1var FF=Object.create;var du=Object.defineProperty,LF=Object.defineProperties,jF=Object.getOwnPropertyDescriptor,BF=Object.getOwnPropertyDescriptors,VF=Object.getOwnPropertyNames,hD=Object.getOwnPropertySymbols,UF=Object.getPrototypeOf,pD=Object.prototype.hasOwnProperty,HF=Object.prototype.propertyIsEnumerable;var fD=(t,n,e)=>n in t?du(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,A=(t,n)=>{for(var e in n||={})pD.call(n,e)&&fD(t,e,n[e]);if(hD)for(var e of hD(n))HF.call(n,e)&&fD(t,e,n[e]);return t},Z=(t,n)=>LF(t,BF(n));var $F=(t,n)=>()=>(t&&(n=t(t=0)),n);var ks=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports),zF=(t,n)=>{for(var e in n)du(t,e,{get:n[e],enumerable:!0})},mD=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of VF(n))!pD.call(t,i)&&i!==e&&du(t,i,{get:()=>n[i],enumerable:!(r=jF(n,i))||r.enumerable});return t};var qF=(t,n,e)=>(e=t!=null?FF(UF(t)):{},mD(n||!t||!t.__esModule?du(e,"default",{value:t,enumerable:!0}):e,t)),hl=t=>mD(du({},"__esModule",{value:!0}),t);var js={};zF(js,{__addDisposableResource:()=>eI,__assign:()=>Mf,__asyncDelegator:()=>GD,__asyncGenerator:()=>Rf,__asyncValues:()=>Of,__await:()=>Si,__awaiter:()=>W,__classPrivateFieldGet:()=>ZD,__classPrivateFieldIn:()=>QD,__classPrivateFieldSet:()=>XD,__createBinding:()=>xf,__decorate:()=>PD,__disposeResources:()=>tI,__esDecorate:()=>LD,__exportStar:()=>$D,__extends:()=>ND,__generator:()=>HD,__importDefault:()=>YD,__importStar:()=>
vendor: 6,616 bytes, line 1
1JD,__makeTemplateObject:()=>KD,__metadata:()=>UD,__param:()=>FD,__propKey:()=>BD,__read:()=>y_,__rest:()=>io,__rewriteRelativeImportExtension:()=>nI,__runInitializers:()=>jD,__setFunctionName:()=>VD,__spread:()=>zD,__spreadArray:()=>WD,__spreadArrays:()=>qD,__values:()=>Af,default:()=>s2});function ND(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");g_(t,n);function e(){this.constructor=t}t.prototype=n===null?Object.create(n):(e.prototype=n.prototype,new e)}function io(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(e[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(e[r[i]]=t[r[i]]);return e}function PD(t,n,e,r){var i=arguments.length,o=i<3?n:r===null?r=Object.getOwnPropertyDescriptor(n,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,n,e,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(i<3?s(o):i>3?s(n,e,o):s(n,e))||o);return i>3&&o&&Object.defineProperty(n,e,o),o}function FD(t,n){return function(e,r){n(e,r,t)}}function LD(t,n,e,r,i,o){function s(w){if(w!==void 0&&typeof w!="function")throw new TypeError("Function expected");return w}for(var a=r.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!n&&t?r.static?t:t.prototype:null,u=n||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),d,f=!1,h=e.length-1;h>=0;h--){var p={};for(var m in r)p[m]=m==="access"?{}:r[m];for(var m in r.access)p.access[m]=r.access[m];p.addInitializer=function(w){if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(w||null))};var g=(0,e[h])(a==="accessor"?{get:u.get,set:u.set}:u[l],p);if(a==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(d=s(g.get))&&(u.get=d),(d=s(g.set))&&(u.set=d),(d=s(g.init))&&i.unshift(d)}else(d=s(g))&&(a==="field"?i.unshift(d):u[l]=d)}c&&Object.defineProperty(c,r.name,u),f=!0}function jD(t,n,e){for(var r=arguments.length>2,i=0;i<n.length;i++)e=r?n[i].call(t,e):n[i].call(t);return r?e:void 0}function BD(t){return typeof t=="symbol"?t:"".concat(t)}function VD(t,n,e){return typeof n=="symbol"&&(n=n.description?"[".concat(n.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:e?"".concat(e," ",n):n})}function UD(t,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,n)}function W(t,n,e,r){function i(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function a(u){try{c(r.next(u))}catch(d){s(d)}}function l(u){try{c(r.throw(u))}catch(d){s(d)}}function c(u){u.done?o(u.value):i(u.value).then(a,l)}c((r=r.apply(t,n||[])).next())})}function HD(t,n){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(e=0)),e;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,i=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){e.label=c[1];break}if(c[0]===6&&e.label<o[1]){e.label=o[1],o=c;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(c);break}o[2]&&e.ops.pop(),e.trys.pop();continue}c=n.call(t,e)}catch(u){c=[6,u],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function $D(t,n){for(var e in t)e!=="default"&&!Object.prototype.hasOwnProperty.call(n,e)&&xf(n,t,e)}function Af(t){var n=typeof Symbol=="function"&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function y_(t,n){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var r=e.call(t),i,o=[],s;try{for(;(n===void 0||n-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(s)throw s.error}}return o}function zD(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(y_(arguments[n]));return t}function qD(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;for(var r=Array(t),i=0,n=0;n<e;n++)for(var o=arguments[n],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function WD(t,n,e){if(e||arguments.length===2)for(var r=0,i=n.length,o;r<i;r++)(o||!(r in n))&&(o||(o=Array.prototype.slice.call(n,0,r)),o[r]=n[r]);return t.concat(o||Array.prototype.slice.call(n))}function Si(t){return this instanceof Si?(this.v=t,this):new Si(t)}function Rf(t,n,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(t,n||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(h){return function(p){return Promise.resolve(p).then(h,d)}}function a(h,p){r[h]&&(i[h]=function(m){return new Promise(function(g,w){o.push([h,m,g,w])>1||l(h,m)})},p&&(i[h]=p(i[h])))}function l(h,p){try{c(r[h](p))}catch(m){f(o[0][3],m)}}function c(h){h.value instanceof Si?Promise.resolve(h.value.v).then(u,d):f(o[0][2],h)}function u(h){l("next",h)}function d(h){l("throw",h)}function f(h,p){h(p),o.shift(),o.length&&l(o[0][0],o[0][1])}}function GD(t){var n,e;return n={},r("next"),r("throw",function(i){throw i}),r("return"),n[Symbol.iterator]=function(){return this},n;function r(i,o){n[i]=t[i]?function(s){return(e=!e)?{value:Si(t[i](s)),done:!1}:o?o(s):s}:o}}function Of(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t[Symbol.asyncIterator],e;return n?n.call(t):(t=typeof Af=="function"?Af(t):t[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(o){e[o]=t[o]&&function(s){return new Promise(function(a,l){s=t[o
vendor: 4,085 bytes, line 1
1](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}}function KD(t,n){return Object.defineProperty?Object.defineProperty(t,"raw",{value:n}):t.raw=n,t}function JD(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var e=v_(t),r=0;r<e.length;r++)e[r]!=="default"&&xf(n,t,e[r]);return i2(n,t),n}function YD(t){return t&&t.__esModule?t:{default:t}}function ZD(t,n,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?t!==n||!r:!n.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(t):r?r.value:n.get(t)}function XD(t,n,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?t!==n||!i:!n.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,e):i?i.value=e:n.set(t,e),e}function QD(t,n){if(n===null||typeof n!="object"&&typeof n!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?n===t:t.has(n)}function eI(t,n,e){if(n!=null){if(typeof n!="object"&&typeof n!="function")throw new TypeError("Object expected.");var r,i;if(e){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=n[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=n[Symbol.dispose],e&&(i=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");i&&(r=function(){try{i.call(this)}catch(o){return Promise.reject(o)}}),t.stack.push({value:n,dispose:r,async:e})}else e&&t.stack.push({async:!0});return n}function tI(t){function n(o){t.error=t.hasError?new o2(o,t.error,"An error was suppressed during disposal."):o,t.hasError=!0}var e,r=0;function i(){for(;e=t.stack.pop();)try{if(!e.async&&r===1)return r=0,t.stack.push(e),Promise.resolve().then(i);if(e.dispose){var o=e.dispose.call(e.value);if(e.async)return r|=2,Promise.resolve(o).then(i,function(s){return n(s),i()})}else r|=1}catch(s){n(s)}if(r===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return i()}function nI(t,n){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,i,o,s){return r?n?".jsx":".js":i&&(!o||!s)?e:i+o+"."+s.toLowerCase()+"js"}):t}var g_,Mf,xf,i2,v_,o2,s2,Ut=$F(()=>{"use strict";g_=function(t,n){return g_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])},g_(t,n)};Mf=function(){return Mf=Object.assign||function(n){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n},Mf.apply(this,arguments)};xf=Object.create?function(t,n,e,r){r===void 0&&(r=e);var i=Object.getOwnPropertyDescriptor(n,e);(!i||("get"in i?!n.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return n[e]}}),Object.defineProperty(t,r,i)}:function(t,n,e,r){r===void 0&&(r=e),t[r]=n[e]};i2=Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n},v_=function(t){return v_=Object.getOwnPropertyNames||function(n){var e=[];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[e.length]=r);return e},v_(t)};o2=typeof SuppressedError=="function"?SuppressedError:function(t,n,e){var r=new Error(e);return r.name="SuppressedError",r.error=t,r.suppressed=n,r};s2={__extends:ND,__assign:Mf,__rest:io,__decorate:PD,__param:FD,__esDecorate:LD,__runInitializers:jD,__propKey:BD,__setFunctionName:VD,__metadata:UD,__awaiter:W,__generator:HD,__createBinding:xf,__exportStar:$D,__values:Af,__read:y_,__spread:zD,__spreadArrays:qD,__spreadArray:WD,__await:Si,__asyncGenerator:Rf,__asyncDelegator:GD,__asyncValues:Of,__makeTemplateOb
1ject:KD,__importStar:JD,__importDefault:YD,__classPrivateFieldGet:ZD,__classPrivateFieldSet:XD,__classPrivateFieldIn:QD,__addDisposableResource:eI,__disposeResources:tI,__rewriteRelativeImportExtension:nI}});var FE=ks(PE=>{"use strict";Object.defineProperty(PE,"__esModule",{value:!0});var NE=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}};PE.default=NE});var BE=ks(jE=>{"use strict";Object.defineProperty(jE,"__esModule",{value:!0});var u5=(Ut(),hl(js)),d5=u5.__importDefault(FE()),LE=class{constructor(n){var e,r;this.shouldThrowOnError=!1,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(e=n.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=n.signal,this.isMaybeSingle=(r=n.isMaybeSingle)!==null&&r!==void 0?r:!1,n.fetch?this.fetch=n.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,e){return this.headers=new Headers(this.headers),this.headers.set(n,e),this}then(n,e){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let r=this.fetch,i=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{var s,a,l,c;let u=null,d=null,f=null,h=o.status,p=o.statusText;if(o.ok){if(this.method!=="HEAD"){let C=await o.text();C===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((s=this.headers.get("Accept"))===null||s===void 0)&&s.includes("application/vnd.pgrst.plan+text"))?d=C:d=JSON.parse(C))}let g=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),w=(l=o.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");g&&w&&w.length>1&&(f=parseInt(w[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,f=null,h=406,p="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let g=await o.text();try{u=JSON.parse(g),Array.isArray(u)&&o.status===404&&(d=[],u=null,h=200,p="OK")}catch{o.status===404&&g===""?(h=204,p="No Content"):u={message:g}}if(u&&this.isMaybeSingle&&(!((c=u?.details)===null||c===void 0)&&c.includes("0 rows"))&&(u=null,h=200,p="OK"),u&&this.shouldThrowOnError)throw new d5.default(u)}return{error:u,data:d,count:f,status:h,statusText:p}});return this.shouldThrowOnError||(i=i.catch(o=>{var s,a,l,c,u,d;let f="",h=o?.cause;if(h){let p=(s=h?.message)!==null&&s!==void 0?s:"",m=(a=h?.code)!==null&&a!==void 0?a:"";f=`${(l=o?.name)!==null&&l!==void 0?l:"FetchError"}: ${o?.message}`,f+=` 2 3Caused by: ${(c=h?.name)!==null&&c!==void 0?c:"Error"}: ${p}`,m&&(f+=` (${m})`),h?.stack&&(f+=` 4${h.stack}`)}else f=(u=o?.stack)!==null&&u!==void 0?u:"";return{error:{message:`${(d=o?.name)!==null&&d!==void 0?d:"FetchError"}: ${o?.message}`,details:f,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),i.then(n,e)}returns(){return this}overrideTypes(){return this}};jE.default=LE});var HE=ks(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});var h5=(Ut(),hl(js)),f5=h5.__importDefault(BE()),VE=class extends f5.default{select(n){let e=!1,r=(n??"*").split("").map(i=>/\s/.test(i)&&!e?"":(i==='"'&&(e=!e),i)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:e=!0,nullsFirst:r,foreignTable:i,referencedTable:o=i}={}){let s=o?`${o}.order`:"order",a=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${a?`${a},`:""}${n}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:e,referencedTable:r=e}={}){let i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${n}`),this}range(n,e,{foreignTable:r,referencedTable:i=r}={}){let o=typeof i>"u"?"offset":`${i}.offset`,s=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(o,`${n}`),this.url.searchParams.set(s,`${e-n+1}`),this}abortSignal(n){return this.signal=n,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
4explain({analyze:n=!1,verbose:e=!1,settings:r=!1,buffers:i=!1,wal:o=!1,format:s="text"}={}){var a;let l=[n?"analyze":null,e?"verbose":null,r?"settings":null,i?"buffers":null,o?"wal":null].filter(Boolean).join("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${c}"; options=${l};`),s==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};UE.default=VE});var gg=ks(zE=>{"use strict";Object.defineProperty(zE,"__esModule",{value:!0});var p5=(Ut(),hl(js)),m5=p5.__importDefault(HE()),g5=new RegExp("[,()]"),$E=class extends m5.default{eq(n,e){return this.url.searchParams.append(n,`eq.${e}`),this}neq(n,e){return this.url.searchParams.append(n,`neq.${e}`),this}gt(n,e){return this.url.searchParams.append(n,`gt.${e}`),this}gte(n,e){return this.url.searchParams.append(n,`gte.${e}`),this}lt(n,e){return this.url.searchParams.append(n,`lt.${e}`),this}lte(n,e){return this.url.searchParams.append(n,`lte.${e}`),this}like(n,e){return this.url.searchParams.append(n,`like.${e}`),this}likeAllOf(n,e){return this.url.searchParams.append(n,`like(all).{${e.join(",")}}`),this}likeAnyOf(n,e){return this.url.searchParams.append(n,`like(any).{${e.join(",")}}`),this}ilike(n,e){return this.url.searchParams.append(n,`ilike.${e}`),this}ilikeAllOf(n,e){return this.url.searchParams.append(n,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(n,e){return this.url.searchParams.append(n,`ilike(any).{${e.join(",")}}`),this}regexMatch(n,e){return this.url.searchParams.append(n,`match.${e}`),this}regexIMatch(n,e){return this.url.searchParams.append(n,`imatch.${e}`),this}is(n,e){return this.url.searchParams.append(n,`is.${e}`),this}isDistinct(n,e){return this.url.searchParams.append(n,`isdistinct.${e}`),this}in(n,e){let r=Array.from(new Set(e)).map(i=>typeof i=="string"&&g5.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(n,`in.(${r})`),this}contains(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cs.{${e.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(e)}`),this}containedBy(n,e){return typeof e=="string"?this.url.searchParams.append(n,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(n,`cd.{${e.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(e)}`),this}rangeGt(n,e){return this.url.searchParams.append(n,`sr.${e}`),this}rangeGte(n,e){return this.url.searchParams.append(n,`nxl.${e}`),this}rangeLt(n,e){return this.url.searchParams.append(n,`sl.${e}`),this}rangeLte(n,e){return this.url.searchParams.append(n,`nxr.${e}`),this}rangeAdjacent(n,e){return this.url.searchParams.append(n,`adj.${e}`),this}overlaps(n,e){return typeof e=="string"?this.url.searchParams.append(n,`ov.${e}`):this.url.searchParams.append(n,`ov.{${e.join(",")}}`),this}textSearch(n,e,{config:r,type:i}={}){let o="";i==="plain"?o="pl":i==="phrase"?o="ph":i==="websearch"&&(o="w");let s=r===void 0?"":`(${r})`;return this.url.searchParams.append(n,`${o}fts${s}.${e}`),this}match(n){return Object.entries(n).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(n,e,r){return this.url.searchParams.append(n,`not.${e}.${r}`),this}or(n,{foreignTable:e,referencedTable:r=e}={}){let i=r?`${r}.or`:"or";return this.url.searchParams.append(i,`(${n})`),this}filter(n,e,r){return this.url.searchParams.append(n,`${e}.${r}`),this}};zE.default=$E});var GE=ks(WE=>{"use strict";Object.defineProperty(WE,"__esModule",{value:!0});var v5=(Ut(),hl(js)),Kd=v5.__importDefault(gg()),qE=class{constructor(n,{headers:e={},schema:r,fetch:i}){this.url=n,this.headers=new Headers(e),this.schema=r,this.fetch=i}select(n,e){let{head:r=!1,count:i}=e??{},o=r?"HEAD":"GET",s=!1,a=(n??"*").split("").map(l=>/\s/.test(l)&&!s?"":(l==='"'&&(s=!s),l)).join("");return this.url.searchParams.set("select",a),i&&this.headers.append("Prefer",`count=${i}`),new Kd.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(n,{count:e,defaultToNull:r=!0}={}){var i;let o="POST";if(e&&this.headers.append("Prefer",`count=${e}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(n)){let s=n.reduce((a,l)=>a.concat(Object.keys(l)),[]);if(s.length>
40){let a=[...new Set(s)].map(l=>`"${l}"`);this.url.searchParams.set("columns",a.join(","))}}return new Kd.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(n,{onConflict:e,ignoreDuplicates:r=!1,count:i,defaultToNull:o=!0}={}){var s;let a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),i&&this.headers.append("Prefer",`count=${i}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(n)){let l=n.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(l.length>0){let c=[...new Set(l)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new Kd.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}update(n,{count:e}={}){var r;let i="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new Kd.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:n}={}){var e;let r="DELETE";return n&&this.headers.append("Prefer",`count=${n}`),new Kd.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}};WE.default=qE});var gx=ks(JE=>{"use strict";Object.defineProperty(JE,"__esModule",{value:!0});var mx=(Ut(),hl(js)),y5=mx.__importDefault(GE()),_5=mx.__importDefault(gg()),KE=class t{constructor(n,{headers:e={},schema:r,fetch:i}={}){this.url=n,this.headers=new Headers(e),this.schemaName=r,this.fetch=i}from(n){if(!n||typeof n!="string"||n.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");let e=new URL(`${this.url}/${n}`);return new y5.default(e,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(n){return new t(this.url,{headers:this.headers,schema:n,fetch:this.fetch})}rpc(n,e={},{head:r=!1,get:i=!1,count:o}={}){var s;let a,l=new URL(`${this.url}/rpc/${n}`),c;r||i?(a=r?"HEAD":"GET",Object.entries(e).filter(([d,f])=>f!==void 0).map(([d,f])=>[d,Array.isArray(f)?`{${f.join(",")}}`:`${f}`]).forEach(([d,f])=>{l.searchParams.append(d,f)})):(a="POST",c=e);let u=new Headers(this.headers);return o&&u.set("Prefer",`count=${o}`),new _5.default({method:a,url:l,headers:u,schema:this.schemaName,body:c,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}};JE.default=KE});var Cx=ks(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.PostgrestError=tr.PostgrestBuilder=tr.PostgrestTransformBuilder=tr.PostgrestFilterBuilder=tr.PostgrestQueryBuilder=tr.PostgrestClient=void 0;var bc=(Ut(),hl(js)),vx=bc.__importDefault(gx());tr.PostgrestClient=vx.default;var yx=bc.__importDefault(GE());tr.PostgrestQueryBuilder=yx.default;var _x=bc.__importDefault(gg());tr.PostgrestFilterBuilder=_x.default;var bx=bc.__importDefault(HE());tr.PostgrestTransformBuilder=bx.default;var wx=bc.__importDefault(BE());tr.PostgrestBuilder=wx.default;var Ex=bc.__importDefault(FE());tr.PostgrestError=Ex.default;tr.default={PostgrestClient:vx.default,PostgrestQueryBuilder:yx.default,PostgrestFilterBuilder:_x.default,PostgrestTransformBuilder:bx.default,PostgrestBuilder:wx.default,PostgrestError:Ex.default}});var Bn=null,vf=!1,Zy=1,WF=null,Gt=Symbol("SIGNAL");function he(t){let n=Bn;return Bn=t,n}function _f(){return Bn}var Ms={version:0,lastCleanEpoch:0,dirty:!1,producers:void 0,producersTail:void 0,consumers:void 0,consumersTail:void 0,recomputing:!1,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,kind:"unknown",producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function As(t){if(vf)throw new Error("");if(Bn===null)return;Bn.consumerOnSignalRead(t);let n=Bn.producersTail;if(n!==void 0&&n.producer===t)return;let e,r=Bn.recomputing;if(r&&(e=n!==void 0?n.nextProducer:Bn.producers,e!==void 0&&e.producer===t)){Bn.producersTail=e,e.lastReadVersion=t.version;return}let i=t.consumersTail;if(i!==void 0&&i.consumer===Bn&&(!r||GF(i,Bn)))return;let o=fl(Bn),s={producer:t,consumer:Bn,nextProducer:e,prevConsumer:i,lastReadVersion:t.version,nextConsumer:void 0};Bn.producersTail=s,n!==void 0?n.nextProducer=s:Bn.producers=s,o&&bD(t,s)}function gD(){Zy++}function Xy(t){if(!(fl(t)&&!t.dirty)&&!(!t.dirty&&t.lastCleanEpoch===Zy)){if(!t.producerMustRecompute(t)&&!Rs(t)){Yy(t);return}t.producerRecomputeValue(t),Yy(t)}}function Qy(t){if(t.consumers===void 0)return;let n=vf;vf=!0;try{for(let e=t.consumers;e!==void 0;e=e.nextConsumer){let r=e.consumer;r.dirty||vD(r)}
vendor: 4,915 bytes, lines 4-6
4}finally{vf=n}}function e_(){return Bn?.consumerAllowSignalWrites!==!1}function vD(t){t.dirty=!0,Qy(t),t.consumerMarkedDirty?.(t)}function Yy(t){t.dirty=!1,t.lastCleanEpoch=Zy}function Ro(t){return t&&yD(t),he(t)}function yD(t){t.producersTail=void 0,t.recomputing=!0}function xs(t,n){he(n),t&&_D(t)}function _D(t){t.recomputing=!1;let n=t.producersTail,e=n!==void 0?n.nextProducer:t.producers;if(e!==void 0){if(fl(t))do e=t_(e);while(e!==void 0);n!==void 0?n.nextProducer=void 0:t.producers=void 0}}function Rs(t){for(let n=t.producers;n!==void 0;n=n.nextProducer){let e=n.producer,r=n.lastReadVersion;if(r!==e.version||(Xy(e),r!==e.version))return!0}return!1}function no(t){if(fl(t)){let n=t.producers;for(;n!==void 0;)n=t_(n)}t.producers=void 0,t.producersTail=void 0,t.consumers=void 0,t.consumersTail=void 0}function bD(t,n){let e=t.consumersTail,r=fl(t);if(e!==void 0?(n.nextConsumer=e.nextConsumer,e.nextConsumer=n):(n.nextConsumer=void 0,t.consumers=n),n.prevConsumer=e,t.consumersTail=n,!r)for(let i=t.producers;i!==void 0;i=i.nextProducer)bD(i.producer,i)}function t_(t){let n=t.producer,e=t.nextProducer,r=t.nextConsumer,i=t.prevConsumer;if(t.nextConsumer=void 0,t.prevConsumer=void 0,r!==void 0?r.prevConsumer=i:n.consumersTail=i,i!==void 0)i.nextConsumer=r;else if(n.consumers=r,!fl(n)){let o=n.producers;for(;o!==void 0;)o=t_(o)}return e}function fl(t){return t.consumerIsAlwaysLive||t.consumers!==void 0}function n_(t){WF?.(t)}function GF(t,n){let e=n.producersTail;if(e!==void 0){let r=n.producers;do{if(r===t)return!0;if(r===e)break;r=r.nextProducer}while(r!==void 0)}return!1}function r_(t,n){return Object.is(t,n)}function Os(t,n){let e=Object.create(KF);e.computation=t,n!==void 0&&(e.equal=n);let r=()=>{if(Xy(e),As(e),e.value===yf)throw e.error;return e.value};return r[Gt]=e,n_(e),r}var Ky=Symbol("UNSET"),Jy=Symbol("COMPUTING"),yf=Symbol("ERRORED"),KF=Z(A({},Ms),{value:Ky,dirty:!0,error:null,equal:r_,kind:"computed",producerMustRecompute(t){return t.value===Ky||t.value===Jy},producerRecomputeValue(t){if(t.value===Jy)throw new Error("");let n=t.value;t.value=Jy;let e=Ro(t),r,i=!1;try{r=t.computation(),he(null),i=n!==Ky&&n!==yf&&r!==yf&&t.equal(n,r)}catch(o){r=yf,t.error=o}finally{xs(t,e)}if(i){t.value=n;return}t.value=r,t.version++}});function JF(){throw new Error}var wD=JF;function ED(t){wD(t)}function i_(t){wD=t}var YF=null;function hu(t,n){let e=Object.create(fu);e.value=t,n!==void 0&&(e.equal=n);let r=()=>CD(e);return r[Gt]=e,n_(e),[r,s=>pl(e,s),s=>SD(e,s)]}function CD(t){return As(t),t.value}function pl(t,n){e_()||ED(t),t.equal(t.value,n)||(t.value=n,ZF(t))}function SD(t,n){e_()||ED(t),pl(t,n(t.value))}var fu=Z(A({},Ms),{equal:r_,value:void 0,kind:"signal"});function ZF(t){t.version++,gD(),Qy(t),YF?.(t)}function o_(t){let n=he(null);try{return t()}finally{he(n)}}var s_=Z(A({},Ms),{consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,dirty:!0,kind:"effect"});function a_(t){if(t.dirty=!1,t.version>0&&!Rs(t))return;t.version++;let n=Ro(t);try{t.cleanup(),t.fn()}finally{xs(t,n)}}function Be(t){return typeof t=="function"}function ml(t){let e=t(r=>{Error.call(r),r.stack=new Error().stack});return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var bf=ml(t=>function(e){t(this),this.message=e?`${e.length} errors occurred during unsubscription: 5${e.map((r,i)=>`${i+1}) ${r.toString()}`).join(` 6 `)}`:"",this.name="UnsubscriptionError",this.errors=e});function Ns(t,n){if(t){let e=t.indexOf(n);0<=e&&t.splice(e,1)}}var St=class t{constructor(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let n;if(!this.closed){this.closed=!0;let{_parentage:e}=this;if(e)if(this._parentage=null,Array.isArray(e))for(let o of e)o.remove(this);else e.remove(this);let{initialTeardown:r}=this;if(Be(r))try{r()}catch(o){n=o instanceof bf?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{DD(o)}catch(s){n=n??[],s instanceof bf?n=[...n,...s.errors]:n.push(s)}}if(n)throw new bf(n)}}add(n){var e;if(n&&n!==this)if(this.closed)DD(n);else{if(n instanceof t){if(n.closed||n._hasParent(this))return;n._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(n)}}_hasParent(n){let{_parentage:e}=this;return e===n||Array.isArray(e)&&e.includes(n)}_addParent(n){let{_parentage:e}=this;this._parentage=Array.isArray(e)?(e.push(n),e):e?[e,n]:n}_removeParent(n){let{_parentage:e}=this;e===n?this._parentage=null:Array.isArray(e)&&Ns(e,n)}remove(n){let{_finalizers:e}=this;e&&Ns(e,n),n instanceof t&&n._removeParent(this)}};St.EMPTY=(()=>{let t=new St;return t.closed=!0,t})();var l_=St.EMPTY;function wf(t){return t instanceof St||t&&"closed"in t&&Be(t.remove)&&Be(t.add)&&Be(t.unsubscribe)}function DD(t){Be(t)?t():t.unsubscribe()}var ri={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNext
vendor: 19,165 bytes, line 6
6Context:!1};var gl={setTimeout(t,n,...e){let{delegate:r}=gl;return r?.setTimeout?r.setTimeout(t,n,...e):setTimeout(t,n,...e)},clearTimeout(t){let{delegate:n}=gl;return(n?.clearTimeout||clearTimeout)(t)},delegate:void 0};function Ef(t){gl.setTimeout(()=>{let{onUnhandledError:n}=ri;if(n)n(t);else throw t})}function Ci(){}var ID=c_("C",void 0,void 0);function TD(t){return c_("E",void 0,t)}function kD(t){return c_("N",t,void 0)}function c_(t,n,e){return{kind:t,value:n,error:e}}var Ps=null;function vl(t){if(ri.useDeprecatedSynchronousErrorHandling){let n=!Ps;if(n&&(Ps={errorThrown:!1,error:null}),t(),n){let{errorThrown:e,error:r}=Ps;if(Ps=null,e)throw r}}else t()}function MD(t){ri.useDeprecatedSynchronousErrorHandling&&Ps&&(Ps.errorThrown=!0,Ps.error=t)}var Fs=class extends St{constructor(n){super(),this.isStopped=!1,n?(this.destination=n,wf(n)&&n.add(this)):this.destination=e2}static create(n,e,r){return new ro(n,e,r)}next(n){this.isStopped?d_(kD(n),this):this._next(n)}error(n){this.isStopped?d_(TD(n),this):(this.isStopped=!0,this._error(n))}complete(){this.isStopped?d_(ID,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(n){this.destination.next(n)}_error(n){try{this.destination.error(n)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},XF=Function.prototype.bind;function u_(t,n){return XF.call(t,n)}var h_=class{constructor(n){this.partialObserver=n}next(n){let{partialObserver:e}=this;if(e.next)try{e.next(n)}catch(r){Cf(r)}}error(n){let{partialObserver:e}=this;if(e.error)try{e.error(n)}catch(r){Cf(r)}else Cf(n)}complete(){let{partialObserver:n}=this;if(n.complete)try{n.complete()}catch(e){Cf(e)}}},ro=class extends Fs{constructor(n,e,r){super();let i;if(Be(n)||!n)i={next:n??void 0,error:e??void 0,complete:r??void 0};else{let o;this&&ri.useDeprecatedNextContext?(o=Object.create(n),o.unsubscribe=()=>this.unsubscribe(),i={next:n.next&&u_(n.next,o),error:n.error&&u_(n.error,o),complete:n.complete&&u_(n.complete,o)}):i=n}this.destination=new h_(i)}};function Cf(t){ri.useDeprecatedSynchronousErrorHandling?MD(t):Ef(t)}function QF(t){throw t}function d_(t,n){let{onStoppedNotification:e}=ri;e&&gl.setTimeout(()=>e(t,n))}var e2={closed:!0,next:Ci,error:QF,complete:Ci};var yl=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Kn(t){return t}function pu(...t){return f_(t)}function f_(t){return t.length===0?Kn:t.length===1?t[0]:function(e){return t.reduce((r,i)=>i(r),e)}}var Ie=(()=>{class t{constructor(e){e&&(this._subscribe=e)}lift(e){let r=new t;return r.source=this,r.operator=e,r}subscribe(e,r,i){let o=n2(e)?e:new ro(e,r,i);return vl(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(e){try{return this._subscribe(e)}catch(r){e.error(r)}}forEach(e,r){return r=AD(r),new r((i,o)=>{let s=new ro({next:a=>{try{e(a)}catch(l){o(l),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)}[yl](){return this}pipe(...e){return f_(e)(this)}toPromise(e){return e=AD(e),new e((r,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>r(o))})}}return t.create=n=>new t(n),t})();function AD(t){var n;return(n=t??ri.Promise)!==null&&n!==void 0?n:Promise}function t2(t){return t&&Be(t.next)&&Be(t.error)&&Be(t.complete)}function n2(t){return t&&t instanceof Fs||t2(t)&&wf(t)}function r2(t){return Be(t?.lift)}function Pe(t){return n=>{if(r2(n))return n.lift(function(e){try{return t(e,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Fe(t,n,e,r,i){return new p_(t,n,e,r,i)}var p_=class extends Fs{constructor(n,e,r,i,o,s){super(n),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=e?function(a){try{e(a)}catch(l){n.error(l)}}:super._next,this._error=i?function(a){try{i(a)}catch(l){n.error(l)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(a){n.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:e}=this;super.unsubscribe(),!e&&((n=this.onFinalize)===null||n===void 0||n.call(this))}}};var xD=ml(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var ve=(()=>{class t extends Ie{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(e){let r=new Sf(this,this);return r.operator=e,r}_throwIfClosed(){if(this.closed)throw new xD}next(e){vl(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let r of this.currentObservers)r.next(e)}})}error(e){vl(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=e;let{observers:r}=this;for(;r.length;)r.shift().error(e)}})}complete(){vl(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:e}=this;for(;e.length;)e.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0}_trySubscribe(e){return this._throwIfClosed(),super._trySubscribe(e)}_subscribe(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)}_innerSubscribe(e){let{hasError:r,isStopped:i,observers:o}=this;return r||i?l_:(this.currentObservers=null,o.push(e),new St(()=>{this.currentObservers=null,Ns(o,e)}))}_checkFinalizedStatuses(e){let{hasError:r,thrownError:i,isStopped:o}=this;r?e.error(i):o&&e.complete()}asObservable(){let e=new Ie;return e.source=this,e}}return t.create=(n,e)=>new Sf(n,e),t})(),Sf=class extends ve{constructor(n,e){super(),this.destination=n,this.source=e}next(n){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.next)===null||r===void 0||r.call(e,n)}error(n){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.error)===null||r===void 0||r.call(e,n)}complete(){var n,e;(e=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||e===void 0||e.call(n)}_subscribe(n){var e,r;return(r=(e=this.source)===null||e===void 0?void 0:e.subscribe(n))!==null&&r!==void 0?r:l_}};var Rt=class extends ve{constructor(n){super(),this._value=n}get value(){return this.getValue()}_subscribe(n){let e=super._subscribe(n);return!e.closed&&n.next(this._value),e}getValue(){let{hasError:n,thrownError:e,_value:r}=this;if(n)throw e;return this._throwIfClosed(),r}next(n){super.next(this._value=n)}};var mu={now(){return(mu.delegate||Date).now()},delegate:void 0};var Ls=class extends ve{constructor(n=1/0,e=1/0,r=mu){super(),this._bufferSize=n,this._windowTime=e,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=e===1/0,this._bufferSize=Math.max(1,n),this._windowTime=Math.max(1,e)}next(n){let{isStopped:e,_buffer:r,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;e||(r.push(n),!i&&r.push(o.now()+s)),this._trimBuffer(),super.next(n)}_subscribe(n){this._throwIfClosed(),this._trimBuffer();let e=this._innerSubscribe(n),{_infiniteTimeWindow:r,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!n.closed;s+=r?1:2)n.next(o[s]);return this._checkFinalizedStatuses(n),e}_trimBuffer(){let{_bufferSize:n,_timestampProvider:e,_buffer:r,_infiniteTimeWindow:i}=this,o=(i?1:2)*n;if(n<1/0&&o<r.length&&r.splice(0,r.length-o),!i){let s=e.now(),a=0;for(let l=1;l<r.length&&r[l]<=s;l+=2)a=l;a&&r.splice(0,a+1)}}};var Df=class extends St{constructor(n,e){super()}schedule(n,e=0){return this}};var gu={setInterval(t,n,...e){let{delegate:r}=gu;return r?.setInterval?r.setInterval(t,n,...e):setInterval(t,n,...e)},clearInterval(t){let{delegate:n}=gu;return(n?.clearInterval||clearInterval)(t)},delegate:void 0};var _l=class extends Df{constructor(n,e){super(n,e),this.scheduler=n,this.work=e,this.pending=!1}schedule(n,e=0){var r;if(this.closed)return this;this.state=n;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,e)),this.pending=!0,this.delay=e,this.id=(r=this.id)!==null&&r!==void 0?r:this.requestAsyncId(o,this.id,e),this}requestAsyncId(n,e,r=0){return gu.setInterval(n.flush.bind(n,this),r)}recycleAsyncId(n,e,r=0){if(r!=null&&this.delay===r&&this.pending===!1)return e;e!=null&&gu.clearInterval(e)}execute(n,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let r=this._execute(n,e);if(r)return r;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(n,e){let r=!1,i;try{this.work(n)}catch(o){r=!0,i=o||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:n,scheduler:e}=this,{actions:r}=e;this.work=this.state=this.scheduler=null,this.pending=!1,Ns(r,this),n!=null&&(this.id=this.recycleAsyncId(e,n,null)),this.delay=null,super.unsubscribe()}}};var bl=class t{constructor(n,e=t.now){this.schedulerActionCtor=n,this.now=e}schedule(n,e=0,r){return new this.schedulerActionCtor(this,n).schedule(r,e)}};bl.now=mu.now;var wl=class extends bl{constructor(n,e=bl.now){super(n,e),this.actions=[],this._active=!1}flush(n){let{actions:e}=this;if(this._active){e.push(n);return}let r;this._active=!0;do if(r=n.execute(n.state,n.delay))break;while(n=e.shift());if(this._active=!1,r){for(;n=e.shift();)n.unsubscribe();throw r}}};var vu=new wl(_l),RD=vu;var If=class extends _l{constructor(n,e){super(n,e),this.scheduler=n,this.work=e}schedule(n,e=0){return e>0?super.schedule(n,e):(this.delay=e,this.state=n,this.scheduler.flush(this),this)}execute(n,e){return e>0||this.closed?super.execute(n,e):this._execute(n,e)}requestAsyncId(n,e,r=0){return r!=null&&r>0||r==null&&this.delay>0?super.requestAsyncId(n,e,r):(n.flush(this),0)}};var Tf=class extends wl{};var m_=new Tf(If);var an=new Ie(t=>t.complete());function kf(t){return t&&Be(t.schedule)}function OD(t){return t[t.length-1]}function El(t){return Be(OD(t))?t.pop():void 0}function Oo(t){return kf(OD(t))?t.pop():void 0}Ut();var Nf=t=>t&&typeof t.length=="number"&&typeof t!="function";function Pf(t){return Be(t?.then)}function Ff(t){return Be(t[yl])}function Lf(t){return Symbol.asyncIterator&&Be(t?.[Symbol.asyncIterator])}function jf(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function a2(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Bf=a2();function Vf(t){return Be(t?.[Bf])}Ut();function Uf(t){return Rf(this,arguments,function*(){let e=t.getReader();try{for(;;){let{value:r,done:i}=yield Si(e.read());if(i)return yield Si(void 0);yield yield Si(r)}}finally{e.releaseLock()}})}function Hf(t){return Be(t?.getReader)}function Dt(t){if(t instanceof Ie)return t;if(t!=null){if(Ff(t))return l2(t);if(Nf(t))return c2(t);if(Pf(t))return u2(t);if(Lf(t))return rI(t);if(Vf(t))return d2(t);if(Hf(t))return h2(t)}throw jf(t)}function l2(t){return new Ie(n=>{let e=t[yl]();if(Be(e.subscribe))return e.subscribe(n);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function c2(t){return new Ie(n=>{for(let e=0;e<t.length&&!n.closed;e++)n.next(t[e]);n.complete()})}function u2(t){return new Ie(n=>{t.then(e=>{n.closed||(n.next(e),n.complete())},e=>n.error(e)).then(null,Ef)})}function d2(t){return new Ie(n=>{for(let e of t)if(n.next(e),n.closed)return;n.complete()})}function rI(t){return new Ie(n=>{f2(t,n).catch(e=>n.error(e))})}function h2(t){return rI(Uf(t))}function f2(t,n){var e,r,i,o;return W(this,void 0,void 0,function*(){try{for(e=Of(t);r=yield e.next(),!r.done;){let s=r.value;if(n.next(s),n.closed)return}}catch(s){i={error:s}}finally{try{r&&!r.done&&(o=e.return)&&(yield o.call(e))}finally{if(i)throw i.error}}n.complete()})}function lr(t,n,e,r=0,i=!1){let o=n.schedule(function(){e(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(o),!i)return o}function Bs(t,n=0){return Pe((e,r)=>{e.subscribe(Fe(r,i=>lr(r,t,()=>r.next(i),n),()=>lr(r,t,()=>r.complete(),n),i=>lr(r,t,()=>r.error(i),n)))})}function $f(t,n=0){return Pe((e,r)=>{r.add(t.schedule(()=>e.subscribe(r),n))})}function iI(t,n){return Dt(t).pipe($f(n),Bs(n))}function oI(t,n){return Dt(t).pipe($f(n),Bs(n))}function sI(t,n){return new Ie(e=>{let r=0;return n.schedule(function(){r===t.length?e.complete():(e.next(t[r++]),e.closed||this.schedule())})})}function aI(t,n){return new Ie(e=>{let r;return lr(e,n,()=>{r=t[Bf](),lr(e,n,()=>{let i,o;try{({value:i,done:o}=r.next())}catch(s){e.error(s);return}o?e.complete():e.next(i)},0,!0)}),()=>Be(r?.return)&&r.return()})}function zf(t,n){if(!t)throw new Error("Iterable cannot be null");return new Ie(e=>{lr(e,n,()=>{let r=t[Symbol.asyncIterator]();lr(e,n,()=>{r.next().then(i=>{i.done?e.complete():e.next(i.value)})},0,!0)})})}function lI(t,n){return zf(Uf(t),n)}function cI(t,n){if(t!=null){if(Ff(t))return iI(t,n);if(Nf(t))return sI(t,n);if(Pf(t))return oI(t,n);if(Lf(t))return zf(t,n);if(Vf(t))return aI(t,n);if(Hf(t))return lI(t,n)}throw jf(t)}function Xe(t,n){return n?cI(t,n):Dt(t)}function fe(...t){let n=Oo(t);return Xe(t,n)}function __(t,n){let e=Be(t)?t:()=>t,r=i=>i.error(e());return new Ie(n?i=>n.schedule(r,0,i):r)}function cr(t){return!!t&&(t instanceof Ie||Be(t.lift)&&Be(t.subscribe))}var Vs=ml(t=>function(){t(this),this.name="EmptyError",this.message="no elements in sequence"});function uI(t){return t instanceof Date&&!isNaN(t)}function te(t,n){return Pe((e,r)=>{let i=0;e.subscribe(Fe(r,o=>{r.next(t.call(n,o,i++))}))})}var{isArray:p2}=Array;function m2(t,n){return p2(n)?t(...n):t(n)}function qf(t){return te(n=>m2(t,n))}var{isArray:g2}=Array,{getPrototypeOf:v2,prototype:y2,keys:_2}=Object;function Wf(t){if(t.length===1){let n=t[0];if(g2(n))return{args:n,keys:null};if(b2(n)){let e=_2(n);return{args:e.map(r=>n[r]),keys:e}}}return{args:t,keys:null}}function b2(t){return t&&typeof t=="object"&&v2(t)===y2}function Gf(t,n){return t.reduce((e,r,i)=>(e[r]=n[i],e),{})}function Cl(...t){let n=Oo(t),e=El(t),{args:r,keys:i}=Wf(t);if(r.length===0)return Xe([],n);let o=new Ie(w2(r,n,i?s=>Gf(i,s):Kn));return e?o.pipe(qf(e)):o}function w2(t,n,e=Kn){return r=>{dI(n,()=>{let{length:i}=t,o=new Array(i),s=i,a=i;for(let l=0;l<i;l++)dI(n,()=>{let c=Xe(t[l],n),u=!1;c.subscribe(Fe(r,d=>{o[l]=d,u||(u=!0,a--),a||r.next(e(o.slice()))},()=>{--s||r.complete()}))},r)},r)}}function dI(t,n,e){t?lr(e,t,n):n()}function hI(t,n,e,r,i,o,s,a){let l=[],c=0,u=0,d=!1,f=()=>{d&&!l.length&&!c&&n.complete()},h=m=>c<r?p(m):l.push(m),p=m=>{o&&n.next(m),c++;let g=!1;Dt(e(m,u++)).subscribe(Fe(n,w=>{i?.(w),o?h(w):n.next(w)},()=>{g=!0},void 0,()=>{if(g)try{for(c--;l.length&&c<r;){let w=l.shift();s?lr(n,s,()=>p(w)):p(w)}f()}catch(w){n.error(w)}}))};return t.subscribe(Fe(n,h,()=>{d=!0,f()})),()=>{a?.()}}function An(t,n,e=1/0){return Be(n)?An((r,i)=>te((o,s)=>n(r,o,i,s))(Dt(t(r,i))),e):(typeof n=="number"&&(e=n),Pe((r,i)=>hI(r,i,t,e)))}function No(t=1/0){return An(Kn,t)}function fI(){return No(1)}function ii(...t){return fI()(Xe(t,Oo(t)))}function Di(t){return new Ie(n=>{Dt(t()).subscribe(n)})}function Us(...t){let n=El(t),{args:e,keys:r}=Wf(t),i=new Ie(o=>{let{length:s}=e;if(!s){o.complete();return}let a=new Array(s),l=s,c=s;for(let u=0;u<s;u++){let d=!1;Dt(e[u]).subscribe(Fe(o,f=>{d||(d=!0,c--),a[u]=f},()=>l--,void 0,()=>{(!l||!d)&&(c||o.next(r?Gf(r,a):a),o.complete())}))}});return n?i.pipe(qf(n)):i}function pI(t=0,n,e=RD){let r=-1;return n!=null&&(kf(n)?e=n:r=n),new Ie(i=>{let o=uI(t)?+t-e.now():t;o<0&&(o=0);let s=0;return e.schedule(function(){i.closed||(i.next(s++),0<=r?this.schedule(void 0,r):i.complete())},o)})}function _t(t,n){return Pe((e,r)=>{let i=0;e.subscribe(Fe(r,o=>t.call(n,o,i++)&&r.next(o)))})}function mI(t){return Pe((n,e)=>{let r=!1,i=null,o=null,s=!1,a=()=>{if(o?.unsubscribe(),o=null,r){r=!1;let c=i;i=null,e.next(c)}s&&e.complete()},l=()=>{o=null,s&&e.complete()};n.subscribe(Fe(e,c=>{r=!0,i=c,o||Dt(t(c)).subscribe(o=Fe(e,a,l))},()=>{s=!0,(!r||!o||o.closed)&&e.complete()}))})}function Kf(t,n=vu){return mI(()=>pI(t,n))}function oo(t){return Pe((n,e)=>{let r=null,i=!1,o;r=n.subscribe(Fe(e,void 0,void 0,s=>{o=Dt(t(s,oo(t)(n))),r?(r.unsubscribe(),r=null,o.subscribe(e)):i=!0})),i&&(r.unsubscribe(),r=null,o.subscribe(e))})}function gI(t,n,e,r,i){return(o,s)=>{let a=e,l=n,c=0;o.subscribe(Fe(s,u=>{let d=c++;l=a?t(l,u,d):(a=!0,u),r&&s.next(l)},i&&(()=>{a&&s.next(l),s.complete()})))}}function Ii(t,n){return Be(n)?An(t,n,1):An(t,1)}function b_(t,n=vu){return Pe((e,r)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let c=o;o=null,r.next(c)}};function l(){let c=s+t,u=n.now();if(u<c){i=this.schedule(void 0,c-u),r.add(i);return}a()}e.subscribe(Fe(r,c=>{o=c,s=n.now(),i||(i=n.schedule(l,t),r.add(i))},()=>{a(),r.complete()},void 0,()=>{o=i=null}))})}function w_(t){return Pe((n,e)=>{let r=!1;n.subscribe(Fe(e,i=>{r=!0,e.next(i)},()=>{r||e.next(t),e.complete()}))})}function It(t){return t<=0?()=>an:Pe((n,e)=>{let r=0;n.subscribe(Fe(e,i=>{++r<=t&&(e.next(i),t<=r&&e.complete())}))})}function so(t,n=Kn){return t=t??E2,Pe((e,r)=>{let i,o=!0;e.subscribe(Fe(r,s=>{let a=n(s);(o||!t(i,a))&&(o=!1,i=a,r.next(s))}))})}function E2(t,n){return t===n}function vI(t=C2){return Pe((n,e)=>{let r=!1;n.subscribe(Fe(e,i=>{r=!0,e.next(i)},()=>r?e.complete():e.error(t())))})}function C2(){return new Vs}function yu(t){return Pe((n,e)=>{try{n.subscribe(e)}finally{e.add(t)}})}function ao(t,n){let e=arguments.length>=2;return r=>r.pipe(t?_t((i,o)=>t(i,o,r)):Kn,It(1),e?w_(n):vI(()=>new Vs))}function Jf(t){return t<=0?()=>an:Pe((n,e)=>{let r=[];n.subscribe(Fe(e,i=>{r.push(i),t<r.length&&r.shift()},()=>{for(let i of r)e.next(i);e.complete()},void 0,()=>{r=null}))})}function E_(...t){let n=t.length;if(n===0)throw new Error("list of properties cannot be empty.");return te(e=>{let r=e;for(let i=0;i<n;i++){let o=r?.[t[i]];if(typeof o<"u")r=o;else return}return r})}function Yf(t,n){return Pe(gI(t,n,arguments.length>=2,!0))}function yI(t={}){let{connector:n=()=>new ve,resetOnError:e=!0,resetOnComplete:r=!0,resetOnRefCountZero:i=!0}=t;return o=>{let s,a,l,c=0,u=!1,d=!1,f=()=>{a?.unsubscribe(),a=void 0},h=()=>{f(),s=l=void 0,u=d=!1},p=()=>{let m=s;h(),m?.unsubscribe()};return Pe((m,g)=>{c++,!d&&!u&&f();let w=l=l??n();g.add(()=>{c--,c===0&&!d&&!u&&(a=C_(p,i))}),w.subscribe(g),!s&&c>0&&(s=new ro({next:C=>w.next(C),error:C=>{d=!0,f(),a=C_(h,e,C),w.error(C)},complete:()=>{u=!0,f(),a=C_(h,r),w.complete()}}),Dt(m).subscribe(s))})(o)}}function C_(t,n,...e){if(n===!0){t();return}if(n===!1)return;let r=new ro({next:()=>{r.unsubscribe(),t()}});return Dt(n(...e)).subscribe(r)}function _u(t,n,e){let r,i=!1;return t&&typeof t=="object"?{bufferSize:r=1/0,windowTime:n=1/0,refCount:i=!1,scheduler:e}=t:r=t??1/0,yI({connector:()=>new Ls(r,n,e),resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:i})}function bu(t){return _t((n,e)=>t<=e)}function Po(...t){let n=Oo(t);return Pe((e,r)=>
vendor: 9,446 bytes, lines 6-7
6{(n?ii(t,e,n):ii(t,e)).subscribe(r)})}function Tt(t,n){return Pe((e,r)=>{let i=null,o=0,s=!1,a=()=>s&&!i&&r.complete();e.subscribe(Fe(r,l=>{i?.unsubscribe();let c=0,u=o++;Dt(t(l,u)).subscribe(i=Fe(r,d=>r.next(n?n(l,d,u,c++):d),()=>{i=null,a()}))},()=>{s=!0,a()}))})}function xr(t){return Pe((n,e)=>{Dt(t).subscribe(Fe(e,()=>e.complete(),Ci)),!e.closed&&n.subscribe(e)})}function S_(t,n=!1){return Pe((e,r)=>{let i=0;e.subscribe(Fe(r,o=>{let s=t(o,i++);(s||n)&&r.next(o),!s&&r.complete()}))})}function Kt(t,n,e){let r=Be(t)||n||e?{next:t,error:n,complete:e}:t;return r?Pe((i,o)=>{var s;(s=r.subscribe)===null||s===void 0||s.call(r);let a=!0;i.subscribe(Fe(o,l=>{var c;(c=r.next)===null||c===void 0||c.call(r,l),o.next(l)},()=>{var l;a=!1,(l=r.complete)===null||l===void 0||l.call(r),o.complete()},l=>{var c;a=!1,(c=r.error)===null||c===void 0||c.call(r,l),o.error(l)},()=>{var l,c;a&&((l=r.unsubscribe)===null||l===void 0||l.call(r)),(c=r.finalize)===null||c===void 0||c.call(r)}))}):Kn}function D_(...t){let n=El(t);return Pe((e,r)=>{let i=t.length,o=new Array(i),s=t.map(()=>!1),a=!1;for(let l=0;l<i;l++)Dt(t[l]).subscribe(Fe(r,c=>{o[l]=c,!a&&!s[l]&&(s[l]=!0,(a=s.every(Kn))&&(s=null))},Ci));e.subscribe(Fe(r,l=>{if(a){let c=[l,...o];r.next(n?n(...c):c)}}))})}var I_;function Zf(){return I_}function Ti(t){let n=I_;return I_=t,n}var _I=Symbol("NotFound");function Sl(t){return t===_I||t?.name==="\u0275NotFound"}var ip="https://angular.dev/best-practices/security#preventing-cross-site-scripting-xss",z=class extends Error{code;constructor(n,e){super(oi(n,e)),this.code=n}};function S2(t){return`NG0${Math.abs(t)}`}function oi(t,n){return`${S2(t)}${n?": "+n:""}`}var uo=globalThis;function pt(t){for(let n in t)if(t[n]===pt)return n;throw Error("")}function SI(t,n){for(let e in n)n.hasOwnProperty(e)&&!t.hasOwnProperty(e)&&(t[e]=n[e])}function co(t){if(typeof t=="string")return t;if(Array.isArray(t))return`[${t.map(co).join(", ")}]`;if(t==null)return""+t;let n=t.overriddenName||t.name;if(n)return`${n}`;let e=t.toString();if(e==null)return""+e;let r=e.indexOf(` 7`);return r>=0?e.slice(0,r):e}function op(t,n){return t?n?`${t} ${n}`:t:n||""}var D2=pt({__forward_ref__:pt});function Rr(t){return t.__forward_ref__=Rr,t.toString=function(){return co(this())},t}function gn(t){return V_(t)?t():t}function V_(t){return typeof t=="function"&&t.hasOwnProperty(D2)&&t.__forward_ref__===Rr}function O(t){return{token:t.token,providedIn:t.providedIn||null,factory:t.factory,value:void 0}}function mt(t){return{providers:t.providers||[],imports:t.imports||[]}}function Tu(t){return I2(t,sp)}function U_(t){return Tu(t)!==null}function I2(t,n){return t.hasOwnProperty(n)&&t[n]||null}function T2(t){let n=t?.[sp]??null;return n||null}function k_(t){return t&&t.hasOwnProperty(Qf)?t[Qf]:null}var sp=pt({\u0275prov:pt}),Qf=pt({\u0275inj:pt}),P=class{_desc;ngMetadataName="InjectionToken";\u0275prov;constructor(n,e){this._desc=n,this.\u0275prov=void 0,typeof e=="number"?this.__NG_ELEMENT_ID__=e:e!==void 0&&(this.\u0275prov=O({token:this,providedIn:e.providedIn||"root",factory:e.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}};function H_(t){return t&&!!t.\u0275providers}var $_=pt({\u0275cmp:pt}),z_=pt({\u0275dir:pt}),q_=pt({\u0275pipe:pt}),W_=pt({\u0275mod:pt}),Eu=pt({\u0275fac:pt}),Ws=pt({__NG_ELEMENT_ID__:pt}),bI=pt({__NG_ENV_ID__:pt});function Il(t){return typeof t=="string"?t:t==null?"":String(t)}function DI(t){return typeof t=="function"?t.name||t.toString():typeof t=="object"&&t!=null&&typeof t.type=="function"?t.type.name||t.type.toString():Il(t)}var II=pt({ngErrorCode:pt}),k2=pt({ngErrorMessage:pt}),M2=pt({ngTokenPath:pt});function G_(t,n){return TI("",-200,n)}function ap(t,n){throw new z(-201,!1)}function TI(t,n,e){let r=new z(n,t);return r[II]=n,r[k2]=t,e&&(r[M2]=e),r}function A2(t){return t[II]}var M_;function kI(){return M_}function Jn(t){let n=M_;return M_=t,n}function K_(t,n,e){let r=Tu(t);if(r&&r.providedIn=="root")return r.value===void 0?r.value=r.factory():r.value;if(e&8)return null;if(n!==void 0)return n;ap(t,"Injector")}var x2={},Hs=x2,A_="__NG_DI_FLAG__",x_=class{injector;constructor(n){this.injector=n}retrieve(n,e){let r=$s(e)||0;try{return this.injector.get(n,r&8?null:Hs,r)}catch(i){if(Sl(i))return i;throw i}}};function R2(t,n=0){let e=Zf();if(e===void 0)throw new z(-203,!1);if(e===null)return K_(t,void 0,n);{let r=O2(n),i=e.retrieve(t,r);if(Sl(i)){if(r.optional)return null;throw i}return i}}function Q(t,n=0){return(kI()||R2)(gn(t),n)}function y(t,n){return Q(t,$s(n))}function $s(t){return typeof t>"u"||typeof t=="number"?t:0|(t.optional&&8)|(t.host&&1)|(t.self&&2)|(t.skipSelf&&4)}function O2(t){return{optional:!!(t&8),host:!!(t&1),self:!!(t&2),skipSelf:!!(t&4)}}function R_(t){let n=[];for(let e=0;e<t.length;e++){let r=gn(t[e]);if(Array.isArray(r)){if(r.length===0)throw new z(900,!1);let i,o=0;for(let s=0;s<r.length;s++){let a=r[s],l=N2(a);typeof l=="number"?l===-1?i=a.token:o|=l:i=a}n.push(Q(i,o))}else n.push(Q(r))}return n}function MI(t,n){return t[A_]=n,t.prototype[A_]=n,t}function N2(t){return t[A_]}function Fo(t,n){let e=t.hasOwnProperty(Eu);return e?t[Eu]:null}function AI(t,n,e){if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++){let i=t[r],o=n[r];if(e&&(i=e(i),o=e(o)),o!==i)return!1}return!0}function xI(t){return t.flat(Number.POSITIVE_INFINITY)}function lp(t,n){t.forEach(e=>Array.isArray(e)?lp(e,n):n(e))}function J_(t,n,e){n>=t.length?t.push(e):t.splice(n,0,e)}function ku(t,n){return n>=t.length-1?t.pop():t.splice(n,1)[0]}function RI(t,n){let e=[];for(let r=0;r<t;r++)e.push(n);return e}function OI(t,n,e,r){let i=t.length;if(i==n)t.push(e,r);else if(i===1)t.push(r,t[0]),t[0]=e;else{for(i--,t.push(t[i-1],t[i]);i>n;){let o=i-2;t[i]=t[o],i--}t[n]=e,t[n+1]=r}}function cp(t,n,e){let r=Tl(t,n);return r>=0?t[r|1]=e:(r=~r,OI(t,r,n,e)),r}function up(t,n){let e=Tl(t,n);if(e>=0)return t[e|1]}function Tl(t,n){return P2(t,n,1)}function P2(t,n,e){let r=0,i=t.length>>e;for(;i!==r;){let o=r+(i-r>>1),s=t[o<<e];if(n===s)return o<<e;s>n?i=o:r=o+1}return~(i<<e)}var si={},Vn=[],Gs=new P(""),Y_=new P("",-1),Z_=new P(""),Cu=class{get(n,e=Hs){if(e===Hs){let i=TI("",-201);throw i.name="\u0275NotFound",i}return e}};function X_(t){return t[W_]||null}function Mi(t){return t[$_]||null}function dp(t){return t[z_]||null}function NI(t){return t[q_]||null}function Or(t){return{\u0275providers:t}}function Mu(t){return Or([{provide:Gs,multi:!0,useValue:t}])}function PI(...t){return{\u0275providers:Q_(!0,t),\u0275fromNgModule:!0}}function Q_(t,...n){let e=[],r=new Set,i,o=s=>{e.push(s)};return lp(n,s=>{let a=s;ep(a,o,[],r)&&(i||=[],i.push(a))}),i!==void 0&&FI(i,o),e}function FI(t,n){for(let e=0;e<t.length;e++){let{ngModule:r,providers:i}=t[e];e0(i,o=>{n(o,r)})}}function ep(t,n,e,r){if(t=gn(t),!t)return!1;let i=null,o=k_(t),s=!o&&Mi(t);if(!o&&!s){let l=t.ngModule;if(o=k_(l),o)i=l;else return!1}else{if(s&&!s.standalone)return!1;i=t}let a=r.has(i);if(s){if(a)return!1;if(r.add(i),s.dependencies){let l=typeof s.dependencies=="function"?s.dependencies():s.dependencies;for(let c of l)ep(c,n,e,r)}}else if(o){if(o.imports!=null&&!a){r.add(i);let c;try{lp(o.imports,u=>{ep(u,n,e,r)&&(c||=[],c.push(u))})}finally{}c!==void 0&&FI(c,n)}if(!a){let c=Fo(i)||(()=>new i);n({provide:i,useFactory:c,deps:Vn},i),n({provide:Z_,useValue:i,multi:!0},i),n({provide:Gs,useValue:()=>Q(i),multi:!0},i)}let l=o.providers;if(l!=null&&!a){let c=t;e0(l,u=>{n(u,c)})}}else return!1;return i!==t&&t.providers!==void 0}function e0(t,n){for(let e of t)H_(e)&&(e=e.\u0275providers),Array.isArray(e)?e0(e,n):n(e)}var F2=pt({provide:String,useValue:pt});function LI(t){return t!==null&&typeof t=="object"&&F2 in t}function L2(t){return!!(t&&t.useExisting)}function j2(t){return!!(t&&t.useFactory)}function zs(t){return typeof t=="function"}function jI(t){return!!t.useClass}var Au=new P(""),Xf={},wI={},T_;function kl(){return T_===void 0&&(T_=new Cu),T_}var kt=class{},qs=class extends kt{parent;source;scopes;records=new Map;_ngOnDestroyHooks=new Set;_onDestroyHooks=[];get destroyed(){return this._destroyed}_destroyed=!1;injectorDefTypes;constructor(n,e,r,i){super(),this.parent=e,this.source=r,this.scopes=i,N_(n,s=>this.processProvider(s)),this.records.set(Y_,Dl(void 0,this)),i.has("environment")&&this.records.set(kt,Dl(void 0,this));let o=this.records.get(Au);o!=null&&typeof o.value=="string"&&this.scopes.add(o.value),this.injectorDefTypes=new Set(this.get(Z_,Vn,{self:!0}))}retrieve(n,e){let r=$s(e)||0;try{return this.get(n,Hs,r)}catch(i){if(Sl(i))return i;throw i}}destroy(){wu(this),this._destroyed=!0;let n=he(null);try{for(let r of this._ngOnDestroyHooks)r.ngOnDestroy();let e=this._onDestroyHooks;this._onDestroyHooks=[];for(let r of e)r()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),he(n)}}onDestroy(n){return wu(this),this._onDestroyHooks.push(n),()=>this.removeOnDestroy(n)}runInContext(n){wu(this);let e=Ti(this),r=Jn(void 0),i;try{return n()}finally{Ti(e),Jn(r)}}get(n,e=Hs,r){if(wu(this),n.hasOwnProperty(bI))return n[bI](this);let i=$s(r),o,s=Ti(this),a=Jn(void 0);try{if(!(i&4)){let c=this.records.get(n);if(c===void 0){let u=$2(n)&&Tu(n);u&&this.injectableDefInScope(u)?c=Dl(O_(n),Xf):c=null,this.records.set(n,c)}if(c!=null)return this.hydrate(n,c,i)}let l=i&2?kl():this.parent;return e=i&8&&e===Hs?null:e,l.get(n,e)}catch(l){let c=A2(l);throw c===-200||c===-201?new z(c,null):l}finally{Jn(a),Ti(s)}}
vendor: 4,445 bytes, line 7
7resolveInjectorInitializers(){let n=he(null),e=Ti(this),r=Jn(void 0),i;try{let o=this.get(Gs,Vn,{self:!0});for(let s of o)s()}finally{Ti(e),Jn(r),he(n)}}toString(){let n=[],e=this.records;for(let r of e.keys())n.push(co(r));return`R3Injector[${n.join(", ")}]`}processProvider(n){n=gn(n);let e=zs(n)?n:gn(n&&n.provide),r=V2(n);if(!zs(n)&&n.multi===!0){let i=this.records.get(e);i||(i=Dl(void 0,Xf,!0),i.factory=()=>R_(i.multi),this.records.set(e,i)),e=n,i.multi.push(n)}this.records.set(e,r)}hydrate(n,e,r){let i=he(null);try{if(e.value===wI)throw G_(co(n));return e.value===Xf&&(e.value=wI,e.value=e.factory(void 0,r)),typeof e.value=="object"&&e.value&&H2(e.value)&&this._ngOnDestroyHooks.add(e.value),e.value}finally{he(i)}}injectableDefInScope(n){if(!n.providedIn)return!1;let e=gn(n.providedIn);return typeof e=="string"?e==="any"||this.scopes.has(e):this.injectorDefTypes.has(e)}removeOnDestroy(n){let e=this._onDestroyHooks.indexOf(n);e!==-1&&this._onDestroyHooks.splice(e,1)}};function O_(t){let n=Tu(t),e=n!==null?n.factory:Fo(t);if(e!==null)return e;if(t instanceof P)throw new z(204,!1);if(t instanceof Function)return B2(t);throw new z(204,!1)}function B2(t){if(t.length>0)throw new z(204,!1);let e=T2(t);return e!==null?()=>e.factory(t):()=>new t}function V2(t){if(LI(t))return Dl(void 0,t.useValue);{let n=t0(t);return Dl(n,Xf)}}function t0(t,n,e){let r;if(zs(t)){let i=gn(t);return Fo(i)||O_(i)}else if(LI(t))r=()=>gn(t.useValue);else if(j2(t))r=()=>t.useFactory(...R_(t.deps||[]));else if(L2(t))r=(i,o)=>Q(gn(t.useExisting),o!==void 0&&o&8?8:void 0);else{let i=gn(t&&(t.useClass||t.provide));if(U2(t))r=()=>new i(...R_(t.deps));else return Fo(i)||O_(i)}return r}function wu(t){if(t.destroyed)throw new z(205,!1)}function Dl(t,n,e=!1){return{factory:t,value:n,multi:e?[]:void 0}}function U2(t){return!!t.deps}function H2(t){return t!==null&&typeof t=="object"&&typeof t.ngOnDestroy=="function"}function $2(t){return typeof t=="function"||typeof t=="object"&&t.ngMetadataName==="InjectionToken"}function N_(t,n){for(let e of t)Array.isArray(e)?N_(e,n):e&&H_(e)?N_(e.\u0275providers,n):n(e)}function Dn(t,n){let e;t instanceof qs?(wu(t),e=t):e=new x_(t);let r,i=Ti(e),o=Jn(void 0);try{return n()}finally{Ti(i),Jn(o)}}function BI(){return kI()!==void 0||Zf()!=null}var ai=0,pe=1,xe=2,vn=3,Nr=4,Yn=5,Ks=6,Ml=7,tn=8,ho=9,Ai=10,Ot=11,Al=12,n0=13,Js=14,Zn=15,Bo=16,Ys=17,xi=18,xu=19,r0=20,lo=21,hp=22,Lo=23,yr=24,Zs=25,Xs=26,Mt=27,VI=1,i0=6,Vo=7,Ru=8,Qs=9,Zt=10;function Ri(t){return Array.isArray(t)&&typeof t[VI]=="object"}function li(t){return Array.isArray(t)&&t[VI]===!0}function o0(t){return(t.flags&4)!==0}function Uo(t){return t.componentOffset>-1}function xl(t){return(t.flags&1)===1}function ci(t){return!!t.template}function Rl(t){return(t[xe]&512)!==0}function ea(t){return(t[xe]&256)===256}var s0="svg",UI="math";function Pr(t){for(;Array.isArray(t);)t=t[ai];return t}function a0(t,n){return Pr(n[t])}function ui(t,n){return Pr(n[t.index])}function Ou(t,n){return t.data[n]}function Nu(t,n){return t[n]}function Pu(t,n,e,r){e>=t.data.length&&(t.data[e]=null,t.blueprint[e]=null),n[e]=r}function Fr(t,n){let e=n[t];return Ri(e)?e:e[ai]}function HI(t){return(t[xe]&4)===4}function fp(t){return(t[xe]&128)===128}function $I(t){return li(t[vn])}function Lr(t,n){return n==null?null:t[n]}function l0(t){t[Ys]=0}function c0(t){t[xe]&1024||(t[xe]|=1024,fp(t)&&ta(t))}function zI(t,n){for(;t>0;)n=n[Js],t--;return n}function Fu(t){return!!(t[xe]&9216||t[yr]?.dirty)}function pp(t){t[Ai].changeDetectionScheduler?.notify(8),t[xe]&64&&(t[xe]|=1024),Fu(t)&&ta(t)}function ta(t){t[Ai].changeDetectionScheduler?.notify(0);let n=jo(t);for(;n!==null&&!(n[xe]&8192||(n[xe]|=8192,!fp(n)));)n=jo(n)}function u0(t,n){if(ea(t))throw new z(911,!1);t[lo]===null&&(t[lo]=[]),t[lo].push(n)}function qI(t,n){if(t[lo]===null)return;let e=t[lo].indexOf(n);e!==-1&&t[lo].splice(e,1)}function jo(t){let n=t[vn];return li(n)?n[vn]:n}function d0(t){return t[Ml]??=[]}function h0(t){return t.cleanup??=[]}function WI(t,n,e,r){let i=d0(n);i.push(e),t.firstCreatePass&&h0(t).push(r,i.length-1)}var He={lFrame:n1(null),bindingsEnabled:!0,skipHydrationRootTNode:null};var P_=!1;function GI(){return He.lFrame.elementDepthCount}function KI(){He.lFrame.elementDepthCount++}function f0(){He.lFrame.elementDepthCount--}function mp(){return He.bindingsEnabled}function p0(){return He.skipHydrationRootTNode!==null}function m0(t){return He.skipHydrationRootTNode===t}
vendor: 5,779 bytes, line 7
7function g0(){He.skipHydrationRootTNode=null}function de(){return He.lFrame.lView}function Ht(){return He.lFrame.tView}function gt(t){return He.lFrame.contextLView=t,t[tn]}function vt(t){return He.lFrame.contextLView=null,t}function In(){let t=v0();for(;t!==null&&t.type===64;)t=t.parent;return t}function v0(){return He.lFrame.currentTNode}function JI(){let t=He.lFrame,n=t.currentTNode;return t.isParent?n:n.parent}function na(t,n){let e=He.lFrame;e.currentTNode=t,e.isParent=n}function y0(){return He.lFrame.isParent}function _0(){He.lFrame.isParent=!1}function b0(){return He.lFrame.contextLView}function w0(){return P_}function Su(t){let n=P_;return P_=t,n}function Ho(){let t=He.lFrame,n=t.bindingRootIndex;return n===-1&&(n=t.bindingRootIndex=t.tView.bindingStartIndex),n}function YI(t){return He.lFrame.bindingIndex=t}function ra(){return He.lFrame.bindingIndex++}function E0(t){let n=He.lFrame,e=n.bindingIndex;return n.bindingIndex=n.bindingIndex+t,e}function ZI(){return He.lFrame.inI18n}function XI(t,n){let e=He.lFrame;e.bindingIndex=e.bindingRootIndex=t,gp(n)}function QI(){return He.lFrame.currentDirectiveIndex}function gp(t){He.lFrame.currentDirectiveIndex=t}function e1(t){let n=He.lFrame.currentDirectiveIndex;return n===-1?null:t[n]}function vp(){return He.lFrame.currentQueryIndex}function Lu(t){He.lFrame.currentQueryIndex=t}function z2(t){let n=t[pe];return n.type===2?n.declTNode:n.type===1?t[Yn]:null}function C0(t,n,e){if(e&4){let i=n,o=t;for(;i=i.parent,i===null&&!(e&1);)if(i=z2(o),i===null||(o=o[Js],i.type&10))break;if(i===null)return!1;n=i,t=o}let r=He.lFrame=t1();return r.currentTNode=n,r.lView=t,!0}function yp(t){let n=t1(),e=t[pe];He.lFrame=n,n.currentTNode=e.firstChild,n.lView=t,n.tView=e,n.contextLView=t,n.bindingIndex=e.bindingStartIndex,n.inI18n=!1}function t1(){let t=He.lFrame,n=t===null?null:t.child;return n===null?n1(t):n}function n1(t){let n={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:t,child:null,inI18n:!1};return t!==null&&(t.child=n),n}function r1(){let t=He.lFrame;return He.lFrame=t.parent,t.currentTNode=null,t.lView=null,t}var S0=r1;function _p(){let t=r1();t.isParent=!0,t.tView=null,t.selectedIndex=-1,t.contextLView=null,t.elementDepthCount=0,t.currentDirectiveIndex=-1,t.currentNamespace=null,t.bindingRootIndex=-1,t.bindingIndex=-1,t.currentQueryIndex=0}function i1(t){return(He.lFrame.contextLView=zI(t,He.lFrame.contextLView))[tn]}function Oi(){return He.lFrame.selectedIndex}function $o(t){He.lFrame.selectedIndex=t}function D0(){let t=He.lFrame;return Ou(t.tView,t.selectedIndex)}function zo(){He.lFrame.currentNamespace=s0}function Ol(){q2()}function q2(){He.lFrame.currentNamespace=null}function o1(){return He.lFrame.currentNamespace}var s1=!0;function bp(){return s1}function ju(t){s1=t}function F_(t,n=null,e=null,r){let i=I0(t,n,e,r);return i.resolveInjectorInitializers(),i}function I0(t,n=null,e=null,r,i=new Set){let o=[e||Vn,PI(t)];return r=r||(typeof t=="object"?void 0:co(t)),new qs(o,n||kl(),r||null,i)}var Re=class t{static THROW_IF_NOT_FOUND=Hs;static NULL=new Cu;static create(n,e){if(Array.isArray(n))return F_({name:""},e,n,"");{let r=n.name??"";return F_({name:r},n.parent,n.providers,r)}}static \u0275prov=O({token:t,providedIn:"any",factory:()=>Q(Y_)});static __NG_ELEMENT_ID__=-1},Ve=new P(""),Ye=(()=>{class t{static __NG_ELEMENT_ID__=W2;static __NG_ENV_ID__=e=>e}return t})(),tp=class extends Ye{_lView;constructor(n){super(),this._lView=n}get destroyed(){return ea(this._lView)}onDestroy(n){let e=this._lView;return u0(e,n),()=>qI(e,n)}};function W2(){return new tp(de())}var a1=!1,fo=(()=>{class t{taskId=0;pendingTasks=new Set;destroyed=!1;pendingTask=new Rt(!1);get hasPendingTasks(){return this.destroyed?!1:this.pendingTask.value}get hasPendingTasksObservable(){return this.destroyed?new Ie(e=>{e.next(!1),e.complete()}):this.pendingTask}add(){!this.hasPendingTasks&&!this.destroyed&&this.pendingTask.next(!0);let e=this.taskId++;return this.pendingTasks.add(e),e}has(e){return this.pendingTasks.has(e)}remove(e){this.pendingTasks.delete(e),this.pendingTasks.size===0&&this.hasPendingTasks&&this.pendingTask.next(!1)}ngOnDestroy(){this.pendingTasks.clear(),this.hasPendingTasks&&this.pendingTask.next(!1),this.destroyed=!0,this.pendingTask.unsubscribe()}static \u0275prov=O({token:t,providedIn:"root",factory:()=>new t})}return t})(),L_=class extends ve{__isAsync;destroyRef=void 0;pendingTasks=void 0;constructor(n=!1){super(),this.__isAsync=n,BI()&&(this.destroyRef=y(Ye,{optional:!0})??void 0,this.pendingTasks=y(fo,{optional:!0})??void 0)}emit(n){let e=he(null);try{super.next(n)}finally{he(e)}}subscribe(n,e,r){let i=n,o=e||(()=>null),s=r;if(n&&typeof n=="object"){let l=n;i=l.next?.bind(l),o=l.error?.bind(l),s=l.complete?.bind(l)}this.__isAsync&&(o=this.wrapInTimeout(o),i&&(i=this.wrapInTimeout(i)),s&&(s=this.wrapInTimeout(s)));let a=super.subscribe({next:i,error:o,complete:s});return n instanceof St&&n.add(a),a}wrapInTimeout(n){return e=>{let r=this.pendingTasks?.add();setTimeout(()=>{try{n(e)}finally{r!==void 0&&this.pendingTasks?.remove(r)}})}}},tt=L_;function np(...t){}function T0(t){let n,e;function r(){t=np;try{e!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(e),n!==void 0&&clearTimeout(n)}catch{}}return n=setTimeout(()=>{t(),r()}),typeof requestAnimationFrame=="function"&&(e=requestAnimationFrame(()=>{t(),r()})),()=>r()}function k0(t){return queueMicrotask(()=>t()),()=>{t=np}}var M0="isAngularZone",Du=M0+"_ID",G2=0,Ke=class t{hasPendingMacrotasks=!1;hasPendingMicrotasks=!1;isStable=!0;onUnstable=new tt(!1);onMicrotaskEmpty=new tt(!1);onStable=new tt(!1);
7onError=new tt(!1);constructor(n){let{enableLongStackTrace:e=!1,shouldCoalesceEventChangeDetection:r=!1,shouldCoalesceRunChangeDetection:i=!1,scheduleInRootZone:o=a1}=n;if(typeof Zone>"u")throw new z(908,!1);Zone.assertZonePatched();let s=this;s._nesting=0,s._outer=s._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(s._inner=s._inner.fork(new Zone.TaskTrackingZoneSpec)),e&&Zone.longStackTraceZoneSpec&&(s._inner=s._inner.fork(Zone.longStackTraceZoneSpec)),s.shouldCoalesceEventChangeDetection=!i&&r,s.shouldCoalesceRunChangeDetection=i,s.callbackScheduled=!1,s.scheduleInRootZone=o,Y2(s)}static isInAngularZone(){return typeof Zone<"u"&&Zone.current.get(M0)===!0}static assertInAngularZone(){if(!t.isInAngularZone())throw new z(909,!1)}static assertNotInAngularZone(){if(t.isInAngularZone())throw new z(909,!1)}run(n,e,r){return this._inner.run(n,e,r)}runTask(n,e,r,i){let o=this._inner,s=o.scheduleEventTask("NgZoneEvent: "+i,n,K2,np,np);try{return o.runTask(s,e,r)}finally{o.cancelTask(s)}}runGuarded(n,e,r){return this._inner.runGuarded(n,e,r)}runOutsideAngular(n){return this._outer.run(n)}},K2={};function A0(t){if(t._nesting==0&&!t.hasPendingMicrotasks&&!t.isStable)try{t._nesting++,t.onMicrotaskEmpty.emit(null)}finally{if(t._nesting--,!t.hasPendingMicrotasks)try{t.runOutsideAngular(()=>t.onStable.emit(null))}finally{t.isStable=!0}}}function J2(t){if(t.isCheckStableRunning||t.callbackScheduled)return;t.callbackScheduled=!0;function n(){T0(()=>{t.callbackScheduled=!1,j_(t),t.isCheckStableRunning=!0,A0(t),t.isCheckStableRunning=!1})}t.scheduleInRootZone?Zone.root.run(()=>{n()}):t._outer.run(()=>{n()}),j_(t)}function Y2(t){let n=()=>{J2(t)},e=G2++;t._inner=t._inner.fork({name:"angular",properties:{[M0]:!0,[Du]:e,[Du+e]:!0},onInvokeTask:(r,i,o,s,a,l)=>{if(Z2(l))return r.invokeTask(o,s,a,l);try{return EI(t),r.invokeTask(o,s,a,l)}finally{(t.shouldCoalesceEventChangeDetection&&s.type==="eventTask"||t.shouldCoalesceRunChangeDetection)&&n(),CI(t)}},onInvoke:(r,i,o,s,a,l,c)=>{try{return EI(t),r.invoke(o,s,a,l,c)}finally{t.shouldCoalesceRunChangeDetection&&!t.callbackScheduled&&!X2(l)&&n(),CI(t)}},onHasTask:(r,i,o,s)=>{r.hasTask(o,s),i===o&&(s.change=="microTask"?(t._hasPendingMicrotasks=s.microTask,j_(t),A0(t)):s.change=="macroTask"&&(t.hasPendingMacrotasks=s.macroTask))},onHandleError:(r,i,o,s)=>(r.handleError(o,s),t.runOutsideAngular(()=>t.onError.emit(s)),!1)})}function j_(t){t._hasPendingMicrotasks||(t.shouldCoalesceEventChangeDetection||t.shouldCoalesceRunChangeDetection)&&t.callbackScheduled===!0?t.hasPendingMicrotasks=!0:t.hasPendingMicrotasks=!1}function EI(t){t._nesting++,t.isStable&&(t.isStable=!1,t.onUnstable.emit(null))}function CI(t){t._nesting--,A0(t)}var Iu=class{hasPendingMicrotasks=!1;hasPendingMacrotasks=!1;isStable=!0;onUnstable=new tt;onMicrotaskEmpty=new tt;onStable=new tt;onError=new tt;run(n,e,r){return n.apply(e,r)}runGuarded(n,e,r){return n.apply(e,r)}runOutsideAngular(n){return n()}runTask(n,e,r,i){return n.apply(e,r)}};function Z2(t){return l1(t,"__ignore_ng_zone__")}function X2(t){return l1(t,"__scheduler_tick__")}function l1(t,n){return!Array.isArray(t)||t.length!==1?!1:t[0]?.data?.[n]===!0}var ur=class{_console=console;handleError(n){this._console.error("ERROR",n)}},_r=new P("",{factory:()=>{let t=y(Ke),n=y(kt),e;return r=>{t.runOutsideAngular(()=>{n.destroyed&&!e?setTimeout(()=>{throw r}):(e??=n.get(ur),e.handleError(r))})}}}),c1={provide:Gs,useValue:()=>{let t=y(ur,{optional:!0})},multi:!0},Q2=new P("",{factory:()=>{let t=y(Ve).defaultView;if(!t)return;let n=y(_r),e=o=>{n(o.reason),o.preventDefault()},r=o=>{o.error?n(o.error):n(new Error(o.message,{cause:o})),o.preventDefault()},i=()=>{t.addEventListener("unhandledrejection",e),t.addEventListener("error",r)};typeof Zone<"u"?Zone.root.run(i):i(),y(Ye).onDestroy(()=>{t.removeEventListener("error",r),t.removeEventListener("unhandledrejection",e)})}});function x0(){return Or([Mu(()=>void y(Q2))])}function Ee(t,n){let[e,r,i]=hu(t,n?.equal),o=e,s=o[Gt];return o.set=r,o.update=i,o.asReadonly=wp.bind(o),o}function wp(){let t=this[Gt];if(t.readonlyFn===void 0){let n=()=>this();n[Gt]=t,t.readonlyFn=n}return t.readonlyFn}var Nl=(()=>{class t{view;node;
vendor: 12,406 bytes, line 7
7constructor(e,r){this.view=e,this.node=r}static __NG_ELEMENT_ID__=eL}return t})();function eL(){return new Nl(de(),In())}var ki=class{},Bu=new P("",{factory:()=>!0});var R0=new P(""),Pl=(()=>{class t{internalPendingTasks=y(fo);scheduler=y(ki);errorHandler=y(_r);add(){let e=this.internalPendingTasks.add();return()=>{this.internalPendingTasks.has(e)&&(this.scheduler.notify(11),this.internalPendingTasks.remove(e))}}run(e){let r=this.add();e().catch(this.errorHandler).finally(r)}static \u0275prov=O({token:t,providedIn:"root",factory:()=>new t})}return t})(),Ep=(()=>{class t{static \u0275prov=O({token:t,providedIn:"root",factory:()=>new B_})}return t})(),B_=class{dirtyEffectCount=0;queues=new Map;add(n){this.enqueue(n),this.schedule(n)}schedule(n){n.dirty&&this.dirtyEffectCount++}remove(n){let e=n.zone,r=this.queues.get(e);r.has(n)&&(r.delete(n),n.dirty&&this.dirtyEffectCount--)}enqueue(n){let e=n.zone;this.queues.has(e)||this.queues.set(e,new Set);let r=this.queues.get(e);r.has(n)||r.add(n)}flush(){for(;this.dirtyEffectCount>0;){let n=!1;for(let[e,r]of this.queues)e===null?n||=this.flushQueue(r):n||=e.run(()=>this.flushQueue(r));n||(this.dirtyEffectCount=0)}}flushQueue(n){let e=!1;for(let r of n)r.dirty&&(this.dirtyEffectCount--,e=!0,r.run());return e}},rp=class{[Gt];constructor(n){this[Gt]=n}destroy(){this[Gt].destroy()}};function ln(t,n){let e=n?.injector??y(Re),r=n?.manualCleanup!==!0?e.get(Ye):null,i,o=e.get(Nl,null,{optional:!0}),s=e.get(ki);return o!==null?(i=rL(o.view,s,t),r instanceof tp&&r._lView===o.view&&(r=null)):i=iL(t,e.get(Ep),s),i.injector=e,r!==null&&(i.onDestroyFns=[r.onDestroy(()=>i.destroy())]),new rp(i)}var u1=Z(A({},s_),{cleanupFns:void 0,zone:null,onDestroyFns:null,run(){let t=Su(!1);try{a_(this)}finally{Su(t)}},cleanup(){if(!this.cleanupFns?.length)return;let t=he(null);try{for(;this.cleanupFns.length;)this.cleanupFns.pop()()}finally{this.cleanupFns=[],he(t)}}}),tL=Z(A({},u1),{consumerMarkedDirty(){this.scheduler.schedule(this),this.notifier.notify(12)},destroy(){if(no(this),this.onDestroyFns!==null)for(let t of this.onDestroyFns)t();this.cleanup(),this.scheduler.remove(this)}}),nL=Z(A({},u1),{consumerMarkedDirty(){this.view[xe]|=8192,ta(this.view),this.notifier.notify(13)},destroy(){if(no(this),this.onDestroyFns!==null)for(let t of this.onDestroyFns)t();this.cleanup(),this.view[Lo]?.delete(this)}});function rL(t,n,e){let r=Object.create(nL);return r.view=t,r.zone=typeof Zone<"u"?Zone.current:null,r.notifier=n,r.fn=d1(r,e),t[Lo]??=new Set,t[Lo].add(r),r.consumerMarkedDirty(r),r}function iL(t,n,e){let r=Object.create(tL);return r.fn=d1(r,t),r.scheduler=n,r.notifier=e,r.zone=typeof Zone<"u"?Zone.current:null,r.scheduler.add(r),r.notifier.notify(12),r}function d1(t,n){return()=>{n(e=>(t.cleanupFns??=[]).push(e))}}function nt(t){return o_(t)}function Hl(t){return{toString:t}.toString()}var Cp="__parameters__";function uL(t){return function(...e){if(t){let r=t(...e);for(let i in r)this[i]=r[i]}}}function dL(t,n,e){return Hl(()=>{let r=uL(n);function i(...o){if(this instanceof i)return r.apply(this,o),this;let s=new i(...o);return a.annotation=s,a;function a(l,c,u){let d=l.hasOwnProperty(Cp)?l[Cp]:Object.defineProperty(l,Cp,{value:[]})[Cp];for(;d.length<=u;)d.push(null);return(d[u]=d[u]||[]).push(s),l}}return i.prototype.ngMetadataName=t,i.annotationCls=i,i})}var yb=MI(dL("Inject",t=>({token:t})),-1);function hL(t){return typeof t=="function"}function U1(t,n,e,r){n!==null?n.applyValueToInputSignal(n,r):t[e]=r}var xp=class{previousValue;currentValue;firstChange;constructor(n,e,r){this.previousValue=n,this.currentValue=e,this.firstChange=r}isFirstChange(){return this.firstChange}},xn=(()=>{let t=()=>H1;return t.ngInherit=!0,t})();function H1(t){return t.type.prototype.ngOnChanges&&(t.setInput=pL),fL}function fL(){let t=z1(this),n=t?.current;if(n){let e=t.previous;if(e===si)t.previous=n;else for(let r in n)e[r]=n[r];t.current=null,this.ngOnChanges(n)}}function pL(t,n,e,r,i){let o=this.declaredInputs[r],s=z1(t)||mL(t,{previous:si,current:null}),a=s.current||(s.current={}),l=s.previous,c=l[o];a[o]=new xp(c&&c.currentValue,e,l===si),U1(t,n,i,e)}var $1="__ngSimpleChanges__";function z1(t){return t[$1]||null}function mL(t,n){return t[$1]=n}var h1=[];var yt=function(t,n=null,e){for(let r=0;r<h1.length;r++){let i=h1[r];i(t,n,e)}},ot=(function(t){return t[t.TemplateCreateStart=0]="TemplateCreateStart",t[t.TemplateCreateEnd=1]="TemplateCreateEnd",t[t.TemplateUpdateStart=2]="TemplateUpdateStart",t[t.TemplateUpdateEnd=3]="TemplateUpdateEnd",t[t.LifecycleHookStart=4]="LifecycleHookStart",t[t.LifecycleHookEnd=5]="LifecycleHookEnd",t[t.OutputStart=6]="OutputStart",t[t.OutputEnd=7]="OutputEnd",t[t.BootstrapApplicationStart=8]="BootstrapApplicationStart",t[t.BootstrapApplicationEnd=9]="BootstrapApplicationEnd",t[t.BootstrapComponentStart=10]="BootstrapComponentStart",t[t.BootstrapComponentEnd=11]="BootstrapComponentEnd",t[t.ChangeDetectionStart=12]="ChangeDetectionStart",t[t.ChangeDetectionEnd=13]="ChangeDetectionEnd",t[t.ChangeDetectionSyncStart=14]="ChangeDetectionSyncStart",t[t.ChangeDetectionSyncEnd=15]="ChangeDetectionSyncEnd",t[t.AfterRenderHooksStart=16]="AfterRenderHooksStart",t[t.AfterRenderHooksEnd=17]="AfterRenderHooksEnd",t[t.ComponentStart=18]="ComponentStart",t[t.ComponentEnd=19]="ComponentEnd",t[t.DeferBlockStateStart=20]="DeferBlockStateStart",t[t.DeferBlockStateEnd=21]="DeferBlockStateEnd",t[t.DynamicComponentStart=22]="DynamicComponentStart",t[t.DynamicComponentEnd=23]="DynamicComponentEnd",t[t.HostBindingsUpdateStart=24]="HostBindingsUpdateStart",t[t.HostBindingsUpdateEnd=25]="HostBindingsUpdateEnd",t})(ot||{});function gL(t,n,e){let{ngOnChanges:r,ngOnInit:i,ngDoCheck:o}=n.type.prototype;if(r){let s=H1(n);(e.preOrderHooks??=[]).push(t,s),(e.preOrderCheckHooks??=[]).push(t,s)}i&&(e.preOrderHooks??=[]).push(0-t,i),o&&((e.preOrderHooks??=[]).push(t,o),(e.preOrderCheckHooks??=[]).push(t,o))}function q1(t,n){for(let e=n.directiveStart,r=n.directiveEnd;e<r;e++){let o=t.data[e].type.prototype,{ngAfterContentInit:s,ngAfterContentChecked:a,ngAfterViewInit:l,ngAfterViewChecked:c,ngOnDestroy:u}=o;s&&(t.contentHooks??=[]).push(-e,s),a&&((t.contentHooks??=[]).push(e,a),(t.contentCheckHooks??=[]).push(e,a)),l&&(t.viewHooks??=[]).push(-e,l),c&&((t.viewHooks??=[]).push(e,c),(t.viewCheckHooks??=[]).push(e,c)),u!=null&&(t.destroyHooks??=[]).push(e,u)}}function Ip(t,n,e){W1(t,n,3,e)}function Tp(t,n,e,r){(t[xe]&3)===e&&W1(t,n,e,r)}function O0(t,n){let e=t[xe];(e&3)===n&&(e&=16383,e+=1,t[xe]=e)}function W1(t,n,e,r){let i=r!==void 0?t[Ys]&65535:0,o=r??-1,s=n.length-1,a=0;for(let l=i;l<s;l++)if(typeof n[l+1]=="number"){if(a=n[l],r!=null&&a>=r)break}else n[l]<0&&(t[Ys]+=65536),(a<o||o==-1)&&(vL(t,e,n,l),t[Ys]=(t[Ys]&4294901760)+l+2),l++}function f1(t,n){yt(ot.LifecycleHookStart,t,n);let e=he(null);try{n.call(t)}finally{he(e),yt(ot.LifecycleHookEnd,t,n)}}function vL(t,n,e,r){let i=e[r]<0,o=e[r+1],s=i?-e[r]:e[r],a=t[s];i?t[xe]>>14<t[Ys]>>16&&(t[xe]&3)===n&&(t[xe]+=16384,f1(a,o)):f1(a,o)}var Ll=-1,oa=class{factory;name;injectImpl;resolving=!1;canSeeViewProviders;multi;componentProviders;index;providerFactory;constructor(n,e,r,i){this.factory=n,this.name=i,this.canSeeViewProviders=e,this.injectImpl=r}};function yL(t){return(t.flags&8)!==0}function _L(t){return(t.flags&16)!==0}function bL(t,n,e){let r=0;for(;r<e.length;){let i=e[r];if(typeof i=="number"){if(i!==0)break;r++;let o=e[r++],s=e[r++],a=e[r++];t.setAttribute(n,s,a,o)}else{let o=i,s=e[++r];wL(o)?t.setProperty(n,o,s):t.setAttribute(n,o,s),r++}}return r}function G1(t){return t===3||t===4||t===6}function wL(t){return t.charCodeAt(0)===64}function jl(t,n){if(!(n===null||n.length===0))if(t===null||t.length===0)t=n.slice();else{let e=-1;for(let r=0;r<n.length;r++){let i=n[r];typeof i=="number"?e=i:e===0||(e===-1||e===2?p1(t,e,i,null,n[++r]):p1(t,e,i,null,null))}}return t}function p1(t,n,e,r,i){let o=0,s=t.length;if(n===-1)s=-1;else for(;o<t.length;){let a=t[o++];if(typeof a=="number"){if(a===n){s=-1;break}else if(a>n){s=o-1;break}}}for(;o<t.length;){let a=t[o];if(typeof a=="number")break;if(a===e){i!==null&&(t[o+1]=i);return}o++,i!==null&&o++}s!==-1&&(t.splice(s,0,n),o=s+1),t.splice(o++,0,e),i!==null&&t.splice(o++,0,i)}function K1(t){return t!==Ll}function Rp(t){return t&32767}function EL(t){return t>>16}function Op(t,n){let e=EL(t),r=n;for(;e>0;)r=r[Js],e--;return r}var z0=!0;function Np(t){let n=z0;return z0=t,n}var CL=256,J1=CL-1,Y1=5,SL=0,Ni={};function DL(t,n,e){let r;typeof e=="string"?r=e.charCodeAt(0)||0:e.hasOwnProperty(Ws)&&(r=e[Ws]),r==null&&(r=e[Ws]=SL++);let i=r&J1,o=1<<i;n.data[t+(i>>Y1)]|=o}function Pp(t,n){let e=Z1(t,n);if(e!==-1)return e;let r=n[pe];r.firstCreatePass&&(t.injectorIndex=n.length,N0(r.data,t),N0(n,null),N0(r.blueprint,null));let i=_b(t,n),o=t.injectorIndex;if(K1(i)){let s=Rp(i),a=Op(i,n),l=a[pe].data;for(let c=0;c<8;c++)n[o+c]=a[s+c]|l[s+c]}return n[o+8]=i,o}function N0(t,n){t.push(0,0,0,0,0,0,0,0,n)}function Z1(t,n){return t.injectorIndex===-1||t.parent&&t.parent.injectorIndex===t.injectorIndex||n[t.injectorIndex+8]===null?-1:t.injectorIndex}function _b(t,n){if(t.parent&&t.parent.injectorIndex!==-1)return t.parent.injectorIndex;let e=0,r=null,i=n;for(;i!==null;){if(r=nT(i),r===null)return Ll;if(e++,i=i[Js],r.injectorIndex!==-1)return r.injectorIndex|e<<16}return Ll}function q0(t,n,e){DL(t,n,e)}function IL(t,n){if(n==="class")return t.classes;if(n==="style")return t.styles;let e=t.attrs;if(e){let r=e.length,i=0;for(;i<r;){let o=e[i];if(G1(o))break;if(o===0)i=i+2;else if(typeof o=="number")for(i++;i<r&&typeof e[i]=="string";)i++;else{if(o===n)return e[i+1];i=i+2}}}return null}function X1(t,n,e){if(e&8||t!==void 0)return t;ap(n,"NodeInjector")}function Q1(t,n,e,r){if(e&8&&r===void 0&&(r=null),(e&3)===0){let i=t[ho],o=Jn(void 0);try{return i?i.get(n,r,e&8):K_(n,r,e&8)}finally{Jn(o)}}return X1(r,n,e)}function eT(t,n,e,r=0,i){if(t!==null){if(n[xe]&2048&&!(r&2)){let s=AL(t,n,e,r,Ni);if(s!==Ni)return s}let o=tT(t,n,e,r,Ni);if(o!==Ni)return o}return Q1(n,e,r,i)}function tT(t,n,e,r,i){let o=kL(e);if(typeof o=="function"){if(!C0(n,t,r))return r&1?X1(i,e,r):Q1(n,e,r,i);try{let s;if(s=o(r),s==null&&!(r&8))ap(e);else return s}finally{S0()}}else if(typeof o=="number"){let s=null,a=Z1(t,n),l=Ll,c=r&1?n[Zn][Yn]:null;for((a===-1||r&4)&&(l=a===-1?_b(t,n):n[a+8],l===Ll||!g1(r,!1)?a=-1:(s=n[pe],a=Rp(l),n=Op(l,n)));a!==-1;){let u=n[pe];if(m1(o,a,u.data)){let d=TL(a,n,e,s,r,c);if(d!==Ni)return d}l=n[a+8],l!==Ll&&g1(r,n[pe].data[a+8]===c)&&m1(o,a,n)?(s=u,a=Rp(l),n=Op(l,n)):a=-1}}return i}function TL(t,n,e,r,i,o){let s=n[pe],a=s.data[t+8],l=r==null?Uo(a)&&z0:r!=s&&(a.type&3)!==0,c=i&1&&o===a,u=kp(a,s,e,l,c);return u!==null?$u(n,s,u,a,i):Ni}function kp(t,n,e,r,i){let o=t.providerIndexes,s=n.data,a=o&1048575,l=t.directiveStart,c=t.directiveEnd,u=o>>20,d=r?a:a+u,f=i?a+u:c;for(let h=d;h<f;h++){let p=s[h];if(h<l&&e===p||h>=l&&p.type===e)return h}if(i){let h=s[l];if(h&&ci(h)&&h.type===e)return l}return null}function $u(t,n,e,r,i){let o=t[e],s=n.data;if(o instanceof oa){let a=o;if(a.resolving){let h=DI(s[e]);throw G_(h)}let l=Np(a.canSeeViewProviders);a.resolving=!0;let c=s[e].type||s[e],u,d=a.injectImpl?Jn(a.injectImpl):null,f=C0(t,r,0);try{o=t[e]=a.factory(void 0,i,s,t,r),n.firstCreatePass&&e>=r.directiveStart&&gL(e,s[e],n)}finally{d!==null&&Jn(d),Np(l),a.resolving=!1,S0()}}return o}function kL(t){if(typeof t=="string")return t.charCodeAt(0)||0;let n=t.hasOwnProperty(Ws)?t[Ws]:void 0;return typeof n=="number"?n>=0?n&J1:ML:n}function m1(t,n,e){let r=1<<t;return!!(e[n+(t>>Y1)]&r)}function g1(t,n){return!(t&2)&&!(t&1&&n)}var ia=class{_tNode;_lView;constructor(n,e){this._tNode=n,this._lView=e}get(n,e,r){return eT(this._tNode,this._lView,n,$s(r),e)}};function ML(){return new ia(In(),de())}function yn(t){return Hl(()=>{let n=t.prototype.constructor,e=n[Eu]||W0(n),r=Object.prototype,i=Object.getPrototypeOf(t.prototype).constructor;for(;i&&i!==r;){let o=i[Eu]||W0(i);if(o&&o!==e)return o;i=Object.getPrototypeOf(i)}return o=>new o})}function W0(t){return V_(t)?()=>{let n=W0(gn(t));return n&&n()}:Fo(t)}function AL(t,n,e,r,i){let o=t,s=n;for(;o!==null&&s!==null&&s[xe]&2048&&!Rl(s);){let a=tT(o,s,e,r|2,Ni);if(a!==Ni)return a;let l=o.parent;if(!l){let c=s[r0];if(c){let u=c.get(e,Ni,r);if(u!==Ni)return u}l=nT(s),s=s[Js]}o=l}return i}function nT(t){let n=t[pe],e=n.type;return e===2?n.declTNode:e===1?t[Yn]:null}function Yu(t){return IL(In(),t)}
vendor: 1,478 bytes, line 7
7function xL(){return $l(In(),de())}function $l(t,n){return new We(ui(t,n))}var We=(()=>{class t{nativeElement;constructor(e){this.nativeElement=e}static __NG_ELEMENT_ID__=xL}return t})();function rT(t){return t instanceof We?t.nativeElement:t}function RL(){return this._results[Symbol.iterator]()}var Fp=class{_emitDistinctChangesOnly;dirty=!0;_onDirty=void 0;_results=[];_changesDetected=!1;_changes=void 0;length=0;first=void 0;last=void 0;get changes(){return this._changes??=new ve}constructor(n=!1){this._emitDistinctChangesOnly=n}get(n){return this._results[n]}map(n){return this._results.map(n)}filter(n){return this._results.filter(n)}find(n){return this._results.find(n)}reduce(n,e){return this._results.reduce(n,e)}forEach(n){this._results.forEach(n)}some(n){return this._results.some(n)}toArray(){return this._results.slice()}toString(){return this._results.toString()}reset(n,e){this.dirty=!1;let r=xI(n);(this._changesDetected=!AI(this._results,r,e))&&(this._results=r,this.length=r.length,this.last=r[this.length-1],this.first=r[0])}notifyOnChanges(){this._changes!==void 0&&(this._changesDetected||!this._emitDistinctChangesOnly)&&this._changes.next(this)}onDirty(n){this._onDirty=n}setDirty(){this.dirty=!0,this._onDirty?.()}destroy(){this._changes!==void 0&&(this._changes.complete(),this._changes.unsubscribe())}[Symbol.iterator]=RL};function iT(t){return(t.flags&128)===128}var bb=(function(t){return t[t.OnPush=0]="OnPush",t[t.Default=1]="Default",t})(bb||{}
vendor: 27,544 bytes, line 7
7),oT=new Map,OL=0;function NL(){return OL++}function PL(t){oT.set(t[xu],t)}function G0(t){oT.delete(t[xu])}var v1="__ngContext__";function Bl(t,n){Ri(n)?(t[v1]=n[xu],PL(n)):t[v1]=n}function sT(t){return lT(t[Al])}function aT(t){return lT(t[Nr])}function lT(t){for(;t!==null&&!li(t);)t=t[Nr];return t}var FL;function wb(t){FL=t}var zl=new P("",{factory:()=>LL}),LL="ng";var Zp=new P(""),po=new P("",{providedIn:"platform",factory:()=>"unknown"}),Eb=new P(""),ql=new P("",{factory:()=>y(Ve).body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce")||null});var cT="r";var uT="di";var dT=!1,hT=new P("",{factory:()=>dT});var Cb=new P("");var jL=(t,n,e,r)=>{};function BL(t,n,e,r){jL(t,n,e,r)}function Xp(t){return(t.flags&32)===32}var VL=()=>null;function fT(t,n,e=!1){return VL(t,n,e)}function pT(t,n){let e=t.contentQueries;if(e!==null){let r=he(null);try{for(let i=0;i<e.length;i+=2){let o=e[i],s=e[i+1];if(s!==-1){let a=t.data[s];Lu(o),a.contentQueries(2,n[s],s)}}}finally{he(r)}}}function K0(t,n,e){Lu(0);let r=he(null);try{n(t,e)}finally{he(r)}}function Sb(t,n,e){if(o0(n)){let r=he(null);try{let i=n.directiveStart,o=n.directiveEnd;for(let s=i;s<o;s++){let a=t.data[s];if(a.contentQueries){let l=e[s];a.contentQueries(1,l,s)}}}finally{he(r)}}}var fi=(function(t){return t[t.Emulated=0]="Emulated",t[t.None=2]="None",t[t.ShadowDom=3]="ShadowDom",t[t.ExperimentalIsolatedShadowDom=4]="ExperimentalIsolatedShadowDom",t})(fi||{});var Sp;function UL(){if(Sp===void 0&&(Sp=null,uo.trustedTypes))try{Sp=uo.trustedTypes.createPolicy("angular#unsafe-bypass",{createHTML:t=>t,createScript:t=>t,createScriptURL:t=>t})}catch{}return Sp}function y1(t){return UL()?.createScriptURL(t)||t}var Lp=class{changingThisBreaksApplicationSecurity;constructor(n){this.changingThisBreaksApplicationSecurity=n}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${ip})`}};function Wl(t){return t instanceof Lp?t.changingThisBreaksApplicationSecurity:t}function Db(t,n){let e=mT(t);if(e!=null&&e!==n){if(e==="ResourceURL"&&n==="URL")return!0;throw new Error(`Required a safe ${n}, got a ${e} (see ${ip})`)}return e===n}function mT(t){return t instanceof Lp&&t.getTypeName()||null}var HL=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i;function gT(t){return t=String(t),t.match(HL)?t:"unsafe:"+t}var Qp=(function(t){return t[t.NONE=0]="NONE",t[t.HTML=1]="HTML",t[t.STYLE=2]="STYLE",t[t.SCRIPT=3]="SCRIPT",t[t.URL=4]="URL",t[t.RESOURCE_URL=5]="RESOURCE_URL",t})(Qp||{});function Zu(t){let n=yT();return n?n.sanitize(Qp.URL,t)||"":Db(t,"URL")?Wl(t):gT(Il(t))}function vT(t){let n=yT();if(n)return y1(n.sanitize(Qp.RESOURCE_URL,t)||"");if(Db(t,"ResourceURL"))return y1(Wl(t));throw new z(904,!1)}function $L(t,n){return n==="src"&&(t==="embed"||t==="frame"||t==="iframe"||t==="media"||t==="script")||n==="href"&&(t==="base"||t==="link")?vT:Zu}function Ib(t,n,e){return $L(n,e)(t)}function yT(){let t=de();return t&&t[Ai].sanitizer}var zL=/^>|^->|<!--|-->|--!>|<!-$/g,qL=/(<|>)/g,WL="\u200B$1\u200B";function GL(t){return t.replace(zL,n=>n.replace(qL,WL))}function _T(t){return t instanceof Function?t():t}function KL(t,n,e){let r=t.length;for(;;){let i=t.indexOf(n,e);if(i===-1)return i;if(i===0||t.charCodeAt(i-1)<=32){let o=n.length;if(i+o===r||t.charCodeAt(i+o)<=32)return i}e=i+1}}var bT="ng-template";function JL(t,n,e,r){let i=0;if(r){for(;i<n.length&&typeof n[i]=="string";i+=2)if(n[i]==="class"&&KL(n[i+1].toLowerCase(),e,0)!==-1)return!0}else if(Tb(t))return!1;if(i=n.indexOf(1,i),i>-1){let o;for(;++i<n.length&&typeof(o=n[i])=="string";)if(o.toLowerCase()===e)return!0}return!1}function Tb(t){return t.type===4&&t.value!==bT}function YL(t,n,e){let r=t.type===4&&!e?bT:t.value;return n===r}function ZL(t,n,e){let r=4,i=t.attrs,o=i!==null?ej(i):0,s=!1;for(let a=0;a<n.length;a++){let l=n[a];if(typeof l=="number"){if(!s&&!di(r)&&!di(l))return!1;if(s&&di(l))continue;s=!1,r=l|r&1;continue}if(!s)if(r&4){if(r=2|r&1,l!==""&&!YL(t,l,e)||l===""&&n.length===1){if(di(r))return!1;s=!0}}else if(r&8){if(i===null||!JL(t,i,l,e)){if(di(r))return!1;s=!0}}else{let c=n[++a],u=XL(l,i,Tb(t),e);if(u===-1){if(di(r))return!1;s=!0;continue}if(c!==""){let d;if(u>o?d="":d=i[u+1].toLowerCase(),r&2&&c!==d){if(di(r))return!1;s=!0}}}}return di(r)||s}function di(t){return(t&1)===0}function XL(t,n,e,r){if(n===null)return-1;let i=0;if(r||!e){let o=!1;for(;i<n.length;){let s=n[i];if(s===t)return i;if(s===3||s===6)o=!0;else if(s===1||s===2){let a=n[++i];for(;typeof a=="string";)a=n[++i];continue}else{if(s===4)break;if(s===0){i+=4;continue}}i+=o?1:2}return-1}else return tj(n,t)}function wT(t,n,e=!1){for(let r=0;r<n.length;r++)if(ZL(t,n[r],e))return!0;return!1}function QL(t){let n=t.attrs;if(n!=null){let e=n.indexOf(5);if((e&1)===0)return n[e+1]}return null}function ej(t){for(let n=0;n<t.length;n++){let e=t[n];if(G1(e))return n}return t.length}function tj(t,n){let e=t.indexOf(4);if(e>-1)for(e++;e<t.length;){let r=t[e];if(typeof r=="number")return-1;if(r===n)return e;e++}return-1}function nj(t,n){e:for(let e=0;e<n.length;e++){let r=n[e];if(t.length===r.length){for(let i=0;i<t.length;i++)if(t[i]!==r[i])continue e;return!0}}return!1}function _1(t,n){return t?":not("+n.trim()+")":n}function rj(t){let n=t[0],e=1,r=2,i="",o=!1;for(;e<t.length;){let s=t[e];if(typeof s=="string")if(r&2){let a=t[++e];i+="["+s+(a.length>0?'="'+a+'"':"")+"]"}else r&8?i+="."+s:r&4&&(i+=" "+s);else i!==""&&!di(s)&&(n+=_1(o,i),i=""),r=s,o=o||!di(r);e++}return i!==""&&(n+=_1(o,i)),n}function ij(t){return t.map(rj).join(",")}function oj(t){let n=[],e=[],r=1,i=2;for(;r<t.length;){let o=t[r];if(typeof o=="string")i===2?o!==""&&n.push(o,t[++r]):i===8&&e.push(o);else{if(!di(i))break;i=o}r++}return e.length&&n.push(1,...e),n}var dr={};function sj(t,n){return t.createText(n)}function aj(t,n,e){t.setValue(n,e)}function lj(t,n){return t.createComment(GL(n))}function ET(t,n,e){return t.createElement(n,e)}function jp(t,n,e,r,i){t.insertBefore(n,e,r,i)}function CT(t,n,e){t.appendChild(n,e)}function b1(t,n,e,r,i){r!==null?jp(t,n,e,r,i):CT(t,n,e)}function ST(t,n,e,r){t.removeChild(null,n,e,r)}function cj(t,n,e){t.setAttribute(n,"style",e)}function uj(t,n,e){e===""?t.removeAttribute(n,"class"):t.setAttribute(n,"class",e)}function DT(t,n,e){let{mergedAttrs:r,classes:i,styles:o}=e;r!==null&&bL(t,n,r),i!==null&&uj(t,n,i),o!==null&&cj(t,n,o)}function kb(t,n,e,r,i,o,s,a,l,c,u){let d=Mt+r,f=d+i,h=dj(d,f),p=typeof c=="function"?c():c;return h[pe]={type:t,blueprint:h,template:e,queries:null,viewQuery:a,declTNode:n,data:h.slice().fill(null,d),bindingStartIndex:d,expandoStartIndex:f,hostBindingOpCodes:null,firstCreatePass:!0,firstUpdatePass:!0,staticViewQueries:!1,staticContentQueries:!1,preOrderHooks:null,preOrderCheckHooks:null,contentHooks:null,contentCheckHooks:null,viewHooks:null,viewCheckHooks:null,destroyHooks:null,cleanup:null,contentQueries:null,components:null,directiveRegistry:typeof o=="function"?o():o,pipeRegistry:typeof s=="function"?s():s,firstChild:null,schemas:l,consts:p,incompleteFirstPass:!1,ssrId:u}}function dj(t,n){let e=[];for(let r=0;r<n;r++)e.push(r<t?null:dr);return e}function hj(t){let n=t.tView;return n===null||n.incompleteFirstPass?t.tView=kb(1,null,t.template,t.decls,t.vars,t.directiveDefs,t.pipeDefs,t.viewQuery,t.schemas,t.consts,t.id):n}function Mb(t,n,e,r,i,o,s,a,l,c,u){let d=n.blueprint.slice();return d[ai]=i,d[xe]=r|4|128|8|64|1024,(c!==null||t&&t[xe]&2048)&&(d[xe]|=2048),l0(d),d[vn]=d[Js]=t,d[tn]=e,d[Ai]=s||t&&t[Ai],d[Ot]=a||t&&t[Ot],d[ho]=l||t&&t[ho]||null,d[Yn]=o,d[xu]=NL(),d[Ks]=u,d[r0]=c,d[Zn]=n.type==2?t[Zn]:d,d}function fj(t,n,e){let r=ui(n,t),i=hj(e),o=t[Ai].rendererFactory,s=Ab(t,Mb(t,i,null,IT(e),r,n,null,o.createRenderer(r,e),null,null,null));return t[n.index]=s}function IT(t){let n=16;return t.signals?n=4096:t.onPush&&(n=64),n}function TT(t,n,e,r){if(e===0)return-1;let i=n.length;for(let o=0;o<e;o++)n.push(r),t.blueprint.push(r),t.data.push(null);return i}function Ab(t,n){return t[Al]?t[n0][Nr]=n:t[Al]=n,t[n0]=n,n}function R(t=1){kT(Ht(),de(),Oi()+t,!1)}function kT(t,n,e,r){if(!r)if((n[xe]&3)===3){let o=t.preOrderCheckHooks;o!==null&&Ip(n,o,e)}else{let o=t.preOrderHooks;o!==null&&Tp(n,o,0,e)}$o(e)}var em=(function(t){return t[t.None=0]="None",t[t.SignalBased=1]="SignalBased",t[t.HasDecoratorInputTransform=2]="HasDecoratorInputTransform",t})(em||{});function J0(t,n,e,r){let i=he(null);try{let[o,s,a]=t.inputs[e],l=null;(s&em.SignalBased)!==0&&(l=n[o][Gt]),l!==null&&l.transformFn!==void 0?r=l.transformFn(r):a!==null&&(r=a.call(n,r)),t.setInput!==null?t.setInput(n,l,r,e,o):U1(n,l,o,r)}finally{he(i)}}var pi=(function(t){return t[t.Important=1]="Important",t[t.DashCase=2]="DashCase",t})(pi||{}),pj;function xb(t,n){return pj(t,n)}var sa=new Set,tm=(function(t){return t[t.CHANGE_DETECTION=0]="CHANGE_DETECTION",t[t.AFTER_NEXT_RENDER=1]="AFTER_NEXT_RENDER",t})(tm||{}),Fi=new P(""),w1=new Set;function mi(t){w1.has(t)||(w1.add(t),performance?.mark?.("mark_feature_usage",{detail:{feature:t}}))}var nm=(()=>{class t{impl=null;execute(){this.impl?.execute()}static \u0275prov=O({token:t,providedIn:"root",factory:()=>new t})}return t})(),Rb=[0,1,2,3],Ob=(()=>{class t{ngZone=y(Ke);scheduler=y(ki);errorHandler=y(ur,{optional:!0});sequences=new Set;deferredRegistrations=new Set;executing=!1;constructor(){y(Fi,{optional:!0})}execute(){let e=this.sequences.size>0;e&&yt(ot.AfterRenderHooksStart),this.executing=!0;for(let r of Rb)for(let i of this.sequences)if(!(i.erroredOrDestroyed||!i.hooks[r]))try{i.pipelinedValue=this.ngZone.runOutsideAngular(()=>this.maybeTrace(()=>{let o=i.hooks[r];return o(i.pipelinedValue)},i.snapshot))}catch(o){i.erroredOrDestroyed=!0,this.errorHandler?.handleError(o)}this.executing=!1;for(let r of this.sequences)r.afterRun(),r.once&&(this.sequences.delete(r),r.destroy());for(let r of this.deferredRegistrations)this.sequences.add(r);this.deferredRegistrations.size>0&&this.scheduler.notify(7),this.deferredRegistrations.clear(),e&&yt(ot.AfterRenderHooksEnd)}register(e){let{view:r}=e;r!==void 0?((r[Zs]??=[]).push(e),ta(r),r[xe]|=8192):this.executing?this.deferredRegistrations.add(e):this.addSequence(e)}addSequence(e){this.sequences.add(e),this.scheduler.notify(7)}unregister(e){this.executing&&this.sequences.has(e)?(e.erroredOrDestroyed=!0,e.pipelinedValue=void 0,e.once=!0):(this.sequences.delete(e),this.deferredRegistrations.delete(e))}maybeTrace(e,r){return r?r.run(tm.AFTER_NEXT_RENDER,e):e()}static \u0275prov=O({token:t,providedIn:"root",factory:()=>new t})}return t})(),zu=class{impl;hooks;view;once;snapshot;erroredOrDestroyed=!1;pipelinedValue=void 0;unregisterOnDestroy;constructor(n,e,r,i,o,s=null){this.impl=n,this.hooks=e,this.view=r,this.once=i,this.snapshot=s,this.unregisterOnDestroy=o?.onDestroy(()=>this.destroy())}afterRun(){this.erroredOrDestroyed=!1,this.pipelinedValue=void 0,this.snapshot?.dispose(),this.snapshot=null}destroy(){this.impl.unregister(this),this.unregisterOnDestroy?.();let n=this.view?.[Zs];n&&(this.view[Zs]=n.filter(e=>e!==this))}};function br(t,n){let e=n?.injector??y(Re);return mi("NgAfterNextRender"),gj(t,e,n,!0)}function mj(t){return t instanceof Function?[void 0,void 0,t,void 0]:[t.earlyRead,t.write,t.mixedReadWrite,t.read]}function gj(t,n,e,r){let i=n.get(nm);i.impl??=n.get(Ob);let o=n.get(Fi,null,{optional:!0}),s=e?.manualCleanup!==!0?n.get(Ye):null,a=n.get(Nl,null,{optional:!0}),l=new zu(i.impl,mj(t),a?.view,r,s,o?.snapshot(null));return i.impl.register(l),l}var MT=new P("",{factory:()=>({queue:new Set,isScheduled:!1,scheduler:null})});function AT(t,n,e){let r=t.get(MT);if(Array.isArray(n))for(let i of n)r.queue.add(i),e?.detachedLeaveAnimationFns?.push(i);else r.queue.add(n),e?.detachedLeaveAnimationFns?.push(n);r.scheduler&&r.scheduler(t)}function vj(t,n){let e=t.get(MT);if(n.detachedLeaveAnimationFns){for(let r of n.detachedLeaveAnimationFns)e.queue.delete(r);n.detachedLeaveAnimationFns=void 0}}function yj(t,n){for(let[e,r]of n)AT(t,r.animateFns)}function E1(t,n,e,r){let i=t?.[Xs]?.enter;n!==null&&i&&i.has(e.index)&&yj(r,i)}function Fl(t,n,e,r,i,o,s,a){if(i!=null){let l,c=!1;li(i)?l=i:Ri(i)&&(c=!0,i=i[ai]);let u=Pr(i);t===0&&r!==null?(E1(a,r,o,e),s==null?CT(n,r,u):jp(n,r,u,s||null,!0)):t===1&&r!==null?(E1(a,r,o,e),jp(n,r,u,s||null,!0)):t===2?C1(a,o,e,d=>{ST(n,u,c,d)}):t===3&&C1(a,o,e,()=>{n.destroyNode(u)}),l!=null&&Mj(n,t,e,l,o,r,s)}}function _j(t,n){xT(t,n),n[ai]=null,n[Yn]=null}function bj(t,n,e,r,i,o){r[ai]=i,r[Yn]=n,im(t,r,e,1,i,o)}function xT(t,n){n[Ai].changeDetectionScheduler?.notify(9),im(t,n,n[Ot],2,null,null)}function wj(t){let n=t[Al];if(!n)return P0(t[pe],t);for(;n;){let e=null;if(Ri(n))e=n[Al];else{let r=n[Zt];r&&(e=r)}if(!e){for(;n&&!n[Nr]&&n!==t;)Ri(n)&&P0(n[pe],n),n=n[vn];n===null&&(n=t),Ri(n)&&P0(n[pe],n),e=n&&n[Nr]}n=e}}function Nb(t,n){let e=t[Qs],r=e.indexOf(n);e.splice(r,1)}function rm(t,n){if(ea(n))return;let e=n[Ot];e.destroyNode&&im(t,n,e,3,null,null),wj(n)}function P0(t,n){if(ea(n))return;let e=he(null);try{n[xe]&=-129,n[xe]|=256,n[yr]&&no(n[yr]),Sj(t,n),Cj(t,n),n[pe].type===1&&n[Ot].destroy();let r=n[Bo];if(r!==null&&li(n[vn])){r!==n[vn]&&Nb(r,n);let i=n[xi];i!==null&&i.detachView(t)}G0(n)}finally{he(e)}}function C1(t,n,e,r){let i=t?.[Xs];if(i==null||i.leave==null||!i.leave.has(n.index))return r(!1);t&&sa.add(t),AT(e,()=>{if(i.leave&&i.leave.has(n.index)){let s=i.leave.get(n.index),a=[];if(s){for(let l=0;l<s.animateFns.length;l++){let c=s.animateFns[l],{promise:u}=c();a.push(u)}i.detachedLeaveAnimationFns=void 0}i.running=Promise.allSettled(a),Ej(t,r)}else t&&sa.delete(t),r(!1)},i)}function Ej(t,n){let e=t[Xs]?.running;if(e){e.then(()=>{t[Xs].running=void 0,sa.delete(t),n(!0)});return}n(!1)}function Cj(t,n){let e=t.cleanup,r=n[Ml];if(e!==null)for(let s=0;s<e.length-1;s+=2)if(typeof e[s]=="string"){let a=e[s+3];a>=0?r[a]():r[-a].unsubscribe(),s+=2}else{let a=r[e[s+1]];e[s].call(a)}r!==null&&(n[Ml]=null);let i=n[lo];if(i!==null){n[lo]=null;for(let s=0;s<i.length;s++){let a=i[s];a()}}let o=n[Lo];if(o!==null){n[Lo]=null;for(let s of o)s.destroy()}}function Sj(t,n){let e;if(t!=null&&(e=t.destroyHooks)!=null)for(let r=0;r<e.length;r+=2){let i=n[e[r]];if(!(i instanceof oa)){let o=e[r+1];if(Array.isArray(o))for(let s=0;s<o.length;s+=2){let a=i[o[s]],l=o[s+1];yt(ot.LifecycleHookStart,a,l);try{l.call(a)}finally{yt(ot.LifecycleHookEnd,a,l)}}else{yt(ot.LifecycleHookStart,i,o);try{o.call(i)}finally{yt(ot.LifecycleHookEnd,i,o)}}}}}function RT(t,n,e){return Dj(t,n.parent,e)}function Dj(t,n,e){let r=n;for(;r!==null&&r.type&168;)n=r,r=n.parent;if(r===null)return e[ai];if(Uo(r)){let{encapsulation:i}=t.data[r.directiveStart+r.componentOffset];if(i===fi.None||i===fi.Emulated)return null}return ui(r,e)}function OT(t,n,e){return Tj(t,n,e)}function Ij(t,n,e){return t.type&40?ui(t,e):null}var Tj=Ij,S1;function Pb(t,n,e,r){let i=RT(t,r,n),o=n[Ot],s=r.parent||n[Yn],a=OT(s,r,n);if(i!=null)if(Array.isArray(e))for(let l=0;l<e.length;l++)b1(o,i,e[l],a,!1);else b1(o,i,e,a,!1);S1!==void 0&&S1(o,r,n,e,i)}function Uu(t,n){if(n!==null){let e=n.type;if(e&3)return ui(n,t);if(e&4)return Y0(-1,t[n.index]);if(e&8){let r=n.child;if(r!==null)return Uu(t,r);{let i=t[n.index];return li(i)?Y0(-1,i):Pr(i)}}else{if(e&128)return Uu(t,n.next);if(e&32)return xb(n,t)()||Pr(t[n.index]);{let r=NT(t,n);if(r!==null){if(Array.isArray(r))return r[0];let i=jo(t[Zn]);return Uu(i,r)}else return Uu(t,n.next)}}}return null}function NT(t,n){if(n!==null){let r=t[Zn][Yn],i=n.projection;return r.projection[i]}return null}function Y0(t,n){let e=Zt+t+1;if(e<n.length){let r=n[e],i=r[pe].firstChild;if(i!==null)return Uu(r,i)}return n[Vo]}function Fb(t,n,e,r,i,o,s){for(;e!=null;){let a=r[ho];if(e.type===128){e=e.next;continue}let l=r[e.index],c=e.type;if(s&&n===0&&(l&&Bl(Pr(l),r),e.flags|=2),!Xp(e))if(c&8)Fb(t,n,e.child,r,i,o,!1),Fl(n,t,a,i,l,e,o,r);else if(c&32){let u=xb(e,r),d;for(;d=u();)Fl(n,t,a,i,d,e,o,r);Fl(n,t,a,i,l,e,o,r)}else c&16?PT(t,n,r,e,i,o):Fl(n,t,a,i,l,e,o,r);e=s?e.projectionNext:e.next}}function im(t,n,e,r,i,o){Fb(e,r,t.firstChild,n,i,o,!1)}function kj(t,n,e){let r=n[Ot],i=RT(t,e,n),o=e.parent||n[Yn],s=OT(o,e,n);PT(r,0,n,e,i,s)}function PT(t,n,e,r,i,o){let s=e[Zn],l=s[Yn].projection[r.projection];if(Array.isArray(l))for(let c=0;c<l.length;c++){let u=l[c];Fl(n,t,e[ho],i,u,r,o,e)}else{let c=l,u=s[vn];iT(r)&&(c.flags|=128),Fb(t,n,c,u,i,o,!0)}}function Mj(t,n,e,r,i,o,s){let a=r[Vo],l=Pr(r);a!==l&&Fl(n,t,e,o,a,i,s);for(let c=Zt;c<r.length;c++){let u=r[c];im(u[pe],u,t,n,o,a)}}function Aj(t,n,e,r,i){if(n)i?t.addClass(e,r):t.removeClass(e,r);else{let o=r.indexOf("-")===-1?void 0:pi.DashCase;i==null?t.removeStyle(e,r,o):(typeof i=="string"&&i.endsWith("!important")&&(i=i.slice(0,-10),o|=pi.Important),t.setStyle(e,r,i,o))}}function FT(t,n,e,r,i){let o=Oi(),s=r&2;try{$o(-1),s&&n.length>Mt&&kT(t,n,Mt,!1);let a=s?ot.TemplateUpdateStart:ot.TemplateCreateStart;yt(a,i,e),e(r,i)}finally{$o(o);let a=s?ot.TemplateUpdateEnd:ot.TemplateCreateEnd;yt(a,i,e)}}function om(t,n,e){jj(t,n,e),(e.flags&64)===64&&Bj(t,n,e)}function Xu(t,n,e=ui){let r=n.localNames;if(r!==null){let i=n.index+1;for(let o=0;o<r.length;o+=2){let s=r[o+1],a=s===-1?e(n,t):t[s];t[i++]=a}}}function xj(t,n,e,r){let o=r.get(hT,dT)||e===fi.ShadowDom||e===fi.ExperimentalIsolatedShadowDom,s=t.selectRootElement(n,o);return Rj(s),s}function Rj(t){Oj(t)}var Oj=()=>null;function Nj(t){return t==="class"?"className":t==="for"?"htmlFor":t==="formaction"?"formAction":t==="innerHtml"?"innerHTML":t==="readonly"?"readOnly":t==="tabindex"?"tabIndex":t}function Pj(t,n,e,r,i,o){let s=n[pe];if(Vb(t,s,n,e,r)){Uo(t)&&Lj(n,t.index);return}t.type&3&&(e=Nj(e)),Fj(t,n,e,r,i,o)}function Fj(t,n,e,r,i,o){if(t.type&3){let s=ui(t,n);r=o!=null?o(r,t.value||"",e):r,i.setProperty(s,e,r)}else t.type&12}function Lj(t,n){let e=Fr(n,t);e[xe]&16||(e[xe]|=64)}function jj(t,n,e){let r=e.directiveStart,i=e.directiveEnd;Uo(e)&&fj(n,e,t.data[r+e.componentOffset]),t.firstCreatePass||Pp(e,n);let o=e.initialInputs;for(let s=r;s<i;s++){let a=t.data[s],l=$u(n,t,s,e);if(Bl(l,n),o!==null&&$j(n,s-r,l,a,e,o),ci(a)){let c=Fr(e.index,n);c[tn]=$u(n,t,s,e)}}}function Bj(t,n,e){let r=e.directiveStart,i=e.directiveEnd,o=e.index,s=QI();try{$o(o);for(let a=r;a<i;a++){let l=t.data[a],c=n[a];gp(a),(l.hostBindings!==null||l.hostVars!==0||l.hostAttrs!==null)&&Vj(l,c)}}finally{$o(-1),gp(s)}}function Vj(t,n){t.hostBindings!==null&&t.hostBindings(1,n)}function Lb(t,n){let e=t.directiveRegistry,r=null;if(e)for(let i=0;i<e.length;i++){let o=e[i];wT(n,o.selectors,!1)&&(r??=[],ci(o)?r.unshift(o):r.push(o))}return r}function Uj(t,n,e,r,i,o){let s=ui(t,n);Hj(n[Ot],s,o,t.value,e,r,i)}function Hj(t,n,e,r,i,o,s){if(o==null)t.removeAttribute(n,i,e);else{let a=s==null?Il(o):s(o,r||"",i);t.setAttribute(n,i,a,e)}}function $j(t,n,e,r,i,o){let s=o[n];if(s!==null)for(let a=0;a<s.length;a+=2){let l=s[a],c=s[a+1];J0(r,e,l,c)}}function jb(t,n,e,r,i){let o=Mt+e,s=n[pe],a=i(s,n,t,r,e);n[o]=a,na(t,!0);let l=t.type===2;return l?(DT(n[Ot],a,t),(GI()===0||xl(t))&&Bl(a,n),KI()):Bl(a,n),bp()&&(!l||!Xp(t))&&Pb(s,n,a,t),t}function Bb(t){let n=t;return y0()?_0():(n=n.parent,na(n,!1)),n}function zj(t,n){let e=t[ho];if(!e)return;let r;try{r=e.get(_r,null)}catch{r=null}r?.(n)}function Vb(t,n,e,r,i){let o=t.inputs?.[r],s=t.hostDirectiveInputs?.[r],a=!1;if(s)for(let l=0;l<s.length;l+=2){let c=s[l],u=s[l+1],d=n.data[c];J0(d,e[c],u,i),a=!0}if(o)for(let l of o){let c=e[l],u=n.data[l];J0(u,c,r,i),a=!0}return a}function qj(t,n){let e=Fr(n,t),r=e[pe];Wj(r,e);let i=e[ai];i!==null&&e[Ks]===null&&(e[Ks]=fT(i,e[ho])),yt(ot.ComponentStart);try{Ub(r,e,e[tn])}finally{yt(ot.ComponentEnd,e[tn])}}function Wj(t,n){for(let e=n.length;e<t.blueprint.length;e++)n.push(t.blueprint[e])}function Ub(t,n,e){yp(n);try{let r=t.viewQuery;r!==null&&K0(1,r,e);let i=t.template;i!==null&&FT(t,n,i,1,e),t.firstCreatePass&&(t.firstCreatePass=!1),n[xi]?.finishViewCreation(t),t.staticContentQueries&&pT(t,n),t.staticViewQueries&&K0(2,t.viewQuery,e);let o=t.components;o!==null&&Gj(n,o)}catch(r){throw t.firstCreatePass&&(t.incompleteFirstPass=!0,t.firstCreatePass=!1),r}finally{n[xe]&=-5,_p()}}function Gj(t,n){for(let e=0;e<n.length;e++)qj(t,n[e])}function Qu(t,n,e,r){let i=he(null);try{let o=n.tView,a=t[xe]&4096?4096:16,l=Mb(t,o,e,a,null,n,null,null,r?.injector??null,r?.embeddedViewInjector??null,r?.dehydratedView??null),c=t[n.index];l[Bo]=c;let u=t[xi];return u!==null&&(l[xi]=u.createEmbeddedView(o)),Ub(o,l,e),l}finally{he(i)}}function Vl(t,n){return!n||n.firstChild===null||iT(t)}function qu(t,n,e,r,i=!1){for(;e!==null;){if(e.type===128){e=i?e.projectionNext:e.next;continue}let o=n[e.index];o!==null&&r.push(Pr(o)),li(o)&<(o,r);let s=e.type;if(s&8)qu(t,n,e.child,r);else if(s&32){let a=xb(e,n),l;for(;l=a();)r.push(l)}else if(s&16){let a=NT(n,e);if(Array.isArray(a))r.push(...a);else{let l=jo(n[Zn]);qu(l[pe],l,a,r,!0)}}e=i?e.projectionNext:e.next}return r}function LT(t,n){for(let e=Zt;e<t.length;e++){let r=t[e],i=r[pe].firstChild;i!==null&&qu(r[pe],r,i,n)}t[Vo]!==t[ai]&&n.push(t[Vo])}function jT(t){if(t[Zs]!==null){for(let n of t[Zs])n.impl.addSequence(n);t[Zs].length=0}}var BT=[];function Kj(t){return t[yr]??Jj(t)}function Jj(t){let n=BT.pop()??Object.create(Zj);return n.lView=t,n}function Yj(t){t.lView[yr]!==t&&(t.lView=null,BT.push(t))}var Zj=Z(A({},Ms),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:t=>{ta(t.lView)},consumerOnSignalRead(){this.lView[yr]=this}});function Xj(t){let n=t[yr]??Object.create(Qj);return n.lView=t,n}var Qj=Z(A({},Ms),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:t=>{let n=jo(t.lView);for(;n&&!VT(n[pe]);)n=jo(n);n&&c0(n)},consumerOnSignalRead(){this.lView[yr]=this}});function VT(t){return t.type!==2}function UT(t){if(t[Lo]===null)return;let n=!0;for(;n;){let e=!1;for(let r of t[Lo])r.dirty&&(e=!0,r.zone===null||Zone.current===r.zone?r.run():r.zone.run(()=>r.run()));n=e&&!!(t[xe]&8192)}}var eB=100;function HT(t,n=0){let r=t[Ai].rendererFactory,i=!1;i||r.begin?.();try{tB(t,n)}finally{i||r.end?.()}}function tB(t,n){let e=w0();try{Su(!0),Z0(t,n);let r=0;for(;Fu(t);){if(r===eB)throw new z(103,!1);r++,Z0(t,1)}}finally{Su(e)}}function nB(t,n,e,r){if(ea(n))return;let i=n[xe],o=!1,s=!1;yp(n);let a=!0,l=null,c=null;o||(VT(t)?(c=Kj(n),l=Ro(c)):_f()===null?(a=!1,c=Xj(n),l=Ro(c)):n[yr]&&(no(n[yr]),n[yr]=null));try{l0(n),YI(t.bindingStartIndex),e!==null&&FT(t,n,e,2,r);let u=(i&3)===3;if(!o)if(u){let h=t.preOrderCheckHooks;h!==null&&Ip(n,h,null)}else{let h=t.preOrderHooks;h!==null&&Tp(n,h,0,null),O0(n,0)}if(s||rB(n),UT(n),$T(n,0),t.contentQueries!==null&&pT(t,n),!o)if(u){let h=t.contentCheckHooks;h!==null&&Ip(n,h)}else{let h=t.contentHooks;h!==null&&Tp(n,h,1),O0(n,1)}oB(t,n);let d=t.components;d!==null&&qT(n,d,0);let f=t.viewQuery;if(f!==null&&K0(2,f,r),!o)if(u){let h=t.viewCheckHooks;h!==null&&Ip(n,h)}else{let h=t.viewHooks;h!==null&&Tp(n,h,2),O0(n,2)}if(t.firstUpdatePass===!0&&(t.firstUpdatePass=!1),n[hp]){for(let h of n[hp])h();n[hp]=null}o||(jT(n),n[xe]&=-73)}catch(u){throw o||ta(n),u}finally{c!==null&&(xs(c,l),a&&Yj(c)),_p()}}function $T(t,n){for(let e=sT(t);e!==null;e=aT(e))for(let r=Zt;r<e.length;r++){let i=e[r];zT(i,n)}}function rB(t){for(let n=sT(t);n!==null;n=aT(n)){if(!(n[xe]&2))continue;let e=n[Qs];for(let r=0;r<e.length;r++){let i=e[r];c0(i)}}}function iB(t,n,e){yt(ot.ComponentStart);let r=Fr(n,t);try{zT(r,e)}finally{yt(ot.ComponentEnd,r[tn])}}function zT(t,n){fp(t)&&Z0(t,n)}function Z0(t,n){let r=t[pe],i=t[xe],o=t[yr],s=!!(n===0&&i&16);if(s||=!!(i&64&&n===0),s||=!!(i&1024),s||=!!(o?.dirty&&Rs(o)),s||=!1,o&&(o.dirty=!1),t[xe]&=-9217,s)nB(r,t,r.template,t[tn]);else if(i&8192){let a=he(null);try{UT(t),$T(t,1);let l=r.components;l!==null&&qT(t,l,1),jT(t)}finally{he(a)}}}function qT(t,n,e){for(let r=0;r<n.length;r++)iB(t,n[r],e)}function oB(t,n){let e=t.hostBindingOpCodes;if(e!==null)try{for(let r=0;r<e.length;r++){let i=e[r];if(i<0)$o(~i);else{let o=i,s=e[++r],a=e[++r];XI(s,o);let l=n[o];yt(ot.HostBindingsUpdateStart,l);try{a(2,l)}finally{yt(ot.HostBindingsUpdateEnd,l)}}}}finally{$o(-1)}}function Hb(t,n){let e=w0()?64:1088;for(t[Ai].changeDetectionScheduler?.notify(n);t;){t[xe]|=e;let r=jo(t);if(Rl(t)&&!r)return t;t=r}return null}function WT(t,n,e,r){return[t,!0,0,n,null,r,null,e,null,null]}function GT(t,n){let e=Zt+n;if(e<t.length)return t[e]}function ed(t,n,e,r=!0){let i=n[pe];if(sB(i,n,t,e),r){let s=Y0(e,t),a=n[Ot],l=a.parentNode(t[Vo]);l!==null&&bj(i,t[Yn],a,n,l,s)}let o=n[Ks];o!==null&&o.firstChild!==null&&(o.firstChild=null)}function KT(t,n){let e=Wu(t,n);return e!==void 0&&rm(e[pe],e),e}function Wu(t,n){if(t.length<=Zt)return;let e=Zt+n,r=t[e];if(r){let i=r[Bo];i!==null&&i!==t&&Nb(i,r),n>0&&(t[e-1][Nr]=r[Nr]);let o=ku(t,Zt+n);_j(r[pe],r);let s=o[xi];s!==null&&s.detachView(o[pe]),r[vn]=null,r[Nr]=null,r[xe]&=-129}return r}function sB(t,n,e,r){let i=Zt+r,o=e.length;r>0&&(e[i-1][Nr]=n),r<o-Zt?(n[Nr]=e[i],J_(e,Zt+r,n)):(e.push(n),n[Nr]=null),n[vn]=e;let s=n[Bo];s!==null&&e!==s&&JT(s,n);let a=n[xi];a!==null&&a.insertView(t),pp(n),n[xe]|=128}function JT(t,n){let e=t[Qs],r=n[vn];if(Ri(r))t[xe]|=2;else{let i=r[vn][Zn];n[Zn]!==i&&(t[xe]|=2)}e===null?t[Qs]=[n]:e.push(n)}var qo=class{_lView;_cdRefInjectingView;_appRef=null;_attachedToViewContainer=!1;exhaustive;get rootNodes(){let n=this._lView,e=n[pe];return qu(e,n,e.firstChild,[])}constructor(n,e){this._lView=n,this._cdRefInjectingView=e}get context(){return this._lView[tn]}set context(n){this._lView[tn]=n}get destroyed(){return ea(this._lView)}destroy(){if(this._appRef)this._appRef.detachView(this);else if(this._attachedToViewContainer){let n=this._lView[vn];if(li(n)){let e=n[Ru],r=e?e.indexOf(this):-1;r>-1&&(Wu(n,r),ku(e,r))}this._attachedToViewContainer=!1}rm(this._lView[pe],this._lView)}onDestroy(n){u0(this._lView,n)}markForCheck(){Hb(this._cdRefInjectingView||this._lView,4)}detach(){this._lView[xe]&=-129}reattach(){pp(this._lView),this._lView[xe]|=128}detectChanges(){this._lView[xe]|=1024,HT(this._lView)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new z(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null;let n=Rl(this._lView),e=this._lView[Bo];e!==null&&!n&&Nb(e,this._lView),xT(this._lView[pe],this._lView)}attachToAppRef(n){if(this._attachedToViewContainer)throw new z(902,!1);this._appRef=n;let e=Rl(this._lView),r=this._lView[Bo];r!==null&&!e&&JT(r,this._lView),pp(this._lView)}};var Xn=(()=>{class t{_declarationLView;_declarationTContainer;elementRef;static __NG_ELEMENT_ID__=aB;constructor(e,r,i){this._declarationLView=e,this._declarationTContainer=r,this.elementRef=i}get ssrId(){return this._declarationTContainer.tView?.ssrId||null}createEmbeddedView(e,r){return this.createEmbeddedViewImpl(e,r)}createEmbeddedViewImpl(e,r,i){let o=Qu(this._declarationLView,this._declarationTContainer,e,{embeddedViewInjector:r,dehydratedView:i});return new qo(o)}}return t})();function aB(){return sm(In(),de())}function sm(t,n){return t.type&4?new Xn(n,t,$l(t,n)):null}function la(t,n,e,r,i){let o=t.data[n];if(o===null)o=lB(t,n,e,r,i),ZI()&&(o.flags|=32);else if(o.type&64){o.type=e,o.value=r,o.attrs=i;let s=JI();o.injectorIndex=s===null?-1:s.injectorIndex}return na(o,!0),o}function lB(t,n,e,r,i){let o=v0(),s=y0(),a=s?o:o&&o.parent,l=t.data[n]=uB(t,a,e,n,r,i);return cB(t,l,o,s),l}function cB(t,n,e,r){t.firstChild===null&&(t.firstChild=n),e!==null&&(r?e.child==null&&n.parent!==null&&(e.child=n):e.next===null&&(e.next=n,n.prev=e))}function uB(t,n,e,r,i,o){let s=n?n.injectorIndex:-1,a=0;return p0()&&(a|=128),{type:e,index:r,insertBeforeIndex:null,injectorIndex:s,directiveStart:-1,directiveEnd:-1,directiveStylingLast:-1,componentOff
vendor: 5,710 bytes, line 7
7set:-1,fieldIndex:-1,customControlIndex:-1,propertyBindings:null,flags:a,providerIndexes:0,value:i,attrs:o,mergedAttrs:null,localNames:null,initialInputs:null,inputs:null,hostDirectiveInputs:null,outputs:null,hostDirectiveOutputs:null,directiveToIndex:null,tView:null,next:null,prev:null,projectionNext:null,child:null,parent:n,projection:null,styles:null,stylesWithoutHost:null,residualStyles:void 0,classes:null,classesWithoutHost:null,residualClasses:void 0,classBindings:0,styleBindings:0}}function dB(t){let n=t[i0]??[],r=t[vn][Ot],i=[];for(let o of n)o.data[uT]!==void 0?i.push(o):hB(o,r);t[i0]=i}function hB(t,n){let e=0,r=t.firstChild;if(r){let i=t.data[cT];for(;e<i;){let o=r.nextSibling;ST(n,r,!1),r=o,e++}}}var fB=()=>null,pB=()=>null;function Bp(t,n){return fB(t,n)}function YT(t,n,e){return pB(t,n,e)}var ZT=class{},am=class{},X0=class{resolveComponentFactory(n){throw new z(917,!1)}},td=class{static NULL=new X0},Un=class{},Tn=(()=>{class t{destroyNode=null;static __NG_ELEMENT_ID__=()=>mB()}return t})();function mB(){let t=de(),n=In(),e=Fr(n.index,t);return(Ri(e)?e:t)[Ot]}var XT=(()=>{class t{static \u0275prov=O({token:t,providedIn:"root",factory:()=>null})}return t})();var Mp={},Q0=class{injector;parentInjector;constructor(n,e){this.injector=n,this.parentInjector=e}get(n,e,r){let i=this.injector.get(n,Mp,r);return i!==Mp||e===Mp?i:this.parentInjector.get(n,e,r)}};function Vp(t,n,e){let r=e?t.styles:null,i=e?t.classes:null,o=0;if(n!==null)for(let s=0;s<n.length;s++){let a=n[s];if(typeof a=="number")o=a;else if(o==1)i=op(i,a);else if(o==2){let l=a,c=n[++s];r=op(r,l+": "+c+";")}}e?t.styles=r:t.stylesWithoutHost=r,e?t.classes=i:t.classesWithoutHost=i}function _e(t,n=0){let e=de();if(e===null)return Q(t,n);let r=In();return eT(r,e,gn(t),n)}function $b(){let t="invalid";throw new Error(t)}function QT(t,n,e,r,i){let o=r===null?null:{"":-1},s=i(t,e);if(s!==null){let a=s,l=null,c=null;for(let u of s)if(u.resolveHostDirectives!==null){[a,l,c]=u.resolveHostDirectives(s);break}yB(t,n,e,a,o,l,c)}o!==null&&r!==null&&gB(e,r,o)}function gB(t,n,e){let r=t.localNames=[];for(let i=0;i<n.length;i+=2){let o=e[n[i+1]];if(o==null)throw new z(-301,!1);r.push(n[i],o)}}function vB(t,n,e){n.componentOffset=e,(t.components??=[]).push(n.index)}function yB(t,n,e,r,i,o,s){let a=r.length,l=!1;for(let f=0;f<a;f++){let h=r[f];!l&&ci(h)&&(l=!0,vB(t,e,f)),q0(Pp(e,n),t,h.type)}SB(e,t.data.length,a);for(let f=0;f<a;f++){let h=r[f];h.providersResolver&&h.providersResolver(h)}let c=!1,u=!1,d=TT(t,n,a,null);a>0&&(e.directiveToIndex=new Map);for(let f=0;f<a;f++){let h=r[f];if(e.mergedAttrs=jl(e.mergedAttrs,h.hostAttrs),bB(t,e,n,d,h),CB(d,h,i),s!==null&&s.has(h)){let[m,g]=s.get(h);e.directiveToIndex.set(h.type,[d,m+e.directiveStart,g+e.directiveStart])}else(o===null||!o.has(h))&&e.directiveToIndex.set(h.type,d);h.contentQueries!==null&&(e.flags|=4),(h.hostBindings!==null||h.hostAttrs!==null||h.hostVars!==0)&&(e.flags|=64);let p=h.type.prototype;!c&&(p.ngOnChanges||p.ngOnInit||p.ngDoCheck)&&((t.preOrderHooks??=[]).push(e.index),c=!0),!u&&(p.ngOnChanges||p.ngDoCheck)&&((t.preOrderCheckHooks??=[]).push(e.index),u=!0),d++}_B(t,e,o)}function _B(t,n,e){for(let r=n.directiveStart;r<n.directiveEnd;r++){let i=t.data[r];if(e===null||!e.has(i))D1(0,n,i,r),D1(1,n,i,r),T1(n,r,!1);else{let o=e.get(i);I1(0,n,o,r),I1(1,n,o,r),T1(n,r,!0)}}}function D1(t,n,e,r){let i=t===0?e.inputs:e.outputs;for(let o in i)if(i.hasOwnProperty(o)){let s;t===0?s=n.inputs??={}:s=n.outputs??={},s[o]??=[],s[o].push(r),ek(n,o)}}function I1(t,n,e,r){let i=t===0?e.inputs:e.outputs;for(let o in i)if(i.hasOwnProperty(o)){let s=i[o],a;t===0?a=n.hostDirectiveInputs??={}:a=n.hostDirectiveOutputs??={},a[s]??=[],a[s].push(r,o),ek(n,s)}}function ek(t,n){n==="class"?t.flags|=8:n==="style"&&(t.flags|=16)}function T1(t,n,e){let{attrs:r,inputs:i,hostDirectiveInputs:o}=t;if(r===null||!e&&i===null||e&&o===null||Tb(t)){t.initialInputs??=[],t.initialInputs.push(null);return}let s=null,a=0;for(;a<r.length;){let l=r[a];if(l===0){a+=4;continue}else if(l===5){a+=2;continue}else if(typeof l=="number")break;if(!e&&i.hasOwnProperty(l)){let c=i[l];for(let u of c)if(u===n){s??=[],s.push(l,r[a+1]);break}}else if(e&&o.hasOwnProperty(l)){let c=o[l];for(let u=0;u<c.length;u+=2)if(c[u]===n){s??=[],s.push(c[u+1],r[a+1]);break}}a+=2}t.initialInputs??=[],t.initialInputs.push(s)}function bB(t,n,e,r,i){t.data[r]=i;let o=i.factory||(i.factory=Fo(i.type,!0)),s=new oa(o,ci(i),_e,null);t.blueprint[r]=s,e[r]=s,wB(t,n,r,TT(t,e,i.hostVars,dr),i)}function wB(t,n,e,r,i){let o=i.hostBindings;if(o){let s=t.hostBindingOpCodes;s===null&&(s=t.hostBindingOpCodes=[]);let a=~n.index;EB(s)!=a&&s.push(a),s.push(e,r,o)}}function EB(t){let n=t.length;for(;n>0;){let e=t[--n];if(typeof e=="number"&&e<0)return e}return 0}function CB(t,n,e){if(e){if(n.exportAs)for(let r=0;r<n.exportAs.length;r++)e[n.exportAs[r]]=t;ci(n)&&(e[""]=t)}}function SB(t,n,e){t.flags|=1,t.directiveStart=n,t.directiveEnd=n+e,t.providerIndexes=n}function zb(t,n,e,r,i,o,s,a){let l=n[pe],c=l.consts,u=Lr(c,s),d=la(l,t,e,r,u);return o&&QT(l,n,d,Lr(c,a),i),d.mergedAttrs=jl(d.mergedAttrs,d.attrs),d.attrs!==null&&Vp(d,d.attrs,!1),d.mergedAttrs!==null&&Vp(d,d.mergedAttrs,!0),l.queries!==null&&l.queries.elementStart(l,d),d}function qb(t,n){q1(t,n),o0(n)&&t.queries.elementEnd(n)}function DB(t,n,e,r,i,o){let s=n.consts,a=Lr(s,i),l=la(n,t,e,r,a);if(l.mergedAttrs=jl(l.mergedAttrs,l.attrs),o!=null){let c=Lr(s,o);l.localNames=[];for(let u=0;u<c.length;u+=2)l.localNames.push(c[u],-1)}return l.attrs!==null&&Vp(l,l.attrs,!1),l.mergedAttrs!==null&&Vp(l,l.mergedAttrs,!0),n.queries!==null&&n.queries.elementStart(n,l),l}function Wb(t){return t!==null&&(typeof t=="function"||typeof t=="object")}
vendor: 4,232 bytes, line 7
7function nd(t,n,e){return t[n]=e}function IB(t,n){return t[n]}function jr(t,n,e){if(e===dr)return!1;let r=t[n];return Object.is(r,e)?!1:(t[n]=e,!0)}function Up(t,n,e,r){let i=jr(t,n,e);return jr(t,n+1,r)||i}function TB(t,n,e,r,i){let o=Up(t,n,e,r);return jr(t,n+2,i)||o}function kB(t,n,e,r,i,o){let s=Up(t,n,e,r);return Up(t,n+2,i,o)||s}function Ap(t,n,e){return function r(i){let o=Uo(t)?Fr(t.index,n):n;Hb(o,5);let s=n[tn],a=k1(n,s,e,i),l=r.__ngNextListenerFn__;for(;l;)a=k1(n,s,l,i)&&a,l=l.__ngNextListenerFn__;return a}}function k1(t,n,e,r){let i=he(null);try{return yt(ot.OutputStart,n,e),e(r)!==!1}catch(o){return zj(t,o),!1}finally{yt(ot.OutputEnd,n,e),he(i)}}function tk(t,n,e,r,i,o,s,a){let l=xl(t),c=!1,u=null;if(!r&&l&&(u=AB(n,e,o,t.index)),u!==null){let d=u.__ngLastListenerFn__||u;d.__ngNextListenerFn__=s,u.__ngLastListenerFn__=s,c=!0}else{let d=ui(t,e),f=r?r(d):d;BL(e,f,o,a);let h=i.listen(f,o,a);if(!MB(o)){let p=r?m=>r(Pr(m[t.index])):t.index;nk(p,n,e,o,a,h,!1)}}return c}function MB(t){return t.startsWith("animation")||t.startsWith("transition")}function AB(t,n,e,r){let i=t.cleanup;if(i!=null)for(let o=0;o<i.length-1;o+=2){let s=i[o];if(s===e&&i[o+1]===r){let a=n[Ml],l=i[o+2];return a&&a.length>l?a[l]:null}typeof s=="string"&&(o+=2)}return null}function nk(t,n,e,r,i,o,s){let a=n.firstCreatePass?h0(n):null,l=d0(e),c=l.length;l.push(i,o),a&&a.push(r,t,c,(c+1)*(s?-1:1))}function M1(t,n,e,r,i,o){let s=n[e],a=n[pe],c=a.data[e].outputs[r],d=s[c].subscribe(o);nk(t.index,a,n,i,o,d,!0)}var eb=Symbol("BINDING");var Hp=class extends td{ngModule;constructor(n){super(),this.ngModule=n}resolveComponentFactory(n){let e=Mi(n);return new Wo(e,this.ngModule)}};function xB(t){return Object.keys(t).map(n=>{let[e,r,i]=t[n],o={propName:e,templateName:n,isSignal:(r&em.SignalBased)!==0};return i&&(o.transform=i),o})}function RB(t){return Object.keys(t).map(n=>({propName:t[n],templateName:n}))}function OB(t,n,e){let r=n instanceof kt?n:n?.injector;return r&&t.getStandaloneInjector!==null&&(r=t.getStandaloneInjector(r)||r),r?new Q0(e,r):e}function NB(t){let n=t.get(Un,null);if(n===null)throw new z(407,!1);let e=t.get(XT,null),r=t.get(ki,null);return{rendererFactory:n,sanitizer:e,changeDetectionScheduler:r,ngReflect:!1}}function PB(t,n){let e=rk(t);return ET(n,e,e==="svg"?s0:e==="math"?UI:null)}function rk(t){return(t.selectors[0][0]||"div").toLowerCase()}var Wo=class extends am{componentDef;ngModule;selector;componentType;ngContentSelectors;isBoundToModule;cachedInputs=null;cachedOutputs=null;get inputs(){return this.cachedInputs??=xB(this.componentDef.inputs),this.cachedInputs}get outputs(){return this.cachedOutputs??=RB(this.componentDef.outputs),this.cachedOutputs}constructor(n,e){super(),this.componentDef=n,this.ngModule=e,this.componentType=n.type,this.selector=ij(n.selectors),this.ngContentSelectors=n.ngContentSelectors??[],this.isBoundToModule=!!e}create(n,e,r,i,o,s){yt(ot.DynamicComponentStart);let a=he(null);try{let l=this.componentDef,c=FB(r,l,s,o),u=OB(l,i||this.ngModule,n),d=NB(u),f=d.rendererFactory.createRenderer(null,l),h=r?xj(f,r,l.encapsulation,u):PB(l,f),p=s?.some(A1)||o?.some(w=>typeof w!="function"&&w.bindings.some(A1)),m=Mb(null,c,null,512|IT(l),null,null,d,f,u,null,fT(h,u,!0));m[Mt]=h,yp(m);let g=null;try{let w=zb(Mt,m,2,"#host",()=>c.directiveRegistry,!0,0);DT(f,h,w),Bl(h,m),om(c,m,w),Sb(c,w,m),qb(c,w),e!==void 0&&jB(w,this.ngContentSelectors,e),g=Fr(w.index,m),m[tn]=g[tn],Ub(c,m,null)}catch(w){throw g!==null&&G0(g),G0(m),w}finally{yt(ot.DynamicComponentEnd),_p()}return new $p(this.componentType,m,!!p)}finally{he(a)}}};function FB(t,n,e,r){let i=t?["ng-version","21.0.1"]:oj(n.selectors[0]),o=null,s=null,a=0;if(e)for(let u of e)a+=u[eb].requiredVars,u.create&&(u.targetIdx=0,(o??=[]).push(u)),u.update&&(u.targetIdx=0,(s??=[]).push(u));if(r)for(let u=0;u<r.length;u++){let d=r[u];if(typeof d!="function")for(let f of d.bindings){a+=f[eb].requiredVars;let h=u+1;f.create&&(f.targetIdx=h,(o??=[]).push(f)),f.update&&(f.targetIdx=h,(s??=[]).push(f))}}let l=[n];if(r)for(let u of r){let d=typeof u=="function"?u:u.type,f=dp(d);l.push(f)}return kb(0,null,LB(o,s),1,a,l,null,null,null,[i],null)}function LB(t,n){return!t&&!n?null:e=>{if(e&1&&t)for(let r of t)r.create();
vendor: 8,338 bytes, line 7
7if(e&2&&n)for(let r of n)r.update()}}function A1(t){let n=t[eb].kind;return n==="input"||n==="twoWay"}var $p=class extends ZT{_rootLView;_hasInputBindings;instance;hostView;changeDetectorRef;componentType;location;previousInputValues=null;_tNode;constructor(n,e,r){super(),this._rootLView=e,this._hasInputBindings=r,this._tNode=Ou(e[pe],Mt),this.location=$l(this._tNode,e),this.instance=Fr(this._tNode.index,e)[tn],this.hostView=this.changeDetectorRef=new qo(e,void 0),this.componentType=n}setInput(n,e){this._hasInputBindings;let r=this._tNode;if(this.previousInputValues??=new Map,this.previousInputValues.has(n)&&Object.is(this.previousInputValues.get(n),e))return;let i=this._rootLView,o=Vb(r,i[pe],i,n,e);this.previousInputValues.set(n,e);let s=Fr(r.index,i);Hb(s,1)}get injector(){return new ia(this._tNode,this._rootLView)}destroy(){this.hostView.destroy()}onDestroy(n){this.hostView.onDestroy(n)}};function jB(t,n,e){let r=t.projection=[];for(let i=0;i<n.length;i++){let o=e[i];r.push(o!=null&&o.length?Array.from(o):null)}}var Hn=(()=>{class t{static __NG_ELEMENT_ID__=BB}return t})();function BB(){let t=In();return ok(t,de())}var VB=Hn,ik=class extends VB{_lContainer;_hostTNode;_hostLView;constructor(n,e,r){super(),this._lContainer=n,this._hostTNode=e,this._hostLView=r}get element(){return $l(this._hostTNode,this._hostLView)}get injector(){return new ia(this._hostTNode,this._hostLView)}get parentInjector(){let n=_b(this._hostTNode,this._hostLView);if(K1(n)){let e=Op(n,this._hostLView),r=Rp(n),i=e[pe].data[r+8];return new ia(i,e)}else return new ia(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(n){let e=x1(this._lContainer);return e!==null&&e[n]||null}get length(){return this._lContainer.length-Zt}createEmbeddedView(n,e,r){let i,o;typeof r=="number"?i=r:r!=null&&(i=r.index,o=r.injector);let s=Bp(this._lContainer,n.ssrId),a=n.createEmbeddedViewImpl(e||{},o,s);return this.insertImpl(a,i,Vl(this._hostTNode,s)),a}createComponent(n,e,r,i,o,s,a){let l=n&&!hL(n),c;if(l)c=e;else{let g=e||{};c=g.index,r=g.injector,i=g.projectableNodes,o=g.environmentInjector||g.ngModuleRef,s=g.directives,a=g.bindings}let u=l?n:new Wo(Mi(n)),d=r||this.parentInjector;if(!o&&u.ngModule==null){let w=(l?d:this.parentInjector).get(kt,null);w&&(o=w)}let f=Mi(u.componentType??{}),h=Bp(this._lContainer,f?.id??null),p=h?.firstChild??null,m=u.create(d,i,p,o,s,a);return this.insertImpl(m.hostView,c,Vl(this._hostTNode,h)),m}insert(n,e){return this.insertImpl(n,e,!0)}insertImpl(n,e,r){let i=n._lView;if($I(i)){let a=this.indexOf(n);if(a!==-1)this.detach(a);else{let l=i[vn],c=new ik(l,l[Yn],l[vn]);c.detach(c.indexOf(n))}}let o=this._adjustIndex(e),s=this._lContainer;return ed(s,i,o,r),n.attachToViewContainerRef(),J_(F0(s),o,n),n}move(n,e){return this.insert(n,e)}indexOf(n){let e=x1(this._lContainer);return e!==null?e.indexOf(n):-1}remove(n){let e=this._adjustIndex(n,-1),r=Wu(this._lContainer,e);r&&(ku(F0(this._lContainer),e),rm(r[pe],r))}detach(n){let e=this._adjustIndex(n,-1),r=Wu(this._lContainer,e);return r&&ku(F0(this._lContainer),e)!=null?new qo(r):null}_adjustIndex(n,e=0){return n??this.length+e}};function x1(t){return t[Ru]}function F0(t){return t[Ru]||(t[Ru]=[])}function ok(t,n){let e,r=n[t.index];return li(r)?e=r:(e=WT(r,n,null,t),n[t.index]=e,Ab(n,e)),HB(e,n,t,r),new ik(e,t,n)}function UB(t,n){let e=t[Ot],r=e.createComment(""),i=ui(n,t),o=e.parentNode(i);return jp(e,o,r,e.nextSibling(i),!1),r}var HB=qB,$B=()=>!1;function zB(t,n,e){return $B(t,n,e)}function qB(t,n,e,r){if(t[Vo])return;let i;e.type&8?i=Pr(r):i=UB(n,e),t[Vo]=i}var tb=class t{queryList;matches=null;constructor(n){this.queryList=n}clone(){return new t(this.queryList)}setDirty(){this.queryList.setDirty()}},nb=class t{queries;constructor(n=[]){this.queries=n}createEmbeddedView(n){let e=n.queries;if(e!==null){let r=n.contentQueries!==null?n.contentQueries[0]:e.length,i=[];for(let o=0;o<r;o++){let s=e.getByIndex(o),a=this.queries[s.indexInDeclarationView];i.push(a.clone())}return new t(i)}return null}insertView(n){this.dirtyQueriesWithMatches(n)}detachView(n){this.dirtyQueriesWithMatches(n)}finishViewCreation(n){this.dirtyQueriesWithMatches(n)}dirtyQueriesWithMatches(n){for(let e=0;e<this.queries.length;e++)Kb(n,e).matches!==null&&this.queries[e].setDirty()}},zp=class{flags;read;predicate;constructor(n,e,r=null){this.flags=e,this.read=r,typeof n=="string"?this.predicate=YB(n):this.predicate=n}},rb=class t{queries;constructor(n=[]){this.queries=n}elementStart(n,e){for(let r=0;r<this.queries.length;r++)this.queries[r].elementStart(n,e)}elementEnd(n){for(let e=0;e<this.queries.length;e++)this.queries[e].elementEnd(n)}embeddedTView(n){let e=null;for(let r=0;r<this.length;r++){let i=e!==null?e.length:0,o=this.getByIndex(r).embeddedTView(n,i);o&&(o.indexInDeclarationView=r,e!==null?e.push(o):e=[o])}return e!==null?new t(e):null}template(n,e){for(let r=0;r<this.queries.length;r++)this.queries[r].template(n,e)}getByIndex(n){return this.queries[n]}get length(){return this.queries.length}track(n){this.queries.push(n)}},ib=class t{metadata;matches=null;indexInDeclarationView=-1;crossesNgTemplate=!1;_declarationNodeIndex;_appliesToNextNode=!0;constructor(n,e=-1){this.metadata=n,this._declarationNodeIndex=e}elementStart(n,e){this.isApplyingToNode(e)&&this.matchTNode(n,e)}elementEnd(n){this._declarationNodeIndex===n.index&&(this._appliesToNextNode=!1)}template(n,e){this.elementStart(n,e)}embeddedTView(n,e){return this.isApplyingToNode(n)?(this.crossesNgTemplate=!0,this.addMatch(-n.index,e),new t(this.metadata)):null}isApplyingToNode(n){if(this._appliesToNextNode&&(this.metadata.flags&1)!==1){let e=this._declarationNodeIndex,r=n.parent;for(;r!==null&&r.type&8&&r.index!==e;)r=r.parent;return e===(r!==null?r.index:-1)}return this._appliesToNextNode}matchTNode(n,e){let r=this.metadata.predicate;if(Array.isArray(r))for(let i=0;i<r.length;i++){let o=r[i];this.matchTNodeWithReadOption(n,e,WB(e,o)),this.matchTNodeWithReadOption(n,e,kp(e,n,o,!1,!1))}else r===Xn?e.type&4&&this.matchTNodeWithReadOption(n,e,-1):this.matchTNodeWithReadOption(n,e,kp(e,n,r,!1,!1))}matchTNodeWithReadOption(n,e,r){if(r!==null){let i=this.metadata.read;if(i!==null)if(i===We||i===Hn||i===Xn&&e.type&4)this.addMatch(e.index,-2);else{let o=kp(e,n,i,!1,!1);o!==null&&this.addMatch(e.index,o)}else this.addMatch(e.index,r)}}addMatch(n,e){this.matches===null?this.matches=[n,e]:this.matches.push(n,e)}};function WB(t,n){let e=t.localNames;if(e!==null){for(let r=0;r<e.length;r+=2)if(e[r]===n)return e[r+1]}return null}function GB(t,n){return t.type&11?$l(t,n):t.type&4?sm(t,n):null}function KB(t,n,e,r){return e===-1?GB(n,t):e===-2?JB(t,n,r):$u(t,t[pe],e,n)}function JB(t,n,e){if(e===We)return $l(n,t);if(e===Xn)return sm(n,t);if(e===Hn)return ok(n,t)}function sk(t,n,e,r){let i=n[xi].queries[r];if(i.matches===null){let o=t.data,s=e.matches,a=[];for(let l=0;s!==null&&l<s.length;l+=2){let c=s[l];if(c<0)a.push(null);else{let u=o[c];a.push(KB(n,u,s[l+1],e.metadata.read))}}i.matches=a}return i.matches}function ob(t,n,e,r){let i=t.queries.getByIndex(e),o=i.matches;if(o!==null){let s=sk(t,n,i,e);for(let a=0;a<o.length;a+=2){let l=o[a];if(l>0)r.push(s[a/2]);else{let c=o[a+1],u=n[-l];for(let d=Zt;d<u.length;d++){let f=u[d];f[Bo]===f[vn]&&ob(f[pe],f,c,r)}if(u[Qs]!==null){let d=u[Qs];for(let f=0;f<d.length;f++){let h=d[f];ob(h[pe],h,c,r)}}}}}return r}function Gb(t,n){return t[xi].queries[n].queryList}function ak(t,n,e){let r=new Fp((e&4)===4);return WI(t,n,r,r.destroy),(n[xi]??=new nb).queries.push(new tb(r))-1}function lk(t,n,e){let r=Ht();return r.firstCreatePass&&(uk(r,new zp(t,n,e),-1),(n&2)===2&&(r.staticViewQueries=!0)),ak(r,de(),n)}function ck(t,n,e,r){let i=Ht();if(i.firstCreatePass){let o=In();uk(i,new zp(n,e,r),o.index),ZB(i,t),(e&2)===2&&(i.staticContentQueries=!0)}return ak(i,de(),e)}function YB(t){return t.split(",").map(n=>n.trim())}function uk(t,n,e){t.queries===null&&(t.queries=new rb),t.queries.track(new ib(n,e))}function ZB(t,n){let e=t.contentQueries||(t.contentQueries=[]),r=e.length?e[e.length-1]:-1;n!==r&&e.push(t.queries.length-1,n)}function Kb(t,n){return t.queries.getByIndex(n)}function dk(t,n){let e=t[pe],r=Kb(e,n);return r.crossesNgTemplate?ob(e,t,n,[]):sk(e,t,r,n)}function Jb(t,n,e){let r,i=Os(()=>{r._dirtyCounter();let o=XB(r,t);if(n&&o===void 0)throw new z(-951,!1);return o}
vendor: 15,108 bytes, line 7
7);return r=i[Gt],r._dirtyCounter=Ee(0),r._flatValue=void 0,i}function hk(t){return Jb(!0,!1,t)}function fk(t){return Jb(!0,!0,t)}function pk(t){return Jb(!1,!1,t)}function mk(t,n){let e=t[Gt];e._lView=de(),e._queryIndex=n,e._queryList=Gb(e._lView,n),e._queryList.onDirty(()=>e._dirtyCounter.update(r=>r+1))}function XB(t,n){let e=t._lView,r=t._queryIndex;if(e===void 0||r===void 0||e[xe]&4)return n?void 0:Vn;let i=Gb(e,r),o=dk(e,r);return i.reset(o,rT),n?i.first:i._changesDetected||t._flatValue===void 0?t._flatValue=i.toArray():t._flatValue}var Pi=class{},lm=class{};var qp=class extends Pi{ngModuleType;_parent;_bootstrapComponents=[];_r3Injector;instance;destroyCbs=[];componentFactoryResolver=new Hp(this);constructor(n,e,r,i=!0){super(),this.ngModuleType=n,this._parent=e;let o=X_(n);this._bootstrapComponents=_T(o.bootstrap),this._r3Injector=I0(n,e,[{provide:Pi,useValue:this},{provide:td,useValue:this.componentFactoryResolver},...r],co(n),new Set(["environment"])),i&&this.resolveInjectorInitializers()}resolveInjectorInitializers(){this._r3Injector.resolveInjectorInitializers(),this.instance=this._r3Injector.get(this.ngModuleType)}get injector(){return this._r3Injector}destroy(){let n=this._r3Injector;!n.destroyed&&n.destroy(),this.destroyCbs.forEach(e=>e()),this.destroyCbs=null}onDestroy(n){this.destroyCbs.push(n)}},Wp=class extends lm{moduleType;constructor(n){super(),this.moduleType=n}create(n){return new qp(this.moduleType,n,[])}};var Gu=class extends Pi{injector;componentFactoryResolver=new Hp(this);instance=null;constructor(n){super();let e=new qs([...n.providers,{provide:Pi,useValue:this},{provide:td,useValue:this.componentFactoryResolver}],n.parent||kl(),n.debugName,new Set(["environment"]));this.injector=e,n.runEnvironmentInitializers&&e.resolveInjectorInitializers()}destroy(){this.injector.destroy()}onDestroy(n){this.injector.onDestroy(n)}};function Gl(t,n,e=null){return new Gu({providers:t,parent:n,debugName:e,runEnvironmentInitializers:!0}).injector}var QB=(()=>{class t{_injector;cachedInjectors=new Map;constructor(e){this._injector=e}getOrCreateStandaloneInjector(e){if(!e.standalone)return null;if(!this.cachedInjectors.has(e)){let r=Q_(!1,e.type),i=r.length>0?Gl([r],this._injector,`Standalone[${e.type.name}]`):null;this.cachedInjectors.set(e,i)}return this.cachedInjectors.get(e)}ngOnDestroy(){try{for(let e of this.cachedInjectors.values())e!==null&&e.destroy()}finally{this.cachedInjectors.clear()}}static \u0275prov=O({token:t,providedIn:"environment",factory:()=>new t(Q(kt))})}return t})();function ae(t){return Hl(()=>{let n=gk(t),e=Z(A({},n),{decls:t.decls,vars:t.vars,template:t.template,consts:t.consts||null,ngContentSelectors:t.ngContentSelectors,onPush:t.changeDetection===bb.OnPush,directiveDefs:null,pipeDefs:null,dependencies:n.standalone&&t.dependencies||null,getStandaloneInjector:n.standalone?i=>i.get(QB).getOrCreateStandaloneInjector(e):null,getExternalStyles:null,signals:t.signals??!1,data:t.data||{},encapsulation:t.encapsulation||fi.Emulated,styles:t.styles||Vn,_:null,schemas:t.schemas||null,tView:null,id:""});n.standalone&&mi("NgStandalone"),vk(e);let r=t.dependencies;return e.directiveDefs=R1(r,e3),e.pipeDefs=R1(r,NI),e.id=r3(e),e})}function e3(t){return Mi(t)||dp(t)}function bt(t){return Hl(()=>({type:t.type,bootstrap:t.bootstrap||Vn,declarations:t.declarations||Vn,imports:t.imports||Vn,exports:t.exports||Vn,transitiveCompileScopes:null,schemas:t.schemas||null,id:t.id||null}))}function t3(t,n){if(t==null)return si;let e={};for(let r in t)if(t.hasOwnProperty(r)){let i=t[r],o,s,a,l;Array.isArray(i)?(a=i[0],o=i[1],s=i[2]??o,l=i[3]||null):(o=i,s=i,a=em.None,l=null),e[o]=[r,a,l],n[o]=s}return e}function n3(t){if(t==null)return si;let n={};for(let e in t)t.hasOwnProperty(e)&&(n[t[e]]=e);return n}function Oe(t){return Hl(()=>{let n=gk(t);return vk(n),n})}function rd(t){return{type:t.type,name:t.name,factory:null,pure:t.pure!==!1,standalone:t.standalone??!0,onDestroy:t.type.prototype.ngOnDestroy||null}}function gk(t){let n={};return{type:t.type,providersResolver:null,factory:null,hostBindings:t.hostBindings||null,hostVars:t.hostVars||0,hostAttrs:t.hostAttrs||null,contentQueries:t.contentQueries||null,declaredInputs:n,inputConfig:t.inputs||si,exportAs:t.exportAs||null,standalone:t.standalone??!0,signals:t.signals===!0,selectors:t.selectors||Vn,viewQuery:t.viewQuery||null,features:t.features||null,setInput:null,resolveHostDirectives:null,hostDirectives:null,inputs:t3(t.inputs,n),outputs:n3(t.outputs),debugInfo:null}}function vk(t){t.features?.forEach(n=>n(t))}function R1(t,n){return t?()=>{let e=typeof t=="function"?t():t,r=[];for(let i of e){let o=n(i);o!==null&&r.push(o)}return r}:null}function r3(t){let n=0,e=typeof t.consts=="function"?"":t.consts,r=[t.selectors,t.ngContentSelectors,t.hostVars,t.hostAttrs,e,t.vars,t.decls,t.encapsulation,t.standalone,t.signals,t.exportAs,JSON.stringify(t.inputs),JSON.stringify(t.outputs),Object.getOwnPropertyNames(t.type.prototype),!!t.contentQueries,!!t.viewQuery];for(let o of r.join("|"))n=Math.imul(31,n)+o.charCodeAt(0)<<0;return n+=2147483648,"c"+n}function Yb(t){let n=e=>{let r=Array.isArray(t);e.hostDirectives===null?(e.resolveHostDirectives=i3,e.hostDirectives=r?t.map(sb):[t]):r?e.hostDirectives.unshift(...t.map(sb)):e.hostDirectives.unshift(t)};return n.ngInherit=!0,n}function i3(t){let n=[],e=!1,r=null,i=null;for(let o=0;o<t.length;o++){let s=t[o];if(s.hostDirectives!==null){let a=n.length;r??=new Map,i??=new Map,yk(s,n,r),i.set(s,[a,n.length-1])}o===0&&ci(s)&&(e=!0,n.push(s))}for(let o=e?1:0;o<t.length;o++)n.push(t[o]);return[n,r,i]}function yk(t,n,e){if(t.hostDirectives!==null)for(let r of t.hostDirectives)if(typeof r=="function"){let i=r();for(let o of i)O1(sb(o),n,e)}else O1(r,n,e)}function O1(t,n,e){let r=dp(t.directive);o3(r.declaredInputs,t.inputs),yk(r,n,e),e.set(r,t),n.push(r)}function sb(t){return typeof t=="function"?{directive:gn(t),inputs:si,outputs:si}:{directive:gn(t.directive),inputs:N1(t.inputs),outputs:N1(t.outputs)}}function N1(t){if(t===void 0||t.length===0)return si;let n={};for(let e=0;e<t.length;e+=2)n[t[e]]=t[e+1];return n}function o3(t,n){for(let e in n)if(n.hasOwnProperty(e)){let r=n[e],i=t[e];t[r]=i}}function s3(t){return Object.getPrototypeOf(t.prototype).constructor}function kn(t){let n=s3(t.type),e=!0,r=[t];for(;n;){let i;if(ci(t))i=n.\u0275cmp||n.\u0275dir;else{if(n.\u0275cmp)throw new z(903,!1);i=n.\u0275dir}if(i){if(e){r.push(i);let s=t;s.inputs=L0(t.inputs),s.declaredInputs=L0(t.declaredInputs),s.outputs=L0(t.outputs);let a=i.hostBindings;a&&d3(t,a);let l=i.viewQuery,c=i.contentQueries;if(l&&c3(t,l),c&&u3(t,c),a3(t,i),SI(t.outputs,i.outputs),ci(i)&&i.data.animation){let u=t.data;u.animation=(u.animation||[]).concat(i.data.animation)}}let o=i.features;if(o)for(let s=0;s<o.length;s++){let a=o[s];a&&a.ngInherit&&a(t),a===kn&&(e=!1)}}n=Object.getPrototypeOf(n)}l3(r)}function a3(t,n){for(let e in n.inputs){if(!n.inputs.hasOwnProperty(e)||t.inputs.hasOwnProperty(e))continue;let r=n.inputs[e];r!==void 0&&(t.inputs[e]=r,t.declaredInputs[e]=n.declaredInputs[e])}}function l3(t){let n=0,e=null;for(let r=t.length-1;r>=0;r--){let i=t[r];i.hostVars=n+=i.hostVars,i.hostAttrs=jl(i.hostAttrs,e=jl(e,i.hostAttrs))}}function L0(t){return t===si?{}:t===Vn?[]:t}function c3(t,n){let e=t.viewQuery;e?t.viewQuery=(r,i)=>{n(r,i),e(r,i)}:t.viewQuery=n}function u3(t,n){let e=t.contentQueries;e?t.contentQueries=(r,i,o)=>{n(r,i,o),e(r,i,o)}:t.contentQueries=n}function d3(t,n){let e=t.hostBindings;e?t.hostBindings=(r,i)=>{n(r,i),e(r,i)}:t.hostBindings=n}function _k(t,n,e,r,i,o,s,a){if(e.firstCreatePass){t.mergedAttrs=jl(t.mergedAttrs,t.attrs);let u=t.tView=kb(2,t,i,o,s,e.directiveRegistry,e.pipeRegistry,null,e.schemas,e.consts,null);e.queries!==null&&(e.queries.template(e,t),u.queries=e.queries.embeddedTView(t))}a&&(t.flags|=a),na(t,!1);let l=f3(e,n,t,r);bp()&&Pb(e,n,l,t),Bl(l,n);let c=WT(l,n,l,t);n[r+Mt]=c,Ab(n,c),zB(c,t,n)}function h3(t,n,e,r,i,o,s,a,l,c,u){let d=e+Mt,f;return n.firstCreatePass?(f=la(n,d,4,s||null,a||null),mp()&&QT(n,t,f,Lr(n.consts,c),Lb),q1(n,f)):f=n.data[d],_k(f,t,n,e,r,i,o,l),xl(f)&&om(n,t,f),c!=null&&Xu(t,f,u),f}function Ku(t,n,e,r,i,o,s,a,l,c,u){let d=e+Mt,f;if(n.firstCreatePass){if(f=la(n,d,4,s||null,a||null),c!=null){let h=Lr(n.consts,c);f.localNames=[];for(let p=0;p<h.length;p+=2)f.localNames.push(h[p],-1)}}else f=n.data[d];return _k(f,t,n,e,r,i,o,l),c!=null&&Xu(t,f,u),f}function Rn(t,n,e,r,i,o,s,a){let l=de(),c=Ht(),u=Lr(c.consts,o);return h3(l,c,t,n,e,r,i,u,void 0,s,a),Rn}var f3=p3;function p3(t,n,e,r){return ju(!0),n[Ot].createComment("")}var Zb=(()=>{class t{log(e){console.log(e)}warn(e){console.warn(e)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"platform"})}return t})();function id(t){return typeof t=="function"&&t[Gt]!==void 0}var Xb=new P("");function Go(t){return!!t&&typeof t.then=="function"}function Qb(t){return!!t&&typeof t.subscribe=="function"}var ew=new P("");function Kl(t){return Or([{provide:ew,multi:!0,useValue:t}])}var tw=(()=>{class t{resolve;reject;initialized=!1;done=!1;donePromise=new Promise((e,r)=>{this.resolve=e,this.reject=r});appInits=y(ew,{optional:!0})??[];injector=y(Re);constructor(){}runInitializers(){if(this.initialized)return;let e=[];for(let i of this.appInits){let o=Dn(this.injector,i);if(Go(o))e.push(o);else if(Qb(o)){let s=new Promise((a,l)=>{o.subscribe({complete:a,error:l})});e.push(s)}}let r=()=>{this.done=!0,this.resolve()};Promise.all(e).then(()=>{r()}).catch(i=>{this.reject(i)}),e.length===0&&r(),this.initialized=!0}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),od=new P("");function bk(){i_(()=>{let t="";throw new z(600,t)})}function wk(t){return t.isBoundToModule}var m3=10;var wr=(()=>{class t{_runningTick=!1;_destroyed=!1;_destroyListeners=[];_views=[];internalErrorHandler=y(_r);afterRenderManager=y(nm);zonelessEnabled=y(Bu);rootEffectScheduler=y(Ep);dirtyFlags=0;tracingSnapshot=null;allTestViews=new Set;autoDetectTestViews=new Set;includeAllTestViews=!1;afterTick=new ve;get allViews(){return[...(this.includeAllTestViews?this.allTestViews:this.autoDetectTestViews).keys(),...this._views]}get destroyed(){return this._destroyed}componentTypes=[];components=[];internalPendingTask=y(fo);get isStable(){return this.internalPendingTask.hasPendingTasksObservable.pipe(te(e=>!e))}constructor(){y(Fi,{optional:!0})}whenStable(){let e;return new Promise(r=>{e=this.isStable.subscribe({next:i=>{i&&r()}})}).finally(()=>{e.unsubscribe()})}_injector=y(kt);_rendererFactory=null;get injector(){return this._injector}bootstrap(e,r){return this.bootstrapImpl(e,r)}bootstrapImpl(e,r,i=Re.NULL){return this._injector.get(Ke).run(()=>{yt(ot.BootstrapComponentStart);let s=e instanceof am;if(!this._injector.get(tw).done){let p="";throw new z(405,p)}let l;s?l=e:l=this._injector.get(td).resolveComponentFactory(e),this.componentTypes.push(l.componentType);let c=wk(l)?void 0:this._injector.get(Pi),u=r||l.selector,d=l.create(i,[],u,c),f=d.location.nativeElement,h=d.injector.get(Xb,null);return h?.registerApplication(f),d.onDestroy(()=>{this.detachView(d.hostView),Hu(this.components,d),h?.unregisterApplication(f)}),this._loadComponent(d),yt(ot.BootstrapComponentEnd,d),d})}tick(){this.zonelessEnabled||(this.dirtyFlags|=1),this._tick()}_tick(){yt(ot.ChangeDetectionStart),this.tracingSnapshot!==null?this.tracingSnapshot.run(tm.CHANGE_DETECTION,this.tickImpl):this.tickImpl()}tickImpl=()=>{if(this._runningTick)throw yt(ot.ChangeDetectionEnd),new z(101,!1);let e=he(null);try{this._runningTick=!0,this.synchronize()}finally{this._runningTick=!1,this.tracingSnapshot?.dispose(),this.tracingSnapshot=null,he(e),this.afterTick.next(),yt(ot.ChangeDetectionEnd)}};synchronize(){this._rendererFactory===null&&!this._injector.destroyed&&(this._rendererFactory=this._injector.get(Un,null,{optional:!0}));let e=0;for(;this.dirtyFlags!==0&&e++<m3;){yt(ot.ChangeDetectionSyncStart);try{this.synchronizeOnce()}finally{yt(ot.ChangeDetectionSyncEnd)}}}synchronizeOnce(){this.dirtyFlags&16&&(this.dirtyFlags&=-17,this.rootEffectScheduler.flush());let e=!1;if(this.dirtyFlags&7){let r=!!(this.dirtyFlags&1);this.dirtyFlags&=-8,this.dirtyFlags|=8;for(let{_lView:i}of this.allViews){if(!r&&!Fu(i))continue;let o=r&&!this.zonelessEnabled?0:1;HT(i,o),e=!0}if(this.dirtyFlags&=-5,this.syncDirtyFlagsWithViews(),this.dirtyFlags&23)return}e||(this._rendererFactory?.begin?.(),this._rendererFactory?.end?.()),this.dirtyFlags&8&&(this.dirtyFlags&=-9,this.afterRenderManager.execute()),this.syncDirtyFlagsWithViews()}syncDirtyFlagsWithViews(){if(this.allViews.some(({_lView:e})=>Fu(e))){this.dirtyFlags|=2;return}else this.dirtyFlags&=-8}attachView(e){let r=e;this._views.push(r),r.attachToAppRef(this)}detachView(e){let r=e;Hu(this._views,r),r.detachFromAppRef()}_loadComponent(e){this.attachView(e.hostView);try{this.tick()}catch(i){this.internalErrorHandler(i)}this.components.push(e),this._injector.get(od,[]).forEach(i=>i(e))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(e=>e()),this._views.slice().forEach(e=>e.destroy())}finally{this._destroyed=!0,this._views=[],this._destroyListeners=[]}}onDestroy(e){return this._destroyListeners.push(e),()=>Hu(this._destroyListeners,e)}destroy(){if(this._destroyed)throw new z(406,!1);let e=this._injector;e.destroy&&!e.destroyed&&e.destroy()}get viewCount(){return this._views.length}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function Hu(t,n){let e=t.indexOf(n);e>-1&&t.splice(e,1)}function ut(t,n,e,r){let i=de(),o=ra();if(jr(i,o,n)){let s=Ht(),a=D0();Uj(a,i,t,n,e,r)}return ut}var rre=typeof document<"u"&&typeof document?.documentElement?.getAnimations=="function";var ab=class{destroy(n){}updateValue(n,e){}swap(n,e){let r=Math.min(n,e),i=Math.max(n,e),o=this.detach(i);if(i-r>1){let s=this.detach(r);this.attach(r,o),this.attach(i,s)}else this.attach(r,o)}move(n,e){this.attach(e,this.detach(n))}};function j0(t,n,e,r,i){return t===e&&Object.is(n,r)?1:Object.is(i(t,n),i(e,r))?-1:0}function g3(t,n,e,r){let i,o,s=0,a=t.length-1,l=void 0;if(Array.isArray(n)){he(r);let c=n.length-1;for(he(null);s<=a&&s<=c;){let u=t.at(s),d=n[s],f=j0(s,u,s,d,e);if(f!==0){f<0&&t.updateValue(s,d),s++;continue}let h=t.at(a),p=n[c],m=j0(a,h,c,p,e);if(m!==0){m<0&&t.updateValue(a,p),a--,c--;continue}let g=e(s,u),w=e(a,h),C=e(s,d);if(Object.is(C,w)){let T=e(c,p);Object.is(T,g)?(t.swap(s,a),t.updateValue(a,p),c--,a--):t.move(a,s),t.updateValue(s,d),s++;continue}if(i??=new Gp,o??=F1(t,s,a,e),lb(t,i,s,C))t.updateValue(s,d),s++,a++;else if(o.has(C))i.set(g,t.detach(s)),a--;else{let T=t.create(s,n[s]);t.attach(s,T),s++,a++}}for(;s<=c;)P1(t,i,e,s,n[s]),s++}else if(n!=null){he(r);let c=n[Symbol.iterator]();he(null);let u=c.next();for(;!u.done&&s<=a;){let d=t.at(s),f=u.value,h=j0(s,d,s,f,e);if(h!==0)h<0&&t.updateValue(s,f),s++,u=c.next();else{i??=new Gp,o??=F1(t,s,a,e);let p=e(s,f);if(lb(t,i,s,p))t.updateValue(s,f),s++,a++,u=c.next();
vendor: 16,905 bytes, line 7
7else if(!o.has(p))t.attach(s,t.create(s,f)),s++,a++,u=c.next();else{let m=e(s,d);i.set(m,t.detach(s)),a--}}}for(;!u.done;)P1(t,i,e,t.length,u.value),u=c.next()}for(;s<=a;)t.destroy(t.detach(a--));i?.forEach(c=>{t.destroy(c)})}function lb(t,n,e,r){return n!==void 0&&n.has(r)?(t.attach(e,n.get(r)),n.delete(r),!0):!1}function P1(t,n,e,r,i){if(lb(t,n,r,e(r,i)))t.updateValue(r,i);else{let o=t.create(r,i);t.attach(r,o)}}function F1(t,n,e,r){let i=new Set;for(let o=n;o<=e;o++)i.add(r(o,t.at(o)));return i}var Gp=class{kvMap=new Map;_vMap=void 0;has(n){return this.kvMap.has(n)}delete(n){if(!this.has(n))return!1;let e=this.kvMap.get(n);return this._vMap!==void 0&&this._vMap.has(e)?(this.kvMap.set(n,this._vMap.get(e)),this._vMap.delete(e)):this.kvMap.delete(n),!0}get(n){return this.kvMap.get(n)}set(n,e){if(this.kvMap.has(n)){let r=this.kvMap.get(n);this._vMap===void 0&&(this._vMap=new Map);let i=this._vMap;for(;i.has(r);)r=i.get(r);i.set(r,e)}else this.kvMap.set(n,e)}forEach(n){for(let[e,r]of this.kvMap)if(n(r,e),this._vMap!==void 0){let i=this._vMap;for(;i.has(r);)r=i.get(r),n(r,e)}}};function be(t,n,e,r,i,o,s,a){mi("NgControlFlow");let l=de(),c=Ht(),u=Lr(c.consts,o);return Ku(l,c,t,n,e,r,i,u,256,s,a),nw}function nw(t,n,e,r,i,o,s,a){mi("NgControlFlow");let l=de(),c=Ht(),u=Lr(c.consts,o);return Ku(l,c,t,n,e,r,i,u,512,s,a),nw}function we(t,n){mi("NgControlFlow");let e=de(),r=ra(),i=e[r]!==dr?e[r]:-1,o=i!==-1?Kp(e,Mt+i):void 0,s=0;if(jr(e,r,t)){let a=he(null);try{if(o!==void 0&&KT(o,s),t!==-1){let l=Mt+t,c=Kp(e,l),u=hb(e[pe],l),d=YT(c,u,e),f=Qu(e,u,n,{dehydratedView:d});ed(c,f,s,Vl(u,d))}}finally{he(a)}}else if(o!==void 0){let a=GT(o,s);a!==void 0&&(a[tn]=n)}}var cb=class{lContainer;$implicit;$index;constructor(n,e,r){this.lContainer=n,this.$implicit=e,this.$index=r}get $count(){return this.lContainer.length-Zt}};function rw(t,n){return n}var ub=class{hasEmptyBlock;trackByFn;liveCollection;constructor(n,e,r){this.hasEmptyBlock=n,this.trackByFn=e,this.liveCollection=r}};function Br(t,n,e,r,i,o,s,a,l,c,u,d,f){mi("NgControlFlow");let h=de(),p=Ht(),m=l!==void 0,g=de(),w=a?s.bind(g[Zn][tn]):s,C=new ub(m,w);g[Mt+t]=C,Ku(h,p,t+1,n,e,r,i,Lr(p.consts,o),256),m&&Ku(h,p,t+2,l,c,u,d,Lr(p.consts,f),512)}var db=class extends ab{lContainer;hostLView;templateTNode;operationsCounter=void 0;needsIndexUpdate=!1;constructor(n,e,r){super(),this.lContainer=n,this.hostLView=e,this.templateTNode=r}get length(){return this.lContainer.length-Zt}at(n){return this.getLView(n)[tn].$implicit}attach(n,e){let r=e[Ks];this.needsIndexUpdate||=n!==this.length,ed(this.lContainer,e,n,Vl(this.templateTNode,r)),v3(this.lContainer,n)}detach(n){return this.needsIndexUpdate||=n!==this.length-1,y3(this.lContainer,n),_3(this.lContainer,n)}create(n,e){let r=Bp(this.lContainer,this.templateTNode.tView.ssrId),i=Qu(this.hostLView,this.templateTNode,new cb(this.lContainer,e,n),{dehydratedView:r});return this.operationsCounter?.recordCreate(),i}destroy(n){rm(n[pe],n),this.operationsCounter?.recordDestroy()}updateValue(n,e){this.getLView(n)[tn].$implicit=e}reset(){this.needsIndexUpdate=!1,this.operationsCounter?.reset()}updateIndexes(){if(this.needsIndexUpdate)for(let n=0;n<this.length;n++)this.getLView(n)[tn].$index=n}getLView(n){return b3(this.lContainer,n)}};function Vr(t){let n=he(null),e=Oi();try{let r=de(),i=r[pe],o=r[e],s=e+1,a=Kp(r,s);if(o.liveCollection===void 0){let c=hb(i,s);o.liveCollection=new db(a,r,c)}else o.liveCollection.reset();let l=o.liveCollection;if(g3(l,t,o.trackByFn,n),l.updateIndexes(),o.hasEmptyBlock){let c=ra(),u=l.length===0;if(jr(r,c,u)){let d=e+2,f=Kp(r,d);if(u){let h=hb(i,d),p=YT(f,h,r),m=Qu(r,h,void 0,{dehydratedView:p});ed(f,m,0,Vl(h,p))}else i.firstUpdatePass&&dB(f),KT(f,0)}}}finally{he(n)}}function Kp(t,n){return t[n]}function v3(t,n){if(t.length<=Zt)return;let e=Zt+n,r=t[e],i=r?r[Xs]:void 0;if(r&&i&&i.detachedLeaveAnimationFns&&i.detachedLeaveAnimationFns.length>0){let o=r[ho];vj(o,i),sa.delete(r),i.detachedLeaveAnimationFns=void 0}}function y3(t,n){if(t.length<=Zt)return;let e=Zt+n,r=t[e],i=r?r[Xs]:void 0;i&&i.leave&&i.leave.size>0&&(i.detachedLeaveAnimationFns=[])}function _3(t,n){return Wu(t,n)}function b3(t,n){return GT(t,n)}function hb(t,n){return Ou(t,n)}function ue(t,n,e){let r=de(),i=ra();if(jr(r,i,n)){let o=Ht(),s=D0();Pj(s,r,t,n,r[Ot],e)}return ue}function fb(t,n,e,r,i){Vb(n,t,e,i?"class":"style",r)}function L(t,n,e,r){let i=de(),o=i[pe],s=t+Mt,a=o.firstCreatePass?zb(s,i,2,n,Lb,mp(),e,r):o.data[s];if(jb(a,i,t,n,Ek),xl(a)){let l=i[pe];om(l,i,a),Sb(l,a,i)}return r!=null&&Xu(i,a),L}function V(){let t=Ht(),n=In(),e=Bb(n);return t.firstCreatePass&&qb(t,e),m0(e)&&g0(),f0(),e.classesWithoutHost!=null&&yL(e)&&fb(t,e,de(),e.classesWithoutHost,!0),e.stylesWithoutHost!=null&&_L(e)&&fb(t,e,de(),e.stylesWithoutHost,!1),V}function Ce(t,n,e,r){return L(t,n,e,r),V(),Ce}function Te(t,n,e,r){let i=de(),o=i[pe],s=t+Mt,a=o.firstCreatePass?DB(s,o,2,n,e,r):o.data[s];return jb(a,i,t,n,Ek),r!=null&&Xu(i,a),Te}function Ne(){let t=In(),n=Bb(t);return m0(n)&&g0(),f0(),Ne}function Ko(t,n,e,r){return Te(t,n,e,r),Ne(),Ko}var Ek=(t,n,e,r,i)=>(ju(!0),ET(n[Ot],r,o1()));function ca(t,n,e){let r=de(),i=r[pe],o=t+Mt,s=i.firstCreatePass?zb(o,r,8,"ng-container",Lb,mp(),n,e):i.data[o];if(jb(s,r,t,"ng-container",w3),xl(s)){let a=r[pe];om(a,r,s),Sb(a,s,r)}return e!=null&&Xu(r,s),ca}function ua(){let t=Ht(),n=In(),e=Bb(n);return t.firstCreatePass&&qb(t,e),ua}function Jo(t,n,e){return ca(t,n,e),ua(),Jo}var w3=(t,n,e,r,i)=>(ju(!0),lj(n[Ot],""));function $t(){return de()}var Vu=void 0;function E3(t){let n=Math.floor(Math.abs(t)),e=t.toString().replace(/^[^.]*\.?/,"").length;return n===1&&e===0?1:5}var C3=["en",[["a","p"],["AM","PM"]],[["AM","PM"]],[["S","M","T","W","T","F","S"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],["Su","Mo","Tu","We","Th","Fr","Sa"]],Vu,[["J","F","M","A","M","J","J","A","S","O","N","D"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],["January","February","March","April","May","June","July","August","September","October","November","December"]],Vu,[["B","A"],["BC","AD"],["Before Christ","Anno Domini"]],0,[6,0],["M/d/yy","MMM d, y","MMMM d, y","EEEE, MMMM d, y"],["h:mm\u202Fa","h:mm:ss\u202Fa","h:mm:ss\u202Fa z","h:mm:ss\u202Fa zzzz"],["{1}, {0}",Vu,Vu,Vu],[".",",",";","%","+","-","E","\xD7","\u2030","\u221E","NaN",":"],["#,##0.###","#,##0%","\xA4#,##0.00","#E0"],"USD","$","US Dollar",{},"ltr",E3],B0={};function cm(t){let n=S3(t),e=L1(n);if(e)return e;let r=n.split("-")[0];if(e=L1(r),e)return e;if(r==="en")return C3;throw new z(701,!1)}function L1(t){return t in B0||(B0[t]=uo.ng&&uo.ng.common&&uo.ng.common.locales&&uo.ng.common.locales[t]),B0[t]}var da=(function(t){return t[t.LocaleId=0]="LocaleId",t[t.DayPeriodsFormat=1]="DayPeriodsFormat",t[t.DayPeriodsStandalone=2]="DayPeriodsStandalone",t[t.DaysFormat=3]="DaysFormat",t[t.DaysStandalone=4]="DaysStandalone",t[t.MonthsFormat=5]="MonthsFormat",t[t.MonthsStandalone=6]="MonthsStandalone",t[t.Eras=7]="Eras",t[t.FirstDayOfWeek=8]="FirstDayOfWeek",t[t.WeekendRange=9]="WeekendRange",t[t.DateFormat=10]="DateFormat",t[t.TimeFormat=11]="TimeFormat",t[t.DateTimeFormat=12]="DateTimeFormat",t[t.NumberSymbols=13]="NumberSymbols",t[t.NumberFormats=14]="NumberFormats",t[t.CurrencyCode=15]="CurrencyCode",t[t.CurrencySymbol=16]="CurrencySymbol",t[t.CurrencyName=17]="CurrencyName",t[t.Currencies=18]="Currencies",t[t.Directionality=19]="Directionality",t[t.PluralCase=20]="PluralCase",t[t.ExtraData=21]="ExtraData",t})(da||{});function S3(t){return t.toLowerCase().replace(/_/g,"-")}var sd="en-US";var D3=sd;function Ck(t){typeof t=="string"&&(D3=t.toLowerCase().replace(/_/g,"-"))}function Ge(t,n,e){let r=de(),i=Ht(),o=In();return I3(i,r,r[Ot],o,t,n,e),Ge}function Ur(t,n,e){let r=de(),i=Ht(),o=In();return(o.type&3||e)&&tk(o,i,r,e,r[Ot],t,n,Ap(o,r,n)),Ur}function I3(t,n,e,r,i,o,s){let a=!0,l=null;if((r.type&3||s)&&(l??=Ap(r,n,o),tk(r,t,n,s,e,i,o,l)&&(a=!1)),a){let c=r.outputs?.[i],u=r.hostDirectiveOutputs?.[i];if(u&&u.length)for(let d=0;d<u.length;d+=2){let f=u[d],h=u[d+1];l??=Ap(r,n,o),M1(r,n,f,h,i,l)}if(c&&c.length)for(let d of c)l??=Ap(r,n,o),M1(r,n,d,i,i,l)}}function ie(t=1){return i1(t)}function T3(t,n){let e=null,r=QL(t);for(let i=0;i<n.length;i++){let o=n[i];if(o==="*"){e=i;continue}if(r===null?wT(t,o,!0):nj(r,o))return i}return e}function Jl(t){let n=de()[Zn][Yn];if(!n.projection){let e=t?t.length:1,r=n.projection=RI(e,null),i=r.slice(),o=n.child;for(;o!==null;){if(o.type!==128){let s=t?T3(o,t):0;s!==null&&(i[s]?i[s].projectionNext=o:r[s]=o,i[s]=o)}o=o.next}}}function Yl(t,n=0,e,r,i,o){let s=de(),a=Ht(),l=r?t+1:null;l!==null&&Ku(s,a,l,r,i,o,null,e);let c=la(a,Mt+t,16,null,e||null);c.projection===null&&(c.projection=n),_0();let d=!s[Ks]||p0();s[Zn][Yn].projection[c.projection]===null&&l!==null?k3(s,a,l):d&&!Xp(c)&&kj(a,s,c)}function k3(t,n,e){let r=Mt+e,i=n.data[r],o=t[r],s=Bp(o,i.tView.ssrId),a=Qu(t,i,void 0,{dehydratedView:s});ed(o,a,0,Vl(i,s))}function iw(t,n,e,r){ck(t,n,e,r)}function um(t,n,e){lk(t,n,e)}function Zl(t){let n=de(),e=Ht(),r=vp();Lu(r+1);let i=Kb(e,r);if(t.dirty&&HI(n)===((i.metadata.flags&2)===2)){if(i.matches===null)t.reset([]);else{let o=dk(n,r);t.reset(o,rT),t.notifyOnChanges()}return!0}return!1}function Xl(){return Gb(de(),vp())}function dm(t,n,e,r,i){mk(n,ck(t,e,r,i))}function Yo(t,n,e,r){mk(t,lk(n,e,r))}function Li(t=1){Lu(vp()+t)}function ji(t){let n=b0();return Nu(n,Mt+t)}function Dp(t,n){return t<<17|n<<2}function aa(t){return t>>17&32767}function M3(t){return(t&2)==2}function A3(t,n){return t&131071|n<<17}function pb(t){return t|2}function Ul(t){return(t&131068)>>2}function V0(t,n){return t&-131069|n<<2}function x3(t){return(t&1)===1}function mb(t){return t|1}function R3(t,n,e,r,i,o){let s=o?n.classBindings:n.styleBindings,a=aa(s),l=Ul(s);t[r]=e;let c=!1,u;if(Array.isArray(e)){let d=e;u=d[1],(u===null||Tl(d,u)>0)&&(c=!0)}else u=e;if(i)if(l!==0){let f=aa(t[a+1]);t[r+1]=Dp(f,a),f!==0&&(t[f+1]=V0(t[f+1],r)),t[a+1]=A3(t[a+1],r)}else t[r+1]=Dp(a,0),a!==0&&(t[a+1]=V0(t[a+1],r)),a=r;else t[r+1]=Dp(l,0),a===0?a=r:t[l+1]=V0(t[l+1],r),l=r;c&&(t[r+1]=pb(t[r+1])),j1(t,u,r,!0),j1(t,u,r,!1),O3(n,u,t,r,o),s=Dp(a,l),o?n.classBindings=s:n.styleBindings=s}function O3(t,n,e,r,i){let o=i?t.residualClasses:t.residualStyles;o!=null&&typeof n=="string"&&Tl(o,n)>=0&&(e[r+1]=mb(e[r+1]))}function j1(t,n,e,r){let i=t[e+1],o=n===null,s=r?aa(i):Ul(i),a=!1;for(;s!==0&&(a===!1||o);){let l=t[s],c=t[s+1];N3(l,n)&&(a=!0,t[s+1]=r?mb(c):pb(c)),s=r?aa(c):Ul(c)}a&&(t[e+1]=r?pb(i):mb(i))}function N3(t,n){return t===null||n==null||(Array.isArray(t)?t[1]:t)===n?!0:Array.isArray(t)&&typeof n=="string"?Tl(t,n)>=0:!1}var hi={textEnd:0,key:0,keyEnd:0,value:0,valueEnd:0};function P3(t){return t.substring(hi.key,hi.keyEnd)}function F3(t){return L3(t),Sk(t,Dk(t,0,hi.textEnd))}function Sk(t,n){let e=hi.textEnd;return e===n?-1:(n=hi.keyEnd=j3(t,hi.key=n,e),Dk(t,n,e))}function L3(t){hi.key=0,hi.keyEnd=0,hi.value=0,hi.valueEnd=0,hi.textEnd=t.length}function Dk(t,n,e){for(;n<e&&t.charCodeAt(n)<=32;)n++;return n}function j3(t,n,e){for(;n<e&&t.charCodeAt(n)>32;)n++;return n}function Bi(t,n,e){return Ik(t,n,e,!1),Bi}function Er(t,n){return Ik(t,n,null,!0),Er}function ow(t){V3(W3,B3,t,!0)}function B3(t,n){for(let e=F3(n);e>=0;e=Sk(n,e))cp(t,P3(n),!0)}function Ik(t,n,e,r){let i=de(),o=Ht(),s=E0(2);if(o.firstUpdatePass&&kk(o,t,s,r),n!==dr&&jr(i,s,n)){let a=o.data[Oi()];Mk(o,a,i,i[Ot],t,i[s+1]=K3(n,e),r,s)}}function V3(t,n,e,r){let i=Ht(),o=E0(2);i.firstUpdatePass&&kk(i,null,o,r);let s=de();if(e!==dr&&jr(s,o,e)){let a=i.data[Oi()];if(Ak(a,r)&&!Tk(i,o)){let l=r?a.classesWithoutHost:a.stylesWithoutHost;l!==null&&(e=op(l,e||"")),fb(i,a,s,e,r)}else G3(i,a,s,s[Ot],s[o+1],s[o+1]=q3(t,n,e),r,o)}}function Tk(t,n){return n>=t.expandoStartIndex}function kk(t,n,e,r){let i=t.data;if(i[e+1]===null){let o=i[Oi()],s=Tk(t,e);Ak(o,r)&&n===null&&!s&&(n=!1),n=U3(i,o,n,r),R3(i,o,n,e,s,r)}}function U3(t,n,e,r){let i=e1(t),o=r?n.residualClasses:n.residualStyles;if(i===null)(r?n.classBindings:n.styleBindings)===0&&(e=U0(null,t,n,e,r),e=Ju(e,n.attrs,r),o=null);else{let s=n.directiveStylingLast;if(s===-1||t[s]!==i)if(e=U0(i,t,n,e,r),o===null){let l=H3(t,n,r);l!==void 0&&Array.isArray(l)&&(l=U0(null,t,n,l[1],r),l=Ju(l,n.attrs,r),$3(t,n,r,l))}else o=z3(t,n,r)}return o!==void 0&&(r?n.residualClasses=o:n.residualStyles=o),e}function H3(t,n,e){let r=e?n.classBindings:n.styleBindings;if(Ul(r)!==0)return t[aa(r)]}function $3(t,n,e,r){let i=e?n.classBindings:n.styleBindings;t[aa(i)]=r}function z3(t,n,e){let r,i=n.directiveEnd;for(let o=1+n.directiveStylingLast;o<i;o++){let s=t[o].hostAttrs;r=Ju(r,s,e)}return Ju(r,n.attrs,e)}function U0(t,n,e,r,i){let o=null,s=e.directiveEnd,a=e.directiveStylingLast;for(a===-1?a=e.directiveStart:a++;a<s&&(o=n[a],r=Ju(r,o.hostAttrs,i),o!==t);)a++;return t!==null&&(e.directiveStylingLast=a),r}function Ju(t,n,e){let r=e?1:2,i=-1;if(n!==null)for(let o=0;o<n.length;o++){let s=n[o];typeof s=="number"?i=s:i===r&&(Array.isArray(t)||(t=t===void 0?[]:["",t]),cp(t,s,e?!0:n[++o]))}return t===void 0?null:t}function q3(t,n,e){if(e==null||e==="")return Vn;let r=[],i=Wl(e);if(Array.isArray(i))for(let o=0;o<i.length;o++)t(r,i[o],!0);else if(typeof i=="object")for(let o in i)i.hasOwnProperty(o)&&t(r,o,i[o]);else typeof i=="string"&&n(r,i);return r}function W3(t,n,e){let r=String(n);r!==""&&!r.includes(" ")&&cp(t,r,e)}function G3(t,n,e,r,i,o,s,a){i===dr&&(i=Vn);let l=0,c=0,u=0<i.length?i[0]:null,d=0<o.length?o[0]:null;for(;u!==null||d!==null;){let f=l<i.length?i[l+1]:void 0,h=c<o.length?o[c+1]:void 0,p=null,m;u===d?(l+=2,c+=2,f!==h&&(p=d,m=h)):d===null||u!==null&&u<d?(l+=2,p=u):(c+=2,p=d,m=h),p!==null&&Mk(t,n,e,r,p,m,s,a),u=l<i.length?i[l]:null,d=c<o.length?o[c]:null}}function Mk(t,n,e,r,i,o,s,a){if(!(n.type&3))return;let l=t.data,c=l[a+1],u=x3(c)?B1(l,n,e,i,Ul(c),s):void 0;if(!Jp(u)){Jp(o)||M3(c)&&(o=B1(l,null,e,i,a,s));let d=a0(Oi(),e);Aj(r,s,d,i,o)}}function B1(t,n,e,r,i,o){let s=n===null,a;for(;i>0;){let l=t[i],c=Array.isArray(l),u=c?l[1]:l,d=u===null,f=e[i+1];f===dr&&(f=d?Vn:void 0);let h=d?up(f,r):u===r?f:void 0;if(c&&!Jp(h)&&(h=up(l,r)),Jp(h)&&(a=h,s))return a;let p=t[i+1];i=s?aa(p):Ul(p)}if(n!==null){let l=o?n.residualClasses:n.residualStyles;l!=null&&(a=up(l,r))}return a}function Jp(t){return t!==void 0}function K3(t,n){return t==null||t===""||(typeof n=="string"?t=t+n:typeof t=="object"&&(t=co(Wl(t)))),t}function Ak(t,n){return(t.flags&(n?8:16))!==0}function j(t,n=""){let e=de(),r=Ht(),i=t+Mt,o=r.firstCreatePass?la(r,i,1,n,null):r.data[i],s=J3(r,e,o,n,t);e[i]=s,bp()&&Pb(r,e,s,o),na(o,!1)}var J3=(t,n,e,r,i)=>(ju(!0),sj(n[Ot],r));function xk(t,n,e,r=""){return jr(t,ra(),e)?n+Il(e)+r:dr}function me(t){return Qe("",t),me}function Qe(t,n,e){let r=de(),i=xk(r,t,n,e);return i!==dr&&Y3(r,Oi(),i),Qe}function Y3(t,n,e){let r=a0(n,t);aj(t[Ot],r,e)}var Rk={};function Ql(t){mi("NgLet");let n=Ht(),e=de(),r=t+Mt,i=la(n,r,128,null,null);return na(i,!1),Pu(n,e,r,Rk),Ql}function ad(t){let n=Ht(),e=de(),r=Oi();return Pu(n,e,r,t),t}function gi(t){let n=b0(),e=Nu(n,Mt+t);if(e===Rk)throw new z(314,!1);return e}function ec(t){return jr(de(),ra(),t)?Il(t):dr}function sw(t,n,e=""){return xk(de(),t,n,e)}function Z3(t,n,e){let r=Ht();if(r.firstCreatePass){let i=ci(t);gb(e,r.data,r.blueprint,i,!0),gb(n,r.data,r.blueprint,i,!1)}}function gb(t,n,e,r,i){if(t=gn(t),Array.isArray(t))for(let o=0;o<t.length;o++)gb(t[o],n,e,r,i);else{let o=Ht(),s=de(),a=In(),l=zs(t)?t:gn(t.provide),c=t0(t),u=a.providerIndexes&1048575,d=a.directiveStart,f=a.providerIndexes>>20;if(zs(t)||!t.multi){let h=new oa(c,i,_e,null),p=$0(l,n,i?u:u+f,d);p===-1?(q0(Pp(a,s),o,l),H0(o,t,n.length),n.push(l),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),e.push(h),s.push(h)):(e[p]=h,s[p]=h)}else{let h=$0(l,n,u+f,d),p=$0(l,n,u,u+f),m=h>=0&&e[h],g=p>=0&&e[p];if(i&&!g||!i&&!m){q0(Pp(a,s),o,l);let w=eV(i?Q3:X3,e.length,i,r,c,t);!i&&g&&(e[p].providerFactory=w),H0(o,t,n.length,0),n.push(l),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),e.push(w),s.push(w)}else{let w=Ok(e[i?p:h],c,!i&&r);H0(o,t,h>-1?h:p,w)}!i&&r&&g&&e[p].componentProviders++}}}function H0(t,n,e,r){let i=zs(n),o=jI(n);if(i||o){let l=(o?gn(n.useClass):n).prototype.ngOnDestroy;if(l){let c=t.destroyHooks||(t.destroyHooks=[]);if(!i&&n.multi){let u=c.indexOf(e);u===-1?c.push(e,[r,l]):c[u+1].push(r,l)}else c.push(e,l)}}}function Ok(t,n,e){return e&&t.componentProviders++,t.multi.push(n)-1}function $0(t,n,e,r){for(let i=e;i<r;i++)if(n[i]===t)return i;return-1}function X3(t,n,e,r,i){return vb(this.multi,[])}function Q3(t,n,e,r,i){let o=this.multi,s;if(this.providerFactory){let a=this.providerFactory.componentProviders,l=$u(r,r[pe],this.providerFactory.index,i);s=l.slice(0,a),vb(o,s);for(let c=a;c<l.length;c++)s.push(l[c])}else s=[],vb(o,s);return s}function vb(t,n){for(let e=0;e<t.length;e++){let r=t[e];
vendor: 13,788 bytes, line 7
7n.push(r())}return n}function eV(t,n,e,r,i,o){let s=new oa(t,e,_e,null);return s.multi=[],s.index=n,s.componentProviders=0,Ok(s,i,r&&!e),s}function Cr(t,n=[]){return e=>{e.providersResolver=(r,i)=>Z3(r,i?i(t):t,n)}}function $n(t,n,e){let r=Ho()+t,i=de();return i[r]===dr?nd(i,r,e?n.call(e):n()):IB(i,r)}function Nt(t,n,e,r){return Nk(de(),Ho(),t,n,e,r)}function Sr(t,n,e,r,i){return Pk(de(),Ho(),t,n,e,r,i)}function ha(t,n,e,r,i,o){return tV(de(),Ho(),t,n,e,r,i,o)}function aw(t,n,e,r,i,o,s){return nV(de(),Ho(),t,n,e,r,i,o,s)}function hm(t,n){let e=t[n];return e===dr?void 0:e}function Nk(t,n,e,r,i,o){let s=n+e;return jr(t,s,i)?nd(t,s+1,o?r.call(o,i):r(i)):hm(t,s+1)}function Pk(t,n,e,r,i,o,s){let a=n+e;return Up(t,a,i,o)?nd(t,a+2,s?r.call(s,i,o):r(i,o)):hm(t,a+2)}function tV(t,n,e,r,i,o,s,a){let l=n+e;return TB(t,l,i,o,s)?nd(t,l+3,a?r.call(a,i,o,s):r(i,o,s)):hm(t,l+3)}function nV(t,n,e,r,i,o,s,a,l){let c=n+e;return kB(t,c,i,o,s,a)?nd(t,c+4,l?r.call(l,i,o,s,a):r(i,o,s,a)):hm(t,c+4)}function X(t,n){let e=Ht(),r,i=t+Mt;e.firstCreatePass?(r=rV(n,e.pipeRegistry),e.data[i]=r,r.onDestroy&&(e.destroyHooks??=[]).push(i,r.onDestroy)):r=e.data[i];let o=r.factory||(r.factory=Fo(r.type,!0)),s,a=Jn(_e);try{let l=Np(!1),c=o();return Np(l),Pu(e,de(),i,c),c}finally{Jn(a)}}function rV(t,n){if(n)for(let e=n.length-1;e>=0;e--){let r=n[e];if(t===r.name)return r}}function ne(t,n,e){let r=t+Mt,i=de(),o=Nu(i,r);return Fk(i,r)?Nk(i,Ho(),n,o.transform,e,o):o.transform(e)}function mo(t,n,e,r){let i=t+Mt,o=de(),s=Nu(o,i);return Fk(o,i)?Pk(o,Ho(),n,s.transform,e,r,s):s.transform(e,r)}function Fk(t,n){return t[pe].data[n].pure}function ld(t,n){return sm(t,n)}var Yp=class{ngModuleFactory;componentFactories;constructor(n,e){this.ngModuleFactory=n,this.componentFactories=e}},lw=(()=>{class t{compileModuleSync(e){return new Wp(e)}compileModuleAsync(e){return Promise.resolve(this.compileModuleSync(e))}compileModuleAndAllComponentsSync(e){let r=this.compileModuleSync(e),i=X_(e),o=_T(i.declarations).reduce((s,a)=>{let l=Mi(a);return l&&s.push(new Wo(l)),s},[]);return new Yp(r,o)}compileModuleAndAllComponentsAsync(e){return Promise.resolve(this.compileModuleAndAllComponentsSync(e))}clearCache(){}clearCacheFor(e){}getModuleId(e){}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Lk=(()=>{class t{applicationErrorHandler=y(_r);appRef=y(wr);taskService=y(fo);ngZone=y(Ke);zonelessEnabled=y(Bu);tracing=y(Fi,{optional:!0});zoneIsDefined=typeof Zone<"u"&&!!Zone.root.run;schedulerTickApplyArgs=[{data:{__scheduler_tick__:!0}}];subscriptions=new St;angularZoneId=this.zoneIsDefined?this.ngZone._inner?.get(Du):null;scheduleInRootZone=!this.zonelessEnabled&&this.zoneIsDefined&&(y(R0,{optional:!0})??!1);cancelScheduledCallback=null;useMicrotaskScheduler=!1;runningTick=!1;pendingRenderTaskId=null;constructor(){this.subscriptions.add(this.appRef.afterTick.subscribe(()=>{this.runningTick||this.cleanup()})),this.subscriptions.add(this.ngZone.onUnstable.subscribe(()=>{this.runningTick||this.cleanup()}))}notify(e){if(!this.zonelessEnabled&&e===5)return;switch(e){case 0:{this.appRef.dirtyFlags|=2;break}case 3:case 2:case 4:case 5:case 1:{this.appRef.dirtyFlags|=4;break}case 6:{this.appRef.dirtyFlags|=2;break}case 12:{this.appRef.dirtyFlags|=16;break}case 13:{this.appRef.dirtyFlags|=2;break}case 11:break;case 9:case 8:case 7:case 10:default:this.appRef.dirtyFlags|=8}if(this.appRef.tracingSnapshot=this.tracing?.snapshot(this.appRef.tracingSnapshot)??null,!this.shouldScheduleTick())return;let r=this.useMicrotaskScheduler?k0:T0;this.pendingRenderTaskId=this.taskService.add(),this.scheduleInRootZone?this.cancelScheduledCallback=Zone.root.run(()=>r(()=>this.tick())):this.cancelScheduledCallback=this.ngZone.runOutsideAngular(()=>r(()=>this.tick()))}shouldScheduleTick(){return!(this.appRef.destroyed||this.pendingRenderTaskId!==null||this.runningTick||this.appRef._runningTick||!this.zonelessEnabled&&this.zoneIsDefined&&Zone.current.get(Du+this.angularZoneId))}tick(){if(this.runningTick||this.appRef.destroyed)return;if(this.appRef.dirtyFlags===0){this.cleanup();return}!this.zonelessEnabled&&this.appRef.dirtyFlags&7&&(this.appRef.dirtyFlags|=1);let e=this.taskService.add();try{this.ngZone.run(()=>{this.runningTick=!0,this.appRef._tick()},void 0,this.schedulerTickApplyArgs)}catch(r){this.taskService.remove(e),this.applicationErrorHandler(r)}finally{this.cleanup()}this.useMicrotaskScheduler=!0,k0(()=>{this.useMicrotaskScheduler=!1,this.taskService.remove(e)})}ngOnDestroy(){this.subscriptions.unsubscribe(),this.cleanup()}cleanup(){if(this.runningTick=!1,this.cancelScheduledCallback?.(),this.cancelScheduledCallback=null,this.pendingRenderTaskId!==null){let e=this.pendingRenderTaskId;this.pendingRenderTaskId=null,this.taskService.remove(e)}}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function jk(){return[{provide:ki,useExisting:Lk},{provide:Ke,useClass:Iu},{provide:Bu,useValue:!0}]}function iV(){return typeof $localize<"u"&&$localize.locale||sd}var cd=new P("",{factory:()=>y(cd,{optional:!0,skipSelf:!0})||iV()});var ud=class{destroyed=!1;listeners=null;errorHandler=y(ur,{optional:!0});destroyRef=y(Ye);constructor(){this.destroyRef.onDestroy(()=>{this.destroyed=!0,this.listeners=null})}subscribe(n){if(this.destroyed)throw new z(953,!1);return(this.listeners??=[]).push(n),{unsubscribe:()=>{let e=this.listeners?.indexOf(n);e!==void 0&&e!==-1&&this.listeners?.splice(e,1)}}}emit(n){if(this.destroyed){console.warn(oi(953,!1));return}if(this.listeners===null)return;let e=he(null);try{for(let r of this.listeners)try{r(n)}catch(i){this.errorHandler?.handleError(i)}}finally{he(e)}}};function le(t,n){return Os(t,n?.equal)}var mm=Symbol("InputSignalNode#UNSET"),Gk=Z(A({},fu),{transformFn:void 0,applyValueToInputSignal(t,n){pl(t,n)}});function Kk(t,n){let e=Object.create(Gk);e.value=t,e.transformFn=n?.transform;function r(){if(As(e),e.value===mm){let i=null;throw new z(-950,i)}return e.value}return r[Gt]=e,r}var pm=class{attributeName;constructor(n){this.attributeName=n}__NG_ELEMENT_ID__=()=>Yu(this.attributeName);toString(){return`HostAttributeToken ${this.attributeName}`}};function hd(t){return new ud}function Bk(t,n){return Kk(t,n)}function yV(t){return Kk(mm,t)}var Le=(Bk.required=yV,Bk);function Vk(t,n){return hk(n)}function _V(t,n){return fk(n)}var fa=(Vk.required=_V,Vk);function mw(t,n){return pk(n)}function Jk(t,n){let e=Object.create(Gk),r=new ud;e.value=t;function i(){return As(e),Uk(e.value),e.value}return i[Gt]=e,i.asReadonly=wp.bind(i),i.set=o=>{e.equal(e.value,o)||(pl(e,o),r.emit(o))},i.update=o=>{Uk(e.value),i.set(o(e.value))},i.subscribe=r.subscribe.bind(r),i.destroyRef=r.destroyRef,i}function Uk(t){if(t===mm)throw new z(952,!1)}function Hk(t,n){return Jk(t,n)}function bV(t){return Jk(mm,t)}var fd=(Hk.required=bV,Hk);var uw=new P(""),wV=new P("");function dd(t){return!t.moduleRef}function EV(t){let n=dd(t)?t.r3Injector:t.moduleRef.injector,e=n.get(Ke);return e.run(()=>{dd(t)?t.r3Injector.resolveInjectorInitializers():t.moduleRef.resolveInjectorInitializers();let r=n.get(_r),i;if(e.runOutsideAngular(()=>{i=e.onError.subscribe({next:r})}),dd(t)){let o=()=>n.destroy(),s=t.platformInjector.get(uw);s.add(o),n.onDestroy(()=>{i.unsubscribe(),s.delete(o)})}else{let o=()=>t.moduleRef.destroy(),s=t.platformInjector.get(uw);s.add(o),t.moduleRef.onDestroy(()=>{Hu(t.allPlatformModules,t.moduleRef),i.unsubscribe(),s.delete(o)})}return SV(r,e,()=>{let o=n.get(fo),s=o.add(),a=n.get(tw);return a.runInitializers(),a.donePromise.then(()=>{let l=n.get(cd,sd);if(Ck(l||sd),!n.get(wV,!0))return dd(t)?n.get(wr):(t.allPlatformModules.push(t.moduleRef),t.moduleRef);if(dd(t)){let u=n.get(wr);return t.rootComponent!==void 0&&u.bootstrap(t.rootComponent),u}else return CV?.(t.moduleRef,t.allPlatformModules),t.moduleRef}).finally(()=>void o.remove(s))})})}var CV;function SV(t,n,e){try{let r=e();return Go(r)?r.catch(i=>{throw n.runOutsideAngular(()=>t(i)),i}):r}catch(r){throw n.runOutsideAngular(()=>t(r)),r}}var fm=null;function DV(t=[],n){return Re.create({name:n,providers:[{provide:Au,useValue:"platform"},{provide:uw,useValue:new Set([()=>fm=null])},...t]})}function IV(t=[]){if(fm)return fm;let n=DV(t);return fm=n,bk(),TV(n),n}function TV(t){let n=t.get(Zp,null);Dn(t,()=>{n?.forEach(e=>e())})}function gw(){return!1}var zn=(()=>{class t{static __NG_ELEMENT_ID__=kV}return t})();function kV(t){return MV(In(),de(),(t&16)===16)}function MV(t,n,e){if(Uo(t)&&!e){let r=Fr(t.index,n);return new qo(r,r)}else if(t.type&175){let r=n[Zn];return new qo(r,n)}return null}var dw=class{constructor(){}supports(n){return n instanceof Map||Wb(n)}create(){return new hw}},hw=class{_records=new Map;_mapHead=null;_appendAfter=null;_previousMapHead=null;_changesHead=null;_changesTail=null;_additionsHead=null;_additionsTail=null;_removalsHead=null;_removalsTail=null;get isDirty(){return this._additionsHead!==null||this._changesHead!==null||this._removalsHead!==null}forEachItem(n){let e;for(e=this._mapHead;e!==null;e=e._next)n(e)}forEachPreviousItem(n){let e;for(e=this._previousMapHead;e!==null;e=e._nextPrevious)n(e)}forEachChangedItem(n){let e;for(e=this._changesHead;e!==null;e=e._nextChanged)n(e)}forEachAddedItem(n){let e;for(e=this._additionsHead;e!==null;e=e._nextAdded)n(e)}forEachRemovedItem(n){let e;for(e=this._removalsHead;e!==null;e=e._nextRemoved)n(e)}diff(n){if(!n)n=new Map;else if(!(n instanceof Map||Wb(n)))throw new z(900,!1);return this.check(n)?this:null}onDestroy(){}check(n){this._reset();let e=this._mapHead;if(this._appendAfter=null,this._forEach(n,(r,i)=>{if(e&&e.key===i)this._maybeAddToChanges(e,r),this._appendAfter=e,e=e._next;else{let o=this._getOrCreateRecordForKey(i,r);e=this._insertBeforeOrAppend(e,o)}}),e){e._prev&&(e._prev._next=null),this._removalsHead=e;for(let r=e;r!==null;r=r._nextRemoved)r===this._mapHead&&(this._mapHead=null),this._records.delete(r.key),r._nextRemoved=r._next,r.previousValue=r.currentValue,r.currentValue=null,r._prev=null,r._next=null}return this._changesTail&&(this._changesTail._nextChanged=null),this._additionsTail&&(this._additionsTail._nextAdded=null),this.isDirty}_insertBeforeOrAppend(n,e){if(n){let r=n._prev;return e._next=n,e._prev=r,n._prev=e,r&&(r._next=e),n===this._mapHead&&(this._mapHead=e),this._appendAfter=n,n}return this._appendAfter?(this._appendAfter._next=e,e._prev=this._appendAfter):this._mapHead=e,this._appendAfter=e,null}_getOrCreateRecordForKey(n,e){if(this._records.has(n)){let i=this._records.get(n);this._maybeAddToChanges(i,e);let o=i._prev,s=i._next;return o&&(o._next=s),s&&(s._prev=o),i._next=null,i._prev=null,i}let r=new fw(n);return this._records.set(n,r),r.currentValue=e,this._addToAdditions(r),r}_reset(){if(this.isDirty){let n;for(this._previousMapHead=this._mapHead,n=this._previousMapHead;n!==null;n=n._next)n._nextPrevious=n._next;for(n=this._changesHead;n!==null;n=n._nextChanged)n.previousValue=n.currentValue;for(n=this._additionsHead;n!=null;n=n._nextAdded)n.previousValue=n.currentValue;this._changesHead=this._changesTail=null,this._additionsHead=this._additionsTail=null,this._removalsHead=null}}_maybeAddToChanges(n,e){Object.is(e,n.currentValue)||(n.previousValue=n.currentValue,n.currentValue=e,this._addToChanges(n))}_addToAdditions(n){this._additionsHead===null?this._additionsHead=this._additionsTail=n:(this._additionsTail._nextAdded=n,this._additionsTail=n)}_addToChanges(n){this._changesHead===null?this._changesHead=this._changesTail=n:(this._changesTail._nextChanged=n,this._changesTail=n)}_forEach(n,e){n instanceof Map?n.forEach(e):Object.keys(n).forEach(r=>e(n[r],r))}},fw=class{key;previousValue=null;currentValue=null;_nextPrevious=null;_next=null;_prev=null;_nextAdded=null;_nextRemoved=null;_nextChanged=null;constructor(n){this.key=n}};function $k(){return new vw([new dw])}var vw=(()=>{class t{static \u0275prov=O({token:t,providedIn:"root",factory:$k});factories;constructor(e){this.factories=e}static create(e,r){if(r){let i=r.factories.slice();e=e.concat(i)}return new t(e)}static extend(e){return{provide:t,useFactory:()=>{let r=y(t,{optional:!0,skipSelf:!0});return t.create(e,r||$k())}}}find(e){let r=this.factories.find(i=>i.supports(e));if(r)return r;throw new z(901,!1)}}return t})();function Yk(t){let{rootComponent:n,appProviders:e,platformProviders:r,platformRef:i}=t;yt(ot.BootstrapApplicationStart);try{let o=i?.injector??IV(r),s=[jk(),c1,...e||[]],a=new Gu({providers:s,parent:o,debugName:"",runEnvironmentInitializers:!1});return EV({r3Injector:a.injector,platformInjector:o,rootComponent:n})}catch(o){return Promise.reject(o)}finally{yt(ot.BootstrapApplicationEnd)}}function At(t){return typeof t=="boolean"?t:t!=null&&t!=="false"}var cw=Symbol("NOT_SET"),Zk=new Set,AV=Z(A({},fu),{kind:"afterRenderEffectPhase",consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,value:cw,cleanup:null,consumerMarkedDirty(){if(this.sequence.impl.executing){if(this.sequence.lastPhase===null||this.sequence.lastPhase<this.phase)return;this.sequence.erroredOrDestroyed=!0}this.sequence.scheduler.notify(7)},phaseFn(t){if(this.sequence.lastPhase=this.phase,!this.dirty)return this.signal;if(this.dirty=!1,this.value!==cw&&!Rs(this))return this.signal;try{for(let i of this.cleanup??Zk)i()}finally{this.cleanup?.clear()}let n=[];t!==void 0&&n.push(t),n.push(this.registerCleanupFn);let e=Ro(this),r;try{r=this.userFn.apply(null,n)}finally{xs(this,e)}return(this.value===cw||!this.equal(this.value,r))&&(this.value=r,this.version++),this.signal}}),pw=class extends zu{scheduler;lastPhase=null;nodes=[void 0,void 0,void 0,void 0];onDestroyFns=null;constructor(n,e,r,i,o,s=null){super(n,[void 0,void 0,void 0,void 0],r,!1,o.get(Ye),s),this.scheduler
7=i;for(let a of Rb){let l=e[a];if(l===void 0)continue;let c=Object.create(AV);c.sequence=this,c.phase=a,c.userFn=l,c.dirty=!0,c.signal=()=>(As(c),c.value),c.signal[Gt]=c,c.registerCleanupFn=u=>(c.cleanup??=new Set).add(u),this.nodes[a]=c,this.hooks[a]=u=>c.phaseFn(u)}}afterRun(){super.afterRun(),this.lastPhase=null}destroy(){if(this.onDestroyFns!==null)for(let n of this.onDestroyFns)n();super.destroy();for(let n of this.nodes)if(n)try{for(let e of n.cleanup??Zk)e()}finally{no(n)}}};function pa(t,n){let e=n?.injector??y(Re),r=e.get(ki),i=e.get(nm),o=e.get(Fi,null,{optional:!0});i.impl??=e.get(Ob);let s=t;typeof s=="function"&&(s={mixedReadWrite:t});let a=e.get(Nl,null,{optional:!0}),l=new pw(i.impl,[s.earlyRead,s.write,s.mixedReadWrite,s.read],a?.view,r,e,o?.snapshot(null));return i.impl.register(l),l}function gm(t,n){let e=Mi(t),r=n.elementInjector||kl();return new Wo(e).create(r,n.projectableNodes,n.hostElement,n.environmentInjector,n.directives,n.bindings)}function Xk(t){let n=Mi(t);if(!n)return null;let e=new Wo(n);return{get selector(){return e.selector},get type(){return e.componentType},get inputs(){return e.inputs},get outputs(){return e.outputs},get ngContentSelectors(){return e.ngContentSelectors},get isStandalone(){return n.standalone},get isSignal(){return n.signals}}}var tM=null;function Hr(){return tM}function yw(t){tM??=t}var pd=class{},md=(()=>{class t{historyGo(e){throw new Error("")}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:()=>y(nM),providedIn:"platform"})}return t})(),_w=new P(""),nM=(()=>{class t extends md{_location;_history;_doc=y(Ve);constructor(){super(),this._location=window.location,this._history=window.history}getBaseHrefFromDOM(){return Hr().getBaseHref(this._doc)}onPopState(e){let r=Hr().getGlobalEventTarget(this._doc,"window");return r.addEventListener("popstate",e,!1),()=>r.removeEventListener("popstate",e)}onHashChange(e){let r=Hr().getGlobalEventTarget(this._doc,"window");return r.addEventListener("hashchange",e,!1),()=>r.removeEventListener("hashchange",e)}get href(){return this._location.href}get protocol(){return this._location.protocol}get hostname(){return this._location.hostname}get port(){return this._location.port}get pathname(){return this._location.pathname}get search(){return this._location.search}get hash(){return this._location.hash}set pathname(e){this._location.pathname=e}pushState(e,r,i){this._history.pushState(e,r,i)}replaceState(e,r,i){this._history.replaceState(e,r,i)}forward(){this._history.forward()}back(){this._history.back()}historyGo(e=0){this._history.go(e)}getState(){return this._history.state}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:()=>new t,providedIn:"platform"})}return t})();function vm(t,n){return t?n?t.endsWith("/")?n.startsWith("/")?t+n.slice(1):t+n:n.startsWith("/")?t+n:`${t}/${n}`:t:n}function Qk(t){let n=t.search(/#|\?|$/);return t[n-1]==="/"?t.slice(0,n-1)+t.slice(n):t}function vi(t){return t&&t[0]!=="?"?`?${t}`:t}var yi=(()=>{class t{historyGo(e){throw new Error("")}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:()=>y(_m),providedIn:"root"})}return t})(),ym=new P(""),_m=(()=>{class t extends yi{_platformLocation;_baseHref;_removeListenerFns=[];constructor(e,r){super(),this._platformLocation=e,this._baseHref=r??this._platformLocation.getBaseHrefFromDOM()??y(Ve).location?.origin??""}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(e){this._removeListenerFns.push(this._platformLocation.onPopState(e),this._platformLocation.onHashChange(e))}getBaseHref(){return this._baseHref}prepareExternalUrl(e){return vm(this._baseHref,e)}path(e=!1){let r=this._platformLocation.pathname+vi(this._platformLocation.search),i=this._platformLocation.hash;return i&&e?`${r}${i}`:r}pushState(e,r,i,o){let s=this.prepareExternalUrl(i+vi(o));this._platformLocation.pushState(e,r,s)}replaceState(e,r,i,o){let s=this.prepareExternalUrl(i+vi(o));this._platformLocation.replaceState(e,r,s)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(e=0){this._platformLocation.historyGo?.(e)}static \u0275fac=function(r){return new(r||t)(Q(md),Q(ym,8))};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Vi=(()=>
vendor: 12,745 bytes, line 7
7{class t{_subject=new ve;_basePath;_locationStrategy;_urlChangeListeners=[];_urlChangeSubscription=null;constructor(e){this._locationStrategy=e;let r=this._locationStrategy.getBaseHref();this._basePath=OV(Qk(eM(r))),this._locationStrategy.onPopState(i=>{this._subject.next({url:this.path(!0),pop:!0,state:i.state,type:i.type})})}ngOnDestroy(){this._urlChangeSubscription?.unsubscribe(),this._urlChangeListeners=[]}path(e=!1){return this.normalize(this._locationStrategy.path(e))}getState(){return this._locationStrategy.getState()}isCurrentPathEqualTo(e,r=""){return this.path()==this.normalize(e+vi(r))}normalize(e){return t.stripTrailingSlash(RV(this._basePath,eM(e)))}prepareExternalUrl(e){return e&&e[0]!=="/"&&(e="/"+e),this._locationStrategy.prepareExternalUrl(e)}go(e,r="",i=null){this._locationStrategy.pushState(i,"",e,r),this._notifyUrlChangeListeners(this.prepareExternalUrl(e+vi(r)),i)}replaceState(e,r="",i=null){this._locationStrategy.replaceState(i,"",e,r),this._notifyUrlChangeListeners(this.prepareExternalUrl(e+vi(r)),i)}forward(){this._locationStrategy.forward()}back(){this._locationStrategy.back()}historyGo(e=0){this._locationStrategy.historyGo?.(e)}onUrlChange(e){return this._urlChangeListeners.push(e),this._urlChangeSubscription??=this.subscribe(r=>{this._notifyUrlChangeListeners(r.url,r.state)}),()=>{let r=this._urlChangeListeners.indexOf(e);this._urlChangeListeners.splice(r,1),this._urlChangeListeners.length===0&&(this._urlChangeSubscription?.unsubscribe(),this._urlChangeSubscription=null)}}_notifyUrlChangeListeners(e="",r){this._urlChangeListeners.forEach(i=>i(e,r))}subscribe(e,r,i){return this._subject.subscribe({next:e,error:r??void 0,complete:i??void 0})}static normalizeQueryParams=vi;static joinWithSlash=vm;static stripTrailingSlash=Qk;static \u0275fac=function(r){return new(r||t)(Q(yi))};static \u0275prov=O({token:t,factory:()=>xV(),providedIn:"root"})}return t})();function xV(){return new Vi(Q(yi))}function RV(t,n){if(!t||!n.startsWith(t))return n;let e=n.substring(t.length);return e===""||["/",";","?","#"].includes(e[0])?e:n}function eM(t){return t.replace(/\/index.html$/,"")}function OV(t){if(new RegExp("^(https?:)?//").test(t)){let[,e]=t.split(/\/\/[^\/]+/);return e}return t}var Cw=(()=>{class t extends yi{_platformLocation;_baseHref="";_removeListenerFns=[];constructor(e,r){super(),this._platformLocation=e,r!=null&&(this._baseHref=r)}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(e){this._removeListenerFns.push(this._platformLocation.onPopState(e),this._platformLocation.onHashChange(e))}getBaseHref(){return this._baseHref}path(e=!1){let r=this._platformLocation.hash??"#";return r.length>0?r.substring(1):r}prepareExternalUrl(e){let r=vm(this._baseHref,e);return r.length>0?"#"+r:r}pushState(e,r,i,o){let s=this.prepareExternalUrl(i+vi(o))||this._platformLocation.pathname;this._platformLocation.pushState(e,r,s)}replaceState(e,r,i,o){let s=this.prepareExternalUrl(i+vi(o))||this._platformLocation.pathname;this._platformLocation.replaceState(e,r,s)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(e=0){this._platformLocation.historyGo?.(e)}static \u0275fac=function(r){return new(r||t)(Q(md),Q(ym,8))};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})();var Sw=(function(t){return t[t.Decimal=0]="Decimal",t[t.Percent=1]="Percent",t[t.Currency=2]="Currency",t[t.Scientific=3]="Scientific",t})(Sw||{});var Ui={Decimal:0,Group:1,List:2,PercentSign:3,PlusSign:4,MinusSign:5,Exponential:6,SuperscriptingExponent:7,PerMille:8,Infinity:9,NaN:10,TimeSeparator:11,CurrencyDecimal:12,CurrencyGroup:13};function tc(t,n){let e=cm(t),r=e[da.NumberSymbols][n];if(typeof r>"u"){if(n===Ui.CurrencyDecimal)return e[da.NumberSymbols][Ui.Decimal];if(n===Ui.CurrencyGroup)return e[da.NumberSymbols][Ui.Group]}return r}function oM(t,n){return cm(t)[da.NumberFormats][n]}var PV=/^(\d+)?\.((\d+)(-(\d+))?)?$/,rM=22,bm=".",gd="0",FV=";",LV=",",bw="#";function jV(t,n,e,r,i,o,s=!1){let a="",l=!1;if(!isFinite(t))a=tc(e,Ui.Infinity);else{let c=UV(t);s&&(c=VV(c));let u=n.minInt,d=n.minFrac,f=n.maxFrac;if(o){let C=o.match(PV);if(C===null)throw new z(2306,!1);let T=C[1],I=C[3],F=C[5];T!=null&&(u=ww(T)),I!=null&&(d=ww(I)),F!=null?f=ww(F):I!=null&&d>f&&(f=d)}HV(c,d,f);let h=c.digits,p=c.integerLen,m=c.exponent,g=[];for(l=h.every(C=>!C);p<u;p++)h.unshift(0);for(;p<0;p++)h.unshift(0);p>0?g=h.splice(p,h.length):(g=h,h=[0]);let w=[];for(h.length>=n.lgSize&&w.unshift(h.splice(-n.lgSize,h.length).join(""));h.length>n.gSize;)w.unshift(h.splice(-n.gSize,h.length).join(""));h.length&&w.unshift(h.join("")),a=w.join(tc(e,r)),g.length&&(a+=tc(e,i)+g.join("")),m&&(a+=tc(e,Ui.Exponential)+"+"+m)}return t<0&&!l?a=n.negPre+a+n.negSuf:a=n.posPre+a+n.posSuf,a}function sM(t,n,e){let r=oM(n,Sw.Decimal),i=BV(r,tc(n,Ui.MinusSign));return jV(t,i,n,Ui.Group,Ui.Decimal,e)}function BV(t,n="-"){let e={minInt:1,minFrac:0,maxFrac:0,posPre:"",posSuf:"",negPre:"",negSuf:"",gSize:0,lgSize:0},r=t.split(FV),i=r[0],o=r[1],s=i.indexOf(bm)!==-1?i.split(bm):[i.substring(0,i.lastIndexOf(gd)+1),i.substring(i.lastIndexOf(gd)+1)],a=s[0],l=s[1]||"";e.posPre=a.substring(0,a.indexOf(bw));for(let u=0;u<l.length;u++){let d=l.charAt(u);d===gd?e.minFrac=e.maxFrac=u+1:d===bw?e.maxFrac=u+1:e.posSuf+=d}let c=a.split(LV);if(e.gSize=c[1]?c[1].length:0,e.lgSize=c[2]||c[1]?(c[2]||c[1]).length:0,o){let u=i.length-e.posPre.length-e.posSuf.length,d=o.indexOf(bw);e.negPre=o.substring(0,d).replace(/'/g,""),e.negSuf=o.slice(d+u).replace(/'/g,"")}else e.negPre=n+e.posPre,e.negSuf=e.posSuf;return e}function VV(t){if(t.digits[0]===0)return t;let n=t.digits.length-t.integerLen;return t.exponent?t.exponent+=2:(n===0?t.digits.push(0,0):n===1&&t.digits.push(0),t.integerLen+=2),t}function UV(t){let n=Math.abs(t)+"",e=0,r,i,o,s,a;for((i=n.indexOf(bm))>-1&&(n=n.replace(bm,"")),(o=n.search(/e/i))>0?(i<0&&(i=o),i+=+n.slice(o+1),n=n.substring(0,o)):i<0&&(i=n.length),o=0;n.charAt(o)===gd;o++);if(o===(a=n.length))r=[0],i=1;else{for(a--;n.charAt(a)===gd;)a--;for(i-=o,r=[],s=0;o<=a;o++,s++)r[s]=Number(n.charAt(o))}return i>rM&&(r=r.splice(0,rM-1),e=i-1,i=1),{digits:r,exponent:e,integerLen:i}}function HV(t,n,e){if(n>e)throw new z(2307,!1);let r=t.digits,i=r.length-t.integerLen,o=Math.min(Math.max(n,i),e),s=o+t.integerLen,a=r[s];if(s>0){r.splice(Math.max(t.integerLen,s));for(let d=s;d<r.length;d++)r[d]=0}else{i=Math.max(0,i),t.integerLen=1,r.length=Math.max(1,s=o+1),r[0]=0;for(let d=1;d<s;d++)r[d]=0}if(a>=5)if(s-1<0){for(let d=0;d>s;d--)r.unshift(0),t.integerLen++;r.unshift(1),t.integerLen++}else r[s-1]++;for(;i<Math.max(0,o);i++)r.push(0);let l=o!==0,c=n+t.integerLen,u=r.reduceRight(function(d,f,h,p){return f=f+d,p[h]=f<10?f:f-10,l&&(p[h]===0&&h>=c?p.pop():l=!1),f>=10?1:0},0);u&&(r.unshift(u),t.integerLen++)}function ww(t){let n=parseInt(t);if(isNaN(n))throw new z(2305,!1);return n}var Ew=/\s+/,iM=[],ma=(()=>{class t{_ngEl;_renderer;initialClasses=iM;rawClass;stateMap=new Map;constructor(e,r){this._ngEl=e,this._renderer=r}set klass(e){this.initialClasses=e!=null?e.trim().split(Ew):iM}set ngClass(e){this.rawClass=typeof e=="string"?e.trim().split(Ew):e}ngDoCheck(){for(let r of this.initialClasses)this._updateState(r,!0);let e=this.rawClass;if(Array.isArray(e)||e instanceof Set)for(let r of e)this._updateState(r,!0);else if(e!=null)for(let r of Object.keys(e))this._updateState(r,!!e[r]);this._applyStateDiff()}_updateState(e,r){let i=this.stateMap.get(e);i!==void 0?(i.enabled!==r&&(i.changed=!0,i.enabled=r),i.touched=!0):this.stateMap.set(e,{enabled:r,changed:!0,touched:!0})}_applyStateDiff(){for(let e of this.stateMap){let r=e[0],i=e[1];i.changed?(this._toggleClass(r,i.enabled),i.changed=!1):i.touched||(i.enabled&&this._toggleClass(r,!1),this.stateMap.delete(r)),i.touched=!1}}_toggleClass(e,r){e=e.trim(),e.length>0&&e.split(Ew).forEach(i=>{r?this._renderer.addClass(this._ngEl.nativeElement,i):this._renderer.removeClass(this._ngEl.nativeElement,i)})}static \u0275fac=function(r){return new(r||t)(_e(We),_e(Tn))};static \u0275dir=Oe({type:t,selectors:[["","ngClass",""]],inputs:{klass:[0,"class","klass"],ngClass:"ngClass"}})}return t})();var Dw=(()=>{class t{_ngEl;_differs;_renderer;_ngStyle=null;_differ=null;constructor(e,r,i){this._ngEl=e,this._differs=r,this._renderer=i}set ngStyle(e){this._ngStyle=e,!this._differ&&e&&(this._differ=this._differs.find(e).create())}ngDoCheck(){if(this._differ){let e=this._differ.diff(this._ngStyle);e&&this._applyChanges(e)}}_setStyle(e,r){let[i,o]=e.split("."),s=i.indexOf("-")===-1?void 0:pi.DashCase;r!=null?this._renderer.setStyle(this._ngEl.nativeElement,i,o?`${r}${o}`:r,s):this._renderer.removeStyle(this._ngEl.nativeElement,i,s)}_applyChanges(e){e.forEachRemovedItem(r=>this._setStyle(r.key,null)),e.forEachAddedItem(r=>this._setStyle(r.key,r.currentValue)),e.forEachChangedItem(r=>this._setStyle(r.key,r.currentValue))}static \u0275fac=function(r){return new(r||t)(_e(We),_e(vw),_e(Tn))};static \u0275dir=Oe({type:t,selectors:[["","ngStyle",""]],inputs:{ngStyle:"ngStyle"}})}return t})(),vd=(()=>{class t{_viewContainerRef;_viewRef=null;ngTemplateOutletContext=null;ngTemplateOutlet=null;ngTemplateOutletInjector=null;constructor(e){this._viewContainerRef=e}ngOnChanges(e){if(this._shouldRecreateView(e)){let r=this._viewContainerRef;if(this._viewRef&&r.remove(r.indexOf(this._viewRef)),!this.ngTemplateOutlet){this._viewRef=null;return}let i=this._createContextForwardProxy();this._viewRef=r.createEmbeddedView(this.ngTemplateOutlet,i,{injector:this.ngTemplateOutletInjector??void 0})}}_shouldRecreateView(e){return!!e.ngTemplateOutlet||!!e.ngTemplateOutletInjector}_createContextForwardProxy(){return new Proxy({},{set:(e,r,i)=>this.ngTemplateOutletContext?Reflect.set(this.ngTemplateOutletContext,r,i):!1,get:(e,r,i)=>{if(this.ngTemplateOutletContext)return Reflect.get(this.ngTemplateOutletContext,r,i)}})}static \u0275fac=function(r){return new(r||t)(_e(Hn))};static \u0275dir=Oe({type:t,selectors:[["","ngTemplateOutlet",""]],inputs:{ngTemplateOutletContext:"ngTemplateOutletContext",ngTemplateOutlet:"ngTemplateOutlet",ngTemplateOutletInjector:"ngTemplateOutletInjector"},features:[xn]})}return t})();function $V(t,n){return new z(2100,!1)}var Iw=(()=>{class t{_locale;constructor(e){this._locale=e}transform(e,r,i){if(!zV(e))return null;i||=this._locale;try{let o=qV(e);return sM(o,i,r)}catch(o){throw $V(t,o.message)}}static \u0275fac=function(r){return new(r||t)(_e(cd,16))};static \u0275pipe=rd({name:"number",type:t,pure:!0})}return t})();function zV(t){return!(t==null||t===""||t!==t)}function qV(t){if(typeof t=="string"&&!isNaN(Number(t)-parseFloat(t)))return Number(t);if(typeof t!="number")throw new z(2309,!1);return t}var st=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({})}return t})();function yd(t,n){n=encodeURIComponent(n);for(let e of t.split(";")){let r=e.indexOf("="),[i,o]=r==-1?[e,""]:[e.slice(0,r),e.slice(r+1)];if(i.trim()===n)return decodeURIComponent(o)}return null}var ga=class{};var kw="browser";function wm(t){return t===kw}var aM=(()=>{class t{static \u0275prov=O({token:t,providedIn:"root",factory:()=>new Tw(y(Ve),window)})}return t})(),Tw=class{document;window;offset=()=>[0,0];constructor(n,e){this.document=n,this.window=e}setOffset(n){Array.isArray(n)?this.offset=()=>n:this.offset=n}getScrollPosition(){return[this.window.scrollX,this.window.scrollY]}scrollToPosition(n,e){this.window.scrollTo(Z(A({},e),{left:n[0],top:n[1]}))}scrollToAnchor(n,e){let r=GV(this.document,n);r&&(this.scrollToElement(r,e),r.focus())}setHistoryScrollRestoration(n){try{this.window.history.scrollRestoration=n}catch{console.warn(oi(2400,!1))}}scrollToElement(n,e){let r=n.getBoundingClientRect(),i=r.left+this.window.pageXOffset,o=r.top+this.window.pageYOffset,s=this.offset();this.window.scrollTo(Z(A({},e),{left:i-s[0],top:o-s[1]}))}};function GV(t,n){let e=t.getElementById(n)||t.getElementsByName(n)[0];if(e)return e;if(typeof t.createTreeWalker=="function"&&t.body&&typeof t.body.attachShadow=="function"){let r=t.createTreeWalker(t.body,NodeFilter.SHOW_ELEMENT),i=r.currentNode;for(;i;){let o=i.shadowRoot;if(o){let s=o.getElementById(n)||o.querySelector(`[name="${n}"]`);if(s)return s}i=r.nextNode()}}return null}var _d=class{_doc;constructor(n){this._doc=n}manager},Em=(()=>{class t extends _d{constructor(e){super(e)}supports(e){return!0}addEventListener(e,r,i,o){return e.addEventListener(r,i,o),()=>this.removeEventListener(e,r,i,o)}removeEventListener(e,r,i,o){return e.removeEventListener(r,i,o)}static \u0275fac=function(r){return new(r||t)(Q(Ve))};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t}
vendor: 4,536 bytes, line 7
7)(),Dm=new P(""),Rw=(()=>{class t{_zone;_plugins;_eventNameToPlugin=new Map;constructor(e,r){this._zone=r,e.forEach(s=>{s.manager=this});let i=e.filter(s=>!(s instanceof Em));this._plugins=i.slice().reverse();let o=e.find(s=>s instanceof Em);o&&this._plugins.push(o)}addEventListener(e,r,i,o){return this._findPluginFor(r).addEventListener(e,r,i,o)}getZone(){return this._zone}_findPluginFor(e){let r=this._eventNameToPlugin.get(e);if(r)return r;if(r=this._plugins.find(o=>o.supports(e)),!r)throw new z(5101,!1);return this._eventNameToPlugin.set(e,r),r}static \u0275fac=function(r){return new(r||t)(Q(Dm),Q(Ke))};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})(),Mw="ng-app-id";function lM(t){for(let n of t)n.remove()}function cM(t,n){let e=n.createElement("style");return e.textContent=t,e}function KV(t,n,e,r){let i=t.head?.querySelectorAll(`style[${Mw}="${n}"],link[${Mw}="${n}"]`);if(i)for(let o of i)o.removeAttribute(Mw),o instanceof HTMLLinkElement?r.set(o.href.slice(o.href.lastIndexOf("/")+1),{usage:0,elements:[o]}):o.textContent&&e.set(o.textContent,{usage:0,elements:[o]})}function xw(t,n){let e=n.createElement("link");return e.setAttribute("rel","stylesheet"),e.setAttribute("href",t),e}var Ow=(()=>{class t{doc;appId;nonce;inline=new Map;external=new Map;hosts=new Set;constructor(e,r,i,o={}){this.doc=e,this.appId=r,this.nonce=i,KV(e,r,this.inline,this.external),this.hosts.add(e.head)}addStyles(e,r){for(let i of e)this.addUsage(i,this.inline,cM);r?.forEach(i=>this.addUsage(i,this.external,xw))}removeStyles(e,r){for(let i of e)this.removeUsage(i,this.inline);r?.forEach(i=>this.removeUsage(i,this.external))}addUsage(e,r,i){let o=r.get(e);o?o.usage++:r.set(e,{usage:1,elements:[...this.hosts].map(s=>this.addElement(s,i(e,this.doc)))})}removeUsage(e,r){let i=r.get(e);i&&(i.usage--,i.usage<=0&&(lM(i.elements),r.delete(e)))}ngOnDestroy(){for(let[,{elements:e}]of[...this.inline,...this.external])lM(e);this.hosts.clear()}addHost(e){this.hosts.add(e);for(let[r,{elements:i}]of this.inline)i.push(this.addElement(e,cM(r,this.doc)));for(let[r,{elements:i}]of this.external)i.push(this.addElement(e,xw(r,this.doc)))}removeHost(e){this.hosts.delete(e)}addElement(e,r){return this.nonce&&r.setAttribute("nonce",this.nonce),e.appendChild(r)}static \u0275fac=function(r){return new(r||t)(Q(Ve),Q(zl),Q(ql,8),Q(po))};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})(),Aw={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/Math/MathML"},Nw=/%COMP%/g;var dM="%COMP%",JV=`_nghost-${dM}`,YV=`_ngcontent-${dM}`,ZV=!0,XV=new P("",{factory:()=>ZV});function QV(t){return YV.replace(Nw,t)}function eU(t){return JV.replace(Nw,t)}function hM(t,n){return n.map(e=>e.replace(Nw,t))}var Pw=(()=>{class t{eventManager;sharedStylesHost;appId;removeStylesOnCompDestroy;doc;ngZone;nonce;tracingService;rendererByCompId=new Map;defaultRenderer;platformIsServer;constructor(e,r,i,o,s,a,l=null,c=null){this.eventManager=e,this.sharedStylesHost=r,this.appId=i,this.removeStylesOnCompDestroy=o,this.doc=s,this.ngZone=a,this.nonce=l,this.tracingService=c,this.platformIsServer=!1,this.defaultRenderer=new bd(e,s,a,this.platformIsServer,this.tracingService)}createRenderer(e,r){if(!e||!r)return this.defaultRenderer;let i=this.getOrCreateRenderer(e,r);return i instanceof Sm?i.applyToHost(e):i instanceof wd&&i.applyStyles(),i}getOrCreateRenderer(e,r){let i=this.rendererByCompId,o=i.get(r.id);if(!o){let s=this.doc,a=this.ngZone,l=this.eventManager,c=this.sharedStylesHost,u=this.removeStylesOnCompDestroy,d=this.platformIsServer,f=this.tracingService;switch(r.encapsulation){case fi.Emulated:o=new Sm(l,c,r,this.appId,u,s,a,d,f);break;case fi.ShadowDom:return new Cm(l,e,r,s,a,this.nonce,d,f,c);case fi.ExperimentalIsolatedShadowDom:return new Cm(l,e,r,s,a,this.nonce,d,f);default:o=new wd(l,c,r,u,s,a,d,f);break}i.set(r.id,o)}return o}ngOnDestroy(){this.rendererByCompId.clear()}componentReplaced(e){this.rendererByCompId.delete(e)}static \u0275fac=function(r){return new(r||t)(Q(Rw),Q(Ow),Q(zl),Q(XV),Q(Ve),Q(Ke),Q(ql),Q(Fi,8))};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})(),bd=class{eventManager;doc;ngZone;platformIsServer;tracingService;data=Object.create(null);throwOnSyntheticProps=!0;constructor(n,e,r,i,o){this.eventManager=n,this.doc=e,this.ngZone=r,this.platformIsServer=i,this.tracingService=o}destroy(){}destroyNode=null;
vendor: 104,865 bytes, lines 7-8
7createElement(n,e){return e?this.doc.createElementNS(Aw[e]||e,n):this.doc.createElement(n)}createComment(n){return this.doc.createComment(n)}createText(n){return this.doc.createTextNode(n)}appendChild(n,e){(uM(n)?n.content:n).appendChild(e)}insertBefore(n,e,r){n&&(uM(n)?n.content:n).insertBefore(e,r)}removeChild(n,e){e.remove()}selectRootElement(n,e){let r=typeof n=="string"?this.doc.querySelector(n):n;if(!r)throw new z(-5104,!1);return e||(r.textContent=""),r}parentNode(n){return n.parentNode}nextSibling(n){return n.nextSibling}setAttribute(n,e,r,i){if(i){e=i+":"+e;let o=Aw[i];o?n.setAttributeNS(o,e,r):n.setAttribute(e,r)}else n.setAttribute(e,r)}removeAttribute(n,e,r){if(r){let i=Aw[r];i?n.removeAttributeNS(i,e):n.removeAttribute(`${r}:${e}`)}else n.removeAttribute(e)}addClass(n,e){n.classList.add(e)}removeClass(n,e){n.classList.remove(e)}setStyle(n,e,r,i){i&(pi.DashCase|pi.Important)?n.style.setProperty(e,r,i&pi.Important?"important":""):n.style[e]=r}removeStyle(n,e,r){r&pi.DashCase?n.style.removeProperty(e):n.style[e]=""}setProperty(n,e,r){n!=null&&(n[e]=r)}setValue(n,e){n.nodeValue=e}listen(n,e,r,i){if(typeof n=="string"&&(n=Hr().getGlobalEventTarget(this.doc,n),!n))throw new z(5102,!1);let o=this.decoratePreventDefault(r);return this.tracingService?.wrapEventListener&&(o=this.tracingService.wrapEventListener(n,e,o)),this.eventManager.addEventListener(n,e,o,i)}decoratePreventDefault(n){return e=>{if(e==="__ngUnwrap__")return n;n(e)===!1&&e.preventDefault()}}};function uM(t){return t.tagName==="TEMPLATE"&&t.content!==void 0}var Cm=class extends bd{hostEl;sharedStylesHost;shadowRoot;constructor(n,e,r,i,o,s,a,l,c){super(n,i,o,a,l),this.hostEl=e,this.sharedStylesHost=c,this.shadowRoot=e.attachShadow({mode:"open"}),this.sharedStylesHost&&this.sharedStylesHost.addHost(this.shadowRoot);let u=r.styles;u=hM(r.id,u);for(let f of u){let h=document.createElement("style");s&&h.setAttribute("nonce",s),h.textContent=f,this.shadowRoot.appendChild(h)}let d=r.getExternalStyles?.();if(d)for(let f of d){let h=xw(f,i);s&&h.setAttribute("nonce",s),this.shadowRoot.appendChild(h)}}nodeOrShadowRoot(n){return n===this.hostEl?this.shadowRoot:n}appendChild(n,e){return super.appendChild(this.nodeOrShadowRoot(n),e)}insertBefore(n,e,r){return super.insertBefore(this.nodeOrShadowRoot(n),e,r)}removeChild(n,e){return super.removeChild(null,e)}parentNode(n){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(n)))}destroy(){this.sharedStylesHost&&this.sharedStylesHost.removeHost(this.shadowRoot)}},wd=class extends bd{sharedStylesHost;removeStylesOnCompDestroy;styles;styleUrls;constructor(n,e,r,i,o,s,a,l,c){super(n,o,s,a,l),this.sharedStylesHost=e,this.removeStylesOnCompDestroy=i;let u=r.styles;this.styles=c?hM(c,u):u,this.styleUrls=r.getExternalStyles?.(c)}applyStyles(){this.sharedStylesHost.addStyles(this.styles,this.styleUrls)}destroy(){this.removeStylesOnCompDestroy&&sa.size===0&&this.sharedStylesHost.removeStyles(this.styles,this.styleUrls)}},Sm=class extends wd{contentAttr;hostAttr;constructor(n,e,r,i,o,s,a,l,c){let u=i+"-"+r.id;super(n,e,r,o,s,a,l,c,u),this.contentAttr=QV(u),this.hostAttr=eU(u)}applyToHost(n){this.applyStyles(),this.setAttribute(n,this.hostAttr,"")}createElement(n,e){let r=super.createElement(n,e);return super.setAttribute(r,this.contentAttr,""),r}};var Im=class t extends pd{supportsDOMEvents=!0;static makeCurrent(){yw(new t)}onAndCancel(n,e,r,i){return n.addEventListener(e,r,i),()=>{n.removeEventListener(e,r,i)}}dispatchEvent(n,e){n.dispatchEvent(e)}remove(n){n.remove()}createElement(n,e){return e=e||this.getDefaultDocument(),e.createElement(n)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(n){return n.nodeType===Node.ELEMENT_NODE}isShadowRoot(n){return n instanceof DocumentFragment}getGlobalEventTarget(n,e){return e==="window"?window:e==="document"?n:e==="body"?n.body:null}getBaseHref(n){let e=tU();return e==null?null:nU(e)}resetBaseElement(){Ed=null}getUserAgent(){return window.navigator.userAgent}getCookie(n){return yd(document.cookie,n)}},Ed=null;function tU(){return Ed=Ed||document.head.querySelector("base"),Ed?Ed.getAttribute("href"):null}function nU(t){return new URL(t,document.baseURI).pathname}var rU=(()=>{class t{build(){return new XMLHttpRequest}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})(),fM=["alt","control","meta","shift"],iU={"\b":"Backspace"," ":"Tab","\x7F":"Delete","\x1B":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},oU={alt:t=>t.altKey,control:t=>t.ctrlKey,meta:t=>t.metaKey,shift:t=>t.shiftKey},pM=(()=>{class t extends _d{constructor(e){super(e)}supports(e){return t.parseEventName(e)!=null}addEventListener(e,r,i,o){let s=t.parseEventName(r),a=t.eventCallback(s.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>Hr().onAndCancel(e,s.domEventName,a,o))}static parseEventName(e){let r=e.toLowerCase().split("."),i=r.shift();if(r.length===0||!(i==="keydown"||i==="keyup"))return null;let o=t._normalizeKey(r.pop()),s="",a=r.indexOf("code");if(a>-1&&(r.splice(a,1),s="code."),fM.forEach(c=>{let u=r.indexOf(c);u>-1&&(r.splice(u,1),s+=c+".")}),s+=o,r.length!=0||o.length===0)return null;let l={};return l.domEventName=i,l.fullKey=s,l}static matchEventFullKeyCode(e,r){let i=iU[e.key]||e.key,o="";return r.indexOf("code.")>-1&&(i=e.code,o="code."),i==null||!i?!1:(i=i.toLowerCase(),i===" "?i="space":i==="."&&(i="dot"),fM.forEach(s=>{if(s!==i){let a=oU[s];a(e)&&(o+=s+".")}}),o+=i,o===r)}static eventCallback(e,r,i){return o=>{t.matchEventFullKeyCode(o,e)&&i.runGuarded(()=>r(o))}}static _normalizeKey(e){return e==="esc"?"escape":e}static \u0275fac=function(r){return new(r||t)(Q(Ve))};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})();function Fw(t,n,e){let r=A({rootComponent:t,platformRef:e?.platformRef},sU(n));return Yk(r)}function sU(t){return{appProviders:[...dU,...t?.providers??[]],platformProviders:uU}}function aU(){Im.makeCurrent()}function lU(){return new ur}function cU(){return wb(document),document}var uU=[{provide:po,useValue:kw},{provide:Zp,useValue:aU,multi:!0},{provide:Ve,useFactory:cU}];var dU=[{provide:Au,useValue:"root"},{provide:ur,useFactory:lU},{provide:Dm,useClass:Em,multi:!0},{provide:Dm,useClass:pM,multi:!0},Pw,Ow,Rw,{provide:Un,useExisting:Pw},{provide:ga,useClass:rU},[]];var Qo=class t{headers;normalizedNames=new Map;lazyInit;lazyUpdate=null;constructor(n){n?typeof n=="string"?this.lazyInit=()=>{this.headers=new Map,n.split(` 8`).forEach(e=>{let r=e.indexOf(":");if(r>0){let i=e.slice(0,r),o=e.slice(r+1).trim();this.addHeaderEntry(i,o)}})}:typeof Headers<"u"&&n instanceof Headers?(this.headers=new Map,n.forEach((e,r)=>{this.addHeaderEntry(r,e)})):this.lazyInit=()=>{this.headers=new Map,Object.entries(n).forEach(([e,r])=>{this.setHeaderEntries(e,r)})}:this.headers=new Map}has(n){return this.init(),this.headers.has(n.toLowerCase())}get(n){this.init();let e=this.headers.get(n.toLowerCase());return e&&e.length>0?e[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(n){return this.init(),this.headers.get(n.toLowerCase())||null}append(n,e){return this.clone({name:n,value:e,op:"a"})}set(n,e){return this.clone({name:n,value:e,op:"s"})}delete(n,e){return this.clone({name:n,value:e,op:"d"})}maybeSetNormalizedName(n,e){this.normalizedNames.has(e)||this.normalizedNames.set(e,n)}init(){this.lazyInit&&(this.lazyInit instanceof t?this.copyFrom(this.lazyInit):this.lazyInit(),this.lazyInit=null,this.lazyUpdate&&(this.lazyUpdate.forEach(n=>this.applyUpdate(n)),this.lazyUpdate=null))}copyFrom(n){n.init(),Array.from(n.headers.keys()).forEach(e=>{this.headers.set(e,n.headers.get(e)),this.normalizedNames.set(e,n.normalizedNames.get(e))})}clone(n){let e=new t;return e.lazyInit=this.lazyInit&&this.lazyInit instanceof t?this.lazyInit:this,e.lazyUpdate=(this.lazyUpdate||[]).concat([n]),e}applyUpdate(n){let e=n.name.toLowerCase();switch(n.op){case"a":case"s":let r=n.value;if(typeof r=="string"&&(r=[r]),r.length===0)return;this.maybeSetNormalizedName(n.name,e);let i=(n.op==="a"?this.headers.get(e):void 0)||[];i.push(...r),this.headers.set(e,i);break;case"d":let o=n.value;if(!o)this.headers.delete(e),this.normalizedNames.delete(e);else{let s=this.headers.get(e);if(!s)return;s=s.filter(a=>o.indexOf(a)===-1),s.length===0?(this.headers.delete(e),this.normalizedNames.delete(e)):this.headers.set(e,s)}break}}addHeaderEntry(n,e){let r=n.toLowerCase();this.maybeSetNormalizedName(n,r),this.headers.has(r)?this.headers.get(r).push(e):this.headers.set(r,[e])}setHeaderEntries(n,e){let r=(Array.isArray(e)?e:[e]).map(o=>o.toString()),i=n.toLowerCase();this.headers.set(i,r),this.maybeSetNormalizedName(n,i)}forEach(n){this.init(),Array.from(this.normalizedNames.keys()).forEach(e=>n(this.normalizedNames.get(e),this.headers.get(e)))}};var km=class{map=new Map;set(n,e){return this.map.set(n,e),this}get(n){return this.map.has(n)||this.map.set(n,n.defaultValue()),this.map.get(n)}delete(n){return this.map.delete(n),this}has(n){return this.map.has(n)}keys(){return this.map.keys()}},Mm=class{encodeKey(n){return mM(n)}encodeValue(n){return mM(n)}decodeKey(n){return decodeURIComponent(n)}decodeValue(n){return decodeURIComponent(n)}};function hU(t,n){let e=new Map;return t.length>0&&t.replace(/^\?/,"").split("&").forEach(i=>{let o=i.indexOf("="),[s,a]=o==-1?[n.decodeKey(i),""]:[n.decodeKey(i.slice(0,o)),n.decodeValue(i.slice(o+1))],l=e.get(s)||[];l.push(a),e.set(s,l)}),e}var fU=/%(\d[a-f0-9])/gi,pU={40:"@","3A":":",24:"$","2C":",","3B":";","3D":"=","3F":"?","2F":"/"};function mM(t){return encodeURIComponent(t).replace(fU,(n,e)=>pU[e]??n)}function Tm(t){return`${t}`}var _i=class t{map;encoder;updates=null;cloneFrom=null;constructor(n={}){if(this.encoder=n.encoder||new Mm,n.fromString){if(n.fromObject)throw new z(2805,!1);this.map=hU(n.fromString,this.encoder)}else n.fromObject?(this.map=new Map,Object.keys(n.fromObject).forEach(e=>{let r=n.fromObject[e],i=Array.isArray(r)?r.map(Tm):[Tm(r)];this.map.set(e,i)})):this.map=null}has(n){return this.init(),this.map.has(n)}get(n){this.init();let e=this.map.get(n);return e?e[0]:null}getAll(n){return this.init(),this.map.get(n)||null}keys(){return this.init(),Array.from(this.map.keys())}append(n,e){return this.clone({param:n,value:e,op:"a"})}appendAll(n){let e=[];return Object.keys(n).forEach(r=>{let i=n[r];Array.isArray(i)?i.forEach(o=>{e.push({param:r,value:o,op:"a"})}):e.push({param:r,value:i,op:"a"})}),this.clone(e)}set(n,e){return this.clone({param:n,value:e,op:"s"})}delete(n,e){return this.clone({param:n,value:e,op:"d"})}toString(){return this.init(),this.keys().map(n=>{let e=this.encoder.encodeKey(n);return this.map.get(n).map(r=>e+"="+this.encoder.encodeValue(r)).join("&")}).filter(n=>n!=="").join("&")}clone(n){let e=new t({encoder:this.encoder});return e.cloneFrom=this.cloneFrom||this,e.updates=(this.updates||[]).concat(n),e}init(){this.map===null&&(this.map=new Map),this.cloneFrom!==null&&(this.cloneFrom.init(),this.cloneFrom.keys().forEach(n=>this.map.set(n,this.cloneFrom.map.get(n))),this.updates.forEach(n=>{switch(n.op){case"a":case"s":let e=(n.op==="a"?this.map.get(n.param):void 0)||[];e.push(Tm(n.value)),this.map.set(n.param,e);break;case"d":if(n.value!==void 0){let r=this.map.get(n.param)||[],i=r.indexOf(Tm(n.value));i!==-1&&r.splice(i,1),r.length>0?this.map.set(n.param,r):this.map.delete(n.param)}else{this.map.delete(n.param);break}}}),this.cloneFrom=this.updates=null)}};function mU(t){switch(t){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"JSONP":return!1;default:return!0}}function gM(t){return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer}function vM(t){return typeof Blob<"u"&&t instanceof Blob}function yM(t){return typeof FormData<"u"&&t instanceof FormData}function gU(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}var _M="Content-Type",bM="Accept",wM="text/plain",EM="application/json",vU=`${EM}, ${wM}, */*`,nc=class t{url;body=null;headers;context;reportProgress=!1;withCredentials=!1;credentials;keepalive=!1;cache;priority;mode;redirect;referrer;integrity;referrerPolicy;responseType="json";method;params;urlWithParams;transferCache;timeout;constructor(n,e,r,i){this.url=e,this.method=n.toUpperCase();let o;if(mU(this.method)||i?(this.body=r!==void 0?r:null,o=i):o=r,o){if(this.reportProgress=!!o.reportProgress,this.withCredentials=!!o.withCredentials,this.keepalive=!!o.keepalive,o.responseType&&(this.responseType=o.responseType),o.headers&&(this.headers=o.headers),o.context&&(this.context=o.context),o.params&&(this.params=o.params),o.priority&&(this.priority=o.priority),o.cache&&(this.cache=o.cache),o.credentials&&(this.credentials=o.credentials),typeof o.timeout=="number"){if(o.timeout<1||!Number.isInteger(o.timeout))throw new z(2822,"");this.timeout=o.timeout}o.mode&&(this.mode=o.mode),o.redirect&&(this.redirect=o.redirect),o.integrity&&(this.integrity=o.integrity),o.referrer&&(this.referrer=o.referrer),o.referrerPolicy&&(this.referrerPolicy=o.referrerPolicy),this.transferCache=o.transferCache}if(this.headers??=new Qo,this.context??=new km,!this.params)this.params=new _i,this.urlWithParams=e;else{let s=this.params.toString();if(s.length===0)this.urlWithParams=e;else{let a=e.indexOf("?"),l=a===-1?"?":a<e.length-1?"&":"";this.urlWithParams=e+l+s}}}serializeBody(){return this.body===null?null:typeof this.body=="string"||gM(this.body)||vM(this.body)||yM(this.body)||gU(this.body)?this.body:this.body instanceof _i?this.body.toString():typeof this.body=="object"||typeof this.body=="boolean"||Array.isArray(this.body)?JSON.stringify(this.body):this.body.toString()}detectContentTypeHeader(){return this.body===null||yM(this.body)?null:vM(this.body)?this.body.type||null:gM(this.body)?null:typeof this.body=="string"?wM:this.body instanceof _i?"application/x-www-form-urlencoded;charset=UTF-8":typeof this.body=="object"||typeof this.body=="number"||typeof this.body=="boolean"?EM:null}clone(n={}){let e=n.method||this.method,r=n.url||this.url,i=n.responseType||this.responseType,o=n.keepalive??this.keepalive,s=n.priority||this.priority,a=n.cache||this.cache,l=n.mode||this.mode,c=n.redirect||this.redirect,u=n.credentials||this.credentials,d=n.referrer||this.referrer,f=n.integrity||this.integrity,h=n.referrerPolicy||this.referrerPolicy,p=n.transferCache??this.transferCache,m=n.timeout??this.timeout,g=n.body!==void 0?n.body:this.body,w=n.withCredentials??this.withCredentials,C=n.reportProgress??this.reportProgress,T=n.headers||this.headers,I=n.params||this.params,F=n.context??this.context;return n.setHeaders!==void 0&&(T=Object.keys(n.setHeaders).reduce(($,q)=>$.set(q,n.setHeaders[q]),T)),n.setParams&&(I=Object.keys(n.setParams).reduce(($,q)=>$.set(q,n.setParams[q]),I)),new t(e,r,g,{params:I,headers:T,context:F,reportProgress:C,responseType:i,withCredentials:w,transferCache:p,keepalive:o,cache:a,priority:s,timeout:m,mode:l,redirect:c,credentials:u,referrer:d,integrity:f,referrerPolicy:h})}},va=(function(t){return t[t.Sent=0]="Sent",t[t.UploadProgress=1]="UploadProgress",t[t.ResponseHeader=2]="ResponseHeader",t[t.DownloadProgress=3]="DownloadProgress",t[t.Response=4]="Response",t[t.User=5]="User",t})(va||{}),rc=class{headers;status;statusText;url;ok;type;redirected;responseType;constructor(n,e=200,r="OK"){this.headers=n.headers||new Qo,this.status=n.status!==void 0?n.status:e,this.statusText=n.statusText||r,this.url=n.url||null,this.redirected=n.redirected,this.responseType=n.responseType,this.ok=this.status>=200&&this.status<300}},Am=class t extends rc{constructor(n={}){super(n)}type=va.ResponseHeader;clone(n={}){return new t({headers:n.headers||this.headers,status:n.status!==void 0?n.status:this.status,statusText:n.statusText||this.statusText,url:n.url||this.url||void 0})}},Cd=class t extends rc{body;constructor(n={}){super(n),this.body=n.body!==void 0?n.body:null}type=va.Response;clone(n={}){return new t({body:n.body!==void 0?n.body:this.body,headers:n.headers||this.headers,status:n.status!==void 0?n.status:this.status,statusText:n.statusText||this.statusText,url:n.url||this.url||void 0,redirected:n.redirected??this.redirected,responseType:n.responseType??this.responseType})}},Xo=class extends rc{name="HttpErrorResponse";message;error;ok=!1;constructor(n){super(n,0,"Unknown Error"),this.status>=200&&this.status<300?this.message=`Http failure during parsing for ${n.url||"(unknown url)"}`:this.message=`Http failure response for ${n.url||"(unknown url)"}: ${n.status} ${n.statusText}`,this.error=n.error||null}},yU=200,_U=204;var bU=new P("");var wU=/^\)\]\}',?\n/;var jw=(()=>{class t{xhrFactory;tracingService=y(Fi,{optional:!0});constructor(e){this.xhrFactory=e}maybePropagateTrace(e){return this.tracingService?.propagate?this.tracingService.propagate(e):e}handle(e){if(e.method==="JSONP")throw new z(-2800,!1);let r=this.xhrFactory;return fe(null).pipe(Tt(()=>new Ie(o=>{let s=r.build();if(s.open(e.method,e.urlWithParams),e.withCredentials&&(s.withCredentials=!0),e.headers.forEach((g,w)=>s.setRequestHeader(g,w.join(","))),e.headers.has(bM)||s.setRequestHeader(bM,vU),!e.headers.has(_M)){let g=e.detectContentTypeHeader();g!==null&&s.setRequestHeader(_M,g)}if(e.timeout&&(s.timeout=e.timeout),e.responseType){let g=e.responseType.toLowerCase();s.responseType=g!=="json"?g:"text"}let a=e.serializeBody(),l=null,c=()=>{if(l!==null)return l;let g=s.statusText||"OK",w=new Qo(s.getAllResponseHeaders()),C=s.responseURL||e.url;return l=new Am({headers:w,status:s.status,statusText:g,url:C}),l},u=this.maybePropagateTrace(()=>{let{headers:g,status:w,statusText:C,url:T}=c(),I=null;w!==_U&&(I=typeof s.response>"u"?s.responseText:s.response),w===0&&(w=I?yU:0);let F=w>=200&&w<300;if(e.responseType==="json"&&typeof I=="string"){let $=I;I=I.replace(wU,"");try{I=I!==""?JSON.parse(I):null}catch(q){I=$,F&&(F=!1,I={error:q,text:I})}}F?(o.next(new Cd({body:I,headers:g,status:w,statusText:C,url:T||void 0})),o.complete()):o.error(new Xo({error:I,headers:g,status:w,statusText:C,url:T||void 0}))}),d=this.maybePropagateTrace(g=>{let{url:w}=c(),C=new Xo({error:g,status:s.status||0,statusText:s.statusText||"Unknown Error",url:w||void 0});o.error(C)}),f=d;e.timeout&&(f=this.maybePropagateTrace(g=>{let{url:w}=c(),C=new Xo({error:new DOMException("Request timed out","TimeoutError"),status:s.status||0,statusText:s.statusText||"Request timeout",url:w||void 0});o.error(C)}));let h=!1,p=this.maybePropagateTrace(g=>{h||(o.next(c()),h=!0);let w={type:va.DownloadProgress,loaded:g.loaded};g.lengthComputable&&(w.total=g.total),e.responseType==="text"&&s.responseText&&(w.partialText=s.responseText),o.next(w)}),m=this.maybePropagateTrace(g=>{let w={type:va.UploadProgress,loaded:g.loaded};g.lengthComputable&&(w.total=g.total),o.next(w)});return s.addEventListener("load",u),s.addEventListener("error",d),s.addEventListener("timeout",f),s.addEventListener("abort",d),e.reportProgress&&(s.addEventListener("progress",p),a!==null&&s.upload&&s.upload.addEventListener("progress",m)),s.send(a),o.next({type:va.Sent}),()=>{s.removeEventListener("error",d),s.removeEventListener("abort",d),s.removeEventListener("load",u),s.removeEventListener("timeout",f),e.reportProgress&&(s.removeEventListener("progress",p),a!==null&&s.upload&&s.upload.removeEventListener("progress",m)),s.readyState!==s.DONE&&s.abort()}})))}static \u0275fac=function(r){return new(r||t)(Q(ga))};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function EU(t,n){return n(t)}function CU(t,n,e){return(r,i)=>Dn(e,()=>n(r,o=>t(o,i)))}var CM=new P("",{factory:()=>[]}),SM=new P(""),DM=new P("",{providedIn:"root",factory:()=>!0});var ic=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:function(r){let i=null;return r?i=new(r||t):i=Q(jw),i},providedIn:"root"})}return t})();var xm=(()=>{class t{backend;injector;chain=null;pendingTasks=y(Pl);contributeToStability=y(DM);constructor(e,r){this.backend=e,this.injector=r}handle(e){if(this.chain===null){let r=Array.from(new Set([...this.injector.get(CM),...this.injector.get(SM,[])]));this.chain=r.reduceRight((i,o)=>CU(i,o,this.injector),EU)}if(this.contributeToStability){let r=this.pendingTasks.add();return this.chain(e,i=>this.backend.handle(i)).pipe(yu(r))}else return this.chain(e,r=>this.backend.handle(r))}static \u0275fac=function(r){return new(r||t)(Q(ic),Q(kt))};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Bw=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:function(r){let i=null;return r?i=new(r||t):i=Q(xm),i},providedIn:"root"})}return t})();function Lw(t,n){return{body:n,headers:t.headers,context:t.context,observe:t.observe,params:t.params,reportProgress:t.reportProgress,responseType:t.responseType,withCredentials:t.withCredentials,credentials:t.credentials,transferCache:t.transferCache,timeout:t.timeout,keepalive:t.keepalive,priority:t.priority,cache:t.cache,mode:t.mode,redirect:t.redirect,integrity:t.integrity,referrer:t.referrer,referrerPolicy:t.referrerPolicy}}var es=(()=>{class t{handler;constructor(e){this.handler=e}request(e,r,i={}){let o;if(e instanceof nc)o=e;else{let l;i.headers instanceof Qo?l=i.headers:l=new Qo(i.headers);let c;i.params&&(i.params instanceof _i?c=i.params:c=new _i({fromObject:i.params})),o=new nc(e,r,i.body!==void 0?i.body:null,{headers:l,context:i.context,params:c,reportProgress:i.reportProgress,responseType:i.responseType||"json",withCredentials:i.withCredentials,transferCache:i.transferCache,keepalive:i.keepalive,priority:i.priority,cache:i.cache,mode:i.mode,redirect:i.redirect,credentials:i.credentials,referrer:i.referrer,referrerPolicy:i.referrerPolicy,integrity:i.integrity,timeout:i.timeout})}let s=fe(o).pipe(Ii(l=>this.handler.handle(l)));if(e instanceof nc||i.observe==="events")return s;let a=s.pipe(_t(l=>l instanceof Cd));switch(i.observe||"body"){case"body":switch(o.responseType){case"arraybuffer":return a.pipe(te(l=>{if(l.body!==null&&!(l.body instanceof ArrayBuffer))throw new z(2806,!1);return l.body}));case"blob":return a.pipe(te(l=>{if(l.body!==null&&!(l.body instanceof Blob))throw new z(2807,!1);return l.body}));case"text":return a.pipe(te(l=>{if(l.body!==null&&typeof l.body!="string")throw new z(2808,!1);return l.body}));case"json":default:return a.pipe(te(l=>l.body))}case"response":return a;default:throw new z(2809,!1)}}delete(e,r={}){return this.request("DELETE",e,r)}get(e,r={}){return this.request("GET",e,r)}head(e,r={}){return this.request("HEAD",e,r)}jsonp(e,r){return this.request("JSONP",e,{params:new _i().append(r,"JSONP_CALLBACK"),observe:"body",responseType:"json"})}options(e,r={}){return this.request("OPTIONS",e,r)}patch(e,r,i={}){return this.request("PATCH",e,Lw(i,r))}post(e,r,i={}){return this.request("POST",e,Lw(i,r))}put(e,r,i={}){return this.request("PUT",e,Lw(i,r))}static \u0275fac=function(r){return new(r||t)(Q(Bw))};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var SU=new P("",{factory:()=>!0}),DU="XSRF-TOKEN",IU=new P("",{providedIn:"root",factory:()=>DU}),TU="X-XSRF-TOKEN",kU=new P("",{providedIn:"root",factory:()=>TU}),MU=(()=>{class t{cookieName=y(IU);doc=y(Ve);lastCookieString="";lastToken=null;parseCount=0;getToken(){let e=this.doc.cookie||"";return e!==this.lastCookieString&&(this.parseCount++,this.lastToken=yd(e,this.cookieName),this.lastCookieString=e),this.lastToken}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),IM=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:function(r){let i=null;return r?i=new(r||t):i=Q(MU),i},providedIn:"root"})}return t})(),AU=/^(?:https?:)?\/\//i;function xU(t,n){if(!y(SU)||t.method==="GET"||t.method==="HEAD"||AU.test(t.url))return n(t);let e=y(IM).getToken(),r=y(kU);return e!=null&&!t.headers.has(r)&&(t=t.clone({headers:t.headers.set(r,e)})),n(t)}function Vw(...t){let n=[es,xm,{provide:Bw,useExisting:xm},{provide:ic,useFactory:()=>y(bU,{optional:!0})??y(jw)},{provide:CM,useValue:xU,multi:!0}];for(let e of t)n.push(...e.\u0275providers);return Or(n)}var TM=(()=>{class t{_doc;constructor(e){this._doc=e}getTitle(){return this._doc.title}setTitle(e){this._doc.title=e||""}static \u0275fac=function(r){return new(r||t)(Q(Ve))};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var je="primary",Nd=Symbol("RouteTitle"),qw=class{params;constructor(n){this.params=n||{}}has(n){return Object.prototype.hasOwnProperty.call(this.params,n)}get(n){if(this.has(n)){let e=this.params[n];return Array.isArray(e)?e[0]:e}return null}getAll(n){if(this.has(n)){let e=this.params[n];return Array.isArray(e)?e:[e]}return[]}get keys(){return Object.keys(this.params)}};function wa(t){return new qw(t)}function FM(t,n,e){let r=e.path.split("/");if(r.length>t.length||e.pathMatch==="full"&&(n.hasChildren()||r.length<t.length))return null;let i={};for(let o=0;o<r.length;o++){let s=r[o],a=t[o];if(s[0]===":")i[s.substring(1)]=a;else if(s!==a.path)return null}return{consumed:t.slice(0,r.length),posParams:i}}function Lm(t){return new Promise((n,e)=>{t.pipe(ao()).subscribe({next:r=>n(r),error:r=>e(r)})})}function OU(t,n){if(t.length!==n.length)return!1;for(let e=0;e<t.length;++e)if(!Hi(t[e],n[e]))return!1;return!0}function Hi(t,n){let e=t?Ww(t):void 0,r=n?Ww(n):void 0;if(!e||!r||e.length!=r.length)return!1;let i;for(let o=0;o<e.length;o++)if(i=e[o],!LM(t[i],n[i]))return!1;return!0}function Ww(t){return[...Object.keys(t),...Object.getOwnPropertySymbols(t)]}function LM(t,n){if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return!1;let e=[...t].sort(),r=[...n].sort();return e.every((i,o)=>r[o]===i)}else return t===n}function jM(t){return t.length>0?t[t.length-1]:null}function Ea(t){return cr(t)?t:Go(t)?Xe(Promise.resolve(t)):fe(t)}function BM(t){return cr(t)?Lm(t):Promise.resolve(t)}var NU={exact:UM,subset:HM},VM={exact:PU,subset:FU,ignored:()=>!0};function kM(t,n,e){return NU[e.paths](t.root,n.root,e.matrixParams)&&VM[e.queryParams](t.queryParams,n.queryParams)&&!(e.fragment==="exact"&&t.fragment!==n.fragment)}function PU(t,n){return Hi(t,n)}function UM(t,n,e){if(!_a(t.segments,n.segments)||!Nm(t.segments,n.segments,e)||t.numberOfChildren!==n.numberOfChildren)return!1;for(let r in n.children)if(!t.children[r]||!UM(t.children[r],n.children[r],e))return!1;return!0}function FU(t,n){return Object.keys(n).length<=Object.keys(t).length&&Object.keys(n).every(e=>LM(t[e],n[e]))}function HM(t,n,e){return $M(t,n,n.segments,e)}function $M(t,n,e,r){if(t.segments.length>e.length){let i=t.segments.slice(0,e.length);return!(!_a(i,e)||n.hasChildren()||!Nm(i,e,r))}else if(t.segments.length===e.length){if(!_a(t.segments,e)||!Nm(t.segments,e,r))return!1;for(let i in n.children)if(!t.children[i]||!HM(t.children[i],n.children[i],r))return!1;return!0}else{let i=e.slice(0,t.segments.length),o=e.slice(t.segments.length);return!_a(t.segments,i)||!Nm(t.segments,i,r)||!t.children[je]?!1:$M(t.children[je],n,o,r)}}function Nm(t,n,e){return n.every((r,i)=>VM[e](t[i].parameters,r.parameters))}var wi=class{root;queryParams;fragment;_queryParamMap;constructor(n=new dt([],{}),e={},r=null){this.root=n,this.queryParams=e,this.fragment=r}get queryParamMap(){return this._queryParamMap??=wa(this.queryParams),this._queryParamMap}toString(){return BU.serialize(this)}},dt=class{segments;children;parent=null;constructor(n,e){this.segments=n,this.children=e,Object.values(e).forEach(r=>r.parent=this)}hasChildren(){return this.numberOfChildren>0}get numberOfChildren(){return Object.keys(this.children).length}toString(){return Pm(this)}},ts=class{path;parameters;_parameterMap;constructor(n,e){this.path=n,this.parameters=e}get parameterMap(){return this._parameterMap??=wa(this.parameters),this._parameterMap}toString(){return qM(this)}};function LU(t,n){return _a(t,n)&&t.every((e,r)=>Hi(e.parameters,n[r].parameters))}function _a(t,n){return t.length!==n.length?!1:t.every((e,r)=>e.path===n[r].path)}function jU(t,n){let e=[];return Object.entries(t.children).forEach(([r,i])=>{r===je&&(e=e.concat(n(i,r)))}),Object.entries(t.children).forEach(([r,i])=>{r!==je&&(e=e.concat(n(i,r)))}),e}var Ca=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:()=>new go,providedIn:"root"})}return t})(),go=class{parse(n){let e=new Kw(n);return new wi(e.parseRootSegment(),e.parseQueryParams(),e.parseFragment())}serialize(n){let e=`/${Sd(n.root,!0)}`,r=HU(n.queryParams),i=typeof n.fragment=="string"?`#${VU(n.fragment)}`:"";return`${e}${r}${i}`}},BU=new go;function Pm(t){return t.segments.map(n=>qM(n)).join("/")}function Sd(t,n){if(!t.hasChildren())return Pm(t);if(n){let e=t.children[je]?Sd(t.children[je],!1):"",r=[];return Object.entries(t.children).forEach(([i,o])=>{i!==je&&r.push(`${i}:${Sd(o,!1)}`)}),r.length>0?`${e}(${r.join("//")})`:e}else{let e=jU(t,(r,i)=>i===je?[Sd(t.children[je],!1)]:[`${i}:${Sd(r,!1)}`]);return Object.keys(t.children).length===1&&t.children[je]!=null?`${Pm(t)}/${e[0]}`:`${Pm(t)}/(${e.join("//")})`}}function zM(t){return encodeURIComponent(t).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",")}function Rm(t){return zM(t).replace(/%3B/gi,";")}function VU(t){return encodeURI(t)}function Gw(t){return zM(t).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/%26/gi,"&")}function Fm(t){return decodeURIComponent(t)}function MM(t){return Fm(t.replace(/\+/g,"%20"))}function qM(t){return`${Gw(t.path)}${UU(t.parameters)}`}function UU(t){return Object.entries(t).map(([n,e])=>`;${Gw(n)}=${Gw(e)}`).join("")}function HU(t){let n=Object.entries(t).map(([e,r])=>Array.isArray(r)?r.map(i=>`${Rm(e)}=${Rm(i)}`).join("&"):`${Rm(e)}=${Rm(r)}`).filter(e=>e);return n.length?`?${n.join("&")}`:""}var $U=/^[^\/()?;#]+/;function Uw(t){let n=t.match($U);return n?n[0]:""}var zU=/^[^\/()?;=#]+/;function qU(t){let n=t.match(zU);return n?n[0]:""}var WU=/^[^=?&#]+/;function GU(t){let n=t.match(WU);return n?n[0]:""}var KU=/^[^&#]+/;function JU(t){let n=t.match(KU);return n?n[0]:""}var Kw=class{url;remaining;constructor(n){this.url=n,this.remaining=n}parseRootSegment(){return this.consumeOptional("/"),this.remaining===""||this.peekStartsWith("?")||this.peekStartsWith("#")?new dt([],{}):new dt([],this.parseChildren())}parseQueryParams(){let n={};if(this.consumeOptional("?"))do this.parseQueryParam(n);while(this.consumeOptional("&"));return n}parseFragment(){return this.consumeOptional("#")?decodeURIComponent(this.remaining):null}parseChildren(){if(this.remaining==="")return{};this.consumeOptional("/");let n=[];for(this.peekStartsWith("(")||n.push(this.parseSegment());this.peekStartsWith("/")&&!this.peekStartsWith("//")&&!this.peekStartsWith("/(");)this.capture("/"),n.push(this.parseSegment());let e={};this.peekStartsWith("/(")&&(this.capture("/"),e=this.parseParens(!0));let r={};return this.peekStartsWith("(")&&(r=this.parseParens(!1)),(n.length>0||Object.keys(e).length>0)&&(r[je]=new dt(n,e)),r}parseSegment(){let n=Uw(this.remaining);if(n===""&&this.peekStartsWith(";"))throw new z(4009,!1);return this.capture(n),new ts(Fm(n),this.parseMatrixParams())}parseMatrixParams(){let n={};for(;this.consumeOptional(";");)this.parseParam(n);return n}parseParam(n){let e=qU(this.remaining);if(!e)return;this.capture(e);let r="";if(this.consumeOptional("=")){let i=Uw(this.remaining);i&&(r=i,this.capture(r))}n[Fm(e)]=Fm(r)}parseQueryParam(n){let e=GU(this.remaining);if(!e)return;this.capture(e);let r="";if(this.consumeOptional("=")){let s=JU(this.remaining);s&&(r=s,this.capture(r))}let i=MM(e),o=MM(r);if(n.hasOwnProperty(i)){let s=n[i];Array.isArray(s)||(s=[s],n[i]=s),s.push(o)}else n[i]=o}parseParens(n){let e={};for(this.capture("(");!this.consumeOptional(")")&&this.remaining.length>0;){let r=Uw(this.remaining),i=this.remaining[r.length];if(i!=="/"&&i!==")"&&i!==";")throw new z(4010,!1);let o;r.indexOf(":")>-1?(o=r.slice(0,r.indexOf(":")),this.capture(o),this.capture(":")):n&&(o=je);let s=this.parseChildren();e[o??je]=Object.keys(s).length===1&&s[je]?s[je]:new dt([],s),this.consumeOptional("//")}return e}peekStartsWith(n){return this.remaining.startsWith(n)}consumeOptional(n){return this.peekStartsWith(n)?(this.remaining=this.remaining.substring(n.length),!0):!1}capture(n){if(!this.consumeOptional(n))throw new z(4011,!1)}};function WM(t){return t.segments.length>0?new dt([],{[je]:t}):t}function GM(t){let n={};for(let[r,i]of Object.entries(t.children)){let o=GM(i);if(r===je&&o.segments.length===0&&o.hasChildren())for(let[s,a]of Object.entries(o.children))n[s]=a;else(o.segments.length>0||o.hasChildren())&&(n[r]=o)}let e=new dt(t.segments,n);return YU(e)}function YU(t){if(t.numberOfChildren===1&&t.children[je]){let n=t.children[je];return new dt(t.segments.concat(n.segments),n.children)}return t}function ns(t){return t instanceof wi}function KM(t,n,e=null,r=null,i=new go){let o=JM(t);return YM(o,n,e,r,i)}function JM(t){let n;function e(o){let s={};for(let l of o.children){let c=e(l);s[l.outlet]=c}let a=new dt(o.url,s);return o===t&&(n=a),a}let r=e(t.root),i=WM(r);return n??i}function YM(t,n,e,r,i){let o=t;for(;o.parent;)o=o.parent;if(n.length===0)return Hw(o,o,o,e,r,i);let s=ZU(n);if(s.toRoot())return Hw(o,o,new dt([],{}),e,r,i);let a=XU(s,o,t),l=a.processChildren?Id(a.segmentGroup,a.index,s.commands):XM(a.segmentGroup,a.index,s.commands);return Hw(o,a.segmentGroup,l,e,r,i)}function jm(t){return typeof t=="object"&&t!=null&&!t.outlets&&!t.segmentPath}function kd(t){return typeof t=="object"&&t!=null&&t.outlets}function AM(t,n,e){t||="\u0275";let r=new wi;return r.queryParams={[t]:n},e.parse(e.serialize(r)).queryParams[t]}function Hw(t,n,e,r,i,o){let s={};for(let[c,u]of Object.entries(r??{}))s[c]=Array.isArray(u)?u.map(d=>AM(c,d,o)):AM(c,u,o);let a;t===n?a=e:a=ZM(t,n,e);let l=WM(GM(a));return new wi(l,s,i)}function ZM(t,n,e){let r={};return Object.entries(t.children).forEach(([i,o])=>{o===n?r[i]=e:r[i]=ZM(o,n,e)}),new dt(t.segments,r)}var Bm=class{isAbsolute;numberOfDoubleDots;commands;constructor(n,e,r){if(this.isAbsolute=n,this.numberOfDoubleDots=e,this.commands=r,n&&r.length>0&&jm(r[0]))throw new z(4003,!1);let i=r.find(kd);if(i&&i!==jM(r))throw new z(4004,!1)}toRoot(){return this.isAbsolute&&this.commands.length===1&&this.commands[0]=="/"}};function ZU(t){if(typeof t[0]=="string"&&t.length===1&&t[0]==="/")return new Bm(!0,0,t);let n=0,e=!1,r=t.reduce((i,o,s)=>{if(typeof o=="object"&&o!=null){if(o.outlets){let a={};return Object.entries(o.outlets).forEach(([l,c])=>{a[l]=typeof c=="string"?c.split("/"):c}),[...i,{outlets:a}]}if(o.segmentPath)return[...i,o.segmentPath]}return typeof o!="string"?[...i,o]:s===0?(o.split("/").forEach((a,l)=>{l==0&&a==="."||(l==0&&a===""?e=!0:a===".."?n++:a!=""&&i.push(a))}),i):[...i,o]},[]);return new Bm(e,n,r)}var sc=class{segmentGroup;processChildren;index;constructor(n,e,r){this.segmentGroup=n,this.processChildren=e,this.index=r}};function XU(t,n,e){if(t.isAbsolute)return new sc(n,!0,0);if(!e)return new sc(n,!1,NaN);if(e.parent===null)return new sc(e,!0,0);let r=jm(t.commands[0])?0:1,i=e.segments.length-1+r;return QU(e,i,t.numberOfDoubleDots)}function QU(t,n,e){let r=t,i=n,o=e;for(;o>i;){if(o-=i,r=r.parent,!r)throw new z(4005,!1);i=r.segments.length}return new sc(r,!1,i-o)}function e4(t){return kd(t[0])?t[0].outlets:{[je]:t}}function XM(t,n,e){if(t??=new dt([],{}),t.segments.length===0&&t.hasChildren())return Id(t,n,e);let r=t4(t,n,e),i=e.slice(r.commandIndex);if(r.match&&r.pathIndex<t.segments.length){let o=new dt(t.segments.slice(0,r.pathIndex),{});return o.children[je]=new dt(t.segments.slice(r.pathIndex),t.children),Id(o,0,i)}else return r.match&&i.length===0?new dt(t.segments,{}):r.match&&!t.hasChildren()?Jw(t,n,e):r.match?Id(t,0,i):Jw(t,n,e)}function Id(t,n,e){if(e.length===0)return new dt(t.segments,{});{let r=e4(e),i={};if(Object.keys(r).some(o=>o!==je)&&t.children[je]&&t.numberOfChildren===1&&t.children[je].segments.length===0){let o=Id(t.children[je],n,e);return new dt(t.segments,o.children)}return Object.entries(r).forEach(([o,s])=>{typeof s=="string"&&(s=[s]),s!==null&&(i[o]=XM(t.children[o],n,s))}),Object.entries(t.children).forEach(([o,s])=>{r[o]===void 0&&(i[o]=s)}),new dt(t.segments,i)}}function t4(t,n,e){let r=0,i=n,o={match:!1,pathIndex:0,commandIndex:0};for(;i<t.segments.length;){if(r>=e.length)return o;let s=t.segments[i],a=e[r];if(kd(a))break;let l=`${a}`,c=r<e.length-1?e[r+1]:null;if(i>0&&l===void 0)break;if(l&&c&&typeof c=="object"&&c.outlets===void 0){if(!RM(l,c,s))return o;r+=2}else{if(!RM(l,{},s))return o;r++}i++}return{match:!0,pathIndex:i,commandIndex:r}}function Jw(t,n,e){let r=t.segments.slice(0,n),i=0;for(;i<e.length;){let o=e[i];if(kd(o)){let l=n4(o.outlets);return new dt(r,l)}if(i===0&&jm(e[0])){let l=t.segments[n];r.push(new ts(l.path,xM(e[0]))),i++;continue}let s=kd(o)?o.outlets[je]:`${o}`,a=i<e.length-1?e[i+1]:null;s&&a&&jm(a)?(r.push(new ts(s,xM(a))),i+=2):(r.push(new ts(s,{})),i++)}return new dt(r,{})}function n4(t){let n={};return Object.entries(t).forEach(([e,r])=>{typeof r=="string"&&(r=[r]),r!==null&&(n[e]=Jw(new dt([],{}),0,r))}),n}function xM(t){let n={};return Object.entries(t).forEach(([e,r])=>n[e]=`${r}`),n}function RM(t,n,e){return t==e.path&&Hi(n,e.parameters)}var ac="imperative",_n=(function(t){return t[t.NavigationStart=0]="NavigationStart",t[t.NavigationEnd=1]="NavigationEnd",t[t.NavigationCancel=2]="NavigationCancel",t[t.NavigationError=3]="NavigationError",t[t.RoutesRecognized=4]="RoutesRecognized",t[t.ResolveStart=5]="ResolveStart",t[t.ResolveEnd=6]="ResolveEnd",t[t.GuardsCheckStart=7]="GuardsCheckStart",t[t.GuardsCheckEnd=8]="GuardsCheckEnd",t[t.RouteConfigLoadStart=9]="RouteConfigLoadStart",t[t.RouteConfigLoadEnd=10]="RouteConfigLoadEnd",t[t.ChildActivationStart=11]="ChildActivationStart",t[t.ChildActivationEnd=12]="ChildActivationEnd",t[t.ActivationStart=13]="ActivationStart",t[t.ActivationEnd=14]="ActivationEnd",t[t.Scroll=15]="Scroll",t[t.NavigationSkipped=16]="NavigationSkipped",t})(_n||{}),Ir=class{id;url;constructor(n,e){this.id=n,this.url=e}},rs=class extends Ir{type=_n.NavigationStart;navigationTrigger;restoredState;constructor(n,e,r="imperative",i=null){super(n,e),this.navigationTrigger=r,this.restoredState=i}toString(){return`NavigationStart(id: ${this.id}, url: '${this.url}')`}},Tr=class extends Ir{urlAfterRedirects;type=_n.NavigationEnd;constructor(n,e,r){super(n,e),this.urlAfterRedirects=r}toString(){return`NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`}},Qn=(function(t){return t[t.Redirect=0]="Redirect",t[t.SupersededByNewNavigation=1]="SupersededByNewNavigation",t[t.NoDataFromResolver=2]="NoDataFromResolver",t[t.GuardRejected=3]="GuardRejected",t[t.Aborted=4]="Aborted",t})(Qn||{}),cc=(function(t){return t[t.IgnoredSameUrlNavigation=0]="IgnoredSameUrlNavigation",t[t.IgnoredByUrlHandlingStrategy=1]="IgnoredByUrlHandlingStrategy",t})(cc||{}),$i=class extends Ir{reason;code;type=_n.NavigationCancel;constructor(n,e,r,i){super(n,e),this.reason=r,this.code=i}toString(){return`NavigationCancel(id: ${this.id}, url: '${this.url}')`}},zi=class extends Ir{reason;code;type=_n.NavigationSkipped;constructor(n,e,r,i){super(n,e),this.reason=r,this.code=i}},uc=class extends Ir{error;target;type=_n.NavigationError;constructor(n,e,r,i){super(n,e),this.error=r,this.target=i}toString(){return`NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`}},Md=class extends Ir{urlAfterRedirects;state;type=_n.RoutesRecognized;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i}toString(){return`RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},Vm=class extends Ir{urlAfterRedirects;state;type=_n.GuardsCheckStart;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i}toString(){return`GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},Um=class extends Ir{urlAfterRedirects;state;shouldActivate;type=_n.GuardsCheckEnd;constructor(n,e,r,i,o){super(n,e),this.urlAfterRedirects=r,this.state=i,this.shouldActivate=o}toString(){return`GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`}},Hm=class extends Ir{urlAfterRedirects;state;type=_n.ResolveStart;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i}toString(){return`ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},$m=class extends Ir{urlAfterRedirects;state;type=_n.ResolveEnd;constructor(n,e,r,i){super(n,e),this.urlAfterRedirects=r,this.state=i}toString(){return`ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},zm=class{route;type=_n.RouteConfigLoadStart;constructor(n){this.route=n}toString(){return`RouteConfigLoadStart(path: ${this.route.path})`}},qm=class{route;type=_n.RouteConfigLoadEnd;constructor(n){this.route=n}toString(){return`RouteConfigLoadEnd(path: ${this.route.path})`}},Wm=class{snapshot;type=_n.ChildActivationStart;constructor(n){this.snapshot=n}toString(){return`ChildActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Gm=class{snapshot;type=_n.ChildActivationEnd;constructor(n){this.snapshot=n}toString(){return`ChildActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Km=class{snapshot;type=_n.ActivationStart;constructor(n){this.snapshot=n}toString(){return`ActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Jm=class{snapshot;type=_n.ActivationEnd;constructor(n){this.snapshot=n}toString(){return`ActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},dc=class{routerEvent;position;anchor;type=_n.Scroll;constructor(n,e,r){this.routerEvent=n,this.position=e,this.anchor=r}toString(){let n=this.position?`${this.position[0]}, ${this.position[1]}`:null;return`Scroll(anchor: '${this.anchor}', position: '${n}')`}},Ad=class{},hc=class{url;navigationBehaviorOptions;constructor(n,e){this.url=n,this.navigationBehaviorOptions=e}};function r4(t){return!(t instanceof Ad)&&!(t instanceof hc)}function i4(t,n){return t.providers&&!t._injector&&(t._injector=Gl(t.providers,n,`Route: ${t.path}`)),t._injector??n}function bi(t){return t.outlet||je}function o4(t,n){let e=t.filter(r=>bi(r)===n);return e.push(...t.filter(r=>bi(r)!==n)),e}function mc(t){if(!t)return null;if(t.routeConfig?._injector)return t.routeConfig._injector;for(let n=t.parent;n;n=n.parent){let e=n.routeConfig;if(e?._loadedInjector)return e._loadedInjector;if(e?._injector)return e._injector}return null}var Ym=class{rootInjector;outlet=null;route=null;children;attachRef=null;get injector(){return mc(this.route?.snapshot)??this.rootInjector}constructor(n){this.rootInjector=n,this.children=new Sa(this.rootInjector)}},Sa=(()=>{class t{rootInjector;contexts=new Map;constructor(e){this.rootInjector=e}onChildOutletCreated(e,r){let i=this.getOrCreateContext(e);i.outlet=r,this.contexts.set(e,i)}onChildOutletDestroyed(e){let r=this.getContext(e);r&&(r.outlet=null,r.attachRef=null)}onOutletDeactivated(){let e=this.contexts;return this.contexts=new Map,e}onOutletReAttached(e){this.contexts=e}getOrCreateContext(e){let r=this.getContext(e);return r||(r=new Ym(this.rootInjector),this.contexts.set(e,r)),r}getContext(e){return this.contexts.get(e)||null}static \u0275fac=function(r){return new(r||t)(Q(kt))};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Zm=class{_root;constructor(n){this._root=n}get root(){return this._root.value}parent(n){let e=this.pathFromRoot(n);return e.length>1?e[e.length-2]:null}children(n){let e=Yw(n,this._root);return e?e.children.map(r=>r.value):[]}firstChild(n){let e=Yw(n,this._root);return e&&e.children.length>0?e.children[0].value:null}siblings(n){let e=Zw(n,this._root);return e.length<2?[]:e[e.length-2].children.map(i=>i.value).filter(i=>i!==n)}pathFromRoot(n){return Zw(n,this._root).map(e=>e.value)}};function Yw(t,n){if(t===n.value)return n;for(let e of n.children){let r=Yw(t,e);if(r)return r}return null}function Zw(t,n){if(t===n.value)return[n];for(let e of n.children){let r=Zw(t,e);if(r.length)return r.unshift(n),r}return[]}var Dr=class{value;children;constructor(n,e){this.value=n,this.children=e}toString(){return`TreeNode(${this.value})`}};function oc(t){let n={};return t&&t.children.forEach(e=>n[e.value.outlet]=e),n}var xd=class extends Zm{snapshot;constructor(n,e){super(n),this.snapshot=e,rE(this,n)}toString(){return this.snapshot.toString()}};function QM(t){let n=s4(t),e=new Rt([new ts("",{})]),r=new Rt({}),i=new Rt({}),o=new Rt({}),s=new Rt(""),a=new $r(e,r,o,s,i,je,t,n.root);return a.snapshot=n.root,new xd(new Dr(a,[]),n)}function s4(t){let n={},e={},r={},o=new ba([],n,r,"",e,je,t,null,{});return new Rd("",new Dr(o,[]))}var $r=class{urlSubject;paramsSubject;queryParamsSubject;fragmentSubject;dataSubject;outlet;component;snapshot;_futureSnapshot;_routerState;_paramMap;_queryParamMap;title;url;params;queryParams;fragment;data;constructor(n,e,r,i,o,s,a,l){this.urlSubject=n,this.paramsSubject=e,this.queryParamsSubject=r,this.fragmentSubject=i,this.dataSubject=o,this.outlet=s,this.component=a,this._futureSnapshot=l,this.title=this.dataSubject?.pipe(te(c=>c[Nd]))??fe(void 0),this.url=n,this.params=e,this.queryParams=r,this.fragment=i,this.data=o}get routeConfig(){return this._futureSnapshot.routeConfig}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=this.params.pipe(te(n=>wa(n))),this._paramMap}get queryParamMap(){return this._queryParamMap??=this.queryParams.pipe(te(n=>wa(n))),this._queryParamMap}toString(){return this.snapshot?this.snapshot.toString():`Future(${this._futureSnapshot})`}};function Xm(t,n,e="emptyOnly"){let r,{routeConfig:i}=t;return n!==null&&(e==="always"||i?.path===""||!n.component&&!n.routeConfig?.loadComponent)?r={params:A(A({},n.params),t.params),data:A(A({},n.data),t.data),resolve:A(A(A(A({},t.data),n.data),i?.data),t._resolvedData)}:r={params:A({},t.params),data:A({},t.data),resolve:A(A({},t.data),t._resolvedData??{})},i&&tA(i)&&(r.resolve[Nd]=i.title),r}var ba=class{url;params;queryParams;fragment;data;outlet;component;routeConfig;_resolve;_resolvedData;_routerState;_paramMap;_queryParamMap;get title(){return this.data?.[Nd]}constructor(n,e,r,i,o,s,a,l,c){this.url=n,this.params=e,this.queryParams=r,this.fragment=i,this.data=o,this.outlet=s,this.component=a,this.routeConfig=l,this._resolve=c}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=wa(this.params),this._paramMap}get queryParamMap(){return this._queryParamMap??=wa(this.queryParams),this._queryParamMap}toString(){let n=this.url.map(r=>r.toString()).join("/"),e=this.routeConfig?this.routeConfig.path:"";return`Route(url:'${n}', path:'${e}')`}},Rd=class extends Zm{url;constructor(n,e){super(e),this.url=n,rE(this,e)}toString(){return eA(this._root)}};function rE(t,n){n.value._routerState=t,n.children.forEach(e=>rE(t,e))}function eA(t){let n=t.children.length>0?` { ${t.children.map(eA).join(", ")} } `:"";return`${t.value}${n}`}function $w(t){if(t.snapshot){let n=t.snapshot,e=t._futureSnapshot;t.snapshot=e,Hi(n.queryParams,e.queryParams)||t.queryParamsSubject.next(e.queryParams),n.fragment!==e.fragment&&t.fragmentSubject.next(e.fragment),Hi(n.params,e.params)||t.paramsSubject.next(e.params),OU(n.url,e.url)||t.urlSubject.next(e.url),Hi(n.data,e.data)||t.dataSubject.next(e.data)}else t.snapshot=t._futureSnapshot,t.dataSubject.next(t._futureSnapshot.data)}function Xw(t,n){let e=Hi(t.params,n.params)&&LU(t.url,n.url),r=!t.parent!=!n.parent;return e&&!r&&(!t.parent||Xw(t.parent,n.parent))}function tA(t){return typeof t.title=="string"||t.title===null}var nA=new P(""),Da=(()=>{class t{activated=null;get activatedComponentRef(){return this.activated}_activatedRoute=null;name=je;activateEvents=new tt;deactivateEvents=new tt;attachEvents=new tt;detachEvents=new tt;routerOutletData=Le(void 0,{});parentContexts=y(Sa);location=y(Hn);changeDetector=y(zn);inputBinder=y(Pd,{optional:!0});supportsBindingToComponentInputs=!0;ngOnChanges(e){if(e.name){let{firstChange:r,previousValue:i}=e.name;if(r)return;this.isTrackedInParentContexts(i)&&(this.deactivate(),this.parentContexts.onChildOutletDestroyed(i)),this.initializeOutletWithName()}}ngOnDestroy(){this.isTrackedInParentContexts(this.name)&&this.parentContexts.onChildOutletDestroyed(this.name),this.inputBinder?.unsubscribeFromRouteData(this)}isTrackedInParentContexts(e){return this.parentContexts.getContext(e)?.outlet===this}ngOnInit(){this.initializeOutletWithName()}initializeOutletWithName(){if(this.parentContexts.onChildOutletCreated(this.name,this),this.activated)return;let e=this.parentContexts.getContext(this.name);e?.route&&(e.attachRef?this.attach(e.attachRef,e.route):this.activateWith(e.route,e.injector))}get isActivated(){return!!this.activated}get component(){if(!this.activated)throw new z(4012,!1);return this.activated.instance}get activatedRoute(){if(!this.activated)throw new z(4012,!1);return this._activatedRoute}get activatedRouteData(){return this._activatedRoute?this._activatedRoute.snapshot.data:{}}detach(){if(!this.activated)throw new z(4012,!1);this.location.detach();let e=this.activated;return this.activated=null,this._activatedRoute=null,this.detachEvents.emit(e.instance),e}attach(e,r){this.activated=e,this._activatedRoute=r,this.location.insert(e.hostView),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.attachEvents.emit(e.instance)}deactivate(){if(this.activated){let e=this.component;this.activated.destroy(),this.activated=null,this._activatedRoute=null,this.deactivateEvents.emit(e)}}activateWith(e,r){if(this.isActivated)throw new z(4013,!1);this._activatedRoute=e;let i=this.location,s=e.snapshot.component,a=this.parentContexts.getOrCreateContext(this.name).children,l=new Qw(e,a,i.injector,this.routerOutletData);this.activated=i.createComponent(s,{index:i.length,injector:l,environmentInjector:r}),this.changeDetector.markForCheck(),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.activateEvents.emit(this.activated.instance)}static \u0275fac=function(r){return new(r||t)};static \u0275dir=Oe({type:t,selectors:[["router-outlet"]],inputs:{name:"name",routerOutletData:[1,"routerOutletData"]},outputs:{activateEvents:"activate",deactivateEvents:"deactivate",attachEvents:"attach",detachEvents:"detach"},exportAs:["outlet"],features:[xn]})}return t})(),Qw=class{route;childContexts;parent;outletData;constructor(n,e,r,i){this.route=n,this.childContexts=e,this.parent=r,this.outletData=i}get(n,e){return n===$r?this.route:n===Sa?this.childContexts:n===nA?this.outletData:this.parent.get(n,e)}},Pd=new P(""),iE=(()=>{class t{outletDataSubscriptions=new Map;bindActivatedRouteToOutletComponent(e){this.unsubscribeFromRouteData(e),this.subscribeToRouteData(e)}unsubscribeFromRouteData(e){this.outletDataSubscriptions.get(e)?.unsubscribe(),this.outletDataSubscriptions.delete(e)}subscribeToRouteData(e){let{activatedRoute:r}=e,i=Cl([r.queryParams,r.params,r.data]).pipe(Tt(([o,s,a],l)=>(a=A(A(A({},o),s),a),l===0?fe(a):Promise.resolve(a)))).subscribe(o=>{if(!e.isActivated||!e.activatedComponentRef||e.activatedRoute!==r||r.component===null){this.unsubscribeFromRouteData(e);return}let s=Xk(r.component);if(!s){this.unsubscribeFromRouteData(e);return}for(let{templateName:a}of s.inputs)e.activatedComponentRef.setInput(a,o[a])});this.outletDataSubscriptions.set(e,i)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})(),oE=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275cmp=ae({type:t,selectors:[["ng-component"]],exportAs:["emptyRouterOutlet"],decls:1,vars:0,template:function(r,i){r&1&&Ce(0,"router-outlet")},dependencies:[Da],encapsulation:2})}return t})();function sE(t){let n=t.children&&t.children.map(sE),e=n?Z(A({},t),{children:n}):A({},t);return!e.component&&!e.loadComponent&&(n||e.loadChildren)&&e.outlet&&e.outlet!==je&&(e.component=oE),e}function a4(t,n,e){let r=Od(t,n._root,e?e._root:void 0);return new xd(r,n)}function Od(t,n,e){if(e&&t.shouldReuseRoute(n.value,e.value.snapshot)){let r=e.value;r._futureSnapshot=n.value;let i=l4(t,n,e);return new Dr(r,i)}else{if(t.shouldAttach(n.value)){let o=t.retrieve(n.value);if(o!==null){let s=o.route;return s.value._futureSnapshot=n.value,s.children=n.children.map(a=>Od(t,a)),s}}let r=c4(n.value),i=n.children.map(o=>Od(t,o));return new Dr(r,i)}}function l4(t,n,e){return n.children.map(r=>{for(let i of e.children)if(t.shouldReuseRoute(r.value,i.value.snapshot))return Od(t,r,i);return Od(t,r)})}function c4(t){return new $r(new Rt(t.url),new Rt(t.params),new Rt(t.queryParams),new Rt(t.fragment),new Rt(t.data),t.outlet,t.component,t)}var fc=class{redirectTo;navigationBehaviorOptions;constructor(n,e){this.redirectTo=n,this.navigationBehaviorOptions=e}},rA="ngNavigationCancelingError";function Qm(t,n){let{redirectTo:e,navigationBehaviorOptions:r}=ns(n)?{redirectTo:n,navigationBehaviorOptions:void 0}:n,i=iA(!1,Qn.Redirect);return i.url=e,i.navigationBehaviorOptions=r,i}function iA(t,n){let e=new Error(`NavigationCancelingError: ${t||""}`);return e[rA]=!0,e.cancellationCode=n,e}function u4(t){return oA(t)&&ns(t.url)}function oA(t){return!!t&&t[rA]}var d4=(t,n,e,r)=>te(i=>(new eE(n,i.targetRouterState,i.currentRouterState,e,r).activate(t),i)),eE=class{routeReuseStrategy;futureState;currState;forwardEvent;inputBindingEnabled;constructor(n,e,r,i,o){this.routeReuseStrategy=n,this.futureState=e,this.currState=r,this.forwardEvent=i,this.inputBindingEnabled=o}activate(n){let e=this.futureState._root,r=this.currState?this.currState._root:null;this.deactivateChildRoutes(e,r,n),$w(this.futureState.root),this.activateChildRoutes(e,r,n)}deactivateChildRoutes(n,e,r){let i=oc(e);n.children.forEach(o=>{let s=o.value.outlet;this.deactivateRoutes(o,i[s],r),delete i[s]}),Object.values(i).forEach(o=>{this.deactivateRouteAndItsChildren(o,r)})}deactivateRoutes(n,e,r){let i=n.value,o=e?e.value:null;if(i===o)if(i.component){let s=r.getContext(i.outlet);s&&this.deactivateChildRoutes(n,e,s.children)}else this.deactivateChildRoutes(n,e,r);else o&&this.deactivateRouteAndItsChildren(e,r)}deactivateRouteAndItsChildren(n,e){n.value.component&&this.routeReuseStrategy.shouldDetach(n.value.snapshot)?this.detachAndStoreRouteSubtree(n,e):this.deactivateRouteAndOutlet(n,e)}detachAndStoreRouteSubtree(n,e){let r=e.getContext(n.value.outlet),i=r&&n.value.component?r.children:e,o=oc(n);for(let s of Object.values(o))this.deactivateRouteAndItsChildren(s,i);if(r&&r.outlet){let s=r.outlet.detach(),a=r.children.onOutletDeactivated();this.routeReuseStrategy.store(n.value.snapshot,{componentRef:s,route:n,contexts:a})}}deactivateRouteAndOutlet(n,e){let r=e.getContext(n.value.outlet),i=r&&n.value.component?r.children:e,o=oc(n);for(let s of Object.values(o))this.deactivateRouteAndItsChildren(s,i);r&&(r.outlet&&(r.outlet.deactivate(),r.children.onOutletDeactivated()),r.attachRef=null,r.route=null)}activateChildRoutes(n,e,r){let i=oc(e);n.children.forEach(o=>{this.activateRoutes(o,i[o.value.outlet],r),this.forwardEvent(new Jm(o.value.snapshot))}),n.children.length&&this.forwardEvent(new Gm(n.value.snapshot))}activateRoutes(n,e,r){let i=n.value,o=e?e.value:null;if($w(i),i===o)if(i.component){let s=r.getOrCreateContext(i.outlet);this.activateChildRoutes(n,e,s.children)}else this.activateChildRoutes(n,e,r);else if(i.component){let s=r.getOrCreateContext(i.outlet);if(this.routeReuseStrategy.shouldAttach(i.snapshot)){let a=this.routeReuseStrategy.retrieve(i.snapshot);this.routeReuseStrategy.store(i.snapshot,null),s.children.onOutletReAttached(a.contexts),s.attachRef=a.componentRef,s.route=a.route.value,s.outlet&&s.outlet.attach(a.componentRef,a.route.value),$w(a.route.value),this.activateChildRoutes(n,null,s.children)}else s.attachRef=null,s.route=i,s.outlet&&s.outlet.activateWith(i,s.injector),this.activateChildRoutes(n,null,s.children)}else this.activateChildRoutes(n,null,r)}},eg=class{path;route;constructor(n){this.path=n,this.route=this.path[this.path.length-1]}},lc=class{component;route;constructor(n,e){this.component=n,this.route=e}};function h4(t,n,e){let r=t._root,i=n?n._root:null;return Dd(r,i,e,[r.value])}function f4(t){let n=t.routeConfig?t.routeConfig.canActivateChild:null;return!n||n.length===0?null:{node:t,guards:n}}function gc(t,n){let e=Symbol(),r=n.get(t,e);return r===e?typeof t=="function"&&!U_(t)?t:n.get(t):r}function Dd(t,n,e,r,i={canDeactivateChecks:[],canActivateChecks:[]}){let o=oc(n);return t.children.forEach(s=>{p4(s,o[s.value.outlet],e,r.concat([s.value]),i),delete o[s.value.outlet]}),Object.entries(o).forEach(([s,a])=>Td(a,e.getContext(s),i)),i}function p4(t,n,e,r,i={canDeactivateChecks:[],canActivateChecks:[]}){let o=t.value,s=n?n.value:null,a=e?e.getContext(t.value.outlet):null;if(s&&o.routeConfig===s.routeConfig){let l=m4(s,o,o.routeConfig.runGuardsAndResolvers);l?i.canActivateChecks.push(new eg(r)):(o.data=s.data,o._resolvedData=s._resolvedData),o.component?Dd(t,n,a?a.children:null,r,i):Dd(t,n,e,r,i),l&&a&&a.outlet&&a.outlet.isActivated&&i.canDeactivateChecks.push(new lc(a.outlet.component,s))}else s&&Td(n,a,i),i.canActivateChecks.push(new eg(r)),o.component?Dd(t,null,a?a.children:null,r,i):Dd(t,null,e,r,i);return i}function m4(t,n,e){if(typeof e=="function")return e(t,n);switch(e){case"pathParamsChange":return!_a(t.url,n.url);case"pathParamsOrQueryParamsChange":return!_a(t.url,n.url)||!Hi(t.queryParams,n.queryParams);case"always":return!0;case"paramsOrQueryParamsChange":return!Xw(t,n)||!Hi(t.queryParams,n.queryParams);case"paramsChange":default:return!Xw(t,n)}}function Td(t,n,e){let r=oc(t),i=t.value;Object.entries(r).forEach(([o,s])=>{i.component?n?Td(s,n.children.getContext(o),e):Td(s,null,e):Td(s,n,e)}),i.component?n&&n.outlet&&n.outlet.isActivated?e.canDeactivateChecks.push(new lc(n.outlet.component,i)):e.canDeactivateChecks.push(new lc(null,i)):e.canDeactivateChecks.push(new lc(null,i))}function Fd(t){return typeof t=="function"}function g4(t){return typeof t=="boolean"}function v4(t){return t&&Fd(t.canLoad)}function y4(t){return t&&Fd(t.canActivate)}function _4(t){return t&&Fd(t.canActivateChild)}function b4(t){return t&&Fd(t.canDeactivate)}function w4(t){return t&&Fd(t.canMatch)}function sA(t){return t instanceof Vs||t?.name==="EmptyError"}var Om=Symbol("INITIAL_VALUE");function pc(){return Tt(t=>Cl(t.map(n=>n.pipe(It(1),Po(Om)))).pipe(te(n=>{for(let e of n)if(e!==!0){if(e===Om)return Om;if(e===!1||E4(e))return e}return!0}),_t(n=>n!==Om),It(1)))}function E4(t){return ns(t)||t instanceof fc}function aA(t){return t.aborted?fe(void 0).pipe(It(1)):new Ie(n=>{let e=()=>{n.next(),n.complete()};return t.addEventListener("abort",e),()=>t.removeEventListener("abort",e)})}function lA(t){return xr(aA(t))}function C4(t,n){return An(e=>{let{targetSnapshot:r,currentSnapshot:i,guards:{canActivateChecks:o,canDeactivateChecks:s}}=e;return s.length===0&&o.length===0?fe(Z(A({},e),{guardsResult:!0})):S4(s,r,i,t).pipe(An(a=>a&&g4(a)?D4(r,o,t,n):fe(a)),te(a=>Z(A({},e),{guardsResult:a})))})}function S4(t,n,e,r){return Xe(t).pipe(An(i=>A4(i.component,i.route,e,n,r)),ao(i=>i!==!0,!0))}function D4(t,n,e,r){return Xe(n).pipe(Ii(i=>ii(T4(i.route.parent,r),I4(i.route,r),M4(t,i.path,e),k4(t,i.route,e))),ao(i=>i!==!0,!0))}function I4(t,n){return t!==null&&n&&n(new Km(t)),fe(!0)}function T4(t,n){return t!==null&&n&&n(new Wm(t)),fe(!0)}function k4(t,n,e){let r=n.routeConfig?n.routeConfig.canActivate:null;if(!r||r.length===0)return fe(!0);let i=r.map(o=>Di(()=>{let s=mc(n)??e,a=gc(o,s),l=y4(a)?a.canActivate(n,t):Dn(s,()=>a(n,t));return Ea(l).pipe(ao())}));return fe(i).pipe(pc())}function M4(t,n,e){let r=n[n.length-1],o=n.slice(0,n.length-1).reverse().map(s=>f4(s)).filter(s=>s!==null).map(s=>Di(()=>{let a=s.guards.map(l=>{let c=mc(s.node)??e,u=gc(l,c),d=_4(u)?u.canActivateChild(r,t):Dn(c,()=>u(r,t));return Ea(d).pipe(ao())});return fe(a).pipe(pc())}));return fe(o).pipe(pc())}function A4(t,n,e,r,i){let o=n&&n.routeConfig?n.routeConfig.canDeactivate:null;if(!o||o.length===0)return fe(!0);let s=o.map(a=>{let l=mc(n)??i,c=gc(a,l),u=b4(c)?c.canDeactivate(t,n,e,r):Dn(l,()=>c(t,n,e,r));return Ea(u).pipe(ao())});return fe(s).pipe(pc())}function x4(t,n,e,r,i){let o=n.canLoad;if(o===void 0||o.length===0)return fe(!0);let s=o.map(a=>{let l=gc(a,t),c=v4(l)?l.canLoad(n,e):Dn(t,()=>l(n,e)),u=Ea(c);return i?u.pipe(lA(i)):u});return fe(s).pipe(pc(),cA(r))}function cA(t){return pu(Kt(n=>{if(typeof n!="boolean")throw Qm(t,n)}),te(n=>n===!0))}function R4(t,n,e,r,i){let o=n.canMatch;if(!o||o.length===0)return fe(!0);let s=o.map(a=>{let l=gc(a,t),c=w4(l)?l.canMatch(n,e):Dn(t,()=>l(n,e)),u=Ea(c);return i?u.pipe(lA(i)):u});return fe(s).pipe(pc(),cA(r))}var ya=class uA extends Error{segmentGroup;constructor(n){super(),this.segmentGroup=n||null,Object.setPrototypeOf(this,uA.prototype)}},tE=class dA extends Error{urlTree;constructor(n){super(),this.urlTree=n,Object.setPrototypeOf(this,dA.prototype)}};function O4(t){throw new z(4e3,!1)}function N4(t){throw iA(!1,Qn.GuardRejected)}var P4=class{urlSerializer;urlTree;constructor(n,e){this.urlSerializer=n,this.urlTree=e}async lineralizeSegments(n,e){let r=[],i=e.root;for(;;){if(r=r.concat(i.segments),i.numberOfChildren===0)return r;if(i.numberOfChildren>1||!i.children[je])throw O4(`${n.redirectTo}`);i=i.children[je]}}async applyRedirectCommands(n,e,r,i,o){let s=await F4(e,i,o);if(s instanceof wi)throw new tE(s);let a=this.applyRedirectCreateUrlTree(s,this.urlSerializer.parse(s),n,r);if(s[0]==="/")throw new tE(a);return a}applyRedirectCreateUrlTree(n,e,r,i){let o=this.createSegmentGroup(n,e.root,r,i);return new wi(o,this.createQueryParams(e.queryParams,this.urlTree.queryParams),e.fragment)}createQueryParams(n,e){let r={};return Object.entries(n).forEach(([i,o])=>{if(typeof o=="string"&&o[0]===":"){let a=o.substring(1);r[i]=e[a]}else r[i]=o}),r}createSegmentGroup(n,e,r,i){let o=this.createSegments(n,e.segments,r,i),s={};return Object.entries(e.children).forEach(([a,l])=>{s[a]=this.createSegmentGroup(n,l,r,i)}),new dt(o,s)}createSegments(n,e,r,i){return e.map(o=>o.path[0]===":"?this.findPosParam(n,o,i):this.findOrReturn(o,r))}findPosParam(n,e,r){let i=r[e.path.substring(1)];if(!i)throw new z(4001,!1);return i}findOrReturn(n,e){let r=0;for(let i of e){if(i.path===n.path)return e.splice(r),i;r++}return n}};function F4(t,n,e){if(typeof t=="string")return Promise.resolve(t);let r=t,{queryParams:i,fragment:o,routeConfig:s,url:a,outlet:l,params:c,data:u,title:d}=n;return Lm(Ea(Dn(e,()=>r({params:c,data:u,queryParams:i,fragment:o,routeConfig:s,url:a,outlet:l,title:d}))))}var nE={matched:!1,consumedSegments:[],remainingSegments:[],parameters:{},positionalParamSegments:{}};function L4(t,n,e,r,i,o){let s=hA(t,n,e);return s.matched?(r=i4(n,r),R4(r,n,e,i,o).pipe(te(a=>a===!0?s:A({},nE)))):fe(s)}function hA(t,n,e){if(n.path==="**")return j4(e);if(n.path==="")return n.pathMatch==="full"&&(t.hasChildren()||e.length>0)?A({},nE):{matched:!0,consumedSegments:[],remainingSegments:e,parameters:{},positionalParamSegments:{}};let i=(n.matcher||FM)(e,t,n);if(!i)return A({},nE);let o={};Object.entries(i.posParams??{}).forEach(([a,l])=>{o[a]=l.path});let s=i.consumed.length>0?A(A({},o),i.consumed[i.consumed.length-1].parameters):o;return{matched:!0,consumedSegments:i.consumed,remainingSegments:e.slice(i.consumed.length),parameters:s,positionalParamSegments:i.posParams??{}}}function j4(t){return{matched:!0,parameters:t.length>0?jM(t).parameters:{},consumedSegments:t,remainingSegments:[],positionalParamSegments:{}}}function OM(t,n,e,r){return e.length>0&&U4(t,e,r)?{segmentGroup:new dt(n,V4(r,new dt(e,t.children))),slicedSegments:[]}:e.length===0&&H4(t,e,r)?{segmentGroup:new dt(t.segments,B4(t,e,r,t.children)),slicedSegments:e}:{segmentGroup:new dt(t.segments,t.children),slicedSegments:e}}function B4(t,n,e,r){let i={};for(let o of e)if(ng(t,n,o)&&!r[bi(o)]){let s=new dt([],{});i[bi(o)]=s}return A(A({},r),i)}function V4(t,n){let e={};e[je]=n;for(let r of t)if(r.path===""&&bi(r)!==je){let i=new dt([],{});e[bi(r)]=i}return e}function U4(t,n,e){return e.some(r=>ng(t,n,r)&&bi(r)!==je)}function H4(t,n,e){return e.some(r=>ng(t,n,r))}function ng(t,n,e){return(t.hasChildren()||n.length>0)&&e.pathMatch==="full"?!1:e.path===""}function $4(t,n,e){return n.length===0&&!t.children[e]}var z4=class{};async function q4(t,n,e,r,i,o,s="emptyOnly",a){return new G4(t,n,e,r,i,s,o,a).recognize()}var W4=31,G4=class{injector;configLoader;rootComponentType;config;urlTree;paramsInheritanceStrategy;urlSerializer;abortSignal;applyRedirects;absoluteRedirectCount=0;allowRedirects=!0;constructor(n,e,r,i,o,s,a,l){this.injector=n,this.configLoader=e,this.rootComponentType=r,this.config=i,this.urlTree=o,this.paramsInheritanceStrategy=s,this.urlSerializer=a,this.abortSignal=l,this.applyRedirects=new P4(this.urlSerializer,this.urlTree)}noMatchError(n){return new z(4002,`'${n.segmentGroup}'`)}async recognize(){let n=OM(this.urlTree.root,[],[],this.config).segmentGroup,{children:e,rootSnapshot:r}=await this.match(n),i=new Dr(r,e),o=new Rd("",i),s=KM(r,[],this.urlTree.queryParams,this.urlTree.fragment);return s.queryParams=this.urlTree.queryParams,o.url=this.urlSerializer.serialize(s),{state:o,tree:s}}async match(n){let e=new ba([],Object.freeze({}),Object.freeze(A({},this.urlTree.queryParams)),this.urlTree.fragment,Object.freeze({}),je,this.rootComponentType,null,{});try{return{children:await this.processSegmentGroup(this.injector,this.config,n,je,e),rootSnapshot:e}}catch(r){if(r instanceof tE)return this.urlTree=r.urlTree,this.match(r.urlTree.root);throw r instanceof ya?this.noMatchError(r):r}}async processSegmentGroup(n,e,r,i,o){if(r.segments.length===0&&r.hasChildren())return this.processChildren(n,e,r,o);let s=await this.processSegment(n,e,r,r.segments,i,!0,o);return s instanceof Dr?[s]:[]}async processChildren(n,e,r,i){let o=[];for(let l of Object.keys(r.children))l==="primary"?o.unshift(l):o.push(l);let s=[];for(let l of o){let c=r.children[l],u=o4(e,l),d=await this.processSegmentGroup(n,u,c,l,i);s.push(...d)}let a=fA(s);return K4(a),a}async processSegment(n,e,r,i,o,s,a){for(let l of e)try{return await this.processSegmentAgainstRoute(l._injector??n,e,l,r,i,o,s,a)}catch(c){if(c instanceof ya||sA(c))continue;throw c}if($4(r,i,o))return new z4;throw new ya(r)}async processSegmentAgainstRoute(n,e,r,i,o,s,a,l){if(bi(r)!==s&&(s===je||!ng(i,o,r)))throw new ya(i);if(r.redirectTo===void 0)return this.matchSegmentAgainstRoute(n,i,r,o,s,l);if(this.allowRedirects&&a)return this.expandSegmentAgainstRouteUsingRedirect(n,i,e,r,o,s,l);throw new ya(i)}async expandSegmentAgainstRouteUsingRedirect(n,e,r,i,o,s,a){let{matched:l,parameters:c,consumedSegments:u,positionalParamSegments:d,remainingSegments:f}=hA(e,i,o);if(!l)throw new ya(e);typeof i.redirectTo=="string"&&i.redirectTo[0]==="/"&&(this.absoluteRedirectCount++,this.absoluteRedirectCount>W4&&(this.allowRedirects=!1));let h=new ba(o,c,Object.freeze(A({},this.urlTree.queryParams)),this.urlTree.fragment,NM(i),bi(i),i.component??i._loadedComponent??null,i,PM(i)),p=Xm(h,a,this.paramsInheritanceStrategy);if(h.params=Object.freeze(p.params),h.data=Object.freeze(p.data),this.abortSignal.aborted)throw new Error(this.abortSignal.reason);let m=await this.applyRedirects.applyRedirectCommands(u,i.redirectTo,d,h,n),g=await this.applyRedirects.lineralizeSegments(i,m);return this.processSegment(n,r,e,g.concat(f),s,!1,a)}async matchSegmentAgainstRoute(n,e,r,i,o,s){if(this.abortSignal.aborted)throw new Error(this.abortSignal.reason);let a=await Lm(L4(e,r,i,n,this.urlSerializer,this.abortSignal));if(r.path==="**"&&(e.children={}),!a?.matched)throw new ya(e);n=r._injector??n;let{routes:l}=await this.getChildConfig(n,r,i),c=r._loadedInjector??n,{parameters:u,consumedSegments:d,remainingSegments:f}=a,h=new ba(d,u,Object.freeze(A({},this.urlTree.queryParams)),this.urlTree.fragment,NM(r),bi(r),r.component??r._loadedComponent??null,r,PM(r)),p=Xm(h,s,this.paramsInheritanceStrategy);h.params=Object.freeze(p.params),h.data=Object.freeze(p.data);let{segmentGroup:m,slicedSegments:g}=OM(e,d,f,l);if(g.length===0&&m.hasChildren()){let T=await this.processChildren(c,l,m,h);return new Dr(h,T)}if(l.length===0&&g.length===0)return new Dr(h,[]);let w=bi(r)===o,C=await this.processSegment(c,l,m,g,w?je:o,!0,h);return new Dr(h,C instanceof Dr?[C]:[])}async getChildConfig(n,e,r){if(e.children)return{routes:e.children,injector:n};if(e.loadChildren){if(e._loadedRoutes!==void 0)return{routes:e._loadedRoutes,injector:e._loadedInjector};if(this.abortSignal.aborted)throw new Error(this.abortSignal.reason);if(await Lm(x4(n,e,r,this.urlSerializer,this.abortSignal))){let o=await this.configLoader.loadChildren(n,e);return e._loadedRoutes=o.routes,e._loadedInjector=o.injector,o}throw N4(e)}return{routes:[],injector:n}}};function K4(t){t.sort((n,e)=>n.value.outlet===je?-1:e.value.outlet===je?1:n.value.outlet.localeCompare(e.value.outlet))}function J4(t){let n=t.value.routeConfig;return n&&n.path===""}function fA(t){let n=[],e=new Set;for(let r of t){if(!J4(r)){n.push(r);continue}let i=n.find(o=>r.value.routeConfig===o.value.routeConfig);i!==void 0?(i.children.push(...r.children),e.add(i)):n.push(r)}for(let r of e){let i=fA(r.children);n.push(new Dr(r.value,i))}return n.filter(r=>!e.has(r))}function NM(t){return t.data||{}}function PM(t){return t.resolve||{}}var Y4=new P("",{factory:()=>q4});function Z4(t,n,e,r,i,o,s){let a=t.get(Y4);return An(l=>fe(l).pipe(Tt(c=>a(t,n,e,r,c.extractedUrl,i,o,s)),te(({state:c,tree:u})=>Z(A({},l),{targetSnapshot:c,urlAfterRedirects:u}))))}function X4(t,n){return An(e=>{let{targetSnapshot:r,guards:{canActivateChecks:i}}=e;if(!i.length)return fe(e);let o=new Set(i.map(l=>l.route)),s=new Set;for(let l of o)if(!s.has(l))for(let c of pA(l))s.add(c);let a=0;return Xe(s).pipe(Ii(l=>o.has(l)?Q4(l,r,t,n):(l.data=Xm(l,l.parent,t).resolve,fe(void 0))),Kt(()=>a++),Jf(1),An(l=>a===s.size?fe(e):an))})}function pA(t){let n=t.children.map(e=>pA(e)).flat();return[t,...n]}function Q4(t,n,e,r){let i=t.routeConfig,o=t._resolve;return i?.title!==void 0&&!tA(i)&&(o[Nd]=i.title),Di(()=>(t.data=Xm(t,t.parent,e).resolve,eH(o,t,n,r).pipe(te(s=>(t._resolvedData=s,t.data=A(A({},t.data),s),null)))))}function eH(t,n,e,r){let i=Ww(t);if(i.length===0)return fe({});let o={};return Xe(i).pipe(An(s=>tH(t[s],n,e,r).pipe(ao(),Kt(a=>{if(a instanceof fc)throw Qm(new go,a);o[s]=a}))),Jf(1),te(()=>o),oo(s=>sA(s)?an:__(s)))}function tH(t,n,e,r){let i=mc(n)??r,o=gc(t,i),s=o.resolve?o.resolve(n,e):Dn(i,()=>o(n,e));return Ea(s)}function zw(t){return Tt(n=>{let e=t(n);return e?Xe(e).pipe(te(()=>n)):fe(n)})}var aE=(()=>{class t{buildTitle(e){let r,i=e.root;for(;i!==void 0;)r=this.getResolvedTitleForRoute(i)??r,i=i.children.find(o=>o.outlet===je);return r}getResolvedTitleForRoute(e){return e.data[Nd]}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:()=>y(mA),providedIn:"root"})}return t})(),mA=(()=>{class t extends aE{title;constructor(e){super(),this.title=e}updateTitle(e){let r=this.buildTitle(e);r!==void 0&&this.title.setTitle(r)}static \u0275fac=function(r){return new(r||t)(Q(TM))};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),is=new P("",{factory:()=>({})}),Ia=new P(""),rg=(()=>{class t{componentLoaders=new WeakMap;childrenLoaders=new WeakMap;onLoadStartListener;onLoadEndListener;compiler=y(lw);async loadComponent(e,r){if(this.componentLoaders.get(r))return this.componentLoaders.get(r);if(r._loadedComponent)return Promise.resolve(r._loadedComponent);this.onLoadStartListener&&this.onLoadStartListener(r);let i=(async()=>{try{let o=await BM(Dn(e,()=>r.loadComponent())),s=await yA(vA(o));return this.onLoadEndListener&&this.onLoadEndListener(r),r._loadedComponent=s,s}finally{this.componentLoaders.delete(r)}})();return this.componentLoaders.set(r,i),i}loadChildren(e,r){if(this.childrenLoaders.get(r))return this.childrenLoaders.get(r);if(r._loadedRoutes)return Promise.resolve({routes:r._loadedRoutes,injector:r._loadedInjector});this.onLoadStartListener&&this.onLoadStartListener(r);let i=(async()=>{try{let o=await gA(r,this.compiler,e,this.onLoadEndListener);return r._loadedRoutes=o.routes,r._loadedInjector=o.injector,o}finally{this.childrenLoaders.delete(r)}})();return this.childrenLoaders.set(r,i),i}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();async function gA(t,n,e,r){let i=await BM(Dn(e,()=>t.loadChildren())),o=await yA(vA(i)),s;o instanceof lm||Array.isArray(o)?s=o:s=await n.compileModuleAsync(o),r&&r(t);let a,l,c=!1;return Array.isArray(s)?(l=s,c=!0):(a=s.create(e).injector,l=a.get(Ia,[],{optional:!0,self:!0}).flat()),{routes:l.map(sE),injector:a}}function nH(t){return t&&typeof t=="object"&&"default"in t}function vA(t){return nH(t)?t.default:t}async function yA(t){return t}var ig=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:()=>y(rH),providedIn:"root"})}return t})(),rH=(()=>{class t{shouldProcessUrl(e){return!0}extract(e){return e}merge(e,r){return e}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),lE=new P(""),cE=new P("");function _A(t,n,e){let r=t.get(cE),i=t.get(Ve);if(!i.startViewTransition||r.skipNextTransition)return r.skipNextTransition=!1,new Promise(c=>setTimeout(c));let o,s=new Promise(c=>{o=c}),a=i.startViewTransition(()=>(o(),iH(t)));a.ready.catch(c=>{});let{onViewTransitionCreated:l}=r;return l&&Dn(t,()=>l({transition:a,from:n,to:e})),s}function iH(t){return new Promise(n=>{br({read:()=>setTimeout(n)},{injector:t})})}var oH=()=>{},uE=new P(""),og=(()=>{class t{currentNavigation=Ee(null,{equal:()=>!1});currentTransition=null;lastSuccessfulNavigation=Ee(null,{});events=new ve;transitionAbortWithErrorSubject=new ve;configLoader=y(rg);environmentInjector=y(kt);destroyRef=y(Ye);urlSerializer=y(Ca);rootContexts=y(Sa);location=y(Vi);inputBindingEnabled=y(Pd,{optional:!0})!==null;titleStrategy=y(aE);options=y(is,{optional:!0})||{};paramsInheritanceStrategy=this.options.paramsInheritanceStrategy||"emptyOnly";urlHandlingStrategy=y(ig);createViewTransition=y(lE,{optional:!0});navigationErrorHandler=y(uE,{optional:!0});navigationId=0;get hasRequestedNavigation(){return this.navigationId!==0}transitions;afterPreactivation=()=>fe(void 0);rootComponentType=null;destroyed=!1;constructor(){let e=i=>this.events.next(new zm(i)),r=i=>this.events.next(new qm(i));this.configLoader.onLoadEndListener=r,this.configLoader.onLoadStartListener=e,this.destroyRef.onDestroy(()=>{this.destroyed=!0})}complete(){this.transitions?.complete()}handleNavigationRequest(e){let r=++this.navigationId;nt(()=>{this.transitions?.next(Z(A({},e),{extractedUrl:this.urlHandlingStrategy.extract(e.rawUrl),targetSnapshot:null,targetRouterState:null,guards:{canActivateChecks:[],canDeactivateChecks:[]},guardsResult:null,id:r}))})}setupNavigations(e){return this.transitions=new Rt(null),this.transitions.pipe(_t(r=>r!==null),Tt(r=>{let i=!1,o=new AbortController;return fe(r).pipe(Tt(s=>{if(this.navigationId>r.id)return this.cancelNavigationTransition(r,"",Qn.SupersededByNewNavigation),an;this.currentTransition=r;let a=this.lastSuccessfulNavigation();this.currentNavigation.set({id:s.id,initialUrl:s.rawUrl,extractedUrl:s.extractedUrl,targetBrowserUrl:typeof s.extras.browserUrl=="string"?this.urlSerializer.parse(s.extras.browserUrl):s.extras.browserUrl,trigger:s.source,extras:s.extras,previousNavigation:a?Z(A({},a),{previousNavigation:null}):null,abort:()=>o.abort()});let l=!e.navigated||this.isUpdatingInternalState()||this.isUpdatedBrowserUrl(),c=s.extras.onSameUrlNavigation??e.onSameUrlNavigation;if(!l&&c!=="reload")return this.events.next(new zi(s.id,this.urlSerializer.serialize(s.rawUrl),"",cc.IgnoredSameUrlNavigation)),s.resolve(!1),an;if(this.urlHandlingStrategy.shouldProcessUrl(s.rawUrl))return fe(s).pipe(Tt(u=>(this.events.next(new rs(u.id,this.urlSerializer.serialize(u.extractedUrl),u.source,u.restoredState)),u.id!==this.navigationId?an:Promise.resolve(u))),Z4(this.environmentInjector,this.configLoader,this.rootComponentType,e.config,this.urlSerializer,this.paramsInheritanceStrategy,o.signal),Kt(u=>{r.targetSnapshot=u.targetSnapshot,r.urlAfterRedirects=u.urlAfterRedirects,this.currentNavigation.update(f=>(f.finalUrl=u.urlAfterRedirects,f));let d=new Md(u.id,this.urlSerializer.serialize(u.extractedUrl),this.urlSerializer.serialize(u.urlAfterRedirects),u.targetSnapshot);this.events.next(d)}));if(l&&this.urlHandlingStrategy.shouldProcessUrl(s.currentRawUrl)){let{id:u,extractedUrl:d,source:f,restoredState:h,extras:p}=s,m=new rs(u,this.urlSerializer.serialize(d),f,h);this.events.next(m);let g=QM(this.rootComponentType).snapshot;return this.currentTransition=r=Z(A({},s),{targetSnapshot:g,urlAfterRedirects:d,extras:Z(A({},p),{skipLocationChange:!1,replaceUrl:!1})}),this.currentNavigation.update(w=>(w.finalUrl=d,w)),fe(r)}else return this.events.next(new zi(s.id,this.urlSerializer.serialize(s.extractedUrl),"",cc.IgnoredByUrlHandlingStrategy)),s.resolve(!1),an}),Kt(s=>{let a=new Vm(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot);this.events.next(a)}),te(s=>(this.currentTransition=r=Z(A({},s),{guards:h4(s.targetSnapshot,s.currentSnapshot,this.rootContexts)}),r)),C4(this.environmentInjector,s=>this.events.next(s)),Kt(s=>{if(r.guardsResult=s.guardsResult,s.guardsResult&&typeof s.guardsResult!="boolean")throw Qm(this.urlSerializer,s.guardsResult);let a=new Um(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects),s.targetSnapshot,!!s.guardsResult);this.events.next(a)}),_t(s=>s.guardsResult?!0:(this.cancelNavigationTransition(s,"",Qn.GuardRejected),!1)),zw(s=>{if(s.guards.canActivateChecks.length!==0)return fe(s).pipe(Kt(a=>{let l=new Hm(a.id,this.urlSerializer.serialize(a.extractedUrl),this.urlSerializer.serialize(a.urlAfterRedirects),a.targetSnapshot);this.events.next(l)}),Tt(a=>{let l=!1;return fe(a).pipe(X4(this.paramsInheritanceStrategy,this.environmentInjector),Kt({next:()=>l=!0,complete:()=>{l||this.cancelNavigationTransition(a,"",Qn.NoDataFromResolver)}}))}),Kt(a=>{let l=new $m(a.id,this.urlSerializer.serialize(a.extractedUrl),this.urlSerializer.serialize(a.urlAfterRedirects),a.targetSnapshot);this.events.next(l)}))}),zw(s=>{let a=c=>{let u=[];if(c.routeConfig?._loadedComponent)c.component=c.routeConfig?._loadedComponent;else if(c.routeConfig?.loadComponent){let d=mc(c)??this.environmentInjector;u.push(this.configLoader.loadComponent(d,c.routeConfig).then(f=>{c.component=f}))}for(let d of c.children)u.push(...a(d));return u},l=a(s.targetSnapshot.root);return l.length===0?fe(s):Xe(Promise.all(l).then(()=>s))}),zw(()=>this.afterPreactivation()),Tt(()=>{let{currentSnapshot:s,targetSnapshot:a}=r,l=this.createViewTransition?.(this.environmentInjector,s.root,a.root);return l?Xe(l).pipe(te(()=>r)):fe(r)}),te(s=>{let a=a4(e.routeReuseStrategy,s.targetSnapshot,s.currentRouterState);return this.currentTransition=r=Z(A({},s),{targetRouterState:a}),this.currentNavigation.update(l=>(l.targetRouterState=a,l)),r}),Kt(()=>{this.events.next(new Ad)}),d4(this.rootContexts,e.routeReuseStrategy,s=>this.events.next(s),this.inputBindingEnabled),It(1),xr(aA(o.signal).pipe(_t(()=>!i&&!r.targetRouterState),Kt(()=>{this.cancelNavigationTransition(r,o.signal.reason+"",Qn.Aborted)}))),Kt({next:s=>{i=!0,this.currentNavigation.update(a=>(a.abort=oH,a)),this.lastSuccessfulNavigation.set(nt(this.currentNavigation)),this.events.next(new Tr(s.id,this.urlSerializer.serialize(s.extractedUrl),this.urlSerializer.serialize(s.urlAfterRedirects))),this.titleStrategy?.updateTitle(s.targetRouterState.snapshot),s.resolve(!0)},complete:()=>{i=!0}}),xr(this.transitionAbortWithErrorSubject.pipe(Kt(s=>{throw s}))),yu(()=>{o.abort(),i||this.cancelNavigationTransition(r,"",Qn.SupersededByNewNavigation),this.currentTransition?.id===r.id&&(this.currentNavigation.set(null),this.currentTransition=null)}),oo(s=>{if(this.destroyed)return r.resolve(!1),an;if(i=!0,oA(s))this.events.next(new $i(r.id,this.urlSerializer.serialize(r.extractedUrl),s.message,s.cancellationCode)),u4(s)?this.events.next(new hc(s.url,s.navigationBehaviorOptions)):r.resolve(!1);else{let a=new uc(r.id,this.urlSerializer.serialize(r.extractedUrl),s,r.targetSnapshot??void 0);try{let l=Dn(this.environmentInjector,()=>this.navigationErrorHandler?.(a));if(l instanceof fc){let{message:c,cancellationCode:u}=Qm(this.urlSerializer,l);this.events.next(new $i(r.id,this.urlSerializer.serialize(r.extractedUrl),c,u)),this.events.next(new hc(l.redirectTo,l.navigationBehaviorOptions))}else throw this.events.next(a),s}catch(l){this.options.resolveNavigationPromiseOnError?r.resolve(!1):r.reject(l)}}return an}))}))}cancelNavigationTransition(e,r,i){let o=new $i(e.id,this.urlSerializer.serialize(e.extractedUrl),r,i);this.events.next(o),e.resolve(!1)}isUpdatingInternalState(){return this.currentTransition?.extractedUrl.toString()!==this.currentTransition?.currentUrlTree.toString()}isUpdatedBrowserUrl(){let e=this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(!0))),r=nt(this.currentNavigation),i=r?.targetBrowserUrl??r?.extractedUrl;return e.toString()!==i?.toString()&&!r?.extras.skipLocationChange}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function sH(t){return t!==ac}var bA=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:()=>y(aH),providedIn:"root"})}return t})(),tg=class{shouldDetach(n){return!1}store(n,e){}shouldAttach(n){return!1}retrieve(n){return null}shouldReuseRoute(n,e){return n.routeConfig===e.routeConfig}},aH=(()=>{class t extends tg{static \u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})();static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),dE=(()=>{class t{urlSerializer=y(Ca);options=y(is,{optional:!0})||{};canceledNavigationResolution=this.options.canceledNavigationResolution||"replace";location=y(Vi);urlHandlingStrategy=y(ig);urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred";currentUrlTree=new wi;getCurrentUrlTree(){return this.currentUrlTree}rawUrlTree=this.currentUrlTree;getRawUrlTree(){return this.rawUrlTree}createBrowserPath({finalUrl:e,initialUrl:r,targetBrowserUrl:i}){let o=e!==void 0?this.urlHandlingStrategy.merge(e,r):r,s=i??o;return s instanceof wi?this.urlSerializer.serialize(s):s}commitTransition({targetRouterState:e,finalUrl:r,initialUrl:i}){r&&e?(this.currentUrlTree=r,this.rawUrlTree=this.urlHandlingStrategy.merge(r,i),this.routerState=e):this.rawUrlTree=i}routerState=QM(null);getRouterState(){return this.routerState}stateMemento=this.createStateMemento();updateStateMemento(){this.stateMemento=this.createStateMemento()}createStateMemento(){return{rawUrlTree:this.rawUrlTree,currentUrlTree:this.currentUrlTree,routerState:this.routerState}}resetInternalState({finalUrl:e}){this.routerState=this.stateMemento.routerState,this.currentUrlTree=this.stateMemento.currentUrlTree,this.rawUrlTree=this.urlHandlingStrategy.merge(this.currentUrlTree,e??this.rawUrlTree)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:()=>y(wA),providedIn:"root"})}return t})(),wA=(()=>{class t extends dE{currentPageId=0;lastSuccessfulId=-1;restoredState(){return this.location.getState()}get browserPageId(){return this.canceledNavigationResolution!=="computed"?this.currentPageId:this.restoredState()?.\u0275routerPageId??this.currentPageId}registerNonRouterCurrentEntryChangeListener(e){return this.location.subscribe(r=>{r.type==="popstate"&&setTimeout(()=>{e(r.url,r.state,"popstate")})})}handleRouterEvent(e,r){e instanceof rs?this.updateStateMemento():e instanceof zi?this.commitTransition(r):e instanceof Md?this.urlUpdateStrategy==="eager"&&(r.extras.skipLocationChange||this.setBrowserUrl(this.createBrowserPath(r),r)):e instanceof Ad?(this.commitTransition(r),this.urlUpdateStrategy==="deferred"&&!r.extras.skipLocationChange&&this.setBrowserUrl(this.createBrowserPath(r),r)):e instanceof $i&&e.code!==Qn.SupersededByNewNavigation&&e.code!==Qn.Redirect?this.restoreHistory(r):e instanceof uc?this.restoreHistory(r,!0):e instanceof Tr&&(this.lastSuccessfulId=e.id,this.currentPageId=this.browserPageId)}setBrowserUrl(e,{extras:r,id:i}){let{replaceUrl:o,state:s}=r;if(this.location.isCurrentPathEqualTo(e)||o){let a=this.browserPageId,l=A(A({},s),this.generateNgRouterState(i,a));this.location.replaceState(e,"",l)}else{let a=A(A({},s),this.generateNgRouterState(i,this.browserPageId+1));this.location.go(e,"",a)}}restoreHistory(e,r=!1){if(this.canceledNavigationResolution==="computed"){let i=this.browserPageId,o=this.currentPageId-i;o!==0?this.location.historyGo(o):this.getCurrentUrlTree()===e.finalUrl&&o===0&&(this.resetInternalState(e),this.resetUrlToCurrentUrlTree())}else this.canceledNavigationResolution==="replace"&&(r&&this.resetInternalState(e),this.resetUrlToCurrentUrlTree())}resetUrlToCurrentUrlTree(){this.location.replaceState(this.urlSerializer.serialize(this.getRawUrlTree()),"",this.generateNgRouterState(this.lastSuccessfulId,this.currentPageId))}generateNgRouterState(e,r){return this.canceledNavigationResolution==="computed"?{navigationId:e,\u0275routerPageId:r}:{navigationId:e}}static \u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})();static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function sg(t,n){t.events.pipe(_t(e=>e instanceof Tr||e instanceof $i||e instanceof uc||e instanceof zi),te(e=>e instanceof Tr||e instanceof zi?0:(e instanceof $i?e.code===Qn.Redirect||e.code===Qn.SupersededByNewNavigation:!1)?2:1),_t(e=>e!==2),It(1)).subscribe(()=>{n()})}var lH={paths:"exact",fragment:"ignored",matrixParams:"ignored",queryParams:"exact"},cH={paths:"subset",fragment:"ignored",matrixParams:"ignored",queryParams:"subset"},cn=(()=>{class t{get currentUrlTree(){return this.stateManager.getCurrentUrlTree()}get rawUrlTree(){return this.stateManager.getRawUrlTree()}disposed=!1;nonRouterCurrentEntryChangeSubscription;console=y(Zb);stateManager=y(dE);options=y(is,{optional:!0})||{};pendingTasks=y(fo);urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred";navigationTransitions=y(og);urlSerializer=y(Ca);location=y(Vi);urlHandlingStrategy=y(ig);injector=y(kt);_events=new ve;get events(){return this._events}get routerState(){return this.stateManager.getRouterState()}navigated=!1;routeReuseStrategy=y(bA);onSameUrlNavigation=this.options.onSameUrlNavigation||"ignore";config=y(Ia,{optional:!0})?.flat()??[];componentInputBindingEnabled=!!y(Pd,{optional:!0});currentNavigation=this.navigationTransitions.currentNavigation.asReadonly();constructor(){this.resetConfig(this.config),this.navigationTransitions.setupNavigations(this).subscribe({error:e=>{this.console.warn(e)}}),this.subscribeToNavigationEvents()}eventsSubscription=new St;subscribeToNavigationEvents(){let e=this.navigationTransitions.events.subscribe(r=>{try{let i=this.navigationTransitions.currentTransition,o=nt(this.navigationTransitions.currentNavigation);if(i!==null&&o!==null){if(this.stateManager.handleRouterEvent(r,o),r instanceof $i&&r.code!==Qn.Redirect&&r.code!==Qn.SupersededByNewNavigation)this.navigated=!0;else if(r instanceof Tr)this.navigated=!0;else if(r instanceof hc){let s=r.navigationBehaviorOptions,a=this.urlHandlingStrategy.merge(r.url,i.currentRawUrl),l=A({browserUrl:i.extras.browserUrl,info:i.extras.info,skipLocationChange:i.extras.skipLocationChange,replaceUrl:i.extras.replaceUrl||this.urlUpdateStrategy==="eager"||sH(i.source)},s);this.scheduleNavigation(a,ac,null,l,{resolve:i.resolve,reject:i.reject,promise:i.promise})}}r4(r)&&this._events.next(r)}catch(i){this.navigationTransitions.transitionAbortWithErrorSubject.next(i)}});this.eventsSubscription.add(e)}resetRootComponentType(e){this.routerState.root.component=e,this.navigationTransitions.rootComponentType=e}initialNavigation(){this.setUpLocationChangeListener(),this.navigationTransitions.hasRequestedNavigation||this.navigateToSyncWithBrowser(this.location.path(!0),ac,this.stateManager.restoredState())}setUpLocationChangeListener(){this.nonRouterCurrentEntryChangeSubscription??=this.stateManager.registerNonRouterCurrentEntryChangeListener((e,r,i)=>{this.navigateToSyncWithBrowser(e,i,r)})}navigateToSyncWithBrowser(e,r,i){let o={replaceUrl:!0},s=i?.navigationId?i:null;if(i){let l=A({},i);delete l.navigationId,delete l.\u0275routerPageId,Object.keys(l).length!==0&&(o.state=l)}let a=this.parseUrl(e);this.scheduleNavigation(a,r,s,o).catch(l=>{this.disposed||this.injector.get(_r)(l)})}get url(){return this.serializeUrl(this.currentUrlTree)}getCurrentNavigation(){return nt(this.navigationTransitions.currentNavigation)}get lastSuccessfulNavigation(){return this.navigationTransitions.lastSuccessfulNavigation}resetConfig(e){this.config=e.map(sE),this.navigated=!1}ngOnDestroy(){this.dispose()}dispose(){this._events.unsubscribe(),this.navigationTransitions.complete(),this.nonRouterCurrentEntryChangeSubscription&&(this.nonRouterCurrentEntryChangeSubscription.unsubscribe(),this.nonRouterCurrentEntryChangeSubscription=void 0),this.disposed=!0,this.eventsSubscription.unsubscribe()}createUrlTree(e,r={}){let{relativeTo:i,queryParams:o,fragment:s,queryParamsHandling:a,preserveFragment:l}=r,c=l?this.currentUrlTree.fragment:s,u=null;switch(a??this.options.defaultQueryParamsHandling){case"merge":u=A(A({},this.currentUrlTree.queryParams),o);break;case"preserve":u=this.currentUrlTree.queryParams;break;default:u=o||null}u!==null&&(u=this.removeEmptyProps(u));let d;try{let f=i?i.snapshot:this.routerState.snapshot.root;d=JM(f)}catch{(typeof e[0]!="string"||e[0][0]!=="/")&&(e=[]),d=this.currentUrlTree.root}return YM(d,e,u,c??null,this.urlSerializer)}navigateByUrl(e,r={skipLocationChange:!1}){let i=ns(e)?e:this.parseUrl(e),o=this.urlHandlingStrategy.merge(i,this.rawUrlTree);return this.scheduleNavigation(o,ac,null,r)}navigate(e,r={skipLocationChange:!1}){return uH(e),this.navigateByUrl(this.createUrlTree(e,r),r)}serializeUrl(e){return this.urlSerializer.serialize(e)}parseUrl(e){try{return this.urlSerializer.parse(e)}catch{return this.console.warn(oi(4018,!1)),this.urlSerializer.parse("/")}}isActive(e,r){let i;if(r===!0?i=A({},lH):r===!1?i=A({},cH):i=r,ns(e))return kM(this.currentUrlTree,e,i);let o=this.parseUrl(e);return kM(this.currentUrlTree,o,i)}removeEmptyProps(e){return Object.entries(e).reduce((r,[i,o])=>(o!=null&&(r[i]=o),r),{})}scheduleNavigation(e,r,i,o,s){if(this.disposed)return Promise.resolve(!1);let a,l,c;s?(a=s.resolve,l=s.reject,c=s.promise):c=new Promise((d,f)=>{a=d,l=f});let u=this.pendingTasks.add();return sg(this,()=>{queueMicrotask(()=>this.pendingTasks.remove(u))}),this.navigationTransitions.handleNavigationRequest({source:r,restoredState:i,currentUrlTree:this.currentUrlTree,currentRawUrl:this.currentUrlTree,rawUrl:e,extras:o,resolve:a,reject:l,promise:c,currentSnapshot:this.routerState.snapshot,currentRouterState:this.routerState}),c.catch(d=>Promise.reject(d))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function uH(t){for(let n=0;n<t.length;n++)if(t[n]==null)throw new z(4008,!1)}var os=(()=>{class t{router;route;tabIndexAttribute;renderer;el;locationStrategy;reactiveHref=Ee(null,{});get href(){return nt(this.reactiveHref)}set href(e){this.reactiveHref.set(e)}target;queryParams;fragment;queryParamsHandling;state;info;relativeTo;isAnchorElement;subscription;onChanges=new ve;applicationErrorHandler=y(_r);options=y(is,{optional:!0});constructor(e,r,i,o,s,a){this.router=e,this.route=r,this.tabIndexAttribute=i,this.renderer=o,this.el=s,this.locationStrategy=a,this.reactiveHref.set(y(new pm("href"),{optional:!0}));let l=s.nativeElement.tagName?.toLowerCase();this.isAnchorElement=l==="a"||l==="area"||!!(typeof customElements=="object"&&customElements.get(l)?.observedAttributes?.includes?.("href")),this.isAnchorElement?this.setTabIndexIfNotOnNativeEl("0"):this.subscribeToNavigationEventsIfNecessary()}subscribeToNavigationEventsIfNecessary(){if(this.subscription!==void 0||!this.isAnchorElement)return;let e=this.preserveFragment,r=i=>i==="merge"||i==="preserve";e||=r(this.queryParamsHandling),e||=!this.queryParamsHandling&&!r(this.options?.defaultQueryParamsHandling),e&&(this.subscription=this.router.events.subscribe(i=>{i instanceof Tr&&this.updateHref()}))}preserveFragment=!1;skipLocationChange=!1;replaceUrl=!1;setTabIndexIfNotOnNativeEl(e){this.tabIndexAttribute!=null||this.isAnchorElement||this.applyAttributeValue("tabindex",e)}ngOnChanges(e){this.isAnchorElement&&(this.updateHref(),this.subscribeToNavigationEventsIfNecessary()),this.onChanges.next(this)}routerLinkInput=null;set routerLink(e){e==null?(this.routerLinkInput=null,this.setTabIndexIfNotOnNativeEl(null)):(ns(e)?this.routerLinkInput=e:this.routerLinkInput=Array.isArray(e)?e:[e],this.setTabIndexIfNotOnNativeEl("0"))}onClick(e,r,i,o,s){let a=this.urlTree;if(a===null||this.isAnchorElement&&(e!==0||r||i||o||s||typeof this.target=="string"&&this.target!="_self"))return!0;let l={skipLocationChange:this.skipLocationChange,replaceUrl:this.replaceUrl,state:this.state,info:this.info};return this.router.navigateByUrl(a,l)?.catch(c=>{this.applicationErrorHandler(c)}),!this.isAnchorElement}ngOnDestroy(){this.subscription?.unsubscribe()}updateHref(){let e=this.urlTree;this.reactiveHref.set(e!==null&&this.locationStrategy?this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(e))??"":null)}applyAttributeValue(e,r){let i=this.renderer,o=this.el.nativeElement;r!==null?i.setAttribute(o,e,r):i.removeAttribute(o,e)}get urlTree(){return this.routerLinkInput===null?null:ns(this.routerLinkInput)?this.routerLinkInput:this.router.createUrlTree(this.routerLinkInput,{relativeTo:this.relativeTo!==void 0?this.relativeTo:this.route,queryParams:this.queryParams,fragment:this.fragment,queryParamsHandling:this.queryParamsHandling,preserveFragment:this.preserveFragment})}static \u0275fac=function(r){return new(r||t)(_e(cn),_e($r),Yu("tabindex"),_e(Tn),_e(We),_e(yi))};static \u0275dir=Oe({type:t,selectors:[["","routerLink",""]],hostVars:2,hostBindings:function(r,i){r&1&&Ge("click",function(s){return i.onClick(s.button,s.ctrlKey,s.shiftKey,s.altKey,s.metaKey)}),r&2&&ut("href",i.reactiveHref(),Ib)("target",i.target)},inputs:{target:"target",queryParams:"queryParams",fragment:"fragment",queryParamsHandling:"queryParamsHandling",state:"state",info:"info",relativeTo:"relativeTo",preserveFragment:[2,"preserveFragment","preserveFragment",At],skipLocationChange:[2,"skipLocationChange","skipLocationChange",At],replaceUrl:[2,"replaceUrl","replaceUrl",At],routerLink:"routerLink"},features:[xn]})}return t})(),fE=(()=>{class t{router;element;renderer;cdr;links;classes=[];routerEventsSubscription;linkInputChangesSubscription;_isActive=!1;get isActive(){return this._isActive}routerLinkActiveOptions={exact:!1};ariaCurrentWhenActive;isActiveChange=new tt;link=y(os,{optional:!0});constructor(e,r,i,o){this.router=e,this.element=r,this.renderer=i,this.cdr=o,this.routerEventsSubscription=e.events.subscribe(s=>{s instanceof Tr&&this.update()})}ngAfterContentInit(){fe(this.links.changes,fe(null)).pipe(No()).subscribe(e=>{this.update(),this.subscribeToEachLinkOnChanges()})}subscribeToEachLinkOnChanges(){this.linkInputChangesSubscription?.unsubscribe();let e=[...this.links.toArray(),this.link].filter(r=>!!r).map(r=>r.onChanges);this.linkInputChangesSubscription=Xe(e).pipe(No()).subscribe(r=>{this._isActive!==this.isLinkActive(this.router)(r)&&this.update()})}set routerLinkActive(e){let r=Array.isArray(e)?e:e.split(" ");this.classes=r.filter(i=>!!i)}ngOnChanges(e){this.update()}ngOnDestroy(){this.routerEventsSubscription.unsubscribe(),this.linkInputChangesSubscription?.unsubscribe()}update(){!this.links||!this.router.navigated||queueMicrotask(()=>{let e=this.hasActiveLinks();this.classes.forEach(r=>{e?this.renderer.addClass(this.element.nativeElement,r):this.renderer.removeClass(this.element.nativeElement,r)}),e&&this.ariaCurrentWhenActive!==void 0?this.renderer.setAttribute(this.element.nativeElement,"aria-current",this.ariaCurrentWhenActive.toString()):this.renderer.removeAttribute(this.element.nativeElement,"aria-current"),this._isActive!==e&&(this._isActive=e,this.cdr.markForCheck(),this.isActiveChange.emit(e))})}isLinkActive(e){let r=dH(this.routerLinkActiveOptions)?this.routerLinkActiveOptions:this.routerLinkActiveOptions.exact||!1;return i=>{let o=i.urlTree;return o?e.isActive(o,r):!1}}hasActiveLinks(){let e=this.isLinkActive(this.router);return this.link&&e(this.link)||this.links.some(e)}static \u0275fac=function(r){return new(r||t)(_e(cn),_e(We),_e(Tn),_e(zn))};static \u0275dir=Oe({type:t,selectors:[["","routerLinkActive",""]],contentQueries:function(r,i,o){if(r&1&&iw(o,os,5),r&2){let s;Zl(s=Xl())&&(i.links=s)}},inputs:{routerLinkActiveOptions:"routerLinkActiveOptions",ariaCurrentWhenActive:"ariaCurrentWhenActive",routerLinkActive:"routerLinkActive"},outputs:{isActiveChange:"isActiveChange"},exportAs:["routerLinkActive"],features:[xn]})}return t})();function dH(t){return!!t.paths}var Ld=class{};var EA=(()=>{class t{router;injector;preloadingStrategy;loader;subscription;constructor(e,r,i,o){this.router=e,this.injector=r,this.preloadingStrategy=i,this.loader=o}setUpPreloading(){this.subscription=this.router.events.pipe(_t(e=>e instanceof Tr),Ii(()=>this.preload())).subscribe(()=>{})}preload(){return this.processRoutes(this.injector,this.router.config)}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}processRoutes(e,r){let i=[];for(let o of r){o.providers&&!o._injector&&(o._injector=Gl(o.providers,e,`Route: ${o.path}`));let s=o._injector??e,a=o._loadedInjector??s;(o.loadChildren&&!o._loadedRoutes&&o.canLoad===void 0||o.loadComponent&&!o._loadedComponent)&&i.push(this.preloadConfig(s,o)),(o.children||o._loadedRoutes)&&i.push(this.processRoutes(a,o.children??o._loadedRoutes))}return Xe(i).pipe(No())}preloadConfig(e,r){return this.preloadingStrategy.preload(r,()=>{let i;r.loadChildren&&r.canLoad===void 0?i=Xe(this.loader.loadChildren(e,r)):i=fe(null);let o=i.pipe(An(s=>s===null?fe(void 0):(r._loadedRoutes=s.routes,r._loadedInjector=s.injector,this.processRoutes(s.injector??e,s.routes))));if(r.loadComponent&&!r._loadedComponent){let s=this.loader.loadComponent(e,r);return Xe([o,s]).pipe(No())}else return o})}static \u0275fac=function(r){return new(r||t)(Q(cn),Q(kt),Q(Ld),Q(rg))};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),CA=new P(""),hH=(()=>{class t{urlSerializer;transitions;viewportScroller;zone;options;routerEventsSubscription;scrollEventsSubscription;lastId=0;lastSource=ac;restoredId=0;store={};constructor(e,r,i,o,s={}){this.urlSerializer=e,this.transitions=r,this.viewportScroller=i,this.zone=o,this.options=s,s.scrollPositionRestoration||="disabled",s.anchorScrolling||="disabled"}init(){this.options.scrollPositionRestoration!=="disabled"&&this.viewportScroller.setHistoryScrollRestoration("manual"),this.routerEventsSubscription=this.createScrollEvents(),this.scrollEventsSubscription=this.consumeScrollEvents()}createScrollEvents(){return this.transitions.events.subscribe(e=>{e instanceof rs?(this.store[this.lastId]=this.viewportScroller.getScrollPosition(),this.lastSource=e.navigationTrigger,this.restoredId=e.restoredState?e.restoredState.navigationId:0):e instanceof Tr?(this.lastId=e.id,this.scheduleScrollEvent(e,this.urlSerializer.parse(e.urlAfterRedirects).fragment)):e instanceof zi&&e.code===cc.IgnoredSameUrlNavigation&&(this.lastSource=void 0,this.restoredId=0,this.scheduleScrollEvent(e,this.urlSerializer.parse(e.url).fragment))})}consumeScrollEvents(){return this.transitions.events.subscribe(e=>{if(!(e instanceof dc))return;let r={behavior:"instant"};e.position?this.options.scrollPositionRestoration==="top"?this.viewportScroller.scrollToPosition([0,0],r):this.options.scrollPositionRestoration==="enabled"&&this.viewportScroller.scrollToPosition(e.position,r):e.anchor&&this.options.anchorScrolling==="enabled"?this.viewportScroller.scrollToAnchor(e.anchor):this.options.scrollPositionRestoration!=="disabled"&&this.viewportScroller.scrollToPosition([0,0])})}scheduleScrollEvent(e,r){this.zone.runOutsideAngular(async()=>{await new Promise(i=>{setTimeout(i),typeof requestAnimationFrame<"u"&&requestAnimationFrame(i)}),this.zone.run(()=>{this.transitions.events.next(new dc(e,this.lastSource==="popstate"?this.store[this.restoredId]:null,r))})})}ngOnDestroy(){this.routerEventsSubscription?.unsubscribe(),this.scrollEventsSubscription?.unsubscribe()}static \u0275fac=function(r){$b()};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})();function pE(t,...n){return Or([{provide:Ia,multi:!0,useValue:t},[],{provide:$r,useFactory:SA},{provide:od,multi:!0,useFactory:DA},n.map(e=>e.\u0275providers)])}function SA(){return y(cn).routerState.root}function jd(t,n){return{\u0275kind:t,\u0275providers:n}}function DA(){let t=y(Re);return n=>{let e=t.get(wr);if(n!==e.components[0])return;let r=t.get(cn),i=t.get(IA);t.get(mE)===1&&r.initialNavigation(),t.get(MA,null,{optional:!0})?.setUpPreloading(),t.get(CA,null,{optional:!0})?.init(),r.resetRootComponentType(e.componentTypes[0]),i.closed||(i.next(),i.complete(),i.unsubscribe())}}var IA=new P("",{factory:()=>new ve}),mE=new P("",{factory:()=>1});function TA(){let t=[{provide:Cb,useValue:!0},{provide:mE,useValue:0},Kl(()=>{let n=y(Re);return n.get(_w,Promise.resolve()).then(()=>new Promise(r=>{let i=n.get(cn),o=n.get(IA);sg(i,()=>{r(!0)}),n.get(og).afterPreactivation=()=>(r(!0),o.closed?fe(void 0):o),i.initialNavigation()}))})];return jd(2,t)}function kA(){let t=[Kl(()=>{y(cn).setUpLocationChangeListener()}),{provide:mE,useValue:2}];return jd(3,t)}var MA=new P("");function AA(t){return jd(0,[{provide:MA,useExisting:EA},{provide:Ld,useExisting:t}])}function ag(){return jd(8,[iE,{provide:Pd,useExisting:iE}])}function xA(t){mi("NgRouterViewTransitions");let n=[{provide:lE,useValue:_A},{provide:cE,useValue:A({skipNextTransition:!!t?.skipInitialTransition},t)}];return jd(9,n)}var RA=[Vi,{provide:Ca,useClass:go},cn,Sa,{provide:$r,useFactory:SA},rg,[]],vo=(()=>{class t{constructor(){}static forRoot(e,r){return{ngModule:t,providers:[RA,[],{provide:Ia,multi:!0,useValue:e},[],r?.errorHandler?{provide:uE,useValue:r.errorHandler}:[],{provide:is,useValue:r||{}},r?.useHash?pH():mH(),fH(),r?.preloadingStrategy?AA(r.preloadingStrategy).\u0275providers:[],r?.initialNavigation?gH(r):[],r?.bindToComponentInputs?ag().\u0275providers:[],r?.enableViewTransitions?xA().\u0275providers:[],vH()]}}static forChild(e){return{ngModule:t,providers:[{provide:Ia,multi:!0,useValue:e}]}}static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({})}return t})();function fH(){return{provide:CA,useFactory:()=>{let t=y(aM),n=y(Ke),e=y(is),r=y(og),i=y(Ca);return e.scrollOffset&&t.setOffset(e.scrollOffset),new hH(i,r,t,n,e)}}}function pH(){return{provide:yi,useClass:Cw}}function mH(){return{provide:yi,useClass:_m}}function gH(t){return[t.initialNavigation==="disabled"?kA().\u0275providers:[],t.initialNavigation==="enabledBlocking"?TA().\u0275providers:[]]}var hE=new P("");function vH(){return[{provide:hE,useFactory:DA},{provide:od,multi:!0,useExisting:hE}]}function un(t){t||(t=y(Ye));let n=new Ie(e=>{if(t.destroyed){e.next();return}return t.onDestroy(e.next.bind(e))});return e=>e.pipe(xr(n))}function OA(t,n){let e=n?.injector??y(Re),r=new Ls(1),i=ln(()=>{let o;try{o=t()}catch(s){nt(()=>r.error(s));return}nt(()=>r.next(o))},{injector:e,manualCleanup:!0}
8);return e.get(Ye).onDestroy(()=>{i.destroy(),r.complete()}),r.asObservable()}function er(t,n){let r=!n?.manualCleanup?n?.injector?.get(Ye)??y(Ye):null,i=yH(n?.equal),o;n?.requireSync?o=Ee({kind:0},{equal:i}):o=Ee({kind:1,value:n?.initialValue},{equal:i});let s,a=t.subscribe({next:l=>o.set({kind:1,value:l}),error:l=>{o.set({kind:2,error:l}),s?.()},complete:()=>{s?.()}});if(n?.requireSync&&o().kind===0)throw new z(601,!1);return s=r?.onDestroy(a.unsubscribe.bind(a)),le(()=>{let l=o();switch(l.kind){case 1:return l.value;case 2:throw l.error;case 0:throw new z(601,!1)}},{equal:n?.equal})}function yH(t=Object.is){return(n,e)=>n.kind===1&&e.kind===1&&t(n.value,e.value)}var _H={};function bH(t,n){if(t==null)throw new Error(`${n} must be defined.`)}var WA="@ngrx/store/init",vc=(()=>{class t extends Rt{constructor(){super({type:WA})}next(e){if(typeof e=="function")throw new TypeError(` 9 Dispatch expected an object, instead it received a function. 10 If you're using the createAction function, make sure to invoke the function 11 before dispatching the action. For example, someAction should be someAction().`);if(typeof e>"u")throw new TypeError("Actions must be objects");if(typeof e.type>"u")throw new TypeError("Actions must have a type property");super.next(e)}complete(){}ngOnDestroy(){super.complete()}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=O({token:t,factory:t.\u0275fac})}}return t})(),wH=[vc],GA=new P("@ngrx/store Internal Root Guard"),NA=new P("@ngrx/store Internal Initial State"),EE=new P("@ngrx/store Initial State"),KA=new P("@ngrx/store Reducer Factory"),PA=new P("@ngrx/store Internal Reducer Factory Provider"),JA=new P("@ngrx/store Initial Reducers"),vE=new P("@ngrx/store Internal Initial Reducers");var FA=new P("@ngrx/store Internal Store Reducers");var EH=new P("@ngrx/store Internal Store Features");var CH=new P("@ngrx/store Feature Reducers"),LA=new P("@ngrx/store User Provided Meta Reducers"),lg=new P("@ngrx/store Meta Reducers"),jA=new P("@ngrx/store Internal Resolved Meta Reducers"),BA=new P("@ngrx/store User Runtime Checks Config"),VA=new P("@ngrx/store Internal User Runtime Checks Config"),Bd=new P("@ngrx/store Internal Runtime Checks"),CE=new P("@ngrx/store Check if Action types are unique"),yE=new P("@ngrx/store Root Store Provider"),UA=new P("@ngrx/store Feature State Provider");function SH(t,n={}){let e=Object.keys(t),r={};for(let o=0;o<e.length;o++){let s=e[o];typeof t[s]=="function"&&(r[s]=t[s])}let i=Object.keys(r);return function(s,a){s=s===void 0?n:s;let l=!1,c={};for(let u=0;u<i.length;u++){let d=i[u],f=r[d],h=s[d],p=f(h,a);c[d]=p,l=l||p!==h}return l?c:s}}function DH(t,n){return Object.keys(t).filter(e=>e!==n).reduce((e,r)=>Object.assign(e,{[r]:t[r]}),{})}function YA(...t){return function(n){if(t.length===0)return n;let e=t[t.length-1];return t.slice(0,-1).reduceRight((i,o)=>o(i),e(n))}}function ZA(t,n){return Array.isArray(n)&&n.length>0&&(t=YA.apply(null,[...n,t])),(e,r)=>{let i=t(e);return(o,s)=>(o=o===void 0?r:o,i(o,s))}}function IH(t){let n=Array.isArray(t)&&t.length>0?YA(...t):e=>e;return(e,r)=>(e=n(e),(i,o)=>(i=i===void 0?r:i,e(i,o)))}var Vd=class extends Ie{},cg=class extends vc{},TH="@ngrx/store/update-reducers",ug=(()=>{class t extends Rt{get currentReducers(){return this.reducers}constructor(e,r,i,o){super(o(i,r)),this.dispatcher=e,this.initialState=r,this.reducers=i,this.reducerFactory=o}addFeature(e){this.addFeatures([e])}addFeatures(e){let r=e.reduce((i,{reducers:o,reducerFactory:s,metaReducers:a,initialState:l,key:c})=>{let u=typeof o=="function"?IH(a)(o,l):ZA(s,a)(o,l);return i[c]=u,i},{});this.addReducers(r)}removeFeature(e){this.removeFeatures([e])}removeFeatures(e){this.removeReducers(e.map(r=>r.key))}addReducer(e,r){this.addReducers({[e]:r})}addReducers(e){this.reducers=A(A({},this.reducers),e),this.updateReducers(Object.keys(e))}removeReducer(e){this.removeReducers([e])}removeReducers(e){e.forEach(r=>{this.reducers=DH(this.reducers,r)}),this.updateReducers(e)}updateReducers(e){this.next(this.reducerFactory(this.reducers,this.initialState)),this.dispatcher.next({type:TH,features:e})}ngOnDestroy(){this.complete()}static{this.\u0275fac=function(r){return new(r||t)(Q(cg),Q(EE),Q(JA),Q(KA))}}static{this.\u0275prov=O({token:t,factory:t.\u0275fac})}}return t})(),kH=[ug,{provide:Vd,useExisting:ug},{provide:cg,useExisting:vc}],SE=(()=>{class t extends ve{ngOnDestroy(){this.complete()}static{this.\u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})()}static{this.\u0275prov=O({token:t,factory:t.\u0275fac})}}return t})(),MH=[SE],dg=class extends Ie{},HA=(()=>{class t extends Rt{static{this.INIT=WA}constructor(e,r,i,o){super(o);let a=e.pipe(Bs(m_)).pipe(D_(r)),l={state:o},c=a.pipe(Yf(AH,l));this.stateSubscription=c.subscribe(({state:u,action:d})=>{this.next(u),i.next(d)}),this.state=er(this,{manualCleanup:!0,requireSync:!0})}ngOnDestroy(){this.stateSubscription.unsubscribe(),this.complete()}static{this.\u0275fac=function(r){return new(r||t)(Q(vc),Q(Vd),Q(SE),Q(EE))}}static{this.\u0275prov=O({token:t,factory:t.\u0275fac})}}return t})();function AH(t={state:void 0},[n,e]){let{state:r}=t;return{state:e(r,n),action:n}}var xH=[HA,{provide:dg,useExisting:HA}],DE=(()=>{class t extends Ie{constructor(e,r,i,o){super(),this.actionsObserver=r,this.reducerManager=i,this.injector=o,this.source=e,this.state=e.state}select(e,...r){return OH.call(null,e,...r)(this)}selectSignal(e,r){return le(()=>e(this.state()),r)}lift(e){let r=new t(this,this.actionsObserver,this.reducerManager);return r.operator=e,r}dispatch(e,r){if(typeof e=="function")return this.processDispatchFn(e,r);this.actionsObserver.next(e)}next(e){this.actionsObserver.next(e)}error(e){this.actionsObserver.error(e)}complete(){this.actionsObserver.complete()}addReducer(e,r){this.reducerManager.addReducer(e,r)}removeReducer(e){this.reducerManager.removeReducer(e)}processDispatchFn(e,r){bH(this.injector,"Store Injector");let i=r?.injector??NH()??this.injector;return ln(()=>{let o=e();nt(()=>this.dispatch(o))},{injector:i})}static{this.\u0275fac=function(r){return new(r||t)(Q(dg),Q(vc),Q(ug),Q(Re))}}static{this.\u0275prov=O({token:t,factory:t.\u0275fac})}}return t})(),RH=[DE];function OH(t,n,...e){return function(i){let o;
vendor: 5,309 bytes, line 11
11if(typeof t=="string"){let s=[n,...e].filter(Boolean);o=i.pipe(E_(t,...s))}else if(typeof t=="function")o=i.pipe(te(s=>t(s,n)));else throw new TypeError(`Unexpected type '${typeof t}' in select operator, expected 'string' or 'function'`);return o.pipe(so())}}function NH(){try{return y(Re)}catch{return}}var IE="https://ngrx.io/guide/store/configuration/runtime-checks";function $A(t){return t===void 0}function zA(t){return t===null}function XA(t){return Array.isArray(t)}function PH(t){return typeof t=="string"}function FH(t){return typeof t=="boolean"}function LH(t){return typeof t=="number"}function QA(t){return typeof t=="object"&&t!==null}function jH(t){return QA(t)&&!XA(t)}function BH(t){if(!jH(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function _E(t){return typeof t=="function"}function VH(t){return _E(t)&&t.hasOwnProperty("\u0275cmp")}function UH(t,n){return Object.prototype.hasOwnProperty.call(t,n)}function HH(t){return t instanceof P?y(t):t}function ex(t){return typeof t=="function"?t():t}function $H(t,n){return t.concat(n)}function zH(){if(y(DE,{optional:!0,skipSelf:!0}))throw new TypeError("The root Store has been provided more than once. Feature modules should provide feature states instead.");return"guarded"}function qH(t,n){return function(e,r){let i=n.action(r)?bE(r):r,o=t(e,i);return n.state()?bE(o):o}}function bE(t){Object.freeze(t);let n=_E(t);return Object.getOwnPropertyNames(t).forEach(e=>{if(!e.startsWith("\u0275")&&UH(t,e)&&(!n||e!=="caller"&&e!=="callee"&&e!=="arguments")){let r=t[e];(QA(r)||_E(r))&&!Object.isFrozen(r)&&bE(r)}}),t}function WH(t,n){return function(e,r){if(n.action(r)){let o=wE(r);qA(o,"action")}let i=t(e,r);if(n.state()){let o=wE(i);qA(o,"state")}return i}}function wE(t,n=[]){return($A(t)||zA(t))&&n.length===0?{path:["root"],value:t}:Object.keys(t).reduce((r,i)=>{if(r)return r;let o=t[i];return VH(o)?r:$A(o)||zA(o)||LH(o)||FH(o)||PH(o)||XA(o)?!1:BH(o)?wE(o,[...n,i]):{path:[...n,i],value:o}},!1)}function qA(t,n){if(t===!1)return;let e=t.path.join("."),r=new Error(`Detected unserializable ${n} at "${e}". ${IE}#strict${n}serializability`);throw r.value=t.value,r.unserializablePath=e,r}function GH(t,n){return function(e,r){if(n.action(r)&&!Ke.isInAngularZone())throw new Error(`Action '${r.type}' running outside NgZone. ${IE}#strictactionwithinngzone`);return t(e,r)}}function KH(t){return gw()?A({strictStateSerializability:!1,strictActionSerializability:!1,strictStateImmutability:!0,strictActionImmutability:!0,strictActionWithinNgZone:!1,strictActionTypeUniqueness:!1},t):{strictStateSerializability:!1,strictActionSerializability:!1,strictStateImmutability:!1,strictActionImmutability:!1,strictActionWithinNgZone:!1,strictActionTypeUniqueness:!1}}function JH({strictActionSerializability:t,strictStateSerializability:n}){return e=>t||n?WH(e,{action:r=>t&&!TE(r),state:()=>n}):e}function YH({strictActionImmutability:t,strictStateImmutability:n}){return e=>t||n?qH(e,{action:r=>t&&!TE(r),state:()=>n}):e}function TE(t){return t.type.startsWith("@ngrx")}function ZH({strictActionWithinNgZone:t}){return n=>t?GH(n,{action:e=>t&&!TE(e)}):n}function XH(t){return[{provide:VA,useValue:t},{provide:BA,useFactory:e5,deps:[VA]},{provide:Bd,deps:[BA],useFactory:KH},{provide:lg,multi:!0,deps:[Bd],useFactory:YH},{provide:lg,multi:!0,deps:[Bd],useFactory:JH},{provide:lg,multi:!0,deps:[Bd],useFactory:ZH}]}function QH(){return[{provide:CE,multi:!0,deps:[Bd],useFactory:t5}]}function e5(t){return t}function t5(t){if(!t.strictActionTypeUniqueness)return;let n=Object.entries(_H).filter(([,e])=>e>1).map(([e])=>e);if(n.length)throw new Error(`Action types are registered more than once, ${n.map(e=>`"${e}"`).join(", ")}. ${IE}#strictactiontypeuniqueness`)}function n5(t={},n={}){return[{provide:GA,useFactory:zH},{provide:NA,useValue:n.initialState},{provide:EE,useFactory:ex,deps:[NA]},{provide:vE,useValue:t},{provide:FA,useExisting:t instanceof P?t:vE},{provide:JA,deps:[vE,[new yb(FA)]],useFactory:HH},{provide:LA,useValue:n.metaReducers?n.metaReducers:[]},{provide:jA,deps:[lg,LA],useFactory:$H},{provide:PA,useValue:n.reducerFactory?n.reducerFactory:SH},{provide:KA,deps:[PA,jA],useFactory:ZA},wH,kH,MH,xH,RH,XH(n.runtimeChecks),QH()]}function r5(){y(vc),y(Vd),y(SE),y(DE),y(GA,{optional:!0}),y(CE,{optional:!0})}var i5=[{provide:yE,useFactory:r5},Mu(()=>y(yE))];function tx(t,n){return Or([...n5(t,n),i5])}function o5(){y(yE);let t=y(EH),n=y(CH),e=y(ug);y(CE,{optional:!0});let r=t.map((i,o)=>{let a=n.shift()[o];return Z(A({},i),{reducers:a,initialState:ex(i.initialState)})});e.addFeatures(r)}var Phe=[{provide:UA,useFactory:o5},Mu(()=>y(UA))];var $d=class{},rx=(()=>{class t{handle(e){return e.key}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})(),yc=class{},ix=(()=>{class t extends yc{compile(e,r){return e}compileTranslations(e,r){return e}static \u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})();static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})(),as=class{},ox=(()=>{class t extends as{getTranslation(e){return fe({})}static \u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})();static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})();function hg(t,n){if(t===n)return!0;
11if(t===null||n===null)return!1;if(t!==t&&n!==n)return!0;let e=typeof t,r=typeof n,i;if(e==r&&e=="object")if(Array.isArray(t)){if(!Array.isArray(n))return!1;if((i=t.length)==n.length){for(let o=0;o<i;o++)if(!hg(t[o],n[o]))return!1;return!0}}else{if(Array.isArray(n))return!1;if(yo(t)&&yo(n)){let o=Object.create(null);for(let s in t){if(!hg(t[s],n[s]))return!1;o[s]=!0}for(let s in n)if(!(s in o)&&typeof n[s]<"u")return!1;return!0}}return!1}function ss(t){return typeof t<"u"&&t!==null}function nx(t){return t!==void 0}function yo(t){return Hd(t)&&!Ta(t)&&t!==null}function Hd(t){return typeof t=="object"&&t!==null}function Ta(t){return Array.isArray(t)}function fg(t){return typeof t=="string"}function s5(t){return typeof t=="function"}function pg(t){if(Ta(t))return t.map(n=>pg(n));if(yo(t)){let n={};return Object.keys(t).forEach(e=>{n[e]=pg(t[e])}),n}else return t}function xE(t,n){if(!Hd(t))return pg(n);let e=pg(t);return Hd(e)&&Hd(n)&&Object.keys(n).forEach(r=>{yo(n[r])?r in t?e[r]=xE(t[r],n[r]):Object.assign(e,{[r]:n[r]}):Object.assign(e,{[r]:n[r]})}),e}function sx(t,n){let e=n.split(".");n="";do{n+=e.shift();let r=!e.length;if(ss(t)){if(yo(t)&&nx(t[n])&&(yo(t[n])||Ta(t[n])||r)){t=t[n],n="";continue}if(Ta(t)){let i=parseInt(n,10);if(nx(t[i])&&(yo(t[i])||Ta(t[i])||r)){t=t[i],n="";continue}}}if(r){t=void 0;continue}n+="."}while(e.length);return t}function a5(t,n,e){return xE(t,l5(n,e))}function l5(t,n){return t.split(".").reduceRight((e,r)=>({[r]:e}),n)}var _c=class{},ax=(()=>{class t extends _c{templateMatcher=/{{\s?([^{}\s]*)\s?}}/g;interpolate(e,r){if(fg(e))return this.interpolateString(e,r);if(s5(e))return this.interpolateFunction(e,r)}interpolateFunction(e,r){return e(r)}interpolateString(e,r){return r?e.replace(this.templateMatcher,(i,o)=>{let s=this.getInterpolationReplacement(r,o);return s!==void 0?s:i}):e}getInterpolationReplacement(e,r){return this.formatValue(sx(e,r))}formatValue(e){if(fg(e))return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(e===null)return"null";if(Ta(e))return e.join(", ");if(Hd(e))return typeof e.toString=="function"&&e.toString!==Object.prototype.toString?e.toString():JSON.stringify(e)}static \u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})();static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})(),kE=(()=>{class t{_onTranslationChange=new ve;_onLangChange=new ve;_onFallbackLangChange=new ve;fallbackLang=null;currentLang;translations={};languages=[];getTranslations(e){return this.translations[e]}setTranslations(e,r,i){this.translations[e]=i&&this.hasTranslationFor(e)?xE(this.translations[e],r):r,this.addLanguages([e]),this._onTranslationChange.next({lang:e,translations:this.getTranslations(e)})}getLanguages(){return this.languages}getCurrentLang(){return this.currentLang}getFallbackLang(){return this.fallbackLang}setFallbackLang(e,r=!0){this.fallbackLang=e,r&&this._onFallbackLangChange.next({lang:e,translations:this.translations[e]})}setCurrentLang(e,r=!0){this.currentLang=e,r&&this._onLangChange.next({lang:e,translations:this.translations[e]})}get onTranslationChange(){return this._onTranslationChange.asObservable()}get onLangChange(){return this._onLangChange.asObservable()}get onFallbackLangChange(){return this._onFallbackLangChange.asObservable()}addLanguages(e){this.languages=Array.from(new Set([...this.languages,...e]))}hasTranslationFor(e){return typeof this.translations[e]<"u"}deleteTranslations(e){delete this.translations[e]}getTranslation(e){let r=this.getValue(this.currentLang,e);return r===void 0&&this.fallbackLang!=null&&this.fallbackLang!==this.currentLang&&(r=this.getValue(this.fallbackLang,e)),r}getValue(e,r){return sx(this.getTranslations(e),r)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})(),ME=new P("TRANSLATE_CONFIG"),Ud=t=>cr(t)?t:fe(t);var Jt=(()=>{class t{loadingTranslations;pending=!1;_translationRequests={};lastUseLanguage=null;currentLoader=y(as);compiler=y(yc);parser=y(_c);missingTranslationHandler=y($d);store=y(kE);extend=!1;get onTranslationChange(){return this.store.onTranslationChange}get onLangChange(){return this.store.onLangChange}get onFallbackLangChange(){return this.store.onFallbackLangChange}get onDefaultLangChange(){return this.store.onFallbackLangChange}constructor(){let e=A({extend:!1,fallbackLang:null},y(ME,{optional:!0}));e.lang&&this.use(e.lang),e.fallbackLang&&this.setFallbackLang(e.fallbackLang),e.extend&&(this.extend=!0)}setFallbackLang(e){this.getFallbackLang()||this.store.setFallbackLang(e,!1);let r=this.loadOrExtendLanguage(e);return cr(r)?(r.pipe(It(1)).subscribe({next:()=>{this.store.setFallbackLang(e)},error:()=>{}}),r):(this.store.setFallbackLang(e),fe(this.store.getTranslations(e)))}use(e){this.lastUseLanguage=e,this.getCurrentLang()||this.store.setCurrentLang(e,!1);let r=this.loadOrExtendLanguage(e);return cr(r)?(r.pipe(It(1)).subscribe({next:()=>{this.changeLang(e)},error:()=>{}}),r):(this.changeLang(e),fe(this.store.getTranslations(e)))}loadOrExtendLanguage(e){if(!this.store.hasTranslationFor(e)||this.extend)return this._translationRequests[e]=this._translationRequests[e]||this.loadAndCompileTranslations(e),this._translationRequests[e]}changeLang(e){e===this.lastUseLanguage&&this.store.setCurrentLang(e)}getCurrentLang(){return this.store.getCurrentLang()}loadAndCompileTranslations(e){this.pending=!0;let r=this.currentLoader.getTranslation(e).pipe(_u(1),It(1));return this.loadingTranslations=r.pipe(te(i=>this.compiler.compileTranslations(i,e)),_u(1),It(1)),this.loadingTranslations.subscribe({next:i=>{this.store.setTranslations(e,i,this.extend),this.pending=!1},error:i=>{this.pending=!1}}),r}setTranslation(e,r,i=!1){let o=this.compiler.compileTranslations(r,e);this.store.setTranslations(e,o,i||this.extend)}getLangs(){return this.store.getLanguages()}addLangs(e){this.store.addLanguages(e)}getParsedResultForKey(e,r){let i=this.getTextToInterpolate(e);if(ss(i))return this.runInterpolation(i,r);let o=this.missingTranslationHandler.handle(A({key:e,translateService:this},r!==void 0&&{interpolateParams:r}));return o!==void 0?o:e}getFallbackLang(){return this.store.getFallbackLang()}getTextToInterpolate(e){return this.store.getTranslation(e)}runInterpolation(e,r){if(ss(e))return Ta(e)?this.runInterpolationOnArray(e,r):yo(e)?this.runInterpolationOnDict(e,r):this.parser.interpolate(e,r)}runInterpolationOnArray(e,r){return e.map(i=>this.runInterpolation(i,r))}runInterpolationOnDict(e,r){let i={};for(let o in e){let s=this.runInterpolation(e[o],r);
11s!==void 0&&(i[o]=s)}return i}getParsedResult(e,r){return e instanceof Array?this.getParsedResultForArray(e,r):this.getParsedResultForKey(e,r)}getParsedResultForArray(e,r){let i={},o=!1;for(let a of e)i[a]=this.getParsedResultForKey(a,r),o=o||cr(i[a]);if(!o)return i;let s=e.map(a=>Ud(i[a]));return Us(s).pipe(te(a=>{let l={};return a.forEach((c,u)=>{l[e[u]]=c}),l}))}get(e,r){if(!ss(e)||!e.length)throw new Error('Parameter "key" is required and cannot be empty');return this.pending?this.loadingTranslations.pipe(Ii(()=>Ud(this.getParsedResult(e,r)))):Ud(this.getParsedResult(e,r))}getStreamOnTranslationChange(e,r){if(!ss(e)||!e.length)throw new Error('Parameter "key" is required and cannot be empty');return ii(Di(()=>this.get(e,r)),this.onTranslationChange.pipe(Tt(()=>{let i=this.getParsedResult(e,r);return Ud(i)})))}stream(e,r){if(!ss(e)||!e.length)throw new Error('Parameter "key" required');return ii(Di(()=>this.get(e,r)),this.onLangChange.pipe(Tt(()=>{let i=this.getParsedResult(e,r);return Ud(i)})))}instant(e,r){if(!ss(e)||e.length===0)throw new Error('Parameter "key" is required and cannot be empty');let i=this.getParsedResult(e,r);return cr(i)?Array.isArray(e)?e.reduce((o,s)=>(o[s]=s,o),{}):e:i}set(e,r,i=this.getCurrentLang()){this.store.setTranslations(i,a5(this.store.getTranslations(i),e,fg(r)?this.compiler.compile(r,i):this.compiler.compileTranslations(r,i)),!1)}reloadLang(e){return this.resetLang(e),this.loadAndCompileTranslations(e)}
11resetLang(e){delete this._translationRequests[e],this.store.deleteTranslations(e)}static getBrowserLang(){if(typeof window>"u"||!window.navigator)return;let e=this.getBrowserCultureLang();return e?e.split(/[-_]/)[0]:void 0}static getBrowserCultureLang(){if(!(typeof window>"u"||typeof window.navigator>"u"))return window.navigator.languages?window.navigator.languages[0]:window.navigator.language||window.navigator.browserLanguage||window.navigator.userLanguage}getBrowserLang(){return t.getBrowserLang()}getBrowserCultureLang(){return t.getBrowserCultureLang()}get defaultLang(){return this.getFallbackLang()}get currentLang(){return this.store.getCurrentLang()}get langs(){return this.store.getLanguages()}setDefaultLang(e){return this.setFallbackLang(e)}getDefaultLang(){return this.getFallbackLang()}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})();var zt=(()=>{class t{translate=y(Jt);_ref=y(zn);value="";lastKey=null;lastParams=[];onTranslationChange;onLangChange;onFallbackLangChange;
11updateValue(e,r,i){let o=s=>{this.value=s!==void 0?s:e,this.lastKey=e,this._ref.markForCheck()};if(i){let s=this.translate.getParsedResult(e,r);cr(s)?s.subscribe(o):o(s)}this.translate.get(e,r).subscribe(o)}transform(e,...r){if(!e||!e.length)return e;if(hg(e,this.lastKey)&&hg(r,this.lastParams))return this.value;let i;if(ss(r[0])&&r.length)if(fg(r[0])&&r[0].length){let o=r[0].replace(/(')?([a-zA-Z0-9_]+)(')?(\s)?:/g,'"$2":').replace(/:(\s)?(')(.*?)(')/g,':"$3"');try{i=JSON.parse(o)}catch(s){throw new SyntaxError(`Wrong parameter in TranslatePipe. Expected a valid Object, received: ${r[0]}`)}}else yo(r[0])&&(i=r[0]);return this.lastKey=e,this.lastParams=r,this.updateValue(e,i),this._dispose(),this.onTranslationChange||(this.onTranslationChange=this.translate.onTranslationChange.subscribe(o=>{(this.lastKey&&o.lang===this.translate.getCurrentLang()||o.lang===this.translate.getFallbackLang())&&(this.lastKey=null,this.updateValue(e,i,o.translations))})),this.onLangChange||(this.onLangChange=this.translate.onLangChange.subscribe(o=>{this.lastKey&&(this.lastKey=null,this.updateValue(e,i,o.translations))})),this.onFallbackLangChange||(this.onFallbackLangChange=this.translate.onFallbackLangChange.subscribe(()=>{this.lastKey&&(this.lastKey=null,this.updateValue(e,i))})),this.value}_dispose(){typeof this.onTranslationChange<"u"&&(this.onTranslationChange.unsubscribe(),this.onTranslationChange=void 0),typeof this.onLangChange<"u"&&(this.onLangChange.unsubscribe(),this.onLangChange=void 0),typeof this.onFallbackLangChange<"u"&&(this.onFallbackLangChange.unsubscribe(),this.onFallbackLangChange=void 0)}ngOnDestroy(){this._dispose()}static \u0275fac=function(r){return new(r||t)};static \u0275pipe=rd({name:"translate",type:t,pure:!1});static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})();function lx(t){return{provide:as,useClass:t}}function cx(t){return{provide:yc,useClass:t}}function ux(t){return{provide:_c,useClass:t}}function dx(t){return{provide:$d,useClass:t}}function hx(t={}){return AE(A({compiler:cx(ix),parser:ux(ax),loader:lx(ox),missingTranslationHandler:dx(rx)},t),!0)}function AE(t={},n){let e=[];t.loader&&e.push(t.loader),t.compiler&&e.push(t.compiler),t.parser&&e.push(t.parser),t.missingTranslationHandler&&e.push(t.missingTranslationHandler),n&&e.push(kE),(t.useDefaultLang||t.defaultLanguage)&&(console.warn("The `useDefaultLang` and `defaultLanguage` options are deprecated. Please use `fallbackLang` instead."),t.useDefaultLang===!0&&t.defaultLanguage&&(t.fallbackLang=t.defaultLanguage));let r={fallbackLang:t.fallbackLang??null,lang:t.lang,extend:t.extend??!1};return e.push({provide:ME,useValue:r}),e.push({provide:Jt,useClass:Jt,deps:[kE,as,yc,_c,$d,ME]}),e}var qt=(()=>{class t{static forRoot(e={}){return{ngModule:t,providers:[...AE(A({compiler:cx(ix),parser:ux(ax),loader:lx(ox),missingTranslationHandler:dx(rx)},e),!0)]}}static forChild(e={}){return{ngModule:t,providers:[...AE(e,e.isolate??!1)]}}static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({})}return t})();var RE=new P("TRANSLATE_HTTP_LOADER_CONFIG"),c5=(()=>{class t{http;config;constructor(){this.config=A({prefix:"/assets/i18n/",suffix:".json",enforceLoading:!1,useHttpBackend:!1},y(RE)),this.http=this.config.useHttpBackend?new es(y(ic)):y(es)}getTranslation(e){let r=this.config.enforceLoading?`?enforceLoading=${Date.now()}`:"";return this.http.get(`${this.config.prefix}${e}${this.config.suffix}${r}`)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac})}return t})();function fx(t={}){let n=t.useHttpBackend??!1;return[{provide:RE,useValue:t},{provide:as,useClass:c5,deps:[n?ic:es,RE]}]}Ut();var px=t=>t?(...n)=>t(...n):(...n)=>fetch(...n);var zd=class extends Error{constructor(n,e="FunctionsError",r){super(n),this.name=e,this.context=r}},mg=class extends zd{constructor(n){super("Failed to send a request to the Edge Function","FunctionsFetchError",n)}},qd=class extends zd{constructor(n){super("Relay Error invoking the Edge Function","FunctionsRelayError",n)}},Wd=class extends zd{constructor(n){super("Edge Function returned a non-2xx status code","FunctionsHttpError",n)}},OE=(function(t){return t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2",t})(OE||{});var Gd=class{constructor(n,{headers:e={},customFetch:r,region:i=OE.Any}={}){this.url=n,this.headers=e,this.region=i,this.fetch=px(r)}setAuth(n){this.headers.Authorization=`Bearer ${n}`}invoke(n){return W(this,arguments,void 0,function*(e,r={}){var i;let o,s;try{let{headers:a,method:l,body:c,signal:u,timeout:d}=r,f={},{region:h}=r;h||(h=this.region);let p=new URL(`${this.url}/${e}`);h&&h!=="any"&&(f["x-region"]=h,p.searchParams.set("forceFunctionRegion",h));let m;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",m=c):typeof c=="string"?(f["Content-Type"]="text/plain",m=c):typeof FormData<"u"&&c instanceof FormData?m=c:(f["Content-Type"]="application/json",m=JSON.stringify(c)):m=c;let g=u;d&&(s=new AbortController,o=setTimeout(()=>s.abort(),d),u?(g=s.signal,u.addEventListener("abort",()=>s.abort())):g=s.signal);let w=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),a),body:m,signal:g}).catch(F=>{throw new mg(F)}),C=w.headers.get("x-relay-error");
11if(C&&C==="true")throw new qd(w);if(!w.ok)throw new Wd(w);let T=((i=w.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),I;return T==="application/json"?I=yield w.json():T==="application/octet-stream"||T==="application/pdf"?I=yield w.blob():T==="text/event-stream"?I=w:T==="multipart/form-data"?I=yield w.formData():I=yield w.text(),{data:I,error:null,response:w}}catch(a){return{data:null,error:a,response:a instanceof Wd||a instanceof qd?a.context:void 0}}finally{o&&clearTimeout(o)}})}};var YE=qF(Cx(),1),{PostgrestClient:Sx,PostgrestQueryBuilder:pfe,PostgrestFilterBuilder:mfe,PostgrestTransformBuilder:gfe,PostgrestBuilder:vfe,PostgrestError:b5}=YE.default||YE;var ZE=class{constructor(){}static detectEnvironment(){var n;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((n=navigator.userAgent)===null||n===void 0)&&n.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){let e=process.versions;if(e&&e.node){let r=e.node,i=parseInt(r.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: 12import ws from "ws" 13new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let n=this.detectEnvironment();if(n.constructor)return n.constructor;let e=n.error||"WebSocket not supported in this environment.";throw n.workaround&&(e+=` 14 15Suggested solution: ${n.workaround}`),new Error(e)}static createWebSocket(n,e){let r=this.getWebSocketConstructor();return new r(n,e)}static isWebSocketSupported(){try{let n=this.detectEnvironment();return n.type==="native"||n.type==="ws"}catch{return!1}}},XE=ZE;var Dx="2.86.0";var Ix=`realtime-js/${Dx}`,QE="1.0.0",Tx="2.0.0",eC=QE;var Jd=1e4,kx=1e3,Mx=100,ka=(function(t){return t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed",t})(ka||{}),bn=(function(t){return t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving",t})(bn||{}),qr=(function(t){return t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token",t})(qr||{}),tC=(function(t){return t.websocket="websocket",t})(tC||{}),Ma=(function(t){return t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed",t})(Ma||{});var vg=class{constructor(n){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=n??[]}encode(n,e){if(n.event===this.BROADCAST_EVENT&&!(n.payload instanceof ArrayBuffer)&&typeof n.payload.event=="string")return e(this._binaryEncodeUserBroadcastPush(n));let r=[n.join_ref,n.ref,n.topic,n.event,n.payload];return e(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(n){var e;return this._isArrayBuffer((e=n.payload)===null||e===void 0?void 0:e.payload)?this._encodeBinaryUserBroadcastPush(n):this._encodeJsonUserBroadcastPush(n)}_encodeBinaryUserBroadcastPush(n){var e,r;let i=(r=(e=n.payload)===null||e===void 0?void 0:e.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(n,this.BINARY_ENCODING,i)}_encodeJsonUserBroadcastPush(n){var e,r;let i=(r=(e=n.payload)===null||e===void 0?void 0:e.payload)!==null&&r!==void 0?r:{},s=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(n,this.JSON_ENCODING,s)}_encodeUserBroadcastPush(n,e,r){var i,o;let s=n.topic,a=(i=n.ref)!==null&&i!==void 0?i:"",l=(o=n.join_ref)!==null&&o!==void 0?o:"",c=n.payload.event,u=this.allowedMetadataKeys?this._pick(n.payload,this.allowedMetadataKeys):{},d=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(s.length>255)throw new Error(`topic length ${s.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);let f=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+s.length+c.length+d.length,h=new ArrayBuffer(this.HEADER_LENGTH+f),p=new DataView(
15h),m=0;p.setUint8(m++,this.KINDS.userBroadcastPush),p.setUint8(m++,l.length),p.setUint8(m++,a.length),p.setUint8(m++,s.length),p.setUint8(m++,c.length),p.setUint8(m++,d.length),p.setUint8(m++,e),Array.from(l,w=>p.setUint8(m++,w.charCodeAt(0))),Array.from(a,w=>p.setUint8(m++,w.charCodeAt(0))),Array.from(s,w=>p.setUint8(m++,w.charCodeAt(0))),Array.from(c,w=>p.setUint8(m++,w.charCodeAt(0))),Array.from(d,w=>p.setUint8(m++,w.charCodeAt(0)));var g=new Uint8Array(h.byteLength+r.byteLength);return g.set(new Uint8Array(h),0),g.set(new Uint8Array(r),h.byteLength),g.buffer}decode(n,e){if(this._isArrayBuffer(n)){let r=this._binaryDecode(n);return e(r)}if(typeof n=="string"){let r=JSON.parse(n),[i,o,s,a,l]=r;return e({join_ref:i,ref:o,topic:s,event:a,payload:l})}return e({})}_binaryDecode(n){let e=new DataView(n),r=e.getUint8(0),i=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(n,e,i)}}_decodeUserBroadcast(n,e,r){let i=e.getUint8(1),o=e.getUint8(2),s=e.getUint8(3),a=e.getUint8(4),l=this.HEADER_LENGTH+4,c=r.decode(n.slice(l,l+i));l=l+i;let u=r.decode(n.slice(l,l+o));l=l+o;let d=r.decode(n.slice(l,l+s));l=l+s;let f=n.slice(l,n.byteLength),h=a===this.JSON_ENCODING?JSON.parse(r.decode(f)):f,p={type:this.BROADCAST_EVENT,event:u,payload:h};return s>0&&(p.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(n){var e;return n instanceof ArrayBuffer||((e=n?.constructor)===null||e===void 0?void 0:e.name)==="ArrayBuffer"}_pick(n,e){return!n||typeof n!="object"?{}:Object.fromEntries(Object.entries(n).filter(([r])=>e.includes(r)))}};var wc=class{constructor(n,e){this.callback=n,this.timerCalc=e,this.timer=void 0,this.tries=0,this.callback=n,this.timerCalc=e}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};var Ft=(function(t){return t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange",t})(Ft||{}),rC=(t,n,e={})=>{var r;let i=(r=e.skipTypes)!==null&&r!==void 0?r:[];return n?Object.keys(n).reduce((o,s)=>(o[s]=w5(s,t,n,i),o),{}):{}},w5=(t,n,e,r)=>{let i=n.find(a=>a.name===t),o=i?.type,s=e[t];return o&&!r.includes(o)?Ax(o,s):nC(s)},Ax=(t,n)=>{if(t.charAt(0)==="_"){let e=t.slice(1,t.length);return D5(n,e)}switch(t){case Ft.bool:return E5(n);case Ft.float4:case Ft.float8:case Ft.int2:case Ft.int4:case Ft.int8:case Ft.numeric:case Ft.oid:return C5(n);case Ft.json:case Ft.jsonb:return S5(n);case Ft.timestamp:return I5(n);case Ft.abstime:case Ft.date:case Ft.daterange:case Ft.int4range:case Ft.int8range:case Ft.money:case Ft.reltime:case Ft.text:case Ft.time:case Ft.timestamptz:case Ft.timetz:case Ft.tsrange:case Ft.tstzrange:return nC(n);default:return nC(n)}},nC=t=>t,E5=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},C5=t=>{if(typeof t=="string"){let n=parseFloat(t);if(!Number.isNaN(n))return n}return t},S5=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(n){return console.log(`JSON parse error: ${n}`),t}return t},D5=(t,n)=>{if(typeof t!="string")return t;let e=t.length-1,r=t[e];if(t[0]==="{"&&r==="}"){let o,s=t.slice(1,e);try{o=JSON.parse("["+s+"]")}catch{o=s?s.split(","):[]}return o.map(a=>Ax(n,a))}return t},I5=t=>typeof t=="string"?t.replace(" ","T"):t,yg=t=>{let n=new URL(t);return n.protocol=n.protocol.replace(/^ws/i,"http"),n.pathname=n.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),n.pathname===""||n.pathname==="/"?n.pathname="/api/broadcast":n.pathname=n.pathname+"/api/broadcast",n.href};var Ec=class{constructor(n,e,r={},i=Jd){this.channel=n,this.event=e,this.payload=r,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHo
15oks=[],this.refEvent=null}resend(n){this.timeout=n,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(n){this.payload=Object.assign(Object.assign({},this.payload),n)}receive(n,e){var r;return this._hasReceived(n)&&e((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:n,callback:e}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let n=e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)};this.channel._on(this.refEvent,{},n),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(n,e){this.refEvent&&this.channel._trigger(this.refEvent,{status:n,response:e})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:n,response:e}){this.recHooks.filter(r=>r.status===n).forEach(r=>r.callback(e))}_hasReceived(n){return this.receivedResp&&this.receivedResp.status===n}};var Yd=class t{constructor(n,e){this.channel=n,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let r=e?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},i=>{let{onJoin:o,onLeave:s,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=t.syncState(this.state,i,o,s),this.pendingDiffs.forEach(l=>{this.state=t.syncDiff(this.state,l,o,s)}),this.pendingDiffs=[],a()}),this.channel._on(r.diff,{},i=>{let{onJoin:o,onLeave:s,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=t.syncDiff(this.state,i,o,s),a())}),this.onJoin((i,o,s)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:o,newPresences:s})}),this.onLeave((i,o,s)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:o,leftPresences:s})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(n,e,r,i){let o=this.cloneDeep(n),s=this.transformState(e),a={},l={};return this.map(o,(c,u)=>{s[c]||(l[c]=u)}),this.map(s,(c,u)=>{let d=o[c];if(d){let f=u.map(g=>g.presence_ref),h=d.map(g=>g.presence_ref),p=u.filter(g=>h.indexOf(g.presence_ref)<0),m=d.filter(g=>f.indexOf(g.presence_ref)<0);p.length>0&&(a[c]=p),m.length>0&&(l[c]=m)}else a[c]=u}),this.syncDiff(o,{joins:a,leaves:l},r,i)}static syncDiff(n,e,r,i){let{joins:o,leaves:s}={joins:this.transformState(e.joins),leaves:this.transformState(e.leaves)};return r||(r=()=>{}),i||(i=()=>{}),this.map(o,(a,l)=>{var c;let u=(c=n[a])!==null&&c!==void 0?c:[];if(n[a]=this.cloneDeep(l),u.length>0){let d=n[a].map(h=>h.presence_ref),f=u.filter(h=>d.indexOf(h.presence_ref)<0);n[a].unshift(...f)}r(a,u,l)}),this.map(s,(a,l)=>{let c=n[a];if(!c)return;let u=l.map(d=>d.presence_ref);c=c.filter(d=>u.indexOf(d.presence_ref)<0),n[a]=c,i(a,c,l),c.length===0&&delete n[a]}),n}static map(n,e){return Object.getOwnPropertyNames(n).map(r=>e(r,n[r]))}static transformState(n){return n=this.cloneDeep(n),Object.getOwnPropertyNames(n).reduce((e,r)=>{let i=n[r];return"metas"in i?e[r]=i.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):e[r]=i,e},{})}static cloneDeep(n){return JSON.parse(JSON.stringify(n))}onJoin(n){this.caller.onJoin=n}onLeave(n){this.caller.onLeave=n}onSync(n){this.caller.onSync=n}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}};var Zd=(function(t){return t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system",t})(Zd||{}),_o=(function(t){return t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR",t})(_o||{});var Xd=class t{constructor(n,e={config:{}},r){var i,o;if(this.topic=n,this.params=e,this.socket=r,this.bindings={},this.state=bn.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=n.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config),this.timeout=this.socket.timeout,this.joinPush=new Ec(this,qr.join,this.params,this.timeout),this.rejoinTimer=new wc(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=bn.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=bn.closed,this.socket._remove(this)}),this._onError(s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=bn.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=bn.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",s=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=bn.errored,this.rejoinTimer.scheduleTimeout())}),this._on(qr.reply,{},(s,a)=>{this._trigger(this._replyEventName(a),s)}),this.presence=new Yd(this),this.broadcastEndpointURL=yg(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||o===void 0)&&o.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(n,e=this.timeout){var r,i,o;if(this.socket.isConnected()||this.socket.connect(),this.state==bn.closed){let{config:{broadcast:s,presence:a,private:l}}=this.params,c=(i=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(h=>h.filter))!==null&&i!==void 0?i:[],u=!!this.bindings[Zd.PRESENCE]&&this.bindings[Zd.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,d={},f={broadcast:s,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(h=>n?.(_o.CHANNEL_ERROR,h)),this._onClose(()=>n?.(_o.CLOSED)),this.updateJoinPayload(Object.assign({config:f},d)),this.joinedOnce=!0,this._rejoin(e),this.joinPush.receive("ok",async({postgres_changes:h})=>{var p;if(this.socket.setAuth(),h===void 0){n?.(_o.SUBSCRIBED);return}else{let m=this.bindings.postgres_changes,g=(p=m?.length)!==null&&p!==void 0?p:0,w=[];for(let C=0;C<g;C++){let T=m[C],{filter:{event:I,schema:F,table:$,filter:q}}=T,G=h&&h[C];if(G&&G.event===I&&G.schema===F&&G.table===$&&G.filter===q)w.push(Object.assign(Object.assign({},T),{id:G.id}));else{this.unsubscribe(),this.state=bn.errored,n?.(_o.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=w,n&&n(_o.SUBSCRIBED);return}}).receive("error",h=>{this.state=bn.errored,n?.(_o.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(h).join(", ")||"error")))}).receive("timeout",()=>{n?.(_o.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(n,e={}){return await this.send({type:"presence",event:"track",payload:n},e.timeout||this.timeout)}async untrack(n={}){return await this.send({type:"presence",event:"untrack"},n)}on(n,e,r){return this.state===bn.joined&&n===Zd.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(n,e,r)}async httpSend(n,e,r={}){var i;let o=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(e==null)return Promise.reject("Payload is required for httpSend()");let s={method:"POST",headers:{Authorization:o,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:n,payload:e,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,s,(i=r.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;
15try{let c=await a.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(n,e={}){var r,i;if(!this._canPush()&&n.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");let{event:o,payload:s}=n,l={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:s,private:this.private}]})};try{let c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=e.timeout)!==null&&r!==void 0?r:this.timeout);return await((i=c.body)===null||i===void 0?void 0:i.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var s,a,l;let c=this._push(n.type,n,e.timeout||this.timeout);n.type==="broadcast"&&!(!((l=(a=(s=this.params)===null||s===void 0?void 0:s.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&o("ok"),c.receive("ok",()=>o("ok")),c.receive("error",()=>o("error")),c.receive("timeout",()=>o("timed out"))})}updateJoinPayload(n){this.joinPush.updatePayload(n)}unsubscribe(n=this.timeout){this.state=bn.leaving;let e=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(qr.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(i=>{r=new Ec(this,qr.leave,{},n),r.receive("ok",()=>{e(),i("ok")}).receive("timeout",()=>{e(),i("timed out")}).receive("error",()=>{i("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r?.destroy()})}teardown(){this.pushBuffer.forEach(n=>n.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=bn.closed,this.bindings={}}async _fetchWithTimeout(n,e,r){let i=new AbortController,o=setTimeout(()=>i.abort(),r),s=await this.socket.fetch(n,Object.assign(Object.assign({},e),{signal:i.signal}));return clearTimeout(o),s}_push(n,e,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${n}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new Ec(this,n,e,r);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(n){if(n.startTimeout(),this.pushBuffer.push(n),this.pushBuffer.length>Mx){let e=this.pushBuffer.shift();e&&(e.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${e.event}`,e.payload))}}_onMessage(n,e,r){return e}_isMember(n){return this.topic===n}_joinRef(){return this.joinPush.ref}_trigger(n,e,r){var i,o;let s=n.toLocaleLowerCase(),{close:a,error:l,leave:c,join:u}=qr;if(r&&[a,l,c,u].indexOf(s)>=0&&r!==this._joinRef())return;let f=this._onMessage(s,e,r);if(e&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(s)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(h=>{var p,m,g;return((p=h.filter)===null||p===void 0?void 0:p.event)==="*"||((g=(m=h.filter)===null||m===void 0?void 0:m.event)===null||g===void 0?void 0:g.toLocaleLowerCase())===s}).map(h=>h.callback(f,r)):(o=this.bindings[s])===null||o===void 0||o.filter(h=>{var p,m,g,w,C,T;if(["broadcast","presence","postgres_changes"].includes(s))if("id"in h){let I=h.id,F=(p=h.filter)===null||p===void 0?void 0:p.event;return I&&((m=e.ids)===null||m===void 0?void 0:m.includes(I))&&(F==="*"||F?.toLocaleLowerCase()===((g=e.data)===null||g===void 0?void 0:g.type.toLocaleLowerCase()))}else{let I=(C=(w=h?.filter)===null||w===void 0?void 0:w.event)===null||C===void 0?void 0:C.toLocaleLowerCase();return I==="*"||I===((T=e?.event)===null||T===void 0?void 0:T.toLocaleLowerCase())}else return h.type.toLocaleLowerCase()===s}).map(h=>{if(typeof f=="object"&&"ids"in f){let p=f.data,{schema:m,table:g,commit_timestamp:w,type:C,errors:T}=p;f=Object.assign(Object.assign({},{schema:m,table:g,commit_timestamp:w,eventType:C,new:{},old:{},errors:T}),this._getPayloadRecords(p))}h.callback(f,r)}
15)}_isClosed(){return this.state===bn.closed}_isJoined(){return this.state===bn.joined}_isJoining(){return this.state===bn.joining}_isLeaving(){return this.state===bn.leaving}_replyEventName(n){return`chan_reply_${n}`}_on(n,e,r){let i=n.toLocaleLowerCase(),o={type:i,filter:e,callback:r};return this.bindings[i]?this.bindings[i].push(o):this.bindings[i]=[o],this}_off(n,e){let r=n.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(i=>{var o;return!(((o=i.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===r&&t.isEqual(i.filter,e))})),this}static isEqual(n,e){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(let r in n)if(n[r]!==e[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(n){this._on(qr.close,{},n)}_onError(n){this._on(qr.error,{},e=>n(e))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(n=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=bn.joining,this.joinPush.resend(n))}_getPayloadRecords(n){let e={new:{},old:{}};return(n.type==="INSERT"||n.type==="UPDATE")&&(e.new=rC(n.columns,n.record)),(n.type==="UPDATE"||n.type==="DELETE")&&(e.old=rC(n.columns,n.old_record)),e}};var iC=()=>{},_g={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},k5=[1e3,2e3,5e3,1e4],M5=1e4,A5=` 16 addEventListener("message", (e) => { 17 if (e.data.event === "start") { 18 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 19 } 20 });`,Qd=class{constructor(n,e){var r;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Jd,this.transport=null,this.heartbeatIntervalMs=_g.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=iC,this.ref=0,this.reconnectTimer=null,this.vsn=eC,this.logger=iC,this.conn=null,this.sendBuffer=[],this.serializer=new vg,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((r=e?.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=e.params.apikey,this.endPoint=`${n}/${tC.websocket}`,this.httpEndpoint=yg(n),this._initializeOptions(e),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(e?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=XE.createWebSocket(this.endpointURL())}catch(n){this._setConnectionState("disconnected");let e=n.message;throw e.includes("Node.js")?new Error(`${e} 21 22To use Realtime in Node.js, you need to provide a WebSocket implementation: 23 24Option 1: Use Node.js 22+ which has native WebSocket support 25Option 2: Install and provide the "ws" package: 26 27 npm install ws 28 29 import ws from "ws" 30 const client = new RealtimeClient(url, { 31 ...options, 32 transport: ws 33 })`):new Error(`WebSocket not available: ${e}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(n,e){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){let r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(n?this.conn.close(n,e??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(n){let e=await n.unsubscribe();return this.channels.length===0&&this.disconnect(),e}async removeAllChannels(){let n=await Promise.all(this.channels.map(e=>e.unsubscribe()));return this.channels=[],this.disconnect(),n}log(n,e,r){this.logger(n,e,r)}connectionState(){switch(this.conn&&this.conn.readyState){case ka.connecting:return Ma.Connecting;case ka.open:return Ma.Open;case ka.closing:return Ma.Closing;default:return Ma.Closed}}isConnected(){return this.connectionState()===Ma.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}
33channel(n,e={config:{}}){let r=`realtime:${n}`,i=this.getChannels().find(o=>o.topic===r);if(i)return i;{let o=new Xd(`realtime:${n}`,e,this);return this.channels.push(o),o}}push(n){let{topic:e,event:r,payload:i,ref:o}=n,s=()=>{this.encode(n,a=>{var l;(l=this.conn)===null||l===void 0||l.send(a)})};this.log("push",`${e} ${r} (${o})`,i),this.isConnected()?s():this.sendBuffer.push(s)}async setAuth(n=null){this._authPromise=this._performAuth(n);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var n;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this._wasManualDisconnect=!1,(n=this.conn)===null||n===void 0||n.close(kx,"heartbeat timeout"),setTimeout(()=>{var e;this.isConnected()||(e=this.reconnectTimer)===null||e===void 0||e.scheduleTimeout()},_g.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this._setAuthSafely("heartbeat")}onHeartbeat(n){this.heartbeatCallback=n}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(n=>n()),this.sendBuffer=[])}_makeRef(){let n=this.ref+1;return n===this.ref?this.ref=0:this.ref=n,this.ref.toString()}_leaveOpenTopic(n){let e=this.channels.find(r=>r.topic===n&&(r._isJoined()||r._isJoining()));e&&(this.log("transport",`leaving duplicate topic "${n}"`),e.unsubscribe())}_remove(n){this.channels=this.channels.filter(e=>e.topic!==n.topic)}_onConnMessage(n){this.decode(n.data,e=>{if(e.topic==="phoenix"&&e.event==="phx_reply")try{this.heartbeatCallback(e.payload.status==="ok"?"ok":"error")}catch(c){this.log("error","error in heartbeat callback",c)}e.ref&&e.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);let{topic:r,event:i,payload:o,ref:s}=e,a=s?`(${s})`:"",l=o.status||"";this.log("receive",`${l} ${r} ${i} ${a}`.trim(),o),this.channels.filter(c=>c._isMember(r)).forEach(c=>c._trigger(i,o,s)),this._triggerStateCallbacks("message",e)})}_clearTimer(n){var e;n==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):n==="reconnect"&&((e=this.reconnectTimer)===null||e===void 0||e.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=n=>this._onConnError(n),this.conn.onmessage=n=>this._onConnMessage(n),this.conn.onclose=n=>this._onConnClose(n))}_teardownConnection(){if(this.conn){if(this.conn.readyState===ka.open||this.conn.readyState===ka.connecting)try{this.conn.close()}catch(n){this.log("error","Error closing connection",n)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this.channels.forEach(n=>n.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(e=>{this.log("error","error waiting for auth on connect",e),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");let n=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(n),this.workerRef.onerror=e=>{this.log("worker","worker error",e.message),this.workerRef.terminate()},this.workerRef.onmessage=e=>{e.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(n){var e;this._setConnectionState("disconnected"),this.log("transport","close",n),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(e=this.reconnectTimer)===null||e===void 0||e.scheduleTimeout(),this._triggerStateCallbacks("close",n)}_onConnError(n){this._setConnectionState("disconnected"),this.log("transport",`${n}`),this._triggerChanError(),this._triggerStateCallbacks("error",n)}
33_triggerChanError(){this.channels.forEach(n=>n._trigger(qr.error))}_appendParams(n,e){if(Object.keys(e).length===0)return n;let r=n.match(/\?/)?"&":"?",i=new URLSearchParams(e);return`${n}${r}${i}`}_workerObjectUrl(n){let e;if(n)e=n;else{let r=new Blob([A5],{type:"application/javascript"});e=URL.createObjectURL(r)}return e}_setConnectionState(n,e=!1){this._connectionState=n,n==="connecting"?this._wasManualDisconnect=!1:n==="disconnecting"&&(this._wasManualDisconnect=e)}async _performAuth(n=null){let e;n?e=n:this.accessToken?e=await this.accessToken():e=this.accessTokenValue,this.accessTokenValue!=e&&(this.accessTokenValue=e,this.channels.forEach(r=>{let i={access_token:e,version:Ix};e&&r.updateJoinPayload(i),r.joinedOnce&&r._isJoined()&&r._push(qr.access_token,{access_token:e})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(n="general"){this.setAuth().catch(e=>{this.log("error",`error setting auth in ${n}`,e)})}_triggerStateCallbacks(n,e){try{this.stateChangeCallbacks[n].forEach(r=>{try{r(e)}catch(i){this.log("error",`error in ${n} callback`,i)}})}catch(r){this.log("error",`error triggering ${n} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new wc(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},_g.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(n){var e,r,i,o,s,a,l,c,u,d,f,h;switch(this.transport=(e=n?.transport)!==null&&e!==void 0?e:null,this.timeout=(r=n?.timeout)!==null&&r!==void 0?r:Jd,this.heartbeatIntervalMs=(i=n?.heartbeatIntervalMs)!==null&&i!==void 0?i:_g.HEARTBEAT_INTERVAL,this.worker=(o=n?.worker)!==null&&o!==void 0?o:!1,this.accessToken=(s=n?.accessToken)!==null&&s!==void 0?s:null,this.heartbeatCallback=(a=n?.heartbeatCallback)!==null&&a!==void 0?a:iC,this.vsn=(l=n?.vsn)!==null&&l!==void 0?l:eC,n?.params&&(this.params=n.params),n?.logger&&(this.logger=n.logger),(n?.logLevel||n?.log_level)&&(this.logLevel=n.logLevel||n.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=n?.reconnectAfterMs)!==null&&c!==void 0?c:p=>k5[p-1]||M5,this.vsn){case QE:this.encode=(u=n?.encode)!==null&&u!==void 0?u:(p,m)=>m(JSON.stringify(p)),this.decode=(d=n?.decode)!==null&&d!==void 0?d:(p,m)=>m(JSON.parse(p));break;case Tx:this.encode=(f=n?.encode)!==null&&f!==void 0?f:this.serializer.encode.bind(this.serializer),this.decode=(h=n?.decode)!==null&&h!==void 0?h:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=n?.workerUrl}}};Ut();var ls=class extends Error{constructor(n){super(n),this.__isStorageError=!0,this.name="StorageError"}};function Et(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var bg=class extends ls{constructor(n,e,r){super(n),this.name="StorageApiError",this.status=e,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Aa=class extends ls{constructor(n,e){super(n),this.name="StorageUnknownError",this.originalError=e}};Ut();var Cc=t=>t?(...n)=>t(...n):(...n)=>fetch(...n),xx=()=>Response,wg=t=>{if(Array.isArray(t))return t.map(e=>wg(e));if(typeof t=="function"||t!==Object(t))return t;let n={};return Object.entries(t).forEach(([e,r])=>{let i=e.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));n[i]=wg(r)}),n},Rx=t=>{if(typeof t!="object"||t===null)return!1;let n=Object.getPrototypeOf(t);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Ox=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);var oC=t=>{var n;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(n=t.error)===null||n===void 0?void 0:n.message)||JSON.stringify(t)},x5=(t,n,e)=>W(void 0,void 0,void 0,function*(){let r=yield xx();t instanceof r&&!e?.noResolveJson?t.json().then(i=>{let o=t.status||500,s=i?.statusCode||o+"";n(new bg(oC(i),o,s))}).catch(i=>{n(new Aa(oC(i),i))}):n(new Aa(oC(t),t))}),R5=(t,n,e,r)=>{let i={method:t,headers:n?.headers||{}};return t==="GET"||!r?i:(Rx(r)?(i.headers=Object.assign({"Content-Type":"application/json"},n?.headers),i.body=JSON.stringify(r)):i.body=r,n?.duplex&&(i.duplex=n.duplex),Object.assign(Object.assign({},i),e))};function eh(t,n,e,r,i,o){return W(this,void 0,void 0,function*(){return new Promise((s,a)=>{t(e,R5(n,r,i,o)).then(l=>{if(!l.ok)throw l;return r?.noResolveJson?l:l.json()}).then(l=>s(l)).catch(l=>x5(l,a,r))})})}function cs(t,n,e,r){return W(this,void 0,void 0,function*(){return eh(t,"GET",n,e,r)})}function hr(t,n,e,r,i){return W(this,void 0,void 0,function*(){return eh(t,"POST",n,r,i,e)})}function th(t,n,e,r,i){return W(this,void 0,void 0,function*(){return eh(t,"PUT",n,r,i,e)})}function Nx(t,n,e,r){return W(this,void 0,void 0,function*(){return eh(t,"HEAD",n,Object.assign(Object.assign({},e),{noResolveJson:!0}),r)})}function Sc(t,n,e,r,i){return W(this,void 0,void 0,function*(){return eh(t,"DELETE",n,r,i,e)})}Ut();Ut();var Eg=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e}then(n,e){return this.execute().then(n,e)}execute(){return W(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Et(n))return{data:null,error:n};throw n}})}};var Px,sC=class{constructor(n,e){this.downloadFn=n,this.shouldThrowOnError=e,this[Px]="BlobDownloadBuilder",this.promise=null}asStream(){return new Eg(this.downloadFn,this.shouldThrowOnError)}then(n,e){return this.getPromise().then(n,e)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return W(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Et(n))return{data:null,error:n};throw n}})}};Px=Symbol.toStringTag;var Fx=sC;var O5={limit:100,offset:0,sortBy:{column:"name",order:"asc"}}
33,Lx={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Cg=class{constructor(n,e={},r,i){this.shouldThrowOnError=!1,this.url=n,this.headers=e,this.bucketId=r,this.fetch=Cc(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(n,e,r,i){return W(this,void 0,void 0,function*(){try{let o,s=Object.assign(Object.assign({},Lx),i),a=Object.assign(Object.assign({},this.headers),n==="POST"&&{"x-upsert":String(s.upsert)}),l=s.metadata;typeof Blob<"u"&&r instanceof Blob?(o=new FormData,o.append("cacheControl",s.cacheControl),l&&o.append("metadata",this.encodeMetadata(l)),o.append("",r)):typeof FormData<"u"&&r instanceof FormData?(o=r,o.has("cacheControl")||o.append("cacheControl",s.cacheControl),l&&!o.has("metadata")&&o.append("metadata",this.encodeMetadata(l))):(o=r,a["cache-control"]=`max-age=${s.cacheControl}`,a["content-type"]=s.contentType,l&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(l))),(typeof ReadableStream<"u"&&o instanceof ReadableStream||o&&typeof o=="object"&&"pipe"in o&&typeof o.pipe=="function")&&!s.duplex&&(s.duplex="half")),i?.headers&&(a=Object.assign(Object.assign({},a),i.headers));let c=this._removeEmptyFolders(e),u=this._getFinalPath(c),d=yield(n=="PUT"?th:hr)(this.fetch,`${this.url}/object/${u}`,o,Object.assign({headers:a},s?.duplex?{duplex:s.duplex}:{}));return{data:{path:c,id:d.Id,fullPath:d.Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if(Et(o))return{data:null,error:o};throw o}})}upload(n,e,r){return W(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",n,e,r)})}uploadToSignedUrl(n,e,r,i){return W(this,void 0,void 0,function*(){let o=this._removeEmptyFolders(n),s=this._getFinalPath(o),a=new URL(this.url+`/object/upload/sign/${s}`);a.searchParams.set("token",e);try{let l,c=Object.assign({upsert:Lx.upsert},i),u=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.append("cacheControl",c.cacheControl)):(l=r,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType);let d=yield th(this.fetch,a.toString(),l,{headers:u});return{data:{path:o,fullPath:d.Key},error:null}}catch(l){if(this.shouldThrowOnError)throw l;if(Et(l))return{data:null,error:l};throw l}})}createSignedUploadUrl(n,e){return W(this,void 0,void 0,function*(){try{let r=this._getFinalPath(n),i=Object.assign({},this.headers);e?.upsert&&(i["x-upsert"]="true");let o=yield hr(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:i}),s=new URL(this.url+o.url),a=s.searchParams.get("token");if(!a)throw new ls("No token returned by API");return{data:{signedUrl:s.toString(),path:n,token:a},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Et(r))return{data:null,error:r};throw r}})}update(n,e,r){return W(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",n,e,r)})}move(n,e,r){return W(this,void 0,void 0,function*(){try{return{data:yield hr(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:n,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Et(i))return{data:null,error:i};throw i}})}copy(n,e,r){return W(this,void 0,void 0,function*(){try{return{data:{path:(yield hr(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:n,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Et(i))return{data:null,error:i};throw i}})}createSignedUrl(n,e,r){return W(this,void 0,void 0,function*(){try{let i=this._getFinalPath(n),o=yield hr(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:e},r?.transform?{transform:r.transform}:{}),{headers:this.headers}),s=r?.download?`&download=${r.download===!0?"":r.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${s}`)},{data:o,error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Et(i))return{data:null,error:i};throw i}})}createSignedUrls(n,e,r){return W(this,void 0,void 0,function*(){try{let i=yield hr(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:e,paths:n},{headers:this.headers}),o=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{data:i.map(s=>Object.assign(Object.assign({},s),{signedUrl:s.signedURL?encodeURI(`${this.url}${s.signedURL}${o}`):null})),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Et(i))return{data:null,error:i};throw i}})}download(n,e){let i=typeof e?.transform<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString(e?.transform||{}),s=o?`?${o}`:"",a=this._getFinalPath(n),l=()=>cs(this.fetch,`${this.url}/${i}/${a}${s}`,{headers:this.headers,noResolveJson:!0});return new Fx(l,this.shouldThrowOnError)}info(n){return W(this,void 0,void 0,function*(){let e=this._getFinalPath(n);try{let r=yield cs(this.fetch,`${this.url}/object/info/${e}`,{headers:this.headers});return{data:wg(r),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Et(r))return{data:null,error:r};throw r}})}exists(n){return W(this,void 0,void 0,function*(){let e=this._getFinalPath(n);try{return yield Nx(this.fetch,`${this.url}/object/${e}`,{headers:this.headers}),{data:!0,error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Et(r)&&r instanceof Aa){let i=r.originalError;if([400,404].includes(i?.status))return{data:!1,error:r}}throw r}})}getPublicUrl(n,e){let r=this._getFinalPath(n),i=[],o=e?.download?`download=${e.download===!0?"":e.download}`:"";o!==""&&i.push(o);let a=typeof e?.transform<"u"?"render/image":"object",l=this.transformOptsToQueryString(e?.transform||{});l!==""&&i.push(l);let c=i.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${r}${c}`)}}}remove(n){return W(this,void 0,void 0,function*(){try{return{data:yield Sc(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:n},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Et(e))return{data:null,error:e};throw e}})}list(n,e,r){return W(this,void 0,void 0,function*(){try{let i=Object.assign(Object.assign(Object.assign({},O5),e),{prefix:n||""});return{data:yield hr(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},r),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Et(i))return{data:null,error:i};throw i}})}listV2(n,e){return W(this,void 0,void 0,function*(){try{let r=Object.assign({},n);return{data:yield hr(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},e),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Et(r))return{data:null,error:r};throw r}})}encodeMetadata(n){return JSON.stringify(n)}toBase64(n){return typeof Buffer<"u"?Buffer.from(n).toString("base64"):btoa(n)}_getFinalPath(n){return`${this.bucketId}/${n.replace(/^\/+/,"")}`}_removeEmptyFolders(n){return n.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(n){let e=[];return n.width&&e.push(`width=${n.width}`),n.height&&e.push(`height=${n.height}`),n.resize&&e.push(`resize=${n.resize}`),n.format&&e.push(`format=${n.format}`),n.quality&&e.push(`quality=${n.quality}`),e.join("&")}};Ut();var Sg="2.86.0";var Dg={"X-Client-Info":`storage-js/${Sg}`};var Ig=class{constructor(n,e={},r,i){this.shouldThrowOnError=!1;let o=new URL(n);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Dg),e),this.fetch=Cc(r)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(n){return W(this,void 0,void 0,function*(){try{let e=this.listBucketOptionsToQueryString(n);return{data:yield cs(this.fetch,`${this.url}/bucket${e}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Et(e))return{data:null,error:e};throw e}})}getBucket(n){return W(this,void 0,void 0,function*(){try{return{data:yield cs(this.fetch,`${this.url}/bucket/${n}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Et(e))return{data:null,error:e};throw e}})}createBucket(n){return W(this,arguments,void 0,function*(e,r={public:!1}){try{return{data:yield hr(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:r.type,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Et(i))return{data:null,error:i};throw i}})}updateBucket(n,e){return W(this,void 0,void 0,function*(){try{return{data:yield th(this.fetch,`${this.url}/bucket/${n}`,{id:n,name:n,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Et(r))return{data:null,error:r};throw r}})}emptyBucket(n){return W(this,void 0,void 0,function*(){try{return{data:yield hr(this.fetch,`${this.url}/bucket/${n}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Et(e))return{data:null,error:e};throw e}})}deleteBucket(n){return W(this,void 0,void 0,function*(){try{return{data:yield Sc(this.fetch,`${this.url}/bucket/${n}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Et(e))return{data:null,error:e};throw e}})}listBucketOptionsToQueryString(n){let e={};return n&&("limit"in n&&(e.limit=String(n.limit)),"offset"in n&&(e.offset=String(n.offset)),n.search&&(e.search=n.search),n.sortColumn&&(e.sortColumn=n.sortColumn),n.sortOrder&&(e.sortOrder=n.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}};Ut();
vendor: 4,840 bytes, line 33
33var nh=class extends Error{constructor(t,n){super(t),this.name="IcebergError",this.status=n.status,this.icebergType=n.icebergType,this.icebergCode=n.icebergCode,this.details=n.details,this.isCommitStateUnknown=n.icebergType==="CommitStateUnknownException"||[500,502,504].includes(n.status)&&n.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function N5(t,n,e){let r=new URL(n,t);if(e)for(let[i,o]of Object.entries(e))o!==void 0&&r.searchParams.set(i,o);return r.toString()}async function P5(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function F5(t){let n=t.fetchImpl??globalThis.fetch;return{async request({method:e,path:r,query:i,body:o,headers:s}){let a=N5(t.baseUrl,r,i),l=await P5(t.auth),c=await n(a,{method:e,headers:A(A(A({},o?{"Content-Type":"application/json"}:{}),l),s),body:o?JSON.stringify(o):void 0}),u=await c.text(),d=(c.headers.get("content-type")||"").includes("application/json"),f=d&&u?JSON.parse(u):u;if(!c.ok){let h=d?f:void 0,p=h?.error;throw new nh(p?.message??`Request failed with status ${c.status}`,{status:c.status,icebergType:p?.type,icebergCode:p?.code,details:h})}return{status:c.status,headers:c.headers,data:f}}}}function Tg(t){return t.join("�")}var L5=class{constructor(t,n=""){this.client=t,this.prefix=n}async listNamespaces(t){let n=t?{parent:Tg(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:n})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(t,n){let e={namespace:t.namespace,properties:n?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:e})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Tg(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Tg(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Tg(t.namespace)}`}),!0}catch(n){if(n instanceof nh&&n.status===404)return!1;throw n}}async createNamespaceIfNotExists(t,n){try{return await this.createNamespace(t,n)}catch(e){if(e instanceof nh&&e.status===409)return;throw e}}};function Dc(t){return t.join("�")}var j5=class{constructor(t,n="",e){this.client=t,this.prefix=n,this.accessDelegation=e}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Dc(t.namespace)}/tables`})).data.identifiers}async createTable(t,n){let e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Dc(t.namespace)}/tables`,body:n,headers:e})).data.metadata}async updateTable(t,n){let e=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Dc(t.namespace)}/tables/${t.name}`,body:n});return{"metadata-location":e.data["metadata-location"],metadata:e.data.metadata}}async dropTable(t,n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Dc(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(n?.purge??!1)}})}async loadTable(t){let n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Dc(t.namespace)}/tables/${t.name}`,headers:n})).data.metadata}async tableExists(t){let n={};this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Dc(t.namespace)}/tables/${t.name}`,headers:n}),!0}catch(e){if(e instanceof nh&&e.status===404)return!1;throw e}}async createTableIfNotExists(t,n){try{return await this.createTable(t,n)}catch(e){if(e instanceof nh&&e.status===409)return await this.loadTable({namespace:t.namespace,name:n.name});throw e}}},jx=class{constructor(t){let n="v1";t.catalogName&&(n+=`/${t.catalogName}`);let e=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=F5({baseUrl:e,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new L5(this.client,n),this.tableOps=new j5(this.client,n,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,n){return this.namespaceOps.createNamespace(t,n)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}
33async createTable(t,n){return this.tableOps.createTable(t,n)}async updateTable(t,n){return this.tableOps.updateTable(t,n)}async dropTable(t,n){await this.tableOps.dropTable(t,n)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,n){return this.namespaceOps.createNamespaceIfNotExists(t,n)}async createTableIfNotExists(t,n){return this.tableOps.createTableIfNotExists(t,n)}};var kg=class{constructor(n,e={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Dg),e),this.fetch=Cc(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(n){return W(this,void 0,void 0,function*(){try{return{data:yield hr(this.fetch,`${this.url}/bucket`,{name:n},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Et(e))return{data:null,error:e};throw e}})}listBuckets(n){return W(this,void 0,void 0,function*(){try{let e=new URLSearchParams;n?.limit!==void 0&&e.set("limit",n.limit.toString()),n?.offset!==void 0&&e.set("offset",n.offset.toString()),n?.sortColumn&&e.set("sortColumn",n.sortColumn),n?.sortOrder&&e.set("sortOrder",n.sortOrder),n?.search&&e.set("search",n.search);let r=e.toString(),i=r?`${this.url}/bucket?${r}`:`${this.url}/bucket`;return{data:yield cs(this.fetch,i,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Et(e))return{data:null,error:e};throw e}})}deleteBucket(n){return W(this,void 0,void 0,function*(){try{return{data:yield Sc(this.fetch,`${this.url}/bucket/${n}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Et(e))return{data:null,error:e};throw e}})}from(n){if(!Ox(n))throw new ls("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");return new jx({baseUrl:this.url,catalogName:n,auth:{type:"custom",getHeaders:()=>W(this,void 0,void 0,function*(){return this.headers})},fetch:this.fetch})}};Ut();Ut();var Ic={"X-Client-Info":`storage-js/${Sg}`,"Content-Type":"application/json"};var Mg=class extends Error{constructor(n){super(n),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function qn(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Tc=class extends Mg{constructor(n,e,r){super(n),this.name="StorageVectorsApiError",this.status=e,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Ag=class extends Mg{constructor(n,e){super(n),this.name="StorageVectorsUnknownError",this.originalError=e}};Ut();var kc=t=>t?(...n)=>t(...n):(...n)=>fetch(...n);var Bx=t=>{if(typeof t!="object"||t===null)return!1;let n=Object.getPrototypeOf(t);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};var Vx=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),B5=(t,n,e)=>W(void 0,void 0,void 0,function*(){if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!e?.noResolveJson){let i=t.status||500,o=t;if(typeof o.json=="function")o.json().then(s=>{let a=s?.statusCode||s?.code||i+"";n(new Tc(Vx(s),i,a))}).catch(()=>{let s=i+"",a=o.statusText||`HTTP ${i} error`;n(new Tc(a,i,s))});else{let s=i+"",a=o.statusText||`HTTP ${i} error`;n(new Tc(a,i,s))}}else n(new Ag(Vx(t),t))}),V5=(t,n,e,r)=>{let i={method:t,headers:n?.headers||{}};return t==="GET"||!r?i:(Bx(r)?(i.headers=Object.assign({"Content-Type":"application/json"},n?.headers),i.body=JSON.stringify(r)):i.body=r,Object.assign(Object.assign({},i),e))};function U5(t,n,e,r,i,o){return W(this,void 0,void 0,function*(){return new Promise((s,a)=>{t(e,V5(n,r,i,o)).then(l=>{if(!l.ok)throw l;if(r?.noResolveJson)return l;let c=l.headers.get("content-type");return!c||!c.includes("application/json")?{}:l.json()}).then(l=>s(l)).catch(l=>B5(l,a,r))})})}function Wn(t,n,e,r,i){return W(this,void 0,void 0,function*(){return U5(t,"POST",n,r,i,e)})}var xg=class{constructor(n,e={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Ic),e),this.fetch=kc(r)}
33throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(n){return W(this,void 0,void 0,function*(){try{return{data:(yield Wn(this.fetch,`${this.url}/CreateIndex`,n,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(qn(e))return{data:null,error:e};throw e}})}getIndex(n,e){return W(this,void 0,void 0,function*(){try{return{data:yield Wn(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:n,indexName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(qn(r))return{data:null,error:r};throw r}})}listIndexes(n){return W(this,void 0,void 0,function*(){try{return{data:yield Wn(this.fetch,`${this.url}/ListIndexes`,n,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(qn(e))return{data:null,error:e};throw e}})}deleteIndex(n,e){return W(this,void 0,void 0,function*(){try{return{data:(yield Wn(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:n,indexName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(qn(r))return{data:null,error:r};throw r}})}};Ut();var Rg=class{constructor(n,e={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Ic),e),this.fetch=kc(r)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(n){return W(this,void 0,void 0,function*(){try{if(n.vectors.length<1||n.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield Wn(this.fetch,`${this.url}/PutVectors`,n,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(qn(e))return{data:null,error:e};throw e}})}getVectors(n){return W(this,void 0,void 0,function*(){try{return{data:yield Wn(this.fetch,`${this.url}/GetVectors`,n,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(qn(e))return{data:null,error:e};throw e}})}listVectors(n){return W(this,void 0,void 0,function*(){try{if(n.segmentCount!==void 0){if(n.segmentCount<1||n.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(n.segmentIndex!==void 0&&(n.segmentIndex<0||n.segmentIndex>=n.segmentCount))throw new Error(`segmentIndex must be between 0 and ${n.segmentCount-1}`)}return{data:yield Wn(this.fetch,`${this.url}/ListVectors`,n,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(qn(e))return{data:null,error:e};throw e}})}queryVectors(n){return W(this,void 0,void 0,function*(){try{return{data:yield Wn(this.fetch,`${this.url}/QueryVectors`,n,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(qn(e))return{data:null,error:e};throw e}})}deleteVectors(n){return W(this,void 0,void 0,function*(){try{if(n.keys.length<1||n.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield Wn(this.fetch,`${this.url}/DeleteVectors`,n,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(qn(e))return{data:null,error:e};throw e}})}};Ut();var Og=class{constructor(n,e={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Ic),e),this.fetch=kc(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(n){return W(this,void 0,void 0,function*(){try{return{data:(yield Wn(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(qn(e))return{data:null,error:e};throw e}})}getBucket(n){return W(this,void 0,void 0,function*(){try{return{data:yield Wn(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:n},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(qn(e))return{data:null,error:e};throw e}})}listBuckets(){return W(this,arguments,void 0,function*(n={}){try{return{data:yield Wn(this.fetch,`${this.url}/ListVectorBuckets`,n,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(qn(e))return{data:null,error:e};throw e}})}deleteBucket(n){return W(this,void 0,void 0,function*(){try{return{data:(yield Wn(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(qn(e))return{data:null,error:e};throw e}})}};var rh=class extends Og{constructor(n,e={}){super(n,e.headers||{},e.fetch)}from(n){return new Ng(this.url,this.headers,n,this.fetch)}createBucket(n){let e=Object.create(null,{createBucket:{get:()=>super.createBucket}});return W(this,void 0,void 0,function*(){return e.createBucket.call(this,n)})}getBucket(n){let e=Object.create(null,{getBucket:{get:()=>super.getBucket}});return W(this,void 0,void 0,function*(){return e.getBucket.call(this,n)})}listBuckets(){let n=Object.create(null,{listBuckets:{get:()=>super.listBuckets}});return W(this,arguments,void 0,function*(e={}
33){return n.listBuckets.call(this,e)})}deleteBucket(n){let e=Object.create(null,{deleteBucket:{get:()=>super.deleteBucket}});return W(this,void 0,void 0,function*(){return e.deleteBucket.call(this,n)})}},Ng=class extends xg{constructor(n,e,r,i){super(n,e,i),this.vectorBucketName=r}createIndex(n){let e=Object.create(null,{createIndex:{get:()=>super.createIndex}});return W(this,void 0,void 0,function*(){return e.createIndex.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){let n=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return W(this,arguments,void 0,function*(e={}){return n.listIndexes.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}getIndex(n){let e=Object.create(null,{getIndex:{get:()=>super.getIndex}});return W(this,void 0,void 0,function*(){return e.getIndex.call(this,this.vectorBucketName,n)})}deleteIndex(n){let e=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return W(this,void 0,void 0,function*(){return e.deleteIndex.call(this,this.vectorBucketName,n)})}index(n){return new Pg(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},Pg=class extends Rg{constructor(n,e,r,i,o){super(n,e,o),this.vectorBucketName=r,this.indexName=i}putVectors(n){let e=Object.create(null,{putVectors:{get:()=>super.putVectors}});return W(this,void 0,void 0,function*(){return e.putVectors.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(n){let e=Object.create(null,{getVectors:{get:()=>super.getVectors}});return W(this,void 0,void 0,function*(){return e.getVectors.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){let n=Object.create(null,{listVectors:{get:()=>super.listVectors}});return W(this,arguments,void 0,function*(e={}){return n.listVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(n){let e=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return W(this,void 0,void 0,function*(){return e.queryVectors.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(n){let e=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return W(this,void 0,void 0,function*(){return e.deleteVectors.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};var ih=class extends Ig{constructor(n,e={},r,i){super(n,e,r,i)}from(n){return new Cg(this.url,this.headers,n,this.fetch)}get vectors(){return new rh(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new kg(this.url+"/iceberg",this.headers,this.fetch)}};var Ux="2.86.0";var oh="";typeof Deno<"u"?oh="deno":typeof document<"u"?oh="web":typeof navigator<"u"&&navigator.product==="ReactNative"?oh="react-native":oh="node";var H5={"X-Client-Info":`supabase-js-${oh}/${Ux}`},Hx={headers:H5},$x={schema:"public"},zx={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},qx={};var $5=t=>t?(...n)=>t(...n):(...n)=>fetch(...n),z5=()=>Headers,Wx=(t,n,e)=>{let r=$5(e),i=z5();return async(o,s)=>{var a;let l=(a=await n())!==null&&a!==void 0?a:t,c=new i(s?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(o,Object.assign(Object.assign({},s),{headers:c}))}};function q5(t){return t.endsWith("/")?t:t+"/"}function Gx(t,n){var e,r;let{db:i,auth:o,realtime:s,global:a}=t,{db:l,auth:c,realtime:u,global:d}=n,f={db:Object.assign(Object.assign({},l),i),auth:Object.assign(Object.assign({},c),o),realtime:Object.assign(Object.assign({},u),s),storage:{},global:Object.assign(Object.assign(Object.assign({},d),a),{headers:Object.assign(Object.assign({},(e=d?.headers)!==null&&e!==void 0?e:{}),(r=a?.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return t.accessToken?f.accessToken=t.accessToken:delete f.accessToken,f}function Kx(t){let n=t?.trim();if(!n)throw new Error("supabaseUrl is required.");
33if(!n.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(q5(n))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}Ut();Ut();var Fg="2.86.0";var xa=30*1e3,Lg=3,jg=Lg*xa,Jx="http://localhost:9999",Yx="supabase.auth.token";var Zx={"X-Client-Info":`gotrue-js/${Fg}`};var sh="X-Supabase-Api-Version",aC={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Xx=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Qx=600*1e3;var us=class extends Error{constructor(n,e,r){super(n),this.__isAuthError=!0,this.name="AuthError",this.status=e,this.code=r}};function oe(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}var Bg=class extends us{constructor(n,e,r){super(n,e,r),this.name="AuthApiError",this.status=e,this.code=r}};function eR(t){return oe(t)&&t.name==="AuthApiError"}var Wr=class extends us{constructor(n,e){super(n),this.name="AuthUnknownError",this.originalError=e}},qi=class extends us{constructor(n,e,r,i){super(n,r,i),this.name=e,this.status=r}},On=class extends qi{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};function tR(t){return oe(t)&&t.name==="AuthSessionMissingError"}var bo=class extends qi{constructor(){super("Auth session or user missing","AuthInvalidToken
33ResponseError",500,void 0)}},Ra=class extends qi{constructor(n){super(n,"AuthInvalidCredentialsError",400,void 0)}},Oa=class extends qi{constructor(n,e=null){super(n,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=e}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};function nR(t){return oe(t)&&t.name==="AuthImplicitGrantRedirectError"}var ah=class extends qi{constructor(n,e=null){super(n,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=e}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}},Mc=class extends qi{constructor(n,e){super(n,"AuthRetryableFetchError",e,void 0)}};function Vg(t){return oe(t)&&t.name==="AuthRetryableFetchError"}var lh=class extends qi{constructor(n,e,r){super(n,"AuthWeakPasswordError",e,"weak_password"),this.reasons=r}};var Na=class extends qi{constructor(n){super(n,"AuthInvalidJwtError",400,"invalid_jwt")}};var Ug="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),rR=` 34\r=`.split(""),W5=(()=>{let t=new Array(128);for(let n=0;n<t.length;n+=1)t[n]=-1;for(let n=0;n<rR.length;n+=1)t[rR[n].charCodeAt(0)]=-2;for(let n=0;n<Ug.length;n+=1)t[Ug[n].charCodeAt(0)]=n;return t})();function iR(t,n,e){if(t!==null)for(n.queue=n.queue<<8|t,n.queuedBits+=8;n.queuedBits>=6;){let r=n.queue>>n.queuedBits-6&63;e(Ug[r]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){let r=n.queue>>n.queuedBits-6&63;e(Ug[r]),n.queuedBits-=6}}function oR(t,n,e){let r=W5[t];if(r>-1)for(n.queue=n.queue<<6|r,n.queuedBits+=6;n.queuedBits>=8;)e(n.queue>>n.queuedBits-8&255),n.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function lC(t){let n=[],e=s=>{n.push(String.fromCodePoint(s))},r={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},o=s=>{J5(s,r,e)};for(let s=0;s<t.length;s+=1)oR(t.charCodeAt(s),i,o);return n.join("")}function G5(t,n){if(t<=127){n(t);return}else if(t<=2047){n(192|t>>6),n(128|t&63);return}else if(t<=65535){n(224|t>>12),n(128|t>>6&63),n(128|t&63);return}else if(t<=1114111){n(240|t>>18),n(128|t>>12&63),n(128|t>>6&63),n(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function K5(t,n){for(let e=0;e<t.length;e+=1){let r=t.charCodeAt(e);if(r>55295&&r<=56319){let i=(r-55296)*1024&65535;r=(t.charCodeAt(e+1)-56320&65535|i)+65536,e+=1}G5(r,n)}}function J5(t,n,e){if(n.utf8seq===0){if(t<=127){e(t);return}for(let r=1;r<6;r+=1)if((t>>7-r&1)===0){n.utf8seq=r;break}if(n.utf8seq===2)n.codepoint=t&31;else if(n.utf8seq===3)n.codepoint=t&15;else if(n.utf8seq===4)n.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");n.utf8seq-=1}else if(n.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");n.codepoint=n.codepoint<<6|t&63,n.utf8seq-=1,n.utf8seq===0&&e(n.codepoint)}}function ds(t){let n=[],e={queue:0,queuedBits:0},r=i=>{n.push(i)};for(let i=0;i<t.length;i+=1)oR(t.charCodeAt(i),e,r);return new Uint8Array(n)}function sR(t){let n=[];return K5(t,e=>n.push(e)),new Uint8Array(n)}function wo(t){let n=[],e={queue:0,queuedBits:0},r=i=>{n.push(i)};return t.forEach(i=>iR(i,e,r)),iR(null,e,r),n.join("")}function aR(t){return Math.round(Date.now()/1e3)+t}function lR(){return Symbol("auth-callback")}var wn=()=>typeof window<"u"&&typeof document<"u",Pa={tested:!1,writable:!1},Hg=()=>{if(!wn())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Pa.tested)return Pa.writable;let t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Pa.tested=!0,Pa.writable=!0}catch{Pa.tested=!0,Pa.writable=!1}return Pa.writable};function cR(t){let n={},e=new URL(t);if(e.hash&&e.hash[0]==="#")try{new URLSearchParams(e.hash.substring(1)).forEach((i,o)=>{n[o]=i})}catch{}return e.searchParams.forEach((r,i)=>{n[i]=r}),n}var $g=t=>t?(...n)=>t(...n):(...n)=>fetch(...n),uR=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Fa=async(t,n,e)=>{await t.setItem(n,JSON.stringify(e))},hs=async(t,n)=>{let e=await t.getItem(n);if(!e)return null;try{return JSON.parse(e)}catch{return e}},Eo=async(t,n)=>{await t.removeItem(n)},ch=class t{constructor(){this.promise=new t.promiseConstructor((n,e)=>{this.resolve=n,this.reject=e})}};ch.promiseConstructor=Promise;function zg(t){let n=t.split(".");if(n.length!==3)throw new Na("Invalid JWT structure");for(let r=0;r<n.length;r++)if(!Xx.test(n[r]))throw new Na("JWT not in base64url format");return{header:JSON.parse(lC(n[0])),payload:JSON.parse(lC(n[1])),signature:ds(n[2]),raw:{header:n[0],payload:n[1]}}}async function dR(t){return await new Promise(n=>{setTimeout(()=>n(null),t)})}function hR(t,n){return new Promise((r,i)=>{(async()=>{for(let o=0;o<1/0;o++)try{let s=await t(o);if(!n(o,null,s)){r(s);return}}catch(s){if(!n(o,s)){i(s);return}}})()})}function Y5(t){return("0"+t.toString(16)).substr(-2)}function Z5(){let n=new Uint32Array(56);if(typeof crypto>"u"){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=e.length,i="";for(let o=0;o<56;o++)i+=e.charAt(Math.floor(Math.random()*r));return i}return crypto.getRandomValues(n),Array.from(n,Y5).join("")}async function X5(t){let e=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",e),i=new Uint8Array(r);return Array.from(i).map(o=>String.fromCharCode(o)).join("")}async function Q5(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code
34challenge method will default to use plain instead of sha256."),t;let e=await X5(t);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function La(t,n,e=!1){let r=Z5(),i=r;e&&(i+="/PASSWORD_RECOVERY"),await Fa(t,`${n}-code-verifier`,i);let o=await Q5(r);return[o,r===o?"plain":"s256"]}var e6=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function fR(t){let n=t.headers.get(sh);if(!n||!n.match(e6))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch{return null}}function pR(t){if(!t)throw new Error("Missing exp claim");let n=Math.floor(Date.now()/1e3);if(t<=n)throw new Error("JWT has expired")}function mR(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}var t6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ja(t){if(!t6.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function qg(){let t={};return new Proxy(t,{get:(n,e)=>{if(e==="__isUserNotAvailableProxy")return!0;if(typeof e=="symbol"){let r=e.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${e}" property of the session object is not supported. Please use getUser() instead.`)},set:(n,e)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${e}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(n,e)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${e}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function gR(t,n){return new Proxy(t,{get:(e,r,i)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){let o=r.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(e,r,i)}return!n.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),n.value=!0),Reflect.get(e,r,i)}})}function cC(t){return JSON.parse(JSON.stringify(t))}var Ba=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),n6=[502,503,504];async function vR(t){var n;if(!uR(t))throw new Mc(Ba(t),0);if(n6.includes(t.status))throw new Mc(Ba(t),t.status);let e;try{e=await t.json()}catch(o){throw new Wr(Ba(o),o)}let r,i=fR(t);if(i&&i.getTime()>=aC["2024-01-01"].timestamp&&typeof e=="object"&&e&&typeof e.code=="string"?r=e.code:typeof e=="object"&&e&&typeof e.error_code=="string"&&(r=e.error_code),r){if(r==="weak_password")throw new lh(Ba(e),t.status,((n=e.weak_password)===null||n===void 0?void 0:n.reasons)||[]);if(r==="session_not_found")throw new On}else if(typeof e=="object"&&e&&typeof e.weak_password=="object"&&e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.reasons.reduce((o,s)=>o&&typeof s=="string",!0))throw new lh(Ba(e),t.status,e.weak_password.reasons);throw new Bg(Ba(e),t.status||500,r)}var r6=(t,n,e,r)=>{let i={method:t,headers:n?.headers||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},n?.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),e))};async function ye(t,n,e,r){var i;let o=Object.assign({},r?.headers);o[sh]||(o[sh]=aC["2024-01-01"].name),r?.jwt&&(o.Authorization=`Bearer ${r.jwt}`);let s=(i=r?.query)!==null&&i!==void 0?i:{};r?.redirectTo&&(s.redirect_to=r.redirectTo);let a=Object.keys(s).length?"?"+new URLSearchParams(s).toString():"",l=await i6(t,n,e+a,{headers:o,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(l):{data:Object.assign({},l),error:null}}async function i6(t,n,e,r,i,o){let s=r6(n,r,i,o),a;try{a=await t(e,Object.assign({},s))}catch(l){throw console.error(l),new Mc(Ba(l),0)}if(a.ok||await vR(a),r?.noResolveJson)return a;try{return await a.json()}catch(l){await vR(l)}}function Gr(t){var n;let e=null;o6(t)&&(e=Object.assign({},t),t.expires_at||(e.expires_at=aR(t.expires_in)));let r=(n=t.user)!==null&&n!==void 0?n:t;return{data:{session:e,user:r},error:null}}function uC(t){let n=Gr(t);return!n.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((e,r)=>e&&typeof r=="string",!0)&&(n.data.weak_password=t.weak_password),n}function Wi(t){var n;return{data:{user:(n=t.user)!==null&&n!==void 0?n:t},error:null}}function yR(t){return{data:t,error:null}}function _R(t){let{action_link:n,email_otp:e,hashed_token:r,redirect_to:i,verification_type:o}=t,s=io(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:n,email_otp:e,hashed_token:r,redirect_to:i,verification_type:o},l=Object.assign({},s);return{data:{properties:a,user:l},error:null}}function dC(t){return t}function o6(t){return t.access_token&&t.refresh_token&&t.expires_in}var Wg=["global","local","others"];var Ac=class{constructor({url:n="",headers:e={},fetch:r}){this.url=n,this.headers=e,this.fetch=$g(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(n,e=Wg[0]){if(Wg.indexOf(e)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Wg.join(", ")}`);try{return await ye(this.fetch,"POST",`${this.url}/logout?scope=${e}`,{headers:this.headers,jwt:n,noResolveJson:!0}),{data:null,error:null}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async inviteUserByEmail(n,e={}){try{return await ye(this.fetch,"POST",`${this.url}/invite`,{body:{email:n,data:e.data},headers:this.headers,redirectTo:e.redirectTo,xform:Wi})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async generateLink(n){try{let{options:e}=n,r=io(n,["options"]),i=Object.assign(Object.assign({},r),e);return"newEmail"in r&&(i.new_email=r?.newEmail,delete i.newEmail),await ye(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:_R,redirectTo:e?.redirectTo})}catch(e){if(oe(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(n){try{return await ye(this.fetch,"POST",`${this.url}/admin/users`,{body:n,headers:this.headers,xform:Wi})}catch(e){if(oe(e))return{data:{user:null},error:e};throw e}}async listUsers(n){var e,r,i,o,s,a,l;try{let c={nextPage:null,lastPage:0,total:0},u=await ye(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(e=n?.page)===null||e===void 0?void 0:e.toString())!==null&&r!==void 0?r:"",per_page:(o=(i=n?.perPage)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""},xform:dC});if(u.error)throw u.error;let d=await u.json(),f=(s=u.headers.get("x-total-count"))!==null&&s!==void 0?s:0,h=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return h.length>
340&&(h.forEach(p=>{let m=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),g=JSON.parse(p.split(";")[1].split("=")[1]);c[`${g}Page`]=m}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(oe(c))return{data:{users:[]},error:c};throw c}}async getUserById(n){ja(n);try{return await ye(this.fetch,"GET",`${this.url}/admin/users/${n}`,{headers:this.headers,xform:Wi})}catch(e){if(oe(e))return{data:{user:null},error:e};throw e}}async updateUserById(n,e){ja(n);try{return await ye(this.fetch,"PUT",`${this.url}/admin/users/${n}`,{body:e,headers:this.headers,xform:Wi})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async deleteUser(n,e=!1){ja(n);try{return await ye(this.fetch,"DELETE",`${this.url}/admin/users/${n}`,{headers:this.headers,body:{should_soft_delete:e},xform:Wi})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async _listFactors(n){ja(n.userId);try{let{data:e,error:r}=await ye(this.fetch,"GET",`${this.url}/admin/users/${n.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:e,error:r}}catch(e){if(oe(e))return{data:null,error:e};throw e}}async _deleteFactor(n){ja(n.userId),ja(n.id);try{return{data:await ye(this.fetch,"DELETE",`${this.url}/admin/users/${n.userId}/factors/${n.id}`,{headers:this.headers}),error:null}}catch(e){if(oe(e))return{data:null,error:e};throw e}}async _listOAuthClients(n){var e,r,i,o,s,a,l;try{let c={nextPage:null,lastPage:0,total:0},u=await ye(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(e=n?.page)===null||e===void 0?void 0:e.toString())!==null&&r!==void 0?r:"",per_page:(o=(i=n?.perPage)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""},xform:dC});if(u.error)throw u.error;let d=await u.json(),f=(s=u.headers.get("x-total-count"))!==null&&s!==void 0?s:0,h=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return h.length>0&&(h.forEach(p=>{let m=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),g=JSON.parse(p.split(";")[1].split("=")[1]);c[`${g}Page`]=m}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(oe(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(n){try{return await ye(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:n,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(oe(e))return{data:null,error:e};throw e}}async _getOAuthClient(n){try{return await ye(this.fetch,"GET",`${this.url}/admin/oauth/clients/${n}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(oe(e))return{data:null,error:e};throw e}}async _updateOAuthClient(n,e){try{return await ye(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${n}`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(n){try{return await ye(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${n}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(oe(e))return{data:null,error:e};throw e}}async _regenerateOAuthClientSecret(n){try{return await ye(this.fetch,"POST",`${this.url}/admin/oauth/clients/${n}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(oe(e))return{data:null,error:e};throw e}}};function hC(t={}){return{getItem:n=>t[n]||null,setItem:(n,e)=>{t[n]=e},removeItem:n=>{delete t[n]}}}var Va={debug:!!(globalThis&&Hg()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")},uh=class extends Error{constructor(n){super(n),this.isAcquireTimeout=!0}},Gg=class extends uh{};async function fC(t,n,e){Va.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,n);let r=new globalThis.AbortController;return n>0&&setTimeout(()=>{r.abort(),Va.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},n),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,n===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal}
34,async i=>{if(i){Va.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await e()}finally{Va.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(n===0)throw Va.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Gg(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Va.debug)try{let o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await e()}}))}function bR(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function pC(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function wR(t){return parseInt(t,16)}function ER(t){let n=new TextEncoder().encode(t);return"0x"+Array.from(n,r=>r.toString(16).padStart(2,"0")).join("")}function CR(t){var n;let{chainId:e,domain:r,expirationTime:i,issuedAt:o=new Date,nonce:s,notBefore:a,requestId:l,resources:c,scheme:u,uri:d,version:f}=t;{if(!Number.isInteger(e))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${e}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(s&&s.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${s}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);if(!((n=t.statement)===null||n===void 0)&&n.includes(` 35`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}let h=pC(t.address),p=u?`${u}://${r}`:r,m=t.statement?`${t.statement} 36`:"",g=`${p} wants you to sign in with your Ethereum account: 37${h} 38 39${m}`,w=`URI: ${d} 40Version: ${f} 41Chain ID: ${e}${s?` 42Nonce: ${s}`:""} 43Issued At: ${o.toISOString()}`;if(i&&(w+=` 44Expiration Time: ${i.toISOString()}`),a&&(w+=` 45Not Before: ${a.toISOString()}`),l&&(w+=` 46Request ID: ${l}`),c){let C=` 47Resources:`;for(let T of c){if(!T||typeof T!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${T}`);C+=` 48- ${T}`}w+=C}return`${g} 49${w}`}Ut();var Yt=class extends Error{constructor({message:n,code:e,cause:r,name:i}){var o;super(n,{cause:r}),this.__isWebAuthnError=!0,this.name=(o=i??(r instanceof Error?r.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=e}},Ua=class extends Yt{constructor(n,e){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e,message:n}),this.name="WebAuthnUnknownError",this.originalError=e}};function SR({error:t,options:n}){var e,r,i;let{publicKey:o}=n;if(!o)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(n.signal instanceof AbortSignal)return new Yt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((e=o.authenticatorSelection)===null||e===void 0?void 0:e.requireResidentKey)===!0)return new Yt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(n.mediation==="conditional"&&((r=o.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Yt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=o.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Yt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Yt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Yt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return o.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new Yt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Yt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){let s=window.location.hostname;if(mC(s)){if(o.rp.id!==s)return new Yt({message:`The RP ID "${o.rp.id}
49" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Yt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new Yt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Yt({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Yt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function DR({error:t,options:n}){let{publicKey:e}=n;if(!e)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(n.signal instanceof AbortSignal)return new Yt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Yt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){let r=window.location.hostname;if(mC(r)){if(e.rpId!==r)return new Yt({message:`The RP ID "${e.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Yt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Yt({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Yt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}var gC=class{createNewAbortSignal(){if(this.controller){let e=new Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}let n=new AbortController;return this.controller=n,n.signal}cancelCeremony(){if(this.controller){let n=new Error("Manually cancelling existing WebAuthn API call");n.name="AbortError",this.controller.abort(n),this.controller=void 0}}},s6=new gC;function TR(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);let{challenge:n,user:e,excludeCredentials:r}=t,i=io(t,["challenge","user","excludeCredentials"]),o=ds(n).buffer,s=Object.assign(Object.assign({},e),{id:ds(e.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:o,user:s});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){let c=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:ds(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function kR(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);let{challenge:n,allowCredentials:e}=t,r=io(t,["challenge","allowCredentials"]),i=ds(n).buffer,o=Object.assign(Object.assign({},r),{challenge:i});if(e&&e.length>0){o.allowCredentials=new Array(e.length);for(let s=0;s<e.length;s++){let a=e[s];o.allowCredentials[s]=Object.assign(Object.assign({},a),{id:ds(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return o}function MR(t){var n;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let e=t;return{id:t.id,rawId:t.id,response:{attestationObject:wo(new Uint8Array(t.response.attestationObject)),clientDataJSON:wo(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(n=e.authenticatorAttachment)!==null&&n!==void 0?n:void 0}}function AR(t){var n;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let e=t,r=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:wo(new Uint8Array(i.authenticatorData)),clientDataJSON:wo(new Uint8Array(i.clientDataJSON)),signature:wo(new Uint8Array(i.signature)),userHandle:i.userHandle?wo(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(n=e.authenticatorAttachment)!==null&&n!==void 0?n:void 0}}function mC(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function IR(){var t,n;return!!(wn()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((n=navigator?.credentials)===null||n===void 0?void 0:n.get)=="function")}async function a6(t){try{let n=await navigator.credentials.create(t);return n?n instanceof PublicKeyCredential?{data:n,error:null}:{data:null,error:new Ua("Browser returned unexpected credential type",n)}:{data:null,error:new Ua("Empty credential response",n)}}catch(n){return{data:null,error:SR({error:n,options:t})}}}async function l6(t){try{let n=await navigator.credentials.get(t);return n?n instanceof PublicKeyCredential?{data:n,error:null}:{data:null,error:new Ua("Browser returned unexpected credential type",n)}:{data:null,error:new Ua("Empty credential response",n)}}catch(n){return{data:null,error:DR({error:n,options:t})}}}var c6={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},u6={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Kg(...t){let n=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),e=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),r={};for(let i of t)if(i)for(let o in i){let s=i[o];if(s!==void 0)if(Array.isArray(s))r[o]=s;else if(e(s))r[o]=s;else if(n(s)){let a=r[o];n(a)?r[o]=Kg(a,s):r[o]=Kg(s)}else r[o]=s}return r}function d6(t,n){return Kg(c6,t,n||{})}function h6(t,n){return Kg(u6,t,n||{})}var Jg=class{constructor(n){this.client=n,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(n){return this.client.mfa.enroll(Object.assign(Object.assign({},n),{factorType:"webauthn"}))}async _challenge({factorId:n,webauthn:e,friendlyName:r,signal:i},o){try{let{data:s,error:a}=await this.client.mfa.challenge({factorId:n,webauthn:e});if(!s)return{data:null,error:a};let l=i??s6.createNewAbortSignal();if(s.webauthn.type==="create"){let{user:c}=s.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${r}`),c.displayName||(c.displayName=c.name)}switch(s.webauthn.type){case"create":{let c=d6(s.webauthn.credential_options.publicKey,o?.create),{data:u,error:d}=await a6({publicKey:c,signal:l});return u?{data:{factorId:n,challengeId:s.id,webauthn:{type:s.webauthn.type,credential_response:u}},error:null}:{data:null,error:d}}case"request":{let c=h6(s.webauthn.credential_options.publicKey,o?.request),{data:u,error:d}=await l6(Object.assign(Object.assign({},s.webauthn.credential_options),{publicKey:c,signal:l}));return u?{data:{factorId:n,challengeId:s.id,webauthn:{type:s.webauthn.type,credential_response:u}},error:null}:{data:null,error:d}}}}catch(s){return oe(s)?{data:null,error:s}:{data:null,error:new Wr("Unexpected error in challenge",s)}}}async _verify({challengeId:n,factorId:e,webauthn:r}){return this.client.mfa.verify({factorId:e,challengeId:n,webauthn:r})}async _authenticate({factorId:n,webauthn:{rpId:e=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},o){if(!e)return{data:null,error:new us("rpId is required for WebAuthn authentication")};try{if(!IR())return{data:null,error:new Wr("Browser does not support WebAuthn",null)};let{data:s,error:a}=await this.challenge({factorId:n,webauthn:{rpId:e,rpOrigins:r},signal:i},{request:o});if(!s)return{data:null,error:a};let{webauthn:l}=s;return this._verify({factorId:n,challengeId:s.challengeId,webauthn:{type:l.type,rpId:e,rpOrigins:r,credential_response:l.credential_response}})}catch(s){return oe(s)?{data:null,error:s}:{data:null,error:new Wr("Unexpected error in authenticate",s)}}}async _register({friendlyName:n,webauthn:{rpId:e=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},o){if(!e)return{data:null,error:new us("rpId is required for WebAuthn registration")};try{if(!IR())return{data:null,error:new Wr("Browser does not support WebAuthn",null)};let{data:s,error:a}=await this._enroll({friendlyName:n});if(!s)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===n&&f.status!=="unverified")}).then(u=>
49u?this.client.mfa.unenroll({factorId:u?.id}):void 0),{data:null,error:a};let{data:l,error:c}=await this._challenge({factorId:s.id,friendlyName:s.friendly_name,webauthn:{rpId:e,rpOrigins:r},signal:i},{create:o});return l?this._verify({factorId:s.id,challengeId:l.challengeId,webauthn:{rpId:e,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(s){return oe(s)?{data:null,error:s}:{data:null,error:new Wr("Unexpected error in register",s)}}}};bR();var f6={url:Jx,storageKey:Yx,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Zx,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function xR(t,n,e){return await e()}var xc={},p6=(()=>{class t{get jwks(){var e,r;return(r=(e=xc[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){xc[this.storageKey]=Object.assign(Object.assign({},xc[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=xc[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){xc[this.storageKey]=Object.assign(Object.assign({},xc[this.storageKey]),{cachedAt:e})}constructor(e){var r,i,o;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;let s=Object.assign(Object.assign({},f6),e);if(this.storageKey=s.storageKey,this.instanceID=(r=t.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,t.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&wn()){let a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new Ac({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=$g(s.fetch),this.lock=s.lock||xR,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,s.lock?this.lock=s.lock:wn()&&(!((i=globalThis?.navigator)===null||i===void 0)&&i.locks)?this.lock=fC:this.lock=xR,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new Jg(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:Hg()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=hC(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=hC(this.memoryStorage)),wn()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(o=this.broadcastChannel)===null||o===void 0||o.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a),await this._notifyAllSubscribers(a.data.event,a.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Fg}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},i="none";if(wn()&&(r=cR(window.location.href),this._isImplicitGrantCallback(r)?i="implicit":await this._isPKCECallback(r)&&(i="pkce")),wn()&&this.detectSessionInUrl&&i!=="none"){let{data:o,error:s}=await this._getSessionFromURL(r,i);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),nR(s)){let c=(e=s.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:s}}return await this._removeSession(),{error:s}}let{session:a,redirectType:l}=o;return this._debug("#_initialize()","detected session in URL",a,"redirect type",l),await this._saveSession(a),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return oe(r)?this._returnResult({error:r}):this._returnResult({error:new Wr("Unexpected error during initialization",r)}
49)}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,i,o;try{let s=await ye(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(r=e?.options)===null||r===void 0?void 0:r.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(o=e?.options)===null||o===void 0?void 0:o.captchaToken}},xform:Gr}),{data:a,error:l}=s;if(l||!a)return this._returnResult({data:{user:null,session:null},error:l});let c=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(s){if(oe(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var r,i,o;try{let s;if("email"in e){let{email:d,password:f,options:h}=e,p=null,m=null;this.flowType==="pkce"&&([p,m]=await La(this.storage,this.storageKey)),s=await ye(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h?.emailRedirectTo,body:{email:d,password:f,data:(r=h?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:h?.captchaToken},code_challenge:p,code_challenge_method:m},xform:Gr})}else if("phone"in e){let{phone:d,password:f,options:h}=e;s=await ye(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:f,data:(i=h?.data)!==null&&i!==void 0?i:{},channel:(o=h?.channel)!==null&&o!==void 0?o:"sms",gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:Gr})}else throw new Ra("You must provide either an email or phone number and a password");let{data:a,error:l}=s;if(l||!a)return this._returnResult({data:{user:null,session:null},error:l});let c=a.session,u=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(s){if(oe(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let r;if("email"in e){let{email:s,password:a,options:l}=e;r=await ye(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:a,gotrue_meta_security:{captcha_token:l?.captchaToken}},xform:uC})}else if("phone"in e){let{phone:s,password:a,options:l}=e;r=await ye(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:a,gotrue_meta_security:{captcha_token:l?.captchaToken}},xform:uC})}else throw new Ra("You must provide either an email or phone number and a password");let{data:i,error:o}=r;if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!i||!i.session||!i.user){let s=new bo;return this._returnResult({data:{user:null,session:null},error:s})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:o})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,i,o,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(i=e.options)===null||i===void 0?void 0:i.scopes,queryParams:(o=e.options)===null||o===void 0?void 0:o.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,i,o,s,a,l,c,u,d,f,h;let p,m;if("message"in e)p=e.message,m=e.signature;else{let{chain:g,wallet:w,statement:C,options:T}=e,I;if(wn())if(typeof w=="object")I=w;else{let De=window;if("ethereum"in De&&typeof De.ethereum=="object"&&"request"in De.ethereum&&typeof De.ethereum.request=="function")I=De.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof w!="object"||!T?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");I=w}let F=new URL((r=T?.url)!==null&&r!==void 0?r:window.location.href),$=await I.request({method:"eth_requestAccounts"}).then(De=>De).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!$||$.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let q=pC($[0]),G=(i=T?.signInWithEthereum)===null||i===void 0?void 0:i.chainId;if(!G){let De=await I.request({method:"eth_chainId"});G=wR(De)}let lt={domain:F.host,address:q,statement:C,uri:F.href,version:"1",chainId:G,nonce:(o=T?.signInWithEthereum)===null||o===void 0?void 0:o.nonce,issuedAt:(a=(s=T?.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(l=T?.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=T?.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=T?.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=T?.signInWithEthereum)===null||d===void 0?void 0:d.resources};p=CR(lt),m=await I.request({method:"personal_sign",params:[ER(p),q]})}try{let{data:g,error:w}=await ye(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:m},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(h=e.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:Gr});if(w)throw w;if(!g||!g.session||!g.user){let C=new bo;return this._returnResult({data:{user:null,session:null},error:C})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:w})}catch(g){if(oe(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(e){var r,i,o,s,a,l,c,u,d,f,h,p;let m,g;if("message"in e)m=e.message,g=e.signature;else{let{chain:w,wallet:C,statement:T,options:I}=e,F;if(wn())if(typeof C=="object")F=C;else{let q=window;if("solana"in q&&typeof q.solana=="object"&&("signIn"in q.solana&&typeof q.solana.signIn=="function"||"signMessage"in q.solana&&typeof q.solana.signMessage=="function"))F=q.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof C!="object"||!I?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");F=C}let $=new URL((r=I?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in F&&F.signIn){let q=await F.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},I?.signInWithSolana),{version:"1",domain:$.host,uri:$.href}),T?{statement:T}:null)),G;if(Array.isArray(q)&&q[0]&&typeof q[0]=="object")G=q[0];else if(q&&typeof q=="object"&&"signedMessage"in q&&"signature"in q)G=q;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in G&&"signature"in G&&(typeof G.signedMessage=="string"||G.signedMessage instanceof Uint8Array)&&G.signature instanceof Uint8Array)m=typeof G.signedMessage=="string"?G.signedMessage:new TextDecoder().decode(G.signedMessage),g=G.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in F)||typeof F.signMessage!="function"||!("publicKey"in F)||typeof F!="object"||!F.publicKey||!("toBase58"in F.publicKey)||typeof F.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${$.host} wants you to sign in with your Solana account:`,F.publicKey.toBase58(),...T?["",T,""]:[""],"Version: 1",`URI: ${$.href}`,`Issued At: ${(o=(i=I?.signInWithSolana)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date().toISOString()}`,...!((s=I?.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${I.signInWithSolana.notBefore}`]:[],...!((a=I?.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${I.signInWithSolana.expirationTime}`]:[],...!((l=I?.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${I.signInWithSolana.chainId}`]:[],...!((c=I?.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${I.signInWithSolana.nonce}`]:[],...!((u=I?.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${I.signInWithSolana.requestId}`]:[],...!((f=(d=I?.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||f===void 0)&&f.length?["Resources",...I.signInWithSolana.resources.map(G=>`- ${G}`)]:[]].join(` 50`);let q=await F.signMessage(new TextEncoder().encode(m),"utf8");if(!q||!(q instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=q}}try{let{data:w,error:C}=await ye(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:wo(g)}
50,!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:Gr});if(C)throw C;if(!w||!w.session||!w.user){let T=new bo;return this._returnResult({data:{user:null,session:null},error:T})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:C})}catch(w){if(oe(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async _exchangeCodeForSession(e){let r=await hs(this.storage,`${this.storageKey}-code-verifier`),[i,o]=(r??"").split("/");try{let{data:s,error:a}=await ye(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:i},xform:Gr});if(await Eo(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!s||!s.session||!s.user){let l=new bo;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:o??null}),error:a})}catch(s){if(oe(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{let{options:r,provider:i,token:o,access_token:s,nonce:a}=e,l=await ye(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:o,access_token:s,nonce:a,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:Gr}),{data:c,error:u}=l;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user){let d=new bo;return this._returnResult({data:{user:null,session:null},error:d})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:u})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,i,o,s,a;try{if("email"in e){let{email:l,options:c}=e,u=null,d=null;this.flowType==="pkce"&&([u,d]=await La(this.storage,this.storageKey));let{error:f}=await ye(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(r=c?.data)!==null&&r!==void 0?r:{},create_user:(i=c?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c?.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:f})}if("phone"in e){let{phone:l,options:c}=e,{data:u,error:d}=await ye(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(o=c?.data)!==null&&o!==void 0?o:{},create_user:(s=c?.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:c?.captchaToken},channel:(a=c?.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:u?.message_id},error:d})}throw new Ra("You must provide either an email or phone number.")}catch(l){if(oe(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(e){var r,i;try{let o,s;"options"in e&&(o=(r=e.options)===null||r===void 0?void 0:r.redirectTo,s=(i=e.options)===null||i===void 0?void 0:i.captchaToken);let{data:a,error:l}=await ye(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:o,xform:Gr});if(l)throw l;if(!a)throw new Error("An error occurred on token verification.");let c=a.session,u=a.user;return c?.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(o){if(oe(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithSSO(e){var r,i,o,s,a;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await La(this.storage,this.storageKey));let u=await ye(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(i=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&i!==void 0?i:void 0}),!((o=e?.options)===null||o===void 0)&&o.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:l,code_challenge_method:c}),headers:this.headers,xform:yR});return!((s=u.data)===null||s===void 0)&&s.url&&wn()&&!(!((a=e.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(oe(l))return this._returnResult({data:null,error:l});throw l}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:r},error:i}=e;if(i)throw i;if(!r)throw new On;let{error:o}=await ye(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:o})})}catch(e){if(oe(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let r=`${this.url}/resend`;if("email"in e){let{email:i,type:o,options:s}=e,{error:a}=await ye(this.fetch,"POST",r,{headers:this.headers,body:{email:i,type:o,gotrue_meta_security:{captcha_token:s?.captchaToken}},redirectTo:s?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in e){let{phone:i,type:o,options:s}=e,{data:a,error:l}=await ye(this.fetch,"POST",r,{headers:this.headers,body:{phone:i,type:o,gotrue_meta_security:{captcha_token:s?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a?.message_id},error:l})}throw new Ra("You must provide either an email or phone number and a type")}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),o=(async()=>(await i,await r()))();return this.pendingInLock.push((async()=>{try{await o}catch{}})()),o}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let i=r();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){let o=[...this.pendingInLock];await Promise.all(o),this.pendingInLock.splice(0,o.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null,r=await hs(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not val
50id"),await this._removeSession())),!e)return{data:{session:null},error:null};let i=e.expires_at?e.expires_at*1e3-Date.now()<jg:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",e.expires_at),!i){if(this.userStorage){let a=await hs(this.userStorage,this.storageKey+"-user");a?.user?e.user=a.user:e.user=qg()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){let a={value:this.suppressGetSessionWarning};e.user=gR(e.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}let{data:o,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:o},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await ye(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Wi}):await this._useSession(async r=>{var i,o,s;let{data:a,error:l}=r;if(l)throw l;return!(!((i=a.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new On}:await ye(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(o=a.session)===null||o===void 0?void 0:o.access_token)!==null&&s!==void 0?s:void 0,xform:Wi})})}catch(r){if(oe(r))return tR(r)&&(await this._removeSession(),await Eo(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async i=>{let{data:o,error:s}=i;if(s)throw s;if(!o.session)throw new On;let a=o.session,l=null,c=null;this.flowType==="pkce"&&e.email!=null&&([l,c]=await La(this.storage,this.storageKey));let{data:u,error:d}=await ye(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:c}),jwt:a.access_token,xform:Wi});if(d)throw d;return a.user=u.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(i){if(oe(i))return this._returnResult({data:{user:null},error:i});throw i}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new On;let r=Date.now()/1e3,i=r,o=!0,s=null,{payload:a}=zg(e.access_token);if(a.exp&&(i=a.exp,o=i<=r),o){let{data:l,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l)return{data:{user:null,session:null},error:null};s=l}else{let{data:l,error:c}=await this._getUser(e.access_token);if(c)throw c;s={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:i-r,expires_at:i},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(r){if(oe(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var i;if(!e){let{data:a,error:l}=r;if(l)throw l;e=(i=a.session)!==null&&i!==void 0?i:void 0}if(!e?.refresh_token)throw new On;let{data:o,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):o?this._returnResult({data:{user:o.user,session:o},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){try{if(!wn())throw new Oa("No browser detected.");
50if(e.error||e.error_description||e.error_code)throw new Oa(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new ah("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Oa("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new ah("No code detected.");let{data:T,error:I}=await this._exchangeCodeForSession(e.code);if(I)throw I;let F=new URL(window.location.href);return F.searchParams.delete("code"),window.history.replaceState(window.history.state,"",F.toString()),{data:{session:T.session,redirectType:null},error:null}}let{provider_token:i,provider_refresh_token:o,access_token:s,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=e;if(!s||!l||!a||!u)throw new Oa("No session defined in URL");let d=Math.round(Date.now()/1e3),f=parseInt(l),h=d+f;c&&(h=parseInt(c));let p=h-d;p*1e3<=xa&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${f}s`);let m=h-f;d-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,h,d):d-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,h,d);let{data:g,error:w}=await this._getUser(s);if(w)throw w;let C={provider_token:i,provider_refresh_token:o,access_token:s,expires_in:f,expires_at:h,refresh_token:a,token_type:u,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:C,redirectType:e.type},error:null})}catch(i){if(oe(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let r=await hs(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var i;let{data:o,error:s}=r;if(s)return this._returnResult({error:s});let a=(i=o.session)===null||i===void 0?void 0:i.access_token;if(a){let{error:l}=await this.admin.signOut(a,e);if(l&&!(eR(l)&&(l.status===404||l.status===401||l.status===403)))return this._returnResult({error:l})}return e!=="others"&&(await this._removeSession(),await Eo(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let r=lR(),i={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,i),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:i}}}async _emitInitialSession(e){return await this._useSession(async r=>{var i,o;try{let{data:{session:s},error:a}=r;if(a)throw a;await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((o=this.stateChangeEmitters.get(e))===null||o===void 0?void 0:o.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,r={}){let i=null,o=null;this.flowType==="pkce"&&([i,o]=await La(this.storage,this.storageKey,!0));try{return await ye(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:i,code_challenge_method:o,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(s){if(oe(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{let{data:r,error:i}=await this.getUser();if(i)throw i;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{let{data:i,error:o}=await this._useSession(async s=>{var a,l,c,u,d;let{data:f,error:h}=s;if(h)throw h;let p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await ye(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(u=f.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(o)throw o;
50return wn()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(i?.url),this._returnResult({data:{provider:e.provider,url:i?.url},error:null})}catch(i){if(oe(i))return this._returnResult({data:{provider:e.provider,url:null},error:i});throw i}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var i;try{let{error:o,data:{session:s}}=r;if(o)throw o;let{options:a,provider:l,token:c,access_token:u,nonce:d}=e,f=await ye(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(i=s?.access_token)!==null&&i!==void 0?i:void 0,body:{provider:l,id_token:c,access_token:u,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:Gr}),{data:h,error:p}=f;return p?this._returnResult({data:{user:null,session:null},error:p}):!h||!h.session||!h.user?this._returnResult({data:{user:null,session:null},error:new bo}):(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),this._returnResult({data:h,error:p}))}catch(o){if(oe(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var i,o;let{data:s,error:a}=r;if(a)throw a;return await ye(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(o=(i=s.session)===null||i===void 0?void 0:i.access_token)!==null&&o!==void 0?o:void 0})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){let r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{let i=Date.now();return await hR(async o=>(o>0&&await dR(200*Math.pow(2,o-1)),this._debug(r,"refreshing attempt",o),await ye(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Gr})),(o,s)=>{let a=200*Math.pow(2,o);return s&&Vg(s)&&Date.now()+a-i<xa})}catch(i){if(this._debug(r,"error",i),oe(i))return this._returnResult({data:{session:null,user:null},error:i});throw i}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){let i=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",i),wn()&&!r.skipBrowserRedirect&&window.location.assign(i),{data:{provider:e,url:i},error:null}}async _recoverAndRefresh(){var e,r;let i="#_recoverAndRefresh()";this._debug(i,"begin");try{let o=await hs(this.storage,this.storageKey);if(o&&this.userStorage){let a=await hs(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:o.user},await Fa(this.userStorage,this.storageKey+"-user",a)),o.user=(e=a?.user)!==null&&e!==void 0?e:qg()}else if(o&&!o.user&&!o.user){let a=await hs(this.storage,this.storageKey+"-user");a&&a?.user?(o.user=a.user,await Eo(this.storage,this.storageKey+"-user"),await Fa(this.storage,this.storageKey,o)):o.user=qg()}if(this._debug(i,"session from storage",o),!this._isValidSession(o)){this._debug(i,"session is not valid"),o!==null&&await this._removeSession();return}let s=((r=o.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<jg;if(this._debug(i,`session has${s?"":" not"} expired with margin of ${jg}s`),s){if(this.autoRefreshToken&&o.refresh_token){let{error:a}=await this._callRefreshToken(o.refresh_token);a&&(console.error(a),Vg(a)||(this._debug(i,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(o.user&&o.user.__isUserNotAvailableProxy===!0)try{let{data:a,error:l}=await this._getUser(o.access_token);!l&&a?.user?(o.user=a.user,await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)):this._debug(i,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(i,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",o)}catch(o){this._debug(i,"error",o),console.error(o);return}finally{this._debug(i,"end")}}async _callRefreshToken(e){var r,i;if(!e)throw new On;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let o=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(o,"begin");try{this.refreshingDeferred=new ch;let{data:s,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!s.session)throw new On;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);let l={data:s.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(s){if(this._debug(o,"error",s),oe(s)){let a={data:null,error:s};return Vg(s)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(a),a}throw(i=this.refreshingDeferred)===null||i===void 0||i.reject(s),s}finally{this.refreshingDeferred=null,this._debug(o,"end")}}async _notifyAllSubscribers(e,r,i=!0){let o=`#_notifyAllSubscribers(${e})`;this._debug(o,"begin",r,`broadcast = ${i}`);try{this.broadcastChannel&&i&&this.broadcastChannel.postMessage({event:e,session:r});let s=[],a=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,r)}catch(c){s.push(c)}});if(await Promise.all(a),s.length>0){for(let l=0;l<s.length;l+=1)console.error(s[l]);throw s[0]}}finally{this._debug(o,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let r=Object.assign({},e),i=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!i&&r.user&&await Fa(this.userStorage,this.storageKey+"-user",{user:r.user});let o=Object.assign({},r);delete o.user;let s=cC(o);await Fa(this.storage,this.storageKey,s)}else{let o=cC(r);await Fa(this.storage,this.storageKey,o)}}async _removeSession(){this._debug("#_removeSession()"),await Eo(this.storage,this.storageKey),await Eo(this.storage,this.storageKey+"-code-verifier"),await Eo(this.storage,this.storageKey+"-user"),this.userStorage&&await Eo(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&wn()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}
50catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),xa);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async r=>{let{data:{session:i}}=r;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let o=Math.floor((i.expires_at*1e3-e)/xa);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${xa}ms, refresh threshold is ${Lg} ticks`),o<=Lg&&await this._callRefreshToken(i.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof uh)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!wn()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,i){let o=[`provider=${encodeURIComponent(r)}`];if(i?.redirectTo&&o.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i?.scopes&&o.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){let[s,a]=await La(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(a)}`});o.push(l.toString())}if(i?.queryParams){let s=new URLSearchParams(i.queryParams);o.push(s.toString())}return i?.skipBrowserRedirect&&o.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${e}?${o.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var i;let{data:o,error:s}=r;return s?this._returnResult({data:null,error:s}):await ye(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var i,o;let{data:s,error:a}=r;if(a)return this._returnResult({data:null,error:a});let l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:c,error:u}=await ye(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(i=s?.session)===null||i===void 0?void 0:i.access_token});return u?this._returnResult({data:null,error:u}):(e.factorType==="totp"&&c.type==="totp"&&(!((o=c?.totp)===null||o===void 0)&&o.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var i;let{data:o,error:s}=r;if(s)return this._returnResult({data:null,error:s});let a=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?MR(e.webauthn.credential_response):AR(e.webauthn.credential_response)})}:{code:e.code}),{data:l,error:c}=await ye(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:a,headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:c}))})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var i;let{data:o,error:s}=r;if(s)return this._returnResult({data:null,error:s});let a=await ye(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(i=o?.session)===null||i===void 0?void 0:i.access_token});if(a.error)return a;let{data:l}=a;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:TR(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:kR(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){let{data:r,error:i}=await this._challenge({factorId:e.factorId});return i?this._returnResult({data:null,error:i}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;let{data:{user:r},error:i}=await this.getUser();if(i)return{data:null,error:i};let o={all:[],phone:[],totp:[],webauthn:[]};for(let s of(e=r?.factors)!==null&&e!==void 0?e:[])o.all.push(s),s.status==="verified"&&o[s.factor_type].push(s);return{data:o,error:null}}async _getAuthenticatorAssuranceLevel(){var e,r;let{data:{session:i},error:o}
50=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:s}=zg(i.access_token),a=null;s.aal&&(a=s.aal);let l=a;((r=(e=i.user.factors)===null||e===void 0?void 0:e.filter(d=>d.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(l="aal2");let u=s.amr||[];return{data:{currentLevel:a,nextLevel:l,currentAuthenticationMethods:u},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{let{data:{session:i},error:o}=r;return o?this._returnResult({data:null,error:o}):i?await ye(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:i.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new On})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async i=>{let{data:{session:o},error:s}=i;if(s)return this._returnResult({data:null,error:s});if(!o)return this._returnResult({data:null,error:new On});let a=await ye(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return a.data&&a.data.redirect_url&&wn()&&!r?.skipBrowserRedirect&&window.location.assign(a.data.redirect_url),a})}catch(i){if(oe(i))return this._returnResult({data:null,error:i});throw i}}async _denyAuthorization(e,r){try{return await this._useSession(async i=>{let{data:{session:o},error:s}=i;if(s)return this._returnResult({data:null,error:s});if(!o)return this._returnResult({data:null,error:new On});let a=await ye(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return a.data&&a.data.redirect_url&&wn()&&!r?.skipBrowserRedirect&&window.location.assign(a.data.redirect_url),a})}catch(i){if(oe(i))return this._returnResult({data:null,error:i});throw i}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:r},error:i}=e;return i?this._returnResult({data:null,error:i}):r?await ye(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new On})})}catch(e){if(oe(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{let{data:{session:i},error:o}=r;return o?this._returnResult({data:null,error:o}):i?(await ye(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:i.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new On})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let i=r.keys.find(l=>l.kid===e);if(i)return i;let o=Date.now();if(i=this.jwks.keys.find(l=>l.kid===e),i&&this.jwks_cached_at+Qx>o)return i;let{data:s,error:a}=await ye(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=o,i=s.keys.find(l=>l.kid===e),!i)?null:i}async getClaims(e,r={}){try{let i=e;if(!i){let{data:p,error:m}
50=await this.getSession();if(m||!p.session)return this._returnResult({data:null,error:m});i=p.session.access_token}let{header:o,payload:s,signature:a,raw:{header:l,payload:c}}=zg(i);r?.allowExpired||pR(s.exp);let u=!o.alg||o.alg.startsWith("HS")||!o.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(o.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!u){let{error:p}=await this.getUser(i);if(p)throw p;return{data:{claims:s,header:o,signature:a},error:null}}let d=mR(o.alg),f=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,f,a,sR(`${l}.${c}`)))throw new Na("Invalid JWT signature");return{data:{claims:s,header:o,signature:a},error:null}}catch(i){if(oe(i))return this._returnResult({data:null,error:i});throw i}}}return t.nextInstanceID={},t})(),vC=p6;var m6=vC,yC=m6;var Yg=class extends yC{constructor(n){super(n)}};var nr=class{constructor(n,e,r){var i,o,s;this.supabaseUrl=n,this.supabaseKey=e;let a=Kx(n);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);let l=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:$x,realtime:qx,auth:Object.assign(Object.assign({},zx),{storageKey:l}),global:Hx},u=Gx(r??{},c);this.storageKey=(i=u.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(o=u.global.headers)!==null&&o!==void 0?o:{},u.accessToken?(this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(d,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((s=u.auth)!==null&&s!==void 0?s:{},this.headers,u.global.fetch),this.fetch=Wx(e,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},u.realtime)),this.accessToken&&this.accessToken().then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new Sx(new URL("rest/v1",a).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this.storage=new ih(this.storageUrl.href,this.headers,this.fetch,r?.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new Gd(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(n){return this.rest.from(n)}schema(n){return this.rest.schema(n)}rpc(n,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(n,e,r)}channel(n,e={config:{}}){return this.realtime.channel(n,e)}getChannels(){return this.realtime.getChannels()}removeChannel(n){return this.realtime.removeChannel(n)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var n,e;if(this.accessToken)return await this.accessToken();let{data:r}=await this.auth.getSession();return(e=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&e!==void 0?e:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:n,persistSession:e,detectSessionInUrl:r,storage:i,userStorage:o,storageKey:s,flowType:a,lock:l,debug:c,throwOnError:u},d,f){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Yg({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),d),storageKey:s,autoRefreshToken:n,persistSession:e,detectSessionInUrl:r,storage:i,userStorage:o,flowType:a,lock:l,debug:c,throwOnError:u,fetch:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(p=>p.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new Qd(this.realtimeUrl.href,Object.assign(Object.assign({},n),{params:Object.assign({apikey:this.supabaseKey},n?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,r)=>{this._handleTokenChanged(e,"CLIENT",r?.access_token)})}_handleTokenChanged(n,e,r){(n==="TOKEN_REFRESHED"||n==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):n==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};var RR=(t,n,e)=>new nr(t,n,e);function g6(){if(typeof window<"u"||typeof process>"u")return!1;let t=process.version;if(t==null)return!1;let n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}g6()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to N
50ode.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");var Kr={production:!1,toastsDuration:5e3,supabaseUrl:"https://wsfoqvrgzwrnyoriiwuo.supabase.co",supabaseKey:"sb_publishable_rodq7jr55R8SVSgVIaOx3Q_wvxmOafJ",uldkUrl:"https://uldk.gugik.gov.pl/7.0/?request=GetParcelById",wmsBaseUrl:"https://integracja.gugik.gov.pl/cgi-bin/KrajowaIntegracjaEwidencjiGruntow"};var HR=(()=>{class t{_renderer;_elementRef;onChange=e=>{};onTouched=()=>{};constructor(e,r){this._renderer=e,this._elementRef=r}setProperty(e,r){this._renderer.setProperty(this._elementRef.nativeElement,e,r)}registerOnTouched(e){this.onTouched=e}registerOnChange(e){this.onChange=e}setDisabledState(e){this.setProperty("disabled",e)}static \u0275fac=function(r){return new(r||t)(_e(Tn),_e(We))};static \u0275dir=Oe({type:t})}return t})(),SC=(()=>{class t extends HR{static \u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})();static \u0275dir=Oe({type:t,features:[kn]})}return t})(),vh=new P("");var v6={provide:vh,useExisting:Rr(()=>Pc),multi:!0};function y6(){let t=Hr()?Hr().getUserAgent():"";return/android (\d+)/.test(t.toLowerCase())}var _6=new P(""),Pc=(()=>{class t extends HR{_compositionMode;_composing=!1;constructor(e,r,i){super(e,r),this._compositionMode=i,this._compositionMode==null&&(this._compositionMode=!y6())}writeValue(e){let r=e??"";this.setProperty("value",r)}_handleInput(e){(!this._compositionMode||this._compositionMode&&!this._composing)&&this.onChange(e)}_compositionStart(){this._composing=!0}_compositionEnd(e){this._composing=!1,this._compositionMode&&this.onChange(e)}static \u0275fac=function(r){return new(r||t)(_e(Tn),_e(We),_e(_6,8))};static \u0275dir=Oe({type:t,selectors:[["input","formControlName","",3,"type","checkbox"],["textarea","formControlName",""],["input","formControl","",3,"type","checkbox"],["textarea","formControl",""],["input","ngModel","",3,"type","checkbox"],["textarea","ngModel",""],["","ngDefaultControl",""]],hostBindings:function(r,i){r&1&&Ge("input",function(s){return i._handleInput(s.target.value)})("blur",function(){return i.onTouched()})("compositionstart",function(){return i._compositionStart()})("compositionend",function(s){return i._compositionEnd(s.target.value)})},standalone:!1,features:[Cr([v6]),kn]})}return t})();function DC(t){return t==null||IC(t)===0}function IC(t){return t==null?null:Array.isArray(t)||typeof t=="string"?t.length:t instanceof Set?t.size:null}var TC=new P(""),kC=new P(""),b6=/^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Co=class{static min(n){return w6(n)}static max(n){return E6(n)}static required(n){return C6(n)}static requiredTrue(n){return S6(n)}static email(n){return D6(n)}static minLength(n){return I6(n)}static maxLength(n){return T6(n)}static pattern(n){return k6(n)}static nullValidator(n){return $R()}static compose(n){return JR(n)}static composeAsync(n){return ZR(n)}};function w6(t){return n=>{if(n.value==null||t==null)return null;let e=parseFloat(n.value);return!isNaN(e)&&e<t?{min:{min:t,actual:n.value}}:null}}function E6(t){return n=>{if(n.value==null||t==null)return null;let e=parseFloat(n.value);return!isNaN(e)&&e>t?{max:{max:t,actual:n.value}}:null}}function C6(t){return DC(t.value)?{required:!0}:null}function S6(t){return t.value===!0?null:{required:!0}}function D6(t){return DC(t.value)||b6.test(t.value)?null:{email:!0}}function I6(t){return n=>{let e=n.value?.length??IC(n.value);return e===null||e===0?null:e<t?{minlength:{requiredLength:t,actualLength:e}}:null}}function T6(t){return n=>{let e=n.value?.length??IC(n.value);return e!==null&&e>t?{maxlength:{requiredLength:t,actualLength:e}}:null}}function k6(t){if(!t)return $R;let n,e;return typeof t=="string"?(e="",t.charAt(0)!=="^"&&(e+="^"),e+=t,t.charAt(t.length-1)!=="$"&&(e+="$"),n=new RegExp(e)):(e=t.toString(),n=t),r=>{if(DC(r.value))return null;let i=r.value;return n.test(i)?null:{pattern:{requiredPattern:e,actualValue:i}}}}function $R(t){return null}function zR(t){return t!=null}function qR(t){return Go(t)?Xe(t):t}function WR(t){let n={};
vendor: 4,362 bytes, line 50
50return t.forEach(e=>{n=e!=null?A(A({},n),e):n}),Object.keys(n).length===0?null:n}function GR(t,n){return n.map(e=>e(t))}function M6(t){return!t.validate}function KR(t){return t.map(n=>M6(n)?n:e=>n.validate(e))}function JR(t){if(!t)return null;let n=t.filter(zR);return n.length==0?null:function(e){return WR(GR(e,n))}}function YR(t){return t!=null?JR(KR(t)):null}function ZR(t){if(!t)return null;let n=t.filter(zR);return n.length==0?null:function(e){let r=GR(e,n).map(qR);return Us(r).pipe(te(WR))}}function XR(t){return t!=null?ZR(KR(t)):null}function OR(t,n){return t===null?[n]:Array.isArray(t)?[...t,n]:[t,n]}function QR(t){return t._rawValidators}function eO(t){return t._rawAsyncValidators}function _C(t){return t?Array.isArray(t)?t:[t]:[]}function Xg(t,n){return Array.isArray(t)?t.includes(n):t===n}function NR(t,n){let e=_C(n);return _C(t).forEach(i=>{Xg(e,i)||e.push(i)}),e}function PR(t,n){return _C(n).filter(e=>!Xg(t,e))}var Qg=class{get value(){return this.control?this.control.value:null}get valid(){return this.control?this.control.valid:null}get invalid(){return this.control?this.control.invalid:null}get pending(){return this.control?this.control.pending:null}get disabled(){return this.control?this.control.disabled:null}get enabled(){return this.control?this.control.enabled:null}get errors(){return this.control?this.control.errors:null}get pristine(){return this.control?this.control.pristine:null}get dirty(){return this.control?this.control.dirty:null}get touched(){return this.control?this.control.touched:null}get status(){return this.control?this.control.status:null}get untouched(){return this.control?this.control.untouched:null}get statusChanges(){return this.control?this.control.statusChanges:null}get valueChanges(){return this.control?this.control.valueChanges:null}get path(){return null}_composedValidatorFn;_composedAsyncValidatorFn;_rawValidators=[];_rawAsyncValidators=[];_setValidators(n){this._rawValidators=n||[],this._composedValidatorFn=YR(this._rawValidators)}_setAsyncValidators(n){this._rawAsyncValidators=n||[],this._composedAsyncValidatorFn=XR(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn||null}get asyncValidator(){return this._composedAsyncValidatorFn||null}_onDestroyCallbacks=[];_registerOnDestroy(n){this._onDestroyCallbacks.push(n)}_invokeOnDestroyCallbacks(){this._onDestroyCallbacks.forEach(n=>n()),this._onDestroyCallbacks=[]}reset(n=void 0){this.control&&this.control.reset(n)}hasError(n,e){return this.control?this.control.hasError(n,e):!1}getError(n,e){return this.control?this.control.getError(n,e):null}},Ha=class extends Qg{name;get formDirective(){return null}get path(){return null}},$a=class extends Qg{_parent=null;name=null;valueAccessor=null},ev=class{_cd;constructor(n){this._cd=n}get isTouched(){return this._cd?.control?._touched?.(),!!this._cd?.control?.touched}get isUntouched(){return!!this._cd?.control?.untouched}get isPristine(){return this._cd?.control?._pristine?.(),!!this._cd?.control?.pristine}get isDirty(){return!!this._cd?.control?.dirty}get isValid(){return this._cd?.control?._status?.(),!!this._cd?.control?.valid}get isInvalid(){return!!this._cd?.control?.invalid}get isPending(){return!!this._cd?.control?.pending}get isSubmitted(){return this._cd?._submitted?.(),!!this._cd?.submitted}};var Fc=(()=>{class t extends ev{constructor(e){super(e)}static \u0275fac=function(r){return new(r||t)(_e($a,2))};static \u0275dir=Oe({type:t,selectors:[["","formControlName",""],["","ngModel",""],["","formControl",""]],hostVars:14,hostBindings:function(r,i){r&2&&Er("ng-untouched",i.isUntouched)("ng-touched",i.isTouched)("ng-pristine",i.isPristine)("ng-dirty",i.isDirty)("ng-valid",i.isValid)("ng-invalid",i.isInvalid)("ng-pending",i.isPending)},standalone:!1,features:[kn]})}return t})(),ov=(()=>{class t extends ev{constructor(e){super(e)}static \u0275fac=function(r){return new(r||t)(_e(Ha,10))};static \u0275dir=Oe({type:t,selectors:[["","formGroupName",""],["","formArrayName",""],["","ngModelGroup",""],["","formGroup",""],["","formArray",""],["form",3,"ngNoForm",""],["","ngForm",""]],hostVars:16,hostBindings:function(r,i){r&2&&Er("ng-untouched",i.isUntouched)("ng-touched",i.isTouched)("ng-pristine",i.isPristine)("ng-dirty",i.isDirty)("ng-valid",i.isValid)("ng-invalid",i.isInvalid)("ng-pending",i.isPending)("ng-submitted",i.isSubmitted)}
vendor: 8,949 bytes, line 50
50,standalone:!1,features:[kn]})}return t})();var dh="VALID",Zg="INVALID",Rc="PENDING",hh="DISABLED",fs=class{},tv=class extends fs{value;source;constructor(n,e){super(),this.value=n,this.source=e}},fh=class extends fs{pristine;source;constructor(n,e){super(),this.pristine=n,this.source=e}},ph=class extends fs{touched;source;constructor(n,e){super(),this.touched=n,this.source=e}},Oc=class extends fs{status;source;constructor(n,e){super(),this.status=n,this.source=e}},bC=class extends fs{source;constructor(n){super(),this.source=n}},gh=class extends fs{source;constructor(n){super(),this.source=n}};function MC(t){return(sv(t)?t.validators:t)||null}function A6(t){return Array.isArray(t)?YR(t):t||null}function AC(t,n){return(sv(n)?n.asyncValidators:t)||null}function x6(t){return Array.isArray(t)?XR(t):t||null}function sv(t){return t!=null&&!Array.isArray(t)&&typeof t=="object"}function tO(t,n,e){let r=t.controls;if(!(n?Object.keys(r):r).length)throw new z(1e3,"");if(!r[e])throw new z(1001,"")}function nO(t,n,e){t._forEachChild((r,i)=>{if(e[i]===void 0)throw new z(1002,"")})}var Nc=class{_pendingDirty=!1;_hasOwnPendingAsyncValidator=null;_pendingTouched=!1;_onCollectionChange=()=>{};_updateOn;_parent=null;_asyncValidationSubscription;_composedValidatorFn;_composedAsyncValidatorFn;_rawValidators;_rawAsyncValidators;value;constructor(n,e){this._assignValidators(n),this._assignAsyncValidators(e)}get validator(){return this._composedValidatorFn}set validator(n){this._rawValidators=this._composedValidatorFn=n}get asyncValidator(){return this._composedAsyncValidatorFn}set asyncValidator(n){this._rawAsyncValidators=this._composedAsyncValidatorFn=n}get parent(){return this._parent}get status(){return nt(this.statusReactive)}set status(n){nt(()=>this.statusReactive.set(n))}_status=le(()=>this.statusReactive(),{});statusReactive=Ee(void 0,{});get valid(){return this.status===dh}get invalid(){return this.status===Zg}get pending(){return this.status==Rc}get disabled(){return this.status===hh}get enabled(){return this.status!==hh}errors;get pristine(){return nt(this.pristineReactive)}set pristine(n){nt(()=>this.pristineReactive.set(n))}_pristine=le(()=>this.pristineReactive(),{});pristineReactive=Ee(!0,{});get dirty(){return!this.pristine}get touched(){return nt(this.touchedReactive)}set touched(n){nt(()=>this.touchedReactive.set(n))}_touched=le(()=>this.touchedReactive(),{});touchedReactive=Ee(!1,{});get untouched(){return!this.touched}_events=new ve;events=this._events.asObservable();valueChanges;statusChanges;get updateOn(){return this._updateOn?this._updateOn:this.parent?this.parent.updateOn:"change"}setValidators(n){this._assignValidators(n)}setAsyncValidators(n){this._assignAsyncValidators(n)}addValidators(n){this.setValidators(NR(n,this._rawValidators))}addAsyncValidators(n){this.setAsyncValidators(NR(n,this._rawAsyncValidators))}removeValidators(n){this.setValidators(PR(n,this._rawValidators))}removeAsyncValidators(n){this.setAsyncValidators(PR(n,this._rawAsyncValidators))}hasValidator(n){return Xg(this._rawValidators,n)}hasAsyncValidator(n){return Xg(this._rawAsyncValidators,n)}clearValidators(){this.validator=null}clearAsyncValidators(){this.asyncValidator=null}markAsTouched(n={}){let e=this.touched===!1;this.touched=!0;let r=n.sourceControl??this;this._parent&&!n.onlySelf&&this._parent.markAsTouched(Z(A({},n),{sourceControl:r})),e&&n.emitEvent!==!1&&this._events.next(new ph(!0,r))}markAllAsDirty(n={}){this.markAsDirty({onlySelf:!0,emitEvent:n.emitEvent,sourceControl:this}),this._forEachChild(e=>e.markAllAsDirty(n))}markAllAsTouched(n={}){this.markAsTouched({onlySelf:!0,emitEvent:n.emitEvent,sourceControl:this}),this._forEachChild(e=>e.markAllAsTouched(n))}markAsUntouched(n={}){let e=this.touched===!0;this.touched=!1,this._pendingTouched=!1;let r=n.sourceControl??this;this._forEachChild(i=>{i.markAsUntouched({onlySelf:!0,emitEvent:n.emitEvent,sourceControl:r})}),this._parent&&!n.onlySelf&&this._parent._updateTouched(n,r),e&&n.emitEvent!==!1&&this._events.next(new ph(!1,r))}markAsDirty(n={}){let e=this.pristine===!0;this.pristine=!1;let r=n.sourceControl??this;this._parent&&!n.onlySelf&&this._parent.markAsDirty(Z(A({},n),{sourceControl:r})),e&&n.emitEvent!==!1&&this._events.next(new fh(!1,r))}markAsPristine(n={}){let e=this.pristine===!1;this.pristine=!0,this._pendingDirty=!1;let r=n.sourceControl??this;this._forEachChild(i=>{i.markAsPristine({onlySelf:!0,emitEvent:n.emitEvent})}),this._parent&&!n.onlySelf&&this._parent._updatePristine(n,r),e&&n.emitEvent!==!1&&this._events.next(new fh(!0,r))}markAsPending(n={}){this.status=Rc;let e=n.sourceControl??this;n.emitEvent!==!1&&(this._events.next(new Oc(this.status,e)),this.statusChanges.emit(this.status)),this._parent&&!n.onlySelf&&this._parent.markAsPending(Z(A({},n),{sourceControl:e}))}disable(n={}){let e=this._parentMarkedDirty(n.onlySelf);this.status=hh,this.errors=null,this._forEachChild(i=>{i.disable(Z(A({},n),{onlySelf:!0}))}),this._updateValue();let r=n.sourceControl??this;n.emitEvent!==!1&&(this._events.next(new tv(this.value,r)),this._events.next(new Oc(this.status,r)),this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._updateAncestors(Z(A({},n),{skipPristineCheck:e}),this),this._onDisabledChange.forEach(i=>i(!0))}enable(n={}){let e=this._parentMarkedDirty(n.onlySelf);this.status=dh,this._forEachChild(r=>{r.enable(Z(A({},n),{onlySelf:!0}))}),this.updateValueAndValidity({onlySelf:!0,emitEvent:n.emitEvent}),this._updateAncestors(Z(A({},n),{skipPristineCheck:e}),this),this._onDisabledChange.forEach(r=>r(!1))}_updateAncestors(n,e){this._parent&&!n.onlySelf&&(this._parent.updateValueAndValidity(n),n.skipPristineCheck||this._parent._updatePristine({},e),this._parent._updateTouched({},e))}setParent(n){this._parent=n}getRawValue(){return this.value}updateValueAndValidity(n={}){if(this._setInitialStatus(),this._updateValue(),this.enabled){let r=this._cancelExistingSubscription();this.errors=this._runValidator(),this.status=this._calculateStatus(),(this.status===dh||this.status===Rc)&&this._runAsyncValidator(r,n.emitEvent)}let e=n.sourceControl??this;n.emitEvent!==!1&&(this._events.next(new tv(this.value,e)),this._events.next(new Oc(this.status,e)),this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._parent&&!n.onlySelf&&this._parent.updateValueAndValidity(Z(A({},n),{sourceControl:e}))}_updateTreeValidity(n={emitEvent:!0}){this._forEachChild(e=>e._updateTreeValidity(n)),this.updateValueAndValidity({onlySelf:!0,emitEvent:n.emitEvent})}_setInitialStatus(){this.status=this._allControlsDisabled()?hh:dh}_runValidator(){return this.validator?this.validator(this):null}_runAsyncValidator(n,e){if(this.asyncValidator){this.status=Rc,this._hasOwnPendingAsyncValidator={emitEvent:e!==!1,shouldHaveEmitted:n!==!1};let r=qR(this.asyncValidator(this));this._asyncValidationSubscription=r.subscribe(i=>{this._hasOwnPendingAsyncValidator=null,this.setErrors(i,{emitEvent:e,shouldHaveEmitted:n})})}}_cancelExistingSubscription(){if(this._asyncValidationSubscription){this._asyncValidationSubscription.unsubscribe();let n=(this._hasOwnPendingAsyncValidator?.emitEvent||this._hasOwnPendingAsyncValidator?.shouldHaveEmitted)??!1;return this._hasOwnPendingAsyncValidator=null,n}return!1}setErrors(n,e={}){this.errors=n,this._updateControlsErrors(e.emitEvent!==!1,this,e.shouldHaveEmitted)}get(n){let e=n;return e==null||(Array.isArray(e)||(e=e.split(".")),e.length===0)?null:e.reduce((r,i)=>r&&r._find(i),this)}getError(n,e){let r=e?this.get(e):this;return r&&r.errors?r.errors[n]:null}hasError(n,e){return!!this.getError(n,e)}get root(){let n=this;for(;n._parent;)n=n._parent;return n}_updateControlsErrors(n,e,r){this.status=this._calculateStatus(),n&&this.statusChanges.emit(this.status),(n||r)&&this._events.next(new Oc(this.status,e)),this._parent&&this._parent._updateControlsErrors(n,e,r)}_initObservables(){this.valueChanges=new tt,this.statusChanges=new tt}_calculateStatus(){return this._allControlsDisabled()?hh:this.errors?Zg:this._hasOwnPendingAsyncValidator||this._anyControlsHaveStatus(Rc)?Rc:this._anyControlsHaveStatus(Zg)?Zg:dh}_anyControlsHaveStatus(n){return this._anyControls(e=>e.status===n)}_anyControlsDirty(){return this._anyControls(n=>n.dirty)}_anyControlsTouched(){return this._anyControls(n=>n.touched)}_updatePristine(n,e){let r=!this._anyControlsDirty(),i=this.pristine!==r;this.pristine=r,this._parent&&!n.onlySelf&&this._parent._updatePristine(n,e),i&&this._events.next(new fh(this.pristine,e))}_updateTouched(n={},e){this.touched=this._anyControlsTouched(),this._events.next(new ph(this.touched,e)),this._parent&&!n.onlySelf&&this._parent._updateTouched(n,e)}_onDisabledChange=[];_registerOnCollectionChange(n){this._onCollectionChange=n}_setUpdateStrategy(n){sv(n)&&n.updateOn!=null&&(this._updateOn=n.updateOn)}_parentMarkedDirty(n){let e=this._parent&&this._parent.dirty;return!n&&!!e&&!this._parent._anyControlsDirty()}
vendor: 19,288 bytes, line 50
50_find(n){return null}_assignValidators(n){this._rawValidators=Array.isArray(n)?n.slice():n,this._composedValidatorFn=A6(this._rawValidators)}_assignAsyncValidators(n){this._rawAsyncValidators=Array.isArray(n)?n.slice():n,this._composedAsyncValidatorFn=x6(this._rawAsyncValidators)}},nv=class extends Nc{constructor(n,e,r){super(MC(e),AC(r,e)),this.controls=n,this._initObservables(),this._setUpdateStrategy(e),this._setUpControls(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator})}controls;registerControl(n,e){return this.controls[n]?this.controls[n]:(this.controls[n]=e,e.setParent(this),e._registerOnCollectionChange(this._onCollectionChange),e)}addControl(n,e,r={}){this.registerControl(n,e),this.updateValueAndValidity({emitEvent:r.emitEvent}),this._onCollectionChange()}removeControl(n,e={}){this.controls[n]&&this.controls[n]._registerOnCollectionChange(()=>{}),delete this.controls[n],this.updateValueAndValidity({emitEvent:e.emitEvent}),this._onCollectionChange()}setControl(n,e,r={}){this.controls[n]&&this.controls[n]._registerOnCollectionChange(()=>{}),delete this.controls[n],e&&this.registerControl(n,e),this.updateValueAndValidity({emitEvent:r.emitEvent}),this._onCollectionChange()}contains(n){return this.controls.hasOwnProperty(n)&&this.controls[n].enabled}setValue(n,e={}){nO(this,!0,n),Object.keys(n).forEach(r=>{tO(this,!0,r),this.controls[r].setValue(n[r],{onlySelf:!0,emitEvent:e.emitEvent})}),this.updateValueAndValidity(e)}patchValue(n,e={}){n!=null&&(Object.keys(n).forEach(r=>{let i=this.controls[r];i&&i.patchValue(n[r],{onlySelf:!0,emitEvent:e.emitEvent})}),this.updateValueAndValidity(e))}reset(n={},e={}){this._forEachChild((r,i)=>{r.reset(n?n[i]:null,Z(A({},e),{onlySelf:!0}))}),this._updatePristine(e,this),this._updateTouched(e,this),this.updateValueAndValidity(e),e?.emitEvent!==!1&&this._events.next(new gh(this))}getRawValue(){return this._reduceChildren({},(n,e,r)=>(n[r]=e.getRawValue(),n))}_syncPendingControls(){let n=this._reduceChildren(!1,(e,r)=>r._syncPendingControls()?!0:e);return n&&this.updateValueAndValidity({onlySelf:!0}),n}_forEachChild(n){Object.keys(this.controls).forEach(e=>{let r=this.controls[e];r&&n(r,e)})}_setUpControls(){this._forEachChild(n=>{n.setParent(this),n._registerOnCollectionChange(this._onCollectionChange)})}_updateValue(){this.value=this._reduceValue()}_anyControls(n){for(let[e,r]of Object.entries(this.controls))if(this.contains(e)&&n(r))return!0;return!1}_reduceValue(){let n={};return this._reduceChildren(n,(e,r,i)=>((r.enabled||this.disabled)&&(e[i]=r.value),e))}_reduceChildren(n,e){let r=n;return this._forEachChild((i,o)=>{r=e(r,i,o)}),r}_allControlsDisabled(){for(let n of Object.keys(this.controls))if(this.controls[n].enabled)return!1;return Object.keys(this.controls).length>0||this.disabled}_find(n){return this.controls.hasOwnProperty(n)?this.controls[n]:null}};var wC=class extends nv{};var av=new P("",{factory:()=>lv}),lv="always";function rO(t,n){return[...n.path,t]}function EC(t,n,e=lv){xC(t,n),n.valueAccessor.writeValue(t.value),(t.disabled||e==="always")&&n.valueAccessor.setDisabledState?.(t.disabled),O6(t,n),P6(t,n),N6(t,n),R6(t,n)}function FR(t,n,e=!0){let r=()=>{};n.valueAccessor&&(n.valueAccessor.registerOnChange(r),n.valueAccessor.registerOnTouched(r)),iv(t,n),t&&(n._invokeOnDestroyCallbacks(),t._registerOnCollectionChange(()=>{}))}function rv(t,n){t.forEach(e=>{e.registerOnValidatorChange&&e.registerOnValidatorChange(n)})}function R6(t,n){if(n.valueAccessor.setDisabledState){let e=r=>{n.valueAccessor.setDisabledState(r)};t.registerOnDisabledChange(e),n._registerOnDestroy(()=>{t._unregisterOnDisabledChange(e)})}}function xC(t,n){let e=QR(t);n.validator!==null?t.setValidators(OR(e,n.validator)):typeof e=="function"&&t.setValidators([e]);let r=eO(t);n.asyncValidator!==null?t.setAsyncValidators(OR(r,n.asyncValidator)):typeof r=="function"&&t.setAsyncValidators([r]);let i=()=>t.updateValueAndValidity();rv(n._rawValidators,i),rv(n._rawAsyncValidators,i)}function iv(t,n){let e=!1;if(t!==null){if(n.validator!==null){let i=QR(t);if(Array.isArray(i)&&i.length>0){let o=i.filter(s=>s!==n.validator);o.length!==i.length&&(e=!0,t.setValidators(o))}}if(n.asyncValidator!==null){let i=eO(t);if(Array.isArray(i)&&i.length>0){let o=i.filter(s=>s!==n.asyncValidator);o.length!==i.length&&(e=!0,t.setAsyncValidators(o))}}}let r=()=>{};return rv(n._rawValidators,r),rv(n._rawAsyncValidators,r),e}function O6(t,n){n.valueAccessor.registerOnChange(e=>{t._pendingValue=e,t._pendingChange=!0,t._pendingDirty=!0,t.updateOn==="change"&&iO(t,n)})}function N6(t,n){n.valueAccessor.registerOnTouched(()=>{t._pendingTouched=!0,t.updateOn==="blur"&&t._pendingChange&&iO(t,n),t.updateOn!=="submit"&&t.markAsTouched()})}function iO(t,n){t._pendingDirty&&t.markAsDirty(),t.setValue(t._pendingValue,{emitModelToViewChange:!1}),n.viewToModelUpdate(t._pendingValue),t._pendingChange=!1}function P6(t,n){let e=(r,i)=>{n.valueAccessor.writeValue(r),i&&n.viewToModelUpdate(r)};t.registerOnChange(e),n._registerOnDestroy(()=>{t._unregisterOnChange(e)})}function F6(t,n){t==null,xC(t,n)}function L6(t,n){return iv(t,n)}function oO(t,n){if(!t.hasOwnProperty("model"))return!1;let e=t.model;return e.isFirstChange()?!0:!Object.is(n,e.currentValue)}function j6(t){return Object.getPrototypeOf(t.constructor)===SC}function B6(t,n){t._syncPendingControls(),n.forEach(e=>{let r=e.control;r.updateOn==="submit"&&r._pendingChange&&(e.viewToModelUpdate(r._pendingValue),r._pendingChange=!1)})}function sO(t,n){if(!n)return null;Array.isArray(n);let e,r,i;return n.forEach(o=>{o.constructor===Pc?e=o:j6(o)?r=o:i=o}),i||r||e||null}function V6(t,n){let e=t.indexOf(n);e>-1&&t.splice(e,1)}function LR(t,n){let e=t.indexOf(n);e>-1&&t.splice(e,1)}function jR(t){return typeof t=="object"&&t!==null&&Object.keys(t).length===2&&"value"in t&&"disabled"in t}var mh=class extends Nc{defaultValue=null;_onChange=[];_pendingValue;_pendingChange=!1;constructor(n=null,e,r){super(MC(e),AC(r,e)),this._applyFormState(n),this._setUpdateStrategy(e),this._initObservables(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator}),sv(e)&&(e.nonNullable||e.initialValueIsDefault)&&(jR(n)?this.defaultValue=n.value:this.defaultValue=n)}setValue(n,e={}){this.value=this._pendingValue=n,this._onChange.length&&e.emitModelToViewChange!==!1&&this._onChange.forEach(r=>r(this.value,e.emitViewToModelChange!==!1)),this.updateValueAndValidity(e)}patchValue(n,e={}){this.setValue(n,e)}reset(n=this.defaultValue,e={}){this._applyFormState(n),this.markAsPristine(e),this.markAsUntouched(e),this.setValue(this.value,e),e.overwriteDefaultValue&&(this.defaultValue=this.value),this._pendingChange=!1,e?.emitEvent!==!1&&this._events.next(new gh(this))}_updateValue(){}_anyControls(n){return!1}_allControlsDisabled(){return this.disabled}registerOnChange(n){this._onChange.push(n)}_unregisterOnChange(n){LR(this._onChange,n)}registerOnDisabledChange(n){this._onDisabledChange.push(n)}_unregisterOnDisabledChange(n){LR(this._onDisabledChange,n)}_forEachChild(n){}_syncPendingControls(){return this.updateOn==="submit"&&(this._pendingDirty&&this.markAsDirty(),this._pendingTouched&&this.markAsTouched(),this._pendingChange)?(this.setValue(this._pendingValue,{onlySelf:!0,emitModelToViewChange:!1}),!0):!1}_applyFormState(n){jR(n)?(this.value=this._pendingValue=n.value,n.disabled?this.disable({onlySelf:!0,emitEvent:!1}):this.enable({onlySelf:!0,emitEvent:!1})):this.value=this._pendingValue=n}};var U6=t=>t instanceof mh;var H6={provide:$a,useExisting:Rr(()=>RC)},BR=Promise.resolve(),RC=(()=>{class t extends $a{_changeDetectorRef;callSetDisabledState;control=new mh;static ngAcceptInputType_isDisabled;_registered=!1;viewModel;name="";isDisabled;model;options;update=new tt;constructor(e,r,i,o,s,a){super(),this._changeDetectorRef=s,this.callSetDisabledState=a,this._parent=e,this._setValidators(r),this._setAsyncValidators(i),this.valueAccessor=sO(this,o)}ngOnChanges(e){if(this._checkForErrors(),!this._registered||"name"in e){if(this._registered&&(this._checkName(),this.formDirective)){let r=e.name.previousValue;this.formDirective.removeControl({name:r,path:this._getPath(r)})}this._setUpControl()}"isDisabled"in e&&this._updateDisabled(e),oO(e,this.viewModel)&&(this._updateValue(this.model),this.viewModel=this.model)}ngOnDestroy(){this.formDirective&&this.formDirective.removeControl(this)}get path(){return this._getPath(this.name)}get formDirective(){return this._parent?this._parent.formDirective:null}viewToModelUpdate(e){this.viewModel=e,this.update.emit(e)}_setUpControl(){this._setUpdateStrategy(),this._isStandalone()?this._setUpStandalone():this.formDirective.addControl(this),this._registered=!0}_setUpdateStrategy(){this.options&&this.options.updateOn!=null&&(this.control._updateOn=this.options.updateOn)}_isStandalone(){return!this._parent||!!(this.options&&this.options.standalone)}_setUpStandalone(){EC(this.control,this,this.callSetDisabledState),this.control.updateValueAndValidity({emitEvent:!1})}_checkForErrors(){this._checkName()}_checkName(){this.options&&this.options.name&&(this.name=this.options.name),!this._isStandalone()&&this.name}_updateValue(e){BR.then(()=>{this.control.setValue(e,{emitViewToModelChange:!1}),this._changeDetectorRef?.markForCheck()})}_updateDisabled(e){let r=e.isDisabled.currentValue,i=r!==0&&At(r);BR.then(()=>{i&&!this.control.disabled?this.control.disable():!i&&this.control.disabled&&this.control.enable(),this._changeDetectorRef?.markForCheck()})}_getPath(e){return this._parent?rO(e,this._parent):[e]}static \u0275fac=function(r){return new(r||t)(_e(Ha,9),_e(TC,10),_e(kC,10),_e(vh,10),_e(zn,8),_e(av,8))};static \u0275dir=Oe({type:t,selectors:[["","ngModel","",3,"formControlName","",3,"formControl",""]],inputs:{name:"name",isDisabled:[0,"disabled","isDisabled"],model:[0,"ngModel","model"],options:[0,"ngModelOptions","options"]},outputs:{update:"ngModelChange"},exportAs:["ngModel"],standalone:!1,features:[Cr([H6]),kn,xn]})}return t})();var cv=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275dir=Oe({type:t,selectors:[["form",3,"ngNoForm","",3,"ngNativeValidate",""]],hostAttrs:["novalidate",""],standalone:!1})}return t})();var CC=class extends Nc{constructor(n,e,r){super(MC(e),AC(r,e)),this.controls=n,this._initObservables(),this._setUpdateStrategy(e),this._setUpControls(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator})}controls;at(n){return this.controls[this._adjustIndex(n)]}push(n,e={}){Array.isArray(n)?n.forEach(r=>{this.controls.push(r),this._registerControl(r)}):(this.controls.push(n),this._registerControl(n)),this.updateValueAndValidity({emitEvent:e.emitEvent}),this._onCollectionChange()}insert(n,e,r={}){this.controls.splice(n,0,e),this._registerControl(e),this.updateValueAndValidity({emitEvent:r.emitEvent})}removeAt(n,e={}){let r=this._adjustIndex(n);r<0&&(r=0),this.controls[r]&&this.controls[r]._registerOnCollectionChange(()=>{}),this.controls.splice(r,1),this.updateValueAndValidity({emitEvent:e.emitEvent})}setControl(n,e,r={}){let i=this._adjustIndex(n);i<0&&(i=0),this.controls[i]&&this.controls[i]._registerOnCollectionChange(()=>{}),this.controls.splice(i,1),e&&(this.controls.splice(i,0,e),this._registerControl(e)),this.updateValueAndValidity({emitEvent:r.emitEvent}),this._onCollectionChange()}get length(){return this.controls.length}setValue(n,e={}){nO(this,!1,n),n.forEach((r,i)=>{tO(this,!1,i),this.at(i).setValue(r,{onlySelf:!0,emitEvent:e.emitEvent})}),this.updateValueAndValidity(e)}patchValue(n,e={}){n!=null&&(n.forEach((r,i)=>{this.at(i)&&this.at(i).patchValue(r,{onlySelf:!0,emitEvent:e.emitEvent})}),this.updateValueAndValidity(e))}reset(n=[],e={}){this._forEachChild((r,i)=>{r.reset(n[i],Z(A({},e),{onlySelf:!0}))}),this._updatePristine(e,this),this._updateTouched(e,this),this.updateValueAndValidity(e),e?.emitEvent!==!1&&this._events.next(new gh(this))}getRawValue(){return this.controls.map(n=>n.getRawValue())}clear(n={}){this.controls.length<1||(this._forEachChild(e=>e._registerOnCollectionChange(()=>{})),this.controls.splice(0),this.updateValueAndValidity({emitEvent:n.emitEvent}))}_adjustIndex(n){return n<0?n+this.length:n}_syncPendingControls(){let n=this.controls.reduce((e,r)=>r._syncPendingControls()?!0:e,!1);return n&&this.updateValueAndValidity({onlySelf:!0}),n}_forEachChild(n){this.controls.forEach((e,r)=>{n(e,r)})}_updateValue(){this.value=this.controls.filter(n=>n.enabled||this.disabled).map(n=>n.value)}_anyControls(n){return this.controls.some(e=>e.enabled&&n(e))}_setUpControls(){this._forEachChild(n=>this._registerControl(n))}_allControlsDisabled(){for(let n of this.controls)if(n.enabled)return!1;return this.controls.length>0||this.disabled}_registerControl(n){n.setParent(this),n._registerOnCollectionChange(this._onCollectionChange)}_find(n){return this.at(n)??null}};var $6=(()=>{class t extends Ha{callSetDisabledState;get submitted(){return nt(this._submittedReactive)}set submitted(e){this._submittedReactive.set(e)}_submitted=le(()=>this._submittedReactive(),{});_submittedReactive=Ee(!1,{});_oldForm;_onCollectionChange=()=>this._updateDomValue();directives=[];constructor(e,r,i){super(),this.callSetDisabledState=i,this._setValidators(e),this._setAsyncValidators(r)}ngOnChanges(e){this.onChanges(e)}ngOnDestroy(){this.onDestroy()}onChanges(e){this._checkFormPresent(),e.hasOwnProperty("form")&&(this._updateValidators(),this._updateDomValue(),this._updateRegistrations(),this._oldForm=this.form)}onDestroy(){this.form&&(iv(this.form,this),this.form._onCollectionChange===this._onCollectionChange&&this.form._registerOnCollectionChange(()=>{}))}get formDirective(){return this}get path(){return[]}addControl(e){let r=this.form.get(e.path);return EC(r,e,this.callSetDisabledState),r.updateValueAndValidity({emitEvent:!1}),this.directives.push(e),r}getControl(e){return this.form.get(e.path)}removeControl(e){FR(e.control||null,e,!1),V6(this.directives,e)}addFormGroup(e){this._setUpFormContainer(e)}removeFormGroup(e){this._cleanUpFormContainer(e)}getFormGroup(e){return this.form.get(e.path)}getFormArray(e){return this.form.get(e.path)}addFormArray(e){this._setUpFormContainer(e)}removeFormArray(e){this._cleanUpFormContainer(e)}updateModel(e,r){this.form.get(e.path).setValue(r)}onReset(){this.resetForm()}resetForm(e=void 0,r={}){this.form.reset(e,r),this._submittedReactive.set(!1)}onSubmit(e){return this.submitted=!0,B6(this.form,this.directives),this.ngSubmit.emit(e),this.form._events.next(new bC(this.control)),e?.target?.method==="dialog"}_updateDomValue(){this.directives.forEach(e=>{let r=e.control,i=this.form.get(e.path);r!==i&&(FR(r||null,e),U6(i)&&(EC(i,e,this.callSetDisabledState),e.control=i))}),this.form._updateTreeValidity({emitEvent:!1})}_setUpFormContainer(e){let r=this.form.get(e.path);F6(r,e),r.updateValueAndValidity({emitEvent:!1})}_cleanUpFormContainer(e){if(this.form){let r=this.form.get(e.path);r&&L6(r,e)&&r.updateValueAndValidity({emitEvent:!1})}}_updateRegistrations(){this.form._registerOnCollectionChange(this._onCollectionChange),this._oldForm&&this._oldForm._registerOnCollectionChange(()=>{})}_updateValidators(){xC(this.form,this),this._oldForm&&iv(this._oldForm,this)}_checkFormPresent(){this.form}static \u0275fac=function(r){return new(r||t)(_e(TC,10),_e(kC,10),_e(av,8))};static \u0275dir=Oe({type:t,features:[kn,xn]})}return t})();var aO=new P("");var z6={provide:$a,useExisting:Rr(()=>yh)},yh=(()=>{class t extends $a{_ngModelWarningConfig;_added=!1;viewModel;control;name=null;set isDisabled(e){}model;update=new tt;static _ngModelWarningSentOnce=!1;_ngModelWarningSent=!1;constructor(e,r,i,o,s){super(),this._ngModelWarningConfig=s,this._parent=e,this._setValidators(r),this._setAsyncValidators(i),this.valueAccessor=sO(this,o)}ngOnChanges(e){this._added||this._setUpControl(),oO(e,this.viewModel)&&(this.viewModel=this.model,this.formDirective.updateModel(this,this.model))}ngOnDestroy(){this.formDirective&&this.formDirective.removeControl(this)}viewToModelUpdate(e){this.viewModel=e,this.update.emit(e)}get path(){return rO(this.name==null?this.name:this.name.toString(),this._parent)}get formDirective(){return this._parent?this._parent.formDirective:null}_setUpControl(){this.control=this.formDirective.addControl(this),this._added=!0}static \u0275fac=function(r){return new(r||t)(_e(Ha,13),_e(TC,10),_e(kC,10),_e(vh,10),_e(aO,8))};static \u0275dir=Oe({type:t,selectors:[["","formControlName",""]],inputs:{name:[0,"formControlName","name"],isDisabled:[0,"disabled","isDisabled"],model:[0,"ngModel","model"]},outputs:{update:"ngModelChange"},standalone:!1,features:[Cr([z6]),kn,xn]})}return t})();var q6={provide:Ha,useExisting:Rr(()=>_h)},_h=(()=>{class t extends $6{form=null;ngSubmit=new tt;get control(){return this.form}static \u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})();static \u0275dir=Oe({type:t,selectors:[["","formGroup",""]],hostBindings:function(r,i){r&1&&Ge("submit",function(s){return i.onSubmit(s)})("reset",function(){return i.onReset()})},inputs:{form:[0,"formGroup","form"]},outputs:{ngSubmit:"ngSubmit"},exportAs:["ngForm"],standalone:!1,features:[Cr([q6]),kn]})}return t})(),W6={provide:vh,useExisting:Rr(()=>uv),multi:!0};function lO(t,n){return t==null?`${n}`:(n&&typeof n=="object"&&(n="Object"),`${t}: ${n}`.slice(0,50))}function G6(t){return t.split(":")[0]}var uv=(()=>{class t extends SC{value;_optionMap=new Map;_idCounter=0;set compareWith(e){this._compareWith=e}_compareWith=Object.is;appRefInjector=y(wr).injector;destroyRef=y(Ye);cdr=y(zn);_queuedWrite=!1;_writeValueAfterRender(){this._queuedWrite||this.appRefInjector.destroyed||(this._queuedWrite=!0,br({write:()=>{this.destroyRef.destroyed||(this._queuedWrite=!1,this.writeValue(this.value))}},{injector:this.appRefInjector}))}writeValue(e){this.cdr.markForCheck(),this.value=e;let r=this._getOptionId(e),i=lO(r,e);this.setProperty("value",i)}registerOnChange(e){this.onChange=r=>{this.value=this._getOptionValue(r),e(this.value)}}_registerOption(){return(this._idCounter++).toString()}_getOptionId(e){for(let r of this._optionMap.keys())if(this._compareWith(this._optionMap.get(r),e))return r;return null}_getOptionValue(e){let r=G6(e);return this._optionMap.has(r)?this._optionMap.get(r):e}static \u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})();static \u0275dir=Oe({type:t,selectors:[["select","formControlName","",3,"multiple",""],["select","formControl","",3,"multiple",""],["select","ngModel","",3,"multiple",""]],hostBindings:function(r,i){r&1&&Ge("change",function(s){return i.onChange(s.target.value)})("blur",function(){return i.onTouched()})},inputs:{compareWith:"compareWith"},standalone:!1,features:[Cr([W6]),kn]})}return t})(),cO=(()=>{class t{_element;_renderer;_select;id;constructor(e,r,i){this._element=e,this._renderer=r,this._select=i,this._select&&(this.id=this._select._registerOption())}set ngValue(e){this._select!=null&&(this._select._optionMap.set(this.id,e),this._setElementValue(lO(this.id,e)),this._select._writeValueAfterRender())}set value(e){this._setElementValue(e),this._select&&this._select._writeValueAfterRender()}_setElementValue(e){this._renderer.setProperty(this._element.nativeElement,"value",e)}ngOnDestroy(){this._select&&(this._select._optionMap.delete(this.id
50),this._select._writeValueAfterRender())}static \u0275fac=function(r){return new(r||t)(_e(We),_e(Tn),_e(uv,9))};static \u0275dir=Oe({type:t,selectors:[["option"]],inputs:{ngValue:"ngValue",value:"value"},standalone:!1})}return t})(),K6={provide:vh,useExisting:Rr(()=>uO),multi:!0};function VR(t,n){return t==null?`${n}`:(typeof n=="string"&&(n=`'${n}'`),n&&typeof n=="object"&&(n="Object"),`${t}: ${n}`.slice(0,50))}function J6(t){return t.split(":")[0]}var uO=(()=>{class t extends SC{value;_optionMap=new Map;_idCounter=0;set compareWith(e){this._compareWith=e}_compareWith=Object.is;writeValue(e){this.value=e;let r;if(Array.isArray(e)){let i=e.map(o=>this._getOptionId(o));r=(o,s)=>{o._setSelected(i.indexOf(s.toString())>-1)}}else r=(i,o)=>{i._setSelected(!1)};this._optionMap.forEach(r)}registerOnChange(e){this.onChange=r=>{let i=[],o=r.selectedOptions;if(o!==void 0){let s=o;for(let a=0;a<s.length;a++){let l=s[a],c=this._getOptionValue(l.value);i.push(c)}}else{let s=r.options;for(let a=0;a<s.length;a++){let l=s[a];if(l.selected){let c=this._getOptionValue(l.value);i.push(c)}}}this.value=i,e(i)}}_registerOption(e){let r=(this._idCounter++).toString();return this._optionMap.set(r,e),r}_getOptionId(e){for(let r of this._optionMap.keys())if(this._compareWith(this._optionMap.get(r)._value,e))return r;return null}_getOptionValue(e){let r=J6(e);return this._optionMap.has(r)?this._optionMap.get(r)._value:e}static \u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})();static \u0275dir=Oe({type:t,selectors:[["select","multiple","","formControlName",""],["select","multiple","","formControl",""],["select","multiple","","ngModel",""]],hostBindings:function(r,i){r&1&&Ge("change",function(s){return i.onChange(s.target)})("blur",function(){return i.onTouched()})},inputs:{compareWith:"compareWith"},standalone:!1,features:[Cr([K6]),kn]})}return t})(),dO=(()=>{class t{_element;_renderer;_select;id;_value;constructor(e,r,i){this._element=e,this._renderer=r,this._select=i,this._select&&(this.id=this._select._registerOption(this))}set ngValue(e){this._select!=null&&(this._value=e,this._setElementValue(VR(this.id,e)),this._select.writeValue(this._select.value))}set value(e){this._select?(this._value=e,this._setElementValue(VR(this.id,e)),this._select.writeValue(this._select.value)):this._setElementValue(e)}_setElementValue(e){this._renderer.setProperty(this._element.nativeElement,"value",e)}_setSelected(e){this._renderer.setProperty(this._element.nativeElement,"selected",e)}ngOnDestroy(){this._select&&(this._select._optionMap.delete(this.id),this._select.writeValue(this._select.value))}static \u0275fac=function(r){return new(r||t)(_e(We),_e(Tn),_e(uO,9))};static \u0275dir=Oe({type:t,selectors:[["option"]],inputs:{ngValue:"ngValue",value:"value"},standalone:!1})}return t})();var hO=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({})}return t})();function UR(t){return!!t&&(t.asyncValidators!==void 0||t.validators!==void 0||t.updateOn!==void 0)}var dv=(()=>{class t{useNonNullable=!1;get nonNullable(){let e=new t;return e.useNonNullable=!0,e}group(e,r=null){let i=this._reduceControls(e),o={};return UR(r)?o=r:r!==null&&(o.validators=r.validator,o.asyncValidators=r.asyncValidator),new nv(i,o)}record(e,r=null){let i=this._reduceControls(e);return new wC(i,r)}control(e,r,i){let o={};return this.useNonNullable?(UR(r)?o=r:(o.validators=r,o.asyncValidators=i),new mh(e,Z(A({},o),{nonNullable:!0}))):new mh(e,r,i)}array(e,r,i){let o=e.map(s=>this._createControl(s));return new CC(o,r,i)}_reduceControls(e){let r={};return Object.keys(e).forEach(i=>{r[i]=this._createControl(e[i])}),r}_createControl(e){if(e instanceof mh)return e;if(e instanceof Nc)return e;if(Array.isArray(e)){let r=e[0],i=e.length>1?e[1]:null,o=e.length>2?e[2]:null;return this.control(r,i,o)}else return this.control(e)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var fO=(()=>{class t{static withConfig(e){return{ngModule:t,providers:[{provide:av,useValue:e.callSetDisabledState??lv}]}}static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({imports:[hO]})}return t})(),hv=(()=>{class t{static withConfig(e){return{ngModule:t,providers:[{provide:aO,useValue:e.warnOnNgModelWithFormControl??"always"},{provide:av,useValue:e.callSetDisabledState??lv}]}}static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({imports:[hO]})}return t})();var pO=(t,n)=>({requiredLength:t,actualLength:n}),Y6=t=>({min:t}),Z6=t=>({max:t});function X6(t,n){t&1&&(Te(0,"p",1),j(1),X(2,"translate"),Ne()),t&2&&(R(),Qe(" ",ne(2,1,"form_validation_messages.required")," "))}function Q6(t,n){if(t&1&&(Te(0,"p",1),j(1),X(2,"translate"),Ne()),t&2){ie(2);let e=gi(0);R(),Qe(" ",mo(2,1,"form_validation_messages.minlength",Sr(4,pO,e.errors==null?null:e.errors.minlength.requiredLength,e.errors==null?null:e.errors.minlength.actualLength))," ")}}function e8(t,n){if(t&1&&(Te(0,"p",1),j(1),X(2,"translate"),Ne()),t&2){ie(2);let e=gi(0);R(),Qe(" ",mo(2,1,"form_validation_messages.maxlength",Sr(4,pO,e.errors==null?null:e.errors.maxlength.requiredLength,e.errors==null?null:e.errors.maxlength.actualLength))," ")}}function t8(t,n){t&1&&(Te(0,"p",1),j(1),X(2,"translate"),Ne()),t&2&&(R(),Qe(" ",ne(2,1,"form_validation_messages.email")," "))}function n8(t,n){t&1&&(Te(0,"p",1),j(1),X(2,"translate"),Ne()),t&2&&(R(),Qe(" ",ne(2,1,"form_validation_messages.pattern")," "))}function r8(t,n){if(t&1&&(Te(0,"p",1),j(1),X(2,"translate"),Ne()),t&2){ie(2);let e=gi(0);R(),Qe(" ",mo(2,1,"form_validation_messages.min",Nt(4,Y6,e.errors==null?null:e.errors.min.min))," ")}}function i8(t,n){if(t&1&&(Te(0,"p",1),j(1),X(2,"translate"),Ne()),t&2){ie(2);let e=gi(0);R(),Qe(" ",mo(2,1,"form_validation_messages.max",Nt(4,Z6,e.errors==null?null:e.errors.max.max))," ")}}function o8(t,n){if(t&1&&(Te(0,"p",1),j(1),X(2,"translate"),Ne()),t&2){let e=ie().$implicit;ie(2);let r=gi(0);R(),Qe(" ",mo(2,1,"form_validation_messages.custom."+e,r.errors[e])," ")}}function s8(t,n){if(t&1&&be(0,o8,3,4,"p",1),t&2){let e=n.$implicit;ie(2);let r=gi(0);we(r.errors!=null&&r.errors[e]?0:-1)}}function a8(t,n){if(t&1&&(be(0,X6,3,3,"p",1),be(1,Q6,3,7,"p",1),be(2,e8,3,7,"p",1),be(3,t8,3,3,"p",1),be(4,n8,3,3,"p",1),be(5,r8,3,6,"p",1),be(6,i8,3,6,"p",1),Br(7,s8,1,1,null,null,rw)),t&2){let e=ie(),r=gi(0);we(!(r==null||r.errors==null)&&r.errors.required?0:-1),R(),we(r.errors!=null&&r.errors.minlength?1:-1),R(),we(r.errors!=null&&r.errors.maxlength?2:-1),R(),we(r.errors!=null&&r.errors.email?3:-1),R(),we(r.errors!=null&&r.errors.pattern?4:-1),R(),we(r.errors!=null&&r.errors.min?5:-1),R(),we(r.errors!=null&&r.errors.max?6:-1),R(),Vr(e.customErrors())}}var Lc=class t{control=Le.required({});customErrors=Le([],{});static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-form-validation-message"]],inputs:{control:[1,"control"],customErrors:[1,"customErrors"]},decls:3,vars:2,consts:[["aria-live","assertive",1,"inline"],[1,"validation-message"]],template:function(e,r){if(e&1&&(Ql(0),Te(1,"div",0),be(2,a8,9,7),Ne()),e&2){let i=ad(r.control());
50R(2),we(i!==null&&(i!=null&&i.invalid)&&(i!=null&&i.touched)?2:-1)}},dependencies:[qt,zt],styles:[".validation-message[_ngcontent-%COMP%]{margin-top:.5rem;display:block!important}p[_ngcontent-%COMP%]{color:var(--danger)}"]})};function l8(t,n){if(t&1&&(Te(0,"span",3),j(1),Ne()),t&2){let e=ie();R(),me(e.text())}}var Gi=class t{text=Le(void 0,{});size=Le("25px",{});static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-loader"]],inputs:{text:[1,"text"],size:[1,"size"]},decls:4,vars:3,consts:[[1,"loader-container"],[1,"neon-ring"],[1,"dot-orbital"],[1,"loading-text"]],template:function(e,r){e&1&&(Te(0,"div",0)(1,"div",1),Ko(2,"div",2),Ne(),be(3,l8,2,1,"span",3),Ne()),e&2&&(Bi("--loader-size",r.size()),R(3),we(r.text()?3:-1))},dependencies:[st],styles:['@charset "UTF-8";.loader-container[_ngcontent-%COMP%]{--loader-size: 60px;--loader-speed: .75s;display:flex;flex-direction:column;align-items:center;gap:1.5rem}.neon-ring[_ngcontent-%COMP%]{position:relative;width:var(--loader-size);height:var(--loader-size);border:calc(var(--loader-size) * .05) solid rgba(var(--text-light-rgb),.05);border-radius:50%}.neon-ring[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:calc(var(--loader-size) * -.05);border-radius:50%;padding:calc(var(--loader-size) * .05);background:linear-gradient(90deg,var(--secondary),var(--primary));-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;animation:_ngcontent-%COMP%_rotate-animation var(--loader-speed) cubic-bezier(.39,.1,.69,.85) infinite}.neon-ring[_ngcontent-%COMP%] .dot-orbital[_ngcontent-%COMP%]{position:absolute;inset:0;animation:_ngcontent-%COMP%_rotate-animation var(--loader-speed) cubic-bezier(.39,.1,.69,.85) infinite}.neon-ring[_ngcontent-%COMP%] .dot-orbital[_ngcontent-%COMP%]:after{content:"";position:absolute;top:calc(var(--loader-size) * -.1);left:50%;transform:translate(-50%);opacity:.25;width:calc(var(--loader-size) * .15);height:calc(var(--loader-size) * .15);background:var(--secondary);border-radius:50%;box-shadow:0 0 calc(var(--loader-size) * .15) var(--secondary),0 0 calc(var(--loader-size) * .3) var(--secondary),0 0 calc(var(--loader-size) * .5) var(--secondary);filter:blur(5px);animation:_ngcontent-%COMP%_pulse-glow 2s cubic-bezier(.39,.1,.69,.85) infinite}@keyframes _ngcontent-%COMP%_rotate-animation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_pulse-glow{0%,to{filter:blur(1.5px) brightness(1);transform:translate(-50%) scale(1)}50%{filter:blur(2.5px) brightness(1.8);transform:translate(-50%) scale(1.3)}}.loading-text[_ngcontent-%COMP%]{font-size:.9rem;color:var(--text-light);letter-spacing:2px;text-transform:uppercase;animation:_ngcontent-%COMP%_pulse-animation 2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_pulse-animation{0%,to{opacity:.4}50%{opacity:1}}']})};var Nn=class t{invalidEmailDomainErrorCode="email_domain_not_allowed";supabase=y(nr);authenticated=new Rt(!0);router=y(cn);_session=null;constructor(){this.supabase.auth.getUser().then(({data:{user:n}})=>{let e=!!n;this.authenticated.next(e)}),this.authChanges((n,e)=>{n==="SIGNED_IN"?this.authenticated.next(!0):n==="SIGNED_OUT"&&(this.authenticated.next(!1),this.router.navigate(["/auth"]))})}get user(){return Xe(this.supabase.auth.getSession()).pipe(te(({data:n})=>n.session?.user||null))}authChanges(n){return this.supabase.auth.onAuthStateChange(n)}signIn(n){return Xe(this.supabase.auth.signInWithOtp({email:n,options:{emailRedirectTo:window.location.href.replace("auth","conversation/latest")}}))}signOut(){return this.supabase.auth.signOut().then(()=>this.router.navigate(["/auth"]))}canActivate(){return this.authenticated.asObservable().pipe(Kt(n=>{n||(this.signOut(),this.router.navigate(["/auth"]))}))}getAccessToken(){return new Ie(n=>{this.supabase.auth.getSession().then(({data:r})=>{r.session?.access_token&&n.next(r.session.access_token)});let{data:{subscription:e}}=this.supabase.auth.onAuthStateChange((r,i)=>{i?.access_token&&n.next(i.access_token)});return()=>e.unsubscribe()}).pipe(_t(n=>!!n),so())}static \u0275fac=function(e){return new(e||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})};function c8(t,n){t&1&&Ce(0,"mvc-loader")}function u8(t,n){t&1&&(L(0,"span"),j(1),X(2,"translate"),V(),L(3,"span",16),j(4,"arrow_forward"),V()),t&2&&(R(),me(ne(2,1,"auth.sign_in")))}var d8=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,fv=class t{authService=y(Nn);formBuilder=y(dv);destroyRef=y(Ye);translate=y(Jt);changeDetectorRef=y(zn);signInForm;loading=!1;ngOnInit(){this.signInForm=this.formBuilder.group({email:["",[Co.required,Co.pattern(d8)]]})}async onSubmit(){this.loading=!0;let n=this.signInForm.value.email;this.authService.signIn(n).pipe(un(this.destroyRef)).subscribe({next:()=>{alert(this.translate.instant("auth.sign_in_success"))},error:e=>{this.loading=!1,this.changeDetectorRef.detectChanges()},complete:()=>{this.signInForm.reset(),this.loading=!1}})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-auth"]],decls:27,vars:16,consts:[[1,"login-page","text-light","flex","items-center","justify-center","relative","bg-houses-repeat"],[1,"blob","blob-1"],[1,"blob","blob-2"],["aria-live","polite",1,"glass","card","pl2","pr2","elevated","shadow","ml1","mr1"],[1,"header-section","mb3"],[1,"brand-title"],[1,"description"],[1,"login-form",3,"ngSubmit","formGroup"],[1,"input-group"],["for","email"],[1,"input-wrapper","relative","flex","items-center"],["aria-hidden","true",1,"material-symbols-outlined","input-icon"],["id","email","formControlName","email","type","email","placeholder","[email protected]",1,"input-field"],[3,"control"],["type","submit",1,"submit-button","gradient-btn","p1",3,"disabled"],[1,"footer-note","text-lighter","mt3"],[1,"material-symbols-outlined"]],template:function(e,r){e&1&&(L(0,"div",0),Ce(1,"div",1)(2,"div",2),L(3,"div",3)(4,"div",4)(5,"h1",5),j(6),X(7,"translate"),V(),L(8,"h2",6),j(9),X(10,"translate"),V()(),L(11,"form",7),Ge("ngSubmit",function(){return r.onSubmit()}),L(12,"div",8)(13,"label",9),j(14),X(15,"translate"),V(),L(16,"div",10)(17,"span",11),j(18,"mail"),V(),Ce(19,"
50input",12),V(),Ce(20,"mvc-form-validation-message",13),V(),L(21,"button",14),be(22,c8,1,0,"mvc-loader")(23,u8,5,3),V()(),L(24,"p",15),j(25),X(26,"translate"),V()()()),e&2&&(R(6),me(ne(7,8,"auth.title")),R(3),me(ne(10,10,"auth.description")),R(2),ue("formGroup",r.signInForm),R(3),me(ne(15,12,"auth.email")),R(6),ue("control",r.signInForm.controls.email),R(),ue("disabled",r.loading||r.signInForm.invalid),R(),we(r.loading?22:23),R(3),me(ne(26,14,"auth.hint")))},dependencies:[hv,cv,Pc,Fc,ov,_h,yh,Lc,Gi,qt,zt],styles:[`:host{display:block;height:100dvh;overflow:hidden;font-size:2rem}html{font-size:20px}html body{overflow-y:hidden}.login-page{height:100%}.card{max-width:430px}.brand-title{font-size:2.8rem}.submit-button{width:100%}.description{font-size:1rem;font-weight:300;letter-spacing:.5px}.footer-note{font-size:.8rem}@media(max-width:768px){.blob{opacity:.1}} 51`],encapsulation:2})};var bh=class{_attachedHost;attach(n){return this._attachedHost=n,n.attach(this)}detach(){let n=this._attachedHost;n!=null&&(this._attachedHost=null,n.detach())}get isAttached(){return this._attachedHost!=null}setAttachedHost(n){this._attachedHost=n}},ps=class extends bh{component;viewContainerRef;injector;projectableNodes;constructor(n,e,r,i){super(),this.component=n,this.viewContainerRef=e,this.injector=r,this.projectableNodes=i}},za=class extends bh{templateRef;viewContainerRef;context;injector;constructor(n,e,r,i){super(),this.templateRef=n,this.viewContainerRef=e,this.context=r,this.injector=i}get origin(){return this.templateRef.elementRef}attach(n,e=this.context){return this.context=e,super.attach(n)}detach(){return this.context=void 0,super.detach()}},NC=class extends bh{element;constructor(n){super(),this.element=n instanceof We?n.nativeElement:n}},jc=class{_attachedPortal;_disposeFn;_isDisposed=!1;hasAttached(){return!!this._attachedPortal}attach(n){if(n instanceof ps)return this._attachedPortal=n,this.attachComponentPortal(n);if(n instanceof za)return this._attachedPortal=n,this.attachTemplatePortal(n);if(this.attachDomPortal&&n instanceof NC)return this._attachedPortal=n,this.attachDomPortal(n)}attachDomPortal=null;detach(){this._attachedPortal&&(this._attachedPortal.setAttachedHost(null),this._attachedPortal=null),this._invokeDisposeFn()}dispose(){this.hasAttached()&&this.detach(),this._invokeDisposeFn(),this._isDisposed=!0}setDisposeFn(n){this._disposeFn=n}_invokeDisposeFn(){this._disposeFn&&(this._disposeFn(),this._disposeFn=null)}},pv=class extends jc{outletElement;_appRef;_defaultInjector;constructor(n,e,r){super(),this.outletElement=n,this._appRef=e,this._defaultInjector=r}attachComponentPortal(n){let e;if(n.viewContainerRef){let r=n.injector||n.viewContainerRef.injector,i=r.get(Pi,null,{optional:!0})||void 0;e=n.viewContainerRef.createComponent(n.component,{index:n.viewContainerRef.length,injector:r,ngModuleRef:i,projectableNodes:n.projectableNodes||void 0}),this.setDisposeFn(()=>e.destroy())}else{let r=this._appRef,i=n.injector||this._defaultInjector||Re.NULL,o=i.get(kt,r.injector);e=gm(n.component,{elementInjector:i,environmentInjector:o,projectableNodes:n.projectableNodes||void 0}),r.attachView(e.hostView),this.setDisposeFn(()=>{r.viewCount>0&&r.detachView(e.hostView),e.destroy()})}return this.outletElement.appendChild(this._getComponentRootNode(e)),this._attachedPortal=n,e}attachTemplatePortal(n){let e=n.viewContainerRef,r=e.createEmbeddedView(n.templateRef,n.context,{injector:n.injector});return r.rootNodes.forEach(i=>this.outletElement.appendChild(i)),r.detectChanges(),this.setDisposeFn(()=>{let i=e.indexOf(r);i!==-1&&e.remove(i)}),this._attachedPortal=n,r}attachDomPortal=n=>{let e=n.element;e.parentNode;let r=this.outletElement.ownerDocument.createComment("dom-portal");e.parentNode.insertBefore(r,e),this.outletElement.appendChild(e),this._attachedPortal=n,super.setDisposeFn(()=>{r.parentNode&&r.parentNode.replaceChild(e,r)})};dispose(){super.dispose(),this.outletElement.remove()}_getComponentRootNode(n){return n.hostView.rootNodes[0]}};var PC=(()=>{class t extends jc{_moduleRef=y(Pi,{optional:!0});_document=y(Ve);
51_viewContainerRef=y(Hn);_isInitialized=!1;_attachedRef;constructor(){super()}get portal(){return this._attachedPortal}set portal(e){this.hasAttached()&&!e&&!this._isInitialized||(this.hasAttached()&&super.detach(),e&&super.attach(e),this._attachedPortal=e||null)}attached=new tt;get attachedRef(){return this._attachedRef}ngOnInit(){this._isInitialized=!0}ngOnDestroy(){super.dispose(),this._attachedRef=this._attachedPortal=null}attachComponentPortal(e){e.setAttachedHost(this);let r=e.viewContainerRef!=null?e.viewContainerRef:this._viewContainerRef,i=r.createComponent(e.component,{index:r.length,injector:e.injector||r.injector,projectableNodes:e.projectableNodes||void 0,ngModuleRef:this._moduleRef||void 0});return r!==this._viewContainerRef&&this._getRootNode().appendChild(i.hostView.rootNodes[0]),super.setDisposeFn(()=>i.destroy()),this._attachedPortal=e,this._attachedRef=i,this.attached.emit(i),i}attachTemplatePortal(e){e.setAttachedHost(this);let r=this._viewContainerRef.createEmbeddedView(e.templateRef,e.context,{injector:e.injector});return super.setDisposeFn(()=>this._viewContainerRef.clear()),this._attachedPortal=e,this._attachedRef=r,this.attached.emit(r),r}attachDomPortal=e=>{let r=e.element;r.parentNode;let i=this._document.createComment("dom-portal");e.setAttachedHost(this),r.parentNode.insertBefore(i,r),this._getRootNode().appendChild(r),this._attachedPortal=e,super.setDisposeFn(()=>{i.parentNode&&i.parentNode.replaceChild(r,i)})};_getRootNode(){let e=this._viewContainerRef.element.nativeElement;return e.nodeType===e.ELEMENT_NODE?e:e.parentNode}static \u0275fac=function(r){return new(r||t)};static \u0275dir=Oe({type:t,selectors:[["","cdkPortalOutlet",""]],inputs:{portal:[0,"cdkPortalOutlet","portal"]},outputs:{attached:"attached"},exportAs:["cdkPortalOutlet"],features:[kn]})}return t})(),FC=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({})}return t})();function mO(t){return t.buttons===0||t.detail===0}function gO(t){let n=t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0];return!!n&&n.identifier===-1&&(n.radiusX==null||n.radiusX===1)&&(n.radiusY==null||n.radiusY===1)}var LC;function h8(){if(LC==null){let t=typeof document<"u"?document.head:null;LC=!!(t&&(t.createShadowRoot||t.attachShadow))}return LC}function vO(t){if(h8()){let n=t.getRootNode?t.getRootNode():null;if(typeof ShadowRoot<"u"&&ShadowRoot&&n instanceof ShadowRoot)return n}return null}function Bc(){let t=typeof document<"u"&&document?document.activeElement:null;for(;t&&t.shadowRoot;){let n=t.shadowRoot.activeElement;if(n===t)break;t=n}return t}function Ki(t){return t.composedPath?t.composedPath()[0]:t.target}var jC;try{jC=typeof Intl<"u"&&Intl.v8BreakIterator}catch{jC=!1}var Mn=(()=>{class t{_platformId=y(po);isBrowser=this._platformId?wm(this._platformId):typeof document=="object"&&!!document;EDGE=this.isBrowser&&/(edge)/i.test(navigator.userAgent);TRIDENT=this.isBrowser&&/(msie|trident)/i.test(navigator.userAgent);BLINK=this.isBrowser&&!!(window.chrome||jC)&&typeof CSS<"u"&&!this.EDGE&&!this.TRIDENT;WEBKIT=this.isBrowser&&/AppleWebKit/i.test(navigator.userAgent)&&!this.BLINK&&!this.EDGE&&!this.TRIDENT;IOS=this.isBrowser&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!("MSStream"in window);FIREFOX=this.isBrowser&&/(firefox|minefield)/i.test(navigator.userAgent);ANDROID=this.isBrowser&&/android/i.test(navigator.userAgent)&&!this.TRIDENT;SAFARI=this.isBrowser&&/safari/i.test(navigator.userAgent)&&this.WEBKIT;constructor(){}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var wh;function f8(){if(wh==null&&typeof window<"u")try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>wh=!0}))}finally{wh=wh||!1}return wh}function yO(t){return f8()?t:!!t.capture}function Vc(t){return t instanceof We?t.nativeElement:t}var p8=new P("cdk-input-modality-detector-options"),m8={ignoreKeys:[18,17,224,91,16]},_O=650,BC={passive:!0,capture:!0},g8=(()=>{class t{_platform=y(Mn);_listenerCleanups;modalityDetected;modalityChanged;get mostRecentModality(){return this._modality.value}_mostRecentTarget=null;_modality=new Rt(null);_options;_lastTouchMs=0;_onKeydown=e=>{this._options?.ignoreKeys?.some(r=>r===e.keyCode)||(this._modality.next("keyboard"),this._mostRecentTarget=Ki(e))};_onMousedown=e=>{Date.now()-this._lastTouchMs<_O||(this._modality.next(mO(e)?"keyboard":"mouse"),this._mostRecentTarget=Ki(e))};_onTouchstart=e=>{if(gO(e)){this._modality.next("keyboard");return}this._lastTouchMs=Date.now(),this._modality.next("touch"),this._mostRecentTarget=Ki(e)};constructor(){let e=y(Ke),r=y(Ve),i=y(p8,{optional:!0});if(this._options=A(A({},m8),i),this.modalityDetected=this._modality.pipe(bu(1)),this.modalityChanged=this.modalityDetected.pipe(so()),this._platform.isBrowser){let o=y(Un).createRenderer(null,null);this._listenerCleanups=e.runOutsideAngular(()=>[o.listen(r,"keydown",this._onKeydown,BC),o.listen(r,"mousedown",this._onMousedown,BC),o.listen(r,"touchstart",this._onTouchstart,BC)])}}ngOnDestroy(){this._modality.complete(),this._listenerCleanups?.forEach(e
vendor: 5,212 bytes, line 51
51=>e())}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),gv=(function(t){return t[t.IMMEDIATE=0]="IMMEDIATE",t[t.EVENTUAL=1]="EVENTUAL",t})(gv||{}),v8=new P("cdk-focus-monitor-default-options"),mv=yO({passive:!0,capture:!0}),bO=(()=>{class t{_ngZone=y(Ke);_platform=y(Mn);_inputModalityDetector=y(g8);_origin=null;_lastFocusOrigin;_windowFocused=!1;_windowFocusTimeoutId;_originTimeoutId;_originFromTouchInteraction=!1;_elementInfo=new Map;_monitoredElementCount=0;_rootNodeFocusListenerCount=new Map;_detectionMode;_windowFocusListener=()=>{this._windowFocused=!0,this._windowFocusTimeoutId=setTimeout(()=>this._windowFocused=!1)};_document=y(Ve);_stopInputModalityDetector=new ve;constructor(){let e=y(v8,{optional:!0});this._detectionMode=e?.detectionMode||gv.IMMEDIATE}_rootNodeFocusAndBlurListener=e=>{let r=Ki(e);for(let i=r;i;i=i.parentElement)e.type==="focus"?this._onFocus(e,i):this._onBlur(e,i)};monitor(e,r=!1){let i=Vc(e);if(!this._platform.isBrowser||i.nodeType!==1)return fe();let o=vO(i)||this._document,s=this._elementInfo.get(i);if(s)return r&&(s.checkChildren=!0),s.subject;let a={checkChildren:r,subject:new ve,rootNode:o};return this._elementInfo.set(i,a),this._registerGlobalListeners(a),a.subject}stopMonitoring(e){let r=Vc(e),i=this._elementInfo.get(r);i&&(i.subject.complete(),this._setClasses(r),this._elementInfo.delete(r),this._removeGlobalListeners(i))}focusVia(e,r,i){let o=Vc(e),s=this._document.activeElement;o===s?this._getClosestElementsInfo(o).forEach(([a,l])=>this._originChanged(a,r,l)):(this._setOrigin(r),typeof o.focus=="function"&&o.focus(i))}ngOnDestroy(){this._elementInfo.forEach((e,r)=>this.stopMonitoring(r))}_getWindow(){return this._document.defaultView||window}_getFocusOrigin(e){return this._origin?this._originFromTouchInteraction?this._shouldBeAttributedToTouch(e)?"touch":"program":this._origin:this._windowFocused&&this._lastFocusOrigin?this._lastFocusOrigin:e&&this._isLastInteractionFromInputLabel(e)?"mouse":"program"}_shouldBeAttributedToTouch(e){return this._detectionMode===gv.EVENTUAL||!!e?.contains(this._inputModalityDetector._mostRecentTarget)}_setClasses(e,r){e.classList.toggle("cdk-focused",!!r),e.classList.toggle("cdk-touch-focused",r==="touch"),e.classList.toggle("cdk-keyboard-focused",r==="keyboard"),e.classList.toggle("cdk-mouse-focused",r==="mouse"),e.classList.toggle("cdk-program-focused",r==="program")}_setOrigin(e,r=!1){this._ngZone.runOutsideAngular(()=>{if(this._origin=e,this._originFromTouchInteraction=e==="touch"&&r,this._detectionMode===gv.IMMEDIATE){clearTimeout(this._originTimeoutId);let i=this._originFromTouchInteraction?_O:1;this._originTimeoutId=setTimeout(()=>this._origin=null,i)}})}_onFocus(e,r){let i=this._elementInfo.get(r),o=Ki(e);!i||!i.checkChildren&&r!==o||this._originChanged(r,this._getFocusOrigin(o),i)}_onBlur(e,r){let i=this._elementInfo.get(r);!i||i.checkChildren&&e.relatedTarget instanceof Node&&r.contains(e.relatedTarget)||(this._setClasses(r),this._emitOrigin(i,null))}_emitOrigin(e,r){e.subject.observers.length&&this._ngZone.run(()=>e.subject.next(r))}_registerGlobalListeners(e){if(!this._platform.isBrowser)return;let r=e.rootNode,i=this._rootNodeFocusListenerCount.get(r)||0;i||this._ngZone.runOutsideAngular(()=>{r.addEventListener("focus",this._rootNodeFocusAndBlurListener,mv),r.addEventListener("blur",this._rootNodeFocusAndBlurListener,mv)}),this._rootNodeFocusListenerCount.set(r,i+1),++this._monitoredElementCount===1&&(this._ngZone.runOutsideAngular(()=>{this._getWindow().addEventListener("focus",this._windowFocusListener)}),this._inputModalityDetector.modalityDetected.pipe(xr(this._stopInputModalityDetector)).subscribe(o=>{this._setOrigin(o,!0)}))}_removeGlobalListeners(e){let r=e.rootNode;if(this._rootNodeFocusListenerCount.has(r)){let i=this._rootNodeFocusListenerCount.get(r);i>1?this._rootNodeFocusListenerCount.set(r,i-1):(r.removeEventListener("focus",this._rootNodeFocusAndBlurListener,mv),r.removeEventListener("blur",this._rootNodeFocusAndBlurListener,mv),this._rootNodeFocusListenerCount.delete(r))}--this._monitoredElementCount||(this._getWindow().removeEventListener("focus",this._windowFocusListener),this._stopInputModalityDetector.next(),clearTimeout(this._windowFocusTimeoutId),clearTimeout(this._originTimeoutId))}_originChanged(e,r,i){this._setClasses(e,r),this._emitOrigin(i,r),this._lastFocusOrigin=r}_getClosestElementsInfo(e){let r=[];return this._elementInfo.forEach((i,o)=>{(o===e||i.checkChildren&&o.contains(e))&&r.push([o,i])}),r}_isLastInteractionFromInputLabel(e){let{_mostRecentTarget:r,mostRecentModality:i}=this._inputModalityDetector;if(i!=="mouse"||!r||r===e||e.nodeName!=="INPUT"&&e.nodeName!=="TEXTAREA"||e.disabled)return!1;let o=e.labels;if(o){for(let s=0;s<o.length;s++)if(o[s].contains(r))return!0}return!1}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var vv=new WeakMap,Eh=(()=>{class t{_appRef;_injector=y(Re);_environmentInjector=y(kt);load(e){let r=this._appRef=this._appRef||this._injector.get(wr),i=vv.get(r);i||(i={loaders:new Set,refs:[]},vv.set(r,i),r.onDestroy(()=>
51{vv.get(r)?.refs.forEach(o=>o.destroy()),vv.delete(r)})),i.loaders.has(e)||(i.loaders.add(e),i.refs.push(gm(e,{environmentInjector:this._environmentInjector})))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var wO=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275cmp=ae({type:t,selectors:[["ng-component"]],exportAs:["cdkVisuallyHidden"],decls:0,vars:0,template:function(r,i){},styles:[`.cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;outline:0;-webkit-appearance:none;-moz-appearance:none;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0} 52`],encapsulation:2,changeDetection:0})}return t})();function Uc(t){return Array.isArray(t)?t:[t]}var EO=new Set,qa,SO=(()=>{class t{_platform=y(Mn);_nonce=y(ql,{optional:!0});_matchMedia;constructor(){this._matchMedia=this._platform.isBrowser&&window.matchMedia?window.matchMedia.bind(window):_8}matchMedia(e){return(this._platform.WEBKIT||this._platform.BLINK)&&y8(e,this._nonce),this._matchMedia(e)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function y8(t,n){if(!EO.has(t))try{qa||(qa=document.createElement("style"),n&&qa.setAttribute("nonce",n),qa.setAttribute("type","text/css"),document.head.appendChild(qa)),qa.sheet&&(qa.sheet.insertRule(`@media ${t} {body{ }}`,0),EO.add(t))}catch(e){console.error(e)}}function _8(t){return{matches:t==="all"||t==="",media:t,addListener:()=>{},removeListener:()=>{}}}var Ch=(()=>{class t{_mediaMatcher=y(SO);_zone=y(Ke);_queries=new Map;_destroySubject=new ve;constructor(){}ngOnDestroy(){this._destroySubject.next(),this._destroySubject.complete()}isMatched(e){return CO(Uc(e)).some(i=>this._registerQuery(i).mql.matches)}observe(e){let i=CO(Uc(e)).map(s=>this._registerQuery(s).observable),o=Cl(i);return o=ii(o.pipe(It(1)),o.pipe(bu(1),b_(0))),o.pipe(te(s=>{let a={matches:!1,breakpoints:{}};return s.forEach(({matches:l,query:c})=>{a.matches=a.matches||l,a.breakpoints[c]=l}),a}))}_registerQuery(e){if(this._queries.has(e))return this._queries.get(e);let r=this._mediaMatcher.matchMedia(e),o={observable:new Ie(s=>{let a=l=>this._zone.run(()=>s.next(l));return r.addListener(a),()=>{r.removeListener(a)}}).pipe(Po(r),te(({matches:s})=>({query:e,matches:s})),xr(this._destroySubject)),mql:r};return this._queries.set(e,o),o}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function CO(t){return t.map(n=>n.split(",")).reduce((n,e)=>n.concat(e)).map(n=>n.trim())}var b8=(()=>{class t{create(e){return typeof MutationObserver>"u"?null:new MutationObserver(e)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var DO=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({providers:[b8]})}return t})();var HC=(()=>{class t{_platform=y(Mn);constructor(){}isDisabled(e){return e.hasAttribute("disabled")}isVisible(e){return E8(e)&&getComputedStyle(e).visibility==="visible"}isTabbable(e){if(!this._platform.isBrowser)return!1;let r=w8(A8(e));if(r&&(IO(r)===-1||!this.isVisible(r)))return!1;let i=e.nodeName.toLowerCase(),o=IO(e);return e.hasAttribute("contenteditable")?o!==-1:i==="iframe"||i==="object"||this._platform.WEBKIT&&this._platform.IOS&&!k8(e)?!1:i==="audio"?e.hasAttribute("controls")?o!==-1:!1:i==="video"?o===-1?!1:o!==null?!0:this._platform.FIREFOX||e.hasAttribute("controls"):e.tabIndex>=0}isFocusable(e,r){return M8(e)&&!this.isDisabled(e)&&(r?.ignoreVisibility||this.isVisible(e))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function w8(t){try{return t.frameElement}catch{return null}}function E8(t){return!!(t.offsetWidth||t.offsetHeight||typeof t.getClientRects=="function"&&t.getClientRects().length)}function C8(t){let n=t.nodeName.toLowerCase();return n==="input"||n==="select"||n==="button"||n==="textarea"}function S8(t){return I8(t)&&t.type=="hidden"}function D8(t){return T8(t)&&t.hasAttribute("href")}function I8(t){return t.nodeName.toLowerCase()=="input"}function T8(t){return t.nodeName.toLowerCase()=="a"}function MO(t){if(!t.hasAttribute("tabindex")||t.tabIndex===void 0)return!1;let n=t.getAttribute("tabindex");return!!(n&&!isNaN(parseInt(n,10)))}function IO(t){if(!MO(t))return null;let n=parseInt(t.getAttribute("tabindex")||"",10);return isNaN(n)?-1:n}function k8(t){let n=t.nodeName.toLowerCase(),e=n==="input"&&t.type;return e==="text"||e==="password"||n==="select"||n==="textarea"}function M8(t){return S8(t)?!1:C8(t)||D8(t)||t.hasAttribute("contenteditable")||MO(t)}function A8(t){return t.ownerDocument&&t.ownerDocument.defaultView||window}var UC=class{_element;_checker;_ngZone;_document;_injector;_startAnchor;_endAnchor;_hasAttached=!1;startAnchorListener=()=>this.focusLastTabbableElement();endAnchorListener=()=>this.focusFirstTabbableElement();get enabled(){return this._enabled}set enabled(n){this._enabled=n,this._startAnchor&&this._endAnchor&&(this._toggleAnchorTabIndex(n,this._startAnchor),this._toggleAnchorTabIndex(n,this._endAnchor))}_enabled=!0;constructor(n,e,r,i,o=!1,s){this._element=n,this._checker=e,this._ngZone=r,this._document=i,this._injector=s,o||this.attachAnchors()}destroy(){let n=this._startAnchor,e=this._endAnchor;n&&(n.removeEventListener("focus",this.startAnchorListener),n.remove()),e&&(e.removeEventListener("focus",this.endAnchorListener),e.remove()),this._startAnchor=this._endAnchor=null,this._hasAttached=!1}attachAnchors(){return this._hasAttached?!0:(this._ngZone.runOutsideAngular(()=>{this._startAnchor||(this._startAnchor=this._createAnchor(),this._startAnchor.addEventListener("focus",this.startAnchorListener)),this._endAnchor||(this._endAnchor=this._createAnchor(),this._endAnchor.addEventListener("focus",this.endAnchorListener))}),this._element.parentNode&&(this._element.parentNode.insertBefore(this._startAnchor,this._element),this._element.parentNode.insertBefore(this._endAnchor,this._element.nextSibling),this._hasAttached=!0),this._hasAttached)}focusInitialElementWhenReady(n){return new Promise(e=>{this._executeOnStable(()=>e(this.focusInitialElement(n)))})}focusFirstTabbableElementWhenReady(n){return new Promise(e=>{this._executeOnStable(()=>e(this.focusFirstTabbableElement(n)))})}focusLastTabbableElementWhenReady(n){return new Promise(e=>{this._executeOnStable(()=>e(this.focusLastTabbableElement(n)))})}_getRegionBoundary(n){let e=this._element.querySelectorAll(`[cdk-focus-region-${n}], [cdkFocusRegion${n}], [cdk-focus-${n}]`);return n=="start"?e.length?e[0]:this._getFirstTabbableElement(this._element):e.length?e[e.length-1]:this._getLastTabbableElement(this._element)}focusInitialElement(n){let e=this._element.querySelector("[cdk-focus-initial], [cdkFocusInitial]");if(e){if(!this._checker.isFocusable(e)){let r=this._getFirstTabbableElement(e);return r?.focus(n),!!r}return e.focus(n),!0}return this.focusFirstTabbableElement(n)}focusFirstTabbableElement(n){let e=this._getRegionBoundary("start");return e&&e.focus(n),!!e}focusLastTabbableElement(n){let e=this._getRegionBoundary("end");return e&&e.focus(n),!!e}hasAttached(){return this._hasAttached}_getFirstTabbableElement(n){if(this._checker.isFocusable(n)&&this._checker.isTabbable(n))return n;let e=n.children;for(let r=0;r<e.length;r++){let i=e[r].nodeType===this._document.ELEMENT_NODE?this._getFirstTabbableElement(e[r]):null;if(i)return i}return null}_getLastTabbableElement(n){if(this._checker.isFocusable(n)&&this._checker.isTabbable(n))return n;let e=n.children;for(let r=e.length-1;r>=0;r--){let i=e[r].nodeType===this._document.ELEMENT_NODE?this._getLastTabbableElement(e[r]):null;if(i)return i}return null}_createAnchor(){let n=this._document.createElement("div");return this._toggleAnchorTabIndex(this._enabled,n),n.classList.add("cdk-visually-hidden"),n.classList.add("cdk-focus-trap-anchor"),n.setAttribute("aria-hidden","true"),n}_toggleAnchorTabIndex(n,e){n?e.setAttribute("tabindex","0"):e.removeAttribute("tabindex")}toggleAnchors(n){this._startAnchor&&this._endAnchor&&(this._toggleAnchorTabIndex(n,this._startAnchor),this._toggleAnchorTabIndex(n,this._endAnchor))}_executeOnStable(n){this._injector?br(n,{injector:this._injector}):setTimeout(n)}},yv=(()=>{class t{_checker=y(HC);_ngZone=y(Ke);_document=y(Ve);_injector=y(Re);constructor(){y(Eh).load(wO)}create(e,r=!1){return new UC(e,this._checker,this._ngZone,this._document,r,this._injector)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),$C=(()=>{class t{_elementRef=y(We);_focusTrapFactory=y(yv);focusTrap;_previouslyFocusedElement=null;get enabled(){return this.focusTrap?.enabled||!1}set enabled(e){this.focusTrap&&(this.focusTrap.enabled=e)}autoCapture;constructor(){y(Mn).isBrowser&&(this.focusTrap=this._focusTrapFactory.create(this._elementRef.nativeElement,!0))}ngOnDestroy(){this.focusTrap?.destroy(),this._previouslyFocusedElement&&(this._previouslyFocusedElement.focus(),this._previouslyFocusedElement=null)}ngAfterContentInit(){this.focusTrap?.attachAnchors(),this.autoCapture&&this._captureFocus()}ngDoCheck(){this.focusTrap&&!this.focusTrap.hasAttached()&&this.focusTrap.attachAnchors()}ngOnChanges(e){let r=e.autoCapture;r&&!r.firstChange&&this.autoCapture&&this.focusTrap?.hasAttached()&&this._captureFocus()}_captureFocus(){this._previouslyFocusedElement=Bc(),this.focusTrap?.focusInitialElementWhenReady()}static \u0275fac=function(r){return new(r||t)};static \u0275dir=Oe({type:t,selectors:[["","cdkTrapFocus",""]],inputs:{enabled:[2,"cdkTrapFocus","enabled",At],autoCapture:[2,"cdkTrapFocusAutoCapture","autoCapture",At]},exportAs:["cdkTrapFocus"],features:[xn]})}return t})();var ms=(function(t){return t[t.NONE=0]="NONE",t[t.BLACK_ON_WHITE=1]="BLACK_ON_WHITE",t[t.WHITE_ON_BLACK=2]="WHITE_ON_BLACK",t})(ms||{}),TO="cdk-high-contrast-black-on-white",kO="cdk-high-contrast-white-on-black",VC="cdk-high-contrast-active",AO=(()=>{class t{_platform=y(Mn);_hasCheckedHighContrastMode;_document=y(Ve);_breakpointSubscription;constructor(){this._breakpointSubscription=y(Ch).observe("(forced-colors: active)").subscribe(()=>{this._hasCheckedHighContrastMode&&(this._hasCheckedHighContrastMode=!1,this._applyBodyHighContrastModeCssClasse
vendor: 20,625 bytes, lines 52-53
52s())})}getHighContrastMode(){if(!this._platform.isBrowser)return ms.NONE;let e=this._document.createElement("div");e.style.backgroundColor="rgb(1,2,3)",e.style.position="absolute",this._document.body.appendChild(e);let r=this._document.defaultView||window,i=r&&r.getComputedStyle?r.getComputedStyle(e):null,o=(i&&i.backgroundColor||"").replace(/ /g,"");switch(e.remove(),o){case"rgb(0,0,0)":case"rgb(45,50,54)":case"rgb(32,32,32)":return ms.WHITE_ON_BLACK;case"rgb(255,255,255)":case"rgb(255,250,239)":return ms.BLACK_ON_WHITE}return ms.NONE}ngOnDestroy(){this._breakpointSubscription.unsubscribe()}_applyBodyHighContrastModeCssClasses(){if(!this._hasCheckedHighContrastMode&&this._platform.isBrowser&&this._document.body){let e=this._document.body.classList;e.remove(VC,TO,kO),this._hasCheckedHighContrastMode=!0;let r=this.getHighContrastMode();r===ms.BLACK_ON_WHITE?e.add(VC,TO):r===ms.WHITE_ON_BLACK&&e.add(VC,kO)}}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Hc=(()=>{class t{constructor(){y(AO)._applyBodyHighContrastModeCssClasses()}static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({imports:[DO]})}return t})();function _v(t,...n){return n.length?n.some(e=>t[e]):t.altKey||t.shiftKey||t.ctrlKey||t.metaKey}function zC(){return typeof __karma__<"u"&&!!__karma__||typeof jasmine<"u"&&!!jasmine||typeof jest<"u"&&!!jest||typeof Mocha<"u"&&!!Mocha}function nn(t){return t==null?"":typeof t=="string"?t:`${t}px`}var x8=new P("cdk-dir-doc",{providedIn:"root",factory:()=>y(Ve)}),R8=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i;function xO(t){let n=t?.toLowerCase()||"";return n==="auto"&&typeof navigator<"u"&&navigator?.language?R8.test(navigator.language)?"rtl":"ltr":n==="rtl"?"rtl":"ltr"}var Ei=(()=>{class t{get value(){return this.valueSignal()}valueSignal=Ee("ltr");change=new tt;constructor(){let e=y(x8,{optional:!0});if(e){let r=e.body?e.body.dir:null,i=e.documentElement?e.documentElement.dir:null;this.valueSignal.set(xO(r||i||"ltr"))}}ngOnDestroy(){this.change.complete()}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Wa;function RO(){if(Wa==null){if(typeof document!="object"||!document||typeof Element!="function"||!Element)return Wa=!1,Wa;if(document.documentElement?.style&&"scrollBehavior"in document.documentElement.style)Wa=!0;else{let t=Element.prototype.scrollTo;t?Wa=!/\{\s*\[native code\]\s*\}/.test(t.toString()):Wa=!1}}return Wa}var Sh=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({})}return t})();var O8=20,qC=(()=>{class t{_ngZone=y(Ke);_platform=y(Mn);_renderer=y(Un).createRenderer(null,null);_cleanupGlobalListener;constructor(){}_scrolled=new ve;_scrolledCount=0;scrollContainers=new Map;register(e){this.scrollContainers.has(e)||this.scrollContainers.set(e,e.elementScrolled().subscribe(()=>this._scrolled.next(e)))}deregister(e){let r=this.scrollContainers.get(e);r&&(r.unsubscribe(),this.scrollContainers.delete(e))}scrolled(e=O8){return this._platform.isBrowser?new Ie(r=>{this._cleanupGlobalListener||(this._cleanupGlobalListener=this._ngZone.runOutsideAngular(()=>this._renderer.listen("document","scroll",()=>this._scrolled.next())));let i=e>0?this._scrolled.pipe(Kf(e)).subscribe(r):this._scrolled.subscribe(r);return this._scrolledCount++,()=>{i.unsubscribe(),this._scrolledCount--,this._scrolledCount||(this._cleanupGlobalListener?.(),this._cleanupGlobalListener=void 0)}}):fe()}ngOnDestroy(){this._cleanupGlobalListener?.(),this._cleanupGlobalListener=void 0,this.scrollContainers.forEach((e,r)=>this.deregister(r)),this._scrolled.complete()}ancestorScrolled(e,r){let i=this.getAncestorScrollContainers(e);return this.scrolled(r).pipe(_t(o=>!o||i.indexOf(o)>-1))}getAncestorScrollContainers(e){let r=[];return this.scrollContainers.forEach((i,o)=>{this._scrollableContainsElement(o,e)&&r.push(o)}),r}_scrollableContainsElement(e,r){let i=Vc(r),o=e.getElementRef().nativeElement;do if(i==o)return!0;while(i=i.parentElement);return!1}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var N8=20,Dh=(()=>{class t{_platform=y(Mn);_listeners;_viewportSize;_change=new ve;_document=y(Ve);constructor(){let e=y(Ke),r=y(Un).createRenderer(null,null);e.runOutsideAngular(()=>{if(this._platform.isBrowser){let i=o=>this._change.next(o);this._listeners=[r.listen("window","resize",i),r.listen("window","orientationchange",i)]}this.change().subscribe(()=>this._viewportSize=null)})}ngOnDestroy(){this._listeners?.forEach(e=>e()),this._change.complete()}getViewportSize(){this._viewportSize||this._updateViewportSize();let e={width:this._viewportSize.width,height:this._viewportSize.height};return this._platform.isBrowser||(this._viewportSize=null),e}getViewportRect(){let e=this.getViewportScrollPosition(),{width:r,height:i}=this.getViewportSize();return{top:e.top,left:e.left,bottom:e.top+i,right:e.left+r,height:i,width:r}}getViewportScrollPosition(){if(!this._platform.isBrowser)return{top:0,left:0};let e=this._document,r=this._getWindow(),i=e.documentElement,o=i.getBoundingClientRect(),s=-o.top||e.body.scrollTop||r.scrollY||i.scrollTop||0,a=-o.left||e.body.scrollLeft||r.scrollX||i.scrollLeft||0;return{top:s,left:a}}change(e=N8){return e>0?this._change.pipe(Kf(e)):this._change}_getWindow(){return this._document.defaultView||window}_updateViewportSize(){let e=this._getWindow();this._viewportSize=this._platform.isBrowser?{width:e.innerWidth,height:e.innerHeight}:{width:0,height:0}}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var OO=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({})}return t})(),WC=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({imports:[Sh,OO,Sh,OO]})}return t})();var GC={},Ji=class t{_appId=y(zl);static _infix=`a${Math.floor(Math.random()*1e5).toString()}`;getId(n,e=!1){return this._appId!=="ng"&&(n+=this._appId),GC.hasOwnProperty(n)||(GC[n]=0),`${n}${e?t._infix+"-":""}${GC[n]++}`}static \u0275fac=function(e){return new(e||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})};var NO=RO();function Iv(t){return new bv(t.get(Dh),t.get(Ve))}var bv=class{_viewportRuler;_previousHTMLStyles={top:"",left:""};_previousScrollPosition;_isEnabled=!1;_document;constructor(n,e){this._viewportRuler=n,this._document=e}attach(){}enable(){if(this._canBeEnabled()){let n=this._document.documentElement;this._previousScrollPosition=this._viewportRuler.getViewportScrollPosition(),this._previousHTMLStyles.left=n.style.left||"",this._previousHTMLStyles.top=n.style.top||"",n.style.left=nn(-this._previousScrollPosition.left),n.style.top=nn(-this._previousScrollPosition.top),n.classList.add("cdk-global-scrollblock"),this._isEnabled=!0}}disable(){if(this._isEnabled){let n=this._document.documentElement,e=this._document.body,r=n.style,i=e.style,o=r.scrollBehavior||"",s=i.scrollBehavior||"";this._isEnabled=!1,r.left=this._previousHTMLStyles.left,r.top=this._previousHTMLStyles.top,n.classList.remove("cdk-global-scrollblock"),NO&&(r.scrollBehavior=i.scrollBehavior="auto"),window.scroll(this._previousScrollPosition.left,this._previousScrollPosition.top),NO&&(r.scrollBehavior=o,i.scrollBehavior=s)}}_canBeEnabled(){if(this._document.documentElement.classList.contains("cdk-global-scrollblock")||this._isEnabled)return!1;let e=this._document.documentElement,r=this._viewportRuler.getViewportSize();return e.scrollHeight>r.height||e.scrollWidth>r.width}};function UO(t,n){return new wv(t.get(qC),t.get(Ke),t.get(Dh),n)}var wv=class{_scrollDispatcher;_ngZone;_viewportRuler;_config;_scrollSubscription=null;_overlayRef;_initialScrollPosition;constructor(n,e,r,i){this._scrollDispatcher=n,this._ngZone=e,this._viewportRuler=r,this._config=i}attach(n){this._overlayRef,this._overlayRef=n}enable(){if(this._scrollSubscription)return;let n=this._scrollDispatcher.scrolled(0).pipe(_t(e=>!e||!this._overlayRef.overlayElement.contains(e.getElementRef().nativeElement)));this._config&&this._config.threshold&&this._config.threshold>1?(this._initialScrollPosition=this._viewportRuler.getViewportScrollPosition().top,this._scrollSubscription=n.subscribe(()=>{let e=this._viewportRuler.getViewportScrollPosition().top;Math.abs(e-this._initialScrollPosition)>this._config.threshold?this._detach():this._overlayRef.updatePosition()})):this._scrollSubscription=n.subscribe(this._detach)}disable(){this._scrollSubscription&&(this._scrollSubscription.unsubscribe(),this._scrollSubscription=null)}detach(){this.disable(),this._overlayRef=null}_detach=()=>{this.disable(),this._overlayRef.hasAttached()&&this._ngZone.run(()=>this._overlayRef.detach())}};var Ih=class{enable(){}disable(){}attach(){}};function KC(t,n){return n.some(e=>{let r=t.bottom<e.top,i=t.top>e.bottom,o=t.right<e.left,s=t.left>e.right;return r||i||o||s})}function PO(t,n){return n.some(e=>{let r=t.top<e.top,i=t.bottom>e.bottom,o=t.left<e.left,s=t.right>e.right;return r||i||o||s})}function ZC(t,n){return new Ev(t.get(qC),t.get(Dh),t.get(Ke),n)}var Ev=class{_scrollDispatcher;_viewportRuler;_ngZone;_config;_scrollSubscription=null;_overlayRef;constructor(n,e,r,i){this._scrollDispatcher=n,this._viewportRuler=e,this._ngZone=r,this._config=i}attach(n){this._overlayRef,this._overlayRef=n}enable(){if(!this._scrollSubscription){let n=this._config?this._config.scrollThrottle:0;this._scrollSubscription=this._scrollDispatcher.scrolled(n).subscribe(()=>{if(this._overlayRef.updatePosition(),this._config&&this._config.autoClose){let e=this._overlayRef.overlayElement.getBoundingClientRect(),{width:r,height:i}=this._viewportRuler.getViewportSize();KC(e,[{width:r,height:i,bottom:i,right:r,top:0,left:0}])&&(this.disable(),this._ngZone.run(()=>this._overlayRef.detach()))}})}}disable(){this._scrollSubscription&&(this._scrollSubscription.unsubscribe(),this._scrollSubscription=null)}detach(){this.disable(),this._overlayRef=null}},HO=(()=>{class t{_injector=y(Re);constructor(){}noop=()=>new Ih;close=e=>UO(this._injector,e);block=()=>Iv(this._injector);reposition=e=>ZC(this._injector,e);static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Ka=class{positionStrategy;scrollStrategy=new Ih;panelClass="";hasBackdrop=!1;backdropClass="cdk-overlay-dark-backdrop";disableAnimations;width;height;minWidth;minHeight;maxWidth;maxHeight;direction;disposeOnNavigation=!1;usePopover;constructor(n){if(n){let e=Object.keys(n);for(let r of e)n[r]!==void 0&&(this[r]=n[r])}}};var Cv=class{connectionPair;scrollableViewProperties;constructor(n,e){this.connectionPair=n,this.scrollableViewProperties=e}};var $O=(()=>{class t{_attachedOverlays=[];_document=y(Ve);_isAttached;constructor(){}ngOnDestroy(){this.detach()}add(e){this.remove(e),this._attachedOverlays.push(e)}remove(e){let r=this._attachedOverlays.indexOf(e);r>-1&&this._attachedOverlays.splice(r,1),this._attachedOverlays.length===0&&this.detach()}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),zO=(()=>{class t extends $O{_ngZone=y(Ke);_renderer=y(Un).createRenderer(null,null);_cleanupKeydown;add(e){super.add(e),this._isAttached||(this._ngZone.runOutsideAngular(()=>{this._cleanupKeydown=this._renderer.listen("body","keydown",this._keydownListener)}),this._isAttached=!0)}detach(){this._isAttached&&(this._cleanupKeydown?.(),this._isAttached=!1)}_keydownListener=e=>{let r=this._attachedOverlays;for(let i=r.length-1;i>-1;i--)if(r[i]._keydownEvents.observers.length>0){this._ngZone.run(()=>r[i]._keydownEvents.next(e));break}};static \u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})();static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),qO=(()=>{class t extends $O{_platform=y(Mn);_ngZone=y(Ke);_renderer=y(Un).createRenderer(null,null);_cursorOriginalValue;_cursorStyleIsSet=!1;_pointerDownEventTarget;_cleanups;add(e){if(super.add(e),!this._isAttached){let r=this._document.body,i={capture:!0},o=this._renderer;this._cleanups=this._ngZone.runOutsideAngular(()=>[o.listen(r,"pointerdown",this._pointerDownListener,i),o.listen(r,"click",this._clickListener,i),o.listen(r,"auxclick",this._clickListener,i),o.listen(r,"contextmenu",this._clickListener,i)]),this._platform.IOS&&!this._cursorStyleIsSet&&(this._cursorOriginalValue=r.style.cursor,r.style.cursor="pointer",this._cursorStyleIsSet=!0),this._isAttached=!0}}detach(){this._isAttached&&(this._cleanups?.forEach(e=>e()),this._cleanups=void 0,this._platform.IOS&&this._cursorStyleIsSet&&(this._document.body.style.cursor=this._cursorOriginalValue,this._cursorStyleIsSet=!1),this._isAttached=!1)}_pointerDownListener=e=>{this._pointerDownEventTarget=Ki(e)};_clickListener=e=>{let r=Ki(e),i=e.type==="click"&&this._pointerDownEventTarget?this._pointerDownEventTarget:r;this._pointerDownEventTarget=null;let o=this._attachedOverlays.slice();for(let s=o.length-1;s>-1;s--){let a=o[s];if(a._outsidePointerEvents.observers.length<1||!a.hasAttached())continue;if(FO(a.overlayElement,r)||FO(a.overlayElement,i))break;let l=a._outsidePointerEvents;this._ngZone?this._ngZone.run(()=>l.next(e)):l.next(e)}};static \u0275fac=(()=>{let e;return function(i){return(e||(e=yn(t)))(i||t)}})();static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function FO(t,n){let e=typeof ShadowRoot<"u"&&ShadowRoot,r=n;for(;r;){if(r===t)return!0;r=e&&r instanceof ShadowRoot?r.host:r.parentNode}return!1}var WO=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275cmp=ae({type:t,selectors:[["ng-component"]],hostAttrs:["cdk-overlay-style-loader",""],decls:0,vars:0,template:function(r,i){},styles:[`.cdk-overlay-container,.cdk-global-overlay-wrapper{pointer-events:none;top:0;left:0;height:100%;width:100%}.cdk-overlay-container{position:fixed}@layer cdk-overlay{.cdk-overlay-container{z-index:1000}}.cdk-overlay-container:empty{display:none}.cdk-global-overlay-wrapper{display:flex;position:absolute}@layer cdk-overlay{.cdk-global-overlay-wrapper{z-index:1000}}.cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;display:flex;max-width:100%;max-height:100%}@layer cdk-overlay{.cdk-overlay-pane{z-index:1000}}.cdk-overlay-backdrop{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:auto;-webkit-tap-highlight-color:rgba(0,0,0,0);opacity:0;touch-action:manipulation}@layer cdk-overlay{.cdk-overlay-backdrop{z-index:1000;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}}@media(prefers-reduced-motion){.cdk-overlay-backdrop{transition-duration:1ms}}.cdk-overlay-backdrop-showing{opacity:1}@media(forced-colors: active){.cdk-overlay-backdrop-showing{opacity:.6}}@layer cdk-overlay{.cdk-overlay-dark-backdrop{background:rgba(0,0,0,.32)}}.cdk-overlay-transparent-backdrop{transition:visibility 1ms linear,opacity 1ms linear;visibility:hidden;opacity:1}.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing,.cdk-high-contrast-active .cdk-overlay-transparent-backdrop{opacity:0;visibility:visible}.cdk-overlay-backdrop-noop-animation{transition:none}.cdk-overlay-connected-position-bounding-box{position:absolute;display:flex;flex-direction:column;min-width:1px;min-height:1px}@layer cdk-overlay{.cdk-overlay-connected-position-bounding-box{z-index:1000}}.cdk-global-scrollblock{position:fixed;width:100%;overflow-y:scroll}.cdk-overlay-popover{background:none;border:none;padding:0;outline:0;overflow:visible;position:fixed;pointer-events:none;white-space:normal;color:inherit;text-decoration:none;width:100%;height:100%;inset:auto;top:0;left:0}.cdk-overlay-popover::backdrop{display:none}.cdk-overlay-popover .cdk-overlay-backdrop{position:fixed;z-index:auto} 53`],encapsulation:2,changeDetection:0})}return t})(),Tv=(()=>{class t{_platform=y(Mn);_containerElement;_document=y(Ve);_styleLoader=y(Eh);constructor(){}ngOnDestroy(){this._containerElement?.remove()}getContainerElement(){return this._loadStyles(),this._containerElement||this._createContainer(),this._containerElement}_createContainer(){let e="cdk-overlay-container";if(this._platform.isBrowser||zC()){let i=this._document.querySelectorAll(`.${e}[platform="server"], .${e}[platform="test"]`);for(let o=0;o<i.length;o++)i[o].remove()}let r=this._document.createElement("div");r.classList.add(e),zC()?r.setAttribute("platform","test"):this._platform.isBrowser||r.setAttribute("platform","server"),this._document.body.appendChild(r),this._containerElement=r}_loadStyles(){this._styleLoader.load(WO)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),JC=class{_renderer;_ngZone;element;_cleanupClick;_cleanupTransitionEnd;_fallbackTimeout;constructor(n,e,r,i){this._renderer=e,this._ngZone=r,this.element=n.createElement("div"),this.element.classList.add("cdk-overlay-backdrop"),this._cleanupClick=e.listen(this.element,"click",i)}detach(){this._ngZone.runOutsideAngular(()=>{let n=this.element;clearTimeout(this._fallbackTimeout),this._cleanupTransitionEnd?.(),this._cleanupTransitionEnd=this._renderer.listen(n,"transitionend",this.dispose),this._fallbackTimeout=setTimeout(this.dispose,500),n.style.pointerEvents="none",n.classList.remove("cdk-overlay-backdrop-showing")})}dispose=()=>{clearTimeout(this._fallbackTimeout),this._cleanupClick?.(),this._cleanupTransitionEnd?.(),this._cleanupClick=this._cleanupTransitionEnd=this._fallbackTimeout=void 0,this.element.remove()}};function XC(t){return t&&t.nodeType===1}var $c=class{_portalOutlet;_host;_pane;_config;_ngZone;_keyboardDispatcher;_document;_location;_outsideClickDispatcher;_animationsDisabled;_injector;_renderer;_backdropClick=new ve;_attachments=new ve;_detachments=new ve;_positionStrategy;_scrollStrategy;_locationChanges=St.EMPTY;_backdropRef=null;_detachContentMutationObserver;_detachContentAfterRenderRef;_disposed;_previousHostParent;_keydownEvents=new ve;_outsidePointerEvents=new ve;_afterNextRenderRef;constructor(n,e,r,i,o,s,a,l,c,u=!1,d,f){this._portalOutlet=n,this._host=e,this._pane=r,this._config=i,this._ngZone=o,this._keyboardDispatcher=s,this._document=a,this._location=l,this._outsideClickDispatcher=c,this._animationsDisabled=u,this._injector=d,this._renderer=f,i.scrollStrategy&&(this._scrollStrategy=i.scrollStrategy,this._scrollStrategy.attach(this)),this._positionStrategy=i.positionStrategy}get overlayElement(){return this._pane}get backdropElement(){return this._backdropRef?.element||null}get hostElement(){return this._host}attach(n){if(this._disposed)return null;this._attachHost();let e=this._portalOutlet.attach(n);return this._positionStrategy?.attach(this),this._updateStackingOrder(),this._updateElementSize(),this._updateElementDirection(),this._scrollStrategy&&this._scrollStrategy.enable(),this._afterNextRenderRef?.destroy(),this._afterNextRenderRef=br(()=>{this.hasAttached()&&this.updatePosition()},{injector:this._injector}),this._togglePointerEvents(!0),this._config.hasBackdrop&&this._attachBackdrop(),this._config.panelClass&&this._toggleClasses(this._pane,this._config.panelClass,!0),this._attachments.next(),this._completeDetachContent(),this._keyboardDispatcher.add(this),this._config.disposeOnNavigation&&(this._locationChanges=this._location.subscribe(()=>this.dispose())),this._outsideClickDispatcher.add(this),typeof e?.onDestroy=="function"&&e.onDestroy(()=>{this.hasAttached()&&this._ngZone.runOutsideAngular(()=>Promise.resolve().then(()=>this.detach()))}),e}detach(){if(!this.hasAttached())return;this.detachBackdrop(),this._togglePointerEvents(!1),this._positionStrategy&&this._positionStrategy.detach&&this._positionStrategy.detach(),this._scrollStrategy&&this._scrollStrategy.disable();let n=this._portalOutlet.detach();return this._detachments.next(),this._completeDetachContent(),this._keyboardDispatcher.remove(this),this._detachContentWhenEmpty(),this._locationChanges.unsubscribe(),this._outsideClickDispatcher.remove(this),n}dispose(){if(this._disposed)return;let n=this.hasAttached();this._positionStrategy&&this._positionStrategy.dispose(),this._disposeScrollStrategy(),this._backdropRef?.dispose(),this._locationChanges.unsubscribe(),this._keyboardDispatcher.remove(this),this._portalOutlet.dis
53pose(),this._attachments.complete(),this._backdropClick.complete(),this._keydownEvents.complete(),this._outsidePointerEvents.complete(),this._outsideClickDispatcher.remove(this),this._host?.remove(),this._afterNextRenderRef?.destroy(),this._previousHostParent=this._pane=this._host=this._backdropRef=null,n&&this._detachments.next(),this._detachments.complete(),this._completeDetachContent(),this._disposed=!0}hasAttached(){return this._portalOutlet.hasAttached()}backdropClick(){return this._backdropClick}attachments(){return this._attachments}detachments(){return this._detachments}keydownEvents(){return this._keydownEvents}outsidePointerEvents(){return this._outsidePointerEvents}getConfig(){return this._config}updatePosition(){this._positionStrategy&&this._positionStrategy.apply()}updatePositionStrategy(n){n!==this._positionStrategy&&(this._positionStrategy&&this._positionStrategy.dispose(),this._positionStrategy=n,this.hasAttached()&&(n.attach(this),this.updatePosition()))}updateSize(n){this._config=A(A({},this._config),n),this._updateElementSize()}setDirection(n){this._config=Z(A({},this._config),{direction:n}),this._updateElementDirection()}addPanelClass(n){this._pane&&this._toggleClasses(this._pane,n,!0)}removePanelClass(n){this._pane&&this._toggleClasses(this._pane,n,!1)}getDirection(){let n=this._config.direction;return n?typeof n=="string"?n:n.value:"ltr"}updateScrollStrategy(n){n!==this._scrollStrategy&&(this._disposeScrollStrategy(),this._scrollStrategy=n,this.hasAttached()&&(n.attach(this),n.enable()))}_updateElementDirection(){this._host.setAttribute("dir",this.getDirection())}_updateElementSize(){if(!this._pane)return;let n=this._pane.style;n.width=nn(this._config.width),n.height=nn(this._config.height),n.minWidth=nn(this._config.minWidth),n.minHeight=nn(this._config.minHeight),n.maxWidth=nn(this._config.maxWidth),n.maxHeight=nn(this._config.maxHeight)}_togglePointerEvents(n){this._pane.style.pointerEvents=n?"":"none"}_attachHost(){if(!this._host.parentElement){let n=this._config.usePopover?this._positionStrategy?.getPopoverInsertionPoint?.():null;XC(n)?n.after(this._host):n?.type==="parent"?n.element.appendChild(this._host):this._previousHostParent?.appendChild(this._host)}if(this._config.usePopover)try{this._host.showPopover()}catch{}}_attachBackdrop(){let n="cdk-overlay-backdrop-showing";this._backdropRef?.dispose(),this._backdropRef=new JC(this._document,this._renderer,this._ngZone,e=>{this._backdropClick.next(e)}),this._animationsDisabled&&this._backdropRef.element.classList.add("cdk-overlay-backdrop-noop-animation"),this._config.backdropClass&&this._toggleClasses(this._backdropRef.element,this._config.backdropClass,!0),this._config.usePopover?this._host.prepend(this._backdropRef.element):this._host.parentElement.insertBefore(this._backdropRef.element,this._host),!this._animationsDisabled&&typeof requestAnimationFrame<"u"?this._ngZone.runOutsideAngular(()=>{requestAnimationFrame(()=>this._backdropRef?.element.classList.add(n))}):this._backdropRef.element.classList.add(n)}_updateStackingOrder(){!this._config.usePopover&&this._host.nextSibling&&this._host.parentNode.appendChild(this._host)}detachBackdrop(){this._animationsDisabled?(this._backdropRef?.dispose(),this._backdropRef=null):this._backdropRef?.detach()}_toggleClasses(n,e,r){let i=Uc(e||[]).filter(o=>!!o);i.length&&(r?n.classList.add(...i):n.classList.remove(...i))}_detachContentWhenEmpty(){let n=!1;try{this._detachContentAfterRenderRef=br(()=>{n=!0,this._detachContent()},{injector:this._injector})}catch(e){if(n)throw e;this._detachContent()}globalThis.MutationObserver&&this._pane&&(this._detachContentMutationObserver||=new globalThis.MutationObserver(()=>{this._detachContent()}),this._detachContentMutationObserver.observe(this._pane,{childList:!0}))}_detachContent(){(!this._pane||!this._host||this._pane.children.length===0)&&(this._pane&&this._config.panelClass&&this._toggleClasses(this._pane,this._config.panelClass,!1),this._host&&this._host.parentElement&&(this._previousHostParent=this._host.parentElement,this._host.remove()),this._completeDetachContent())}_completeDetachContent(){this._detachContentAfterRenderRef?.destroy(),this._detachContentAfterRenderRef=void 0,this._detachContentMutationObserver?.disconnect()}_disposeScrollStrategy(){let n=this._scrollStrategy;n?.disable(),n?.detach?.()}},LO="cdk-overlay-connected-position-bounding-box",F8=/([A-Za-z%]+)$/;function QC(t,n){return new Sv(n,t.get(Dh),t.get(Ve),t.get(Mn),t.get(Tv))}var Sv=class{_viewportRuler;_document;_platform;_overlayContainer;_overlayRef;_isInitialRender;_lastBoundingBoxSize={width:0,height:0};_isPushed=!1;_canPush=!0;_growAfterOpen=!1;_hasFlexibleDimensions=!0;_positionLocked=!1;_originRect;_overlayRect;_viewportRect;_containerRect;_viewportMargin=0;_scrollables=[];_preferredPositions=[];_origin;_pane;_isDisposed;_boundingBox;_lastPosition;_lastScrollVisibility;_positionChanges=new ve;_resizeSubscription=St.EMPTY;_offsetX=0;_offsetY=0;_transformOriginSelector;_appliedPanelClasses=[];_previousPushAmount;_popoverLocation="global";positionChanges=this._positionChanges;get positions(){return this._preferredPositions}
vendor: 6,273 bytes, line 53
53constructor(n,e,r,i,o){this._viewportRuler=e,this._document=r,this._platform=i,this._overlayContainer=o,this.setOrigin(n)}attach(n){this._overlayRef&&this._overlayRef,this._validatePositions(),n.hostElement.classList.add(LO),this._overlayRef=n,this._boundingBox=n.hostElement,this._pane=n.overlayElement,this._isDisposed=!1,this._isInitialRender=!0,this._lastPosition=null,this._resizeSubscription.unsubscribe(),this._resizeSubscription=this._viewportRuler.change().subscribe(()=>{this._isInitialRender=!0,this.apply()})}apply(){if(this._isDisposed||!this._platform.isBrowser)return;if(!this._isInitialRender&&this._positionLocked&&this._lastPosition){this.reapplyLastPosition();return}this._clearPanelClasses(),this._resetOverlayElementStyles(),this._resetBoundingBoxStyles(),this._viewportRect=this._getNarrowedViewportRect(),this._originRect=this._getOriginRect(),this._overlayRect=this._pane.getBoundingClientRect(),this._containerRect=this._overlayContainer.getContainerElement().getBoundingClientRect();let n=this._originRect,e=this._overlayRect,r=this._viewportRect,i=this._containerRect,o=[],s;for(let a of this._preferredPositions){let l=this._getOriginPoint(n,i,a),c=this._getOverlayPoint(l,e,a),u=this._getOverlayFit(c,e,r,a);if(u.isCompletelyWithinViewport){this._isPushed=!1,this._applyPosition(a,l);return}if(this._canFitWithFlexibleDimensions(u,c,r)){o.push({position:a,origin:l,overlayRect:e,boundingBoxRect:this._calculateBoundingBoxRect(l,a)});continue}(!s||s.overlayFit.visibleArea<u.visibleArea)&&(s={overlayFit:u,overlayPoint:c,originPoint:l,position:a,overlayRect:e})}if(o.length){let a=null,l=-1;for(let c of o){let u=c.boundingBoxRect.width*c.boundingBoxRect.height*(c.position.weight||1);u>l&&(l=u,a=c)}this._isPushed=!1,this._applyPosition(a.position,a.origin);return}if(this._canPush){this._isPushed=!0,this._applyPosition(s.position,s.originPoint);return}this._applyPosition(s.position,s.originPoint)}detach(){this._clearPanelClasses(),this._lastPosition=null,this._previousPushAmount=null,this._resizeSubscription.unsubscribe()}dispose(){this._isDisposed||(this._boundingBox&&Ga(this._boundingBox.style,{top:"",left:"",right:"",bottom:"",height:"",width:"",alignItems:"",justifyContent:""}),this._pane&&this._resetOverlayElementStyles(),this._overlayRef&&this._overlayRef.hostElement.classList.remove(LO),this.detach(),this._positionChanges.complete(),this._overlayRef=this._boundingBox=null,this._isDisposed=!0)}reapplyLastPosition(){if(this._isDisposed||!this._platform.isBrowser)return;let n=this._lastPosition;if(n){this._originRect=this._getOriginRect(),this._overlayRect=this._pane.getBoundingClientRect(),this._viewportRect=this._getNarrowedViewportRect(),this._containerRect=this._overlayContainer.getContainerElement().getBoundingClientRect();let e=this._getOriginPoint(this._originRect,this._containerRect,n);this._applyPosition(n,e)}else this.apply()}withScrollableContainers(n){return this._scrollables=n,this}withPositions(n){return this._preferredPositions=n,n.indexOf(this._lastPosition)===-1&&(this._lastPosition=null),this._validatePositions(),this}withViewportMargin(n){return this._viewportMargin=n,this}withFlexibleDimensions(n=!0){return this._hasFlexibleDimensions=n,this}withGrowAfterOpen(n=!0){return this._growAfterOpen=n,this}withPush(n=!0){return this._canPush=n,this}withLockedPosition(n=!0){return this._positionLocked=n,this}setOrigin(n){return this._origin=n,this}withDefaultOffsetX(n){return this._offsetX=n,this}withDefaultOffsetY(n){return this._offsetY=n,this}withTransformOriginOn(n){return this._transformOriginSelector=n,this}withPopoverLocation(n){return this._popoverLocation=n,this}getPopoverInsertionPoint(){return this._popoverLocation==="global"?null:this._popoverLocation!=="inline"?this._popoverLocation:this._origin instanceof We?this._origin.nativeElement:XC(this._origin)?this._origin:null}_getOriginPoint(n,e,r){let i;if(r.originX=="center")i=n.left+n.width/2;else{let s=this._isRtl()?n.right:n.left,a=this._isRtl()?n.left:n.right;i=r.originX=="start"?s:a}e.left<0&&(i-=e.left);let o;return r.originY=="center"?o=n.top+n.height/2:o=r.originY=="top"?n.top:n.bottom,e.top<0&&(o-=e.top),{x:i,y:o}}_getOverlayPoint(n,e,r){let i;r.overlayX=="center"?i=-e.width/2:r.overlayX==="start"?i=this._isRtl()?-e.width:0:i=this._isRtl()?0:-e.width;let o;return r.overlayY=="center"?o=-e.height/2:o=r.overlayY=="top"?0:-e.height,{x:n.x+i,y:n.y+o}}_getOverlayFit(n,e,r,i){let o=BO(e),{x:s,y:a}=n,l=this._getOffset(i,"x"),c=this._getOffset(i,"y");l&&(s+=l),c&&(a+=c);let u=0-s,d=s+o.width-r.width,f=0-a,h=a+o.height-r.height,p=this._subtractOverflows(o.width,u,d),m=this._subtractOverflows(o.height,f,h),g=p*m;return{visibleArea:g,isCompletelyWithinViewport:o.width*o.height===g,fitsInViewportVertically:m===o.height,fitsInViewportHorizontally:p==o.width}}_canFitWithFlexibleDimensions(n,e,r){if(this._hasFlexibleDimensions){let i=r.bottom-e.y,o=r.right-e.x,s=jO(this._overlayRef.getConfig().minHeight),a=jO(this._overlayRef.getConfig().minWidth),l=n.fitsInViewportVertically||s!=null&&s<=i,c=n.fitsInViewportHorizontally||a!=null&&a<=o;return l&&c}return!1}_pushOverlayOnScreen(n,e,r){if(this._previousPushAmount&&this._positionLocked)return{x:n.x+this._previousPushAmount.x,y:n.y+this._previousPushAmount.y};let i=BO(e),o=this._viewportRect,s=Math.max(n.x+i.width-o.width,0),a=Math.max(n.y+i.height-o.height,0),l=Math.max(o.top-r.top-n.y,0),c=Math.max(o.left-r.left-n.x,0),u=0,d=0;return i.width<=o.width?u=c||-s:u=n.x<this._getViewportMarginStart()?o.left-r.left-n.x:0,i.height<=o.height?d=l||-a:d=n.y<this._getViewportMarginTop()?o.top-r.top-n.y:0,this._previousPushAmount={x:u,y:d},{x:n.x+u,y:n.y+d}}_applyPosition(n,e){if(this._setTransformOrigin(n),this._setOverlayElementStyles(e,n),this._setBoundingBoxStyles(e,n),n.panelClass&&this._addPanelClasses(n.panelClass),this._positionChanges.observers.length){let r=this._getScrollVisibility();if(n!==this._lastPosition||!this._lastScrollVisibility||!L8(this._lastScrollVisibility,r)){let i=new Cv(n,r);this._positionChanges.next(i)}this._lastScrollVisibility=r}this._lastPosition=n,this._isInitialRender=!1}_setTransformOrigin(n){if(!this._transformOriginSelector)return;let e=this._boundingBox.querySelectorAll(this._transformOriginSelector),r,i=n.overlayY;
53n.overlayX==="center"?r="center":this._isRtl()?r=n.overlayX==="start"?"right":"left":r=n.overlayX==="start"?"left":"right";for(let o=0;o<e.length;o++)e[o].style.transformOrigin=`${r} ${i}`}_calculateBoundingBoxRect(n,e){let r=this._viewportRect,i=this._isRtl(),o,s,a;if(e.overlayY==="top")s=n.y,o=r.height-s+this._getViewportMarginBottom();else if(e.overlayY==="bottom")a=r.height-n.y+this._getViewportMarginTop()+this._getViewportMarginBottom(),o=r.height-a+this._getViewportMarginTop();else{let h=Math.min(r.bottom-n.y+r.top,n.y),p=this._lastBoundingBoxSize.height;o=h*2,s=n.y-h,o>p&&!this._isInitialRender&&!this._growAfterOpen&&(s=n.y-p/2)}let l=e.overlayX==="start"&&!i||e.overlayX==="end"&&i,c=e.overlayX==="end"&&!i||e.overlayX==="start"&&i,u,d,f;if(c)f=r.width-n.x+this._getViewportMarginStart()+this._getViewportMarginEnd(),u=n.x-this._getViewportMarginStart();else if(l)d=n.x,u=r.right-n.x-this._getViewportMarginEnd();else{let h=Math.min(r.right-n.x+r.left,n.x),p=this._lastBoundingBoxSize.width;u=h*2,d=n.x-h,u>p&&!this._isInitialRender&&!this._growAfterOpen&&(d=n.x-p/2)}return{top:s,left:d,bottom:a,right:f,width:u,height:o}}_setBoundingBoxStyles(n,e){let r=this._calculateBoundingBoxRect(n,e);!this._isInitialRender&&!this._growAfterOpen&&(r.height=Math.min(r.height,this._lastBoundingBoxSize.height),r.width=Math.min(r.width,this._lastBoundingBoxSize.width));let i={};if(this._hasExactPosition())i.top=i.left="0",i.bottom=i.right="auto",i.maxHeight=i.maxWidth="",i.width=i.height="100%";else{let o=this._overlayRef.getConfig().maxHeight,s=this._overlayRef.getConfig().maxWidth;i.width=nn(r.width),i.height=nn(r.height),i.top=nn(r.top)||"auto",i.bottom=nn(r.bottom)||"auto",i.left=nn(r.left)||"auto",i.right=nn(r.right)||"auto",e.overlayX==="center"?i.alignItems="center":i.alignItems=e.overlayX==="end"?"flex-end":"flex-start",e.overlayY==="center"?i.justifyContent="center":i.justifyContent=e.overlayY==="bottom"?"flex-end":"flex-start",o&&(i.maxHeight=nn(o)),s&&(i.maxWidth=nn(s))}this._lastBoundingBoxSize=r,Ga(this._boundingBox.style,i)}_resetBoundingBoxStyles(){Ga(this._boundingBox.style,{top:"0",left:"0",right:"0",bottom:"0",height:"",width:"",alignItems:"",justifyContent:""})}_resetOverlayElementStyles(){Ga(this._pane.style,{top:"",left:"",bottom:"",right:"",position:"",transform:""})}_setOverlayElementStyles(n,e){let r={},i=this._hasExactPosition(),o=this._hasFlexibleDimensions,s=this._overlayRef.getConfig();if(i){let u=this._viewportRuler.getViewportScrollPosition();Ga(r,this._getExactOverlayY(e,n,u)),Ga(r,this._getExactOverlayX(e,n,u))}else r.position="static";let a="",l=this._getOffset(e,"x"),c=this._getOffset(e,"y");l&&(a+=`translateX(${l}px) `),c&&(a+=`translateY(${c}px)`),r.transform=a.trim(),s.maxHeight&&(i?r.maxHeight=nn(s.maxHeight):o&&(r.maxHeight="")),s.maxWidth&&(i?r.maxWidth=nn(s.maxWidth):o&&(r.maxWidth="")),Ga(this._pane.style,r)}_getExactOverlayY(n,e,r){let i={top:"",bottom:""},o=this._getOverlayPoint(e,this._overlayRect,n);if(this._isPushed&&(o=this._pushOverlayOnScreen(o,this._overlayRect,r)),n.overlayY==="bottom"){let s=this._document.documentElement.clientHeight;i.bottom=`${s-(o.y+this._overlayRect.height)}px`}else i.top=nn(o.y);return i}_getExactOverlayX(n,e,r){let i={left:"",right:""},o=this._getOverlayPoint(e,this._overlayRect,n);this._isPushed&&(o=this._pushOverlayOnScreen(o,this._overlayRect,r));let s;if(this._isRtl()?s=n.overlayX==="end"?"left":"right":s=n.overlayX==="end"?"right":"left",s==="right"){let a=this._document.documentElement.clientWidth;i.right=`${a-(o.x+this._overlayRect.width)}px`}else i.left=nn(o.x);return i}_getScrollVisibility(){let n=this._getOriginRect(),e=this._pane.getBoundingClientRect(),r=this._scrollables.map(i=>i.getElementRef().nativeElement.getBoundingClientRect());return{isOriginClipped:PO(n,r),isOriginOutsideView:KC(n,r),isOverlayClipped:PO(e,r),isOverlayOutsideView:KC(e,r)}}_subtractOverflows(n,...e){return e.reduce((r,i)=>r-Math.max(i,0),n)}_getNarrowedViewportRect(){let n=this._document.documentElement.clientWidth,e=this._document.documentElement.clientHeight,r=this._viewportRuler.getViewportScrollPosition();return{top:r.top+this._getViewportMarginTop(),left:r.left+this._getViewportMarginStart(),right:r.left+n-this._getViewportMarginEnd(),bottom:r.to
53p+e-this._getViewportMarginBottom(),width:n-this._getViewportMarginStart()-this._getViewportMarginEnd(),height:e-this._getViewportMarginTop()-this._getViewportMarginBottom()}}_isRtl(){return this._overlayRef.getDirection()==="rtl"}_hasExactPosition(){return!this._hasFlexibleDimensions||this._isPushed}_getOffset(n,e){return e==="x"?n.offsetX==null?this._offsetX:n.offsetX:n.offsetY==null?this._offsetY:n.offsetY}_validatePositions(){}_addPanelClasses(n){this._pane&&Uc(n).forEach(e=>{e!==""&&this._appliedPanelClasses.indexOf(e)===-1&&(this._appliedPanelClasses.push(e),this._pane.classList.add(e))})}_clearPanelClasses(){this._pane&&(this._appliedPanelClasses.forEach(n=>{this._pane.classList.remove(n)}),this._appliedPanelClasses=[])}_getViewportMarginStart(){return typeof this._viewportMargin=="number"?this._viewportMargin:this._viewportMargin?.start??0}_getViewportMarginEnd(){return typeof this._viewportMargin=="number"?this._viewportMargin:this._viewportMargin?.end??0}_getViewportMarginTop(){return typeof this._viewportMargin=="number"?this._viewportMargin:this._viewportMargin?.top??0}_getViewportMarginBottom(){return typeof this._viewportMargin=="number"?this._viewportMargin:this._viewportMargin?.bottom??0}_getOriginRect(){let n=this._origin;if(n instanceof We)return n.nativeElement.getBoundingClientRect();if(n instanceof Element)return n.getBoundingClientRect();let e=n.width||0,r=n.height||0;return{top:n.y,bottom:n.y+r,left:n.x,right:n.x+e,height:r,width:e}}};function Ga(t,n){for(let e in n)n.hasOwnProperty(e)&&(t[e]=n[e]);return t}function jO(t){if(typeof t!="number"&&t!=null){let[n,e]=t.split(F8);return!e||e==="px"?parseFloat(n):null}return t||null}function BO(t){return{top:Math.floor(t.top),right:Math.floor(t.right),bottom:Math.floor(t.bottom),left:Math.floor(t.left),width:Math.floor(t.width),height:Math.floor(t.height)}}function L8(t,n){return t===n?!0:t.isOriginClipped===n.isOriginClipped&&t.isOriginOutsideView===n.isOriginOutsideView&&t.isOverlayClipped===n.isOverlayClipped&&t.isOverlayOutsideView===n.isOverlayOutsideView}var VO="cdk-global-overlay-wrapper";function kv(t){return new Dv}var Dv=class{_overlayRef;_cssPosition="static";_topOffset="";_bottomOffset="";_alignItems="";_xPosition="";_xOffset="";_width="";_height="";_isDisposed=!1;attach(n){let e=n.getConfig();this._overlayRef=n,this._width&&!e.width&&n.updateSize({width:this._width}),this._height&&!e.height&&n.updateSize({height:this._height}),n.hostElement.classList.add(VO),this._isDisposed=!1}top(n=""){return this._bottomOffset="",this._topOffset=n,this._alignItems="flex-start",this}left(n=""){return this._xOffset=n,this._xPosition="left",this}bottom(n=""){return this._topOffset="",this._bottomOffset=n,this._alignItems="flex-end",this}right(n=""){return this._xOffset=n,this._xPosition="right",this}start(n=""){return this._xOffset=n,this._xPosition="start",this}end(n=""){return this._xOffset=n,this._xPosition="end",this}width(n=""){return this._overlayRef?this._overlayRef.updateSize({width:n}):this._width=n,this}height(n=""){return this._overlayRef?this._overlayRef.updateSize({height:n}):this._height=n,this}centerHorizontally(n=""){return this.left(n),this._xPosition="center",this}centerVertically(n=""){return this.top(n),this._alignItems="center",this}apply(){if(!this._overlayRef||!this._overlayRef.hasAttached())return;let n=this._overlayRef.overlayElement.style,e=this._overlayRef.hostElement.style,r=this._overlayRef.getConfig(),{width:i,height:o,maxWidth:s,maxHeight:a}=r,l=(i==="100%"||i==="100vw")&&(!s||s==="100%"||s==="100vw"),c=(o==="100%"||o==="100vh")&&(!a||a==="100%"||a==="100vh"),u=this._xPosition,d=this._xOffset,f=this._overlayRef.getConfig().direction==="rtl",h="",p="",m="";l?m="flex-start":u==="center"?(m="center",f?p=d:h=d):f?u==="left"||u==="end"?(m="flex-end",h=d):(u==="right"||u==="start")&&(m="flex-start",p=d):u==="left"||u==="start"?(m="flex-start",h=d):(u==="right"||u==="end")&&(m="flex-end",p=d),n.position=this._cssPosition,n.marginLeft=l?"0":h,n.marginTop=c?"0":this._topOffset,n.marginBottom=this._bottomOffset,n.marginRight=l?"0":p,e.justifyContent=m,e.alignItems=c?"flex-start":this._alignItems}dispose(){if(this._isDisposed||!this._overlayRef)return;let n=this._overlayRef.overlayElement.style,e=this._overlayRef.hostElement,r=e.style;e.classList.remove(VO),r.justifyContent=r.alignItems=n.marginTop=n.marginBottom=n.marginLeft=n.marginRight=n.position="",this._overlayRef=null,this._isDisposed=!0}},GO=(()=>{class t{_injector=y(Re);constructor(){}global(){return kv()}flexibleConnectedTo(e){return QC(this._injector,e)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),eS=new P("OVERLAY_DEFAULT_CONFIG");function Th(t,n){t.get(Eh).load(WO);let e=t.get(Tv),r=t.get(Ve),i=t.get(Ji),o=t.get(wr),s=t.get(Ei),a=t.get(Tn,null,{optional:!0})||t.get(Un).createRenderer(null,null),l=new Ka(n),c=t.get(eS,null,{optional:!0})?.usePopover??!0;l.direction=l.direction||s.value,"showPopover"in r.body?l.usePopover=n?.usePopover??c:l.usePopover=!1;let u=r.createElement("div"),d=r.createElement("div");u.id=i.getId("cdk-overlay-"),u.classList.add("cdk-overlay-pane"),d.appendChild(u),l.usePopover&&(d.setAttribute("popover","manual"),d.classList.add("cdk-overlay-popover"));let f=l.usePopover?l.positionStrategy?.getPopoverInsertionPoint?.():null;return e.getContainerElement().appendChild(d),XC(f)?f.after(d):f?.type==="parent"&&f.element.appendChild(d),new $c(new pv(u,o,t),d,u,l,t.get(Ke),t.get(zO),r,t.get(Vi),t.get(qO),n?.disableAnimations??t.get(Eb,null,{optional:!0})==="NoopAnimations",t.get(kt),a)}var Mv=(()=>{class t{scrollStrategies=y(HO);_positionBuilder=y(GO);_injector=y(Re);constructor(){}create(e){return Th(this._injector,e)}position(){return this._positionBuilder}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),j8=[{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"},{originX:"start",originY:"top",overlayX:"start",overlayY:"bottom"},{originX:"end",originY:"top",overlayX:"end",overlayY:"bottom"},{originX:"end",originY:"bottom",overlayX:"end",overlayY:"top"}],B8=new P("cdk-connected-overlay-scroll-strategy",{providedIn:"root",factory:()=>{let t=y(Re);return()=>ZC(t)}}),YC=(()=>{class t{elementRef=y(We);constructor(){}static \u0275fac=function(r){return new(r||t)};static \u0275dir=Oe({type:t,selectors:[["","cdk-overlay-origin",""],["","overlay-origin",""],["","cdkOverlayOrigin",""]],exportAs:["cdkOverlayOrigin"]})}return t})(),KO=new P("cdk-connected-overlay-default-config"),tS=(()=>{class t{_dir=y(Ei,{optional:!0});_injector=y(Re);_overlayRef;_templatePortal;_backdropSubscription=St.EMPTY;_attachSubscription=St.EMPTY;_detachSubscription=St.EMPTY;_positionSubscription=St.EMPTY;_offsetX;_offsetY;_position;_scrollStrategyFactory=y(B8);_ngZone=y(Ke);origin;positions;positionStrategy;get offsetX(){return this._offsetX}set offsetX(e){this._offsetX=e,this._position&&this._updatePositionStrategy(this._position)}get offsetY(){return this._offsetY}set offsetY(e){this._offsetY=e,this._position&&this._updatePositionStrategy(this._position)}width;height;minWidth;minHeight;backdropClass;panelClass;viewportMargin=0;scrollStrategy;open=!1;disableClose=!1;transformOriginSelector;hasBackdrop=!1;lockPosition=!1;flexibleDimensions=!1;growAfterOpen=!1;push=!1;disposeOnNavigation=!1;usePopover;matchWidth=!1;
53set _config(e){typeof e!="string"&&this._assignConfig(e)}backdropClick=new tt;positionChange=new tt;attach=new tt;detach=new tt;overlayKeydown=new tt;overlayOutsideClick=new tt;constructor(){let e=y(Xn),r=y(Hn),i=y(KO,{optional:!0}),o=y(eS,{optional:!0});this.usePopover=o?.usePopover===!1?null:"global",this._templatePortal=new za(e,r),this.scrollStrategy=this._scrollStrategyFactory(),i&&this._assignConfig(i)}get overlayRef(){return this._overlayRef}get dir(){return this._dir?this._dir.value:"ltr"}ngOnDestroy(){this._attachSubscription.unsubscribe(),this._detachSubscription.unsubscribe(),this._backdropSubscription.unsubscribe(),this._positionSubscription.unsubscribe(),this._overlayRef?.dispose()}ngOnChanges(e){this._position&&(this._updatePositionStrategy(this._position),this._overlayRef?.updateSize({width:this._getWidth(),minWidth:this.minWidth,height:this.height,minHeight:this.minHeight}),e.origin&&this.open&&this._position.apply()),e.open&&(this.open?this.attachOverlay():this.detachOverlay())}_createOverlay(){(!this.positions||!this.positions.length)&&(this.positions=j8);let e=this._overlayRef=Th(this._injector,this._buildConfig());this._attachSubscription=e.attachments().subscribe(()=>this.attach.emit()),this._detachSubscription=e.detachments().subscribe(()=>this.detach.emit()),e.keydownEvents().subscribe(r=>{this.overlayKeydown.next(r),r.keyCode===27&&!this.disableClose&&!_v(r)&&(r.preventDefault(),this.detachOverlay())}),this._overlayRef.outsidePointerEvents().subscribe(r=>{let i=this._getOriginElement(),o=Ki(r);(!i||i!==o&&!i.contains(o))&&this.overlayOutsideClick.next(r)})}_buildConfig(){let e=this._position=this.positionStrategy||this._createPositionStrategy(),r=new Ka({direction:this._dir||"ltr",positionStrategy:e,scrollStrategy:this.scrollStrategy,hasBackdrop:this.hasBackdrop,disposeOnNavigation:this.disposeOnNavigation,usePopover:!!this.usePopover});return(this.height||this.height===0)&&(r.height=this.height),(this.minWidth||this.minWidth===0)&&(r.minWidth=this.minWidth),(this.minHeight||this.minHeight===0)&&(r.minHeight=this.minHeight),this.backdropClass&&(r.backdropClass=this.backdropClass),this.panelClass&&(r.panelClass=this.panelClass),r}_updatePositionStrategy(e){let r=this.positions.map(i=>({originX:i.originX,originY:i.originY,overlayX:i.overlayX,overlayY:i.overlayY,offsetX:i.offsetX||this.offsetX,offsetY:i.offsetY||this.offsetY,panelClass:i.panelClass||void 0}));return e.setOrigin(this._getOrigin()).withPositions(r).withFlexibleDimensions(this.flexibleDimensions).withPush(this.push).withGrowAfterOpen(this.growAfterOpen).withViewportMargin(this.viewportMargin).withLockedPosition(this.lockPosition).withTransformOriginOn(this.transformOriginSelector).withPopoverLocation(this.usePopover===null?"global":this.usePopover)}_createPositionStrategy(){let e=QC(this._injector,this._getOrigin());return this._updatePositionStrategy(e),e}_getOrigin(){return this.origin instanceof YC?this.origin.elementRef:this.origin}_getOriginElement(){return this.origin instanceof YC?this.origin.elementRef.nativeElement:this.origin instanceof We?this.origin.nativeElement:typeof Element<"u"&&this.origin instanceof Element?this.origin:null}_getWidth(){return this.width?this.width:this.matchWidth?this._getOriginElement()?.getBoundingClientRect?.().width:void 0}attachOverlay(){this._overlayRef||this._createOverlay();let e=this._overlayRef;e.getConfig().hasBackdrop=this.hasBackdrop,e.updateSize({width:this._getWidth()}),e.hasAttached()||e.attach(this._templatePortal),this.hasBackdrop?this._backdropSubscription=e.backdropClick().subscribe(r=>this.backdropClick.emit(r)):this._backdropSubscription.unsubscribe(),this._positionSubscription.unsubscribe(),this.positionChange.observers.length>0&&(this._positionSubscription=this._position.positionChanges.pipe(S_(()=>this.positionChange.observers.length>0)).subscribe(r=>{this._ngZone.run(()=>this.positionChange.emit(r)),this.positionChange.observers.length===0&&this._positionSubscription.unsubscribe()})),this.open=!0}detachOverlay(){this._overlayRef?.detach(),this._backdropSubscription.unsubscribe(),this._positionSubscription.unsubscribe(),this.open=!1}_assignConfig(e){this.origin=e.origin??this.origin,this.positions=e.positions??this.positions,this.positionStrategy=e.positionStrategy??this.positionStrategy,this.offsetX=e.offsetX??this.offsetX,this.offsetY=e.offsetY??this.offsetY,this.width=e.width??this.width,this.height=e.height??this.height,this.minWidth=e.minWidth??this.minWidth,this.minHeight=e.minHeight??this.minHeight,this.backdropClass=e.backdropClass??this.backdropClass,this.panelClass=e.panelClass??this.panelClass,this.viewportMargin=e.viewportMargin??this.viewportMargin,this.scrollStrategy=e.scrollStrategy??this.scrollStrategy,this.disableClose=e.disableClose??this.disableClose,this.transformOriginSelector=e.transformOriginSelector??this.transformOriginSelector,this.hasBackdrop=e.hasBackdrop??this.hasBackdrop,this.lockPosition=e.lockPosition??this.lockPosition,this.flexibleDimensions=e.flexibleDimensions??this.flexibleDimensions,this.growAfterOpen=e.growAfterOpen??this.growAfterOpen,this.push=e.push??this.push,this.disposeOnNavigation=e.disposeOnNavigation??this.disposeOnNavigation,this.usePopover=e.usePopover??this.usePopover,this.matchWidth=e.matchWidth??this.matchWidth}static \u0275fac=function(r){return new(r||t)};static \u0275dir=Oe({type:t,selectors:[["","cdk-connected-overlay",""],["","connected-overlay",""],["","cdkConnectedOverlay",""]],inputs:{origin:[0,"cdkConnectedOverlayOrigin","origin"],positions:[0,"cdkConnectedOverlayPositions","positions"],positionStrategy:[0,"cdkConnectedOverlayPositionStrategy","positionStrategy"],offsetX:[0,"cdkConnectedOverlayOffsetX","offsetX"],offsetY:[0,"cdkConnectedOverlayOffsetY","offsetY"],width:[0,"cdkConnectedOverlayWidth","width"],height:[0,"cdkConnectedOverlayHeight","height"],minWidth:[0,"cdkConnectedOverlayMinWidth","minWidth"],minHeight:[0,"cdkConnectedOverlayMinHeight","minHeight"],backdropClass:[0,"cdkConnectedOverlayBackdropClass","backdropClass"],panelClass:[0,"cdkConnectedOverlayPanelClass","panelClass"],viewportMargin:[0,"cdkConnectedOverlayViewportMargin","viewportMargin"],scrollStrategy:[0,"cdkConnectedOverlayScrollStrategy","scrollStrategy"],open:[0,"cdkConnectedOverlayOpen","open"],disableClose:[0,"cdkConnectedOverlayDisableClose","disableClose"],transformOriginSelector:[0,"cdkConnectedOverlayTransformOriginOn","transformOriginSelector"],hasBackdrop:[2,"cdkConnectedOverlayHasBackdrop","hasBackdrop",At],lockPosition:[2,"cdkConnectedOverlayLockPosition","lockPosition",At],flexibleDimensions:[2,"cdkConnectedOverlayFlexibleDimensions","flexibleDimensions",At],growAfterOpen:[2,"cdkConnectedOverlayGrowAfterOpen","growAfterOpen",At],push:[2,"cdkConnectedOverlayPush","push",At],disposeOnNavigation:[2,"cdkConnectedOverlayDisposeOnNavigation","disposeOnNavigation",At],usePopover:[0,"cdkConnectedOverlayUsePopover","usePopover"],matchWidth:[2,"cdkConnectedOverlayMatchWidth","matchWidth",At],_config:[0,"cdkConnectedOverlay","_config"]},outputs:{backdropClick:"backdropClick",positionChange:"positionChange",attach:"attach",detach:"detach",overlayKeydown:"overlayKeydown",overlayOutsideClick:"overlayOutsideClick"},exportAs:["cdkConnectedOverlay"],features:[xn]})}return t})(),Av=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=bt({type:t});static \u0275inj=mt({providers:[Mv],imports:[Sh,FC,WC,WC]})}return t})();function V8(t,n){}var zc=class{viewContainerRef;injector;id;role="dialog";panelClass="";hasBackdrop=!0;backdropClass="";disableClose=!1;closePredicate;width="";height="";minWidth;minHeight;maxWidth;maxHeight;positionStrategy;data=null;direction;ariaDescribedBy=null;ariaLabelledBy=null;ariaLabel=null;ariaModal=!1;
vendor: 5,737 bytes, lines 53-54
53autoFocus="first-tabbable";restoreFocus=!0;scrollStrategy;closeOnNavigation=!0;closeOnDestroy=!0;closeOnOverlayDetachments=!0;disableAnimations=!1;providers;container;templateContext};var U8=(()=>{class t extends jc{_elementRef=y(We);_focusTrapFactory=y(yv);_config;_interactivityChecker=y(HC);_ngZone=y(Ke);_focusMonitor=y(bO);_renderer=y(Tn);_changeDetectorRef=y(zn);_injector=y(Re);_platform=y(Mn);_document=y(Ve);_portalOutlet;_focusTrapped=new ve;_focusTrap=null;_elementFocusedBeforeDialogWasOpened=null;_closeInteractionType=null;_ariaLabelledByQueue=[];_isDestroyed=!1;constructor(){super(),this._config=y(zc,{optional:!0})||new zc,this._config.ariaLabelledBy&&this._ariaLabelledByQueue.push(this._config.ariaLabelledBy)}_addAriaLabelledBy(e){this._ariaLabelledByQueue.push(e),this._changeDetectorRef.markForCheck()}_removeAriaLabelledBy(e){let r=this._ariaLabelledByQueue.indexOf(e);r>-1&&(this._ariaLabelledByQueue.splice(r,1),this._changeDetectorRef.markForCheck())}_contentAttached(){this._initializeFocusTrap(),this._captureInitialFocus()}_captureInitialFocus(){this._trapFocus()}ngOnDestroy(){this._focusTrapped.complete(),this._isDestroyed=!0,this._restoreFocus()}attachComponentPortal(e){this._portalOutlet.hasAttached();let r=this._portalOutlet.attachComponentPortal(e);return this._contentAttached(),r}attachTemplatePortal(e){this._portalOutlet.hasAttached();let r=this._portalOutlet.attachTemplatePortal(e);return this._contentAttached(),r}attachDomPortal=e=>{this._portalOutlet.hasAttached();let r=this._portalOutlet.attachDomPortal(e);return this._contentAttached(),r};_recaptureFocus(){this._containsFocus()||this._trapFocus()}_forceFocus(e,r){this._interactivityChecker.isFocusable(e)||(e.tabIndex=-1,this._ngZone.runOutsideAngular(()=>{let i=()=>{o(),s(),e.removeAttribute("tabindex")},o=this._renderer.listen(e,"blur",i),s=this._renderer.listen(e,"mousedown",i)})),e.focus(r)}_focusByCssSelector(e,r){let i=this._elementRef.nativeElement.querySelector(e);i&&this._forceFocus(i,r)}_trapFocus(e){this._isDestroyed||br(()=>{let r=this._elementRef.nativeElement;switch(this._config.autoFocus){case!1:case"dialog":this._containsFocus()||r.focus(e);break;case!0:case"first-tabbable":this._focusTrap?.focusInitialElement(e)||this._focusDialogContainer(e);break;case"first-heading":this._focusByCssSelector('h1, h2, h3, h4, h5, h6, [role="heading"]',e);break;default:this._focusByCssSelector(this._config.autoFocus,e);break}this._focusTrapped.next()},{injector:this._injector})}_restoreFocus(){let e=this._config.restoreFocus,r=null;if(typeof e=="string"?r=this._document.querySelector(e):typeof e=="boolean"?r=e?this._elementFocusedBeforeDialogWasOpened:null:e&&(r=e),this._config.restoreFocus&&r&&typeof r.focus=="function"){let i=Bc(),o=this._elementRef.nativeElement;(!i||i===this._document.body||i===o||o.contains(i))&&(this._focusMonitor?(this._focusMonitor.focusVia(r,this._closeInteractionType),this._closeInteractionType=null):r.focus())}this._focusTrap&&this._focusTrap.destroy()}_focusDialogContainer(e){this._elementRef.nativeElement.focus?.(e)}_containsFocus(){let e=this._elementRef.nativeElement,r=Bc();return e===r||e.contains(r)}_initializeFocusTrap(){this._platform.isBrowser&&(this._focusTrap=this._focusTrapFactory.create(this._elementRef.nativeElement),this._document&&(this._elementFocusedBeforeDialogWasOpened=Bc()))}static \u0275fac=function(r){return new(r||t)};static \u0275cmp=ae({type:t,selectors:[["cdk-dialog-container"]],viewQuery:function(r,i){if(r&1&&um(PC,7),r&2){let o;Zl(o=Xl())&&(i._portalOutlet=o.first)}},hostAttrs:["tabindex","-1",1,"cdk-dialog-container"],hostVars:6,hostBindings:function(r,i){r&2&&ut("id",i._config.id||null)("role",i._config.role)("aria-modal",i._config.ariaModal)("aria-labelledby",i._config.ariaLabel?null:i._ariaLabelledByQueue[0])("aria-label",i._config.ariaLabel)("aria-describedby",i._config.ariaDescribedBy||null)},features:[kn],decls:1,vars:0,consts:[["cdkPortalOutlet",""]],template:function(r,i){r&1&&Rn(0,V8,0,0,"ng-template",0)},dependencies:[PC],styles:[`.cdk-dialog-container{display:block;width:100%;height:100%;min-height:inherit;max-height:inherit} 54`],encapsulation:2})}return t})(),So=class{overlayRef;config;componentInstance;componentRef;containerInstance;disableClose;closed=new ve;backdropClick;keydownEvents;outsidePointerEvents;id;_detachSubscription;constructor(n,e){this.overlayRef=n,this.config=e,this.disableClose=e.disableClose,this.backdropClick=n.backdropClick(),this.keydownEvents=n.keydownEvents(),this.outsidePointerEvents=n.outsidePointerEvents(),this.id=e.id,this.keydownEvents.subscribe(r=>{r.keyCode===27&&!this.disableClose&&!_v(r)&&(r.preventDefault(),this.close(void 0,{focusOrigin:"keyboard"}))}),this.backdropClick.subscribe(()=>{!this.disableClose&&this._canClose()?this.close(void 0,{focusOrigin:"mouse"}):this.containerInstance._recaptureFocus?.()}),this._detachSubscription=n.detachments().subscribe(()=>{e.closeOnOverlayDetachments!==!1&&this.close()})}close(n,e){if(this._canClose(n)){let r=this.closed;this.containerInstance._closeInteractionType=e?.focusOrigin||"program",this._detachSubscription.unsubscribe(),this.overlayRef.dispose(),r.next(n),r.complete(),this.componentInstance=this.containerInstance=null}}updatePosition(){return this.overlayRef.updatePosition(),this}updateSize(n="",e=""){return this.overlayRef.updateSize({width:n,height:e}),this}addPanelClass(n){return this.overlayRef.addPanelClass(n),this}removePanelClass(n){return this.overlayRef.removePanelClass(n),this}_canClose(n){let e=this.config;return!!this.containerInstance&&(!e.closePredicate||e.closePredicate(n,e,this.componentInstance))}},H8=new P("DialogScrollStrategy",{providedIn:"root",factory:()=>{let t=y(Re);return()=>Iv(t)}}
54),rS=new P("DialogData"),$8=new P("DefaultDialogConfig");function z8(t){let n=Ee(t),e=new tt;return{valueSignal:n,get value(){return n()},change:e,ngOnDestroy(){e.complete()}}}var gs=(()=>{class t{_injector=y(Re);_defaultOptions=y($8,{optional:!0});_parentDialog=y(t,{optional:!0,skipSelf:!0});_overlayContainer=y(Tv);_idGenerator=y(Ji);_openDialogsAtThisLevel=[];_afterAllClosedAtThisLevel=new ve;_afterOpenedAtThisLevel=new ve;_ariaHiddenElements=new Map;_scrollStrategy=y(H8);get openDialogs(){return this._parentDialog?this._parentDialog.openDialogs:this._openDialogsAtThisLevel}get afterOpened(){return this._parentDialog?this._parentDialog.afterOpened:this._afterOpenedAtThisLevel}afterAllClosed=Di(()=>this.openDialogs.length?this._getAfterAllClosed():this._getAfterAllClosed().pipe(Po(void 0)));constructor(){}open(e,r){let i=this._defaultOptions||new zc;r=A(A({},i),r),r.id=r.id||this._idGenerator.getId("cdk-dialog-"),r.id&&this.getDialogById(r.id);let o=this._getOverlayConfig(r),s=Th(this._injector,o),a=new So(s,r),l=this._attachContainer(s,a,r);if(a.containerInstance=l,!this.openDialogs.length){let c=this._overlayContainer.getContainerElement();l._focusTrapped?l._focusTrapped.pipe(It(1)).subscribe(()=>{this._hideNonDialogContentFromAssistiveTechnology(c)}):this._hideNonDialogContentFromAssistiveTechnology(c)}return this._attachDialogContent(e,a,l,r),this.openDialogs.push(a),a.closed.subscribe(()=>this._removeOpenDialog(a,!0)),this.afterOpened.next(a),a}closeAll(){nS(this.openDialogs,e=>e.close())}getDialogById(e){return this.openDialogs.find(r=>r.id===e)}ngOnDestroy(){nS(this._openDialogsAtThisLevel,e=>{e.config.closeOnDestroy===!1&&this._removeOpenDialog(e,!1)}),nS(this._openDialogsAtThisLevel,e=>e.close()),this._afterAllClosedAtThisLevel.complete(),this._afterOpenedAtThisLevel.complete(),this._openDialogsAtThisLevel=[]}_getOverlayConfig(e){let r=new Ka({positionStrategy:e.positionStrategy||kv().centerHorizontally().centerVertically(),scrollStrategy:e.scrollStrategy||this._scrollStrategy(),panelClass:e.panelClass,hasBackdrop:e.hasBackdrop,direction:e.direction,minWidth:e.minWidth,minHeight:e.minHeight,maxWidth:e.maxWidth,maxHeight:e.maxHeight,width:e.width,height:e.height,disposeOnNavigation:e.closeOnNavigation,disableAnimations:e.disableAnimations});return e.backdropClass&&(r.backdropClass=e.backdropClass),r}_attachContainer(e,r,i){let o=i.injector||i.viewContainerRef?.injector,s=[{provide:zc,useValue:i},{provide:So,useValue:r},{provide:$c,useValue:e}],a;i.container?typeof i.container=="function"?a=i.container:(a=i.container.type,s.push(...i.container.providers(i))):a=U8;let l=new ps(a,i.viewContainerRef,Re.create({parent:o||this._injector,providers:s}));return e.attach(l).instance}_attachDialogContent(e,r,i,o){if(e instanceof Xn){let s=this._createInjector(o,r,i,void 0),a={$implicit:o.data,dialogRef:r};o.templateContext&&(a=A(A({},a),typeof o.templateContext=="function"?o.templateContext():o.templateContext)),i.attachTemplatePortal(new za(e,null,a,s))}else{let s=this._createInjector(o,r,i,this._injector),a=i.attachComponentPortal(new ps(e,o.viewContainerRef,s));r.componentRef=a,r.componentInstance=a.instance}}_createInjector(e,r,i,o){let s=e.injector||e.viewContainerRef?.injector,a=[{provide:rS,useValue:e.data},{provide:So,useValue:r}];return e.providers&&(typeof e.providers=="function"?a.push(...e.providers(r,e,i)):a.push(...e.providers)),e.direction&&(!s||!s.get(Ei,null,{optional:!0}))&&a.push({provide:Ei,useValue:z8(e.direction)}),Re.create({parent:s||o,providers:a})}_removeOpenDialog(e,r){let i=this.openDialogs.indexOf(e);i>-1&&(this.openDialogs.splice(i,1),this.openDialogs.length||(this._ariaHiddenElements.forEach((o,s)=>{o?s.setAttribute("aria-hidden",o):s.removeAttribute("aria-hidden")}),this._ariaHiddenElements.clear(),r&&this._getAfterAllClosed().next()))}_hideNonDialogContentFromAssistiveTechnology(e){if(e.parentElement){let r=e.parentElement.children;for(let i=r.length-1;i>-1;i--){let o=r[i];o!==e&&o.nodeName!=="SCRIPT"&&o.nodeName!=="STYLE"&&!o.hasAttribute("aria-live")&&!o.hasAttribute("popover")&&(this._ariaHiddenElements.set(o,o.getAttribute("aria-hidden")),o.setAttribute("aria-hidden","true"))}}}_getAfterAllClosed(){let e=this._parentDialog;return e?e._getAfterAllClosed():this._afterAllClosedAtThisLevel}static \u0275fac=function(r){return new(r||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function nS(t,n){let e=t.length;for(;e--;)n(t[e])}function q8(t,n,e,r){var i=fS(tl(1&r?t.prototype:t),n,e);return 2&r&&typeof i=="function"?function(o){return i.apply(e,o)}:i}function fS(){return fS=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(t,n,e){var r=W8(t,n);if(r){var i=Object.getOwnPropertyDescriptor(r,n);return i.get?i.get.call(arguments.length<3?t:e):i.value}},fS.apply(null,arguments)}function W8(t,n){for(;!{}.hasOwnProperty.call(t,n)&&(t=tl(t))!==null;);return t}function of(t,n){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=NS(t))||n&&t&&typeof t.length=="number"){e&&(t=e);var r=0,i=function(){};return{s:i,n:(function(l){function c(){return l.apply(this,arguments)}return c.toString=function(){return l.toString()},c})(function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}),e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 55In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,s=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var c=e.next();return s=c.done,c},e:function(c){a=!0,o=c}
55,f:function(){try{s||e.return==null||e.return()}finally{if(a)throw o}}}}function pS(t){var n=typeof Map=="function"?new Map:void 0;return pS=function(r){if(r===null||!K8(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(n!==void 0){if(n.has(r))return n.get(r);n.set(r,i)}function i(){return G8(r,arguments,tl(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),sf(i,r)},pS(t)}function G8(t,n,e){if(PS())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,n);var i=new(t.bind.apply(t,r));return e&&sf(i,e.prototype),i}function K8(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function el(t,n){return Z8(t)||Y8(t,n)||NS(t,n)||J8()}function J8(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 56In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y8(t,n){var e=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var r,i,o,s,a=[],l=!0,c=!1;try{if(o=(e=e.call(t)).next,n===0){if(Object(e)!==e)return;l=!1}else for(;!(l=(r=o.call(e)).done)&&(a.push(r.value),a.length!==n);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&e.return!=null&&(s=e.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}function Z8(t){if(Array.isArray(t))return t}function Za(t){return e$(t)||Q8(t)||NS(t)||X8()}function X8(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 57In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NS(t,n){if(t){if(typeof t=="string")return mS(t,n);var e={}.toString.call(t).slice(8,-1);return e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set"?Array.from(t):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?mS(t,n):void 0}}function Q8(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function e$(t){if(Array.isArray(t))return mS(t)}function mS(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function K(t,n,e){return n=tl(n),t$(t,PS()?Reflect.construct(n,e||[],tl(t).constructor):n.apply(t,e))}function t$(t,n){if(n&&(B(n)=="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xc(t)}function Xc(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PS(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PS=function(){return!!t})()}function tl(t){return tl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},tl(t)}function J(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&sf(t,n)}function sf(t,n){return sf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},sf(t,n)}function v(){var t,n,e=typeof Symbol=="function"?Symbol:{},r=e.iterator||"@@iterator",i=e.toStringTag||"@@toStringTag";function o(h,p,m,g){var w=p&&p.prototype instanceof a?p:a,C=Object.create(w.prototype);return kr(C,"_invoke",(function(T,I,F){var $,q,G,lt=0,De=F||[],qe=!1,se={p:0,n:0,v:t,a:mn,f:mn.bind(t,4),d:function(jn,Vt){return $=jn,q=0,G=t,se.n=Vt,s}};function mn(ct,jn){for(q=ct,G=jn,n=0;!qe&<&&!Vt&&n<De.length;n++){var Vt,vr=De[n],Gy=se.p,gf=vr[2];ct>3?(Vt=gf===jn)&&(G=vr[(q=vr[4])?5:(q=3,3)],vr[4]=vr[5]=t):vr[0]<=Gy&&((Vt=ct<2&&Gy<vr[1])?(q=0,se.v=jn,se.n=vr[1]):Gy<gf&&(Vt=ct<3||vr[0]>jn||jn>gf)&&(vr[4]=ct,vr[5]=jn,se.n=gf,q=0))}if(Vt||ct>1)return s;throw qe=!0,jn}return function(ct,jn,Vt){if(lt>1)throw TypeError("Generator is already running");for(qe&&jn===1&&mn(jn,Vt),q=jn,G=Vt;(n=q<2?t:G)||!qe;){$||(q?q<3?(q>1&&(se.n=-1),mn(q,G)):se.n=G:se.v=G);try{if(lt=2,$){if(q||(ct="next"),n=$[ct]){if(!(n=n.call($,G)))throw TypeError("iterator result is not an object");
vendor: 1,969 bytes, line 57
57if(!n.done)return n;G=n.value,q<2&&(q=0)}else q===1&&(n=$.return)&&n.call($),q<2&&(G=TypeError("The iterator does not provide a '"+ct+"' method"),q=1);$=t}else if((n=(qe=se.n<0)?G:T.call(I,se))!==s)break}catch(vr){$=t,q=1,G=vr}finally{lt=1}}return{value:n,done:qe}}})(h,m,g),!0),C}var s={};function a(){}function l(){}function c(){}n=Object.getPrototypeOf;var u=[][r]?n(n([][r]())):(kr(n={},r,function(){return this}),n),d=c.prototype=a.prototype=Object.create(u);function f(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,c):(h.__proto__=c,kr(h,i,"GeneratorFunction")),h.prototype=Object.create(d),h}return l.prototype=c,kr(d,"constructor",c),kr(c,"constructor",l),l.displayName="GeneratorFunction",kr(c,i,"GeneratorFunction"),kr(d),kr(d,i,"Generator"),kr(d,r,function(){return this}),kr(d,"toString",function(){return"[object Generator]"}),(v=function(){return{w:o,m:f}})()}function kr(t,n,e,r){var i=Object.defineProperty;try{i({},"",{})}catch{i=0}kr=function(s,a,l,c){function u(d,f){kr(s,d,function(h){return this._invoke(d,f,h)})}a?i?i(s,a,{value:l,enumerable:!c,configurable:!c,writable:!c}):s[a]=l:(u("next",0),u("throw",1),u("return",2))},kr(t,n,e,r)}function JO(t,n,e,r,i,o,s){try{var a=t[o](s),l=a.value}catch(c){return void e(c)}a.done?n(l):Promise.resolve(l).then(r,i)}function D(t){return function(){var n=this,e=arguments;return new Promise(function(r,i){var o=t.apply(n,e);function s(l){JO(o,r,i,s,a,"next",l)}function a(l){JO(o,r,i,s,a,"throw",l)}s(void 0)})}}function YO(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),e.push.apply(e,r)}return e}function Je(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?YO(Object(e),!0).forEach(function(r){_(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):YO(Object(e)).forEac
57h(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function _(t,n,e){return(n=tP(n))in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function B(t){"@babel/helpers - typeof";return B=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},B(t)}function k(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function ZO(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,tP(r.key),r)}}function M(t,n,e){return n&&ZO(t.prototype,n),e&&ZO(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function tP(t){var n=n$(t,"string");return B(n)=="symbol"?n:n+""}function n$(t,n){if(B(t)!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var r=e.call(t,n||"default");if(B(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(t)}var S="classList",N="style",r$="unset",i$="html-wrapper",U=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"div";return document.createElement(n)},o$=(function(){function t(){k(this,t)}return M(t,null,[{key:"render",value:function(e,r){var i=U();i.id="error-view",i.innerText=r,e.replaceChildren(i)}}])})(),s$=(function(){function t(){k(this,t)}return M(t,null,[{key:"onLoad",value:function(e){e.innerHTML='<div id="loading-validate-key-property"></div>'}},{key:"createElements",value:function(){var e=U();return e.id="validate-property-key-view",e}},{key:"render",value:function(e,r,i){var o=t.createElements(),s={onSuccess:r,onFail:o$.render.bind(this,e,"Your 'key' has failed authentication"),onLoad:t.onLoad.bind(this,o)};i.key&&i.verifyKey(i.key,s),e.replaceChildren(o)}}])})(),jt="service",b="text",ke="html",E="error",at="https://deepchat.dev/docs/",xt="ai",et="user",Qi="assistant",Yv="error-message-text",xv="deep-chat-outer-container-role-",XO="empty-message",iS="deep-chat-top-message",QO="deep-chat-middle-message",oS="deep-chat-bottom-message",Y="src",ce="type",Bt="file",x="files",it="image",wt="images",or="camera",Jc="gifs",$e="audio",Yi="microphone",nP="mixedFiles",nl="any",rP="file-message",_s="start",iP="end",oP="messages",eN="0",tN="1";function nN(t){return t.charAt(0).toUpperCase()+t.slice(1)}function a$(t){return t&&JSON.stringify(t)}function FS(t,n,e,r){var i=` 58`.concat(nN(n)," message: ").concat(JSON.stringify(t),` 59`),o=e?"".concat(nN(n)," message after interceptor: ").concat(a$(r),` 60`):"";return i+o}function l$(t,n,e,r){return"".concat(FS(t,n,e,r),"Make sure the ").concat(n," message is using the Response format: ").concat(at,`connect/#Response 61You can also augment it using the responseInterceptor property: `).concat(at,"interceptors#responseInterceptor")}function c$(t,n,e){var r="response";return"".concat(FS(t,r,n,e),"Make sure the ").concat(r,' message is using the {text: string} format, e.g: {text: "Model Response"}')}function u$(t,n){var e="request";return"".concat(FS(t,e,n),"Make sure the ").concat(e,' message is using the {body: {text: string}} format, e.g: {body: {text: "Model Response"}}')}function d$(t){return"".concat(t," failed - please wait for chat view to render before calling this property.")}var Yc=l$,h$=u$,f$=c$,rN=d$,en="Invalid API Key",Mr="Failed to connect",sr="Request settings have not been set up",ty="No file was added",LS="Image was not found",sP="Multi-response arrays are not supported for streaming",aP=`Make sure the events are using {text: string} or {html: string} format. 62You can also augment them using the responseInterceptor property: `.concat(at,"interceptors#responseInterceptor"),p$="Cannot mix {text: string} and {html: string} responses.",m$=`No valid stream events were sent. 63`.concat(aP),g$="Readable Stream connection error.",Es="Please define a `function_handler` property inside the service config.",rl="Function tool response must be an array or contain a text property",lP="Failed to fetch history",Qc="inside-start",Zi="inside-end",Gn="outside-start",En="outside-end",Yr
63="dropup-menu",H="default",rr="hover",ht="click",hn=(function(){function t(){k(this,t)}return M(t,null,[{key:"unsetStyle",value:function(e,r){var i=Object.keys(r).reduce(function(o,s){return o[s]="",o},{});Object.assign(e[N],i)}},{key:"unsetActivityCSSMouseStates",value:function(e,r){r[ht]&&t.unsetStyle(e,r[ht]),r[rr]&&t.unsetStyle(e,r[rr])}},{key:"unsetAllCSSMouseStates",value:function(e,r){t.unsetActivityCSSMouseStates(e,r),r[H]&&t.unsetStyle(e,r[H])}},{key:"processStateful",value:function(e){var r=e[H]||{},i=Object.assign(JSON.parse(JSON.stringify(r)),e?.[rr]),o=Object.assign(JSON.parse(JSON.stringify(i)),e?.[ht]);return _(_(_({},H,r),rr,i),ht,o)}},{key:"mergeStatefulStyles",value:function(e){var r=_(_(_({},H,{}),rr,{}),ht,{});return e.forEach(function(i){r[H]=Object.assign(r[H],i[H]),r[rr]=Object.assign(r[rr],i[rr]),r[ht]=Object.assign(r[ht],i[ht])}),r}},{key:"overwriteDefaultWithAlreadyApplied",value:function(e,r){Object.keys(e[H]||[]).forEach(function(i){var o,s=i;r[N][s]&&(o=e[H])!=null&&o[s]&&(e[H][i]=r[N][s])})}},{key:"applyToStyleIfNotDefined",value:function(e,r){for(var i in r){var o=r[i];e[i]===""&&o&&(e[i]=o)}}}])})(),gS=(function(){function t(){k(this,t)}return M(t,null,[{key:"attemptAppendStyleSheetToHead",value:function(e){if(!(e.fontFamily&&e.fontFamily!==t.DEFAULT_FONT_FAMILY)){var r=document.getElementsByTagName("head")[0];if(!Array.from(r.getElementsByTagName("link")).some(function(o){return o.getAttribute("href")===t.FONT_URL})){var i=U("link");i.rel="stylesheet",i.href=t.FONT_URL,r.appendChild(i)}}}}])})();gS.FONT_URL="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap",gS.DEFAULT_FONT_FAMILY="'Inter', sans-serif, Avenir, Helvetica, Arial";var cP=gS,uP=(function(){function t(){k(this,t)}return M(t,null,[{key:"apply",value:function(e,r){if(r)try{t.applyStyleSheet(e,r)}catch{t.addStyleElement(e,r)}}},{key:"applyStyleSheet",value:function(e,r){var i=new CSSStyleSheet;i.replaceSync(e),r.adoptedStyleSheets.push(i)}},{key:"addStyleElement",value:function(e,r){var i=U("style");i.innerHTML=e,r.appendChild(i)}},{key:"applyDefaultStyleToComponent",value:function(e,r){r&&hn.applyToStyleIfNotDefined(e,r),hn.applyToStyleIfNotDefined(e,t.DEFAULT_COMPONENT_STYLE)}}])})();uP.DEFAULT_COMPONENT_STYLE={height:"350px",width:"320px",borderTop:"1px solid #cacaca",borderRight:"1px solid #cacaca",borderLeft:"1px solid #cacaca",borderBottom:"1px solid #cacaca",fontFamily:cP.DEFAULT_FONT_FAMILY,fontSize:"0.9rem",backgroundColor:"white",position:"relative",overflow:"hidden"};var sS=uP,dP=(function(){function t(){k(this,t)}return M(t,null,[{key:"buildElement",value:function(){var e=U();e[S].add("tooltip");var r=U("span");return r[S].add("tooltip-text"),e.appendChild(r),e}},{key:"tryCreateConfig",value:function(e,r){if(r)return typeof r=="boolean"?_({},b,e):_(_(_({},b,r[b]||e),"timeout",r.timeout||0),"style",r[N])}},{key:"traverseParentUntilContainer",value:function(e){for(var r=e;r.parentElement;)r=r.parentElement;return r}},{key:"setPosition",value:function(e,r){var i=r.getRootNode().host.getBoundingClientRect(),o=e.getBoundingClientRect(),s=r.getBoundingClientRect().width/2,a=o.left+o.width/2;r[N].left="".concat(a-s-i.left,"px"),r[N].top="".concat(o.top-36-i.top,"px");var l=r.getBoundingClientRect();l.left<i.left?r[N].left="".concat(t.OVERFLOW_NEW_POSITION_PX,"px"):l.right>i.right&&(r[N].left="".concat(i.width-l.width-t.OVERFLOW_NEW_POSITION_PX,"px"))}},{key:"display",value:function(e,r,i){return i||(i=t.traverseParentUntilContainer(e).nextSibling),r[b]&&(i.children[0].textContent=r[b]),{timeout:setTimeout(function(){i[N].visibility="visible",t.setPosition(e,i),r[N]&&Object.assign(i[N],r[N])},r.timeout||0),element:i}}},{key:"hide",value:function(e,r){clearTimeout(e.timeout),e.element[N].visibility="hidden",r[N]&&hn.unsetStyle(e.element,r[N]),e.element[N].left="",e.element[N].top=""}}])})();dP.OVERFLOW_NEW_POSITION_PX=4;var Mo=dP,Bv=M(function t(){k(this,t)});Bv.IS_SAFARI=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),Bv.IS_CHROMIUM=window.chrome,Bv.IS_MOBILE=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);var Xr=Bv,dn=(function(t){return t.ESCAPE="Escape",t.ENTER="Enter",t.TAB="Tab",t.ARROW_UP="ArrowUp",t.ARROW_DOWN="ArrowDown",t.ARROW_RIGHT="ArrowRight",t.ARROW_LEFT="ArrowLeft",t.BACKSPACE="Backspace",t.DELET
63E="Delete",t.META="Meta",t.CONTROL="Control",t})(dn||{}),hP=(function(){function t(){k(this,t)}return M(t,null,[{key:"add",value:function(e,r,i,o){i!==void 0&&e.addEventListener("keydown",t.onKeyDown.bind(this,i)),e.oninput=t.onInput.bind(this,i,o),e.addEventListener("paste",function(s){var a;s.preventDefault(),(a=s.clipboardData)!=null&&a[x].length&&r.addFilesToAnyType(Array.from(s.clipboardData[x]))})}},{key:"onKeyDown",value:function(e,r){var i=r.target.textContent;i&&i.length>=e&&!t.PERMITTED_KEYS.has(r.key)&&!t.isKeyCombinationPermitted(r)&&r.preventDefault()}},{key:"isKeyCombinationPermitted",value:function(e){return e.key==="a"?e.ctrlKey||e.metaKey:!1}},{key:"onInput",value:function(e,r,i){var o=i.target,s=o.textContent||"";e!==void 0&&s.length>e&&(o.textContent=s.substring(0,e),af.focusEndOfInput(o)),r?.()}}])})();hP.PERMITTED_KEYS=new Set([dn.BACKSPACE,dn.DELETE,dn.ARROW_RIGHT,dn.ARROW_LEFT,dn.ARROW_DOWN,dn.ARROW_UP,dn.META,dn.CONTROL,dn.ENTER]);var v$=hP,y$=(function(){function t(){k(this,t)}return M(t,null,[{key:"sanitizePastedTextContent",value:function(e){var r,i;e.preventDefault();var o=(r=e.clipboardData)==null?void 0:r.getData("text/plain");o&&((i=document.execCommand)==null||i.call(document,"insertText",!1,o))}}])})(),fP=(function(){function t(n,e,r,i){var o=this;k(this,t);var s,a,l,c;this._isComposing=!1;var u=t.processConfig(e,n.textInput);this.elementRef=t.createContainerElement((s=u?.styles)==null?void 0:s.container),this._config=u,this.inputElementRef=this.createInputElement((a=n.defaultInput)==null?void 0:a[b],i),t.addFilesToAnyType(r,(l=n.defaultInput)==null?void 0:l[x]),this.elementRef.appendChild(this.inputElementRef),n.setPlaceholderText=this.setPlaceholderText.bind(this),n.setPlaceholderText(((c=this._config.placeholder)==null?void 0:c[b])||"Ask me anything!"),this._browserStorage=i,setTimeout(function(){v$.add(o.inputElementRef,r,o._config.characterLimit,n._validationHandler),o._onInput=e.onInput})}return M(t,[{key:"clear",value:function(){var e,r,i,o=window.scrollY;this.inputElementRef[S].contains("text-input-disabled")||(Object.assign(this.inputElementRef[N],(e=this._config.placeholder)==null?void 0:e[N]),this.inputElementRef.textContent="",af.focusEndOfInput(this.inputElementRef),(r=this._onInput)==null||r.call(this,!1),(i=this._browserStorage)==null||i.addInputText("")),Xr.IS_CHROMIUM&&window.scrollTo({top:o})}},{key:"createInputElement",value:function(e,r){var i,o,s,a,l=U();return l.id=t.TEXT_INPUT_ID,l[S].add("text-input-styling"),l.role="textbox",typeof e=="string"?l.innerText=e:r!=null&&r.trackInputText&&(l.innerText=r.get().inputText||""),Xr.IS_MOBILE&&l.setAttribute("tabindex","0"),Xr.IS_CHROMIUM&&t.preventAutomaticScrollUpOnNewLine(l),typeof this._config.disabled=="boolean"&&this._config.disabled===!0?(l.contentEditable="false",l[S].add("text-input-disabled"),l.setAttribute("aria-disabled","true")):(l.contentEditable="true",l.removeAttribute("aria-disabled"),this.addEventListeners(l)),Object.assign(l[N],(i=this._config.styles)==null?void 0:i[b]),Object.assign(l[N],(o=this._config.placeholder)==null?void 0:o[N]),(a=(s=this._config.placeholder)==null?void 0:s[N])!=null&&a.color||l.setAttribute("textcolor",""),l}},{key:"removePlaceholderStyle",value:function(){var e,r,i,o;!this.inputElementRef[S].contains("text-input-disabled")&&(e=this._config.placeholder)!=null&&e[N]&&(hn.unsetStyle(this.inputElementRef,(r=this._config.placeholder)==null?void 0:r[N]),Object.assign(this.inputElementRef[N],(o=(i=this._config)==null?void 0:i.styles)==null?void 0:o[b]))}},{key:"addEventListeners",value:function(e){var r=this,i,o;(i=this._config.styles)!=null&&i.focus&&(e.onfocus=function(){var s;return Object.assign(r.elementRef[N],(s=r._config.styles)==null?void 0:s.focus)},e.onblur=this.onBlur.bind(this,this._config.styles.focus,(o=this._config.styles)==null?void 0:o.container)),e.addEventListener("keydown",this.onKeydown.bind(this)),e.addEventListener("input",this.onInput.bind(this)),e.addEventListener("paste",y$.sanitizePastedTextContent),e.addEventListener("compositionstart",function(){return r._isComposing=!0}),e.addEventListener("compositionend",function(){return r._isComposing=!1})}},{key:"onBlur",value:function(e,r){hn.unsetStyle(this.elementRef,e),r&&Object.assign(this.elementRef[N],r)}},{key:"onKeydown",value:function(e){var r;e.key===dn.ENTER&&!Xr.IS_MOBILE&&!this._isComposing&&!e.ctrlKey&&!e.shiftKey&&(e.preventDefault(),(r=this.submit)==null||r.call(this))}},{key:"onInput",value:function(){var e,r;this.isTextInputEmpty()?Object.assign(this.inputElementRef[N],(e=this._config.placeholder)==null?void 0:e[N]):this.removePlaceholderStyle(),(r=this._onInput)==null||r.call(this,!0)}},{key:"setPlaceholderText",value:function(e){this.inputElementRef.setAttribute("deep-chat-placeholder-text",e),this.inputElementRef.setAttribute("aria-label",e)}},{key:"isTextInputEmpty",value:function(){return this.inputElementRef.textContent===""}}],[{key:"processConfig",value:function(e,r){var i,o,s,a;return r??(r={}),(i=r.disabled)!==null&&i!==void 0||(r.disabled=e.isTextInputDisabled),(o=r.placeholder)!==null&&o!==void 0||(r.placeholder={}),(s=(a=r.placeholder)[b])!==null&&s!==void 0||(a[b]=e.textInputPlaceholderText),r}},{key:"createContainerElement",value:function(e){var r=U();return r.id="text-input-container",Object.assign(r[N],e),r}},{key:"preventAutomaticScrollUpOnNewLine",value:function(e){var r;e.addEventListener("keydown",function(){r=window.scrollY}),e.addEventListener("input",function(){r!==window.scrollY&&window.scrollTo({top:r})})}},{key:"addFilesToAnyType",value:function(e,r){r&&e.addFilesToAnyType(Array.from(r).map(function(i){return i}))}}])})();fP.TEXT_INPUT_ID="text-input";var pP=fP,af=(function(){function t(){k(this,t)}return M(t,null,[{key:"focusEndOfInput",value:function(e){var r=document.createRange();r.selectNodeContents(e),r.collapse(!1);var i=window.getSelection();i?.removeAllRanges(),i?.addRange(r),(Xr.IS_MOBILE||Xr.IS_SAFARI)&&e.focus()}},{key:"focusFromParentElement",value:function(e){var r=e.querySelector("#".concat(pP.TEXT_INPUT_ID));r&&t.focusEndOfInput(r)}}])})(),mP="Authentication",Xt="Authorization",_$="authorization",jS="Unauthorized",BS="Authorization header",Cs="Invalid",df="Incorrect",Ln="authentication_error",Qr="invalid_request_error",Ze="Content-Type",b$="content-type",Ct="application/json",ze="object",VS="completed",Fn="Bearer ",Qt="GET",fn="POST",US="Upload an audio file",Vv="function_call",Xa="input_audio",fr="image_url",gP=(function(){function t(){k(this,t)}return M(t,null,[{key:"addElements",value:function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];
63i.forEach(function(s){return e.appendChild(s)})}},{key:"isScrollbarAtBottomOfElement",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t.CODE_SNIPPET_GENERATION_JUMP,i=e.scrollHeight,o=e.clientHeight,s=e.scrollTop,a=i-o;return s>=a-r}},{key:"cloneElement",value:function(e){var r=e.cloneNode(!0);return e.parentNode.replaceChild(r,e),r}},{key:"scrollToBottom",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2?arguments[2]:void 0;e.scrollButton&&e.scrollButton.hiddenElements.size>0&&e.scrollButton.clearHidden(),i?e.elementRef.scrollTo({left:0,top:i.offsetTop}):r?e.elementRef.scrollTo({left:0,top:e.elementRef.scrollHeight,behavior:"smooth"}):e.elementRef.scrollTop=e.elementRef.scrollHeight}},{key:"scrollToTop",value:function(e){e.scrollTop=0}},{key:"isVisibleInParent",value:function(e,r){var i=e.getBoundingClientRect(),o=r.getBoundingClientRect();return i.bottom>o.top&&i.top<o.bottom}},{key:"waitForScrollEnd",value:function(e,r){var i=-1,o=0,s=function(){var l=e.scrollTop;if(l===i){if(o++,o>2){r();return}}else o=0,i=l;requestAnimationFrame(s)};requestAnimationFrame(s)}},{key:"assignButtonEvents",value:function(e,r){e.onclick=r,e.onkeydown=function(i){i.key===dn.ENTER&&setTimeout(r)}}}])})();gP.CODE_SNIPPET_GENERATION_JUMP=1;var rt=gP,vP=(function(){function t(){k(this,t)}return M(t,null,[{key:"speak",value:function(e,r){if(!r.audio&&window.SpeechSynthesisUtterance){var i=new SpeechSynthesisUtterance(e);Object.assign(i,r),speechSynthesis.speak(i)}}},{key:"processConfig",value:function(e,r){var i={};setTimeout(function(){if(B(e)=="object"&&(e.audio&&(i.audio=e.audio),e.lang&&(i.lang=e.lang),e.pitch&&(i.pitch=e.pitch),e.rate&&(i.rate=e.rate),e.volume&&(i.volume=e.volume),e.voiceName)){var o=window.speechSynthesis.getVoices().find(function(s){var a;return s.name.toLocaleLowerCase()===((a=e.voiceName)==null?void 0:a.toLocaleLowerCase())});o&&(i.voice=o)}r(i)},t.LOAD_VOICES_MS)}}])})();vP.LOAD_VOICES_MS=200;var Uv=vP,vS=(function(){function t(){k(this,t)}return M(t,null,[{key:"colorToHex",value:function(e){var r=U();return r[N].color=e,document.body.appendChild(r),"#".concat(window.getComputedStyle(r).color.match(/\d+/g).map(function(i){return parseInt(i).toString(16).padStart(2,"0")}).join(""))}},{key:"setDots",value:function(e,r){var i,o;if((o=(i=r?.styles)==null?void 0:i.bubble)!=null&&o.color){var s=t.colorToHex(r.styles.bubble.color);e[N].setProperty("--loading-message-color",s),e[N].setProperty("--loading-message-color-fade","".concat(s,"33"))}else e[N].setProperty("--loading-message-color","#848484"),e[N].setProperty("--loading-message-color-fade","#55555533")}},{key:"setRing",value:function(e,r){var i=r||{},o=i.color,s=i.width,a=i.height,l=i.margin,c=i.border;if(o){var u=t.colorToHex(o);e[N].setProperty("--loading-history-color",u)}else e[N].setProperty("--loading-history-color","#dbdbdb");e[N].setProperty("--loading-history-height",a||"57px"),e[N].setProperty("--loading-history-width",s||"57px"),e[N].setProperty("--loading-history-margin",l||"7px"),e[N].setProperty("--loading-history-border",c||"6px solid")}}])})();vS.BUBBLE_CLASS="deep-chat-loading-message-bubble",vS.DOTS_CONTAINER_CLASS="deep-chat-loading-message-dots-container";var vs=vS,Wt=(function(){function t(){k(this,t)}return M(t,null,[{key:"checkForContainerStyles",value:function(e,r){var i=e.containerStyle;i&&(Object.assign(r[N],i),console[E]("The containerStyle property".concat(Jr,"1.3.14.")),console[E]("".concat(Ja,"the style property instead: ").concat(at,"styles#style")))}},{key:"handleResponseProperty",value:function(e){return console[E]("The {result: ....} response object type".concat(Jr,"1.3.0.")),console[E]("".concat(Ja,"the new response object: ").concat(at,"connect#Response")),e.result}},{key:"processHistory",value:function(e){var r=e.initialMessages;if(r)return console[E]("The initialMessages property".concat(Jr,"2.0.0.")),console[E]("".concat(Ja,"the history property instead: ").concat(at,"messages/#history")),r}},{key:"processHistoryFile",value:function(e){var r=e[Bt];r&&(console[E]("The file property in MessageContent".concat(Jr,"1.3.17.")),console[E]("".concat(Ja,"the files array property: ").concat(at,"messages/#MessageContent")),e[x]=[r])}},{key:"processValidateInput",value:function(e){var r=e.validateMessageBeforeSending;if(r)return console[E]("The validateMessageBeforeSending property".concat(Jr,"1.3.24.")),console[E]("".concat(Ja,"validateInput: ").concat(at,"interceptors#validateInput")),r}},{key:"processSubmitUserMessage",value:function(e){return console[E]("The submitUserMessage(text: string) argument string type".concat(Jr,"1.4.4.")),console[E]("".concat(Ja,"the new argument type: ").concat(at,"methods#submitUserMessage")),_({},b,e)}},{key:"flagHTMLUpdateClass",value:function(e){var r;(r=e.children[0])!=null&&r[S].contains("deep-chat-update-message")&&(console[E]('The "deep-chat-update-message" html class'.concat(Jr,"1.4.4.")),console[E]("".concat(Ja,"using {..., overwrite: true} object: ").concat(at,"connect#Response")))}},{key:"processConnect",value:function(e){var r=e;r.request&&(r.connect?Object.assign(r.connect,r.request):r.connect=r.request,console[E]("The request property".concat(Jr,"2.0.0.")),console[E]("".concat(Rv,"connect object: ").concat(at,"connect#connect-1")))}},{key:"checkForStream",value:function(e){var r=e.stream;if(r)return console[E]("The stream property".concat(oN,"the connect object in ver
63sion 2.0.0.")),console[E]("".concat(Rv,"connect object: ").concat(at,"connect#connect-1")),r}},{key:"fireOnNewMessage",value:function(e,r){var i,o=e;o.onNewMessage&&(console[E]("The onNewMessage event".concat(Jr,"2.0.0.")),console[E]("".concat(Rv,"onMessage event: ").concat(at,"events#onMessage")),(i=o.onNewMessage)==null||i.call(o,r)),e.dispatchEvent(new CustomEvent("new-message",{detail:r}))}},{key:"processFileConfigConnect",value:function(e){var r=e;r.request&&(console[E]("The request property in file configuration".concat(Jr,"2.0.0.")),console[E]("Please use the connect property instead: ".concat(at,"files")),r.connect||(r.connect=r.request))}},{key:"processMessageStyles",value:function(e){if(e){var r=JSON.parse(JSON.stringify(e)),i=r.loading;return i&&(i.outerContainer||i.innerContainer||i.bubble||i.media)&&(console[E]("The loading message styles are defined using LoadingMessageStyles interface".concat(Kc,"2.1.0.")),console[E]("Check it out here: ".concat(at,"messages/styles#LoadingMessageStyles")),r.loading={message:{styles:i}}),r}}},{key:"processDemo",value:function(e){return typeof e=="boolean"||e.displayLoadingBubble&&(console[E]("The demo displayLoadingBubble property".concat(Jr,"2.1.0.")),console[E]("Please use displayLoading instead: ".concat(at,"modes#demo")),e.displayLoading={message:!0}),e}},{key:"processCohere",value:function(e){var r=e,i="".concat(Rv,"official documentation: ").concat(at,"directConnection/Cohere");return r.chat&&(console[E]("Cohere chat property".concat(Jr,"2.2.3.")),console[E](i),delete r.chat),r.textGeneration?(console[E]("Cohere textGeneration".concat(iN,"2.2.3.")),console[E](i),delete r.textGeneration,!1):r.summarization?(console[E]("Cohere summarization".concat(iN,"2.2.3.")),console[E](i),delete r.summarization,!1):!0}},{key:"processStreamHTMLWrappers",value:function(e){if(!(!e||B(e)!==ze)){var r=e.htmlWrappers;if(r)return console[E]("The htmlWrappers property".concat(oN,"Deep Chat's base").concat(Kc,"2.3.0.")),console[E]("Check it out here: ".concat(at,"messages/HTML#htmlWrappers")),r}}},{key:"processFocusMode",value:function(e){return!e||typeof e=="boolean"||e.scroll&&(console[E]("The scroll property in focusMode has been changed to smoothScroll".concat(Kc,"2.3.0.")),console[E]("Check it out here: ".concat(at,"modes#focusMode")),e.smoothScroll=!0),e}},{key:"processPosition",value:function(e){if(!e)return e;var r="Position names have been updated".concat(Kc,"2.3.1.");return e==="inside-left"?(console[E](r),Qc):e==="inside-right"?(console[E](r),Zi):e==="outside-left"?(console[E](r),Gn):e==="outside-right"?(console[E](r),En):e}},{key:"processBrowserStorage",value:function(e){var r=e.get();r&&Array.isArray(r)&&e.addMessages(r)}}])})(),Kc=" since version ",Jr=" is deprecated ".concat(Kc),Ja="Please change to using ",Rv="Please see the ",iN=" is not supported ".concat(Kc),oN=" has been moved to ",ny=(function(){function t(){k(this,t)}return M(t,null,[{key:"mouseUp",value:function(e,r){hn.unsetAllCSSMouseStates(e,r),Object.assign(e[N],r[H]),Object.assign(e[N],r[rr])}},{key:"mouseDown",value:function(e,r){Object.assign(e[N],r[ht])}},{key:"mouseLeave",value:function(e,r){hn.unsetAllCSSMouseStates(e,r),Object.assign(e[N],r[H])}},{key:"mouseEnter",value:function(e,r){Object.assign(e[N],r[rr])}},{key:"add",value:function(e,r){e.addEventListener("mouseenter",t.mouseEnter.bind(this,e,r)),e.addEventListener("mouseleave",t.mouseLeave.bind(this,e,r)),e.addEventListener("mousedown",t.mouseDown.bind(this,e,r)),e.addEventListener("mouseup",t.mouseUp.bind(this,e,r))}}])})(),w$="deep-chat-temporary-message",E$="deep-chat-suggestion-button",yS={"deep-chat-button":{styles:_(_(_({},H,{backgroundColor:"white",padding:"5px",paddingLeft:"7px",paddingRight:"7px",border:"1px solid #c2c2c2",borderRadius:"6px",cursor:"pointer"}),rr,{backgroundColor:"#fafafa"}),ht,{backgroundColor:"#f1f1f1"})}},sN=Object.keys(yS),Zc=(function(){function t(){k(this,t)}return M(t,null,[{key:"applySuggestionEvent",value:function(e,r){setTimeout(function(){r.addEventListener(ht,function(){var i,o;(o=e.submitUserMessage)==null||o.call(e,_({},b,((i=r.textContent)==null?void 0:i.trim())||""))})})}},{key:"isElementTemporary",value:function(e){var r;
63return e?(r=e.bubbleElement.children[0])==null?void 0:r[S].contains(w$):!1}},{key:"doesElementContainDeepChatClass",value:function(e){return sN.find(function(r){return e[S].contains(r)})}},{key:"applyEvents",value:function(e,r){var i=yS[r].events;Object.keys(i||[]).forEach(function(o){e.addEventListener(o,i?.[o])})}},{key:"getProcessedStyles",value:function(e,r,i){var o=Array.from(r[S]).reduce(function(c,u){var d,f=(d=e[u])==null?void 0:d.styles;return f&&e[u].styles&&c.push(f),c},[]),s=yS[i].styles;if(s){var a=JSON.parse(JSON.stringify(s));a[H]&&hn.overwriteDefaultWithAlreadyApplied(a,r),o.unshift(a)}var l=hn.mergeStatefulStyles(o);return hn.processStateful(l)}},{key:"applyDeepChatUtilities",value:function(e,r,i){sN.forEach(function(s){var a=i.getElementsByClassName(s);Array.from(a||[]).forEach(function(l){var c=t.getProcessedStyles(r,l,s);Pn.applyStylesToElement(l,c),t.applyEvents(l,s)})});var o=i.getElementsByClassName(E$);Array.from(o).forEach(function(s){return t.applySuggestionEvent(e,s)})}}])})(),Pn=(function(){function t(){k(this,t)}return M(t,null,[{key:"applyStylesToElement",value:function(e,r){var i=hn.processStateful(r);ny.add(e,i),Object.assign(e[N],i[H])}},{key:"applyEventsToElement",value:function(e,r){Object.keys(r).forEach(function(i){var o=r[i];o&&e.addEventListener(i,o)})}},{key:"applyClassUtilitiesToElement",value:function(e,r){var i=r.events,o=r.styles;i&&t.applyEventsToElement(e,i),o&&!Zc.doesElementContainDeepChatClass(e)&&t.applyStylesToElement(e,o)}},{key:"applyCustomClassUtilities",value:function(e,r){Object.keys(e).forEach(function(i){var o=r.getElementsByClassName(i);Array.from(o).forEach(function(s){e[i]&&t.applyClassUtilitiesToElement(s,e[i])})})}},{key:"apply",value:function(e,r){Zc.applyDeepChatUtilities(e,e.htmlClassUtilities,r),t.applyCustomClassUtilities(e.htmlClassUtilities,r)}},{key:"traverseNodes",value:function(e,r){e.nodeType===Node.ELEMENT_NODE&&r.push(e.outerHTML),e.childNodes.forEach(function(i){t.traverseNodes(i,r)})}},{key:"splitHTML",value:function(e){var r=new DOMParser().parseFromString(e,"text/html"),i=[];return r.body.childNodes.forEach(function(o){t.traverseNodes(o,i)}),i}},{key:"isTemporaryBasedOnHTML",value:function(e){var r=U();return r.innerHTML=e,Zc.isElementTemporary({outerContainer:r,bubbleElement:r,innerContainer:r})}},{key:"replaceElementWithNewClone",value:function(e,r){var i,o=(r||e).cloneNode(!0);return(i=e.parentNode)==null||i.replaceChild(o,e),o}},{key:"tryAddWrapper",value:function(e,r,i,o){if(r&&o){var s=i?.[o]||i?.[H];if(s)return e.innerHTML=s,{contentEl:t.getTargetWrapper(e),wrapper:!0}}return{contentEl:e,wrapper:!1}}},{key:"getTargetWrapper",value:function(e){return e.getElementsByClassName(i$)[0]||e}}])})(),yP=(function(){function t(){k(this,t)}return M(t,null,[{key:"createElements",value:function(e,r,i,o){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,a=e.createMessageElementsOnOrientation("",i,o,s);a.bubbleElement[S].add(t.HTML_BUBBLE_CLASS);var l=Pn.tryAddWrapper(a.bubbleElement,r,e._customWrappers,i),c=l.contentEl;return c.innerHTML=r,a}},{key:"overwriteElements",value:function(e,r,i){i.bubbleElement.innerHTML=r,Pn.apply(e,i.outerContainer),Wt.flagHTMLUpdateClass(i.bubbleElement)}},{key:"overwrite",value:function(e,r,i,o){var s=e.messageToElements,a=Lt.overwriteMessage(s,o,r,i,ke,t.HTML_BUBBLE_CLASS);return a&&t.overwriteElements(e,r,a),a}},{key:"create",value:function(e,r,i){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s,a=t.createElements(e,r,i,o);return Lt.fillEmptyMessageElement(a.bubbleElement,r),Pn.apply(e,a.outerContainer),Wt.flagHTMLUpdateClass(a.bubbleElement),e.applyCustomStyles(a,i,!1,(s=e.messageStyles)==null?void 0:s[ke]),a}},{key:"add",value:function(e,r,i,o){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(o!=null&&o.status){var a=this.overwrite(e,r,i,e.messageElementRefs);if(a)return a;o.status=!1}if(!(s&&e.messageElementRefs.length>0&&Pn.isTemporaryBasedOnHTML(r))){var l=t.create(e,r,i,s);return s||e.appendOuterContainerElemet(l.outerContainer),l}}}])})();yP.HTML_BUBBLE_CLASS="html-message";var bs=yP,C$=(function(){function t(){k(this,t)}return M(t,null,[{key:"katex",value:function(e,r,i){var o=(i||{}).delimiter||"$";if(o.length!==1)throw new Error("invalid delimiter");var s=function(u,d){var f;return((f=window.katex)==null?void 0:f.renderToString(u,Je({displayMode:d,throwOnError:!1,output:"mathml"},e)))||""},a=function(u,d,f){var h=!1,p=u.bMarks[d]+u.tShift[d],m=u.eMarks[d];if(p+1>m)return!1;var g=u[Y].charAt(p);if(g!==o)return!1;var w=p;p=u.skipChars(p,g);var C=p-w;if(C!==2)return!1;for(var T=d;++T,!(T>=f||(p=w=u.bMarks[T]+u.tShift[T],m=u.eMarks[T],p<m&&u.tShift[T]<u.blkIndent));)if(u[Y].charAt(p)===o&&!(u.tShift[T]-u.blkIndent>=4)&&(p=u.skipChars(p,g),!(p-w<C)&&(p=u.skipSpaces(p),!(p<m)))){h=!0;break}C=u.tShift[d],u.line=T+(h?1:0);
63var I=u.getLines(d+1,T,C,!0).replace(/[ \n]+/g," ").trim();return u.tokens.push({type:"katex",params:null,content:I,lines:[d,u.line],level:u.level,block:!0}),!0},l=function(u,d){var f=u.pos,h=u.posMax,p=f;if(u[Y].charAt(p)!==o)return!1;for(++p;p<h&&u[Y].charAt(p)===o;)++p;var m=u[Y].slice(f,p);if(m.length>2)return!1;for(var g=p,w=0;p<h;){var C=u[Y].charAt(p);if(C==="{"&&(p===0||u[Y].charAt(p-1)!=="\\"))w+=1;else if(C==="}"&&(p===0||u[Y].charAt(p-1)!=="\\")){if(w-=1,w<0)return!1}else if(C===o&&w===0){for(var T=p,I=p+1;I<h&&u[Y].charAt(I)===o;)++I;if(I-T===m.length){if(!d){var F=u[Y].slice(g,T).replace(/[ \n]+/g," ").trim();u.push({type:"katex",content:F,block:m.length>1,level:u.level})}return u.pos=I,!0}}p+=1}return d||(u.pending+=m),u.pos+=m.length,!0};r.inline.ruler.push("katex",l,i),r.block.ruler.push("katex",a,i),r.renderer.rules.katex=function(c,u){return s(c[u].content,c[u].block)},r.renderer.rules.katex.delimiter=o}}])})(),Ov;function _P(t){return Ov=Ov||document.createElement("textarea"),Ov.innerHTML="&"+t+";",Ov.value}var S$=Object.prototype.hasOwnProperty;function D$(t,n){return t?S$.call(t,n):!1}function bP(t){var n=[].slice.call(arguments,1);return n.forEach(function(e){if(e){if(B(e)!="object")throw new TypeError(e+"must be object");Object.keys(e).forEach(function(r){t[r]=e[r]})}}),t}var I$=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function lf(t){return t.indexOf("\\")<0?t:t.replace(I$,"$1")}function wP(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function _S(t){if(t>65535){t-=65536;var n=55296+(t>>10),e=56320+(t&1023);return String.fromCharCode(n,e)}return String.fromCharCode(t)}var T$=/&([a-z#][a-z0-9]{1,31});/gi,k$=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;function M$(t,n){var e=0,r=_P(n);return n!==r?r:n.charCodeAt(0)===35&&k$.test(n)&&(e=n[1].toLowerCase()==="x"?parseInt(n.slice(2),16):parseInt(n.slice(1),10),wP(e))?_S(e):t}function il(t){return t.indexOf("&")<0?t:t.replace(T$,M$)}var A$=/[&<>"]/,x$=/[&<>"]/g,R$={"&":"&","<":"<",">":">",'"':"""};function O$(t){return R$[t]}function pr(t){return A$.test(t)?t.replace(x$,O$):t}var ee={};ee.blockquote_open=function(){return`<blockquote> 64`};ee.blockquote_close=function(t,n){return"</blockquote>"+sl(t,n)};ee.code=function(t,n){return t[n].block?"<pre><code>"+pr(t[n].content)+"</code></pre>"+sl(t,n):"<code>"+pr(t[n].content)+"</code>"};ee.fence=function(t,n,e,r,i){var o=t[n],s="",a=e.langPrefix,l="",c,u,d;if(o.params){if(c=o.params.split(/\s+/g),u=c.join(" "),D$(i.rules.fence_custom,c[0]))return i.rules.fence_custom[c[0]](t,n,e,r,i);l=pr(il(lf(u))),s=' class="'+a+l+'"'}return e.highlight?d=e.highlight.apply(e.highlight,[o.content].concat(c))||pr(o.content):d=pr(o.content),"<pre><code"+s+">"+d+"</code></pre>"+sl(t,n)};ee.fence_custom={};ee.heading_open=function(t,n){return"<h"+t[n].hLevel+">"};ee.heading_close=function(t,n){return"</h"+t[n].hLevel+`> 65`};ee.hr=function(t,n,e){return(e.xhtmlOut?"<hr />":"<hr>")+sl(t,n)};ee.bullet_list_open=function(){return`<ul> 66`};ee.bullet_list_close=function(t,n){return"</ul>"+sl(t,n)};ee.list_item_open=function(){return"<li>"};ee.list_item_close=function(){return`</li> 67`};ee.ordered_list_open=function(t,n){var e=t[n],r=e.order>1?' start="'+e.order+'"':"";return"<ol"+r+`> 68`};ee.ordered_list_close=function(t,n){return"</ol>"+sl(t,n)};ee.paragraph_open=function(t,n){return t[n].tight?"":"<p>"};ee.paragraph_close=function(t,n){var e=!(t[n].tight&&n&&t[n-1].type==="inline"&&!t[n-1].content);return(t[n].tight?"":"</p>")+(e?sl(t,n):"")};ee.link_open=function(t,n,e){var r=t[n].title?' title="'+pr(il(t[n].title))+'"':"",i=e.linkTarget?' target="'+e.linkTarget+'"':"";return'<a href="'+pr(t[n].href)+'"'+r+i+">"};ee.link_close=function(){return"</a>"};ee.image=function(t,n,e){var r=' src="'+pr(t[n].src)+'"',i=t[n].title?' title="'+pr(il(t[n].title))+'"':"",o=' alt="'+(t[n].alt?pr(il(lf(t[n].alt))):"")+'"',s=e.xhtmlOut?" /":"";return"<img"+r+o+i+s+">"};ee.table_open=function(){return`<table> 69`};ee.table_close=function(){return`</table> 70`};ee.thead_open=function(){return`<thead> 71`};ee.thead_close=function(){return`</thead> 72`};ee.tbody_open=function(){return`<tbody> 73`};ee.tbody_close=function(){return`</tbody> 74`};ee.tr_open=function(){return"<tr>"};ee.tr_close=function(){return`</tr> 75`};ee.th_open=function(t,n){var e=t[n];return"<th"+(e.align?' style="text-align:'+e.align+'"':"")+">"};ee.th_close=function(){return"</th>"};ee.td_open=function(t,n){var e=t[n];return"<td"+(e.align?' style="text-align:'+e.align+'"':"")+">"};ee.td_close=function(){return"</td>"};ee.strong_open=function(){return"<strong>"};ee.strong_close=function(){return"</strong>"};ee.em_open=function(){return"<em>"};ee.em_close=function(){return"</em>"};ee.del_open=function(){return"<del>"};ee.del_close=function(){return"</del>"};ee.ins_open=function(){return"<ins>"};ee.ins_close=function(){return"</ins>"};ee.mark_open=function(){return"<mark>"};ee.mark_close=function(){return"</mark>"};ee.sub=function(t,n){return"<sub>"+pr(t[n].content)+"</sub>"};ee.sup=function(t,n){return"<sup>"+pr(t[n].content)+"</sup>"};ee.hardbreak=function(t,n,e){return e.xhtmlOut?`<br /> 76`:`<br> 77`};ee.softbreak=function(t,n,e){return e.breaks?e.xhtmlOut?`<br /> 78`:`<br> 79`:` 80`};ee.text=function(t,n){return pr(t[n].content)};ee.htmlblock=function(t,n){return t[n].content};ee.htmltag=function(t,n){return t[n].content};ee.abbr_open=function(t,n){return'<abbr title="'+pr(il(t[n].title))+'">'};ee.abbr_close=function(){return"</abbr>"};ee.footnote_ref=function(t,n){var e=Number(t[n].id+1).toString(),r="fnref"+e;return t[n].subId>0&&(r+=":"+t[n].subId),'<sup class="footnote-ref"><a href="#fn'+e+'" id="'+r+'">['+e+"]</a></sup>"};ee.footnote_block_open=function(t,n,e){var r=e.xhtmlOut?`<hr class="footnotes-sep" /> 81`:`<hr class="footnotes-sep"> 82`;return r+`<section class="footnotes"> 83<ol class="footnotes-list"> 84`};ee.footnote_block_close=function(){return`</ol> 85</section> 86`};ee.footnote_open=function(t,n){var e=Number(t[n].id+1).toString();return'<li id="fn'+e+'" class="footnote-item">'};ee.footnote_close=function(){return`</li> 87`};ee.footnote_anchor=function(t,n){var e=Number(t[n].id+1).toString(),r="fnref"+e;return t[n].subId>0&&(r+=":"+t[n].subId),' <a href="#'+r+'" class="footnote-backref">\u21A9</a>'};ee.dl_open=function(){return`<dl> 88`};ee.dt_open=function(){return"<dt>"};ee.dd_open=function(){return"<dd>"};ee.dl_close=function(){return`</dl> 89`};ee.dt_close=function(){return`</dt> 90`};ee.dd_close=function(){return`</dd> 91`};function EP(t,n){return++n>
91=t.length-2?n:t[n].type==="paragraph_open"&&t[n].tight&&t[n+1].type==="inline"&&t[n+1].content.length===0&&t[n+2].type==="paragraph_close"&&t[n+2].tight?EP(t,n+2):n}var sl=ee.getBreak=function(t,n){return n=EP(t,n),n<t.length&&t[n].type==="list_item_close"?"":` 92`};function HS(){this.rules=bP({},ee),this.getBreak=ee.getBreak}HS.prototype.renderInline=function(t,n,e){for(var r=this.rules,i=t.length,o=0,s="";i--;)s+=r[t[o].type](t,o++,n,e,this);return s};HS.prototype.render=function(t,n,e){for(var r=this.rules,i=t.length,o=-1,s="";++o<i;)t[o].type==="inline"?s+=this.renderInline(t[o].children,n,e):s+=r[t[o].type](t,o,n,e,this);return s};function Ar(){this.__rules__=[],this.__cache__=null}Ar.prototype.__find__=function(t){for(var n=this.__rules__.length,e=-1;n--;)if(this.__rules__[++e].name===t)return e;return-1};Ar.prototype.__compile__=function(){var t=this,n=[""];t.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(r){n.indexOf(r)<0&&n.push(r)})}),t.__cache__={},n.forEach(function(e){t.__cache__[e]=[],t.__rules__.forEach(function(r){r.enabled&&(e&&r.alt.indexOf(e)<0||t.__cache__[e].push(r.fn))})})};Ar.prototype.at=function(t,n,e){var r=this.__find__(t),i=e||{};if(r===-1)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=n,this.__rules__[r].alt=i.alt||[],this.__cache__=null};Ar.prototype.before=function(t,n,e,r){var i=this.__find__(t),o=r||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i,0,{name:n,enabled:!0,fn:e,alt:o.alt||[]}),this.__cache__=null};Ar.prototype.after=function(t,n,e,r){var i=this.__find__(t),o=r||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i+1,0,{name:n,enabled:!0,fn:e,alt:o.alt||[]}),this.__cache__=null};Ar.prototype.push=function(t,n,e){var r=e||{};this.__rules__.push({name:t,enabled:!0,fn:n,alt:r.alt||[]}),this.__cache__=null};Ar.prototype.enable=function(t,n){t=Array.isArray(t)?t:[t],n&&this.__rules__.forEach(function(e){e.enabled=!1}),t.forEach(function(e){var r=this.__find__(e);if(r<0)throw new Error("Rules manager: invalid rule name "+e);this.__rules__[r].enabled=!0},this),this.__cache__=null};Ar.prototype.disable=function(t){t=Array.isArray(t)?t:[t],t.forEach(function(n){var e=this.__find__(n);if(e<0)throw new Error("Rules manager: invalid rule name "+n);this.__rules__[e].enabled=!1},this),this.__cache__=null};Ar.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};function N$(t){t.inlineMode?t.tokens.push({type:"inline",content:t.src.replace(/\n/g," ").trim(),level:0,lines:[0,1],children:[]}):t.block.parse(t.src,t.options,t.env,t.tokens)}function al(t,n,e,r,i){this.src=t,this.env=r,this.options=e,this.parser=n,this.tokens=i,this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache=[],this.isInLabel=!1,this.linkLevel=0,this.linkContent="",this.labelUnmatchedScopes=0}al.prototype.pushPending=function(){this.tokens.push({type:"text",content:this.pending,level:this.pendingLevel}),this.pending=""};al.prototype.push=function(t){this.pending&&this.pushPending(),this.tokens.push(t),this.pendingLevel=this.level};al.prototype.cacheSet=function(t,n){for(var e=this.cache.length;e<=t;e++)this.cache.push(0);this.cache[t]=n};al.prototype.cacheGet=function(t){return t<this.cache.length?this.cache[t]:0};function cf(t,n){var e,r,i,o=-1,s=t.posMax,a=t.pos,l=t.isInLabel;if(t.isInLabel)return-1;if(t.labelUnmatchedScopes)return t.labelUnmatchedScopes--,-1;for(t.pos=n+1,t.isInLabel=!0,e=1;t.pos<s;){if(i=t.src.charCodeAt(t.pos),i===91)e++;else if(i===93&&(e--,e===0)){r=!0;break}t.parser.skipToken(t)}return r?(o=t.pos,t.labelUnmatchedScopes=0):t.labelUnmatchedScopes=e-1,t.pos=a,t.isInLabel=l,o}function P$(t,n,e,r){var i,o,s,a,l,c;if(t.charCodeAt(0)!==42||t.charCodeAt(1)!==91||t.indexOf("]:")===-1||(i=new al(t,n,e,r,[]),o=cf(i,1),o<0||t.charCodeAt(o+1)!==58))return-1;for(a=i.posMax,s=o+2;s<a&&i.src.charCodeAt(s)!==10;s++);return l=t.slice(2,o),c=t.slice(o+2,s).trim(),c.length===0?-1:(r.abbreviations||(r.abbreviations={}),B(r.abbreviations[":"+l])>"u"&&(r.abbreviations[":"+l]=c),s)}function F$(t){var n=t.tokens,e,r,i,o;if(!t.inlineMode){for(e=1,r=n.length-1;e<r;e++)if(n[e-1].type==="paragraph_open"&&n[e].type==="inline"&&n[e+1].type==="paragraph_close"){for(i=n[e].content;i.length&&(o=P$(i,t.inline,t.options,t.env),!(o<0));)i=i.slice(o).trim();n[e].content=i,i.length||(n[e-1].tight=!0,n[e+1].tight=!0)}}}function bS(t){var n=il(t);try{n=decodeURI(n)}catch{}return encodeURI(n)}function CP(t,n){var e,r,i,o=n,s=t.posMax;
92if(t.src.charCodeAt(n)===60){for(n++;n<s;){if(e=t.src.charCodeAt(n),e===10)return!1;if(e===62)return i=bS(lf(t.src.slice(o+1,n))),t.parser.validateLink(i)?(t.pos=n+1,t.linkContent=i,!0):!1;if(e===92&&n+1<s){n+=2;continue}n++}return!1}for(r=0;n<s&&(e=t.src.charCodeAt(n),!(e===32||e<32||e===127));){if(e===92&&n+1<s){n+=2;continue}if(e===40&&(r++,r>1)||e===41&&(r--,r<0))break;n++}return o===n||(i=lf(t.src.slice(o,n)),!t.parser.validateLink(i))?!1:(t.linkContent=i,t.pos=n,!0)}function SP(t,n){var e,r=n,i=t.posMax,o=t.src.charCodeAt(n);if(o!==34&&o!==39&&o!==40)return!1;for(n++,o===40&&(o=41);n<i;){if(e=t.src.charCodeAt(n),e===o)return t.pos=n+1,t.linkContent=lf(t.src.slice(r+1,n)),!0;if(e===92&&n+1<i){n+=2;continue}n++}return!1}function DP(t){return t.trim().replace(/\s+/g," ").toUpperCase()}function L$(t,n,e,r){var i,o,s,a,l,c,u,d,f;if(t.charCodeAt(0)!==91||t.indexOf("]:")===-1||(i=new al(t,n,e,r,[]),o=cf(i,0),o<0||t.charCodeAt(o+1)!==58))return-1;for(a=i.posMax,s=o+2;s<a&&(l=i.src.charCodeAt(s),!(l!==32&&l!==10));s++);if(!CP(i,s))return-1;for(u=i.linkContent,s=i.pos,c=s,s=s+1;s<a&&(l=i.src.charCodeAt(s),!(l!==32&&l!==10));s++);for(s<a&&c!==s&&SP(i,s)?(d=i.linkContent,s=i.pos):(d="",s=c);s<a&&i.src.charCodeAt(s)===32;)s++;return s<a&&i.src.charCodeAt(s)!==10?-1:(f=DP(t.slice(1,o)),B(r.references[f])>"u"&&(r.references[f]={title:d,href:u}),s)}function j$(t){var n=t.tokens,e,r,i,o;if(t.env.references=t.env.references||{},!t.inlineMode){for(e=1,r=n.length-1;e<r;e++)if(n[e].type==="inline"&&n[e-1].type==="paragraph_open"&&n[e+1].type==="paragraph_close"){for(i=n[e].content;i.length&&(o=L$(i,t.inline,t.options,t.env),!(o<0));)i=i.slice(o).trim();n[e].content=i,i.length||(n[e-1].tight=!0,n[e+1].tight=!0)}}}function B$(t){var n=t.tokens,e,r,i;for(r=0,i=n.length;r<i;r++)e=n[r],e.type==="inline"&&t.inline.parse(e.content,t.options,t.env,e.children)}function V$(t){var n,e,r,i,o,s,a,l,c,u=0,d=!1,f={};if(t.env.footnotes&&(t.tokens=t.tokens.filter(function(h){return h.type==="footnote_reference_open"?(d=!0,l=[],c=h.label,!1):h.type==="footnote_reference_close"?(d=!1,f[":"+c]=l,!1):(d&&l.push(h),!d)}),!!t.env.footnotes.list)){for(s=t.env.footnotes.list,t.tokens.push({type:"footnote_block_open",level:u++}),n=0,e=s.length;n<e;n++){for(t.tokens.push({type:"footnote_open",id:n,level:u++}),s[n].tokens?(a=[],a.push({type:"paragraph_open",tight:!1,level:u++}),a.push({type:"inline",content:"",level:u,children:s[n].tokens}),a.push({type:"paragraph_close",tight:!1,level:--u})):s[n].label&&(a=f[":"+s[n].label]),t.tokens=t.tokens.concat(a),t.tokens[t.tokens.length-1].type==="paragraph_close"?o=t.tokens.pop():o=null,i=s[n].count>0?s[n].count:1,r=0;r<i;r++)t.tokens.push({type:"footnote_anchor",id:n,subId:r,level:u});o&&t.tokens.push(o),t.tokens.push({type:"footnote_close",level:--u})}t.tokens.push({type:"footnote_block_close",level:--u})}}var aN=` 93()[]'".,!?-`;function aS(t){return t.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1")}function U$(t){var n,e,r,i,o,s,a,l,c,u,d,f,h=t.tokens;if(t.env.abbreviations){for(t.env.abbrRegExp||(f="(^|["+aN.split("").map(aS).join("")+"])("+Object.keys(t.env.abbreviations).map(function(p){return p.substr(1)}).sort(function(p,m){return m.length-p.length}).map(aS).join("|")+")($|["+aN.split("").map(aS).join("")+"])",t.env.abbrRegExp=new RegExp(f,"g")),u=t.env.abbrRegExp,e=0,r=h.length;e<r;e++)if(h[e].type==="inline"){for(i=h[e].children,n=i.length-1;n>=0;n--)if(o=i[n],o.type==="text"){for(l=0,s=o.content,u.lastIndex=0,c=o.level,a=[];d=u.exec(s);)u.lastIndex>l&&a.push({type:"text",content:s.slice(l,d.index+d[1].length),level:c}),a.push({type:"abbr_open",title:t.env.abbreviations[":"+d[2]],level:c++}),a.push({type:"text",content:d[2],level:c}),a.push({type:"abbr_close",level:--c}),l=u.lastIndex-d[3].length;a.length&&(l<s.length&&a.push({type:"text",content:s.slice(l),level:c}),h[e].children=i=[].concat(i.slice(0,n),a,i.slice(n+1)))}}}}var H$=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,$$=/\((c|tm|r|p)\)/ig,z$={c:"\xA9",r:"\xAE",p:"\xA7",tm:"\u2122"};function q$(t){return t.indexOf("(")<0?t:t.replace($$,function(n,e){return z$[e.toLowerCase()]})}function W$(t){var n,e,r,i,o;if(t.options.typographer){for(o=t.tokens.length-1;o>=0;o--)if(t.tokens[o].type==="inline")for(i=t.tokens[o].children,n=i.length-1;n>=0;n--)e=i[n],e.type==="text"&&(r=e.content,r=q$(r),H$.test(r)&&(r=r.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/mg,"$1\u2014$2").replace(/(^|\s)--(\s|$)/mg,"$1\u2013$2").replace(/(^|[^-\s])--([^-\s]|$)/mg,"$1\u2013$2")),e.content=r)}}var G$=/['"]/,lN=/['"]/g,K$=/[-\s()\[\]]/,cN="\u2019";function uN(t,n){return n<0||n>=t.length?!1:!K$.test(t[n])}function qc(t,n,e){return t.substr(0,n)+e+t.substr(n+1)}function J$(t){var n,e,r,i,o,s,a,l,c,u,d,f,h,p,m,g,w;if(t.options.typographer){for(w=[],m=t.tokens.length-1;m>=0;m--)if(t.tokens[m].type==="inline"){for(g=t.tokens[m].children,w.length=0,n=0;n<g.length;n++)if(e=g[n],!(e.type!=="text"||G$.test(e.text))){for(a=g[n].level,h=w.length-1;h>=0&&!(w[h].level<=a);h--);w.length=h+1,r=e.content,o=0,s=r.length;e:for(;o<s&&(lN.lastIndex=o,i=lN.exec(r),!!i);){if(l=!uN(r,i.index-1),o=i.index+1,p=i[0]==="'",c=!uN(r,o),!c&&!l){p&&(e.content=qc(e.content,i.index,cN));continue}if(d=!c,f=!l,f){for(h=w.length-1;h>=0&&(u=w[h],!(w[h].level<a));h--)if(u.single===p&&w[h].level===a){u=w[h],p?(g[u.token].content=qc(g[u.token].content,u.pos,t.options.quotes[2]),e.content=qc(e.content,i.index,t.options.quotes[3])):(g[u.token].content=qc(g[u.token].content,u.pos,t.options.quotes[0]),e.content=qc(e.content,i.index,t.options.quotes[1])),w.length=h;continue e}}d?w.push({token:n,pos:i.index,single:p,level:a}):f&&p&&(e.content=qc(e.content,i.index,cN))}}}}}var lS=[["block",N$],["abbr",F$],["references",j$],["inline",B$],["footnote_tail",V$],["abbr2",U$],["replacements",W$],["smartquotes",J$]];function IP(){this.options={},this.ruler=new Ar;for(var t=0;t<lS.length;t++)this.ruler.push(lS[t][0],lS[t][1])}IP.prototype.process=function(t){var n,e,r;for(r=this.ruler.getRules(""),n=0,e=r.length;n<e;n++)r[n](t)};function ll(t,n,e,r,i){var o,s,a,l,c,u,d;for(this.src=t,this.parser=n,this.options=e,this.env=r,this.tokens=i,this.bMarks=[],this.eMarks=[],this.tShift=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.parentType="root",this.ddIndent=-1,this.level=0,this.result="",s=this.src,u=0,d=!1,a=l=u=0,c=s.length;l<c;l++){if(o=s.charCodeAt(l),!d)if(o===32){u++;continue}else d=!0;(o===10||l===c-1)&&(o!==10&&l++,this.bMarks.push(a),this.eMarks.push(l),this.tShift.push(u),d=!1,u=0,a=l+1)}this.bMarks.push(s.length),this.eMarks.push(s.length),this.tShift.push(0),this.lineMax=this.bMarks.length-1}ll.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]};ll.prototype.skipEmptyLines=function(t){for(var n=this.lineMax;t<n&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t};ll.prototype.skipSpaces=function(t){for(var n=this.src.length;
vendor: 9,595 bytes, line 93
93t<n&&this.src.charCodeAt(t)===32;t++);return t};ll.prototype.skipChars=function(t,n){for(var e=this.src.length;t<e&&this.src.charCodeAt(t)===n;t++);return t};ll.prototype.skipCharsBack=function(t,n,e){if(t<=e)return t;for(;t>e;)if(n!==this.src.charCodeAt(--t))return t+1;return t};ll.prototype.getLines=function(t,n,e,r){var i,o,s,a,l,c=t;if(t>=n)return"";if(c+1===n)return o=this.bMarks[c]+Math.min(this.tShift[c],e),s=r?this.eMarks[c]+1:this.eMarks[c],this.src.slice(o,s);for(a=new Array(n-t),i=0;c<n;c++,i++)l=this.tShift[c],l>e&&(l=e),l<0&&(l=0),o=this.bMarks[c]+l,c+1<n||r?s=this.eMarks[c]+1:s=this.eMarks[c],a[i]=this.src.slice(o,s);return a.join("")};function Y$(t,n,e){var r,i;if(t.tShift[n]-t.blkIndent<4)return!1;for(i=r=n+1;r<e;){if(t.isEmpty(r)){r++;continue}if(t.tShift[r]-t.blkIndent>=4){r++,i=r;continue}break}return t.line=r,t.tokens.push({type:"code",content:t.getLines(n,i,4+t.blkIndent,!0),block:!0,lines:[n,t.line],level:t.level}),!0}function Z$(t,n,e,r){var i,o,s,a,l,c=!1,u=t.bMarks[n]+t.tShift[n],d=t.eMarks[n];if(u+3>d||(i=t.src.charCodeAt(u),i!==126&&i!==96)||(l=u,u=t.skipChars(u,i),o=u-l,o<3)||(s=t.src.slice(u,d).trim(),s.indexOf("`")>=0))return!1;if(r)return!0;for(a=n;a++,!(a>=e||(u=l=t.bMarks[a]+t.tShift[a],d=t.eMarks[a],u<d&&t.tShift[a]<t.blkIndent));)if(t.src.charCodeAt(u)===i&&!(t.tShift[a]-t.blkIndent>=4)&&(u=t.skipChars(u,i),!(u-l<o)&&(u=t.skipSpaces(u),!(u<d)))){c=!0;break}return o=t.tShift[n],t.line=a+(c?1:0),t.tokens.push({type:"fence",params:s,content:t.getLines(n+1,a,o,!0),lines:[n,t.line],level:t.level}),!0}function X$(t,n,e,r){var i,o,s,a,l,c,u,d,f,h,p,m=t.bMarks[n]+t.tShift[n],g=t.eMarks[n];if(m>g||t.src.charCodeAt(m++)!==62||t.level>=t.options.maxNesting)return!1;if(r)return!0;for(t.src.charCodeAt(m)===32&&m++,l=t.blkIndent,t.blkIndent=0,a=[t.bMarks[n]],t.bMarks[n]=m,m=m<g?t.skipSpaces(m):m,o=m>=g,s=[t.tShift[n]],t.tShift[n]=m-t.bMarks[n],d=t.parser.ruler.getRules("blockquote"),i=n+1;i<e&&(m=t.bMarks[i]+t.tShift[i],g=t.eMarks[i],!(m>=g));i++){if(t.src.charCodeAt(m++)===62){t.src.charCodeAt(m)===32&&m++,a.push(t.bMarks[i]),t.bMarks[i]=m,m=m<g?t.skipSpaces(m):m,o=m>=g,s.push(t.tShift[i]),t.tShift[i]=m-t.bMarks[i];continue}if(o)break;for(p=!1,f=0,h=d.length;f<h;f++)if(d[f](t,i,e,!0)){p=!0;break}if(p)break;a.push(t.bMarks[i]),s.push(t.tShift[i]),t.tShift[i]=-1337}for(c=t.parentType,t.parentType="blockquote",t.tokens.push({type:"blockquote_open",lines:u=[n,0],level:t.level++}),t.parser.tokenize(t,n,i),t.tokens.push({type:"blockquote_close",level:--t.level}),t.parentType=c,u[1]=t.line,f=0;f<s.length;f++)t.bMarks[f+n]=a[f],t.tShift[f+n]=s[f];return t.blkIndent=l,!0}function Q$(t,n,e,r){var i,o,s,a=t.bMarks[n],l=t.eMarks[n];if(a+=t.tShift[n],a>l||(i=t.src.charCodeAt(a++),i!==42&&i!==45&&i!==95))return!1;for(o=1;a<l;){if(s=t.src.charCodeAt(a++),s!==i&&s!==32)return!1;s===i&&o++}return o<3?!1:(r||(t.line=n+1,t.tokens.push({type:"hr",lines:[n,t.line],level:t.level})),!0)}function dN(t,n){var e,r,i;return r=t.bMarks[n]+t.tShift[n],i=t.eMarks[n],r>=i||(e=t.src.charCodeAt(r++),e!==42&&e!==45&&e!==43)||r<i&&t.src.charCodeAt(r)!==32?-1:r}function hN(t,n){var e,r=t.bMarks[n]+t.tShift[n],i=t.eMarks[n];if(r+1>=i||(e=t.src.charCodeAt(r++),e<48||e>57))return-1;for(;;){if(r>=i)return-1;if(e=t.src.charCodeAt(r++),!(e>=48&&e<=57)){if(e===41||e===46)break;return-1}}return r<i&&t.src.charCodeAt(r)!==32?-1:r}function e9(t,n){var e,r,i=t.level+2;for(e=n+2,r=t.tokens.length-2;e<r;e++)t.tokens[e].level===i&&t.tokens[e].type==="paragraph_open"&&(t.tokens[e+2].tight=!0,t.tokens[e].tight=!0,e+=2)}function t9(t,n,e,r){var i,o,s,a,l,c,u,d,f,h,p,m,g,w,C,T,I,F,$=!0,q,G,lt,De;if((d=hN(t,n))>=0)g=!0;else if((d=dN(t,n))>=0)g=!1;else return!1;if(t.level>=t.options.maxNesting)return!1;if(m=t.src.charCodeAt(d-1),r)return!0;for(C=t.tokens.length,g?(u=t.bMarks[n]+t.tShift[n],p=Number(t.src.substr(u,d-u-1)),t.tokens.push({type:"ordered_list_open",order:p,lines:I=[n,0],level:t.level++})):t.tokens.push({type:"bullet_list_open",lines:I=[n,0],level:t.level++}),i=n,T=!1,q=t.parser.ruler.getRules("list");i<e&&(w=t.skipSpaces(d),f=t.eMarks[i],w>=f?h=1:h=w-d,h>4&&(h=1),h<1&&(h=1),o=d-t.bMarks[i]+h,t.tokens.push({type:"list_item_open",lines:F=[n,0],level:t.level++}),a=t.blkIndent,l=t.tight,s=t.tShift[n],c=t.parentType,t.tShift[n]=w-t.bMarks[n],t.blkIndent=o,t.tight=!0,t.parentType="list",t.parser.tokenize(t,n,e,!0),(!t.tight||T)&&($=!1),T=t.line-n>1&&t.isEmpty(t.line-1),t.blkIndent=a,t.tShift[n]=s,t.tight=l,t.parentType=c,t.tokens.push({type:"list_item_close",level:--t.level}),i=n=t.line,F[1]=i,w=t.bMarks[n],!(i>=e||t.isEmpty(i)||t.tShift[i]<t.blkIndent));){for(De=!1,G=0,lt=q.length;G<lt;G++)if(q[G](t,i,e,!0)){De=!0;break}if(De)break;if(g){if(d=hN(t,i),d<0)break}else if(d=dN(t,i),d<0)break;if(m!==t.src.charCodeAt(d-1))break}return t.tokens.push({type:g?"ordered_list_close":"bullet_list_close",level:--t.level}),I[1]=i,t.line=i,$&&e9(t,C),!0}function n9(t,n,e,r){var i,o,s,a,l,c=t.bMarks[n]+t.tShift[n],u=t.eMarks[n];if(c+4>u||t.src.charCodeAt(c)!==91||t.src.charCodeAt(c+1)!==94||t.level>=t.options.maxNesting)return!1;for(a=c+2;a<u;a++){if(t.src.charCodeAt(a)===32)return!1;if(t.src.charCodeAt(a)===93)break}return a===c+2||a+1>=u||t.src.charCodeAt(++a)!==58?!1:(r||(a++,t.env.footnotes||(t.env.footnotes={}),t.env.footnotes.refs||(t.env.footnotes.refs={}),l=t.src.slice(c+2,a-2),t.env.footnotes.refs[":"+l]=-1,t.tokens.push({type:"footnote_reference_open",label:l,level:t.level++}),i=t.bMarks[n],o=t.tShift[n],s=t.parentType,t.tShift[n]=t.skipSpaces(a)-a,t.bMarks[n]=a,t.blkIndent+=4,t.parentType="footnote",t.tShift[n]<t.blkIndent&&(t.tShift[n]+=t.blkIndent,t.bMarks[n]-=t.blkIndent),t.parser.tokenize(t,n,e,!0),t.parentType=s,t.blkIndent-=4,t.tShift[n]=o,t.bMarks[n]=i,t.tokens.push({type:"footnote_reference_close",level:--t.level})),!0)}function r9(t,n,e,r){var i,o,s,a=t.bMarks[n]+t.tShift[n],l=t.eMarks[n];if(a>=l||(i=t.src.charCodeAt(a),i!==35||a>=l))return!1;for(o=1,i=t.src.charCodeAt(++a);i===35&&a<l&&o<=6;)o++,i=t.src.charCodeAt(++a);return o>6||a<l&&i!==32?!1:(r||(l=t.skipCharsBack(l,32,a),s=t.skipCharsBack(l,35,a),s>a&&t.src.charCodeAt(s-1)===32&&(l=s),t.line=n+1,t.tokens.push({type:"heading_open",hLevel:o,lines:[n,t.line],level:t.level}),a<l&&t.tokens.push({type:"inline",content:t.src.slice(a,l).trim(),level:t.level+1,lines:[n,t.line],children:[]}),t.tokens.push({type:"heading_close",hLevel:o,level:t.level})),!0)}function i9(t,n,e){var r,i,o,s=n+1;return s>=e||t.tShift[s]<t.blkIndent||t.tShift[s]-t.blkIndent>3||(i=t.bMarks[s]+t.tShift[s],o=t.eMarks[s],i>=o)||(r=t.src.charCodeAt(i),r!==45&&r!==61)||(i=t.skipChars(i,r),i=t.skipSpaces(i),i<o)?!1:(i=t.bMarks[n]+t.tShift[n],t.line=s+1,t.tokens.push({type:"heading_open",hLevel:r===61?1:2,lines:[n,t.line],level:t.level}),t.tokens.push({type:"inline",content:t.src.slice(i,t.eMarks[n]).trim(),level:t.level+1,lines:[n,t.line-1],children:[]}),t.tokens.push({type:"heading_close",hLevel:r===61?1:2,level:t.level}),!0)}var TP={};["article","aside","button","blockquote","body","canvas","caption","col","colgroup","dd","div","dl","dt","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","iframe","li","map","object","ol","output","p","pre","progress","script","section","style","table","tbody","td","textarea","tfoot","th","tr","thead","ul","video"].forEach(function(t){TP[t]=!0});var o9=/^<([a-zA-Z]{1,15})[\s\/>]/,s9=/^<\/([a-zA-Z]{1,15})[\s>]/;function a9(t){var n=t|32;return n>=97&&n<=122}function l9(t,n,e,r){var i,o,s,a=t.bMarks[n],l=t.eMarks[n],c=t.tShift[n];if(a+=c,!t.options.html||c>3||a+2>=l||t.src.charCodeAt(a)!==60)return!1;if(i=t.src.charCodeAt(a+1),i===33||i===63){if(r)return!0}else if(i===47||a9(i)){if(i===47){if(o=t.src.slice(a,l).match(s9),!o)return!1}else if(o=t.src.slice(a,l).match(o9),!o)return!1;if(TP[o[1].toLowerCase()]!==!0)return!1;if(r)return!0}else return!1;for(s=n+1;s<t.lineMax&&!t.isEmpty(s);)s++;return t.line=s,t.tokens.push({type:"htmlblock",level:t.level,lines:[n,t.line],content:t.getLines(n,s,0,!0)}),!0}function cS(t,n){var e=t.bMarks[n]+t.blkIndent,r=t.eMarks[n];return t.src.substr(e,r-e)}function c9(t,n,e,r){var i,o,s,a,l,c,u,d,f,h,p;if(n+2>e||(l=n+1,t.tShift[l]<t.blkIndent)||(s=t.bMarks[l]+t.tShift[l],s>=t.eMarks[l])||(i=t.src.charCodeAt(s),i!==124&&i!==45&&i!==58)||(o=cS(t,n+1),!/^[-:| ]+$/.test(o))||(c=o.split("|"),c<=2))return!1;for(d=[],a=0;a<c.length;a++){if(f=c[a].trim(),!f){if(a===0||a===c.length-1)continue;return!1}if(!/^:?-+:?$/.test(f))return!1;f.charCodeAt(f.length-1)===58?d.push(f.charCodeAt(0)===58?"center":"right"):f.charCodeAt(0)===58?d.push("left"):d.push("")}if(o=cS(t,n).trim(),o.indexOf("|")===-1||(c=o.replace(/^\||\|$/g,"").split("|"),d.length!==c.length))return!1;if(r)return!0;for(t.tokens.push({type:"table_open",lines:h=[n,0],level:t.level++}),t.tokens.push({type:"thead_open",lines:[n,n+1],level:t.level++}),t.tokens.push({type:"tr_open",lines:[n,n+1],level:t.level++}),a=0;a<c.length;a++)t.tokens.push({type:"th_open",align:d[a],lines:[n,n+1],level:t.level++}),t.tokens.push({type:"inline",content:c[a].trim(),lines:[n,n+1],level:t.level,children:[]}),t.tokens.push({type:"th_close",level:--t.level});for(t.tokens.push({type:"tr_close",level:--t.level}),t.tokens.push({type:"thead_close",level:--t.level}),t.tokens.push({type:"tbody_open",lines:p=[n+2,0],level:t.level++}),l=n+2;l<e&&!(t.tShift[l]<t.blkIndent||(o=cS(t,l).trim(),o.indexOf("|")===-1));l++){for(c=o.replace(/^\||\|$/g,"").split("|"),t.tokens.push({type:"tr_open",level:t.level++}),a=0;a<c.length;a++)t.tokens.push({type:"td_open",align:d[a],level:t.level++}
93),u=c[a].substring(c[a].charCodeAt(0)===124?1:0,c[a].charCodeAt(c[a].length-1)===124?c[a].length-1:c[a].length).trim(),t.tokens.push({type:"inline",content:u,level:t.level,children:[]}),t.tokens.push({type:"td_close",level:--t.level});t.tokens.push({type:"tr_close",level:--t.level})}return t.tokens.push({type:"tbody_close",level:--t.level}),t.tokens.push({type:"table_close",level:--t.level}),h[1]=p[1]=l,t.line=l,!0}function Nv(t,n){var e,r,i=t.bMarks[n]+t.tShift[n],o=t.eMarks[n];return i>=o||(r=t.src.charCodeAt(i++),r!==126&&r!==58)||(e=t.skipSpaces(i),i===e)||e>=o?-1:e}function u9(t,n){var e,r,i=t.level+2;for(e=n+2,r=t.tokens.length-2;e<r;e++)t.tokens[e].level===i&&t.tokens[e].type==="paragraph_open"&&(t.tokens[e+2].tight=!0,t.tokens[e].tight=!0,e+=2)}function d9(t,n,e,r){var i,o,s,a,l,c,u,d,f,h,p,m,g,w;if(r)return t.ddIndent<0?!1:Nv(t,n)>=0;if(u=n+1,t.isEmpty(u)&&++u>e||t.tShift[u]<t.blkIndent||(i=Nv(t,u),i<0)||t.level>=t.options.maxNesting)return!1;c=t.tokens.length,t.tokens.push({type:"dl_open",lines:l=[n,0],level:t.level++}),s=n,o=u;e:for(;;){for(w=!0,g=!1,t.tokens.push({type:"dt_open",lines:[s,s],level:t.level++}),t.tokens.push({type:"inline",content:t.getLines(s,s+1,t.blkIndent,!1).trim(),level:t.level+1,lines:[s,s],children:[]}),t.tokens.push({type:"dt_close",level:--t.level});;){if(t.tokens.push({type:"dd_open",lines:a=[u,0],level:t.level++}),m=t.tight,f=t.ddIndent,d=t.blkIndent,p=t.tShift[o],h=t.parentType,t.blkIndent=t.ddIndent=t.tShift[o]+2,t.tShift[o]=i-t.bMarks[o],t.tight=!0,t.parentType="deflist",t.parser.tokenize(t,o,e,!0),(!t.tight||g)&&(w=!1),g=t.line-o>1&&t.isEmpty(t.line-1),t.tShift[o]=p,t.tight=m,t.parentType=h,t.blkIndent=d,t.ddIndent=f,t.tokens.push({type:"dd_close",level:--t.level}),a[1]=u=t.line,u>=e||t.tShift[u]<t.blkIndent)break e;if(i=Nv(t,u),i<0)break;o=u}if(u>=e||(s=u,t.isEmpty(s))||t.tShift[s]<t.blkIndent||(o=s+1,o>=e)||(t.isEmpty(o)&&o++,o>=e)||t.tShift[o]<t.blkIndent||(i=Nv(t,o),i<0))break}return t.tokens.push({type:"dl_close",level:--t.level}),l[1]=u,t.line=u,w&&u9(t,c),!0}function h9(t,n){var e,r,i,o,s,a=n+1,l;if(e=t.lineMax,a<e&&!t.isEmpty(a)){for(l=t.parser.ruler.getRules("paragraph");a<e&&!t.isEmpty(a);a++)if(!(t.tShift[a]-t.blkIndent>3)){for(i=!1,o=0,s=l.length;o<s;o++)if(l[o](t,a,e,!0)){i=!0;break}if(i)break}}return r=t.getLines(n,a,t.blkIndent,!1).trim(),t.line=a,r.length&&(t.tokens.push({type:"paragraph_open",tight:!1,lines:[n,t.line],level:t.level}),t.tokens.push({type:"inline",content:r,level:t.level+1,lines:[n,t.line],children:[]}),t.tokens.push({type:"paragraph_close",tight:!1,level:t.level})),!0}var Pv=[["code",Y$],["fences",Z$,["paragraph","blockquote","list"]],["blockquote",X$,["paragraph","blockquote","list"]],["hr",Q$,["paragraph","blockquote","list"]],["list",t9,["paragraph","blockquote"]],["footnote",n9,["paragraph"]],["heading",r9,["paragraph","blockquote"]],["lheading",i9],["htmlblock",l9,["paragraph","blockquote"]],["table",c9,["paragraph"]],["deflist",d9,["paragraph"]],["paragraph",h9]];function $S(){this.ruler=new Ar;for(var t=0;t<Pv.length;t++)this.ruler.push(Pv[t][0],Pv[t][1],{alt:(Pv[t][2]||[]).slice()})}$S.prototype.tokenize=function(t,n,e){for(var r=this.ruler.getRules(""),i=r.length,o=n,s=!1,a,l;o<e&&(t.line=o=t.skipEmptyLines(o),!(o>=e||t.tShift[o]<t.blkIndent));){for(l=0;l<i&&(a=r[l](t,o,e,!1),!a);l++);if(t.tight=!s,t.isEmpty(t.line-1)&&(s=!0),o=t.line,o<e&&t.isEmpty(o)){if(s=!0,o++,o<e&&t.parentType==="list"&&t.isEmpty(o))break;t.line=o}}};var f9=/[\n\t]/g,p9=/\r[\n\u0085]|[\u2424\u2028\u0085]/g,m9=/\u00a0/g;$S.prototype.parse=function(t,n,e,r){var i,o=0,s=0;if(!t)return[];t=t.replace(m9," "),t=t.replace(p9,` 94`),t.indexOf(" ")>=0&&(t=t.replace(f9,function(a,l){var c;return t.charCodeAt(l)===10?(o=l+1,s=0,a):(c=" ".slice((l-o-s)%4),s=l-o+1,c)})),i=new ll(t,this,n,e,r),this.tokenize(i,i.line,i.lineMax)};function g9(t){switch(t){case 10:case 92:case 96:case 42:case 95:case 94:case 91:case 93:case 33:case 38:case 60:case 62:case 123:case 125:case 36:case 37:case 64:case 126:case 43:case 61:case 58:return!0;default:return!1}}function v9(t,n){for(var e=t.pos;
94e<t.posMax&&!g9(t.src.charCodeAt(e));)e++;return e===t.pos?!1:(n||(t.pending+=t.src.slice(t.pos,e)),t.pos=e,!0)}function y9(t,n){var e,r,i=t.pos;if(t.src.charCodeAt(i)!==10)return!1;if(e=t.pending.length-1,r=t.posMax,!n)if(e>=0&&t.pending.charCodeAt(e)===32)if(e>=1&&t.pending.charCodeAt(e-1)===32){for(var o=e-2;o>=0;o--)if(t.pending.charCodeAt(o)!==32){t.pending=t.pending.substring(0,o+1);break}t.push({type:"hardbreak",level:t.level})}else t.pending=t.pending.slice(0,-1),t.push({type:"softbreak",level:t.level});else t.push({type:"softbreak",level:t.level});for(i++;i<r&&t.src.charCodeAt(i)===32;)i++;return t.pos=i,!0}var zS=[];for(uS=0;uS<256;uS++)zS.push(0);var uS;"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){zS[t.charCodeAt(0)]=1});function _9(t,n){var e,r=t.pos,i=t.posMax;if(t.src.charCodeAt(r)!==92)return!1;if(r++,r<i){if(e=t.src.charCodeAt(r),e<256&&zS[e]!==0)return n||(t.pending+=t.src[r]),t.pos+=2,!0;if(e===10){for(n||t.push({type:"hardbreak",level:t.level}),r++;r<i&&t.src.charCodeAt(r)===32;)r++;return t.pos=r,!0}}return n||(t.pending+="\\"),t.pos++,!0}function b9(t,n){var e,r,i,o,s,a=t.pos,l=t.src.charCodeAt(a);if(l!==96)return!1;for(e=a,a++,r=t.posMax;a<r&&t.src.charCodeAt(a)===96;)a++;for(i=t.src.slice(e,a),o=s=a;(o=t.src.indexOf("`",s))!==-1;){for(s=o+1;s<r&&t.src.charCodeAt(s)===96;)s++;if(s-o===i.length)return n||t.push({type:"code",content:t.src.slice(a,o).replace(/[ \n]+/g," ").trim(),block:!1,level:t.level}),t.pos=s,!0}return n||(t.pending+=i),t.pos+=i.length,!0}function w9(t,n){var e,r,i,o=t.posMax,s=t.pos,a,l;if(t.src.charCodeAt(s)!==126||n||s+4>=o||t.src.charCodeAt(s+1)!==126||t.level>=t.options.maxNesting||(a=s>0?t.src.charCodeAt(s-1):-1,l=t.src.charCodeAt(s+2),a===126)||l===126||l===32||l===10)return!1;for(r=s+2;r<o&&t.src.charCodeAt(r)===126;)r++;if(r>s+3)return t.pos+=r-s,n||(t.pending+=t.src.slice(s,r)),!0;for(t.pos=s+2,i=1;t.pos+1<o;){if(t.src.charCodeAt(t.pos)===126&&t.src.charCodeAt(t.pos+1)===126&&(a=t.src.charCodeAt(t.pos-1),l=t.pos+2<o?t.src.charCodeAt(t.pos+2):-1,l!==126&&a!==126&&(a!==32&&a!==10?i--:l!==32&&l!==10&&i++,i<=0))){e=!0;break}t.parser.skipToken(t)}return e?(t.posMax=t.pos,t.pos=s+2,n||(t.push({type:"del_open",level:t.level++}),t.parser.tokenize(t),t.push({type:"del_close",level:--t.level})),t.pos=t.posMax+2,t.posMax=o,!0):(t.pos=s,!1)}function E9(t,n){var e,r,i,o=t.posMax,s=t.pos,a,l;if(t.src.charCodeAt(s)!==43||n||s+4>=o||t.src.charCodeAt(s+1)!==43||t.level>=t.options.maxNesting||(a=s>0?t.src.charCodeAt(s-1):-1,l=t.src.charCodeAt(s+2),a===43)||l===43||l===32||l===10)return!1;for(r=s+2;r<o&&t.src.charCodeAt(r)===43;)r++;if(r!==s+2)return t.pos+=r-s,n||(t.pending+=t.src.slice(s,r)),!0;for(t.pos=s+2,i=1;t.pos+1<o;){if(t.src.charCodeAt(t.pos)===43&&t.src.charCodeAt(t.pos+1)===43&&(a=t.src.charCodeAt(t.pos-1),l=t.pos+2<o?t.src.charCodeAt(t.pos+2):-1,l!==43&&a!==43&&(a!==32&&a!==10?i--:l!==32&&l!==10&&i++,i<=0))){e=!0;break}t.parser.skipToken(t)}return e?(t.posMax=t.pos,t.pos=s+2,n||(t.push({type:"ins_open",level:t.level++}),t.parser.tokenize(t),t.push({type:"ins_close",level:--t.level})),t.pos=t.posMax+2,t.posMax=o,!0):(t.pos=s,!1)}function C9(t,n){var e,r,i,o=t.posMax,s=t.pos,a,l;if(t.src.charCodeAt(s)!==61||n||s+4>=o||t.src.charCodeAt(s+1)!==61||t.level>=t.options.maxNesting||(a=s>0?t.src.charCodeAt(s-1):-1,l=t.src.charCodeAt(s+2),a===61)||l===61||l===32||l===10)return!1;for(r=s+2;r<o&&t.src.charCodeAt(r)===61;)r++;if(r!==s+2)return t.pos+=r-s,n||(t.pending+=t.src.slice(s,r)),!0;for(t.pos=s+2,i=1;t.pos+1<o;){if(t.src.charCodeAt(t.pos)===61&&t.src.charCodeAt(t.pos+1)===61&&(a=t.src.charCodeAt(t.pos-1),l=t.pos+2<o?t.src.charCodeAt(t.pos+2):-1,l!==61&&a!==61&&(a!==32&&a!==10?i--:l!==32&&l!==10&&i++,i<=0))){e=!0;break}t.parser.skipToken(t)}return e?(t.posMax=t.pos,t.pos=s+2,n||(t.push({type:"mark_open",level:t.level++}),t.parser.tokenize(t),t.push({type:"mark_close",level:--t.level})),t.pos=t.posMax+2,t.posMax=o,!0):(t.pos=s,!1)}function fN(t){return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}function pN(t,n){var e=n,r,i,o,s=!0,a=!0,l=t.posMax,c=t.src.charCodeAt(n);for(r=n>
vendor: 4,461 bytes, line 94
940?t.src.charCodeAt(n-1):-1;e<l&&t.src.charCodeAt(e)===c;)e++;return e>=l&&(s=!1),o=e-n,o>=4?s=a=!1:(i=e<l?t.src.charCodeAt(e):-1,(i===32||i===10)&&(s=!1),(r===32||r===10)&&(a=!1),c===95&&(fN(r)&&(s=!1),fN(i)&&(a=!1))),{can_open:s,can_close:a,delims:o}}function S9(t,n){var e,r,i,o,s,a,l,c=t.posMax,u=t.pos,d=t.src.charCodeAt(u);if(d!==95&&d!==42||n)return!1;if(l=pN(t,u),e=l.delims,!l.can_open)return t.pos+=e,n||(t.pending+=t.src.slice(u,t.pos)),!0;if(t.level>=t.options.maxNesting)return!1;for(t.pos=u+e,a=[e];t.pos<c;){if(t.src.charCodeAt(t.pos)===d){if(l=pN(t,t.pos),r=l.delims,l.can_close){for(o=a.pop(),s=r;o!==s;){if(s<o){a.push(o-s);break}if(s-=o,a.length===0)break;t.pos+=o,o=a.pop()}if(a.length===0){e=o,i=!0;break}t.pos+=r;continue}l.can_open&&a.push(r),t.pos+=r;continue}t.parser.skipToken(t)}return i?(t.posMax=t.pos,t.pos=u+e,n||((e===2||e===3)&&t.push({type:"strong_open",level:t.level++}),(e===1||e===3)&&t.push({type:"em_open",level:t.level++}),t.parser.tokenize(t),(e===1||e===3)&&t.push({type:"em_close",level:--t.level}),(e===2||e===3)&&t.push({type:"strong_close",level:--t.level})),t.pos=t.posMax+e,t.posMax=c,!0):(t.pos=u,!1)}var D9=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function I9(t,n){var e,r,i=t.posMax,o=t.pos;if(t.src.charCodeAt(o)!==126||n||o+2>=i||t.level>=t.options.maxNesting)return!1;for(t.pos=o+1;t.pos<i;){if(t.src.charCodeAt(t.pos)===126){e=!0;break}t.parser.skipToken(t)}return!e||o+1===t.pos||(r=t.src.slice(o+1,t.pos),r.match(/(^|[^\\])(\\\\)*\s/))?(t.pos=o,!1):(t.posMax=t.pos,t.pos=o+1,n||t.push({type:"sub",level:t.level,content:r.replace(D9,"$1")}),t.pos=t.posMax+1,t.posMax=i,!0)}var T9=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function k9(t,n){var e,r,i=t.posMax,o=t.pos;if(t.src.charCodeAt(o)!==94||n||o+2>=i||t.level>=t.options.maxNesting)return!1;for(t.pos=o+1;t.pos<i;){if(t.src.charCodeAt(t.pos)===94){e=!0;break}t.parser.skipToken(t)}return!e||o+1===t.pos||(r=t.src.slice(o+1,t.pos),r.match(/(^|[^\\])(\\\\)*\s/))?(t.pos=o,!1):(t.posMax=t.pos,t.pos=o+1,n||t.push({type:"sup",level:t.level,content:r.replace(T9,"$1")}),t.pos=t.posMax+1,t.posMax=i,!0)}function M9(t,n){var e,r,i,o,s,a,l,c,u=!1,d=t.pos,f=t.posMax,h=t.pos,p=t.src.charCodeAt(h);if(p===33&&(u=!0,p=t.src.charCodeAt(++h)),p!==91||t.level>=t.options.maxNesting||(e=h+1,r=cf(t,h),r<0))return!1;if(a=r+1,a<f&&t.src.charCodeAt(a)===40){for(a++;a<f&&(c=t.src.charCodeAt(a),!(c!==32&&c!==10));a++);if(a>=f)return!1;for(h=a,CP(t,a)?(o=t.linkContent,a=t.pos):o="",h=a;a<f&&(c=t.src.charCodeAt(a),!(c!==32&&c!==10));a++);if(a<f&&h!==a&&SP(t,a))for(s=t.linkContent,a=t.pos;a<f&&(c=t.src.charCodeAt(a),!(c!==32&&c!==10));a++);else s="";if(a>=f||t.src.charCodeAt(a)!==41)return t.pos=d,!1;a++}else{if(t.linkLevel>0)return!1;for(;a<f&&(c=t.src.charCodeAt(a),!(c!==32&&c!==10));a++);if(a<f&&t.src.charCodeAt(a)===91&&(h=a+1,a=cf(t,a),a>=0?i=t.src.slice(h,a++):a=h-1),i||(B(i)>"u"&&(a=r+1),i=t.src.slice(e,r)),l=t.env.references[DP(i)],!l)return t.pos=d,!1;o=l.href,s=l.title}return n||(t.pos=e,t.posMax=r,u?t.push({type:"image",src:o,title:s,alt:t.src.substr(e,r-e),level:t.level}):(t.push({type:"link_open",href:o,title:s,level:t.level++}),t.linkLevel++,t.parser.tokenize(t),t.linkLevel--,t.push({type:"link_close",level:--t.level}))),t.pos=a,t.posMax=f,!0}function A9(t,n){var e,r,i,o,s=t.posMax,a=t.pos;return a+2>=s||t.src.charCodeAt(a)!==94||t.src.charCodeAt(a+1)!==91||t.level>=t.options.maxNesting||(e=a+2,r=cf(t,a+1),r<0)?!1:(n||(t.env.footnotes||(t.env.footnotes={}),t.env.footnotes.list||(t.env.footnotes.list=[]),i=t.env.footnotes.list.length,t.pos=e,t.posMax=r,t.push({type:"footnote_ref",id:i,level:t.level}),t.linkLevel++,o=t.tokens.length,t.parser.tokenize(t),t.env.footnotes.list[i]={tokens:t.tokens.splice(o)},t.linkLevel--),t.pos=r+1,t.posMax=s,!0)}function x9(t,n){var e,r,i,o,s=t.posMax,a=t.pos;if(a+3>s||!t.env.footnotes||!t.env.footnotes.refs||t.src.charCodeAt(a)!==91||t.src.charCodeAt(a+1)!==94||t.level>=t.options.maxNesting)return!1;for(r=a+2;r<s;r++){if(t.src.charCodeAt(r)===32||t.src.charCodeAt(r)===10)return!1;if(t.src.charCodeAt(r)===93)break}return r===a+2||r>=s||(r++,e=t.src.slice(a+2,r-1),B(t.env.footnotes.refs[":"+e])>"u")?!1:(n||(t.env.footnotes.list||(t.env.footnotes.list=[]),t.env.footnotes.refs[":"+e]<0?(i=t.env.footnotes.list.length,t.env.footnotes.list[i]={label:e,count:0},t.env.footnotes.refs[":"+e]=i):i=t.env.footnotes.refs[":"+e],o=t.env.footnotes.list[i].count,t.env.footnotes.list[i].count++,t.pu
94sh({type:"footnote_ref",id:i,subId:o,level:t.level})),t.pos=r,t.posMax=s,!0)}var R9=["coap","doi","javascript","aaa","aaas","about","acap","cap","cid","crid","data","dav","dict","dns","file","ftp","geo","go","gopher","h323","http","https","iax","icap","im","imap","info","ipp","iris","iris.beep","iris.xpc","iris.xpcs","iris.lwz","ldap","mailto","mid","msrp","msrps","mtqp","mupdate","news","nfs","ni","nih","nntp","opaquelocktoken","pop","pres","rtsp","service","session","shttp","sieve","sip","sips","sms","snmp","soap.beep","soap.beeps","tag","tel","telnet","tftp","thismessage","tn3270","tip","tv","urn","vemmi","ws","wss","xcon","xcon-userid","xmlrpc.beep","xmlrpc.beeps","xmpp","z39.50r","z39.50s","adiumxtra","afp","afs","aim","apt","attachment","aw","beshare","bitcoin","bolo","callto","chrome","chrome-extension","com-eventbrite-attendee","content","cvs","dlna-playsingle","dlna-playcontainer","dtn","dvb","ed2k","facetime","feed","finger","fish","gg","git","gizmoproject","gtalk","hcp","icon","ipn","irc","irc6","ircs","itms","jar","jms","keyparc","lastfm","ldaps","magnet","maps","market","message","mms","ms-help","msnim","mumble","mvn","notes","oid","palm","paparazzi","platform","proxy","psyc","query","res","resource","rmi","rsync","rtmp","secondlife","sftp","sgn","skype","smb","soldat","spotify","ssh","steam","svn","teamspeak","things","udp","unreal","ut2004","ventrilo","view-source","webcal","wtai","wyciwyg","xfire","xri","ymsgr"],O9=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,N9=/^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;function P9(t,n){var e,r,i,o,s,a=t.pos;return t.src.charCodeAt(a)!==60||(e=t.src.slice(a),e.indexOf(">")<0)?!1:(r=e.match(N9),r?R9.indexOf(r[1].toLowerCase())<0||(o=r[0].slice(1,-1),s=bS(o),!t.parser.validateLink(o))?!1:(n||(t.push({type:"link_open",href:s,level:t.level}),t.push({type:"text",content:o,level:t.level+1}),t.push({type:"link_close",level:t.level})),t.pos+=r[0].length,!0):(i=e.match(O9),i?(o=i[0].slice(1,-1),s=bS("mailto:"+o),t.parser.validateLink(s)?(n||(t.push({type:"link_open",href:s,level:t.level}),t.push({type:"text",content:o,level:t.level+1}),t.push({type:"link_close",level:t.level})),t.pos+=i[0].length,!0):!1):!1))}function ry(t,n){return t=t.source,n=n||"",function e(r,i){return r?(i=i.source||i,t=t.replace(r,i),e):new RegExp(t,n)}}var F9=/[a-zA-Z_:][a-zA-Z0-9:._-]*/,L9=/[^"'=<>`\x00-\x20]+/,j9=/'[^']*'/,B9=/"[^"]*"/,V9=ry(/(?:unquoted|single_quoted|double_quoted)/)("unquoted",L9)("single_quoted",j9)("double_quoted",B9)(),U9=ry(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name",F9)("attr_value",V9)(),H9=ry(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute",U9)(),$9=/<\/[A-Za-z][A-Za-z0-9]*\s*>/,z9=/<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,q9=/<[?].*?[?]>/,W9=/<![A-Z]+\s+[^>]*>/,G9=/<!\[CDATA\[[\s\S]*?\]\]>/,K9=ry(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag",H9)("close_tag",$9)("comment",z9)("processing",q9)("declaration",W9)("cdata",G9)();function J9(t){var n=t|32;return n>=97&&n<=122}function Y9(t,n){var e,r,i,o=t.pos;return!t.options.html||(i=t.posMax,t.src.charCodeAt(o)!==60||o+2>=i)||(e=t.src.charCodeAt(o+1),e!==33&&e!==63&&e!==47&&!J9(e))||(r=t.src.slice(o).match(K9),!r)?!1:(n||t.push({type:"htmltag",content:t.src.slice(o,o+r[0].length),level:t.level}),t.pos+=r[0].length,!0)}var Z9=/^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,X9=/^&([a-z][a-z0-9]{1,31});/i;function Q9(t,n){var e,r,i,o=t.pos,s=t.posMax;if(t.src.charCodeAt(o)!==38)return!1;if(o+1<s){if(e=t.src.charCodeAt(o+1),e===35){if(i=t.src.slice(o).match(Z9),i)return n||(r=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),t.pending+=wP(r)?_S(r):_S(65533)),t.pos+=i[0].length,!0}else if(i=t.src.slice(o).match(X9),i){var a=_P(i[1]);if(i[1]!==a)return n||(t.pending+=a),t.pos+=i[0].length,!0}}return n||(t.pending+="&"),t.pos++,!0}var dS=[["text",v9],["newline",y9],["escape",_9],["backticks",b9],["del",w9],["ins",E9],["mark",C9],["emphasis",S9],["sub",I9],["sup",k9],["links",M9],["footnote_inline",A9],["footnote_ref",x9],["autolink",P9],["htmltag",Y9],["entity",Q9]];function iy(){this.ruler=new Ar;for(var t=0;t<dS.length;t++)this.ruler.push(dS[t][0],dS[t][1]);this.validateLink=ez}iy.prototype.skipToken=function(t){var n=this.ruler.getRules(""),e=n.length,r=t.pos,i,o;if((o=t.cacheGet(r))>0){t.pos=o;return}for(i=0;i<e;i++)if(n[i](t,!0)){t.cacheSet(r,t.pos);return}t.pos++,t.cacheSet(r,t.pos)};iy.prototype.tokenize=function(t){for(var n=this.ruler.getRules(""),e=n.length,r=t.posMax,i,o;t.pos<r;){for(o=0;o<e&&(i=n[o](t,!1),!i);o++);if(i){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};iy.prototype.parse=function(t,n,e,r){var i=new al(t,this,n,e,r);this.tokenize(i)};function ez(t){var n=["vbscript","javascript","file","data"],e=t.trim().toLowerCase();return e=il(e),!(e.indexOf(":")!==-1&&n.indexOf(e.split(":")[0])!==-1)}var tz={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","replacements","smartquotes","references","abbr2","footnote_tail"]},block:{rules:["blockquote","code","fences","footnote","heading","hr","htmlblock","lheading","list","paragraph","table"]},inline:{rules:["autolink","backticks","del","emphasis","entity","escape","footnote_ref","htmltag","links","newline","text"]}}},nz={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{},block:{}
94,inline:{}}},rz={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","abbr2"]},block:{rules:["blockquote","code","fences","heading","hr","htmlblock","lheading","list","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","htmltag","links","newline","text"]}}},iz={default:tz,full:nz,commonmark:rz};function kP(t,n,e){this.src=n,this.env=e,this.options=t.options,this.tokens=[],this.inlineMode=!1,this.inline=t.inline,this.block=t.block,this.renderer=t.renderer,this.typographer=t.typographer}function eo(t,n){typeof t!="string"&&(n=t,t="default"),n&&n.linkify!=null&&console.warn(`linkify option is removed. Use linkify plugin instead: 95 96import Remarkable from 'remarkable'; 97import linkify from 'remarkable/linkify'; 98new Remarkable().use(linkify) 99`),this.inline=new iy,this.block=new $S,this.core=new IP,this.renderer=new HS,this.ruler=new Ar,this.options={},this.configure(iz[t]),this.set(n||{})}eo.prototype.set=function(t){bP(this.options,t)};eo.prototype.configure=function(t){var n=this;if(!t)throw new Error("Wrong `remarkable` preset, check name/content");t.options&&n.set(t.options),t.components&&Object.keys(t.components).forEach(function(e){t.components[e].rules&&n[e].ruler.enable(t.components[e].rules,!0)})};eo.prototype.use=function(t,n){return t(this,n),this};eo.prototype.parse=function(t,n){var e=new kP(this,t,n);return this.core.process(e),e.tokens};eo.prototype.render=function(t,n){return n=n||{},this.renderer.render(this.parse(t,n),this.options,n)};eo.prototype.parseInline=function(t,n){var e=new kP(this,t,n);return e.inlineMode=!0,this.core.process(e),e.tokens};eo.prototype.renderInline=function(t,n){return n=n||{},this.renderer.render(this.parseInline(t,n),this.options,n)};var MP=(function(){function t(){k(this,t)}return M(t,null,[{key:"addPlugins",value:function(e,r){var i=window.remarkable_plugins;if(i&&i.forEach(function(a){e.use(a.plugin,a.options)}),r!=null&&r.math){window.katex||(console.warn("window.katex not found, use chatElementRef.refreshMessages to re-render messages"),console.warn("See https://deepchat.dev/examples/externalModules"));var o=B(r.math)=="object"?r.math.delimiter:"",s=B(r.math)=="object"&&r.math.options?r.math.options:{};e.use(C$.katex.bind(this,s),{delimiter:o})}}},{key:"instantiate",value:function(e){if(e)return new eo(Je(Je({},t.DEFAULT_PROPERTIES),e));if(window.hljs){var r=window.hljs;return new eo({highlight:function(o,s){if(s&&r.getLanguage(s))try{return r.highlight(o,{language:s}).value}catch{console[E]("failed to setup the highlight dependency")}try{return r.highlightAuto(o).value}catch{console[E]("failed to automatically highlight messages")}return""},html:!1,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkTarget:"_blank",typographer:!0})}else return new eo(t.DEFAULT_PROPERTIES)}},{key:"createNew",value:function(e){var r=t.instantiate(e);return t.addPlugins(r,e),r.inline.validateLink=function(){return!0},r}}])})();MP.DEFAULT_PROPERTIES={breaks:!0,linkTarget:"_blank"};var wS=MP,oz=(function(){function t(n){k(this,t),this.storageKey="deep-chat-storage",this.maxMessages=1e3,this.trackInputText=!1,this.trackScrollHeight=!1,B(n)=="object"&&(n.key&&(this.storageKey=n.key),n.maxMessages&&(this.maxMessages=n.maxMessages),n.inputText!==void 0&&(this.trackInputText=n.inputText),n.scrollHeight!==void 0&&(this.trackScrollHeight=n.scrollHeight),n.clear=this.clear.bind(this),Wt.processBrowserStorage(this))}return M(t,[{key:"get",value:function(){var e=localStorage.getItem(this.storageKey);return e?JSON.parse(e):{messages:[]}}},{key:"set",value:function(e,r,i){var o={messages:e,inputText:r,scrollHeight:i};localStorage.setItem(this.storageKey,JSON.stringify(o))}},{key:"addMessages",value:function(e){var r=e.length-this.maxMessages;r<0&&(r=0);var i=e.slice(r,e.length),o=this.trackInputText||this.trackScrollHeight?localStorage.getItem(this.storageKey):void 0,s=o?JSON.parse(o):void 0;this.set(i,this.trackInputText?s?.inputText:void 0,this.trackScrollHeight?s?.scrollHeight:void 0)}},{key:"addInputText",value:function(e){if(this.trackInputText){var r=localStorage.getItem(this.storageKey),i=r?JSON.parse(r):void 0;this.set(i?.messages||[],e,this.trackScrollHeight?i?.scrollHeight:void 0)}}},{key:"addScrollHeight",value:function(e){if(this.trackScrollHeight){var r=localStorage.getItem(this.storageKey),i=r?JSON.parse(r):void 0;this.set(i?.messages||[],this.trackInputText?i?.inputText:void 0,e)}}},{key:"clear",value:function(){localStorage.removeItem(this.storageKey)}}])})(),Hv=(function(){function t(){k(this,t)}return M(t,null,[{key:"applyCustomStylesToElements",value:function(e,r,i){if(i&&(Object.assign(e.outerContainer[N],i.outerContainer),Object.assign(e.innerContainer[N],i.innerContainer),Object.assign(e.bubbleElement[N],i.bubble),r)){var o=e.bubbleElement.children[0],s=o.tagName.toLocaleLowerCase()!=="a"?o:o.children[0];Object.assign(s[N],i.media)}}},{key:"applySideStyles",value:function(e,r,i,o){o&&(t.applyCustomStylesToElements(e,i,o.shared),r===et?t.applyCustomStylesToElements(e,i,o.user):(t.applyCustomStylesToElements(e,i,o.ai),t.applyCustomStylesToElements(e,i,o[r])))}},{key:"isElementsStyles",value:function(e){return!!(e.outerContainer||e.innerContainer||e.bubble||e.media)}},{key:"applyCustomStyles",value:function(e,r,i,o,s){var a;s&&e[H]!==s?t.isElementsStyles(s)?(t.applyCustomStylesToElements(r,o,(a=e[H])==null?void 0:a.shared),t.applyCustomStylesToElements(r,o,s)):(t.applySideStyles(r,i,o,e[H]),t.applySideStyles(r,i,o,s)):t.applySideStyles(r,i,o,e[H])}},{key:"extractParticularSharedStyles",value:function(e,r){if(r!=null&&r.shared){var i=r.shared,o={outerContainer:{},innerContainer:{},bubble:{},media:{}};return e.forEach(function(s){var a,l,c,u;o.outerContainer[s]=((a=i.outerContainer)==null?void 0:a[s])||"",o.innerContainer[s]=((l=i.innerContainer)==null?void 0:l[s])||"",o.bubble[s]=((c=i.bubble)==null?void 0:c[s])||"",o.media[s]=((u=i.media)==null?void 0:u[s])||""}),o}}}])})(),Zr=(function(){function t(){k(this,t)}return M(t,null,[{key:"setElementProps",value:function(e,r,i,o){var s;i!=="loading"&&(e.applyCustomStyles(r,o,!0,(s=e.messageStyles)==null?void 0:s[i]),r.bubbleElement[S].add(rP))}},{key:"addMessage",value:function(e,r,i,o,s){t.setElementProps(e,r,i,o),s||e.appendOuterContainerElemet(r.outerContainer)}},{key:"wrapInLink",value:function(e,r,i){var o=U("a");return o.href=r,o.download=i||Bt,o.target="_blank",o.appendChild(e),o}},{key:"isNonLinkableDataUrl",value:function(e,r){return!r.startsWith("data")||e===it?!1:e===nl&&r.startsWith("data:text/javascript")||!r.startsWith("data:image")&&!r.startsWith("data:application")}},{key:"processContent",value:function(e,r,i,o){return!i||t.isNonLinkableDataUrl(e,i)?r:t.wrapInLink(r,i,o)}},{key:"waitToLoadThenScroll",value:function(e){setTimeout(function(){e()},60)}},{key:"scrollDownOnImageLoad",value:function(e,r){if(e.startsWith("data"))t.waitToLoadThenScroll(r);else try{fetch(e,{mode:"no-cors"}).catch(function(){}).finally(function(){t.waitToLoadThenScroll(r)})}catch{r()}}},{key:"reAddFileRefToObject",value:function(e,r){var i;
99(i=e[x])==null||i.forEach(function(o,s){var a;o.ref&&(a=r[x])!=null&&a[s]&&(r[x][s].ref=o.ref)})}},{key:"removeFileRef",value:function(e){var r=Je({},e);return delete r.ref,r}},{key:"isAudioFile",value:function(e){var r=/\.(mp3|ogg|wav|aac|webm|4a)$/i,i=e.type,o=e.src;return i===$e||o?.startsWith("data:audio")||o&&r.test(o)}},{key:"isImageFile",value:function(e){var r=e.type,i=e.src;return r===it||i?.startsWith("data:image")||i&&t.isImageFileExtension(i)}},{key:"isImageFileExtension",value:function(e){return/\.(jpg|jpeg|png|gif|bmp)$/i.test(e)}}])})(),ol=(function(){function t(){k(this,t)}return M(t,null,[{key:"onMessage",value:function(e,r,i){var o,s=JSON.parse(JSON.stringify({message:r,isHistory:i,isInitial:i}));Zr.reAddFileRefToObject(r,s.message),(o=e.onMessage)==null||o.call(e,s),e.dispatchEvent(new CustomEvent("message",{detail:s})),Wt.fireOnNewMessage(e,s)}},{key:"onClearMessages",value:function(e){var r;(r=e.onClearMessages)==null||r.call(e),e.dispatchEvent(new CustomEvent("clear-messages"))}},{key:"onRender",value:function(e){var r;(r=e.onComponentRender)==null||r.call(e,e),e.dispatchEvent(new CustomEvent("render",{detail:e}))}},{key:"onInput",value:function(e,r,i){var o,s,a=JSON.parse(JSON.stringify({content:r,isUser:i}));r[x]&&Zr.reAddFileRefToObject(_({},x,(o=r[x])==null?void 0:o.map(function(l){return{ref:l}})),a.content),(s=e.onInput)==null||s.call(e,a),e.dispatchEvent(new CustomEvent("input",{detail:a}))}},{key:"onError",value:function(e,r){var i;(i=e.onError)==null||i.call(e,r),e.dispatchEvent(new CustomEvent(E,{detail:r}))}}])})(),$v=(function(){function t(){k(this,t)}return M(t,null,[{key:"generateLoadingRingElement",value:function(){var e=U();return e[S].add("loading-history"),e.appendChild(U()),e.appendChild(U()),e.appendChild(U()),e.appendChild(U()),e}},{key:"apply",value:function(e,r,i){vs.setRing(r.bubbleElement,i?.bubble),i!=null&&i.bubble&&(i=JSON.parse(JSON.stringify(i)),delete i.bubble),e.applyCustomStyles(r,"history",!1,i)}},{key:"addLoadHistoryMessage",value:function(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o,s,a,l,c,u,d,f;e.bubbleElement[S].add(t.CLASS);var h=i?t.FULL_VIEW_CLASS:t.SMALL_CLASS;e.outerContainer[S].add(h);var p=i?(l=(a=(s=(o=r.messageStyles)==null?void 0:o.loading)==null?void 0:s.history)==null?void 0:a.full)==null?void 0:l.styles:(f=(d=(u=(c=r.messageStyles)==null?void 0:c.loading)==null?void 0:u.history)==null?void 0:d.small)==null?void 0:f.styles;t.apply(r,e,p);var m=r.elementRef;i&&r.elementRef.id!==oP&&(m=r.elementRef.parentElement),m?.prepend(e.outerContainer)}},{key:"createDefaultElements",value:function(e){var r=e.createMessageElements("",xt),i=r.bubbleElement,o=t.generateLoadingRingElement();return i.appendChild(o),r}},{key:"addMessage",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i,o,s,a,l=(a=(s=(o=(i=e.messageStyles)==null?void 0:i.loading)==null?void 0:o.history)==null?void 0:s.full)==null?void 0:a[ke],c=l?bs.createElements(e,l,xt,!0,!0):t.createDefaultElements(e);return t.addLoadHistoryMessage(c,e,r),Lt.softRemRoleElements(c.innerContainer,e.avatar,e.name),c}},{key:"tryChangeViewToSmall",value:function(e,r){var i,o,s,a,l,c,u,d;if(r!=null&&r.outerContainer[S].contains(t.FULL_VIEW_CLASS)){r.outerContainer[S].replace(t.FULL_VIEW_CLASS,t.SMALL_CLASS);var f=(a=(s=(o=(i=e.messageStyles)==null?void 0:i.loading)==null?void 0:o.history)==null?void 0:s.small)==null?void 0:a.styles;f&&t.apply(e,r,f);var h=(d=(u=(c=(l=e.messageStyles)==null?void 0:l.loading)==null?void 0:c.history)==null?void 0:u.small)==null?void 0:d[ke];return h&&(r.bubbleElement.innerHTML=h),!0}return!1}},{key:"changeFullViewToSmall",value:function(e){var r=e.messageElementRefs[e.messageElementRefs.length-1];t.tryChangeViewToSmall(e,r)||t.tryChangeViewToSmall(e,e.messageElementRefs[0])}}])})();$v.CLASS="loading-history-message",$v.FULL_VIEW_CLASS="loading-history-message-full-view",$v.SMALL_CLASS="loading-history-message-small";var Qa=$v,AP=(function(){function t(){k(this,t)}return M(t,null,[{key:"setFade",value:function(e,r){e[N].transitionDuration=typeof r=="number"?"".concat(r,"ms"):"".concat(t.DEFAULT_FADE_MS,"ms")}},{key:"fadeAnimation",value:(function(){var n=D(v().m(function r(i,o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:return i[N].opacity="0",s=typeof o=="number"?o:t.DEFAULT_FADE_MS,a.n=1,new Promise(function(l){setTimeout(function(){return l()},s)});case 1:i[N].opacity="1";case 2:return a.a(2)}},r)}));function e(r,i){return n.apply(this,arguments)}return e})()}])})();AP.DEFAULT_FADE_MS=500;var xP=AP,sz=(function(){function t(n,e,r){if(k(this,t),this.hiddenElements=new Set,this.isScrollButton=!1,this.isScrollingToBottom=!1,this._messages=n,e){var i,o={};B(e)=="object"&&(o=JSON.parse(JSON.stringify(e)),o.onUpdate=e.onUpdate),(i=o.styles)!==null&&i!==void 0||(o.styles={});var s="fit-content";o.styles.default=Je({borderRadius:"10px",width:s,height:s},o.styles.default),this.hiddenMessagesConfig=o,this.io=this.initIntersectionObserver(this._messages.elementRef)}if(r){var a,l=B(r)=="object"?JSON.parse(JSON.stringify(r)):{};(a=l.styles)!==null&&a!==void 0||(l.styles={}),l.styles.default=Je({borderRadius:"50%",width:"1.4rem",height:"1.4rem"},l.styles.default),this.scrollButtonConfig=l}this.element=this.createElement(),this._messages.elementRef.appendChild(this.element)}return M(t,[{key:"initIntersectionObserver",value:function(e){var r=this;
99return new IntersectionObserver(function(i){i.forEach(function(o){var s;o.isIntersecting&&r.hiddenElements.has(o.target)&&(r.hiddenElements.delete(o.target),(s=r.io)==null||s.unobserve(o.target),r.updateHiddenElement())})},{root:e,threshold:.1})}},{key:"createElement",value:function(){var e=this,r=U();return r.id="scroll-button",rt.assignButtonEvents(r,function(){var i,o,s,a=e.isScrollButton?(i=e.scrollButtonConfig)==null?void 0:i.smoothScroll:(o=e.hiddenMessagesConfig)==null?void 0:o.smoothScroll,l=typeof a=="boolean"?a:!0;if(e.isScrollButton||((s=e.hiddenMessagesConfig)==null?void 0:s.clickScroll)==="last")rt.scrollToBottom(e._messages,l),l&&e.element&&(t.hideElement(e.element),e.isScrollingToBottom=!0,rt.waitForScrollEnd(e._messages.elementRef,function(){e.isScrollingToBottom=!1}));else{var c=e.hiddenElements.values().next().value;c&&e._messages.elementRef.scrollTo({left:0,top:c.offsetTop,behavior:l?"smooth":"auto"})}}),Pn.apply(this._messages,r),r}},{key:"assignStyles",value:function(e){if(this.element){Object.assign(this.element[N],e[H]);var r=hn.processStateful(e);ny.add(this.element,r)}}},{key:"updateHiddenElement",value:function(){var e,r;if(this.element){this.isScrollButton=!1;var i=this.hiddenElements.size;if(i===0){t.hideElement(this.element);return}var o="".concat(i," new message").concat(i===1?"":"s");if((e=this.hiddenMessagesConfig)!=null&&e.onUpdate){var s=this.hiddenMessagesConfig.onUpdate(o,i);this.element.innerHTML=s,Pn.apply(this._messages,this.element)}else this.element.innerHTML=o;(r=this.hiddenMessagesConfig)!=null&&r.styles&&this.assignStyles(this.hiddenMessagesConfig.styles),t.displayElement(this.element)}}},{key:"updateHidden",value:function(){var e,r;if(!this.isScrollingToBottom)if(this.hiddenMessagesConfig){var i=(e=this._messages.getFirstMessageContentEl())==null?void 0:e.outerContainer;i&&!rt.isVisibleInParent(i,this._messages.elementRef)&&(this.hiddenElements.add(i),(r=this.io)==null||r.observe(i),this.updateHiddenElement())}else this.updateScroll()}},{key:"clearHidden",value:function(){var e=this;this.hiddenElements.forEach(function(r){var i;return(i=e.io)==null?void 0:i.unobserve(r)}),this.hiddenElements.clear(),this.updateHiddenElement()}},{key:"displayScroll",value:function(){var e,r;this.element&&this.element[N].opacity!==tN&&(t.displayElement(this.element),this.element.innerHTML=((e=this.scrollButtonConfig)==null?void 0:e.content)||'<span style="font-size: 1.2rem; user-select: none;">↓</span>',(r=this.scrollButtonConfig)!=null&&r.styles&&this.assignStyles(this.scrollButtonConfig.styles))}},{key:"updateScroll",value:function(){var e;this.isScrollingToBottom||!this.scrollButtonConfig||(rt.isScrollbarAtBottomOfElement(this._messages.elementRef,((e=this.scrollButtonConfig)==null?void 0:e.scrollDelta)||80)?this.element&&this.element[N].opacity!==eN&&t.hideElement(this.element):(this.displayScroll(),this.isScrollButton=!0))}}],[{key:"displayElement",value:function(e){e[N].opacity=tN,e[N].pointerEvents="auto"}},{key:"hideElement",value:function(e){e[N].opacity=eN,e[N].pointerEvents="none"}}])})(),mN="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%3e%3csvg%20fill='%23000000'%20version='1.1'%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2032%2032'%20xml:space='preserve'%3e%3cpath%20d='M23,30.36H9c-2.404,0-4.36-1.956-4.36-4.36V15c0-2.404,1.956-4.36,4.36-4.36h3.659%20c0.167-1.566,1.415-2.813,2.981-2.981V5.333c-1.131-0.174-2-1.154-2-2.333c0-1.301,1.059-2.36,2.36-2.36%20c1.302,0,2.36,1.059,2.36,2.36c0,1.179-0.869,2.159-2,2.333V7.66c1.566,0.167,2.814,1.415,2.981,2.981H23%20c2.404,0,4.36,1.956,4.36,4.36v11C27.36,28.404,25.404,30.36,23,30.36z%20M9,11.36c-2.007,0-3.64,1.633-3.64,3.64v11%20c0,2.007,1.633,3.64,3.64,3.64h14c2.007,0,3.64-1.633,3.64-3.64V15c0-2.007-1.633-3.64-3.64-3.64H9z%20M13.384,10.64h5.231%20C18.439,9.354,17.334,8.36,16,8.36C14.667,8.36,13.561,9.354,13.384,10.64z%20M16,1.36c-0.904,0-1.64,0.736-1.64,1.64%20S15.096,4.64,16,4.64c0.904,0,1.64-0.736,1.64-1.64S16.904,1.36,16,1.36z%20M20,27.36h-8c-1.301,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36h8c1.302,0,2.36,1.059,2.36,2.36S21.302,27.36,20,27.36z%20M12,23.36c-0.904,0-1.64,0.735-1.64,1.64%2
990s0.736,1.64,1.64,1.64h8c0.904,0,1.64-0.735,1.64-1.64s-0.735-1.64-1.64-1.64H12z%20M31,23.86h-2c-0.199,0-0.36-0.161-0.36-0.36V15%20c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5C31.36,23.699,31.199,23.86,31,23.86z%20M29.36,23.14h1.279v-7.78%20H29.36V23.14z%20M3,23.86H1c-0.199,0-0.36-0.161-0.36-0.36V15c0-0.199,0.161-0.36,0.36-0.36h2c0.199,0,0.36,0.161,0.36,0.36v8.5%20C3.36,23.699,3.199,23.86,3,23.86z%20M1.36,23.14h1.28v-7.78H1.36V23.14z%20M20,20.36c-1.302,0-2.36-1.059-2.36-2.36%20s1.059-2.36,2.36-2.36s2.36,1.059,2.36,2.36C22.36,19.302,21.302,20.36,20,20.36z%20M20,16.36c-0.904,0-1.64,0.736-1.64,1.64%20s0.735,1.64,1.64,1.64s1.64-0.735,1.64-1.64S20.904,16.36,20,16.36z%20M12,20.36c-1.301,0-2.36-1.059-2.36-2.36s1.059-2.36,2.36-2.36%20s2.36,1.059,2.36,2.36C14.36,19.302,13.301,20.36,12,20.36z%20M12,16.36c-0.904,0-1.64,0.736-1.64,1.64s0.736,1.64,1.64,1.64%20s1.64-0.735,1.64-1.64S12.904,16.36,12,16.36z'/%3e%3crect%20style='fill:none;'%20width='32'%20height='32'/%3e%3c/svg%3e",ES="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAMAAAC/MqoPAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////9vX18vLy/Pz86enp4+Li2tnZ1tbWzczM+fn57Ozs4N/f09LS0M/P5uXl7+/v3dzcwtncCAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAAZNSURBVHja7d3bdtsqEABQYABZSLH9/3+ZpnUsIcF5iOM6PfElNoMHMfPQdq3GmL0GkLhEUqLaUExnOtOZznSmM53pTGc605nOdKYznelMZzrTmV4LXSqllKyJDkob26xWq8Zae/iH0QoWTm9d1xur4WuypQJtTd+5dqn0VjcxzNO5/57mEBvdLo8Oron6aseWOjYOFkVvjQs3DmgyONMuht52EfztP+4hdu0i6LCO808/M8c1lE/fuPGej41uUzgdtoO/75N+2ELJ9I3b3//hPXbiMenm3pR/Jt4USgcLBIp4Bh10gqKVhvLo0klCxeSky96nKcj3siw6pJIL4XsoiQ7apyvMY/V3HHrSRioLopvEhSpTCn2TPEuwKYMOIX0tAxRBf/Hpa+lfSqBv9gi1FPsNfTrMAiVmIE/vJhz61FGnQxRIEYE4vfNYdN8Rp6MlHaHotHTn8ejekaZPAjEmyvQWdZFTtYTpXqCGJ0zvcek9Yfoel76nS0ffv1NMp1ca+pkgyfRCGind4L7OWWc605l+cxjsyhqy9AGbPpClc1/nvl5VX0c/3Alk6RU3+Am7shNZ+h6bvidLr7jBB+zKBrL0irOOudmIUDzTmf5gIP+iEuXtRuTVaEmY/oZLfyNMrzjryPc0gerMTdpVg0tvjJUU6bLPcGOoUv46SLL6Wi8yhLf06C7TUyekI0efRaaYqdFltkeNpPumRPSMDxgBYvSM035FrKAmH72hRW99PrpvSdEHkTEGUvSsK3yKVDkuJ92RohcZaehzzirPpOg+J92Tolfc4Cumx5xVXpGiZ34+ICX6W84qv5GiR5NPbiIpOv6BCoSvSkTX+eiaGP092zINvBOj4x8mSf9FqejvNo/cvpOji19ZbmviL0GPLsYMFzgzCor0+Bv/ePDvSJKOb9dJ5UlnbnEHiHgzv6cdTpJOWuc/u3FEucLDOL75xGtBiefrcwgoC9NDSH/jkH6pAuXmBqPQ9HSUPVdZBH1GGOrMXAQdYxcKZfxAoK+KKBKFLosoEoX+u4giUehz8jlcnAuhp78I46yDYNAd+QLR6K+pr+yvxdBTHyVDubQh0UfSxaHSd0lbvNkVRE87JGOtc+PQd2QLQ6fHhJkKsSh6yg13tO08JPprsgrrXWH0dJd2vH1MLPprot4eXoujpzrdhngiD40ek2y92lggPcnWa8qN1Yz0BFuvZhRl0uOfR0v4Ewuli/Bg4Qr3lArqGdndQ3UPO1EunXYwnelMZzrTmc50pjOd6UxnOtOZznSmM53pTGf6kuj6oedFKV0s3fX6sX1S3bsi6a4PD7+/YAqYeBw6pIB/4qEgOqxdSPbGiim4NRRCbzs3Jj0L4UfXtQXQVRfn5IdA/Bw7RZzurEV6EtdsLeGXkIPuA+K1UoVeA0l62zmN/LqfSSft9KkepmoRuvi3nd5uKNFB9zbbXEANqdr941XO0NJx2v2jdJenpf+/3bvn0ts16ph+sd6hX7dPo2+2cZzE02Ia43bzDHqr+2Evnhz74ZHU30ffbKOeng1/NPV30Ns1gYQnSP2P6e65Pfxc6h02XZqXQCjhJ6kPL6bFo4NrGvAU4UII4SE2P1vQuZkuOxckVfehisF1MjUddN/MZBN+kvq5uf0O/xa66gyNS9ktMWlz44rO1Z8C19i5FPdHzPamXn+F3hryPfxMr78+4F+kq22kO6Rf6fUQt+puuustyWv4rbG3l/duztFB96GYoe1cTBdXMr+nw9qVM6ZfxOvzezff0nXi/ZOndvrR6Zvpm0c3h6nhdb+5iS7tsIim/qXZD9+97/Jf+rpZ5BET1ayv0GUzLhEuhBBjIy/RdVPgndutIRt9nt7p5cKFEEJ3Z+jQFDZL+XnMDXxHB73gxn5s9Kc3d3/pFciFkN/QTSXHJpX5l66gDrkQoP6hL3xsPw39la4qOiV8tH78XeSbue6N9mvWa6J/ybpc1CT1Wnh5Qq9meP8IOKH3ddH7E/ri1iYux/SXDrXR4UiPdck/wUpU+FtPf6/orja6O9KL3l56LOvVxe5Ib2qjN0d6Vbex4ghWlU3bPqI90If66MNng680FNpbJijH6kCvaF3uMzQ3+IrpFerV4Y9dffQdN3im10ivbuImhD3Qq5u4HdZkua8znelMZ/pS4z9CPVKkxowNxgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMy0yN1QxNTo0NToxNSswMDowMN1xSg4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDMtMjdUMTU6NDU6MTUrMDA6MDCsLPKyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAABJRU5ErkJggg==",RP=(function(){function t(n){k(this,t),this.className=n}return M(t,[{key:"getAvatarContainer",value:function(e){return e.getElementsByClassName(this.className)[0]}},{key:"tryHide",value:function(e){var r;(r=this.getAvatarContainer(e)[N]).visibility||(r.visibility="hidden")}},{key:"tryReveal",value:function(e){this.getAvatarContainer(e)[N].visibility=""}},{key:"trySoftRem",value:function(e){this.getAvatarContainer(e)[S].add("role-hidden")}}])})(),az=(function(t){function n(e){var r;return k(this,n),r=K(this,n,["avatar-container"]),r._avatars=e,r}return J(n,t),M(n,[{key:"addBesideBubble",value:function(r,i){var o=typeof this._avatars=="boolean"?void 0:this._avatars,s=this.createAvatar(i,o),a=this.getPosition(i,o);s[S].add(a===_s?"start-item-position":"end-item-position"),r.insertAdjacentElement(a===_s?"beforebegin":"afterend",s)}},{key:"createAvatar",value:function(r,i){var o,s,a,l,c,u=U("img");r===et?(u[Y]=((o=i?.[et])==null?void 0:o[Y])||((s=i?.[H])==null?void 0:s[Y])||ES,u.onerror=n.errorFallback.bind(this,ES)):(u[Y]=((a=i?.[r])==null?void 0:a[Y])||((l=i?.[xt])==null?void 0:l[Y])||((c=i?.[H])==null?void 0:c[Y])||mN,u.onerror=n.errorFallback.bind(this,mN)),u[S].add("avatar"),u.alt="".concat(r," avatar");var d=U();return d[S].add(this.className),d.appendChild(u),i&&n.applyCustomStyles(d,u,i,r),d}},{key:"getPosition",value:function(r,i){var o,s,a,l,c,u,d=Wt.processPosition((s=(o=i?.[r])==null?void 0:o.styles)==null?void 0:s.position);return r!==et&&(d??(d=(l=(a=i?.ai)==null?void 0:a.styles)==null?void 0:l.position)),d??(d=(u=(c=i?.[H])==null?void 0:c.styles)==null?void 0:u.position),d??(d=r===et?iP:_s),d}}],[{key:"errorFallback",value:function(r,i){var o=i.target;o.onerror=null,o[Y]=r}},{key:"applyCustomStylesToElements",value:function(r,i,o){Object.assign(r[N],o.container),Object.assign(i[N],o.avatar)}},{key:"applyCustomStyles",value:function(r,i,o,s){var a,l,c,u;
99if((a=o[H])!=null&&a.styles&&n.applyCustomStylesToElements(r,i,o[H].styles),s===et)(l=o.user)!=null&&l.styles&&n.applyCustomStylesToElements(r,i,o.user.styles);else{(c=o.ai)!=null&&c.styles&&n.applyCustomStylesToElements(r,i,o.ai.styles);var d=(u=o[s])==null?void 0:u.styles;d&&n.applyCustomStylesToElements(r,i,d)}}}])})(RP),lz=(function(t){function n(e){var r;return k(this,n),r=K(this,n,["name"]),r._names=e,r}return J(n,t),M(n,[{key:"addBesideBubble",value:function(r,i){var o=typeof this._names=="boolean"?{}:this._names,s=this.createName(i,o),a=n.getPosition(i,o);s[S].add(a===_s?"start-item-position":"end-item-position"),r.insertAdjacentElement(a===_s?"beforebegin":"afterend",s)}},{key:"createName",value:function(r,i){var o=U();return o[S].add(this.className),o.textContent=n.getNameText(r,i),n.applyStyle(o,r,i),o}}],[{key:"getPosition",value:function(r,i){var o,s,a,l=Wt.processPosition((o=i?.[r])==null?void 0:o.position);return r!==et&&(l??(l=(s=i?.[xt])==null?void 0:s.position)),l??(l=(a=i?.[H])==null?void 0:a.position),l??(l=r===et?iP:_s),l}},{key:"applyStyle",value:function(r,i,o){var s,a,l,c;Object.assign(r[N],(s=o[H])==null?void 0:s[N]),i===et?Object.assign(r[N],(a=o[et])==null?void 0:a[N]):(Object.assign(r[N],(l=o[xt])==null?void 0:l[N]),Object.assign(r[N],(c=o[i])==null?void 0:c[N]))}},{key:"getNameText",value:function(r,i){var o,s,a,l,c,u;return r===et?((o=i[et])==null?void 0:o[b])||((s=i[H])==null?void 0:s[b])||"User":r===xt?((a=i[xt])==null?void 0:a[b])||((l=i[H])==null?void 0:l[b])||"AI":((c=i[r])==null?void 0:c[b])||((u=i[H])==null?void 0:u[b])||r}}])})(RP),zv=(function(){function t(n){var e=this;k(this,t);var r,i,o,s;this.messageElementRefs=[],this.htmlClassUtilities={},this.messageToElements=[],this.maxVisibleMessages=4e3,this.autoScrollAllowed=!0,this.elementRef=t.createContainerElement(),this.messageStyles=Wt.processMessageStyles(n.messageStyles),this._remarkable=wS.createNew(n.remarkable),this._applyHTMLToRemarkable=(r=n.remarkable)==null?void 0:r.applyHTML,n.avatars&&(this.avatar=new az(n.avatars)),n.names&&(this.name=new lz(n.names)),n.browserStorage&&(this.browserStorage=new oz(n.browserStorage)),this._onMessage=ol.onMessage.bind(this,n),n.htmlClassUtilities&&(this.htmlClassUtilities=n.htmlClassUtilities),(n.hiddenMessages||n.scrollButton)&&(this.scrollButton=new sz(this,n.hiddenMessages,n.scrollButton)),this.focusMode=Wt.processFocusMode(n.focusMode),this.focusMode||(this._lastGroupMessagesElement=U(),this.elementRef.appendChild(this._lastGroupMessagesElement),n.upwardsMode&&(this.elementRef=this._lastGroupMessagesElement)),typeof this.focusMode!="boolean"&&(i=this.focusMode)!=null&&i.fade&&xP.setFade(this.elementRef,this.focusMode.fade),this._customWrappers=n.htmlWrappers||Wt.processStreamHTMLWrappers((o=n.connect)==null?void 0:o.stream),typeof this.focusMode!="boolean"&&((s=this.focusMode)==null?void 0:s.streamAutoScroll)===!1&&(this.autoScrollAllowed=!1),n.maxVisibleMessages&&(this.maxVisibleMessages=n.maxVisibleMessages),setTimeout(function(){e.submitUserMessage=n.submitUserMessage})}return M(t,[{key:"addNewTextMessage",value:function(e,r,i){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(i!=null&&i.status){var s=this.overwriteText(r,e,this.messageElementRefs);if(s)return s;i.status=!1}var a=o?this.createAndPrependNewMessageElement(e,r,o):this.createAndAppendNewMessageElement(e,r);return a.bubbleElement[S].add(t.TEXT_BUBBLE_CLASS),this.applyCustomStyles(a,r,!1),Lt.fillEmptyMessageElement(a.bubbleElement,e),a}},{key:"overwriteText",value:function(e,r,i){var o=Lt.overwriteMessage(this.messageToElements,i,r,e,"text",t.TEXT_BUBBLE_CLASS);return o&&this.renderText(o.bubbleElement,r,e),o}},{key:"createAndAppendNewMessageElement",value:function(e,r){var i=this.createNewMessageElement(e,r);return this.appendOuterContainerElemet(i.outerContainer,this.focusMode?r:void 0),i}},{key:"createNewGroupElementFocusMode",value:function(){var e;(e=this._lastGroupMessagesElement)==null||e[S].remove(t.LAST_GROUP_MESSAGES_ACTIVE);var r=U();(this.messageToElements.length>1||this.messageToElements.length===1&&this.messageToElements[0][0].role!==et)&&r[S].add(t.LAST_GROUP_MESSAGES_ACTIVE),this._lastGroupMessagesElement=r}},{key:"appendOuterContainerElemet",value:function(e,r){var i;this.focusMode&&(r===et||!this._lastGroupMessagesElement)&&this.createNewGroupElementFocusMode(),(i=this._lastGroupMessagesElement)==null||i.appendChild(e),this._lastGroupMessagesElement&&(this.focusMode||!this.elementRef.contains(this._lastGroupMessagesElement))&&this.elementRef.appendChild(this._lastGroupMessagesElement)}},{key:"createAndPrependNewMessageElement",value:function(e,r,i){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s,a=this.createNewMessageElement(e,r,i,o);if(i&&(s=this.elementRef.firstChild)!=null&&s[S].contains(t.INTRO_CLASS)){this.elementRef.firstChild.insertAdjacentElement("afterend",a.outerContainer);var l=this.messageElementRefs[0];this.messageElementRefs[0]=this.messageElementRefs[1],this.messageElementRefs[1]=l}else this.elementRef.insertBefore(a.outerContainer,this.elementRef.firstChild);return a}},{key:"createMessageElementsOnOrientation",value:function(e,r,i){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return i?this.createAndPrependNewMessageElement(e,r,i,o):this.createNewMessageElement(e,r,i,o)}},{key:"getNumberOfContentMessages",value:function(){var e,r,i=this.messageElementRefs.length;return(r=(e=this.messageElementRefs[i-1])==null?void 0:e.bubbleElement)!=null&&r[S].contains(vs.BUBBLE_CLASS)?i-1:i}},{key:"createNewMessageElement",value:function(e,r){var i=this,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a;!s&&this.getNumberOfContentMessages()>=this.maxVisibleMessages&&setTimeout(function(){return i.removeFirstMessage()}),s||(a=this._introPanel)==null||a.hide();var l=this.messageElementRefs[this.messageElementRefs.length-1];return Qa.changeFullViewToSmall(this),!o&&t.isTemporaryElement(l)&&(this.revealRoleElementsIfTempRemoved(l,r),this.removeLastMessage()),this.createMessageElements(e,r,o)}},{key:"revealRoleElementsIfTempRemoved",value:function(e,r){if((this.avatar||this.name)&&Zc.isElementTemporary(e)){var i=this.messageElementRefs[this.messageElementRefs.length-2];i&&this.messageToElements.length>0&&!e.bubbleElement[S].contains(Lt.getRoleClass(r))&&Lt.revealRoleElements(i.innerContainer,this.avatar,this.name)}}},{key:"createElements",value:function(e,r){var i=t.createBaseElements(r),o=i.outerContainer,s=i.innerContainer,a=i.bubbleElement;return o.appendChild(s),this.addInnerContainerElements(a,e,r),i}},{key:"createMessageElements",value:function(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=this.createElements(e,r);return Lt.updateRefArr(this.messageElementRefs,o,i),Lt.classifyRoleMessages(this.messageElementRefs,r),o}},{key:"addInnerContainerElements",value:function(e,r,i){var o=this.messageElementRefs[this.messageElementRefs.length-1];return Lt.areOuterContainerClassRolesSame(i,o)&&!this.isLastMessageError()&&Lt.hideRoleElements(o.innerContainer,this.avatar,this.name),e[S].add("message-bubble",Lt.getRoleClass(i),i===et?"user-message-text":"ai-message-text"),this.renderText(e,r,i),Lt.addRoleElements(e,i,this.avatar,this.name),{bubbleElement:e}}},{key:"applyCustomStyles",value:function(e,r,i,o){e&&this.messageStyles&&Hv.applyCustomStyles(this.messageStyles,e,r,i,o)}},{key:"removeMessage",value:function(e){e.outerContainer.remove();var r=this.messageElementRefs.findIndex(function(i){return i===e});this.messageElementRefs.splice(r,1)}},{key:"removeFirstMessage",value:function(){this.messageElementRefs[0].outerContainer.remove(),this.messageElementRefs.shift()}},{key:"removeLastMessage",value:function(){this.messageElementRefs[this.messageElementRefs.length-1].outerContainer.remove(),this.messageElementRefs.pop()}},{key:"isLastMessageError",value:function(){var e;return(e=Lt.getLastMessageBubbleElement(this.elementRef))==null?void 0:e[S].contains(Yv)}},{key:"sendClientUpdate",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i;(i=this._onMessage)==null||i.call(this,e,r)}},{key:"renderText",value:function(e,r,i){var o=Pn.tryAddWrapper(e,r,this._customWrappers,i),s=o.contentEl,a=o.wrapper;a&&Pn.apply(this,e),s.innerHTML=this._remarkable.render(r),this._applyHTMLToRemarkable&&Pn.apply(this,s),s.innerText.trim().length===0&&s.children.length>0&&s.children[0].tagName!=="P"&&(s.innerText=r)}},{key:"refreshTextMessages",value:function(e){var r=this;
99this._remarkable=wS.createNew(e),this.messageToElements.forEach(function(i){i[1][b]&&i[0][b]&&r.renderText(i[1][b].bubbleElement,i[0][b],i[0].role)})}},{key:"getFirstMessageContentEl",value:function(){var e=this.messageToElements[this.messageToElements.length-1][1],r=e.text,i=e.html,o=e.files;return r||i||o?.[0]}},{key:"scrollToFirstElement",value:function(e,r){var i;if(e===et){var o=typeof this.focusMode!="boolean"&&((i=this.focusMode)==null?void 0:i.smoothScroll);rt.scrollToBottom(this,o)}else if(r&&this.autoScrollAllowed){var s=this.getFirstMessageContentEl();rt.scrollToBottom(this,!1,s?.outerContainer)}}}],[{key:"createContainerElement",value:function(){var e=U();return e.id=oP,e}},{key:"isTemporaryElement",value:function(e){return t.isLoadingMessage(e)||Zc.isElementTemporary(e)}},{key:"createBaseElements",value:function(e){var r=U(),i=U();i[S].add("inner-message-container"),r.appendChild(i),r[S].add("outer-message-container"),r[S].add(Lt.buildRoleOuterContainerClass(e));var o=U();return o[S].add("message-bubble"),i.appendChild(o),{outerContainer:r,innerContainer:i,bubbleElement:o}}},{key:"createMessageContent",value:function(e){var r=e.text,i=e.files,o=e.html,s=e.custom,a=e._sessionId,l=e.role,c={role:l||xt};return r&&(c[b]=r),i&&(c[x]=i),o&&(c[ke]=o),!r&&!i&&!o&&(c[b]=""),s&&(c.custom=s),a&&(c._sessionId=a),c}},{key:"isLoadingMessage",value:function(e){return e?.bubbleElement[S].contains(vs.BUBBLE_CLASS)}}])})();zv.TEXT_BUBBLE_CLASS="text-message",zv.INTRO_CLASS="deep-chat-intro",zv.LAST_GROUP_MESSAGES_ACTIVE="deep-chat-last-group-messages-active";var Xi=zv,Lt=(function(){function t(){k(this,t)}return M(t,null,[{key:"getLastElementsByClass",value:function(e,r,i){for(var o=function(){var c=e[a];if(c.bubbleElement[S].contains(r[0])&&!r.slice(1).find(function(u){return!c.bubbleElement[S].contains(u)}))if(i){if(!i.find(function(u){return c.bubbleElement[S].contains(u)}))return{v:c}}else return{v:c}},s,a=e.length-1;a>=0;a-=1)if(s=o(),s)return s.v}},{key:"getLastMessage",value:function(e,r,i){for(var o=e.length-1;o>=0;o-=1)if(e[o][0].role===r)if(i){if(e[o][0][i])return e[o][0]}else return e[o][0]}},{key:"getLastTextToElement",value:function(e,r){for(var i=e.length-1;i>=0;i-=1)if(e[i][0]===r)return e[i]}},{key:"overwriteMessage",value:function(e,r,i,o,s,a){var l=t.getLastElementsByClass(r,[t.getRoleClass(o),a],[vs.BUBBLE_CLASS]),c=t.getLastMessage(e,o,s);return c&&(c[s]=i),l}},{key:"getRoleClass",value:function(e){return"".concat(e,"-message")}},{key:"fillEmptyMessageElement",value:function(e,r){r.trim().length===0&&(e[S].add(XO),e.innerHTML='<div style="color:#00000000">.</div>')}},{key:"unfillEmptyMessageElement",value:function(e,r){e[S].contains(XO)&&r.trim().length>0&&e.replaceChildren()}},{key:"getLastMessageBubbleElement",value:function(e){var r,i,o;return Array.from(((o=(i=(r=t.getLastMessageElement(e))==null?void 0:r.children)==null?void 0:i[0])==null?void 0:o.children)||[]).find(function(s){return s[S].contains("message-bubble")})}},{key:"getLastMessageElement",value:function(e){var r,i=(r=e.children[e.children.length-1])==null?void 0:r.children;return i?.[i.length-1]}},{key:"addRoleElements",value:function(e,r,i,o){i?.addBesideBubble(e,r),o?.addBesideBubble(e,r)}},{key:"hideRoleElements",value:function(e,r,i){r?.tryHide(e),i?.tryHide(e)}},{key:"revealRoleElements",value:function(e,r,i){r?.tryReveal(e),i?.tryReveal(e)}},{key:"softRemRoleElements",value:function(e,r,i){r?.trySoftRem(e),i?.trySoftRem(e)}},{key:"updateRefArr",value:function(e,r,i){i?e.unshift(r):e.push(r)}},{key:"buildRoleOuterContainerClass",value:function(e){return"".concat(xv).concat(e)}},{key:"addNewPositionClasses",value:function(e,r){var i;e.outerContainer[S].remove(iS,QO,oS),(i=e.outerContainer[S]).add.apply(i,Za(r))}},{key:"getNumberOfElements",value:function(e){var r=0;return e[b]!==void 0&&(r+=1),e[ke]!==void 0&&(r+=1),e[x]&&(r+=e[x].length),r}},{key:"filterdMessageElements",value:function(e,r){return e.filter(function(i){return i.bubbleElement[S].contains(r)})}},{key:"findMessageElements",value:function(e,r){return e.find(function(i){return i.bubbleElement[S].contains(r)})}},{key:"generateMessageBodyElements",value:function(e,r){var i={};return e[b]&&(i[b]=t.findMessageElements(r,Xi.TEXT_BUBBLE_CLASS)),e[ke]&&(i[ke]=t.findMessageElements(r,bs.HTML_BUBBLE_CLASS)),e[x]&&(i[x]=t.filterdMessageElements(r,rP)),i}},{key:"generateMessageBody",value:function(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=t.getNumberOfElements(e),s=i?r.slice(0,o):r.slice(r.length-o);return t.generateMessageBodyElements(e,s)}},{key:"classifyRoleMessages",value:function(e,r){for(var i=r?t.buildRoleOuterContainerClass(r):void 0,o=e.length-1;o>=0;o-=1)if(r||(i=Array.from(e[o].outerContainer[S]).find(function(f){return f.startsWith(xv)})),!!i){var s=e[o],a=s.outerContainer[S].contains(i),l=e[o-1],c=e[o+1],u=l?.outerContainer[S].contains(i),d=c?.outerContainer[S].contains(i);if(a)!u&&d?t.addNewPositionClasses(s,[iS]):u&&d?t.addNewPositionClasses(s,[QO]):u&&!d?t.addNewPositionClasses(s,[oS]):!u&&!d&&t.addNewPositionClasses(s,[iS,oS]);else if(r)break}}},{key:"areOuterContainerClassRolesSame",value:function(e,r){return r?Array.from(r.outerContainer[S]).find(function(i){return i.startsWith(xv)})===t.buildRoleOuterContainerClass(e):!1}
99},{key:"resetAllRoleElements",value:function(e,r,i){if(!(!r&&!i)){var o="";e.forEach(function(s,a){s.bubbleElement[S].contains(Yv)||t.revealRoleElements(s.innerContainer,r,i);var l=Array.from(s.outerContainer[S]).find(function(c){return c.startsWith(xv)});o===l&&t.hideRoleElements(e[a-1].innerContainer,r,i),o=l})}}},{key:"deepCloneMessagesWithReferences",value:function(e){return e.map(function(r){return t.processMessageContent(r)})}},{key:"processMessageContent",value:function(e){if(e==null||B(e)!==ze)return e;if(Array.isArray(e))return e.map(function(i){return t.processMessageContent(i)});var r={};return Object.entries(e).forEach(function(i){var o=el(i,2),s=o[0],a=o[1];s==="ref"&&a instanceof File||s==="custom"?r[s]=a:a!==null&&B(a)===ze?r[s]=t.processMessageContent(a):r[s]=a}),r}}])})(),CS=(function(){function t(n,e){k(this,t),this._fileAdded=!1,this._streamType="",this._hasStreamEnded=!1,this._partialContent="",this._messages=n,B(e)=="object"&&(this._partialRender=e.partialRender)}return M(t,[{key:"upsertStreamedMessage",value:function(e){if(!this._hasStreamEnded){if(e?.[b]===void 0&&e?.[ke]===void 0)return console[E](aP);var r=e?.[b]||e?.[ke]||"",i=rt.isScrollbarAtBottomOfElement(this._messages.elementRef),o=e?.[b]!==void 0?b:ke;if(!this._elements&&!this._message)this.setInitialState(o,r,e?.role);else{if(this._streamType!==o)return console[E](p$);e!=null&&e.role&&e?.role!==this._activeMessageRole?(this.finaliseStreamedMessage(!1),this.setInitialState(o,r,e?.role)):this.updateBasedOnType(r,o,e?.overwrite)}e!=null&&e._sessionId&&(this._sessionId=e?._sessionId),e!=null&&e.custom&&this._message&&(this._message.custom=e.custom),i&&rt.scrollToBottom(this._messages)}}},{key:"setInitialState",value:function(e,r,i){var o,s,a;this._streamType=e,this._targetWrapper=void 0,this._fileAdded=!1,this._partialContent="",this._partialBubble=void 0,i??(i=xt);var l=((o=this._messages._customWrappers)==null?void 0:o[i])||((s=this._messages._customWrappers)==null?void 0:s[H]),c=l?"":r;this._elements=e===b?this._messages.addNewTextMessage(c,i):bs.add(this._messages,c,i),this._elements&&(this._elements.bubbleElement[S].add(t.MESSAGE_CLASS),this._activeMessageRole=i,this._message=_({role:this._activeMessageRole},e,c),this._messages.messageToElements.push([this._message,_({},e,this._elements)]),l&&this.setTargetWrapperIfNeeded(this._elements,r,this._streamType,l),(a=this._messages.scrollButton)==null||a.updateHidden())}},{key:"setTargetWrapperIfNeeded",value:function(e,r,i,o){e.bubbleElement.innerHTML=o,this._targetWrapper=Pn.getTargetWrapper(e.bubbleElement),this._elements&&Pn.apply(this._messages,this._elements.bubbleElement),this.updateBasedOnType(r,i)}},{key:"updateBasedOnType",value:function(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o,s=this._targetWrapper||((o=this._elements)==null?void 0:o.bubbleElement);this._partialRender||Lt.unfillEmptyMessageElement(s,e),(r===b?this.updateText:this.updateHTML).bind(this)(e,s,i)}},{key:"updateText",value:function(e,r,i){this._message&&(this._message[b]=i?e:this._message[b]+e,this._partialRender&&this.isNewPartialRenderParagraph(r,i)&&this.partialRenderNewParagraph(r),this._partialBubble?this.updatePartialRenderBubble(e):this._messages.renderText(r,this._message[b]))}},{key:"containsPartialRenderMark",value:function(e){var r=e.indexOf(t.PARTIAL_RENDER_MARK);return r===-1?!1:!e.substring(r+t.PARTIAL_RENDER_MARK.length).startsWith("---")}},{key:"isNewPartialRenderParagraph",value:function(e,r){var i;if(r)return e.innerHTML="",!0;var o=this._streamType;if(!this._partialBubble){var s=(i=this._message)==null?void 0:i[o];return!!s&&this.containsPartialRenderMark(s)}return!!this._partialContent&&this.containsPartialRenderMark(this._partialContent)}},{key:"partialRenderNewParagraph",value:function(e){this._partialContent="",this._partialBubble=U(),this._partialBubble[S].add("partial-render-message"),e.appendChild(this._partialBubble)}},{key:"updatePartialRenderBubble",value:function(e){this._partialContent+=e,this._streamType===b?this._messages.renderText(this._partialBubble,this._partialContent):this._partialBubble.innerHTML=this._partialContent}},{key:"updateHTML",value:function(e,r,i){if(this._message)if(this._message[ke]=i?e:(this._message[ke]||"")+e,this._partialRender&&this.isNewPartialRenderParagraph(r,i)&&this.partialRenderNewParagraph(r),this._partialBubble)this.updatePartialRenderBubble(e);else if(i)r.innerHTML=e;else{var o=U("span");o.innerHTML=e,r.appendChild(o)}}},{key:"finaliseStreamedMessage",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r,i;if(!(this._endStreamAfterOperation||!this._message)&&!(this._fileAdded&&!this._elements)){if(!this._elements)throw Error(m$);(r=this._elements.bubbleElement)!=null&&r[S].contains(t.MESSAGE_CLASS)&&(this._streamType===b?this._messages.textToSpeech&&Uv.speak(this._message[b]||"",this._messages.textToSpeech):this._streamType===ke&&this._elements&&Pn.apply(this._messages,this._elements.outerContainer),this._elements.bubbleElement[S].remove(t.MESSAGE_CLASS),this._message&&(this._sessionId&&(this._message._sessionId=this._sessionId),this._messages.sendClientUpdate(Xi.createMessageContent(this._message),!1),(i=this._messages.browserStorage)==null||i.addMessages(this._messages.messageToElements.map(function(o){var s=el(o,1),a=s[0];return a}))),this._hasStreamEnded=e)}}},{key:"markFileAdded",value:function(){this._fileAdded=!0}},{key:"endStreamAfterFileDownloaded",value:(function(){var n=D(v().m(function r(i,o){var s,a,l;return v().w(function(c){for(;;)switch(c.n){case 0:return this._endStreamAfterOperation=!0,c.n=1,o();case 1:s=c.v,a=s.text,l=s.files,a&&this.updateBasedOnType(a,b,!0),this._endStreamAfterOperation=!1,this.finaliseStreamedMessage(),l&&i.addNewMessage(_({},x,l));case 2:return c.a(2)}},r,this)}));function e(r,i){return n.apply(this,arguments)}return e})()}])})();CS.MESSAGE_CLASS="streamed-message",CS.PARTIAL_RENDER_MARK=` 100 101`;var To=CS,Ue=(function(){function t(){k(this,t)}return M(t,null,[{key:"tempRemoveContentHeader",value:(function(){var n=D(v().m(function r(i,o,s){var a,l,c;return v().w(function(u){for(;;)switch(u.p=u.n){case 0:if(i!=null&&i.headers){u.n=1;break}throw new Error(sr);case 1:return a=i.headers[Ze],delete i.headers[Ze],u.p=2,u.n=3,o(s);case 3:l=u.v,u.n=5;break;case 4:throw u.p=4,c=u.v,i.headers[Ze]=a,c;case 5:return u.a(2,(i.headers[Ze]=a,l))}},r,null,[[2,4]])}));function e(r,i,o){return n.apply(this,arguments)}return e})()},{key:"displayError",value:function(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"Service error, please try again.";
101if(console[E](r),B(r)===ze)return r instanceof Error?e.addNewErrorMessage(jt,r.message):Array.isArray(r)||typeof r[E]=="string"?e.addNewErrorMessage(jt,r):Object.keys(r).length===0?e.addNewErrorMessage(jt,i):e.addNewErrorMessage(jt,JSON.stringify(r));e.addNewErrorMessage(jt,r)}},{key:"fetch",value:(function(n){function e(r,i,o,s){return n.apply(this,arguments)}return e.toString=function(){return n.toString()},e})(function(n,e,r,i){var o,s,a={method:((o=n.connectSettings)==null?void 0:o.method)||fn,headers:e};return a.method!==Qt&&(a.body=r?JSON.stringify(i):i),n.connectSettings.credentials&&(a.credentials=n.connectSettings.credentials),fetch(((s=n.connectSettings)==null?void 0:s.url)||n.url||"",a)})},{key:"processResponseByType",value:function(e){var r=e.headers.get("content-type");return r!=null&&r.includes(Ct)?e.json():r!=null&&r.includes("text/plain")||!r?e:e.blob()}},{key:"processRequestInterceptor",value:(function(){var n=D(v().m(function r(i,o){var s,a,l,c,u;return v().w(function(d){for(;;)switch(d.n){case 0:return d.n=1,(s=i.requestInterceptor)==null?void 0:s.call(i,o);case 1:if(u=d.v,u){d.n=2;break}u=o;case 2:return a=u,l=a,c=a,d.a(2,{body:l.body,headers:l.headers,error:c[E]})}},r)}));function e(r,i){return n.apply(this,arguments)}return e})()},{key:"validateResponseFormat",value:function(e,r){if(!e)return!1;var i=Array.isArray(e)?e:[e];return r&&i.length>1?(console[E](sP),!1):!i.find(function(o){return B(o)!="object"||!(typeof o[E]=="string"||typeof o[b]=="string"||typeof o[ke]=="string"||Array.isArray(o[x]))})}},{key:"onInterceptorError",value:function(e,r,i){e.addNewErrorMessage(jt,r),i?.()}},{key:"basicResponseProcessing",value:(function(){var n=D(v().m(function r(i,o){var s,a,l,c,u,d,f,h,p,m,g=arguments,w;return v().w(function(C){for(;;)switch(C.n){case 0:if(s=g.length>2&&g[2]!==void 0?g[2]:{},a=s.io,l=s.displayError,c=l===void 0?!0:l,u=s.useRI,d=u===void 0?!0:u,a!=null&&a.extractResultData){C.n=1;break}return C.a(2,o);case 1:return f=d?a.deepChat.responseInterceptor:void 0,C.n=2,f?.(o);case 2:if(w=C.v,w){C.n=3;break}w=o;case 3:return h=w,C.n=4,a.extractResultData(h);case 4:if(p=C.v,!(!p||B(p)!="object"&&!Array.isArray(p))){C.n=5;break}return c&&(m=Yc(o,"response",!!f,h),t.displayError(i,m)),C.a(2);case 5:return C.a(2,p)}},r)}));function e(r,i){return n.apply(this,arguments)}return e})()}])})();function cz(t,n){return SS.apply(this,arguments)}function SS(){return SS=D(v().m(function t(n,e){var r,i;return v().w(function(o){for(;;)switch(o.n){case 0:r=n.getReader();case 1:return o.n=2,r.read();case 2:if((i=o.v).done){o.n=4;break}e(i.value);case 3:o.n=1;break;case 4:return o.a(2)}},t)})),SS.apply(this,arguments)}function uz(t){var n,e,r,i=!1;return function(o){n===void 0?(n=o,e=0,r=-1):n=hz(n,o);for(var s=n.length,a=0;e<s;){i&&(n[e]===10&&(a=++e),i=!1);for(var l=-1;e<s&&l===-1;++e)switch(n[e]){case 58:r===-1&&(r=e-a);break;case 13:i=!0;case 10:l=e;break}if(l===-1)break;t(n.subarray(a,l),r),a=e,r=-1}a===s?n=void 0:a!==0&&(n=n.subarray(a),e-=a)}}function dz(t,n,e){var r=gN(),i=new TextDecoder;return function(o,s){if(o.length===0)e?.(r),r=gN();else if(s>0){var a=i.decode(o.subarray(0,s)),l=s+(o[s+1]===32?2:1),c=i.decode(o.subarray(l));switch(a){case"data":r.data=r.data?r.data+` 102`+c:c;break;case"event":r.event=c;break;case"id":t(r.id=c);break;case"retry":var u=parseInt(c,10);isNaN(u)||n(r.retry=u);break}}}}function hz(t,n){var e=new Uint8Array(t.length+n.length);return e.set(t),e.set(n,t.length),e}function gN(){return{data:"",event:"",id:"",retry:void 0}}var fz=function(n,e){var r={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(r[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(n);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(n,i[o])&&(r[i[o]]=n[i[o]]);return r},DS="text/event-stream",pz=1e3,vN="last-event-id";function mz(t,n){var e=n.signal,r=n.headers,i=n.onopen,o=n.onmessage,s=n.onclose,a=n.onerror,l=n.openWhenHidden,c=n.fetch,u=fz(n,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise(function(d,f){var h=Object.assign({},r);h.accept||(h.accept=DS);var p;function m(){p.abort(),document.hidden||F()}l||document.addEventListener("visibilitychange",m);var g=pz,w=0;function C(){document.removeEventListener("visibilitychange",m),window.clearTimeout(w),p.abort()}e?.addEventListener("abort",function(){C(),d()});var T=c??window.fetch,I=i??gz;function F(){return $.apply(this,arguments)}function $(){return $=D(v().m(function q(){var G,lt,De,qe;return v().w(function(se){for(;;)switch(se.p=se.n){case 0:return p=new AbortController,se.p=1,se.n=2,T(t,Object.assign(Object.assign({},u),{headers:h,signal:p.signal}));case 2:return lt=se.v,se.n=3,I(lt);
102case 3:return se.n=4,cz(lt.body,uz(dz(function(mn){mn?h[vN]=mn:delete h[vN]},function(mn){g=mn},o)));case 4:s?.(),C(),d(),se.n=6;break;case 5:if(se.p=5,qe=se.v,!p.signal.aborted)try{De=(G=a?.(qe))!==null&&G!==void 0?G:g,window.clearTimeout(w),w=window.setTimeout(F,De)}catch(mn){C(),f(mn)}case 6:return se.a(2)}},q,null,[[1,5]])})),$.apply(this,arguments)}F()})}function gz(t){var n=t.headers.get("content-type");if(!(n!=null&&n.startsWith(DS)))throw new Error("Expected content-type to be ".concat(DS,", Actual: ").concat(n))}var rn=(function(){function t(){k(this,t)}return M(t,null,[{key:"request",value:(function(){var n=D(v().m(function r(i,o,s){var a,l,c,u,d,f,h,p,m,g,w,C,T,I,F=arguments;return v().w(function($){for(;;)switch($.n){case 0:return a=F.length>3&&F[3]!==void 0?F[3]:!0,l=F.length>4&&F[4]!==void 0?F[4]:!1,p={body:o,headers:(c=i.connectSettings)==null?void 0:c.headers},$.n=1,Ue.processRequestInterceptor(i.deepChat,p);case 1:if(m=$.v,g=m.body,w=m.headers,C=m.error,!C){$.n=2;break}return $.a(2,Ue.onInterceptorError(s,C,i.streamHandlers.onClose));case 2:if(!((u=i.connectSettings)!=null&&u.handler)){$.n=3;break}return $.a(2,qS.stream(i,g,s));case 3:if(((d=i.connectSettings)==null?void 0:d.url)!==Ao.URL){$.n=4;break}return $.a(2,Ao.requestStream(s,i));case 4:return T=new To(s,i.stream),I={method:((f=i.connectSettings)==null?void 0:f.method)||fn,headers:w,credentials:(h=i.connectSettings)==null?void 0:h.credentials,body:a?JSON.stringify(g):g},$.a(2,(B(i.stream)=="object"&&i.stream.readable?t.handleReadableStream(i,s,T,I,l,g):t.handleEventStream(i,s,T,I,l,g),T))}},r)}));function e(r,i,o){return n.apply(this,arguments)}return e})()},{key:"handleReadableStream",value:function(e,r,i,o,s,a){var l,c=e.streamHandlers,u=c.onOpen,d=c.onClose,f=!1;fetch(((l=e.connectSettings)==null?void 0:l.url)||e.url||"",o).then((function(){var h=D(v().m(function p(m){var g,w,C,T,I,F,$,q,G,lt,De,qe;return v().w(function(se){for(;;)switch(se.n){case 0:if(m.body){se.n=1;break}throw new Error(g$);case 1:C=m.body.getReader(),T=new TextDecoder,u(),I=!1;case 2:if(!(!I&&!f)){se.n=8;break}return se.n=3,C.read();case 3:if(F=se.v,$=F.value,q=F.done,I=q,!I){se.n=4;break}t.handleClose(e,i,d,s),se.n=7;break;case 4:return G=T.decode($,{stream:!0}),se.n=5,(w=(g=e.deepChat).responseInterceptor)==null?void 0:w.call(g,G);case 5:if(qe=se.v,qe){se.n=6;break}qe=G;case 6:lt=qe,De=B(lt)=="object"?lt:_({},b,G),t.handleMessage(e,r,i,De,a);case 7:se.n=2;break;case 8:return se.a(2)}},p)}));return function(p){return h.apply(this,arguments)}})()).catch(function(h){t.handleError(e,r,h)}),e.streamHandlers.onAbort=function(){i.finaliseStreamedMessage(),e.streamHandlers.onClose(),f=!0}}},{key:"handleEventStream",value:function(e,r,i,o,s,a){var l,c=e.streamHandlers,u=c.onOpen,d=c.onClose,f=new AbortController;e.streamHandlers.onAbort=function(){i.finaliseStreamedMessage(),e.streamHandlers.onClose(),f.abort()},mz(((l=e.connectSettings)==null?void 0:l.url)||e.url||"",Je(Je({},o),{},{openWhenHidden:!0,onopen:function(p){return D(v().m(function m(){return v().w(function(g){for(;;)switch(g.n){case 0:if(!p.ok){g.n=1;break}return g.a(2,u());case 1:return g.n=2,Ue.processResponseByType(p);case 2:throw g.v;case 3:return g.a(2)}},m)}))()},onmessage:function(p){return D(v().m(function m(){var g,w,C,T,I;return v().w(function(F){for(;;)switch(F.n){case 0:if(JSON.stringify(p.data)===JSON.stringify("[DONE]")){F.n=3;break}try{C=JSON.parse(p.data)}catch{C={}}return F.n=1,(w=(g=e.deepChat).responseInterceptor)==null?void 0:w.call(g,C);case 1:if(I=F.v,I){F.n=2;break}I=C;case 2:T=I,t.handleMessage(e,r,i,T,a);case 3:return F.a(2)}},m)}))()},onerror:function(p){throw d(),p},onclose:function(){t.handleClose(e,i,d,s)},signal:f.signal})).catch(function(h){t.handleError(e,r,h)})}},{key:"handleMessage",value:function(e,r,i,o,s){var a;(a=e.extractResultData)==null||a.call(e,o,s).then(function(l){t.upsertContent(r,i.upsertStreamedMessage.bind(i),i,l),r.removeError()}).catch(function(l){r.isLastMessageError()||Ue.displayError(r,l)})}},{key:"handleError",value:function(e,r,i){var o;r.isLastMessageError()||(o=e.extractResultData)==null||o.call(e,i).then(function(){Ue.dis
102playError(r,i)}).catch(function(s){Ue.displayError(r,s)})}},{key:"handleClose",value:function(e,r,i,o){if(e.asyncCallInProgress){e.asyncCallInProgress=!1;return}try{r.finaliseStreamedMessage(),i()}catch(s){if(!o)throw s}}},{key:"simulate",value:(function(){var n=D(v().m(function r(i,o,s,a){var l,c,u,d,f;return v().w(function(h){for(;;)switch(h.n){case 0:return h.n=1,Ue.basicResponseProcessing(i,s,{io:a,useRI:!1});case 1:if(h.v){h.n=2;break}return h.a(2,o.onClose());case 2:if(Array.isArray(s)&&(s=s[0]),s[ke]&&(o.onOpen(),l=Pn.splitHTML(s[ke]),l.length===0&&(l=s[ke].split("")),c=new To(i,a?.stream),t.populateMessages(i,l,c,o,ke,0,a)),!s[x]){h.n=4;break}return h.n=3,Ue.basicResponseProcessing(i,_({},x,s[x]),{io:a});case 3:u=h.v,i.addNewMessage(Je({sendUpdate:!1},u)),!s[ke]&&!s[b]&&(new To(i,a?.stream).finaliseStreamedMessage(),o.onClose());case 4:s[b]&&(o.onOpen(),d=s[b].split(""),f=new To(i,a?.stream),t.populateMessages(i,d,f,o,b,0,a)),s[E]&&(Ue.displayError(i,s[E]),o.onClose()),o.onAbort=function(){o.onClose()};case 5:return h.a(2)}},r)}));function e(r,i,o,s){return n.apply(this,arguments)}return e})()},{key:"populateMessages",value:(function(){var n=D(v().m(function r(i,o,s,a,l,c,u){var d,f,h,p;return v().w(function(m){for(;;)switch(m.p=m.n){case 0:if(d=o[c],!d){m.n=5;break}return m.p=1,m.n=2,Ue.basicResponseProcessing(i,_({},l,d),{io:u});case 2:f=m.v,t.upsertContent(i,s.upsertStreamedMessage.bind(s),s,f),i.removeError(),m.n=4;break;case 3:m.p=3,p=m.v,i.isLastMessageError()||Ue.displayError(i,p);case 4:h=setTimeout(function(){t.populateMessages(i,o,s,a,l,c+1,u)},a.simulationInterim||6),a.onAbort=function(){t.abort(h,s,a.onClose)},m.n=6;break;case 5:s.finaliseStreamedMessage(),a.onClose();case 6:return m.a(2)}},r,null,[[1,3]])}));function e(r,i,o,s,a,l,c){return n.apply(this,arguments)}return e})()},{key:"isSimulation",value:function(e){return B(e)=="object"&&!!e.simulation}},{key:"isSimulatable",value:function(e,r){return t.isSimulation(e)&&r&&(r[b]||r[ke])}},{key:"abort",value:function(e,r,i){clearTimeout(e),r.finaliseStreamedMessage(),i()}},{key:"upsertContent",value:function(e,r,i,o){if(o&&Array.isArray(o)&&(o=o[0]),o!=null&&o[b]||o!=null&&o[ke]){var s=r(o);i??(i=s||void 0)}if(o!=null&&o[x]&&(e.addNewMessage(_({},x,o[x])),i?.markFileAdded()),o!=null&&o[E])throw o[E]}}])})(),OP=(function(){function t(){k(this,t)}return M(t,null,[{key:"generateResponse",value:function(e){var r=e[e.length-1][0];if(r[x]&&r[x].length>0){if(r[x].length>1)return"These are interesting files!";var i=r[x][0];return i[Y]&&i[Y].startsWith("data:image/gif")?"That is a nice gif!":i.type===it?"That is a nice image!":i.type===$e?"I like the sound of that!":"That is an interesting file!"}if(r[b]){if(r[b].charAt(r[b].length-1)==="?")return"I'm sorry but I can't answer that question...";if(r[b].includes("updog"))return"What's updog?"}return"Hi there! This is a demo response!"}},{key:"getCustomResponse",value:function(e,r){return typeof e=="function"?e(r):e}},{key:"getResponse",value:function(e){var r=e.customDemoResponse,i=e.messageToElements;return r?t.getCustomResponse(r,i[i.length-1][0]):_({},b,t.generateResponse(i))}},{key:"request",value:function(e,r){var i=t.getResponse(r);setTimeout(D(v().m(function o(){var s,a,l;return v().w(function(c){for(;;)switch(c.n){case 0:return c.n=1,Ue.basicResponseProcessing(r,i,{io:e});case 1:if(s=c.v,s){c.n=2;break}return c.a(2,e.completionsHandlers.onFinish());case 2:a=Array.isArray(s)?s:[s],l=a.find(function(u){return typeof u[E]=="string"}),l?(r.addNewErrorMessage(jt,l[E]),e.completionsHandlers.onFinish()):rn.isSimulatable(e.stream,s)?rn.simulate(r,e.streamHandlers,s):(a.forEach(function(u){return r.addNewMessage(u)}),e.completionsHandlers.onFinish());case 3:return c.a(2)}},o)})),400)}},{key:"requestStream",value:function(e,r){setTimeout(function(){var i=t.getResponse(e);rn.simulate(e,r.streamHandlers,i,r)},400)}}])})();OP.URL="deep-chat-demo";var Ao=OP,uf=(function(){function t(){k(this,t)}return M(t,null,[{key:"setup",value:function(e){e.permittedErrorPrefixes=["Connection error","Error in server message"],e.websocket="pending"}},{key:"isElementPresentInDOM",value:function(e){return e.getRootNode({composed:!0})instanceof Document}},{key:"createConnection",value:function(e,r){if(t.isElementPresentInDOM(e.deepChat)){var i=e.connectSettings.websocket;if(i){if(e.connectSettings.handler)return qS.websocket(e,r);try{var o=typeof i!="boolean"?i:void 0,s=new WebSocket(e.connectSettings.url||"",o);e.websocket=s,e.websocket.onopen=function(){var a,l;r.removeError(),e.websocket&&B(e.websocket)===ze&&t.assignListeners(e,s,r),(l=(a=e.deepChat)._validationHandler)==null||l.call(a)},e.websocket.onerror=function(a){console[E](a),t.retryConnection(e,r)}}catch(a){console[E](a),t.retryConnection(e,r)}}}}},{key:"retryConnection",value:function(e,r){var i,o;(o=(i=e.deepChat)._validationHandler)==null||o.call(i),t.isElementPresentInDOM(e.deepChat)&&(e.websocket="pending",r.isLastMessageError()||r.addNewErrorMessage(jt,"Connection error"),setTimeout(function(){t.createConnection(e,r)},5e3))}},{key:"assignListeners",value:function(e,r,i){var o=this,s={};r.onmessage=(function(){var a=D(v().m(function l(c){var u,d,f,h,p,m,g;return v().w(function(w){for(;;)switch(w.p=w.n){case 0:if(!e.extractResultData){w.n=8;break}return w.p=1,u=JSON.parse(c.data),w.n=2,Ue.basicResponseProcessing(i,u,{io:e,dis
102playError:!1});case 2:if(d=w.v,d){w.n=3;break}throw Error(Yc(u,"server",!!e.deepChat.responseInterceptor,d));case 3:if(!rn.isSimulation(e.stream)){w.n=4;break}f=t.stream.bind(o,e,i,s),h=s[u.role||xt],rn.upsertContent(i,f,h,d),w.n=6;break;case 4:if(p=Array.isArray(d)?d:[d],m=p.find(function(C){return typeof C[E]=="string"}),!m){w.n=5;break}throw m[E];case 5:p.forEach(function(C){return i.addNewMessage(C)});case 6:w.n=8;break;case 7:w.p=7,g=w.v,Ue.displayError(i,g,"Error in server message");case 8:return w.a(2)}},l,null,[[1,7]])}));return function(l){return a.apply(this,arguments)}})(),r.onclose=function(){var a,l;console[E]("Connection closed"),i.isLastMessageError()||i.addNewErrorMessage(jt,"Connection error"),e.stream&&((l=(a=e.streamHandlers).onAbort)==null||l.call(a)),t.createConnection(e,i)}}},{key:"sendWebsocket",value:(function(){var n=D(v().m(function r(i,o,s){var a,l,c,u,d,f,h,p,m,g=arguments;return v().w(function(w){for(;;)switch(w.n){case 0:if(a=g.length>3&&g[3]!==void 0?g[3]:!0,((l=i.connectSettings)==null?void 0:l.url)!==Ao.URL){w.n=1;break}return w.a(2,Ao.request(i,s));case 1:if(u=i.websocket,!(!u||u==="pending")){w.n=2;break}return w.a(2);case 2:return d={body:o,headers:(c=i.connectSettings)==null?void 0:c.headers},w.n=3,Ue.processRequestInterceptor(i.deepChat,d);case 3:if(f=w.v,h=f.body,p=f.error,!p){w.n=4;break}return w.a(2,s.addNewErrorMessage(jt,p));case 4:if(t.isWebSocket(u)){w.n=5;break}return w.a(2,u.newUserMessage.listener(h));case 5:m=a?JSON.stringify(h):h,u.readyState===void 0||u.readyState!==u.OPEN?(console[E]("Connection is not open"),s.isLastMessageError()||s.addNewErrorMessage(jt,"Connection error")):(u.send(JSON.stringify(m)),i.completionsHandlers.onFinish());case 6:return w.a(2)}},r)}));function e(r,i,o){return n.apply(this,arguments)}return e})()},{key:"canSendMessage",value:function(e){return e?e==="pending"?!1:t.isWebSocket(e)?e.readyState!==void 0&&e.readyState===e.OPEN:e.isOpen:!0}},{key:"isWebSocket",value:function(e){return e.send!==void 0}},{key:"stream",value:function(e,r,i,o){if(o){var s=e.stream.simulation;if(typeof s=="string"){var a,l=o.role||xt,c=i[l];o[b]===s||o[ke]===s?(c?.finaliseStreamedMessage(),delete i[l]):((a=i[l])!==null&&a!==void 0||(i[l]=new To(r,e.stream)),i[l].upsertStreamedMessage(o))}else rn.simulate(r,e.streamHandlers,o)}}}])})(),qS=(function(){function t(){k(this,t)}return M(t,null,[{key:"request",value:(function(){var n=D(v().m(function r(i,o,s){var a,l,c,u,d;return v().w(function(f){for(;;)switch(f.n){case 0:c=!0,u=(function(){var h=D(v().m(function p(m){var g,w,C;return v().w(function(T){for(;;)switch(T.n){case 0:if(c){T.n=1;break}return T.a(2);case 1:return c=!1,T.n=2,Ue.basicResponseProcessing(s,m,{io:i,displayError:!1});case 2:g=T.v,g?(w=Array.isArray(g)?g:[g],C=w.find(function(I){return typeof I[E]=="string"}),C?(console[E](C[E]),s.addNewErrorMessage(jt,C[E]),i.completionsHandlers.onFinish()):rn.isSimulatable(i.stream,g)?rn.simulate(s,i.streamHandlers,g):(w.forEach(function(I){return s.addNewMessage(I)}),i.completionsHandlers.onFinish())):(console[E](Yc(m,"server",!!i.deepChat.responseInterceptor,g)),s.addNewErrorMessage(jt,"Error in server message"),i.completionsHandlers.onFinish());case 3:return T.a(2)}},p)}));return function(m){return h.apply(this,arguments)}})(),d=t.generateOptionalSignals(),(l=(a=i.connectSettings).handler)==null||l.call(a,o,Je(Je({},d),{},{onResponse:u}));case 1:return f.a(2)}},r)}));function e(r,i,o){return n.apply(this,arguments)}return e})()},{key:"attemptToFinaliseStream",value:function(e,r){try{var i=r.messageElementRefs[r.messageElementRefs.length-1];Xi.isLoadingMessage(i)?r.removeLastMessage():e.finaliseStreamedMessage()}catch(o){console[E](o),r.addNewErrorMessage(jt,o)}}},{key:"stream",value:function(e,r,i){var o,s,a=!0,l=!1,c=new To(i,e.stream),u=function(){l||!a||(e.streamHandlers.onOpen(),l=!0)},d=function(){a&&(t.attemptToFinaliseStream(c,i),e.streamHandlers.onClose(),a=!1)},f=(function(){var p=D(v().m(function m(g){var w,C;return v().w(function(T){for(;;)switch(T.n){case 0:if(a){T.n=1;break}return T.a(2);
102case 1:return T.n=2,Ue.basicResponseProcessing(i,g,{io:e,displayError:!1});case 2:w=T.v,w?w[E]?(t.streamError(w[E],c,e,i),a=!1):rn.upsertContent(i,c.upsertStreamedMessage.bind(c),c,w):(C=Yc(g,"server",!!e.deepChat.responseInterceptor,w),t.streamError(C,c,e,i),a=!1);case 3:return T.a(2)}},m)}));return function(g){return p.apply(this,arguments)}})();e.streamHandlers.onAbort=function(){t.attemptToFinaliseStream(c,i),e.streamHandlers.onClose(),a=!1};var h=t.generateOptionalSignals();(s=(o=e.connectSettings).handler)==null||s.call(o,r,Je(Je({},h),{},{onOpen:u,onResponse:f,onClose:d,stopClicked:e.streamHandlers.stopClicked}))}},{key:"streamError",value:function(e,r,i,o){console[E](e),r.finaliseStreamedMessage(),o.addNewErrorMessage(jt,e),i.streamHandlers.onClose()}},{key:"websocket",value:function(e,r){var i=this,o,s,a={isOpen:!1,newUserMessage:{listener:function(){}},roleToStream:{}};e.websocket=a;var l=function(){r.removeError(),a.isOpen=!0},c=function(){a.isOpen=!1},u=(function(){var f=D(v().m(function h(p){var m,g,w,C,T,I;return v().w(function(F){for(;;)switch(F.n){case 0:return F.n=1,Ue.basicResponseProcessing(r,p,{io:e,displayError:!1});case 1:m=F.v,m?(g=Array.isArray(m)?m:[m],w=g.find(function($){return typeof $[E]=="string"}),w?(console[E](w[E]),r.isLastMessageError()||r.addNewErrorMessage(jt,w[E])):rn.isSimulation(e.stream)?(C=m,T=uf.stream.bind(i,e,r,a.roleToStream),I=a.roleToStream[C.role||xt],rn.upsertContent(r,T,I,C)):g.forEach(function($){return r.addNewMessage($)})):(console[E](Yc(p,"server",!!e.deepChat.responseInterceptor,m)),r.addNewErrorMessage(jt,"Error in server message"));case 2:return F.a(2)}},h)}));return function(p){return f.apply(this,arguments)}})(),d=t.generateOptionalSignals();(s=(o=e.connectSettings).handler)==null||s.call(o,void 0,Je(Je({},d),{},{onOpen:l,onResponse:u,onClose:c,newUserMessage:a.newUserMessage}))}},{key:"generateOptionalSignals",value:function(){return{onClose:function(){},onOpen:function(){},stopClicked:{listener:function(){}},newUserMessage:{listener:function(){}}}}}])})(),Sn=(function(){function t(){k(this,t)}return M(t,null,[{key:"request",value:(function(){var n=D(v().m(function r(i,o,s){var a,l,c,u,d,f,h,p,m,g,w,C=arguments;return v().w(function(T){for(;;)switch(T.n){case 0:return a=C.length>3&&C[3]!==void 0?C[3]:!0,d={body:o,headers:(l=i.connectSettings)==null?void 0:l.headers},T.n=1,Ue.processRequestInterceptor(i.deepChat,d);case 1:if(f=T.v,h=f.body,p=f.headers,m=f.error,g=i.completionsHandlers.onFinish,!m){T.n=2;break}return T.a(2,Ue.onInterceptorError(s,m,g));case 2:if(!((c=i.connectSettings)!=null&&c.handler)){T.n=3;break}return T.a(2,qS.request(i,h,s));case 3:if(((u=i.connectSettings)==null?void 0:u.url)!==Ao.URL){T.n=4;break}return T.a(2,Ao.request(i,s));case 4:w=!0,Ue.fetch(i,p,a,h).then(function(I){return w=!!I.ok,I}).then(function(I){return Ue.processResponseByType(I)}).then((function(){var I=D(v().m(function F($){var q,G,lt,De,qe;return v().w(function(se){for(;;)switch(se.n){case 0:if(i.extractResultData){se.n=1;break}return se.a(2);case 1:return se.n=2,(G=(q=i.deepChat).responseInterceptor)==null?void 0:G.call(q,$);case 2:if(qe=se.v,qe){se.n=3;break}qe=$;case 3:return lt=qe,se.n=4,i.extractResultData(lt,h);case 4:if(De=se.v,w){se.n=5;break}throw $;case 5:if(!(!De||B(De)!==ze&&!Array.isArray(De))){se.n=6;break}throw Error(Yc($,"response",!!i.deepChat.responseInterceptor,lt));case 6:if(!De[E]){se.n=7;break}throw De[E];case 7:if(!i.asyncCallInProgress){se.n=8;break}return i.asyncCallInProgress=!1,se.a(2);case 8:rn.isSimulatable(i.stream,De)?rn.simulate(s,i.streamHandlers,De):((Array.isArray(De)?De:[De]).forEach(function(mn){return s.addNewMessage(mn)}),g());case 9:return se.a(2)}},F)}));return function(F){return I.apply(this,arguments)}})()).catch(function(I){Ue.displayError(s,I),g()});case 5:return T.a(2)}},r)}));function e(r,i,o){return n.apply(this,arguments)}return e})()},{key:"executePollRequest",value:function(e,r,i,o){var s=e.completionsHandlers.onFinish;fetch(r,i).then(function(a){return a.json()}).then((function(){var a=D(v().m(function l(c){var u,d,f,h,p;return v().w(function(m){for(;;)switch(m.n){case 0:if(e.extractPollResultData){m.n=1;break}return m.a(2);case 1:return h=e,m.n=2,(d=(u=e.deepChat).responseInterceptor)==null?void 0:d.call(u,c);case 2:if(p=m.v,p){m.n=3;break}p=c;case 3:return m.n=4,h.extractPollResultData.call(h,p);case 4:f=m.v,f.timeoutMS?setTimeout(function(){t.executePollRequest(e,r,i,o)},f.timeoutMS):rn.isSimulatable(e.stream,f)?rn.simulate(o,e.streamHandlers,f):(o.addNewMessage(f),s());case 5:return m.a(2)}},l)}));return function(l){return a.apply(this,arguments)}}
102)()).catch(function(a){Ue.displayError(o,a),s()})}},{key:"poll",value:(function(){var n=D(v().m(function r(i,o,s){var a,l,c,u,d,f,h,p,m,g,w,C,T,I=arguments;return v().w(function(F){for(;;)switch(F.n){case 0:return a=I.length>3&&I[3]!==void 0?I[3]:!0,d={body:o,headers:(l=i.connectSettings)==null?void 0:l.headers},F.n=1,Ue.processRequestInterceptor(i.deepChat,d);case 1:if(f=F.v,h=f.body,p=f.headers,m=f.error,!m){F.n=2;break}return F.a(2,Ue.onInterceptorError(s,m));case 2:g=((c=i.connectSettings)==null?void 0:c.url)||i.url||"",w=((u=i.connectSettings)==null?void 0:u.method)||fn,C=a?JSON.stringify(h):h,T={method:w,body:C,headers:p},i.connectSettings.credentials&&(T.credentials=i.connectSettings.credentials),t.executePollRequest(i,g,T,s);case 3:return F.a(2)}},r)}));function e(r,i,o){return n.apply(this,arguments)}return e})()},{key:"verifyKey",value:function(e,r,i,o,s,a,l,c,u){if(e==="")return a(en);l(),fetch(r,{method:o,headers:i,body:u||null}).then(function(d){return Ue.processResponseByType(d)}).then(function(d){c(d,e,s,a)}).catch(function(d){a(Mr),console[E](d)})}}])})(),WS=(function(){function t(){k(this,t)}return M(t,null,[{key:"getCharacterLimitMessages",value:function(e,r){var i;if(r===-1)return e;var o=0,s=e.length-1;for(s;s>=0;s-=1){var a=(i=e[s])==null?void 0:i[b];if(a!==void 0&&(o+=a.length,o>r)){e[s][b]=a.substring(0,a.length-(o-r));break}}return e.slice(Math.max(s,0))}},{key:"getMaxMessages",value:function(e,r){return e.slice(Math.max(e.length-r,0))}},{key:"processMessages",value:function(e,r,i){return r!==void 0?r>0&&(e=t.getMaxMessages(e,r)):e=[e[e.length-1]],e=JSON.parse(JSON.stringify(e)),i===void 0?e:t.getCharacterLimitMessages(e,i)}}])})(),NP=(function(){function t(n,e,r){k(this,t),this._isLoading=!1,this._isPaginationComplete=!1,this._index=0,this._messages=e,r.fetchHistory&&this.fetchHistory(r.fetchHistory),this.setupInitialHistory(n)}return M(t,[{key:"fetchHistory",value:(function(){var n=D(v().m(function r(i){var o=this,s,a;return v().w(function(l){for(;;)switch(l.n){case 0:return s=Qa.addMessage(this._messages),l.n=1,i();case 1:a=l.v,this._messages.removeMessage(s),t.displayIntroMessages(this._messages.messageElementRefs),a.forEach(function(c){return o._messages.addAnyMessage(c,!0)}),setTimeout(function(){return rt.scrollToBottom(o._messages)},0);case 2:return l.a(2)}},r,this)}));function e(r){return n.apply(this,arguments)}return e})()},{key:"scrollToPreloadFirstEl",value:function(e,r){this._messages.elementRef.scrollTop=r+e.offsetTop-40}},{key:"processLoadedHistory",value:function(e){var r=this,i,o=this._messages,s=o.messageElementRefs,a=o.messageToElements,l=o.elementRef,c=(i=s.find(function(d){return!d.outerContainer[S].contains(Xi.INTRO_CLASS)}))==null?void 0:i.outerContainer,u=l.scrollTop;e?.reverse().map(function(d){var f=r._messages.addAnyMessage(Je(Je({},d),{},{sendUpdate:!0}),!0,!0);if(f){var h=Lt.generateMessageBody(f,s,!0);a.unshift([f,h])}return f}).filter(function(d){return!!d}).reverse().forEach(function(d){return r._messages.sendClientUpdate(d,!0)}),c&&(this._messages.messageElementRefs.length>=this._messages.maxVisibleMessages?setTimeout(function(){return r.scrollToPreloadFirstEl(c,u)}):this.scrollToPreloadFirstEl(c,u))}},{key:"populateMessages",value:function(e,r){this._messages.removeMessage(e),this._isPaginationComplete=r.findIndex(function(c){return!c})<0;var i=r.filter(function(c){return!!c});this.processLoadedHistory(i);var o=this._messages,s=o.messageElementRefs,a=o.avatar,l=o.name;Lt.resetAllRoleElements(s,a,l)}},{key:"loadHistoryOnScroll",value:(function(){var n=D(v().m(function r(i){var o=this;return v().w(function(s){for(;;)switch(s.n){case 0:this._messages.elementRef.onscroll=D(v().m(function a(){var l,c,u;return v().w(function(d){for(;;)switch(d.p=d.n){case 0:if(!(!o._isLoading&&!o._isPaginationComplete&&o._messages.elementRef.scrollTop===0)){d.n=4;break}return o._isLoading=!0,l=Qa.addMessage(o._messages,!1),d.p=1,d.n=2,i(o._index++);case 2:c=d.v,o.populateMessages(l,c),o._isLoading=!1,d.n=4;break;case 3:d.p=3,u=d.v,o._messages.removeMessage(l),o._isPaginationComplete=!0,o._messages.addNewErrorMessage(jt,t.FAILED_ERROR_MESSAGE,!0),console[E](u);case 4:return d.a(2)}},a,null,[[1,3]])}
102));case 1:return s.a(2)}},r,this)}));function e(r){return n.apply(this,arguments)}return e})()},{key:"populateInitialHistory",value:function(e){var r=this;e.forEach(function(i){Wt.processHistoryFile(i),r._messages.addAnyMessage(i,!0)})}},{key:"loadInitialHistory",value:(function(){var n=D(v().m(function r(i){var o,s,a,l;return v().w(function(c){for(;;)switch(c.p=c.n){case 0:return this._isLoading=!0,o=Qa.addMessage(this._messages),c.p=1,c.n=2,i(this._index++);case 2:s=c.v,a=this._messages.elementRef.scrollTop,this.populateMessages(o,s),this.restoreScrollOrScrollToBottom(a===0),c.n=4;break;case 3:c.p=3,l=c.v,this._messages.removeMessage(o),this._isPaginationComplete=!0,this._messages.addNewErrorMessage(jt,t.FAILED_ERROR_MESSAGE,!0),console[E](l);case 4:t.displayIntroMessages(this._messages.messageElementRefs),this._isLoading=!1;case 5:return c.a(2)}},r,this,[[1,3]])}));function e(r){return n.apply(this,arguments)}return e})()},{key:"setupInitialHistory",value:(function(){var n=D(v().m(function r(i){var o,s,a;return v().w(function(l){for(;;)switch(l.n){case 0:i.loadHistory&&this.loadInitialHistory(i.loadHistory),s=(o=this._messages.browserStorage)==null?void 0:o.get(),a=i.history||Wt.processHistory(i)||s?.messages,a&&(this.populateInitialHistory(a),this.restoreScrollOrScrollToBottom(!0),this._index+=1);case 1:return l.a(2)}},r,this)}));function e(r){return n.apply(this,arguments)}return e})()},{key:"restoreScrollOrScrollToBottom",value:function(e){var r=this,i,o,s,a=(o=(i=this._messages.browserStorage)==null?void 0:i.get())==null?void 0:o.scrollHeight;a!==void 0&&(s=this._messages.browserStorage)!=null&&s.trackScrollHeight?setTimeout(function(){r._messages.elementRef.scrollTop=a},0):e&&setTimeout(function(){return rt.scrollToBottom(r._messages)},0)}}],[{key:"addErrorPrefix",value:function(e){var r;(r=e.permittedErrorPrefixes)!==null&&r!==void 0||(e.permittedErrorPrefixes=[]),e.permittedErrorPrefixes.push(t.FAILED_ERROR_MESSAGE)}},{key:"displayIntroMessages",value:function(e){for(var r=0;r<e.length;r+=1){var i=e[0];if(i.outerContainer[S].contains(Xi.INTRO_CLASS))i.outerContainer[N].display="";else break}}}])})();NP.FAILED_ERROR_MESSAGE="Failed to load history";var GS=NP,vz=(function(){function t(){k(this,t)}return M(t,null,[{key:"parseConfig",value:function(e,r,i){var o,s={files:e};if(B(i)=="object"){Wt.processFileConfigConnect(i);var a=i.files,l=i.connect,c=i.button;a&&(a.infoModal&&(s[x].infoModal=a.infoModal,(o=a.infoModal)!=null&&o.textMarkDown&&(s.infoModalTextMarkUp=r.render(a.infoModal.textMarkDown))),a.acceptedFormats&&(s[x].acceptedFormats=a.acceptedFormats),a.maxNumberOfFiles&&(s[x].maxNumberOfFiles=a.maxNumberOfFiles)),s.button=c,l&&Object.keys(l).length>0&&(s.connect=l)}return s}},{key:"processMixedFiles",value:function(e,r,i){if(i){var o={acceptedFormats:""};e.fileTypes.mixedFiles=t.parseConfig(o,r,i)}}},{key:"processMicrophone",value:function(e,r,i,o){var s,a,l,c,u,d,f,h,p=Je({acceptedFormats:"audio/*"},((l=e.fileTypes[$e])==null?void 0:l[x])||{});i&&(navigator.mediaDevices.getUserMedia!==void 0?(e.recordAudio=t.parseConfig(p,r,i),B(i)=="object"&&i[x]&&((s=(c=e.recordAudio)[x])!==null&&s!==void 0||(c[x]={}),e.recordAudio[x].format=(u=i[x])==null?void 0:u.format,e.recordAudio[x].maxDurationSeconds=(d=i[x])==null?void 0:d.maxDurationSeconds,(f=e.fileTypes[$e])!=null&&f[x]&&((a=(h=e.f
102ileTypes[$e][x]).maxNumberOfFiles)!==null&&a!==void 0||(h.maxNumberOfFiles=i[x].maxNumberOfFiles)))):o||(e.fileTypes[$e]=t.parseConfig(p,r,i)))}},{key:"processAudioConfig",value:function(e,r,i,o){if(!(!i&&!o)){var s=Je({acceptedFormats:"audio/*"},o?.[x]||{});e.fileTypes[$e]=t.parseConfig(s,r,i)}}},{key:"processGifConfig",value:function(e,r,i,o){if(!(!i&&!o)){var s=Je({acceptedFormats:"image/gif"},o?.[x]||{});e.fileTypes[Jc]=t.parseConfig(s,r,i)}}},{key:"processCamera",value:function(e,r,i,o){var s,a,l,c,u,d=Je({acceptedFormats:"image/*"},((a=e.fileTypes[wt])==null?void 0:a[x])||{});i&&(navigator.mediaDevices.getUserMedia!==void 0?(e[or]=t.parseConfig(d,r,i),B(i)=="object"&&(e[or].modalContainerStyle=i.modalContainerStyle,i[x]&&((s=(l=e[or])[x])!==null&&s!==void 0||(l[x]={}),e[or][x].format=(c=i[x])==null?void 0:c.format,e[or][x].dimensions=(u=i[x])==null?void 0:u.dimensions))):o||(e.fileTypes[wt]=t.parseConfig(d,r,i)))}},{key:"processImagesConfig",value:function(e,r,i,o){if(!(!i&&!o)){var s=Je({acceptedFormats:"image/*"},o?.[x]||{});e.fileTypes[wt]=t.parseConfig(s,r,i)}}},{key:"populateDefaultFileIO",value:function(e,r){var i,o,s,a,l;e&&((i=e[x])!==null&&i!==void 0||(e[x]={}),(o=(a=e[x]).acceptedFormats)!==null&&o!==void 0||(a.acceptedFormats=r),(s=(l=e[x]).maxNumberOfFiles)!==null&&s!==void 0||(l.maxNumberOfFiles=1))}},{key:"set",value:function(e,r,i){t.populateDefaultFileIO(i?.[$e],".4a,.mp3,.webm,.mp4,.mpga,.wav,.mpeg,.m4a"),t.populateDefaultFileIO(i?.[wt],".png,.jpg");var o=wS.createNew(e.remarkable);t.processImagesConfig(r,o,e[wt],i?.[wt]),t.processCamera(r,o,e[or],e[wt]),t.processGifConfig(r,o,e[Jc],i?.[Jc]),t.processAudioConfig(r,o,e[$e],i?.[$e]),t.processMicrophone(r,o,e[Yi],e[$e]),t.processMixedFiles(r,o,e[nP])}}])})(),Zv=(function(){function t(n,e,r){var i;k(this,t);var o,s,a,l,c;this.rawBody={},this.validateKeyProperty=!1,this.canSendMessage=t.canSendMessage,this.connectSettings={},this.fileTypes={},this.completionsHandlers={},this.streamHandlers={}
102,this.deepChat=n,this.demo=r,Object.assign(this.rawBody,(o=n.connect)==null?void 0:o.additionalBodyProps),this.totalMessagesMaxCharLength=(s=n?.requestBodyLimits)==null?void 0:s.totalMessagesMaxCharLength,this.maxMessages=(a=n?.requestBodyLimits)==null?void 0:a.maxMessages,vz.set(n,this,e),n.connect&&(this.connectSettings=n.connect),this.demo&&((i=(l=this.connectSettings).url)!==null&&i!==void 0||(l.url=Ao.URL)),this.connectSettings.websocket&&uf.setup(this),this.stream=((c=this.deepChat.connect)==null?void 0:c.stream)||Wt.checkForStream(this.deepChat),n.loadHistory&&GS.addErrorPrefix(this)}return M(t,[{key:"verifyKey",value:function(e,r){}},{key:"getServiceIOByType",value:function(e){if(e.type.startsWith($e)&&this.fileTypes[$e])return this.fileTypes[$e];if(e.type.startsWith(it)){if(this.fileTypes[Jc]&&e.type.endsWith("/gif"))return this.fileTypes[Jc];if(this.fileTypes[wt])return this.fileTypes[wt];if(this[or])return this[or]}return this.fileTypes[nP]}},{key:"request",value:(function(){var n=D(v().m(function r(i,o){var s,a=arguments;return v().w(function(l){for(;;)switch(l.n){case 0:return s=a.length>2&&a[2]!==void 0?a[2]:!0,l.a(2,this.stream&&!rn.isSimulation(this.stream)?rn.request(this,i,o,s):Sn.request(this,i,o,s))}},r,this)}));function e(r,i){return n.apply(this,arguments)}return e})()},{key:"callAPIWithText",value:(function(){var n=D(v().m(function r(i,o){var s,a,l,c,u,d,f,h;return v().w(function(p){for(;;)switch(p.n){case 0:return f=Je({messages:o},this.rawBody),h=!1,(l=this.connectSettings.headers)!=null&&l[Ze]||((s=(c=this.connectSettings).headers)!==null&&s!==void 0||(c.headers={}),(a=(u=this.connectSettings.headers)[Ze])!==null&&a!==void 0||(u[Ze]=Ct),h=!0),p.n=1,this.request(f,i);case 1:h&&((d=this.connectSettings.headers)==null||delete d[Ze]);case 2:return p.a(2)}},r,this)}));function e(r,i){return n.apply(this,arguments)}return e})()},{key:"callApiWithFiles",value:(function(){var n=D(v().m(function r(i,o,s){var a,l,c;return v().w(function(u){for(;;)switch(u.n){case 0:return a=t.createCustomFormDataBody(this.rawBody,o,s),l=this.connectSettings,c=this.getServiceIOByType(s[0]),this.connectSettings=c?.connect||this.connectSettings,u.n=1,this.request(a,i,!1);case 1:this.connectSettings=l;case 2:return u.a(2)}},r,this)}));function e(r,i,o){return n.apply(this,arguments)}return e})()},{key:"callServiceAPI",value:(function(){var n=D(v().m(function r(i,o,s){return v().w(function(a){for(;;)switch(a.n){case 0:s?this.callApiWithFiles(i,o,s):this.callAPIWithText(i,o);case 1:return a.a(2)}},r,this)}));function e(r,i,o){return n.apply(this,arguments)}return e})()},{key:"callAPI",value:(function(){var n=D(v().m(function r(i,o){var s,a,l;return v().w(function(c){for(;;)switch(c.n){case 0:if(this.connectSettings){c.n=1;break}throw new Error(sr);case 1:a=WS.processMessages(o.messageToElements.map(function(u){var d=el(u,1),f=d[0];return f}),this.maxMessages,this.totalMessagesMaxCharLength),this.connectSettings.websocket&&(!this.connectSettings.handler||this.connectSettings.url!==Ao.URL)?(l=Je({messages:a},this.rawBody),i[x]&&(s=this.getServiceIOByType(i[x][0]))!=null&&s.connect?this.callApiWithFiles(o,a,i[x]):uf.sendWebsocket(this,l,o,!1)):this.callServiceAPI(o,a,i[x]);case 2:return c.a(2)}},r,this)}));function e(r,i){return n.apply(this,arguments)}return e})()},{key:"extractResultData",value:(function(){var n=D(v().m(function r(i){return v().w(function(o){for(;;)switch(o.n){case 0:if(!i.result){o.n=1;break}return o.a(2,Wt.handleResponseProperty(i));case 1:if(!Ue.validateResponseFormat(i,!!this.stream)){o.n=2;break}return o.a(2,i);case 2:return o.a(2)}},r,this)}));function e(r){return n.apply(this,arguments)}return e})()},{key:"isDirectConnection",value:function(){return!1}},{key:"isWebModel",value:function(){return!1}},{key:"isCustomView",value:function(){return!1}}],[{key:"canSendMessage",value:function(e,r,i){return i?!0:!!(e&&e.trim()!=="")||!!(r&&r.length>0)}},{key:"createCustomFormDataBody",value:function(e,r,i){var o=new FormData;i.forEach(function(l){return o.append("files",l)}),Object.keys(e).forEach(function(l){return o.append(l,String(e[l]))});var s=0;
102r.slice(0,r.length-1).forEach(function(l){o.append("message".concat(s+=1),JSON.stringify(l))});var a=r[r.length-1];return a[b]&&(delete a[x],o.append("message".concat(s+=1),JSON.stringify(a))),o}}])})(),ge=(function(t){function n(e,r,i,o,s){var a;k(this,n);var l;return a=K(this,n,[e,s]),a.insertKeyPlaceholderText="API Key",a.keyHelpUrl="",a.asyncCallInProgress=!1,a.systemMessage="",Object.assign(a.rawBody,(l=e.connect)==null?void 0:l.additionalBodyProps),a._keyVerificationDetails=r,a._buildHeadersFunc=i,o&&a.setApiKeyProperties(o),a.connectSettings=a.buildConnectSettings(a.key||"",e.connect),a}return J(n,t),M(n,[{key:"setApiKeyProperties",value:function(r){this.key=r.key,r.validateKeyProperty&&(this.validateKeyProperty=r.validateKeyProperty)}},{key:"buildConnectSettings",value:function(r,i){var o,s=i??{};return(o=s.headers)!==null&&o!==void 0||(s.headers={}),Object.assign(s.headers,this._buildHeadersFunc(r)),s}},{key:"completeConfig",value:function(r,i){r.system_prompt&&(this.systemMessage=r.system_prompt),i&&(this.functionHandler=i),delete r.system_prompt,delete r.key,delete r.function_handler,Object.assign(this.rawBody,r)}},{key:"keyAuthenticated",value:function(r,i){this.connectSettings=this.buildConnectSettings(i,this.connectSettings),this.key=i,r()}},{key:"verifyKey",value:function(r,i){var o=this._keyVerificationDetails,s=o.url,a=o.method,l=o.handleVerificationResult,c=o.createHeaders,u=o.body,d=o.augmentUrl,f=c?.(r)||this._buildHeadersFunc(r),h=d?.(r)||s;Sn.verifyKey(r,h,f,a,this.keyAuthenticated.bind(this,i.onSuccess),i.onFail,i.onLoad,l,u)}},{key:"isDirectConnection",value:function(){return!0}},{key:"processMessages",value:function(r){return WS.getCharacterLimitMessages(r,this.totalMessagesMaxCharLength?this.totalMessagesMaxCharLength-this.systemMessage.length:-1)}},{key:"addSystemMessage",value:function(r){this.systemMessage&&r.unshift({role:"system",content:this.systemMessage})}},{key:"callDirectServiceServiceAPI",value:(function(){var e=D(v().m(function i(o,s,a,l,c){var u,d;return v().w(function(f){for(;;)switch(f.n){case 0:if(this.connectSettings){f.n=1;break}throw new Error(sr);case 1:if(u=a(this.rawBody,s),d=l?this.stream:!1,!(d&&(B(d)!==ze||!d.simulation)||u.stream)){f.n=2;break}u.stream=!0,l!=null&&l.readable&&(this.stream={readable:!0}),rn.request(this,u,o),f.n=4;break;case 2:return f.n=3,Sn.request(this,u,o,c);case 3:return f.a(2,f.v);case 4:return f.a(2)}},i,this)}));function r(i,o,s,a,l){return e.apply(this,arguments)}return r})()},{key:"callToolFunction",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d,f,h;return v().w(function(p){for(;;)switch(p.n){case 0:return this.asyncCallInProgress=!0,p.n=1,o(s);case 1:if(c=p.v,Array.isArray(c)){p.n=6;break}if(!c[b]){p.n=5;break}return u=_({},b,c[b]),p.n=2,(l=(a=this.deepChat).responseInterceptor)==null?void 0:l.call(a,u);case 2:if(f=p.v,f){p.n=3;break}f=u;case 3:if(d=f,!Array.isArray(d)){p.n=4;break}throw Error("Function tool response interceptor cannot return an array");case 4:return p.a(2,{processedResponse:d});case 5:throw Error(rl);case 6:return p.n=7,Promise.all(c);case 7:return h=p.v,p.a(2,{responses:h})}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"makeAnotherRequest",value:function(r,i,o){try{return i&&(this.stream?rn.request(this,r,i):Sn.request(this,r,i)),_({},b,o||"")}catch(s){throw this.asyncCallInProgress=!1,s}}},{key:"genereteAPIKeyName",value:function(r){return"".concat(r," API Key")}},{key:"extractStreamResultWToolsGeneric",value:(function(){var e=D(v().m(function i(o,s,a,l,c){var u,d,f;return v().w(function(h){for(;;)switch(h.n){case 0:if(u=s.delta,d=s.finish_reason,d!=="tool_calls"){h.n=1;break}return f={tool_calls:o._streamToolCalls},h.a(2,(o._streamToolCalls=void 0,this.handleToolsGeneric(f,a,o.messages,l,c)));case 1:u!=null&&u.tool_calls&&(o._streamToolCalls?u.tool_calls.forEach(function(p,m){o._streamToolCalls&&(o._streamToolCalls[m].function.arguments+=p.function.arguments)}):o._streamToolCalls=u.tool_calls);case 2:return h.a(2,_({},b,u?.content||""))}},i,this)}));function r(i,o,s,a,l){return e.apply(this,arguments)}return r})()},{key:"handleToolsGeneric",value:(function(){var e=D(v().m(function i(o,s,a,l,c){var u,d,f,h,p;return v().w(function(m){for(;;)switch(m.n){case 0:if(!(!o.tool_calls||!l||!s)){m.n=1;break}throw Error(Es);case 1:return u=JSON.parse(JSON.stringify(l)),d=o.tool_calls.map(function(g){return{name:g.function.name,arguments:g.function.arguments}}),m.n=2,this.callToolFunction(s,d);case 2:if(f=m.v,h=f.responses,p=f.processedResponse,!p){m.n=3;break}return m.a(2,p);case 3:if(c&&(u.messages=u.messages.slice(u.messages.length-1),c.message&&u.messages.unshift({role:"system",content:c.message})),u.messages.push({tool_calls:o.tool_calls,role:Qi,content:null}),!(!h.find(function(g){var w=g.response;
102return typeof w!="string"})&&d.length===h.length)){m.n=4;break}return m.a(2,(h.forEach(function(g,w){var C,T=(C=o.tool_calls)==null?void 0:C[w];u?.messages.push({role:"tool",tool_call_id:T?.id,name:T?.function.name,content:g.response})}),this.makeAnotherRequest(u,a)));case 4:throw Error(rl);case 5:return m.a(2)}},i,this)}));function r(i,o,s,a,l){return e.apply(this,arguments)}return r})()},{key:"updateSessionId",value:function(r){this.messages&&this.messages.messageToElements.length>0&&(this.messages.messageToElements[this.messages.messageToElements.length-1][0]._sessionId=r)}}],[{key:"getRoleViaUser",value:function(r){return r===et?et:Qi}},{key:"getRoleViaAI",value:function(r){return r===xt?Qi:et}},{key:"getImageContent",value:function(r){return r.filter(function(i){return i.type===it}).map(function(i){return _(_({},ce,fr),fr,{url:i[Y]||""})}).filter(function(i){return i[fr].url.length>0})}},{key:"getTextWImagesContent",value:function(r){if(r[x]&&r[x].length>0){var i=this.getImageContent(r[x]);return r[b]&&r[b].trim().length>0&&i.unshift(_(_({},ce,b),b,r[b])),i.length>0?i:r[b]||""}return r[b]||""}},{key:"getTextWFilesContent",value:function(r,i){if(r[x]&&r[x].length>0){var o=i(r[x]);return r[b]&&r[b].trim().length>0&&o.unshift(_(_({},ce,b),b,r[b])),o}return r[b]||""}}])})(Zv),yz=(function(){function t(){k(this,t)}return M(t,null,[{key:"waitForPropertiesToBeUpdatedBeforeRender",value:function(e){e._propUpdated_=!1,setTimeout(function(){e._propUpdated_?t.waitForPropertiesToBeUpdatedBeforeRender(e):(e._waitingToRender_=!1,e.onRender())})}},{key:"attemptRender",value:function(e){e._propUpdated_=!0,e._waitingToRender_||(e._waitingToRender_=!0,t.waitForPropertiesToBeUpdatedBeforeRender(e))}}])})(),IS=(function(t){function n(){var e;return k(this,n),e=K(this,n),e._waitingToRender_=!1,e._propUpdated_=!1,Object.keys(n._attributeToProperty_).forEach(function(r){var i=n._attributeToProperty_[r];e.constructPropertyAccessors(i),e.hasOwnProperty(r)||e.constructPropertyAccessors(i,r)}),e}return J(n,t),M(n,[{key:"constructPropertyAccessors",value:function(r,i){var o;Object.defineProperty(this,i||r,{get:function(){return o},set:function(a){o=a,i?this[r]=a:yz.attemptRender(this)}})}},{key:"attributeChangedCallback",value:function(r,i,o){if(i!==o){var s=n._attributes_[r](o),a=n._attributeToProperty_[r];this[a]=s}}},{key:"onRender",value:function(){}}],[{key:"observedAttributes",get:function(){return Object.keys(n._attributes_)||[]}}])})(pS(HTMLElement));IS._attributes_={},IS._attributeToProperty_={};var _z=IS,bz=`<?xml version="1.0" standalone="no"?> 103<svg version="1.1" 104 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" 105 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0.9em" height="0.9em" 106 viewBox="0 0 1200 1200" enable-background="new 0 0 1200 1200"> 107 <path d=" 108 M669.727,273.516c-22.891-2.476-46.15-3.895-69.727-4.248c-103.025,0.457-209.823,25.517-310.913,73.536 109 c-75.058,37.122-148.173,89.529-211.67,154.174C46.232,529.978,6.431,577.76,0,628.74c0.76,44.162,48.153,98.67,77.417,131.764 110 c59.543,62.106,130.754,113.013,211.67,154.174c2.75,1.335,5.51,2.654,8.276,3.955l-75.072,131.102l102.005,60.286l551.416-960.033 111 l-98.186-60.008L669.727,273.516z M902.563,338.995l-74.927,129.857c34.47,44.782,54.932,100.006,54.932,159.888 112 c0,149.257-126.522,270.264-282.642,270.264c-6.749,0-13.29-0.728-19.922-1.172l-49.585,85.84c22.868,2.449,45.99,4.233,69.58,4.541 113 c103.123-0.463,209.861-25.812,310.84-73.535c75.058-37.122,148.246-89.529,211.743-154.174 114 c31.186-32.999,70.985-80.782,77.417-131.764c-0.76-44.161-48.153-98.669-77.417-131.763 115 c-59.543-62.106-130.827-113.013-211.743-154.175C908.108,341.478,905.312,340.287,902.563,338.995L902.563,338.995z 116 M599.927,358.478c6.846,0,13.638,0.274,20.361,0.732l-58.081,100.561c-81.514,16.526-142.676,85.88-142.676,168.897 117 c0,20.854,3.841,40.819,10.913,59.325c0.008,0.021-0.008,0.053,0,0.074l-58.228,100.854 118 c-34.551-44.823-54.932-100.229-54.932-160.182C317.285,479.484,443.808,358.477,599.927,358.478L599.927,358.478z M768.896,570.513 119 L638.013,797.271c81.076-16.837,141.797-85.875,141.797-168.603C779.81,608.194,775.724,588.729,768.896,570.513L768.896,570.513z" 120 /> 121</svg> 122`,wz=`<?xml version="1.0" standalone="no"?> 123<svg version="1.1" 124 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" 125 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0.9em" height="0.9em" 126 viewBox="0 0 1200 1200" enable-background="new 0 0 1200 1200"> 127 <path id="path6686" inkscape:connector-curvature="0" d="M779.843,599.925c0,95.331-80.664,172.612-180.169,172.612 128 c-99.504,0-180.168-77.281-180.168-172.612c0-95.332,80.664-172.612,180.168-172.612 129 C699.179,427.312,779.843,504.594,779.843,599.925z M600,240.521c-103.025,0.457-209.814,25.538-310.9
12904,73.557 130 c-75.058,37.122-148.206,89.496-211.702,154.141C46.208,501.218,6.431,549,0,599.981c0.76,44.161,48.13,98.669,77.394,131.763 131 c59.543,62.106,130.786,113.018,211.702,154.179c94.271,45.751,198.616,72.092,310.904,73.557 132 c103.123-0.464,209.888-25.834,310.866-73.557c75.058-37.122,148.243-89.534,211.74-154.179 133 c31.185-32.999,70.962-80.782,77.394-131.763c-0.76-44.161-48.13-98.671-77.394-131.764 134 c-59.543-62.106-130.824-112.979-211.74-154.141C816.644,268.36,712.042,242.2,600,240.521z M599.924,329.769 135 c156.119,0,282.675,120.994,282.675,270.251c0,149.256-126.556,270.25-282.675,270.25S317.249,749.275,317.249,600.02 136 C317.249,450.763,443.805,329.769,599.924,329.769L599.924,329.769z"/> 137</svg> 138`,ko=(function(){function t(){k(this,t)}return M(t,null,[{key:"createSVGElement",value:function(e){return new DOMParser().parseFromString(e,"image/svg+xml").documentElement}}])})(),PP=(function(){function t(){k(this,t)}return M(t,null,[{key:"changeVisibility",value:function(e,r,i,o){o.target.id===t.VISIBLE_ICON_ID?(r[N].display="none",i[N].display="block",e.type="password"):(r[N].display="block",i[N].display="none",e.type=b)}},{key:"createIconElement",value:function(e,r){var i=ko.createSVGElement(e);return i.id=r,i[S].add("visibility-icon"),i}},{key:"create",value:function(e){var r=U();r.id="visibility-icon-container";var i=t.createIconElement(wz,t.VISIBLE_ICON_ID);i[N].display="none",r.appendChild(i);var o=t.createIconElement(bz,"not-visible-icon");return r.appendChild(o),r.onclick=t.changeVisibility.bind(this,e,i,o),r}}])})();PP.VISIBLE_ICON_ID="visible-icon";var Ez=PP,Cz=(function(){function t(){k(this,t)}return M(t,null,[{key:"createCautionText",value:function(){var e=U("a");return e[S].add("insert-key-input-help-text"),e.innerText="Please exercise CAUTION when inserting your API key outside of deepchat.dev or localhost!!",e}},{key:"createHelpLink",value:function(e){var r=U("a");return r[S].add("insert-key-input-help-text"),r.href=e,r.innerText="Find more info here",r.target="_blank",r}},{key:"createFailText",value:function(){var e=U();return e.id="insert-key-input-invalid-text",e[N].display="none",e}},{key:"createHelpTextContainer",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=U();i.id="insert-key-help-text-container";var o=U();o.id="insert-key-help-text-contents";var s=t.createFailText();if(o.appendChild(s),e){var a=t.createHelpLink(e);o.appendChild(a)}if(r===!0){var l=t.createCautionText();o.appendChild(l)}return i.appendChild(o),{helpTextContainerElement:i,failTextElement:s}}},{key:"onFail",value:function(e,r,i,o){e[S].replace("insert-key-input-valid","insert-key-input-invalid"),i.innerText=o,i[N].display="block",r.innerText="Start",e[S].remove("loading")}},{key:"onLoad",value:function(e,r){e[S].add("loading"),r.innerHTML='<div id="loading-key"></div>'}},{key:"verifyKey",value:function(e,r,i){var o=e.value.trim();i.verifyKey(o,r)}},{key:"addVerificationEvents",value:function(e,r,i,o,s){var a={onSuccess:o,onFail:t.onFail.bind(this,e,r,i),onLoad:t.onLoad.bind(this,e,r)},l=t.verifyKey.bind(this,e,a,s);r.onclick=l,e.onkeydown=function(c){!e[S].contains("loading")&&c.key===dn.ENTER&&l()}}},{key:"createStartButton",value:function(){var e=U();return e.id="start-button",e.innerText="Start",e}},{key:"onInputFocus",value:function(e){e.target[S].replace("insert-key-input-invalid","insert-key-input-valid")}},{key:"createInput",value:function(e){var r=U();r.id="insert-key-input-container";var i=U("input");return i.id="insert-key-input",i.placeholder=e||"API Key",i.type="password",i[S].add("insert-key-input-valid"),i.onfocus=t.onInputFocus,r.appendChild(i),r}},{key:"createContents",value:function(e,r){var i,o=U();o.id="insert-key-contents";var s=t.createInput(r.insertKeyPlaceholderText),a=s.children[0],l=Ez.create(a);s.appendChild(l),o.appendChild(s);var c=t.createStartButton(),u=t.createHelpTextContainer(r.keyHelpUrl,(i=r.deepChat._insertKeyViewStyles)==null?void 0:i.displayCautionText),d=u.helpTextContainerElement,f=u.failTextElement;return o.appendChild(c),o.appendChild(d),t.addVerificationEvents(a,c,f,e,r),o}},{key:"createElements",value:function(e,r){var i=U();i.id="insert-key-view";var o=t.createContents(e,r);return i.appendChild(o),i}},{key:"render",value:function(e,r,i){var o=t.createElements(r,i);e.replaceChildren(o)}}])})(),Xh=(function(){function t(){k(this,t)}return M(t,null,[{key:"enableButtons",value:function(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;window.webLLM?(e&&(e.disabled=!1),r&&(r.disabled=!1)):i<KS.MODULE_SEARCH_LIMIT_S*4&&setTimeout(function(){return t.enableButtons(e,r,i+1)},250)}},{key:"setUpInitial",value:function(e,r,i,o){var s=r?.downloadClass||t.DOWNLOAD_BUTTON_CLASS,a=r?.uploadClass||t.UPLOAD_BUTTON_CLASS,l=r?.fileInputClass||t.FILE_INPUT_CLASS;return setTimeout(function(){var c=i?.getElementsByClassName(s)[0],u=i?.getElementsByClassName(l)[0],d=i?.getElementsByClassName(a)[0];c&&(c.onclick=function(){return e()}),u&&(u.onchange=function(){u[x]&&u[x].length>0&&e(u[x])}),d&&(d.onclick=function(){return u[ht]()}),(c||d)&&t.enableButtons(c,d)}),r?.initialHtml||`<div> 139 Download or upload a web model that will run entirely on your browser: <br/> 140 <button disabled class="`.concat(s,` deep-chat-button deep-chat-web-model-button">Download</button> 141 `).concat(o?"":'<input type="file" class="'.concat(l,`" hidden multiple /> 142 <button disabled class="`).concat(a,' deep-chat-button deep-chat-web-model-button">Upload</button>'),` 143 </div>`)}},{key:"exportFile",value:function(e){for(var r=U("a"),i=4,o=function(l){setTimeout(function(){for(var c=l*i,u=c;u<Math.min(c+i,e.length);u+=1){var d=URL.createObjectURL(e[u]);r.href=d,r.download=e[u].name,document.body.appendChild(r),r[ht](),URL.revokeObjectURL(d)}},500*l)},s=0;s<e.length/i;s+=1)o(s)}},{key:"setUpAfterLoad",value:function(e,r,i,o){var s=r?.exportFilesClass||t.EXPORT_BUTTON_CLASS;return setTimeout(function(){var a=i?.getElementsByClassName(s)[0];a&&(a.onclick=function(){return t.exportFile(e)})}),r?.afterLoadHtml||`<div> 144 Model loaded successfully and has been cached for future requests. 145 `.concat(o?"":'<br/> <button style="margin-top: 5px" class="'.concat(s,' deep-chat-button">Export</button>'),` 146 </div>`)}}])})();
146Xh.DOWNLOAD_BUTTON_CLASS="deep-chat-download-button",Xh.UPLOAD_BUTTON_CLASS="deep-chat-upload-button",Xh.FILE_INPUT_CLASS="deep-chat-file-input",Xh.EXPORT_BUTTON_CLASS="deep-chat-export-button";var yN=Xh,_N={model_list:[{model_url:"https://huggingface.co/mlc-ai/Llama-2-7b-chat-hf-q4f32_1-MLC/resolve/main/",local_id:"Llama-2-7b-chat-hf-q4f32_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-7b-chat-hf/Llama-2-7b-chat-hf-q4f32_1-ctx4k_cs1k-webgpu.wasm",vram_required_MB:9109.03,low_resource_required:!1},{model_url:"https://huggingface.co/mlc-ai/Llama-2-7b-chat-hf-q4f16_1-MLC/resolve/main/",local_id:"Llama-2-7b-chat-hf-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-7b-chat-hf/Llama-2-7b-chat-hf-q4f16_1-ctx4k_cs1k-webgpu.wasm",vram_required_MB:6749.02,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/Llama-2-7b-chat-hf-q4f16_1-MLC/resolve/main/",local_id:"Llama-2-7b-chat-hf-q4f16_1-1k",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-7b-chat-hf/Llama-2-7b-chat-hf-q4f16_1-ctx1k-webgpu.wasm",vram_required_MB:4618.52,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/Llama-2-13b-chat-hf-q4f16_1-MLC/resolve/main/",local_id:"Llama-2-13b-chat-hf-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-13b-chat-hf/Llama-2-13b-chat-hf-q4f16_1-ctx4k_cs1k-webgpu.wasm",vram_required_MB:11814.09,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/Llama-2-70b-chat-hf-q4f16_1-MLC/resolve/main/",local_id:"Llama-2-70b-chat-hf-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-70b-chat-hf/Llama-2-70b-chat-hf-q4f16_1-ctx4k_cs1k-webgpu.wasm",vram_required_MB:43729.05,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f16_1-MLC/resolve/main/",local_id:"RedPajama-INCITE-Chat-3B-v1-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f16_1-ctx2k-webgpu.wasm",vram_required_MB:2972.09,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f32_1-MLC/resolve/main/",local_id:"RedPajama-INCITE-Chat-3B-v1-q4f32_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f32_1-ctx2k-webgpu.wasm",vram_required_MB:3928.09,low_resource_required:!1},{model_url:"https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f16_1-MLC/resolve/main/",local_id:"RedPajama-INCITE-Chat-3B-v1-q4f16_1-1k",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f16_1-ctx1k-webgpu.wasm",vram_required_MB:2041.09,low_resource_required:!0,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f32_1-MLC/resolve/main/",local_id:"RedPajama-INCITE-Chat-3B-v1-q4f32_1-1k",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f32_1-ctx1k-webgpu.wasm",vram_required_MB:2558.09,low_resource_required:!0},{model_url:"https://huggingface.co/mlc-ai/WizardMath-7B-V1.1-q4f16_1-MLC/resolve/main/",local_id:"WizardMath-7B-V1.1-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",vram_required_MB:6079.02,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/Mistral-7B-Instruct-v0.2-q4f16_1-MLC/resolve/main/",local_id:"Mistral-7B-Instruct-v0.2-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",vram_required_MB:6079.02,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/OpenHermes-2.5-Mistral-7B-q4f16_1-MLC/resolve/main/",local_id:"OpenHermes-2.5-Mistral-7B-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",vram_required_MB:6079.02,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/NeuralHermes-2.5-Mistral-7B-q4f16_1-MLC/resolve/main/",local_id:"NeuralHermes-2.5-Mistral-7B-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",vram_required_MB:6079.02,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q0f16-MLC/resolve/main/",local_id:"TinyLlama-1.1B-Chat-v0.4-q0f16",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q0f16-ctx2k-webgpu.wasm",vram_required_MB:5063.52,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q0f32-MLC/resolve/main/",local_id:"TinyLlama-1.1B-Chat-v0.4-q0f32",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q0f32-ctx2k-webgpu.wasm",vram_required_MB:5394.53,low_resource_required:!1},{model_url:"https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q4f16_1-MLC/resolve/main/",local_id:"TinyLlama-1.1B-Chat-v0.4-q4f16_1-1k",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q4f16_1-ctx1k-webgpu.wasm",vram_required_MB:899.11,low_resource_required:!0,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q4f32_1-MLC/resolve/main/",local_id:"TinyLlama-1.1B-Chat-v0.4-q4f32_1-1k",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q4f32_1-ctx1k-webgpu.wasm",vram_required_MB:992.11,low_resource_required:!0}],use_web_worker:!0},Wc=(function(t){function n(e){var r;k(this,n);var i,o;return r=K(this,n,[e]),r._isModelLoaded=!1,r._isModelLoading=!1,r._loadOnFirstMessage=!1,r._webModel={}
146,r.permittedErrorPrefixes=[n.MULTIPLE_MODELS_ERROR,n.WEB_LLM_NOT_FOUND_ERROR,n.GENERIC_ERROR],r._conversationHistory=[],B(e.webModel)=="object"&&(r._webModel=e.webModel),(i=r._webModel.load)!=null&&i.clearCache&&n.clearAllCache(),r.findModelInWindow(e),r.canSendMessage=r.canSubmit.bind(Xc(r)),r._chatEl=(o=e.shadowRoot)==null?void 0:o.children[0],e.history&&n.setUpHistory(r._conversationHistory,e.history),r}return J(n,t),M(n,[{key:"setUpMessages",value:function(r){var i=this;this._messages=r,this._removeIntro=function(){r.removeIntroductoryMessage(),i._removeIntro=void 0}}},{key:"findModelInWindow",value:function(r){var i=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s;window.webLLM?this.configureInit(this.shouldAddIntroMessage(r.introMessage)):o>n.MODULE_SEARCH_LIMIT_S?((s=this._messages)==null||s.addNewErrorMessage(jt,n.WEB_LLM_NOT_FOUND_ERROR),console[E]("The deep-chat-web-llm module has not been attached to the window object. Please see the following guide:"),console[E]("https://deepchat.dev/examples/externalModules")):setTimeout(function(){return i.findModelInWindow(r,o+1)},1e3)}},{key:"shouldAddIntroMessage",value:function(r){var i;return!r&&this._webModel&&((i=this._webModel.introMessage)==null?void 0:i.displayed)!==!1}},{key:"scrollToTop",value:function(r){var i=this,o;((o=this._webModel.introMessage)==null?void 0:o.autoScroll)!==!1&&setTimeout(function(){var s,a;(s=i._messages)!=null&&s.elementRef&&rt.scrollToTop((a=i._messages)==null?void 0:a.elementRef)},r)}},{key:"getIntroMessage",value:function(r){if(!(!this.shouldAddIntroMessage(r)||!this._chatEl)){var i=yN.setUpInitial(this.init.bind(this),this._webModel.introMessage,this._chatEl,!!this._webModel.worker);return this.scrollToTop(1),{role:xt,html:i,sendUpdate:!1}}}},{key:"configureInit",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(s=this._webModel.load,!s){a.n=2;break}if(!s.onInit){a.n=1;break}return this.init(),a.a(2);case 1:if(!s.onMessage){a.n=2;break}return this._loadOnFirstMessage=!0,a.a(2);case 2:o||this.init();case 3:return a.a(2)}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"init",value:(function(){var e=D(v().m(function i(o){var s,a,l;return v().w(function(c){for(;;)switch(c.n){case 0:if((s=this._messages)==null||s.removeError(),a=this.attemptToCreateChat(),l=a,!l){c.n=1;break}return c.n=1,this.loadModel(a,o);case 1:return c.a(2)}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"attemptToCreateChat",value:function(){var r;if(n.chat){(r=this._messages)==null||r.addNewErrorMessage(jt,n.MULTIPLE_MODELS_ERROR),console[E](n.MULTIPLE_MODELS_ERROR);return}if(!(this._isModelLoaded||this._isModelLoading)){var i=this._webModel.worker;return _N.use_web_worker&&i?new window.webLLM.ChatWorkerClient(i):new window.webLLM.ChatModule}}},{key:"getConfig",value:function(){var r,i=n.DEFAULT_MODEL;this._webModel.model&&(i=this._webModel.model);var o=JSON.parse(JSON.stringify(_N));if(this._webModel.urls){var s=o.model_list.find(function(a){return a.local_id=i});s&&(this._webModel.urls.model&&(s.model_url=this._webModel.urls.model),this._webModel.urls.wasm&&(s.model_lib_url=this._webModel.urls.wasm))}return(r=this._webModel.load)!=null&&r.skipCache&&(o.use_cache=!1),{model:i,appConfig:o}}},{key:"loadModel",value:(function(){var e=D(v().m(function i(o,s){var a=this,l,c,u,d,f,h,p,m,g,w,C,T,I,F,$,q;return v().w(function(G){for(;;)switch(G.p=G.n){case 0:return this.scrollToTop(),n.chat=o,this._isModelLoading=!0,m=((l=this._webModel.introMessage)==null?void 0:l.displayed)===!1,g=function(De){var qe;(qe=a._messages)==null||qe.addNewMessage({html:"<div>".concat(De[b],"</div>"),overwrite:!0,sendUpdate:!1}),m&&(setTimeout(function(){return rt.scrollToBottom(a._messages)}),m=!1)},n.chat.setInitProgressCallback(g),G.p=1,C=this.getConfig(),T=C.model,I=C.appConfig,F={},this._webModel.instruction&&(F.conv_config={system:this._webModel.instruction}),this._conversationHistory.length>0&&(F.conversation_history=this._conversationHistory),G.n=2,n.chat.reload(T,F,I,s);case 2:w=G.v,G.n=4;break;case 3:return G.p=3,q=G.v,G.a(2,this.unloadChat(q));case 4:(u=(c=this.deepChat)._validationHandler)==null||u.call(c),(d=this._webModel.introMessage)!=null&&d.removeAfterLoad?this._webModel.introMessage.displayed===!1?(h=this._messages)==null||h.removeLastMessage():(p=this._removeIntro)==null||p.call(this):($=yN.setUpAfterLoad(w,this._webModel.introMessage,this._chatEl,!!this._webModel.worker),(f=this._messages)==null||f.addNewMessage({html:$,overwrite:!0,sendUpdate:!1})),this._isModelLoaded=!0,this._isModelLoading=!1;case 5:return G.a(2)}},i,this,[[1,3]])}
146));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"unloadChat",value:(function(){var e=D(v().m(function i(o){var s,a;return v().w(function(l){for(;;)switch(l.n){case 0:if((s=this._messages)==null||s.addNewErrorMessage(jt,n.GENERIC_ERROR),console[E](o),this._isModelLoaded=!1,this._isModelLoading=!1,a=n.chat,!a){l.n=2;break}return l.n=1,n.chat.unload();case 1:n.chat=void 0;case 2:return l.a(2)}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"immediateResp",value:(function(){var e=D(v().m(function i(o,s,a){var l,c,u,d,f;return v().w(function(h){for(;;)switch(h.n){case 0:return u=_,d={},f=b,h.n=1,a.generate(s,void 0,0);case 1:return l=u(d,f,h.v),h.n=2,n.processResponse(this.deepChat,o,l);case 2:c=h.v,c&&c.forEach(function(p){return o.addNewMessage(p)}),this.completionsHandlers.onFinish();case 3:return h.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"streamResp",value:(function(){var e=D(v().m(function i(o,s,a){var l=this,c;return v().w(function(u){for(;;)switch(u.n){case 0:return this.streamHandlers.onAbort=function(){a.interruptGenerate()},this.streamHandlers.onOpen(),c=new To(o),u.n=1,a.generate(s,(function(){var d=D(v().m(function f(h,p){var m;return v().w(function(g){for(;;)switch(g.n){case 0:return g.n=1,n.processResponse(l.deepChat,o,_({},b,p));case 1:m=g.v,m&&c.upsertStreamedMessage(_(_({},b,m[0][b]),"overwrite",!0));case 2:return g.a(2)}},f)}));return function(f,h){return d.apply(this,arguments)}})());case 1:c.finaliseStreamedMessage(),this.streamHandlers.onClose();case 2:return u.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"generateRespByType",value:(function(){var e=D(v().m(function i(o,s,a,l){var c,u;return v().w(function(d){for(;;)switch(d.p=d.n){case 0:if(d.p=0,!a){d.n=2;break}return d.n=1,this.streamResp(o,s,l);case 1:d.n=3;break;case 2:return d.n=3,this.immediateResp(o,s,l);case 3:d.n=5;break;case 4:d.p=4,u=d.v,(c=this._messages)==null||c.addNewErrorMessage(jt),console.log(u);case 5:return d.a(2)}},i,this,[[0,4]])}));function r(i,o,s,a){return e.apply(this,arguments)}return r})()},{key:"generateResp",value:(function(){var e=D(v().m(function i(o,s,a){var l,c,u,d,f,h,p;return v().w(function(m){for(;;)switch(m.n){case 0:return l=s[s.length-1][b],m.n=1,Ue.processRequestInterceptor(this.deepChat,{body:_({},b,l)});case 1:c=m.v,u=c.body,d=c.error,f=!!this.stream;try{d?(Ue.displayError(o,new Error(d)),(f?this.streamHandlers.onClose:this.completionsHandlers.onFinish)()):!u||!u[b]?(h=h$({body:u},!1),console[E](h),p=f?this.streamHandlers.onClose:this.completionsHandlers.onFinish,Ue.onInterceptorError(o,h,p)):this.generateRespByType(o,u[b],!!this.stream,a)}catch(g){this.unloadChat(g)}case 2:return m.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a,l;return v().w(function(c){for(;;)switch(c.n){case 0:if(this._isModelLoaded){c.n=3;break}if(!this._loadOnFirstMessage){c.n=2;break}return c.n=1,this.init();case 1:c.n=3;break;case 2:return c.a(2);case 3:!n.chat||this._isModelLoading||((a=this._webModel.introMessage)!=null&&a.removeAfterMessage&&((l=this._removeIntro)==null||l.call(this)),o.addLoadingMessage(),this.generateResp(o,s,n.chat));case 4:return c.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"canSubmit",value:function(r){return!(r!=null&&r.trim())||this._isModelLoading?!1:this._loadOnFirstMessage?!0:!!this._isModelLoaded}},{key:"isWebModel",value:function(){return!0}}],[{key:"setUpHistory",value:function(r,i){i.forEach(function(o,s){if(o.role===et&&o[b]){var a=i[s+1];a!=null&&a[b]&&a.role!==et&&r.push([o[b],a[b]])}})}},{key:"processResponse",value:(function(){var e=D(v().m(function i(o,s,a){var l,c,u,d,f,h,p;return v().w(function(m){for(;;)switch(m.n){case 0:return m.n=1,(l=o.responseInterceptor)==null?void 0:l.call(o,a);case 1:if(p=m.v,p){m.n=2;break}p=a;case 2:if(u=p,!((c=o.connect)!=null&&c.stream&&Array.isArray(u)&&u.length>1)){m.n=3;break}return console[E](sP),m.a(2);case 3:if(d=Array.isArray(u)?u:[u],f=d.find(function(g){return typeof g[E]=="string"}),!f){m.n=4;break}return Ue.displayError(s,new Error(f[E])),m.a(2);case 4:if(!d.find(function(g){return!g||!g[b]})){m.n=5;break}return h=f$(a,!!o.responseInterceptor,u),Ue.displayError(s,new Error(h)),m.a(2);case 5:return m.a(2,d)}},i)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"clearAllCache",value:function(){n.clearCache("webllm/model"),n.clearCache("webllm/wasm")}}
146,{key:"clearCache",value:function(r){caches.open(r).then(function(i){i.keys().then(function(o){o.forEach(function(s){i.delete(s)})})})}}])})(Zv);Wc.GENERIC_ERROR="Error, please check the [troubleshooting](".concat(at,"webModel#troubleshooting) section of documentation for help."),Wc.MULTIPLE_MODELS_ERROR="Cannot run multiple web models",Wc.WEB_LLM_NOT_FOUND_ERROR="WebLLM module not found",Wc.DEFAULT_MODEL="Llama-2-7b-chat-hf-q4f32_1",Wc.MODULE_SEARCH_LIMIT_S=5;var KS=Wc,on=function(n,e,r,i){return{url:n,method:e,handleVerificationResult:r,augmentUrl:i}},Sz=function(n){return _(_({},Xt,"".concat(Fn).concat(n)),Ze,Ct)},Dz=function(n,e,r,i){var o=n;Array.isArray(o[E])&&o[E][0]==="Error in `parameters`: field required"?r(e):i(en)},Iz=function(){return on("https://api-inference.huggingface.co/models/gpt2",fn,Dz)},FP=(function(t){function n(e,r,i,o,s,a){var l;return k(this,n),l=K(this,n,[e,Iz(),Sz,s,a]),l.insertKeyPlaceholderText="Hugging Face Token",l.keyHelpUrl="https://huggingface.co/settings/tokens",l.permittedErrorPrefixes=[BS],l.url="".concat(n.URL_PREFIX).concat(i),l.textInputPlaceholderText=r,B(o)=="object"&&(o.model&&(l.url="".concat(n.URL_PREFIX).concat(o.model)),o.options&&(l.rawBody.options=o.options),o.parameters&&(l.rawBody.parameters=o.parameters)),l}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i,o){var s,a=JSON.parse(JSON.stringify(r)),l=i[i.length-1][b];if(l)return(s=a.options)!==null&&s!==void 0||(a.options={}),a.options.wait_for_model=!0,Je({inputs:l},a)}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s,a){var l;return v().w(function(c){for(;;)switch(c.n){case 0:if(this.connectSettings){c.n=1;break}throw new Error(sr);case 1:l=this.preprocessBody(this.rawBody,s,a),Sn.request(this,l,o);case 2:return c.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()}])})(ge);FP.URL_PREFIX="https://api-inference.huggingface.co/models/";var cl=FP,JS=(function(t){function n(e,r,i,o,s,a){var l;return k(this,n),l=K(this,n,[e,r,i,o,s,a]),l.isTextInputDisabled=!0,l.canSendMessage=n.canSendFile,l}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i,o){return o[0]}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s,a){return v().w(function(l){for(;;)switch(l.n){case 0:if(this.connectSettings){l.n=1;break}throw new Error(sr);case 1:if(a!=null&&a[0]){l.n=2;break}throw new Error(ty);case 2:Sn.poll(this,a[0],o,!1);case 3:return l.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()}],[{key:"canSendFile",value:function(r,i){return!!(i!=null&&i[0])}}])})(cl),Tz=(function(t){function n(e){k(this,n);var r,i,o,s=(i=(r=e.directConnection)==null?void 0:r.huggingFace)==null?void 0:i.audioClassification,a=(o=e.directConnection)==null?void 0:o.huggingFace;return K(this,n,[e,"Attach an audio ".concat(Bt),"ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition",s,a,{audio:{}}])}return J(n,t),M(n,[{key:"extractPollResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o.estimated_time){a.n=1;break}return a.a(2,{timeoutMS:(o.estimated_time+1)*1e3});case 1:if(!o[E]){a.n=2;break}throw o[E];case 2:return a.a(2,_({},b,((s=o[0])==null?void 0:s.label)||""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(JS),kz=(function(t){function n(e){k(this,n);var r,i,o,s=(i=(r=e.directConnection)==null?void 0:r.huggingFace)==null?void 0:i.imageClassification,a=(o=e.directConnection)==null?void 0:o.huggingFace;return K(this,n,[e,"Attach an image ".concat(Bt),"google/vit-base-patch16-224",s,a,{images:{}}])}return J(n,t),M(n,[{key:"extractPollResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o.estimated_time){a.n=1;break}return a.a(2,{timeoutMS:(o.estimated_time+1)*1e3});case 1:if(!o[E]){a.n=2;break}throw o[E];case 2:return a.a(2,_({},b,((s=o[0])==null?void 0:s.label)||""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(JS),oy=function(n){return _(_({},Xt,"".concat(Fn).concat(n)),Ze,Ct)}
146,Mz=function(n,e,r,i){n.message?i(en):r(e)},sy=function(){return on("https://api.stability.ai/v1/engines/list",Qt,Mz)},eu="data:image/png;base64,",ay=(function(t){function n(e,r,i,o,s){var a;return k(this,n),a=K(this,n,[e,r,i,o,s]),a.insertKeyPlaceholderText=a.genereteAPIKeyName("Stability AI"),a.keyHelpUrl="https://platform.stability.ai/docs/getting-started/authentication",a.permittedErrorPrefixes=[df,"invalid_"],a}return J(n,t),M(n)})(ge),Az=(function(t){function n(e){var r;k(this,n);var i,o=JSON.parse(JSON.stringify(e.directConnection)),s=o?.stabilityAI,a={images:{files:{acceptedFormats:".png",maxNumberOfFiles:1}}};r=K(this,n,[e,sy(),oy,s,a]),r.url="https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale",r.textInputPlaceholderText="Describe image changes";var l=(i=o?.stabilityAI)==null?void 0:i.imageToImageUpscale;return B(l)=="object"&&(l.engine_id&&(r.url="https://api.stability.ai/v1/generation/".concat(l.engine_id,"/image-to-image/upscale")),n.cleanConfig(l),Object.assign(r.rawBody,l)),r.canSendMessage=n.canSendFileMessage,r}return J(n,t),M(n,[{key:"createFormDataBody",value:function(r,i){var o=new FormData;return o.append(it,i),Object.keys(r).forEach(function(s){o.append(s,String(r[s]))}),o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s,a){var l;return v().w(function(c){for(;;)switch(c.n){case 0:if(this.connectSettings){c.n=1;break}throw new Error(sr);case 1:if(a){c.n=2;break}throw new Error(LS);case 2:l=this.createFormDataBody(this.rawBody,a[0]),Ue.tempRemoveContentHeader(this.connectSettings,Sn.request.bind(this,this,l,o),!1);case 3:return c.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o.message){a.n=1;break}throw o.message;case 1:return s=o.artifacts.map(function(l){return _(_({},Y,"".concat(eu).concat(l.base64)),ce,it)}),a.a(2,_({},x,s))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}],[{key:"cleanConfig",value:function(r){delete r.engine_id}},{key:"canSendFileMessage",value:function(r,i){return!!(i!=null&&i[0])}}])})(ay),xz=(function(t){function n(e){var r;k(this,n);var i,o=JSON.parse(JSON.stringify(e.directConnection)),s=o?.stabilityAI,a=_({},wt,_({},x,{acceptedFormats:".png",maxNumberOfFiles:2}));r=K(this,n,[e,sy(),oy,s,a]),r.url="https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking",r._maskSource="MASK_IMAGE_WHITE",r.textInputPlaceholderText="Describe image changes";var l=(i=o?.stabilityAI)==null?void 0:i.imageToImageMasking;return B(l)=="object"&&(l.engine_id&&(r.url="https://api.stability.ai/v1/generation/".concat(l.engine_id,"/image-to-image/masking")),l.weight!==void 0&&l.weight!==null&&(r._imageWeight=l.weight),l.mask_source!==void 0&&l.mask_source!==null&&(r._maskSource=l.mask_source),n.cleanConfig(l),Object.assign(r.rawBody,l)),r.canSendMessage=n.canSendFileTextMessage,r}return J(n,t),M(n,[{key:"createFormDataBody",value:function(r,i,o,s){var a=new FormData;return a.append("init_image",i),a.append("mask_source",String(this._maskSource)),a.append("mask_image",o),s&&s!==""&&a.append("text_prompts[0][text]",s),this._imageWeight!==void 0&&this._imageWeight!==null&&a.append("text_prompts[0][weight]",String(this._imageWeight)),Object.keys(r).forEach(function(l){a.append(l,String(r[l]))}),a.get("weight")===void 0&&a.append("weight",String(1)),a}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s,a){var l,c,u,d;return v().w(function(f){for(;;)switch(f.n){case 0:if(this.connectSettings){f.n=1;break}throw new Error(sr);case 1:if(!(!a||!a[0]||!a[1])){f.n=2;break}throw new Error(LS);case 2:u=(c=(l=s[s.length-1])==null?void 0:l[b])==null?void 0:c.trim(),d=this.createFormDataBody(this.rawBody,a[0],a[1],u),Ue.tempRemoveContentHeader(this.connectSettings,Sn.request.bind(this,this,d,o),!1);case 3:return f.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o.message){a.n=1;break}throw o.message;case 1:return s=o.artifacts.map(function(l){return _(_({},Y,"".concat(eu).concat(l.base64)),ce,it)}),a.a(2,_({},x,s))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}],[{key:"cleanConfig",value:function(r){delete r.engine_id,delete r.weight}},{key:"canSendFileTextMessage",value:function(r,i){return!!(i!=null&&i[0])&&!!(r&&r.trim()!=="")}}])})(ay),Rz=(function(t){function n(e){k(this,n);var r,i,o,s=(i=(r=e.directConnection)==null?void 0:r.huggingFace)==null?void 0:i.audioSpeechRecognition,a=(o=e.directConnection)==null?void 0:o.huggingFace;return K(this,n,[e,"Attach an audio ".concat(Bt),"facebook/wav2vec2-large-960h-lv
14660-self",s,a,{audio:{}}])}return J(n,t),M(n,[{key:"extractPollResultData",value:(function(){var e=D(v().m(function i(o){return v().w(function(s){for(;;)switch(s.n){case 0:if(!o.estimated_time){s.n=1;break}return s.a(2,{timeoutMS:(o.estimated_time+1)*1e3});case 1:if(!o[E]){s.n=2;break}throw o[E];case 2:return s.a(2,_({},b,o[b]||""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(JS),Oz=(function(t){function n(e){k(this,n);var r,i,o,s=(i=(r=e.directConnection)==null?void 0:r.huggingFace)==null?void 0:i.textGeneration,a=(o=e.directConnection)==null?void 0:o.huggingFace;return K(this,n,[e,"Once upon a time","gpt2",s,a])}return J(n,t),M(n,[{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o[E]){a.n=1;break}throw o[E];case 1:return a.a(2,_({},b,((s=o[0])==null?void 0:s.generated_text)||""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(cl),Nz=(function(t){function n(e){var r;k(this,n);var i,o,s,a=(o=(i=e.directConnection)==null?void 0:i.huggingFace)==null?void 0:o.questionAnswer,l=(s=e.directConnection)==null?void 0:s.huggingFace;return r=K(this,n,[e,"Ask a question","bert-large-uncased-whole-word-masking-finetuned-squad",a,l]),r.permittedErrorPrefixes=[BS,"Error in"],r._context=a.context,r}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=i[i.length-1][b];if(o)return{inputs:{question:o,context:this._context,options:{wait_for_model:!0}}}}},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){return v().w(function(s){for(;;)switch(s.n){case 0:if(!o[E]){s.n=1;break}throw o[E];case 1:return s.a(2,_({},b,o.answer||""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(cl),Pz=(function(t){function n(e){k(this,n);var r,i,o,s=(i=(r=e.directConnection)==null?void 0:r.huggingFace)==null?void 0:i.summarization,a=(o=e.directConnection)==null?void 0:o.huggingFace;return K(this,n,[e,"Insert text to summarize","facebook/bart-large-cnn",s,a])}return J(n,t),M(n,[{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o[E]){a.n=1;break}throw o[E];case 1:return a.a(2,_({},b,((s=o[0])==null?void 0:s.summary_text)||""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(cl),Fz=(function(t){function n(e){var r,i;k(this,n);var o,s,a,l=(s=(o=e.directConnection)==null?void 0:o.huggingFace)==null?void 0:s.conversation,c=(a=e.directConnection)==null?void 0:a.huggingFace;return i=K(this,n,[e,"Ask me anything!","facebook/blenderbot-400M-distill",l,c]),(r=i.maxMessages)!==null&&r!==void 0||(i.maxMessages=-1),i}return J(n,t),M(n,[{key:"processMessagesI",value:function(r){var i=r.filter(function(c){return c[b]}),o=i[i.length-1][b],s=i.slice(0,i.length-1);if(o){var a=s.filter(function(c){return c.role===et}).map(function(c){return c[b]}),l=s.filter(function(c){return c.role===xt}).map(function(c){return c[b]});return{past_user_inputs:a,generated_responses:l,mostRecentMessageText:o}}}},{key:"preprocessBody",value:function(r,i){var o,s=JSON.parse(JSON.stringify(r)),a=this.processMessagesI(i);if(a)return(o=s.options)!==null&&o!==void 0||(s.options={}),s.options.wait_for_model=!0,Je({inputs:_({past_user_inputs:a.past_user_inputs,generated_responses:a.generated_responses},b,a.mostRecentMessageText)},s)}},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){return v().w(function(s){for(;;)switch(s.n){case 0:if(!o[E]){s.n=1;break}throw o[E];case 1:return s.a(2,_({},b,o.generated_text||""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(cl),Lz=(function(t){function n(e){var r;k(this,n);var i,o=JSON.parse(JSON.stringify(e.directConnection)),s=o.stabilityAI,a=_({},wt,_({},x,{acceptedFormats:".png",maxNumberOfFiles:1}));r=K(this,n,[e,sy(),oy,s,a]),r.url="https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image",r.textInputPlaceholderText="Describe image changes";var l=(i=o.stabilityAI)==null?void 0:i.imageToImage;return B(l)=="object"&&(l.engine_id&&(r.url="https://api.stability.ai/v1/generation/".concat(l.engine_id,"/text-to-image")),l.weight!==void 0&&l.weight!==null&&(r._imageWeight=l.weight),n.cleanConfig(l),Object.assign(r.rawBody,l)),r.canSendMessage=n.canSendFileTextMessage,r}return J(n,t),M(n,[{key:"createFormDataBody",value:function(r,i,o){var s=new FormData;return s.append("init_image",i),o&&o!==""&&s.append("text_prompts[0][text]",o),this._imageWeight!==void 0&&this._imageWeight!==null&&s.append("text_prompts[0][weight]",String(this._imageWeight)),Object.keys(r).forEach(function(a){s.append(a,String(r[a]))}),s.get("weight")===void 0&&s.append("weight",String(1)),s}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s,a){var l,c,u,d;return v().w(function(f){for(;;)switch(f.n){case 0:if(this.connectSettings){f.n=1;break}throw new Error(sr);case 1:if(a){f.n=2;break}throw new Error(LS);case 2:u=(c=(l=s[s.length-1])==null?void 0:l[b])==null?void 0:c.trim(),d=this.createFormDataBody(this.rawBody,a[0],u),Ue.tempRemoveContentHeader(this.connectSettings,Sn.request.bind(this,this,d,o),!1);case 3:return f.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o.message){a.n=1;break}throw o.message;case 1:return s=o.artifacts.map(function(l){return _(_({},Y,"".concat(eu).concat(l.base64)),ce,it)}),a.a(2,_({},x,s))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}],[{key:"cleanConfig",value:function(r){delete r.engine_id,delete r.weight}},{key:"canSendFileTextMessage",value:function(r,i){return!!(i!=null&&i[0])&&!!(r&&r.trim()!=="")}}])})(ay),jz=(function(t){function n(e){k(this,n);var r,i,o,s=(i=(r=e.directConnection)==null?void 0:r.huggingFace)==null?void 0:i.translation,a=(o=e.directConnection)==null?void 0:o.huggingFace;return K(this,n,[e,"Insert text to translate","Helsinki-NLP/opus-tatoeba-en-ja",s,a])}return J(n,t),M(n,[{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o[E]){a.n=1;break}throw o[E];case 1:return a.a(2,_({},b,((s=o[0])==null?void 0:s.translation_text)||""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(cl),Bz=(function(t){function n(e){var r;k(this,n);var i,o=JSON.parse(JSON.stringify(e.directConnection)),s=o.stabilityAI;r=K(this,n,[e,sy(),oy,s]),r.url="https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image",r.textInputPlaceholderText="Describe an image";var a=(i=o.stabilityAI)==null?void 0:i.textToImage;return B(a)=="object"&&(a.engine_id&&(r.url="https://api.stability.ai/v1/generation/".concat(a.engine_id,"/text-to-image")),a.weight!==void 0&&a.weight!==null&&(r._imageWeight=a.weight),n.cleanConfig(a),Object.assign(r.rawBody,a)),r.canSendMessage=n.canSendTextMessage,r}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=i[i.length-1][b],s=JSON.parse(JSON.stringify(r)),a=_({},b,o);
146return this._imageWeight&&(a.weight=this._imageWeight),s.text_prompts=[a],s}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this));case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o.message){a.n=1;break}throw o.message;case 1:return s=o.artifacts.map(function(l){return _(_({},Y,"".concat(eu).concat(l.base64)),ce,it)}),a.a(2,_({},x,s))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}],[{key:"cleanConfig",value:function(r){delete r.engine_id,delete r.weight}},{key:"canSendTextMessage",value:function(r){return!!(r&&r.trim()!=="")}}])})(ay),Vz=(function(t){function n(e){var r;k(this,n);var i,o,s,a=(o=(i=e.directConnection)==null?void 0:i.huggingFace)==null?void 0:o.fillMask,l=(s=e.directConnection)==null?void 0:s.huggingFace;return r=K(this,n,[e,"The goal of life is [MASK].","bert-base-uncased",a,l]),r.permittedErrorPrefixes=[BS,"No mask_token"],r}return J(n,t),M(n,[{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o[E]){a.n=1;break}throw o[E];case 1:return a.a(2,_({},b,((s=o[0])==null?void 0:s.sequence)||""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(cl),YS=function(n){return _(_({},Ze,Ct),Xt,"".concat(Fn).concat(n))},Uz=function(n,e,r,i){var o=n;o[E]?o[E].message===jS?i(en):i(Mr):r(e)},ZS=function(){return on("https://open.bigmodel.cn/api/paas/v4/models",Qt,Uz)},Hz=(function(t){function n(e){var r,i,o;k(this,n);var s,a,l,c=JSON.parse(JSON.stringify(e.directConnection)),u=c.bigModel;o=K(this,n,[e,ZS(),YS,u]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("BigModel"),o.keyHelpUrl="https://open.bigmodel.cn/usercenter/apikeys",o.url="https://open.bigmodel.cn/api/paas/v4/audio/speech",o.permittedErrorPrefixes=[Xt,Ln];var d=(s=c.bigModel)==null?void 0:s.textToSpeech;return B(d)===ze&&(o.cleanConfig(d),Object.assign(o.rawBody,d)),(r=(a=o.rawBody).model)!==null&&r!==void 0||(a.model="cogtts"),(i=(l=o.rawBody).voice)!==null&&i!==void 0||(l.voice="tongtong"),o}return J(n,t),M(n,[{key:"cleanConfig",value:function(r){delete r.key}},{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=i[i.length-1];return o.input=s?.[b]||"",o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:return a.a(2,this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this)))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s,a;return v().w(function(l){for(;;)switch(l.n){case 0:return s=new Blob([o],_({},ce,"audio/mpeg")),a=URL.createObjectURL(s),l.a(2,_({},x,[_(_({},Y,a),ce,$e)]))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge),XS=function(n){return _(_({},Ze,Ct),Xt,"".concat(Fn).concat(n))},$z=function(n,e,r,i){var o=n;o[E]?o[E].message===jS?i(en):i(Mr):r(e)},QS=function(){return on("https://api.together.xyz/v1/models",Qt,$z)},zz=(function(t){function n(e){var r,i,o;k(this,n);var s,a,l,c=JSON.parse(JSON.stringify(e.directConnection)),u=c.together;o=K(this,n,[e,QS(),XS,u]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("Together AI"),o.keyHelpUrl="https://api.together.xyz/settings/api-keys",o.url="https://api.together.xyz/v1/audio/speech",o.permittedErrorPrefixes=[Qr,Ln];var d=(s=c.together)==null?void 0:s.textToSpeech;return B(d)===ze&&o.completeConfig(d),(r=(a=o.rawBody).model)!==null&&r!==void 0||(a.model="cartesia/sonic"),(i=(l=o.rawBody).voice)!==null&&i!==void 0||(l.voice="laidback woman"),o}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=i[i.length-1];return o.input=s?.[b]||"",o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:return a.a(2,this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this)))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s,a;return v().w(function(l){for(;;)switch(l.n){case 0:return s=new Blob([o],_({},ce,"audio/mpeg")),a=URL.createObjectURL(s),l.a(2,_({},x,[_(_({},Y,a),ce,$e)]))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge),mr="https://api.openai.com/v1/",tu="https://platform.openai.com/account/api-keys",TS="input_text",bN="input_image",wN="output_text",hS="image_generation_call",LP="function_call_output",kh="response",nu=function(n){return _(_({},Xt,"".concat(Fn).concat(n)),Ze,Ct)},jP=function(n,e,r,i){var o=n;o[E]?o[E].code==="invalid_api_key"?i(en):i(Mr):r(e)},ru=function(){return on("".concat(mr,"models"),Qt,jP)}
146,ys=(function(){var t=D(v().m(function n(e,r,i){var o,s,a,l,c,u,d,f,h,p,m,g,w=arguments;return v().w(function(C){for(;;)switch(C.n){case 0:return o=w.length>3&&w[3]!==void 0?w[3]:!0,s=e.connectSettings,a=e.deepChat,l=e.completionsHandlers,c=e.messages,s.method=i,u={body:r,headers:s.headers},C.n=1,Ue.processRequestInterceptor(a,u);case 1:if(d=C.v,f=d.body,h=d.headers,p=d.error,m=l.onFinish,!(p&&c)){C.n=2;break}return C.a(2,Ue.onInterceptorError(c,p,m));case 2:return C.n=3,Ue.fetch(e,h,o,f).then(function(T){return Ue.processResponseByType(T)});case 3:if(g=C.v,!g[E]){C.n=4;break}throw g[E].message;case 4:return C.a(2,g)}},n)}));return function(e,r,i){return t.apply(this,arguments)}})(),kS=(function(){function t(){k(this,t)}return M(t,null,[{key:"storeFiles",value:(function(){var n=D(v().m(function r(i,o,s,a){var l,c,u,d,f;return v().w(function(h){for(;;)switch(h.p=h.n){case 0:if(l=i.connectSettings.headers,l){h.n=1;break}return h.a(2);case 1:return i.url=a,c=l[Ze],delete l[Ze],u=s.map((function(){var p=D(v().m(function m(g){var w;return v().w(function(C){for(;;)switch(C.n){case 0:return w=new FormData,C.a(2,(w.append("purpose","assistants"),w.append("file",g),new Promise(function(T){T(ys(i,w,fn,!1))})))}},m)}));return function(m){return p.apply(this,arguments)}})()),h.p=2,h.n=3,Promise.all(u);case 3:return d=h.v.map(function(p){return{id:p.id,name:p.filename}}),h.a(2,(l[Ze]=c,d));case 4:throw h.p=4,f=h.v,l[Ze]=c,Ue.displayError(o,f),i.completionsHandlers.onFinish(),f;case 5:return h.a(2)}},r,null,[[2,4]])}));function e(r,i,o,s){return n.apply(this,arguments)}return e})()},{key:"getType",value:function(e,r){var i=e[r].path;return!i||i.endsWith("png")?it:nl}},{key:"getFiles",value:(function(){var n=D(v().m(function r(i,o,s,a){var l,c;return v().w(function(u){for(;;)switch(u.n){case 0:return l=o.map(function(d){var f=d.fileId;return i.url="".concat(s).concat(f).concat(a),new Promise(function(h){h(ys(i,void 0,"GET",!1))})}),u.n=1,Promise.all(l);case 1:return c=u.v.map(function(d,f){return new Promise(function(h){var p=new FileReader;p.readAsDataURL(d),p.onload=function(m){h(_(_(_({},Y,m.target.result),"name",o[f].name),ce,t.getType(o,f)))}})}),u.n=2,Promise.all(c);case 2:return u.a(2,u.v)}},r)}));function e(r,i,o,s){return n.apply(this,arguments)}return e})()},{key:"getFileName",value:function(e){var r=e.split("/");return r[r.length-1]}},{key:"getFilesAndNewText",value:(function(){var n=D(v().m(function r(i,o,s,a,l){var c,u,d,f,h,p;return v().w(function(m){for(;;)switch(m.n){case 0:if(f=s.getFilesPrefix,h=s.getFilesPostfix,p=o.length>0,!p){m.n=2;break}return m.n=1,t.getFiles(i,o,f,h);case 1:d=m.v,(c=l?.[b])!=null&&c.value&&d.forEach(function(g,w){var C;if(g[Y]){var T=o[w].path;(C=l?.[b])!=null&&C.value&&T&&(l[b].value=l[b].value.replace(T,g[Y]))}});case 2:return m.a(2,(u=l?.[b])!=null&&u.value?_(_({},b,l[b].value),"role",a):_(_({},x,d),"role",a))}},r)}));function e(r,i,o,s,a){return n.apply(this,arguments)}return e})()},{key:"getFileDetails",value:function(e,r){var i,o=[];return(i=r?.[b])!=null&&i.value&&e.content.forEach(function(s){var a,l;(l=(a=s[b])==null?void 0:a.annotations)==null||l.forEach(function(c){var u;c[b]&&c[b].startsWith("sandbox:")&&(u=c.file_path)!=null&&u.file_id&&o.push({path:c[b],fileId:c.file_path.file_id,name:t.getFileName(c[b])})})}),r!=null&&r.image_file&&o.push({fileId:r.image_file.file_id}),o}},{key:"getFilesAndText",value:(function(){var n=D(v().m(function r(i,o,s,a){var l;return v().w(function(c){for(;;)switch(c.n){case 0:return l=t.getFileDetails(o,a),c.n=1,t.getFilesAndNewText(i,l,s,o.role,a);case 1:return c.a(2,c.v)}},r)}));function e(r,i,o,s){return n.apply(this,arguments)}return e})()},{key:"parseResult",value:function(e,r){var i=[];if(r)i=e.data;else for(var o=0;o<e.data.length;o+=1){var s=e.data[o];if(s.role===Qi)i.push(s);else break}return i.reverse()}},{key:"parseMessages",value:function(e,r,i){var o=[];return r.forEach((function(){var s=D(v().m(function a(l){return v().w(function(c){for(;;)switch(c.n){case 0:l.content.filter(function(u){return!!u[b]||!!u.image_file}).sort(function(u){return u[b]?-1:u.image_file?1:0}
146).forEach((function(){var u=D(v().m(function d(f){return v().w(function(h){for(;;)switch(h.n){case 0:o.push(t.getFilesAndText(e,l,i,f));case 1:return h.a(2)}},d)}));return function(d){return u.apply(this,arguments)}})());case 1:return c.a(2)}},a)}));return function(a){return s.apply(this,arguments)}})()),Promise.all(o)}},{key:"processStreamMessages",value:(function(){var n=D(v().m(function r(i,o,s){return v().w(function(a){for(;;)switch(a.n){case 0:return a.a(2,t.parseMessages(i,[{content:o,role:Qi}],s))}},r)}));function e(r,i,o){return n.apply(this,arguments)}return e})()},{key:"processAPIMessages",value:(function(){var n=D(v().m(function r(i,o,s,a){var l;return v().w(function(c){for(;;)switch(c.n){case 0:return l=t.parseResult(o,s),c.a(2,t.parseMessages(i,l,a))}},r)}));function e(r,i,o,s){return n.apply(this,arguments)}return e})()}])})();kS.FILES_WITH_TEXT_ERROR="content with type `text` must have `text` values",kS.FUNCTION_TOOL_RESP_ERROR="Response must contain an array of strings for each individual function/tool_call, see ".concat(at,"directConnection/OpenAI/#assistant-functions.");var Ya=kS,BP=(function(t){function n(e,r,i,o,s,a){var l;if(k(this,n),l=K(this,n,[e,o,s,a]),l.insertKeyPlaceholderText=l.genereteAPIKeyName("OpenAI"),l.keyHelpUrl=tu,l.url="",l.permittedErrorPrefixes=[df,"Please send text",GS.FAILED_ERROR_MESSAGE],l.shouldFetchHistory=!1,l._searchedForThreadId=!1,l._config={},l._newAssistantDetails={model:"gpt-4"},l._waitingForStreamResponse=!1,l._isSSEStream=!1,l.urlSegments=i,B(r)=="object"){l._config=r;var c=l._config,u=c.new_assistant,d=c.thread_id,f=c.load_thread_history;Object.assign(l._newAssistantDetails,u),d&&(l.sessionId=d),f&&(l.shouldFetchHistory=!0)}return l.maxMessages=1,l._isSSEStream=!!(l.stream&&(B(l.stream)!="object"||!l.stream.simulation)),l}return J(n,t),M(n,[{key:"fetchHistoryFunc",value:(function(){var e=D(v().m(function i(){var o=this,s,a;return v().w(function(l){for(;;)switch(l.p=l.n){case 0:return setTimeout(function(){return o.deepChat.disableSubmitButton()},2),l.p=1,l.n=2,this.getThreadMessages(this.sessionId,!0);case 2:return s=l.v,l.a(2,(this.deepChat.disableSubmitButton(!1),s));case 3:return l.p=3,a=l.v,l.a(2,[_({},E,lP)])}},i,this,[[1,3]])}));function r(){return e.apply(this,arguments)}return r})()},{key:"processMessage",value:function(r,i){var o=this.totalMessagesMaxCharLength||-1,s=WS.getCharacterLimitMessages(r,o)[0];if(i&&i.length>0){var a=this.filesToolType;if(typeof this.filesToolType=="function"){var l=this.filesToolType(i.map(function(u){var d=u.name;return d}));l==="code_interpreter"||l==="file_search"||l===wt?a=l:(console[E]('Tool type "'.concat(l,'" is not valid')),console[E]('Expected "code_interpreter" or "file_search" or "images". Going to default to "images"'))}if(a==="file_search")return n.processAttachmentsMessage(s,i,"file_search");if(a==="code_interpreter")return n.processAttachmentsMessage(s,i,"code_interpreter");if(i.find(function(u){var d=u.name;return!Zr.isImageFileExtension(d)}))console[E]("The uploaded files contained a non-image file"),console[E]('Make sure only images can be uploaded or define a "code_interpreter" or "file_search" value in the "files_tool_type" property'),console.warn('Make sure your existing assistant supports these "tools" or specify them in the "new_assistant" property');else{var c=n.processImageMessage(s,i);if(c)return c}}return{content:s[b]||"",role:et}}},{key:"createNewThreadMessages",value:function(r,i,o){var s=JSON.parse(JSON.stringify(r)),a=this.processMessage(i,o);return s.thread={messages:[a]},s}},{key:"callService",value:function(r,i,o){if(this.messages=r,this.sessionId){this.url="".concat(this.urlSegments.threadsPrefix,"/").concat(this.sessionId,"/messages").concat(this.urlSegments.createMessagePostfix);var s=this.processMessage(i,o);Sn.request(this,s,r)}else{this.url="".concat(this.urlSegments.threadsPrefix,"/runs").concat(this.urlSegments.threadsPosfix);var a=this.createNewThreadMessages(this.rawBody,i,o);this._isSSEStream?this.createStreamRun(a):Sn.request(this,a,r)}}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s,a){var l,c,u,d,f;return v().w(function(h){for(;;)switch(h.n){case 0:if(this._waitingForStreamResponse=!1,!!this.connectSettings){h.n=1;break}throw new Error(sr);case 1:if(!((l=(c=this.rawBody).assistant_id)!==null&&l!==void 0)){h.n=2;break}h.n=5;break;case 2:if(d=this._config.assistant_id,d){h.n=4;break}return h.n=3,this.createNewAssistant();case 3:d=h.v;case 4:c.assistant_id=d;
146case 5:if(this._searchedForThreadId||this.searchPreviousMessagesForThreadId(o.messageToElements),!a){h.n=7;break}return h.n=6,Ya.storeFiles(this,o,a,this.urlSegments.storeFiles);case 6:f=h.v,h.n=8;break;case 7:f=void 0;case 8:u=f,this.connectSettings.method=fn,this.callService(o,s,u);case 9:return h.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"createNewAssistant",value:(function(){var e=D(v().m(function i(){var o,s;return v().w(function(a){for(;;)switch(a.p=a.n){case 0:return a.p=0,this.url=this.urlSegments.newAssistantUrl,a.n=1,ys(this,JSON.parse(JSON.stringify(this._newAssistantDetails)),fn);case 1:return o=a.v,a.a(2,(this._config.assistant_id=o.id,this._config.assistant_id));case 2:a.p=2,s=a.v,console[E](s),console[E]("Failed to create a new assistant");case 3:return a.a(2)}},i,this,[[0,2]])}));function r(){return e.apply(this,arguments)}return r})()},{key:"searchPreviousMessagesForThreadId",value:function(r){var i=r.find(function(o){var s=el(o,1),a=s[0];return a._sessionId});i&&(this.sessionId=i[0]._sessionId),this._searchedForThreadId=!0}},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s,a,l;return v().w(function(c){for(;;)switch(c.n){case 0:if(!(this._waitingForStreamResponse||this._isSSEStream&&this.sessionId)){c.n=2;break}return c.n=1,this.handleStream(o);case 1:return c.a(2,c.v);case 2:if(!o[E]){c.n=3;break}throw o[E].message.startsWith(Ya.FILES_WITH_TEXT_ERROR)?Error("Please send text with your file(s)"):o[E].message;case 3:return this.asyncCallInProgress=!0,c.n=4,this.assignThreadAndRun(o);case 4:return a="".concat(this.urlSegments.threadsPrefix,"/").concat(this.sessionId,"/runs/").concat(this.run_id).concat(this.urlSegments.threadsPosfix),l={method:Qt,headers:(s=this.connectSettings)==null?void 0:s.headers},c.a(2,(Sn.executePollRequest(this,a,l,this.messages),_({},b,"")))}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"assignThreadAndRun",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!this.sessionId){a.n=2;break}return this.url="".concat(this.urlSegments.threadsPrefix,"/").concat(this.sessionId,"/runs").concat(this.urlSegments.threadsPosfix),a.n=1,ys(this,JSON.parse(JSON.stringify(this.rawBody)),fn);case 1:s=a.v,this.run_id=s.id,a.n=3;break;case 2:this.sessionId=o.thread_id,this.run_id=o.id,this.updateSessionId(this.sessionId);case 3:return a.a(2)}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"getThreadMessages",value:(function(){var e=D(v().m(function i(o){var s,a,l,c,u=arguments,d;return v().w(function(f){for(;;)switch(f.n){case 0:return s=u.length>1&&u[1]!==void 0?u[1]:!1,this.url="".concat(this.urlSegments.threadsPrefix,"/").concat(o,"/messages?").concat(this.urlSegments.listMessagesPostfix),f.n=1,ys(this,{},Qt);case 1:if(c=f.v,d=!s&&this.deepChat.responseInterceptor,!d){f.n=3;break}return f.n=2,(l=(a=this.deepChat).responseInterceptor)==null?void 0:l.call(a,c);case 2:c=f.v;case 3:return f.a(2,Ya.processAPIMessages(this,c,s,this.urlSegments))}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"extractPollResultData",value:(function(){var e=D(v().m(function i(o){var s=this,a,l,c,u,d,f,h,p;return v().w(function(m){for(;;)switch(m.n){case 0:if(l=o.status,c=o.required_action,!(l==="queued"||l==="in_progress")){m.n=1;break}return m.a(2,{timeoutMS:n.POLLING_TIMEOUT_MS});case 1:if(!(l===VS&&this.messages)){m.n=3;break}return m.n=2,this.getThreadMessages(o.thread_id);case 2:return u=m.v,d=u.shift(),f=d.text,h=d.files,m.a(2,(setTimeout(function(){u.forEach(function(g){return s.deepChat.addMessage(g)})}),_({text:f,_sessionId:this.sessionId},x,h)));case 3:if(p=(a=c?.submit_tool_outputs)==null?void 0:a.tool_calls,!(l==="requires_action"&&p)){m.n=5;break}return m.n=4,this.handleTools(p);case 4:return m.a(2,m.v);case 5:throw Error("Thread run status: ".concat(l));case 6:return m.a(2)}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"handleTools",value:(function(){var e=D(v().m(function i(o){var s,a,l,c,u,d;return v().w(function(f){for(;;)switch(f.n){case 0:if(this.functionHandler){f.n=1;break}throw Error(Es);case 1:return s=o.map(function(h){return{name:h.function.name,arguments:h.function.arguments}}),f.n=2,this.functionHandler(s);case 2:if(a=f.v,!(!Array.isArray(a)||o.length!==a.length)){f.n=3;break}throw Error(Ya.FUNCTION_TOOL_RESP_ERROR);case 3:return f.n=4,Promise.all(a);case 4:if(l=f.v,!l.find(function(h){return typeof h!="string"})){f.n=5;break}throw Error(Ya.FUNCTION_TOOL_RESP_ERROR);case 5:if(c=l.map(function(h,p){return{tool_call_id:o[p].id,output:h}}),u="".concat(this.urlSegments.threadsPrefix,"/").concat(this.sessionId),d="/runs/".concat(this.run_id,"/submit_tool_outputs").concat(this.urlSegments.threadsPosfix),this.url="".concat(u).
146concat(d),!this._isSSEStream){f.n=7;break}return f.n=6,this.createStreamRun({tool_outputs:c});case 6:f.n=8;break;case 7:return f.n=8,ys(this,{tool_outputs:c},fn);case 8:return f.a(2,{timeoutMS:n.POLLING_TIMEOUT_MS})}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"handleStream",value:(function(){var e=D(v().m(function i(o){var s,a,l,c;return v().w(function(u){for(;;)switch(u.n){case 0:if(l=(a=(s=o.required_action)==null?void 0:s.submit_tool_outputs)==null?void 0:a.tool_calls,!(o.status==="requires_action"&&l)){u.n=2;break}return this.run_id=o.id,u.n=1,this.handleTools(l);case 1:return u.a(2,u.v);case 2:if(!this._waitingForStreamResponse){u.n=3;break}return u.a(2,this.parseStreamResult(o));case 3:return this._isSSEStream&&this.sessionId&&(this.asyncCallInProgress=!0,this.url="".concat(this.urlSegments.threadsPrefix,"/").concat(this.sessionId,"/runs").concat(this.urlSegments.threadsPosfix),c=JSON.parse(JSON.stringify(this.rawBody)),this.createStreamRun(c)),u.a(2,_({},b,""))}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"parseStreamResult",value:(function(){var e=D(v().m(function i(o){var s,a,l,c,u,d,f,h,p,m;return v().w(function(g){for(;;)switch(g.n){case 0:if(!(o.content&&o.content.length>0&&this.messages)){g.n=1;break}
146if(d=o.content.find(function(w){return w[b]}),!((s=d?.[b])!=null&&s.annotations&&d[b].annotations.length>0)){g.n=1;break}return f=o.content.find(function(w){return!!w[b]})||o.content[0],h=Ya.getFilesAndText.bind(this,this,{role:Qi,content:o.content},this.urlSegments,f),g.a(2,((a=this._messageStream)==null||a.endStreamAfterFileDownloaded(this.messages,h),_({},b,"")));case 1:if(!((l=o.delta)!=null&&l.content)){g.n=4;break}if(!(o.delta.content.length>1)){g.n=3;break}if(p=o.delta.content.find(function(w){return w[b]}),!((c=p?.[b])!=null&&c.annotations&&p[b].annotations.length===0)){g.n=3;break}return g.n=2,Ya.processStreamMessages(this,o.delta.content,this.urlSegments);case 2:return m=g.v,g.a(2,_(_({},b,m[0][b]),x,m[1][x]));case 3:return g.a(2,_({},b,(u=o.delta.content[0][b])==null?void 0:u.value));case 4:return g.a(2,(!this.sessionId&&o.thread_id&&(this.sessionId=o.thread_id),_({},b,"")))}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"createStreamRun",value:(function(){var e=D(v().m(function i(o){return v().w(function(s){for(;;)switch(s.n){case 0:return o.stream=!0,this._waitingForStreamResponse=!0,s.n=1,rn.request(this,o,this.messages,!0,!0);case 1:this._messageStream=s.v;case 2:return s.a(2)}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()}],[{key:"processImageMessage",value:function(r,i){var o=i?.filter(function(s){return Zr.isImageFileExtension(s.name)}).map(function(s){return _(_({},ce,"image_file"),"image_file",{file_id:s.id})});if(o&&o.length>0)return r[b]&&r[b].length>0&&o.push(_(_({},ce,b),b,r[b])),{content:o,role:et}}},{key:"processAttachmentsMessage",value:function(r,i,o){return{attachments:i.map(function(s){return{tools:[_({},ce,o)],file_id:s.id}}),content:[_(_({},ce,b),b,r[b])],role:et}}}])})(ge);BP.POLLING_TIMEOUT_MS=500;var VP=BP,qz=(function(t){function n(e){var r,i,o;k(this,n);var s,a,l,c,u,d=JSON.parse(JSON.stringify(e.directConnection)),f=d.openAI,h=(s=d.openAI)==null?void 0:s.assistant,p=n.buildUrlSegments(h);if(o=K(this,n,[e,h,p,ru(),nu,f]),(r=(a=o.connectSettings).headers)!==null&&r!==void 0||(a.headers={}),(i=(l=o.connectSettings.headers)["OpenAI-Beta"])!==null&&i!==void 0||(l["OpenAI-Beta"]="assistants=v2"),o.shouldFetchHistory&&o.sessionId&&(o.fetchHistory=o.fetchHistoryFunc.bind(Xc(o))),B(h)===ze){var m=(u=(c=e.directConnection)==null?void 0:c.openAI)==null?void 0:u.assistant,g=m.function_handler,w=m.files_tool_type;g&&(o._functionHandlerI=g),w&&(o.filesToolType=w)}return o}return J(n,t),M(n,null,[{key:"buildUrlSegments",value:function(r){var i=B(r)=="object"&&r.custom_base_url||mr;return{threadsPrefix:"".concat(i,"/threads"),threadsPosfix:"",newAssistantUrl:"".concat(i,"/assistants"),createMessagePostfix:"",listMessagesPostfix:"order=desc",storeFiles:"".concat(i,"/").concat(x),getFilesPrefix:"".concat(i,"/").concat(x,"/"),getFilesPostfix:"/content"}}}])})(VP),Xv="Please define the Azure URL Details. [More Information](".concat(at,"directConnection/Azure)"),UP=function(n){return _({"api-key":n},Ze,Ct)},HP=function(n){return on("".concat(n.endpoint,"/openai/models?api-version=").concat(n.version),Qt,jP)},$P=function(n){var e=n.endpoint,r=n.version,i=n.deploymentId;return e&&r&&i},MS=(function(t){function n(e){var r,i;k(this,n);var o,s,a,l,c,u,d,f,h=JSON.parse(JSON.stringify(e.directConnection)),p=h.azure,m=(o=h.azure)==null?void 0:o.openAI,g=m?.urlDetails||{},w="".concat((s=m?.urlDetails)==null?void 0:s.endpoint,"/openai/"),C="?api-version=".concat((a=m?.urlDetails)==null?void 0:a.version),T={threadsPrefix:"".concat(w).concat(n.THREAD_RESOURCE),threadsPosfix:C,newAssistantUrl:"".concat(w).concat(n.NEW_ASSISTANT_RESOURCE).concat(C),createMessagePostfix:C,listMessagesPostfix:"order=desc&api-version=".concat((l=m?.urlDetails)==null?void 0:l.version),storeFiles:"".concat(w).concat(x).concat(C),getFilesPrefix:"".concat(w).concat(x,"/"),getFilesPostfix:"/content".concat(C)};if(i=K(this,n,[e,m?.assistant,T,HP(g),UP,p]),i.permittedErrorPrefixes=[Xv],i.insertKeyPlaceholderText=i.genereteAPIKeyName("Azure OpenAI"),i.keyHelpUrl="https://learn.microsoft.com/en-us
146/answers/questions/1193991/how-to-get-the-value-of-openai-api-key",i.isTextInputDisabled=!1,B(m?.assistant)===ze){var I=(d=(u=(c=e.directConnection)==null?void 0:c.azure)==null?void 0:u.openAI)==null?void 0:d.assistant,F=I.function_handler,$=I.files_tool_type;F&&(i._functionHandlerI=F),$&&(i.filesToolType=$)}return $P(g)?(r=(f=i.connectSettings).headers)!==null&&r!==void 0||(f.headers={}):(i.isTextInputDisabled=!0,i.canSendMessage=function(){return!1},setTimeout(function(){e.addMessage(_({},E,Xv))})),i}return J(n,t),M(n)})(VP);MS.THREAD_RESOURCE="threads",MS.NEW_ASSISTANT_RESOURCE="assistants";var Wz=MS,Gz="sts-session-started",Kz="sts-session-stopped",Cn=(function(){function t(){k(this,t)}return M(t,null,[{key:"addAttributes",value:function(e){e.role="button",e.setAttribute("tabindex","0")}},{key:"addAriaBusy",value:function(e){e.setAttribute("aria-busy","true")}},{key:"removeAriaBusy",value:function(e){e.removeAttribute("aria-busy")}},{key:"addAriaDisabled",value:function(e){e.setAttribute("aria-disabled","true")}},{key:"removeAriaDisabled",value:function(e){e.removeAttribute("aria-disabled")}},{key:"removeAriaAttributes",value:function(e){t.removeAriaBusy(e),t.removeAriaDisabled(e)}}])})(),zP=`<?xml version="1.0" encoding="iso-8859-1"?> 147<svg height="1.4em" width="1.4em" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 148 viewBox="0 0 490.9 490.9" xml:space="preserve"> 149 <g> 150 <g> 151 <path d="M245.5,322.9c53,0,96.2-43.2,96.2-96.2V96.2c0-53-43.2-96.2-96.2-96.2s-96.2,43.2-96.2,96.2v130.5 152 C149.3,279.8,192.5,322.9,245.5,322.9z M173.8,96.2c0-39.5,32.2-71.7,71.7-71.7s71.7,32.2,71.7,71.7v130.5 153 c0,39.5-32.2,71.7-71.7,71.7s-71.7-32.2-71.7-71.7V96.2z"/> 154 <path d="M94.4,214.5c-6.8,0-12.3,5.5-12.3,12.3c0,85.9,66.7,156.6,151.1,162.8v76.7h-63.9c-6.8,0-12.3,5.5-12.3,12.3 155 s5.5,12.3,12.3,12.3h152.3c6.8,0,12.3-5.5,12.3-12.3s-5.5-12.3-12.3-12.3h-63.9v-76.7c84.4-6.3,151.1-76.9,151.1-162.8 156 c0-6.8-5.5-12.3-12.3-12.3s-12.3,5.5-12.3,12.3c0,76.6-62.3,138.9-138.9,138.9s-138.9-62.3-138.9-138.9 157 C106.6,220,101.2,214.5,94.4,214.5z"/> 158 </g> 159 </g> 160</svg> 161`,qv=(function(){function t(){k(this,t)}return M(t,null,[{key:"createTextElement",value:function(e){var r=U();return r[S].add(t.INPUT_BUTTON_INNER_TEXT_CLASS),r.innerText=e,r}},{key:"tryAddSVGElement",value:function(e,r,i,o){i?e.push(ko.createSVGElement(i)):i!==""&&o&&e.push(r)}},{key:"createCustomElements",value:function(e,r,i){var o,s,a=i?.[e],l=(o=a?.[b])==null?void 0:o.content,c=(s=a?.svg)==null?void 0:s.content,u=[];return t.tryAddSVGElement(u,r,c,l),l&&u.push(t.createTextElement(l)),u.length>0?u:void 0}}
161,{key:"reassignClassBasedOnChildren",value:function(e,r){e[S].remove(t.INPUT_BUTTON_SVG_CLASS,t.INPUT_BUTTON_SVG_TEXT_CLASS),r.find(function(i){return i[S].contains(t.INPUT_BUTTON_INNER_TEXT_CLASS)})?r.length>1&&e[S].add(t.INPUT_BUTTON_SVG_TEXT_CLASS):e[S].add(t.INPUT_BUTTON_SVG_CLASS)}}])})();qv.INPUT_BUTTON_SVG_TEXT_CLASS="input-button-svg-text",qv.INPUT_BUTTON_INNER_TEXT_CLASS="text-button",qv.INPUT_BUTTON_SVG_CLASS="input-button-svg";var ws=qv,nf=(function(){function t(){k(this,t)}return M(t,null,[{key:"parseSVGTextElements",value:function(e){return _({svg:e.find(function(r){return r.tagName.toLowerCase()==="svg"})},b,e.find(function(r){return r.tagName.toLowerCase()==="div"}))}}])})(),ir=(function(){function t(){k(this,t)}return M(t,null,[{key:"unsetAllCSS",value:function(e,r){var i,o;r.container&&hn.unsetAllCSSMouseStates(e,r.container);var s=nf.parseSVGTextElements(Array.from(e.children)),a=s.svg,l=s.text;(i=r.svg)!=null&&i.styles&&a&&hn.unsetAllCSSMouseStates(a,r.svg.styles),(o=r[b])!=null&&o.styles&&l&&hn.unsetAllCSSMouseStates(l,r[b].styles)}},{key:"unsetActionCSS",value:function(e,r){var i,o;r.container&&hn.unsetActivityCSSMouseStates(e,r.container);var s=nf.parseSVGTextElements(Array.from(e.children)),a=s.svg,l=s.text;(i=r.svg)!=null&&i.styles&&a&&hn.unsetActivityCSSMouseStates(a,r.svg.styles),(o=r[b])!=null&&o.styles&&l&&hn.unsetActivityCSSMouseStates(l,r[b].styles)}},{key:"setElementsCSS",value:function(e,r,i){var o,s,a,l,c;Object.assign(e[N],(o=r.container)==null?void 0:o[i]);var u=nf.parseSVGTextElements(Array.from(e.children)),d=u.svg,f=u.text;d&&Object.assign(d[N],(a=(s=r.svg)==null?void 0:s.styles)==null?void 0:a[i]),f&&Object.assign(f[N],(c=(l=r[b])==null?void 0:l.styles)==null?void 0:c[i])}},{key:"setElementCssUpToState",value:function(e,r,i){t.setElementsCSS(e,r,H),i!==H&&(t.setElementsCSS(e,r,rr),i!==rr&&t.setElementsCSS(e,r,ht))}}])})(),ul=(function(){function t(n,e,r,i,o,s){k(this,t),this._mouseState={state:"default"},this.isCustom=!1,Cn.addAttributes(n),this.elementRef=n,this.svg=ko.createSVGElement(e),this.customStyles=o,this.position=Wt.processPosition(r),this._tooltipSettings=i,this.dropupText=s}return M(t,[{key:"buttonMouseLeave",value:function(e){var r;this._mouseState.state=H,((r=this._activeTooltip)==null?void 0:r.element[N].visibility)==="visible"&&this._tooltipSettings&&Mo.hide(this._activeTooltip,this._tooltipSettings),e&&(ir.unsetAllCSS(this.elementRef,e),ir.setElementsCSS(this.elementRef,e,H))}},{key:"buttonMouseEnter",value:function(e){var r;this._mouseState.state=rr,this._tooltipSettings&&(this._activeTooltip=Mo.display(this.elementRef,this._tooltipSettings,(r=this._activeTooltip)==null?void 0:r.element)),e&&ir.setElementsCSS(this.elementRef,e,rr)}},{key:"buttonMouseUp",value:function(e){e&&ir.unsetActionCSS(this.elementRef,e),this.buttonMouseEnter(e)}},{key:"buttonMouseDown",value:function(e){this._mouseState.state=ht,e&&ir.setElementsCSS(this.elementRef,e,ht)}},{key:"setEvents",value:function(e){this.elementRef.onmousedown=this.buttonMouseDown.bind(this,e),this.elementRef.onmouseup=this.buttonMouseUp.bind(this,e),this.elementRef.onmouseenter=this.buttonMouseEnter.bind(this,e),this.elementRef.onmouseleave=this.buttonMouseLeave.bind(this,e)}},{key:"unsetCustomStateStyles",value:function(e){if(this.customStyles)for(var r=0;r<e.length;r+=1){var i=e[r],o=i&&this.customStyles[i];o&&ir.unsetActionCSS(this.elementRef,o)}}},{key:"reapplyStateStyle",value:function(e,r){if(this.customStyles){r&&this.unsetCustomStateStyles(r);var i=this.customStyles[e];i&&ir.setElementCssUpToState(this.elementRef,i,this._mouseState.state),this.setEvents(i)}}},{key:"changeElementsByState",value:function(e){var r;(r=this.elementRef).replaceChildren.apply(r,Za(e)),ws.reassignClassBasedOnC
161hildren(this.elementRef,e)}},{key:"buildDefaultIconElement",value:function(e){var r=this.svg.cloneNode(!0);return r.id=e,[r]}},{key:"createInnerElements",value:function(e,r,i){var o=ws.createCustomElements(r,this.svg,i);if(o&&o.length>0){if(this.position===Yr){var s=this.svg.cloneNode(!0);s.id=o[0]===this.svg?e:"dropup-menu-item-icon-element-custom",o[0]=s}return o}return this.buildDefaultIconElement(e)}}])})(),qP=(function(t){function n(e){var r;k(this,n);var i,o,s=((o=(i=e?.[H])==null?void 0:i.svg)==null?void 0:o.content)||n.EMPTY_SVG;return r=K(this,n,[U(),s,void 0,void 0,e]),r.isActive=!1,r._innerElements=r.createInnerElementsForStates(r.customStyles),r.changeToDefault(),r}return J(n,t),M(n,[{key:"createInnerElementsForStates",value:function(r){return _(_(_({},H,this.createInnerButtonElements(H,r)),"active",this.createInnerButtonElements("active",r)),"unavailable",this.createInnerButtonElements("unavailable",r))}},{key:"createInnerButtonElements",value:function(r,i){return ws.createCustomElements(r,this.svg,i)||[this.svg]}},{key:"changeState",value:function(r){this.changeElementsByState(r),this.elementRef[S].replace(ws.INPUT_BUTTON_SVG_CLASS,"deep-chat-openai-realtime-button")}},{key:"changeToActive",value:function(){this.changeState(this._innerElements.active),this.reapplyStateStyle("active",["unavailable",H]),this.isActive=!0}},{key:"changeToDefault",value:function(){var r,i,o,s;this.changeState(this._innerElements[H]),(r=this.customStyles)!=null&&r.active&&ir.unsetAllCSS(this.elementRef,(i=this.customStyles)==null?void 0:i.active),(o=this.customStyles)!=null&&o.unavailable&&ir.unsetAllCSS(this.elementRef,(s=this.customStyles)==null?void 0:s.unavailable),this.reapplyStateStyle(H,["active","unavailable"]),this.isActive=!1}},{key:"changeToUnavailable",value:function(){var r,i,o,s;this.changeState(this._innerElements.unavailable),(r=this.customStyles)!=null&&r.active&&ir.unsetAllCSS(this.elementRef,(i=this.customStyles)==null?void 0:i.active),(o=this.customStyles)!=null&&o[H]&&ir.unsetAllCSS(this.elementRef,(s=this.customStyles)==null?void 0:s[H]),this.reapplyStateStyle("unavailable",[H,"active"]),this.isActive=!1}}])})(ul);qP.EMPTY_SVG='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"></svg>';var EN=qP,Do=(function(){function t(){k(this,t)}return M(t,null,[{key:"setPropertyValueIfDoesNotExist",value:function(e,r,i){var o,s,a=r[0];r.length===1?(o=e[a])!==null&&o!==void 0||(e[a]=i):((s=e[a])!==null&&s!==void 0||(e[a]={}),r.shift(),t.setPropertyValueIfDoesNotExist(e[a],r,i))}},{key:"setPropertyValue",value:function(e,r,i){var o,s=r[0];r.length===1?e[s]=i:((o=e[s])!==null&&o!==void 0||(e[s]={}),r.shift(),t.setPropertyValue(e[s],r,i))}},{key:"getObjectValue",value:function(e,r){var i=r[0],o=e[i];return o===void 0||r.length===1?o:t.getObjectValue(o,r.slice(1))}},{key:"overwritePropertyObjectFromAnother",value:function(e,r,i){var o=t.getObjectValue(r,i);if(o){var s=Je(Je({},o),t.getObjectValue(e,i)||{});t.setPropertyValue(e,i,s)}}},{key:"isJson",value:function(e){try{return JSON.stringify(e),!0}catch{return!1}}},{key:"assignPropertyFromOneToAnother",value:function(e,r,i){var o;(o=r[e])!==null&&o!==void 0||(r[e]={}),Object.assign(r[e],i?.[e])}}])})(),WP=`<?xml version="1.0" encoding="utf-8"?> 162<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg"> 163 <path d="M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z"></path> 164</svg>`,AS=`<?xml version="1.0" encoding="utf-8"?> 165<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg"> 166<path d="M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z"></path> 167</svg>`,Qh=(function(t){function n(e){var r,i;k(this,n);var o,s,a,l,c,u=JSON.parse(JSON.stringify(e.directConnection)),d=n.getKey(e);i=K(this,n,[e,ru(),nu,{key:d}]),i.insertKeyPlaceholderText=i.genereteAPIKeyName("OpenAI"),i.keyHelpUrl=tu,i._microphoneButton=null,i._toggleButton=null,i._errorElement=null,i._loadingElement=null,i._pc=null,i._mediaStream=null,i._isMuted=!1;var f=(o=u.openAI)==null?void 0:o.realtime;if(B(f)===ze){i._avatarConfig=f.avatar,i._ephemeralKey=f.ephemeralKey,i._errorConfig=f[E],i._loadingConfig=f.loading,Object.assign(i.rawBody,f.config);var h=(a=(s=e.directConnection)==null?void 0:s.openAI)==null?void 0:a.realtime,p=h.config||{},m=p.function_handler;m&&(i._functionHandlerI=m),i._events=f.events,h.methods=i.generateMethods(),i.setInputAudioTranscribe(e,(l=h.config)==null?void 0:l.input_audio_transcription)}return(r=(c=i.rawBody).model)!==null&&r!==void 0||(c.model="gpt-4o-realtime-preview-2025-06-03"),i._avatarConfig=n.buildAvatarConfig(f),i._buttonsConfig=n.buildButtonsConfig(f),i._avatarEl=n.createAvatar(i._avatarConfig),i._containerEl=i.createContainer(),i._deepChat=e,i}return J(n,t),M(n,[{key:"setInputAudioTranscribe",value:function(r,i){if(i){var o="whisper-1";B(i)=="object"?this.rawBody.input_audio_transcription={model:i.model||o,language:i.language,prompt:i.prompt}:this.rawBody.input_audio_transcription={model:o}}else r.onMessage&&(console.warn("To get user audio transcription, set `input_audio_transcription` in the `realtime` config."),console.warn("See: ".concat(at,"directConnection/OpenAI/OpenAIRealtime#OpenAIRealtimeConfig")))}},{key:"setUpView",value:function(r,i){r[N].display="none",i.appendChild(this._containerEl),this.setup()}},{key:"setup",value:(function(){var e=D(v().m(function i(){var o,s,a,l;return v().w(function(c){for(;;)switch(c.n){case 0:if(s=(o=this._deepChat.directConnection)==null?void 0:o.openAI,s){c.n=1;break}return c.a(2);case 1:if(a=s?.realtime,!(B(a)!="object"||!a.autoStart&&!a.autoFetchEphemeralKey)){c.n=2;break}return c.a(2);case 2:l=this.key||s.key,(a.fetchEphemeralKey||l)&&a.autoStart&&(this.changeToUnavailable(),this.displayLoading()),this.fetchEphemeralKey(a.autoStart);case 3:return c.a(2)}},i,this)}));function r(){return e.apply(this,arguments)}return r})()},{key:"fetchEphemeralKey",value:(function(){var e=D(v().m(function i(o){var s,a,l,c,u,d,f,h,p;return v().w(function(m){for(;;)switch(m.p=m.n){case 0:if(a=(s=this._deepChat.directConnection)==null?void 0:s.openAI,l=B(a?.realtime)=="object"?a?.realtime.fetchEphemeralKey:void 0,c=a?.realtime,u=this.key||a.key,B(c)!="object"){m.n=8;break}if(this._ephemeralKey){m.n=7;break}if(m.p=1,!l){m.n=3;break}
167return d=l(),d.then&&(this._retrievingEphemeralKey=d),m.n=2,d;case 2:this._ephemeralKey=m.v,m.n=5;break;case 3:if(f=u,!f){m.n=5;break}return this._retrievingEphemeralKey=this.getEphemeralKey(u),m.n=4,this._retrievingEphemeralKey;case 4:this._ephemeralKey=m.v;case 5:m.n=7;break;case 6:m.p=6,h=m.v,this.displayFailedToRetrieveEphemeralKey(h);case 7:this._ephemeralKey&&(o?this.init(this._ephemeralKey):this.changeToAvailable()),m.n=12;break;case 8:if(!u){m.n=12;break}return m.p=9,this._retrievingEphemeralKey=this.getEphemeralKey(u),m.n=10,this._retrievingEphemeralKey;case 10:this._ephemeralKey=m.v,o&&this.init(this._ephemeralKey),m.n=12;break;case 11:m.p=11,p=m.v,this.displayFailedToRetrieveEphemeralKey(p);case 12:return m.a(2)}},i,this,[[9,11],[1,6]])}));function r(i){return e.apply(this,arguments)}return r})()},{key:"getEphemeralKey",value:(function(){var e=D(v().m(function i(o){return v().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,fetch("".concat(mr,"realtime/sessions"),{method:fn,body:JSON.stringify(this.rawBody),headers:_(_({},Ze,Ct),Xt,"".concat(Fn).concat(o))});case 1:return s.n=2,s.v.json();case 2:return s.a(2,s.v.client_secret.value)}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"generateMethods",value:function(){var r=this;return{updateConfig:function(o){var s;(s=r._dc)==null||s.send(JSON.stringify(_(_({},ce,"session.update"),"session",o)))},sendMessage:function(o,s){var a=s||"system",l=[_(_({},ce,a==="system"||a===et?TS:b),"text",o)],c=_(_({role:a},ce,"message"),"content",l);r.sendMessage(c)}}}},{key:"createContainer",value:function(){var r=U();return r.id="deep-chat-openai-realtime-container",r.appendChild(this.createAvatarContainer()),r.appendChild(this.createButtonsContainer()),r.appendChild(this.createError()),r}},{key:"createAvatarContainer",value:function(){var r,i,o=U();return o.id="deep-chat-openai-realtime-avatar-container",Object.assign(o[N],(i=(r=this._avatarConfig)==null?void 0:r.styles)==null?void 0:i.container),o.appendChild(this._avatarEl),o}},{key:"createButtonsContainer",value:function(){var r,i=U();i.id="deep-chat-openai-realtime-buttons-container",Object.assign(i[N],(r=this._buttonsConfig)==null?void 0:r.container),this._microphoneButton=this.createMicophoneButton();var o=n.createButtonContainer(this._microphoneButton.elementRef);this._toggleButton=this.createToggleButton();var s=n.createButtonContainer(this._toggleButton.elementRef);return i.appendChild(o),i.appendChild(s),i.appendChild(this.createLoading()),i}},{key:"createMicophoneButton",value:function(){var r=this,i,o=new EN((i=this._buttonsConfig)==null?void 0:i[Yi]);return o.elementRef[S].add(n.BUTTON_DEFAULT,"deep-chat-openai-realtime-microphone"),rt.assignButtonEvents(o.elementRef,function(){o.isActive?(r.toggleMicorphone(!0),o.elementRef[S].replace(n.MICROPHONE_ACTIVE,n.BUTTON_DEFAULT),o.changeToDefault(),r._isMuted=!1):(r.toggleMicorphone(!1),o.elementRef[S].replace(n.BUTTON_DEFAULT,n.MICROPHONE_ACTIVE),Cn.removeAriaAttributes(o.elementRef),o.changeToActive(),r._isMuted=!0)}),o}},{key:"toggleMicorphone",value:function(r){var i;(i=this._mediaStream)==null||i.getAudioTracks().forEach(function(o){return o.enabled=r})}},{key:"createToggleButton",value:function(){var r=this,i,o=new EN((i=this._buttonsConfig)==null?void 0:i.toggle);return o.elementRef[S].add(n.BUTTON_DEFAULT,"deep-chat-openai-realtime-toggle"),rt.assignButtonEvents(o.elementRef,D(v().m(function s(){var a,l,c,u;return v().w(function(d){for(;;)switch(d.p=d.n){case 0:if(!o.isActive){d.n=1;break}o.changeToDefault(),r.stop(),d.n=9;break;case 1:if(d.p=1,!r._ephemeralKey){d.n=3;break}return r.displayLoading(),d.n=2,r.init(r._ephemeralKey);case 2:d.n=7;break;case 3:if(!r._retrievingEphemeralKey){d.n=6;break}return r.displayLoading(),d.n=4,r._retrievingEphemeralKey;case 4:if(l=d.v,c=(a=r._toggleButton)!=null&&a.isActive,!c){d.n=5;break}return d.n=5,r.init(l);case 5:d.n=7;break;case 6:return r.displayLoading(),d.n=7,r.fetchEphemeralKey(!0);case 7:d.n=9;break;case 8:d.p=8,u=d.v,console[E]("Failed to start conversation:",u),r.displayError(),r.hideLoading();case 9:return d.a(2)}},s,null,[[1,8]])}))),o}},{key:"init",value:(function(){var e=D(v().m(function i(o){var s=this,a,l,c,u,d,f,h,p,m,g,w,C,T;return v().w(function(I){for(;;)switch(I.p=I.n){case 0:return a=new RTCPeerConnection,this._pc=a,l=U($e),l.autoplay=!0,c=new AudioContext,u=c.createAnalyser(),u.fftSize=256,d=new Uint8Array(u.frequencyBinCount),this._pc.ontrack=(function(){var F=D(v().m(function $(q){var G,lt;return v().w(function(De){for(;;)switch(De.n){case 0:if(!q.streams[0]){De.n=2;break}if(l.srcObject=q.streams[0],G=c.createMediaStreamSource(q.streams[0]),lt=c.state==="suspended",!lt){De.n=1;break}return De.n=1,c.resume();case 1:G.connect(u),s.monitorFrequencies(u,d),De.n=3;break;case 2:console[E]("No streams found in the ontrack event."),s.displayError();case 3:return De.a(2)}},$)}));return function($){return F.apply(this,arguments)}})(),I.n=1,navigator.mediaDevices.getUserMedia({audio:!0}).then(function(F){var $;a===s._pc&&(s._mediaStream=F,($=s._pc)==null||$.addTrack(s._mediaStream.getTracks()[0]),s._isMuted&&s.toggleMicorphone(!1))}).catch(function(F){console[E]("Error accessing microphone:",F),s.displayError()});
167case 1:return this._dc=this._pc.createDataChannel("oai-events"),this._dc.addEventListener("message",(function(){var F=D(v().m(function $(q){var G,lt,De,qe,se,mn,ct,jn;return v().w(function(Vt){for(;;)switch(Vt.p=Vt.n){case 0:if(qe=JSON.parse(q.data),qe.type!=="session.created"){Vt.n=1;break}s.removeUnavailable(),s._toggleButton&&(Cn.removeAriaAttributes(s._toggleButton.elementRef),s._toggleButton.changeToActive()),(lt=(G=s._events)==null?void 0:G.started)==null||lt.call(G),s._deepChat.dispatchEvent(new CustomEvent(Gz)),s.hideLoading(),Vt.n=7;break;case 1:if(qe.type!=="response.done"){Vt.n=6;break}if(se=(De=JSON.parse(q.data).response.output)==null?void 0:De[0],se?.type!==Vv){Vt.n=5;break}return mn=se.name,ct=se.call_id,Vt.p=2,Vt.n=3,s.handleTool(mn,se.arguments,ct);case 3:Vt.n=5;break;case 4:Vt.p=4,jn=Vt.v,s.stopOnError(jn);case 5:Vt.n=7;break;case 6:qe.type===E?s.stopOnError(qe[E].message):qe.type===Qr?s.stopOnError(qe.message):qe.type==="response.audio_transcript.delta"||(qe.type==="response.audio_transcript.done"?qe.transcript&&ol.onMessage(s._deepChat,_({role:xt},b,qe.transcript),!1):qe.type==="conversation.item.input_audio_transcription.completed"&&qe.transcript&&ol.onMessage(s._deepChat,_({role:et},b,qe.transcript),!1));case 7:return Vt.a(2)}},$,null,[[2,4]])}));return function($){return F.apply(this,arguments)}})()),I.p=2,I.n=3,this._pc.createOffer();case 3:if(f=I.v,m=a!==this._pc,m){I.n=5;break}return I.n=4,this._pc.setLocalDescription(f);case 4:m=a!==this._pc;case 5:if(!m){I.n=6;break}return I.a(2);case 6:return I.n=7,fetch("".concat(mr,"realtime"),{method:fn,body:f.sdp,headers:_(_({},Xt,"".concat(Fn).concat(o)),Ze,"application/sdp")});case 7:if(h=I.v,a===this._pc){I.n=8;break}return I.a(2);case 8:return g=_,w=_({},ce,"answer"),I.n=9,h[b]();case 9:if(p=g(w,"sdp",I.v),C=a!==this._pc,C){I.n=11;break}return I.n=10,this._pc.setRemoteDescription(p);case 10:C=a!==this._pc;case 11:if(!C){I.n=12;break}return I.a(2);case 12:I.n=14;break;case 13:I.p=13,T=I.v,console[E](T),this.displayError();case 14:return I.a(2)}},i,this,[[2,13]])}));function r(i){return e.apply(this,arguments)}return r})()},{key:"monitorFrequencies",value:function(r,i){var o=this,s=(function(a){function l(){return a.apply(this,arguments)}return l.toString=function(){return a.toString()},l})(function(){var a;r.getByteFrequencyData(i);var l=i.reduce(function(h,p){return h+p},0),c=i.length*255,u=l/c*100,d=1,f=d+u/100*(((a=o._avatarConfig)==null?void 0:a.maxScale)-d);o._avatarEl[N].transform="scale(".concat(f,")"),requestAnimationFrame(s)});s()}},{key:"stopOnError",value:function(r){this.stop(),console[E](r),this.displayError()}},{key:"stop",value:function(){var r,i,o;(r=this._mediaStream)==null||r.getTracks().forEach(function(s){return s.stop()}),this._mediaStream=null,this._pc&&(this._pc.close(),this._pc=null,(o=(i=this._events)==null?void 0:i.stopped)==null||o.call(i),this._deepChat.dispatchEvent(new CustomEvent(Kz)),this._dc=void 0)}},{key:"changeToUnavailable",value:function(){this._microphoneButton&&n.changeButtonToUnavailable(this._microphoneButton),this._toggleButton&&n.changeButtonToUnavailable(this._toggleButton)}},{key:"changeToAvailable",value:function(){this._microphoneButton&&n.changeButtonToAvailable(this._microphoneButton),this._toggleButton&&n.changeButtonToAvailable(this._toggleButton)}},{key:"removeUnavailable",value:function(){this._microphoneButton&&n.removeButtonUnavailable(this._microphoneButton),this._toggleButton&&n.removeButtonUnavailable(this._toggleButton)}},{key:"createError",value:function(){var r,i=U();return i.id="deep-chat-openai-realtime-error",Object.assign(i[N],(r=this._errorConfig)==null?void 0:r[N]),this._errorElement=i,i}},{key:"displayFailedToRetrieveEphemeralKey",value:function(r){console[E]("Failed to retrieve ephemeral key"),console[E](r),this.displayError()}},{key:"displayError",value:function(){var r;this._errorElement&&(this._errorElement[N].display="block",this._errorElement.textContent=((r=this._errorConfig)==null?void 0:r[b])||"Error",this.changeToUnavailable()),this.hideLoading()}},{key:"createLoading",value:function(){var r,i,o=U();return o.id="deep-chat-openai-realtime-loading",this._loadingElement=o,(r=this._loadingConfig)!=null&&r[ke]&&(this._loadingElement.innerHTML=this._loadingConfig[ke]),Object.assign(o[N],(i=this._loadingConfig)==null?void 0:i[N]),o[N].display="none",o}},{key:"displayLoading",value:function(){var r,i,o;this._toggleButton&&(this._toggleButton.changeToActive(),this._toggleButton.elementRef[S].add(n.BUTTON_LOADING),Cn.removeAriaDisabled(this._toggleButton.elementRef),Cn.addAriaBusy(this._toggleButton.elementRef)),(typeof((r=this._loadingConfig)==null?void 0:r.display)!="boolean"||this._loadingConfig.display)&&this._loadingElement&&(this._loadingElement[N].display="block",(i=this._loadingConfig)!=null&&i[ke]||(this._loadingElement.textContent=((o=this._loadingConfig)==null?void 0:o[b])||"Loading"))}},{key:"hideLoading",value:function(){this._toggleButton&&(this._toggleButton.elementRef[S].remove(n.BUTTON_LOADING),Cn.removeAriaBusy(this._toggleButton.elementRef)),this._loadingElement&&(this._loadingElement[N].display="none")}},{key:"handleTool",value:(function(){var e=D(v().m(function i(o,s,a){var l,c;return v().w(function(u){for(;;)switch(u.n){case 0:if(this._functionHandlerI){u.n=1;break}throw Error(Es);case 1:return u.n=2,this._functionHandlerI({name:o,arguments:s});case 2:if(l=u.v,!(B(l)!="object"||!Do.isJson(l))){u.n=3;break}throw Error('The `function_handler` response must be a JSON object, e.g. {response: "My response"}');case 3:c=_(_(_({},ce,LP),"call_id",a),"output",JSON.stringify(l)),this.sendMessage(c);case 4:return u.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"sendMessage",value:function(r){if(this._dc){var i=JSON.stringify(_(_({},ce,"conversation.item.create"),"item",r));this._dc.send(i);var o=_({},ce,"response.create");this._dc.send(JSON.stringify(o))}}},{key:"isCustomView",value:function(){return!0}}],[{key:"getKey",value:function(r){var i=r.directConnection.openAI;if(i!=null&&i.key)return i.key;var o=i?.realtime;if(B(o)=="object"&&(o.ephemeralKey||o.fetchEphemeralKey))return"placeholder"}},{key:"buildAvatarConfig",value:function(r){var i=B(r)=="object"&&r.avatar?JSON.parse(JSON.stringify(r.avatar)):{};return i.maxScale=i.maxScale&&i.maxScale>=1?i.maxScale:2.5,i}},{key:"buildButtonsConfig",value:function(r){var i,o,s,a,l,c,u,d,f,h,p,m,g,w,C,T,I,F,$,q,G,lt,De,qe,se,mn,ct=B(r)=="object"&&r.buttons?JSON.parse(JSON.stringify(r.buttons)):{};return(w=(g=(m=ct[Yi])==null?void 0:m[H])==null?void 0:g[b])!=null&&w.content||((i=ct[Yi])!==null&&i!==void 0||(ct[Yi]={}),(o=(C=ct[Yi])[H])!==null&&o!==void 0||(C[H]={}),(s=(T=ct[Yi][H]).svg)!==null&&s!==void 0||(T.svg={}),(a=(I=ct[Yi][H].svg).content)!==null&&a!==void 0||(I.content=zP)),(q=($=(F=ct.toggle)==null?void 0:F[H])==null?void 0:$[b])!=null&&q.content||((l=ct.toggle)!==null&&l!==void 0||(ct.toggle={}),(c=(G=ct.toggle)[H])!==null&&c!==void 0||(G[H]={}),(u=(lt=ct.toggle[H]).svg)!==null&&u!==void 0||(lt.svg={}),(d=(De=ct.toggle[H].svg).content)!==null&&d!==void 0||(De.content=WP),(f=(qe=ct.toggle).active)!==null&&f!==void 0||(qe.active={}),(h=(se=ct.toggle.active).svg)!==null&&h!==void 0||(se.svg={}),(p=(mn=ct.toggle.active.svg).content)!==null&&p!==void 0||(mn.content=AS)),ct}},{key:"createAvatar",value:function(r){var i,o=U("img");return o.id="deep-chat-openai-realtime-avatar",Object.assign(o[N],(i=r?.styles)==null?void 0:i[it]),o[Y]=r?.[Y]||ES,o}},{key:"createButtonContainer",value:function(r){var i=U();return i[S].add("deep-chat-openai-realtime-button-container"),i.appendChild(r),i}},{key:"changeButtonToUnavailable",value:function(r){r.elementRef[S].add(n.UNAVAILABLE),Cn.removeAriaBusy(r.elementRef),Cn.addAriaDisabled(r.elementRef),r.changeToUnavailable()}},{key:"changeButtonToAvailable",value:function(r){n.removeButtonUnavailable(r),r.changeToDefault()}},{key:"removeButtonUnavailable",value:function(r){Cn.removeAriaDisabled(r.elementRef),r.elementRef[S].remove(n.UNAVAILABLE)}}])})(ge);Qh.BUTTON_DEFAULT="deep-chat-openai-realtime-button-default",Qh.BUTTON_LOADING="deep-chat-openai-realtime-button-loading",Qh.MICROPHONE_ACTIVE="deep-chat-openai-realtime-microphone-active",Qh.UNAVAILABLE="deep-chat-openai-realtime-button-unavailable";var Jz=Qh,xS=(function(t){function n(e){var r,i,o;k(this,n);var s,a,l,c=JSON.parse(JSON.stringify(e.directConnection)),u=c?.openAI;o=K(this,n,[e,ru(),nu,u]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("OpenAI"),o.keyHelpUrl=tu,o.url="".concat(mr,"audio/speech"),o.permittedErrorPrefixes=[Cs];var d=(s=c?.openAI)==null?void 0:s.textToSpeech;return B(d)===ze&&Object.assign(o.rawBody,d),(r=(a=o.rawBody).model)!==null&&r!==void 0||(a.model=n.DEFAULT_MODEL),(i=(l=o.rawBody).voice)!==null&&i!==void 0||(l.voice=n.DEFAULT_VOIDE),o.textInputPlaceholderText="Insert text to generate audio",o.rawBody.response_format="mp3",o}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o,s,a=JSON.parse(JSON.stringify(r)),l=(s=(o=i[i.length-1])==null?void 0:o[b])==null?void 0:s.trim();return l&&l!==""&&(a.input=l),a}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.url=this.connectSettings.url||this.url,this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this));case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){return v().w(function(s){for(;;)switch(s.n){case 0:if(!(o instanceof Blob)){s.n=1;break}return s.a(2,new Promise(function(a){var l=new FileReader;
167l.readAsDataURL(o),l.onload=function(c){a(_({},x,[_(_({},Y,c.target.result),ce,$e)]))}}));case 1:if(!o[E]){s.n=2;break}throw o[E].message;case 2:return s.a(2,_({},E,E))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge);xS.DEFAULT_MODEL="tts-1",xS.DEFAULT_VOIDE="alloy";var Yz=xS,Wv=(function(t){function n(e){var r,i;k(this,n);var o,s,a=JSON.parse(JSON.stringify(e.directConnection)),l=a?.openAI;i=K(this,n,[e,ru(),nu,l,{audio:{}}]),i.insertKeyPlaceholderText=i.genereteAPIKeyName("OpenAI"),i.keyHelpUrl=tu,i.url="",i.permittedErrorPrefixes=[Cs],i.textInputPlaceholderText=US,i._service_url=n.AUDIO_TRANSCRIPTIONS_URL;var c=(o=a?.openAI)==null?void 0:o[$e];return B(c)=="object"&&(i.processConfig(c),n.cleanConfig(c),Object.assign(i.rawBody,c)),(r=(s=i.rawBody).model)!==null&&r!==void 0||(s.model=n.DEFAULT_MODEL),i.rawBody.response_format="json",i.canSendMessage=n.canSendFileMessage,i}return J(n,t),M(n,[{key:"processConfig",value:function(r){r!=null&&r.type&&r.type==="translation"&&(this._service_url=n.AUDIO_TRANSLATIONS_URL,delete r.language)}},{key:"preprocessBody",value:function(r,i){var o,s,a=JSON.parse(JSON.stringify(r)),l=(s=(o=i[i.length-1])==null?void 0:o[b])==null?void 0:s.trim();return l&&l!==""&&(a.prompt=l),a}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s,a){var l,c,u;return v().w(function(d){for(;;)switch(d.n){case 0:if((l=this.connectSettings)!=null&&l.headers){d.n=1;break}throw new Error(sr);case 1:if(a!=null&&a[0]){d.n=2;break}throw new Error(ty);case 2:this.url=this.connectSettings.url||this._service_url,c=this.preprocessBody(this.rawBody,s),u=n.createFormDataBody(c,a[0]),Ue.tempRemoveContentHeader(this.connectSettings,Sn.request.bind(this,this,u,o),!1);case 3:return d.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){return v().w(function(s){for(;;)switch(s.n){case 0:if(!o[E]){s.n=1;break}throw o[E].message;case 1:return s.a(2,_({},b,o[b]))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}],[{key:"canSendFileMessage",value:function(r,i){return!!(i!=null&&i[0])}},{key:"cleanConfig",value:function(r){delete r.type}},{key:"createFormDataBody",value:function(r,i){var o=new FormData;return o.append(Bt,i),Object.keys(r).forEach(function(s){o.append(s,String(r[s]))}),o}}])})(ge);Wv.AUDIO_TRANSCRIPTIONS_URL="".concat(mr,"audio/transcriptions"),Wv.AUDIO_TRANSLATIONS_URL="".concat(mr,"audio/translations"),Wv.DEFAULT_MODEL="whisper-1";var Zz=Wv,iu="Ocp-Apim-Subscription-Key",GP="https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",Xz=function(n,e){return _(_(_({},iu,e),Ze,"application/ssml+xml"),"X-Microsoft-OutputFormat",n)},Qz=function(n){return _(_({},iu,n),"Accept",Ct)},e7=function(n,e,r,i){n[E]?i(en):r(e)},t7=function(n){return{url:"https://".concat(n,".api.cognitive.microsoft.com/sts/v1.0/issuetoken"),method:fn,createHeaders:function(r){return _({},iu,"".concat(r))},handleVerificationResult:e7}},n7=function(n){return _(_({},iu,n),Ze,Ct)},r7=function(n,e,r,i){var o;((o=n[E])==null?void 0:o.code)==="401"?i(en):r(e)},i7=function(n){return{url:"".concat(n,"/language/analyze-text/jobs?api-version=2022-10-01-preview"),method:fn,createHeaders:function(r){return _({},iu,"".concat(r))},handleVerificationResult:r7}},o7=function(n,e,r,i){n.json().then(function(o){!Array.isArray(o)&&o[E].code===401e3?i(en):r(e)})},s7=function(n){return{url:"https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es",method:fn,createHeaders:function(r){return KP(n,r)},handleVerificationResult:o7}},KP=function(n,e){var r=_(_({},iu,e),Ze,Ct);return n&&(r["Ocp-Apim-Subscription-Region"]=n),r},a7=(function(t){function n(e,r,i,o,s){var a;return k(this,n),a=K(this,n,[e,i7(i),r,o,s]),a.insertKeyPlaceholderText="Azure Language Subscription Key",a.keyHelpUrl=GP,a.permittedErrorPrefixes=["Access"],a}return J(n,t),M(n)})(ge),JP=(function(t){function n(e){var r,i;k(this,n);var o,s,a,l,c=(s=(o=e.directConnection)==null?void 0:o.azure)==null?void 0:s.summarization,u=(a=e.directConnection)==null?void 0:a.azure;return i=K(this,n,[e,n7,c.endpoint,u]),i.permittedErrorPrefixes=[n.ENDPOINT_ERROR_MESSAGE],i.url="",i.textInputPlaceholderText="Insert text to summarize",i.isTextInputDisabled=!1,c.endpoint?((r=(l=i.rawBody).language)!==null&&r!==void 0||(l.language="en"),Object.assign(i.rawBody,c),i.url="".concat(c.endpoint,"/language/analyze-text/jobs?api-version=2022-10-01-preview")):(i.isTextInputDisabled=!0,i.canSendMessage=function(){return!1},setTimeout(function(){e.addMessage(_({},E,n.ENDPOINT_ERROR_MESSAGE))}
167)),i}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=i[i.length-1][b];if(o)return{analysisInput:{documents:[_({id:"1",language:r.language},b,o)]},tasks:[{kind:"ExtractiveSummarization"}]}}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this)),this.messages=o;case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s,a,l;return v().w(function(c){for(;;)switch(c.n){case 0:if(!o[E]){c.n=1;break}throw o[E].message;case 1:return this.messages&&this.completionsHandlers&&(this.asyncCallInProgress=!0,a=o.headers.get("operation-location"),l={method:Qt,headers:(s=this.connectSettings)==null?void 0:s.headers},Sn.executePollRequest(this,a,l,this.messages)),c.a(2,_({},b,""))}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"extractPollResultData",value:(function(){var e=D(v().m(function i(o){var s,a,l,c;return v().w(function(u){for(;;)switch(u.n){case 0:if(!o[E]){u.n=1;break}throw o[E];case 1:if(!(o.status==="running"||o.status==="notStarted")){u.n=2;break}return u.a(2,{timeoutMS:2e3});case 2:if(!(o.errors.length>0)){u.n=3;break}throw o.errors[0];case 3:if(!(o.tasks.items[0].results.errors.length>0)){u.n=4;break}throw o.tasks.items[0].results.errors[0];case 4:s="",a=of(o.tasks.items[0].results.documents[0].sentences);try{for(a.s();!(l=a.n()).done;)c=l.value,s+=c[b]}catch(d){a.e(d)}finally{a.f()}return u.a(2,_({},b,s||""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(a7);JP.ENDPOINT_ERROR_MESSAGE="Please define the azure endpoint. [More Information](".concat(at,"directConnection/Azure#Summarization)");var l7=JP,c7=(function(){var t=D(v().m(function n(e,r){var i,o,s,a,l;return v().w(function(c){for(;;)switch(c.n){case 0:return i=_(_({},_$,e),b$,Ct),l="https://api.assemblyai.com/v2/transcript/",c.n=1,fetch("https://api.assemblyai.com/v2/transcript",{method:fn,body:JSON.stringify({audio_url:r}),headers:i});case 1:return c.n=2,c.v.json();case 2:o=l.concat.call(l,c.v.id);case 3:if(s){c.n=9;break}return c.n=4,fetch(o,{headers:i});case 4:return c.n=5,c.v.json();case 5:if(a=c.v,a.status!==VS){c.n=6;break}s=a,c.n=8;break;case 6:if(a.status!==E){c.n=7;break}throw new Error("Transcription failed: ".concat(a[E]));case 7:return c.n=8,new Promise(function(u){return setTimeout(u,3e3)});case 8:c.n=3;break;case 9:return c.a(2,s)}},n)}));return function(e,r){return t.apply(this,arguments)}})(),u7=function(n){return _(_({},Xt,n),Ze,"application/octet-stream")},d7=function(n,e,r,i){var o=n;o[E]?o[E].code==="invalid_api_key"?i(en):i(Mr):r(e)},h7=function(){return on("https://api.assemblyai.com/v2/upload",fn,d7)},f7=(function(t){function n(e){var r;k(this,n);var i,o=(i=e.directConnection)==null?void 0:i.assemblyAI;return r=K(this,n,[e,h7(),u7,o,{audio:{}}]),r.insertKeyPlaceholderText=r.genereteAPIKeyName("AssemblyAI"),r.keyHelpUrl="https://www.assemblyai.com/app/account",r.url="https://api.assemblyai.com/v2/upload",r.isTextInputDisabled=!0,r.textInputPlaceholderText=US,r.permittedErrorPrefixes=[mP,Cs],r.canSendMessage=n.canFileSendMessage,r}return J(n,t),M(n,[{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s,a){var l;return v().w(function(c){for(;;)switch(c.n){case 0:if((l=this.connectSettings)!=null&&l.headers){c.n=1;break}throw new Error(sr);case 1:if(a!=null&&a[0]){c.n=2;break}throw new Error(ty);case 2:Sn.request(this,a[0],o,!1);case 3:return c.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s,a,l,c;return v().w(function(u){for(;;)switch(u.n){case 0:if(!o[E]){u.n=1;break}throw o[E];case 1:return l=(a=(s=this.connectSettings)==null?void 0:s.headers)==null?void 0:a[Xt],u.n=2,c7(l,o.upload_url);case 2:return c=u.v,u.a(2,_({},b,c[b]))}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()}],[{key:"canFileSendMessage",value:function(r,i){return!!(i!=null&&i[0])}}])})(ge),Qv=(function(t){function n(e,r,i,o,s){var a,l,c;k(this,n);var u,d,f=JSON.parse(JSON.stringify(e.directConnection)),h=r||ru(),p=i||nu,m=o||f.openAI;c=K(this,n,[e,h,p,m]),c.insertKeyPlaceholderText=c.genereteAPIKeyName("OpenAI"),c.keyHelpUrl="https://platform.openai.com/account/api-keys",c.permittedErrorPrefixes=[df,"Invalid value"];var g=s||((u=f.openAI)==null?void 0:u.chat);return B(g)===ze&&c.processConfig(g,e),(a=c.maxMessages)!==null&&a!==void 0||(c.maxMessages=-1),(l=(d=c.rawBody).model)!==null&&l!==void 0||(d.model="gpt-4o"),c}return J(n,t),M(n,[{key:"processConfig",value:function(r,i){var o,s,a;this.completeConfig(r,(a=(s=(o=i.directConnection)==null?void 0:o.openAI)==null?void 0:s.chat)==null?void 0:a.function_handler)}}],[{key:"getBaseFileContent",value:function(r){return r.map(function(i){var o,s,a;if(i.type===$e){var l=(o=i[Y])==null?void 0:o.split(",")[1],c=((a=(s=i.name)==null?void 0:s.split(".").pop())==null?void 0:a.toLowerCase())||"wav";return _(_({},ce,Xa),Xa,{data:l,format:c})}return i})}},{key:"getBaseContent",value:function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(i&&r[x]&&r[x].length>0){var o=this.getBaseFileContent(r[x]);return r[b]&&r[b].trim().length>0&&o.unshift(_(_({},ce,b),b,r[b])),o}return r[b]}}])})(ge),p7=(function(t){function n(){var e;return k(this,n),e=K(this,n,arguments),e.url="".concat(mr,"chat/completions"),e}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:n.getContent(a),role:ge.getRoleViaUser(a.role)}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:(a=this.messages)!==null&&a!==void 0||(this.messages=o),this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return l.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d,f,h,p;return v().w(function(m){for(;;)switch(m.n){case 0:if(!o[E]){m.n=1;break}throw o[E].message;case 1:if(!((l=(a=o.choices)==null?void 0:a[0])!=null&&l.delta)){m.n=2;break}return m.a(2,this.extractStreamResult(o.choices[0],s));case 2:if(!((u=(c=o.choices)==null?void 0:c[0])!=null&&u.message)){m.n=5;break}if(!o.choices[0].message.tool_calls){m.n=3;break}return m.a(2,this.handleToolsGeneric(o.choices[0].message,this.functionHandler,this.messages,s));case 3:if(!((d=o.choices[0].message)!=null&&d[$e])){m.n=4;break}return h=this.deepChat.textToSpeech,p=B(h)=="object"&&typeof((f=h?.[$e])==null?void 0:f.displayText)=="boolean",m.a(2,_(_({},x,[_(_({},Y,"data:audio/wav;base64,".concat(o.choices[0].message[$e].data)),ce,$e)]),b,p?o.choices[0].message[$e].transcript:void 0));case 4:return m.a(2,_({},b,o.choices[0].message.content));case 5:return m.a(2,_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractStreamResult",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:return a.a(2,this.extractStreamResultWToolsGeneric(this,o,this.functionHandler,s))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()}],[{key:"getFileContent",value:function(r){return Qv.getBaseFileContent(r).map(function(i){return i.type===Xa?i:_(_({},ce,fr),fr,{url:i[Y]})})}},{key:"getContent",value:function(r){if(r[x]&&r[x].length>0){var i=n.getFileContent(r[x]);return r[b]&&r[b].trim().length>0&&i.unshift(_(_({},ce,b),b,r[b])),i}return r[b]}}])})(Qv),YP=(function(t){function n(e,r,i,o,s){var a;return k(this,n),a=K(this,n,[e,t7(i),r,o,s]),a.insertKeyPlaceholderText="Azure Speech Subscription Key",a.keyHelpUrl=GP,a}return J(n,t),M(n)})(ge);YP.REGION_ERROR_PREFIX="Please define a region config property. [More Information](".concat(at,"directConnection/Azure#");var ly=YP,ZP=(function(t){function n(e){var r,i,o,s;k(this,n);var a,l,c,u,d,f,h=(l=(a=e.directConnection)==null?void 0:a.azure)==null?void 0:l.textToSpeech,p=(c=e.directConnection)==null?void 0:c.azure;return s=K(this,n,[e,Xz.bind({},h?.outputFormat||"audio-16khz-128kbitrate-mono-mp3"),h.region,p]),s.permittedErrorPrefixes=[n.REGION_ERROR_MESSAGE],s.isTextInputDisabled=!1,s.url="",h.region?(Object.assign(s.rawBody,h),(r=(u=s.rawBody).lang)!==null&&r!==void 0||(u.lang="en-US"),(i=(d=s.rawBody).name)!==null&&i!==void 0||(d.name="en-US-JennyNeural"),(o=(f=s.rawBody).gender)!==null&&o!==void 0||(f.gender="Female"),s.url="https://".concat(h.region,".tts.speech.microsoft.com/cognitiveservices/v1")):(s.isTextInputDisabled=!0,s.canSendMessage=function(){return!1},setTimeout(function(){e.addMessage(_({},E,n.REGION_ERROR_MESSAGE))}
167)),s}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=i[i.length-1][b];if(o)return"<speak version='1.0' xml:lang='".concat(r.lang,`'> 168 <voice xml:lang='`).concat(r.lang,"' xml:gender='").concat(r.gender,"' name='").concat(r.name,`'> 169 `).concat(o,` 170 </voice> 171 </speak>`)}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),void 0,!1);case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){return v().w(function(s){for(;;)switch(s.n){case 0:return s.a(2,new Promise(function(a){var l=new FileReader;l.readAsDataURL(o),l.onload=function(c){a(_({},x,[_(_({},Y,c.target.result),ce,$e)]))}}))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ly);ZP.REGION_ERROR_MESSAGE="".concat(ly.REGION_ERROR_PREFIX,"TextToSpeech)");var m7=ZP,XP=(function(t){function n(e){var r;k(this,n);var i,o,s,a=(o=(i=e.directConnection)==null?void 0:i.azure)==null?void 0:o.speechToText,l=(s=e.directConnection)==null?void 0:s.azure,c={audio:_({},x,{acceptedFormats:".wav,.ogg"})};if(r=K(this,n,[e,Qz,a.region,l,c]),r.permittedErrorPrefixes=[n.REGION_ERROR_MESSAGE],r.url="",r.isTextInputDisabled=!0,r.textInputPlaceholderText=US,!a.region)r.isTextInputDisabled=!0,r.canSendMessage=function(){return!1},setTimeout(function(){e.addMessage(_({},E,n.REGION_ERROR_MESSAGE))});else{r.canSendMessage=n.canFileSendMessage;var u=a.lang||"en-US";r.url="https://".concat(a.region,".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(u,"&format=detailed"),r.recordAudio=void 0}return r}return J(n,t),M(n,[{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s,a){var l,c;return v().w(function(u){for(;;)switch(u.n){case 0:if((l=this.connectSettings)!=null&&l.headers){u.n=1;break}throw new Error(sr);case 1:if(a!=null&&a[0]){u.n=2;break}throw new Error(ty);case 2:(c=this.connectSettings)!=null&&c.headers&&(this.connectSettings.headers[Ze]=a[0].name.toLocaleLowerCase().endsWith(".wav")?"audio/wav; codecs=audio/pcm; samplerate=16000":"audio/ogg; codecs=opus"),Sn.request(this,a[0],o,!1);case 3:return u.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){return v().w(function(s){for(;;)switch(s.n){case 0:if(!o[E]){s.n=1;break}throw o[E];case 1:return s.a(2,_({},b,o.DisplayText||""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}],[{key:"canFileSendMessage",value:function(r,i){return!!(i!=null&&i[0])}}])})(ly);XP.REGION_ERROR_MESSAGE="".concat(ly.REGION_ERROR_PREFIX,"SpeechToText)");var g7=XP,v7=(function(t){function n(e){var r;k(this,n);var i,o,s,a=(o=(i=e.directConnection)==null?void 0:i.azure)==null?void 0:o.translation,l=(s=e.directConnection)==null?void 0:s.azure;return r=K(this,n,[e,s7(a.region),KP.bind({},a?.region),l]),r.insertKeyPlaceholderText="Azure Translate Subscription Key",r.keyHelpUrl="https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",r.url="",r.url="https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(a.language||"es"),r}return J(n,t),M(n,[{key:"preprocessBody",value:function(r){var i=r[r.length-1][b];if(i)return[{Text:i}]}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this));case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!Array.isArray(o)){a.n=1;break}return a.a(2,_({},b,((s=o[0].translations)==null?void 0:s[0][b])||""));case 1:throw o[E];case 2:return a.a(2)}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge),y7=(function(t){function n(e){var r,i;k(this,n);var o,s,a=JSON.parse(JSON.stringify(e.directConnection)),l=a.bigModel;i=K(this,n,[e,ZS(),YS,l]),i.insertKeyPlaceholderText=i.genereteAPIKeyName("BigModel"),i.keyHelpUrl="https://open.bigmodel.cn/usercenter/apikeys",i.url="https://open.bigmodel.cn/api/paas/v4/images/generations",i.permittedErrorPrefixes=[Xt,Ln];var c=(o=a.bigModel)==null?void 0:o[wt];return B(c)===ze&&(i.cleanConfig(c),Object.assign(i.rawBody,c)),(r=(s=i.rawBody).model)!==null&&r!==void 0||(s.model="cogview-4-250304"),i}return J(n,t),M(n,[{key:"cleanConfig",value:function(r){delete r.key}},{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=i[i.length-1];return o.prompt=s?.[b]||"",o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:return a.a(2,this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this)))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:return s=o.data.map(function(l){return l!=null&&l.url?_(_({},Y,l.url),ce,it):_(_({},Y,""),ce,it)}),a.a(2,_({},x,s))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge),QP=function(n){return _(_({},Ze,Ct),Xt,"".concat(Fn).concat(n))},_7=function(n,e,r,i){var o=n;o[E]?o[E].message===jS?i(en):i(Mr):r(e)},eF=function(){return on("https://api.groq.com/openai/v1/models",Qt,_7)},b7=(function(t){function n(e){var r,i,o,s;k(this,n);var a,l,c,u,d=JSON.parse(JSON.stringify(e.directConnection)),f=d.groq;s=K(this,n,[e,eF(),QP,f]),s.insertKeyPlaceholderText=s.genereteAPIKeyName("Groq"),s.keyHelpUrl="https://console.groq.com/keys",s.url="https://api.groq.com/openai/v1/audio/speech",s.permittedErrorPrefixes=[Cs,"property"];var h=(a=d.groq)==null?void 0:a.textToSpeech;return B(h)===ze&&s.completeConfig(h),(r=(l=s.rawBody).model)!==null&&r!==void 0||(l.model="playai-tts"),(i=(c=s.rawBody).voice)!==null&&i!==void 0||(c.voice="Fritz-PlayAI"),(o=(u=s.rawBody).response_format)!==null&&o!==void 0||(u.response_format="mp3"),s}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=i[i.length-1];return o.input=s?.[b]||"",o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:return a.a(2,this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this)))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s,a,l;return v().w(function(c){for(;;)switch(c.n){case 0:return s=this.rawBody.response_format||"mp3",a=new Blob([o],_({},ce,"audio/".concat(s))),l=URL.createObjectURL(a),c.a(2,_({},x,[_(_({},Y,l),ce,$e)]))}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge),w7=(function(t){function n(e){var r,i;k(this,n);var o,s,a=JSON.parse(JSON.stringify(e.directConnection)),l=a.together;i=K(this,n,[e,QS(),XS,l]),i.insertKeyPlaceholderText=i.genereteAPIKeyName("Together AI"),i.keyHelpUrl="https://api.together.xyz/settings/api-keys",i.url="https://api.together.xyz/v1/images/generations",i.permittedErrorPrefixes=[Qr,Ln];var c=(o=a.together)==null?void 0:o[wt];return B(c)===ze&&i.completeConfig(c),(r=(s=i.rawBody).model)!==null&&r!==void 0||(s.model="black-forest-labs/FLUX.1-schnell-Free"),i}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=i[i.length-1];return o.prompt=s?.[b]||"",o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:return a.a(2,this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this)))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:return s=o.data.map(function(l){return l!=null&&l.url?_(_({},Y,l.url),ce,it):l!=null&&l.b64_json?_(_({},Y,"data:image/png;base64,".concat(l.b64_json)),ce,it):_(_({},Y,""),ce,it)}),a.a(2,_({},x,s))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge),tF=(function(t){function n(e,r,i,o,s){var a;k(this,n);var l,c;a=K(this,n,[e,r,i,o,s]),a.keyHelpUrl=tu,a.url="".concat(mr,"responses"),a._functionStreamInProgress=!1,a._useConversation=!1,a._conversationLoadLimit=50;var u=s||((c=(l=e.directConnection)==null?void 0:l.openAI)==null?void 0:c.chat);return B(u)===ze&&u!==!0&&u&&(u.conversation&&(a._useConversation=!0,typeof u.conversation=="str
171ing"&&(a._conversationId=u.conversation)),typeof u.conversationLoadLimit=="number"&&(a._conversationLoadLimit=u.conversationLoadLimit),a.cleanConfig(u)),a._conversationId&&(a.fetchHistory=a.fetchHistoryFunc.bind(a)),a}return J(n,t),M(n,[{key:"processConfig",value:function(r,i){q8(n,"processConfig",this,3)([r,i])}},{key:"cleanConfig",value:function(r){delete r.conversation,delete r.conversationLoadLimit}},{key:"fetchHistoryFunc",value:(function(){var e=D(v().m(function i(){var o=this,s,a,l;return v().w(function(c){for(;;)switch(c.p=c.n){case 0:return setTimeout(function(){return o.deepChat.disableSubmitButton()},2),c.p=1,s=this.url,this.url="".concat(mr,"conversations/").concat(this._conversationId,"/items?limit=").concat(this._conversationLoadLimit),c.n=2,ys(this,{},Qt);case 2:return a=c.v,c.a(2,(this.connectSettings.method=fn,this.url=s,this.deepChat.disableSubmitButton(!1),this.processConversationHistory(a)));case 3:return c.p=3,l=c.v,c.a(2,(this.deepChat.disableSubmitButton(!1),[_({},E,lP)]))}},i,this,[[1,3]])}));function r(){return e.apply(this,arguments)}return r})()},{key:"processConversationHistory",value:function(r){if(!r.data||!Array.isArray(r.data))return[];var i=[],o=of(n.filterCompleted(r.data.reverse())),s;try{for(o.s();!(s=o.n()).done;){var a=s.value;if(a.type==="message"&&a.content&&Array.isArray(a.content)){var l=of(a.content),c;try{for(l.s();!(c=l.n()).done;){var u=c.value;(u.type===TS||u.type===wN)&&u[b]?i.push(_({role:a.role},b,u[b])):u.type===bN&&i.push(_({role:a.role},x,n.generateImageFile(u[fr]||"")))}}catch(d){l.e(d)}finally{l.f()}}else a.type===hS&&i.push(_({role:xt},x,n.generateImageFile(a.result)))}}catch(d){o.e(d)}finally{o.f()}return i}},{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r));i=this.processMessages(i),i=this._useConversation?[i[i.length-1]]:i;var s=i.map(function(a){return{content:n.getContent(a),role:ge.getRoleViaUser(a.role)}});return o.input=s,this._conversationId&&(o.conversation=this._conversationId),o}},{key:"createConversation",value:(function(){var e=D(v().m(function i(){var o,s,a;return v().w(function(l){for(;;)switch(l.p=l.n){case 0:return l.p=0,o=this.url,this.url="".concat(mr,"conversations"),l.n=1,ys(this,{},fn);case 1:return s=l.v,l.a(2,(this.url=o,s.id));case 2:throw l.p=2,a=l.v,console[E]("Failed to create conversation:",a),a;case 3:return l.a(2)}},i,this,[[0,2]])}));function r(){return e.apply(this,arguments)}return r})()},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a,l;return v().w(function(c){for(;;)switch(c.n){case 0:if((a=this.messages)!==null&&a!==void 0||(this.messages=o),l=this._useConversation&&!this._conversationId,!l){c.n=2;break}return c.n=1,this.createConversation();case 1:this._conversationId=c.v;case 2:this._conversationId&&this.updateSessionId(this._conversationId),this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 3:return c.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:return l.n=1,this.extractResult(o,s);case 1:return a=l.v,l.a(2,(this._conversationId&&(a._sessionId=this._conversationId),a))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResult",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d,f,h,p;return v().w(function(m){for(;;)switch(m.n){case 0:if(!o[E]){m.n=1;break}throw o[E].message;case 1:if(!o.status){m.n=5;break}if(d=n.filterCompleted(o.output),!(d.length>0)){m.n=4;break}return f=(c=(l=(a=d.find(function(g){var w,C;return typeof((C=(w=g.content)==null?void 0:w[0])==null?void 0:C[b])=="string"}))==null?void 0:a.content)==null?void 0:l[0])==null?void 0:c[b],m.n=2,this.handleResponsesFunctionCalls(d,s,f);case 2:if(h=m.v,!h){m.n=3;break}return m.a(2,h);case 3:return p=this.handleFileGenerationResponse(d,f),m.a(2,p||_({},b,f));case 4:return m.a(2,_({},b,""));case 5:return m.a(2,((u=o.item)==null?void 0:u.type)===Vv&&o.type?this.handleStreamedResponsesFunctionCall(o,s):o.type==="".concat(kh,".").concat(hS,".partial_image")&&o.partial_image_b64?_({},x,[_(_({},Y,"".concat(n.IMAGE_BASE64_PREFIX).concat(o.partial_image_b64)),ce,it)]):o.delta&&!this._functionStreamInProgress&&o.type==="".concat(kh,".").concat(wN,".delta")?_({},b,o.delta):_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"handleStreamedResponsesFunctionCall",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:if(o.type!=="".concat(kh,".output_item.done")){l.n=2;break}if(this._functionStreamInProgress=!1,((a=o.item)==null?void 0:a.type)!==Vv){l.n=1;break}return l.a(2,this.handleResponsesFunctionCalls([o.item],s));case 1:l.n=3;break;case 2:o.type==="".concat(kh,".output_item.added")&&(this._functionStreamInProgress=!0);case 3:return l.a(2,_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"handleFileGenerationResponse",value:function(r,i){var o=r.find(function(s){return s.type===hS});return o?_(_({},x,n.generateImageFile(o.result)),b,i):null}},{key:"handleResponsesFunctionCalls",value:(function(){var e=D(v().m(function i(o,s,a){var l,c,u,d,f,h;return v().w(function(p){for(;;)switch(p.n){case 0:if(l=o.filter(function(m){return m.type===Vv}),l.length!==0){p.n=1;break}return p.a(2,null);case 1:if(!(!s||!this.functionHandler)){p.n=2;break}throw Error(Es);case 2:return c=l.map(function(m){return{name:m.name,arguments:m.arguments}}),p.n=3,this.callToolFunction(this.functionHandler,c);case 3:if(u=p.v,d=u.responses,f=u.processedResponse,!f){p.n=4;break}return p.a(2,f);case 4:if(h=JSON.parse(JSON.stringify(s)),!(h.input&&(l.forEach(function(m){return h.input.push(m)}),!d.find(function(m){var g=m.response;return typeof g!="string"})&&c.length===d.length))){p.n=5;break}
171return p.a(2,(d.forEach(function(m,g){var w=l[g];h.input.push({type:LP,call_id:w.call_id,output:m[kh]})}),this.makeAnotherRequest(h,this.messages,a)));case 5:throw Error(rl);case 6:return p.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()}],[{key:"getFileContent",value:function(r){return Qv.getBaseFileContent(r).map(function(i){return i.type===Xa?i:_(_({detail:"auto"},ce,bN),fr,i[Y])})}},{key:"getContent",value:function(r){if(r.role===et&&r[x]&&r[x].length>0){var i=n.getFileContent(r[x]);return r[b]&&r[b].trim().length>0&&i.unshift(_(_({},ce,TS),b,r[b])),i}return r[b]}},{key:"filterCompleted",value:function(r){return r?.filter(function(i){return i.status===VS})||[]}},{key:"generateImageFile",value:function(r){return[_(_({},Y,"".concat(n.IMAGE_BASE64_PREFIX).concat(r)),ce,it)]}}])})(Qv);tF.IMAGE_BASE64_PREFIX="data:image/png;base64,";var nF=tF,E7=(function(t){function n(e){var r;k(this,n);var i,o,s,a,l,c,u,d=JSON.parse(JSON.stringify(e.directConnection)),f=d.azure,h=((o=(i=d.azure)==null?void 0:i.openAI)==null?void 0:o.urlDetails)||{},p=(a=(s=d.azure)==null?void 0:s.openAI)==null?void 0:a.chat;if(r=K(this,n,[e,HP(h),UP,f,p]),r.permittedErrorPrefixes=[Xv],r.isTextInputDisabled=!1,B(p)===ze){var m=(u=(c=(l=e.directConnection)==null?void 0:l.azure)==null?void 0:c.openAI)==null?void 0:u.chat,g=m.function_handler;g&&(r.functionHandler=g)}return $P(h)?r.url=n.buildURL(h):(r.isTextInputDisabled=!0,r.canSendMessage=function(){return!1},setTimeout(function(){e.addMessage(_({},E,Xv))})),r}return J(n,t),M(n,null,[{key:"buildURL",value:function(r){var i=r.endpoint,o=r.deploymentId,s=r.version;return"".concat(i,"/openai/deployments/").concat(o,"/chat/completions?api-version=").concat(s)}}])})(nF),C7=(function(t){function n(e){var r,i,o;k(this,n);var s,a,l,c,u,d=JSON.parse(JSON.stringify(e.directConnection)),f=d.bigModel;o=K(this,n,[e,ZS(),YS,f]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("BigModel"),o.keyHelpUrl="https://open.bigmodel.cn/usercenter/apikeys",o.url="https://open.bigmodel.cn/api/paas/v4/chat/completions",o.permittedErrorPrefixes=[Xt,Ln];var h=(s=d.bigModel)==null?void 0:s.chat;return B(h)===ze&&o.completeConfig(h,(c=(l=(a=e.directConnection)==null?void 0:a.bigModel)==null?void 0:l.chat)==null?void 0:c.function_handler),(r=o.maxMessages)!==null&&r!==void 0||(o.maxMessages=-1),(i=(u=o.rawBody).model)!==null&&i!==void 0||(u.model="glm-4.5"),o}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:n.getTextWFilesContent(a,n.getFileContent),role:ge.getRoleViaAI(a.role)}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:(a=this.messages)!==null&&a!==void 0||(this.messages=o),this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return l.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:if(!o[E]){l.n=1;break}throw o[E].message;case 1:if(!(o.choices.length>0)){l.n=3;break}if(o.choices[0].delta===void 0){l.n=2;break}return l.a(2,this.extractStreamResult(o.choices[0],s));case 2:if(o.choices[0].message===void 0){l.n=3;break}return a=o.choices[0].message,l.a(2,a.tool_calls?this.handleToolsGeneric({tool_calls:a.tool_calls},this.functionHandler,this.messages,s):_({},b,a.content));case 3:return l.a(2,_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractStreamResult",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d,f,h,p;return v().w(function(m){for(;;)switch(m.n){case 0:if(d=o.delta,f=o.finish_reason,h=(a=this.messages)==null?void 0:a.messageToElements[this.messages.messageToElements.length-2],h?.[0].role===xt&&((l=h?.[0][b])==null?void 0:l.replace(/\n/g,"").trim().length)===0&&((c=this.messages)==null||c.removeMessage(h[1][b]),(u=this.messages)==null||u.messageToElements.splice(this.messages.messageToElements.length-2,1)),f!=="tool_calls"){m.n=2;break}if(!d.tool_calls){m.n=1;break}return p={tool_calls:d.tool_calls},m.a(2,this.handleToolsGeneric(p,this.functionHandler,this.messages,s));case 1:return m.a(2,_({},b,d?.content||""));case 2:return m.a(2,_({},b,d?.content||""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()}],[{key:"getFileContent",value:function(r){return r.map(function(i){return i.type===it?_(_({},ce,fr),fr,{url:i[Y]||""}):_(_({},ce,Bt),"file_url",{url:i[Y]||""})})}}])})(ge),S7=(function(t){function n(e){var r,i,o;k(this,n);var s,a,l=JSON.parse(JSON.stringify(e.directConnection)),c=l.together;o=K(this,n,[e,QS(),XS,c]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("Together AI"),o.keyHelpUrl="https://api.together.xyz/settings/api-keys",o.url="https://api.together.xyz/v1/chat/completions",o.permittedErrorPrefixes=[Qr,Ln];var u=(s=l.together)==null?void 0:s.chat;return B(u)===ze&&o.completeConfig(u),(r=o.maxMessages)!==null&&r!==void 0||(o.maxMessages=-1),(i=(a=o.rawBody).model)!==null&&i!==void 0||(a.model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo"),o}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:a[b]||"",role:a.role===xt?Qi:a.role}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){return v().w(function(s){for(;;)switch(s.n){case 0:if(!o[E]){s.n=1;break}throw o[E].message;case 1:if(!(o.choices.length>0)){s.n=3;break}if(o.choices[0].message===void 0){s.n=2;break}return s.a(2,_({},b,o.choices[0].message.content));case 2:if(o.choices[0].delta===void 0){s.n=3;break}return s.a(2,_({}
171,b,o.choices[0].delta.content));case 3:return s.a(2,_({},b,""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge),Gv=(function(t){function n(e){var r;k(this,n);var i,o=e.directConnection,s=o?.openAI,a={images:_({},x,{acceptedFormats:".png",maxNumberOfFiles:2})};r=K(this,n,[e,ru(),nu,s,a]),r.insertKeyPlaceholderText=r.genereteAPIKeyName("OpenAI"),r.keyHelpUrl=tu,r.url="",r.permittedErrorPrefixes=[df,"Invalid input image"];var l=(i=o?.openAI)==null?void 0:i[wt];if(r[or]){var c=B(l)=="object"&&l.size?Number.parseInt(l.size):1024;r[or][x]={dimensions:{width:c,height:c}}}return B(l)===ze&&Object.assign(r.rawBody,l),r.canSendMessage=n.canFileSendMessage,r}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r));return i&&i!==""&&(o.prompt=i),o}},{key:"callApiWithImage",value:function(r,i,o){var s,a,l,c=(a=(s=i[i.length-1])==null?void 0:s[b])==null?void 0:a.trim();if(o[1]||c&&c!==""){this.url=n.IMAGE_EDIT_URL;var u=this.preprocessBody(this.rawBody,c);l=n.createFormDataBody(u,o[0],o[1])}else this.url=n.IMAGE_VARIATIONS_URL,l=n.createFormDataBody(this.rawBody,o[0]);Ue.tempRemoveContentHeader(this.connectSettings,Sn.request.bind(this,this,l,r),!1)}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s,a){var l,c;return v().w(function(u){for(;;)switch(u.n){case 0:if((l=this.connectSettings)!=null&&l.headers){u.n=1;break}throw new Error(sr);case 1:if(!(a!=null&&a[0])){u.n=2;break}this.callApiWithImage(o,s,a),u.n=4;break;case 2:if(this.connectSettings){u.n=3;break}throw new Error(sr);case 3:this.url=n.IMAGE_GENERATION_URL,c=this.preprocessBody(this.rawBody,s[s.length-1][b]),Sn.request(this,c,o);case 4:return u.a(2)}},i,this)}));function r(i,o,s){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o[E]){a.n=1;break}throw o[E].message;case 1:return s=o.data.map(function(l){return l.url?_(_({},Y,l.url),ce,it):_(_({},Y,"".concat(eu).concat(l.b64_json)),ce,it)}),a.a(2,_({},x,s))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}],[{key:"canFileSendMessage",value:function(r,i){return!!(i!=null&&i[0])||!!(r&&r.trim()!=="")}},{key:"createFormDataBody",value:function(r,i,o){var s=new FormData;return s.append(it,i),o&&s.append("mask",o),Object.keys(r).forEach(function(a){s.append(a,String(r[a]))}),s}}])})(ge);Gv.IMAGE_GENERATION_URL="".concat(mr,"images/generations"),Gv.IMAGE_VARIATIONS_URL="".concat(mr,"images/variations"),Gv.IMAGE_EDIT_URL="".concat(mr,"images/edits");var D7=Gv,I7=function(n){return _(_({},Xt,"".concat(Fn).concat(n)),Ze,Ct)},T7=function(n,e,r,i){var o=n;o[E]?o[E].type===Ln?i(en):i(Mr):r(e)},k7=function(){return on("https://openrouter.ai/api/v1/key",Qt,T7)},M7=(function(t){function n(e){var r,i,o,s;k(this,n);var a,l,c,u,d=JSON.parse(JSON.stringify(e.directConnection)).openRouter;return s=K(this,n,[e,k7(),I7,d]),s.insertKeyPlaceholderText=s.genereteAPIKeyName("OpenRouter"),s.keyHelpUrl="https://openrouter.ai/keys",s.url="https://openrouter.ai/api/v1/chat/completions",s.permittedErrorPrefixes=[Qr,Ln],B(d)===ze&&s.completeConfig(d,(l=(a=e.directConnection)==null?void 0:a.openRouter)==null?void 0:l.function_handler),(r=s.maxMessages)!==null&&r!==void 0||(s.maxMessages=-1),(i=(c=s.rawBody).model)!==null&&i!==void 0||(c.model="openai/gpt-4o"),(o=(u=s.rawBody).max_tokens)!==null&&o!==void 0||(u.max_tokens=1e3),s}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(l){return{content:n.getContent(l),role:ge.getRoleViaUser(l.role)}}),a=[];return this.systemMessage&&a.push({role:"system",content:this.systemMessage}),a.push.apply(a,Za(s)),o.messages=a,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:(a=this.messages)!==null&&a!==void 0||(this.messages=o),this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return l.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d,f,h,p;return v().w(function(m){for(;;)switch(m.n){case 0:if(!o[E]){m.n=1;break}throw o[E].message;case 1:if(o.object!=="chat.completion.chunk"){m.n=4;break}if(d=(a=o.choices)==null?void 0:a[0],!(d!=null&&d.delta)){m.n=2;break}return m.a(2,this.extractStreamResult(d,s));case 2:if(!((l=o.message)!=null&&l[wt])){m.n=3;break}return f=o.message[wt].map(function(g){return _({},Y,g[fr].url)}),m.a(2,_(_({},b,o.message.content||""),x,f));case 3:return m.a(2,_({},b,""));case 4:if(o.object!=="chat.completion"){m.n=6;break}if(h=(c=o.choices)==null?void 0:c[0],!(h!=null&&h.message)){m.n=6;break}if(!h.message.tool_calls){m.n=5;break}return m.a(2,this.handleToolsGeneric({tool_calls:h.message.tool_calls},this.functionHandler,this.messages,s));case 5:return p=((u=h.message[wt])==null?void 0:u.map(function(g){return _({},Y,g[fr].url)}))||[],m.a(2,_(_({},b,h.message.content||""),"files",p));case 6:return m.a(2,_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractStreamResult",value:(function(){var e=D(v().m(function i(o,s){var a,l;return v().w(function(c){for(;;)switch(c.n){case 0:if(a=o.delta,!(a!=null&&a[wt])){c.n=1;break}return l=a[wt].map(function(u){return _({},Y,u[fr].url)}),c.a(2,_(_({},b,a.content||""),x,l));case 1:return c.a(2,this.extractStreamResultWToolsGeneric(this,o,this.functionHandler,s))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()}],[{key:"getAudioContent",value:function(r){return r.filter(function(i){return i.type===$e}).map(function(i){var o,s,a,l=(o=i[Y])==null?void 0:o.split(",")[1],c=(a=(s=i[Y])==null?void 0:s.match(/data:audio\/([^;
171]+)/))==null?void 0:a[1];return _(_({},ce,Xa),Xa,{data:l||"",format:c==="wav"||c==="mp3"?c:"mp3"})}).filter(function(i){return i[Xa].data.length>0})}},{key:"getContent",value:function(r){if(r[x]&&r[x].length>0){var i=[].concat(Za(n.getImageContent(r[x])),Za(n.getAudioContent(r[x])));return r[b]&&r[b].trim().length>0&&i.unshift(_(_({},ce,b),b,r[b])),i.length>0?i:r[b]||""}return r[b]||""}}])})(ge),A7=function(n){return _(_({},Xt,"".concat(Fn).concat(n)),Ze,Ct)},x7=function(n,e,r,i){n[E]?i(en):r(e)},R7=function(){return on("https://api.perplexity.ai/chat/completions",fn,x7)},O7=(function(t){function n(e){var r,i,o;k(this,n);var s,a=JSON.parse(JSON.stringify(e.directConnection)).perplexity;return o=K(this,n,[e,R7(),A7,a]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("Perplexity"),o.keyHelpUrl="https://www.perplexity.ai/settings/api",o.url="https://api.perplexity.ai/chat/completions",o.permittedErrorPrefixes=[Cs,mP,"Permission denied"],B(a)===ze&&o.completeConfig(a),(r=o.maxMessages)!==null&&r!==void 0||(o.maxMessages=-1),(i=(s=o.rawBody).model)!==null&&i!==void 0||(s.model="sonar"),o}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:a[b]||"",role:ge.getRoleViaUser(a.role)}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o[E]){a.n=1;break}throw o[E].message;case 1:if(!(o.choices&&o.choices.length>0)){a.n=3;break}if(s=o.choices[0],!(s.delta&&s.delta.content)){a.n=2;break}return a.a(2,_({},b,s.delta.content));case 2:if(!(s.message&&s.message.content)){a.n=3;break}return a.a(2,_({},b,s.message.content));case 3:return a.a(2,_({},b,""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge),N7=function(n){return _(_({},Xt,"Bearer ".concat(n)),Ze,Ct)},P7=function(n,e,r,i){var o=n;o.detail?i(o.detail):r(e)},F7=function(){return on("http://localhost:3000/api/v1/models",Qt,P7)},L7=(function(t){function n(e){var r,i,o,s;k(this,n);var a,l,c,u,d=JSON.parse(JSON.stringify(e.directConnection)).openWebUI;return s=K(this,n,[e,F7(),N7,d]),s.insertKeyPlaceholderText="Open WebUI API Key",s.keyHelpUrl="https://docs.openwebui.com/getting-started/api-endpoints/",s.url="http://localhost:3000/api/chat/completions",s.permittedErrorPrefixes=["Error"],B(d)===ze&&(s.completeConfig(d,(l=(a=e.directConnection)==null?void 0:a.openWebUI)==null?void 0:l.function_handler),d[x]&&d[x].length>0&&(s.rawBody[x]=d[x])),(r=s.maxMessages)!==null&&r!==void 0||(s.maxMessages=-1),(i=(c=s.rawBody).model)!==null&&i!==void 0||(c.model="llama3.2"),(o=(u=s.rawBody).stream)!==null&&o!==void 0||(u.stream=!1),s}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:ge.getTextWImagesContent(a),role:ge.getRoleViaUser(a.role)}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:(a=this.messages)!==null&&a!==void 0||(this.messages=o),this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{readable:!0});case 1:return l.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a,l,c;return v().w(function(u){for(;;)switch(u.n){case 0:if(!o[E]){u.n=1;break}throw o[E].message;case 1:if(!o[b]){u.n=2;break}return l=o[b].trim(),u.a(2,this.processStreamingResponse(l,s));case 2:if(!(o.choices&&(a=o.choices[0])!=null&&a.message)){u.n=3;break}return c=o.choices[0].message,u.a(2,c.tool_calls?this.handleTools({tool_calls:c.tool_calls},s):_({},b,c.content||""));case 3:return u.a(2,_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"processStreamingResponse",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d,f,h,p,m,g,w;return v().w(function(C){for(;;)switch(C.p=C.n){case 0:l=o.split(` 172`).filter(function(T){return T.trim()!==""}),c="",u=of(l),C.p=1,u.s();case 2:if((d=u.n()).done){C.n=8;break}if(f=d.value,h=f.trim(),h.startsWith("data: ")&&(h=h.substring(6)),h==="[DONE]"){C.n=7;break}if(C.p=3,p=JSON.parse(h),!(p.choices&&(a=p.choices[0])!=null&&a.delta)){C.n=5;break}if(m=p.choices[0].delta,!m.tool_calls){C.n=4;break}return C.a(2,this.handleTools({tool_calls:m.tool_calls},s));case 4:m.content&&(c+=m.content);case 5:C.n=7;break;case 6:return C.p=6,g=C.v,C.a(3,7);case 7:C.n=2;break;case 8:C.n=10;break;case 9:C.p=9,w=C.v,u.e(w);case 10:return C.p=10,u.f(),C.f(10);case 11:return C.a(2,_({},b,c))}},i,this,[[3,6],[1,9,10,11]])}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"handleTools",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d;return v().w(function(f){for(;;)switch(f.n){case 0:if(!(!o.tool_calls||!s||!this.functionHandler)){f.n=1;break}throw Error(Es);case 1:return a=JSON.parse(JSON.stringify(s)),l=o.tool_calls.map(function(h){return{name:h.function.name,arguments:h.function.arguments}}),f.n=2,this.callToolFunction(this.functionHandler,l);case 2:if(c=f.v,u=c.responses,d=c.processedResponse,!d){f.n=3;break}return f.a(2,d);case 3:if(a.messages.push({tool_calls:o.tool_calls,role:Qi,content:""}),!(!u.find(function(h){var p=h.response;return typeof p!="string"})&&l.length===u.length)){f.n=4;break}return f.a(2,(u.forEach(function(h,p){var m,g=(m=o.tool_calls)==null?void 0:m[p];a?.messages.push({role:"tool",tool_name:g?.function.name,content:h.response})}
172),this.makeAnotherRequest(a,this.messages)));case 4:throw Error(rl);case 5:return f.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()}])})(ge),j7=function(n){return _(_({},Xt,"".concat(Fn).concat(n)),Ze,Ct)},B7=function(n,e,r,i){var o=n;o[E]?o[E].type===Ln?i(en):i(Mr):r(e)},V7=function(){return on("https://api.deepseek.com/models",Qt,B7)},U7=(function(t){function n(e){var r,i,o,s,a;k(this,n);var l,c,u,d=JSON.parse(JSON.stringify(e.directConnection)).deepSeek;return a=K(this,n,[e,V7(),j7,d]),a.insertKeyPlaceholderText=a.genereteAPIKeyName("DeepSeek"),a.keyHelpUrl="https://platform.deepseek.com/api_keys",a.url="https://api.deepseek.com/v1/chat/completions",a.permittedErrorPrefixes=[Qr,Ln],B(d)===ze&&a.completeConfig(d),(r=a.maxMessages)!==null&&r!==void 0||(a.maxMessages=-1),(i=(l=a.rawBody).model)!==null&&i!==void 0||(l.model="deepseek-chat"),(o=(c=a.rawBody).temperature)!==null&&o!==void 0||(c.temperature=1),(s=(u=a.rawBody).max_tokens)!==null&&s!==void 0||(u.max_tokens=4096),a}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:a[b]||"",role:ge.getRoleViaUser(a.role)}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o[E]){a.n=1;break}throw o[E].message;case 1:if(!(o.choices&&o.choices.length>0)){a.n=3;break}if(s=o.choices[0],!(s.delta&&s.delta.content)){a.n=2;break}return a.a(2,_({},b,s.delta.content));case 2:if(!(s.message&&s.message.content)){a.n=3;break}return a.a(2,_({},b,s.message.content));case 3:return a.a(2,_({},b,""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge),H7=function(n){return _(_({},Xt,"".concat(Fn).concat(n)),Ze,Ct)},$7=function(n,e,r,i){var o;((o=n.base_resp)==null?void 0:o.status_code)===1004?i(en):r(e)},z7=function(){return on("https://api.minimax.io/v1/files/delete",fn,$7)},q7=(function(t){function n(e){var r,i,o;k(this,n);var s,a=JSON.parse(JSON.stringify(e.directConnection)).miniMax;return o=K(this,n,[e,z7(),H7,a]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("MiniMax"),o.keyHelpUrl="https://www.minimaxi.com",o.url="https://api.minimax.io/v1/text/chatcompletion_v2",o.permittedErrorPrefixes=[Qr,Ln,"insufficient balance"],B(a)===ze&&o.completeConfig(a),(r=o.maxMessages)!==null&&r!==void 0||(o.maxMessages=-1),(i=(s=o.rawBody).model)!==null&&i!==void 0||(s.model="MiniMax-M1"),o}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:a[b]||"",role:ge.getRoleViaUser(a.role)}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s,a;return v().w(function(l){for(;;)switch(l.n){case 0:if(!o[E]){l.n=1;break}throw o[E].message;case 1:if(!(o.choices&&o.choices.length>0)){l.n=3;break}if(a=o.choices[0],!(a.delta&&a.delta.content)){l.n=2;break}return l.a(2,_({},b,a.delta.content));case 2:if(!(a.message&&a.message.content)){l.n=3;break}return l.a(2,_({},b,a.message.content));case 3:if(!(typeof((s=o.base_resp)==null?void 0:s.status_code)=="number"&&o.base_resp.status_code>0)){l.n=4;break}throw o.base_resp.status_msg;case 4:return l.a(2,_({},b,""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge),W7=function(n){return _(_(_({},Xt,"".concat(Fn).concat(n)),Ze,Ct),"accept",Ct)}
172,G7=function(n,e,r,i){n.detail?i(en):r(e)},K7=function(){return on("https://api.mistral.ai/v1/models",Qt,G7)},J7=(function(t){function n(e){var r,i,o;k(this,n);var s,a,l,c=JSON.parse(JSON.stringify(e.directConnection)).mistral;return o=K(this,n,[e,K7(),W7,c]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("Mistral"),o.keyHelpUrl="https://console.mistral.ai/api-keys/",o.url="https://api.mistral.ai/v1/chat/completions",o.permittedErrorPrefixes=[Cs],B(c)===ze&&o.completeConfig(c,(a=(s=e.directConnection)==null?void 0:s.mistral)==null?void 0:a.function_handler),(r=o.maxMessages)!==null&&r!==void 0||(o.maxMessages=-1),(i=(l=o.rawBody).model)!==null&&i!==void 0||(l.model="mistral-small-latest"),o}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{role:ge.getRoleViaAI(a.role),content:ge.getTextWFilesContent(a,n.getFileContent)}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:(a=this.messages)!==null&&a!==void 0||(this.messages=o),this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return l.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:if(!o.message){l.n=1;break}throw o.message;case 1:if(!o[E]){l.n=2;break}throw o[E].message;case 2:if(!(o.choices&&o.choices.length>0)){l.n=4;break}if(a=o.choices[0],!a.delta){l.n=3;break}return l.a(2,this.extractStreamResult(a,s));case 3:if(!a.message){l.n=4;break}return l.a(2,a.message.tool_calls?this.handleToolsGeneric({tool_calls:a.message.tool_calls},this.functionHandler,this.messages,s):_({},b,a.message.content||""));case 4:return l.a(2,_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractStreamResult",value:(function(){var e=D(v().m(function i(o,s){var a,l,c;return v().w(function(u){for(;;)switch(u.n){case 0:if(a=o.delta,l=o.finish_reason,!(l==="tool_calls"&&a!=null&&a.tool_calls)){u.n=1;break}return c={tool_calls:a.tool_calls},u.a(2,this.handleToolsGeneric(c,this.functionHandler,this.messages,s));case 1:return u.a(2,_({},b,a?.content||""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()}],[{key:"getFileContent",value:function(r){return r.map(function(i){return i.type===it?_(_({},ce,fr),fr,i[Y]||""):_(_({},ce,b),b,"[Unsupported ".concat(Bt," type: ").concat(i.type,"]"))})}}])})(ge),Y7=(function(t){function n(e){var r,i,o;k(this,n);var s,a,l,c,u,d=JSON.parse(JSON.stringify(e.directConnection)),f=d.groq;o=K(this,n,[e,eF(),QP,f]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("Groq"),o.keyHelpUrl="https://console.groq.com/keys",o.url="https://api.groq.com/openai/v1/chat/completions",o.permittedErrorPrefixes=[Cs,"property"];var h=(s=d.groq)==null?void 0:s.chat;return B(h)===ze&&o.completeConfig(h,(c=(l=(a=e.directConnection)==null?void 0:a.groq)==null?void 0:l.chat)==null?void 0:c.function_handler),(r=o.maxMessages)!==null&&r!==void 0||(o.maxMessages=-1),(i=(u=o.rawBody).model)!==null&&i!==void 0||(u.model="llama-3.3-70b-versatile"),o}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:n.getTextWImagesContent(a),role:a.role===xt?Qi:a.role}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:(a=this.messages)!==null&&a!==void 0||(this.messages=o),this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return l.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u;return v().w(function(d){for(;;)switch(d.n){case 0:if(!o[E]){d.n=1;break}throw o[E].message;case 1:return d.a(2,(l=(a=o.choices)==null?void 0:a[0])!=null&&l.delta?this.extractStreamResult(o.choices[0],s):(u=(c=o.choices)==null?void 0:c[0])!=null&&u.message?o.choices[0].message.tool_calls?this.handleToolsGeneric(o.choices[0].message,this.functionHandler,this.messages,s,{message:this.systemMessage}):_({},b,o.choices[0].message.content||""):_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractStreamResult",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:return a.a(2,this.extractStreamResultWToolsGeneric(this,o,this.functionHandler,s))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()}])})(ge),Z7=function(n){return _(_(_({},Xt,"".concat(Fn).concat(n)),Ze,Ct),"accept",Ct)},X7=function(n,e,r,i){typeof n.message=="string"?i(en):r(e)},Q7=function(){return on("https://api.cohere.ai/v1/models",Qt,X7)},eq=(function(t){function n(e){var r,i,o;k(this,n);var s,a=JSON.parse(JSON.stringify(e.directConnection)).cohere;if(o=K(this,n,[e,Q7(),Z7,a]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("Cohere"),o.keyHelpUrl="https://dashboard.cohere.ai/api-keys",o.permittedErrorPrefixes=["invalid"],o.url="https://api.cohere.com/v2/chat",B(a)===ze){var l=Wt.processCohere(a);o.canSendMessage=function(){return l},o.cleanConfig(a),Object.assign(o.rawBody,a)}return(r=o.maxMessages)!==null&&r!==void 0||(o.maxMessages=-1),(i=(s=o.rawBody).model)!==null&&i!==void 0||(s.model="command-a-03-2025"),o}return J(n,t),M(n,[{key:"cleanConfig",value:function(r){delete r.key}},{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=i.filter(function(a){return a[b]});return o.messages=s.map(function(a){return{role:ge.getRoleViaAI(a.role),content:a[b]}}),o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{readable:!0});case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s,a,l,c;return v().w(function(u){for(;;)switch(u.n){case 0:if(typeof o.message!="string"){u.n=1;break}throw o.message;case 1:if(!(this.stream&&o[b])){u.n=2;break}return c=n.parseBundledEvents(o[b]),u.a(2,{text:n.aggregateBundledEventsText(c)});case 2:if(!("message"in o&&(l=(a=(s=o.message)==null?void 0:s.content)==null?void 0:a[0])!=null&&l[b])){u.n=3;break}return u.a(2,_({},b,o.message.content[0][b]));case 3:throw new Error("Invalid response format from Cohere API");case 4:return u.a(2)}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()}],[{key:"parseBundledEvents",value:function(r){var i=r.trim().split(` 173`),o=[],s=of(i),a;try{for(s.s();!(a=s.n()).done;){var l=a.value;if(l.trim())try{var c=JSON.parse(l);o.push(c)}catch(u){console[E]("Failed to parse line:",l,u)}}}catch(u){s.e(u)}finally{s.f()}return o}},{key:"aggregateBundledEventsText",value:function(r){return r.filter(function(i){var o,s,a;return i.type==="content-delta"&&((a=(s=(o=i.delta)==null?void 0:o.message)==null?void 0:s.content)==null?void 0:a[b])}).map(function(i){var o,s,a;return(a=(s=(o=i.delta)==null?void 0:o.message)==null?void 0:s.content)==null?void 0:a[b]}).join("")}}])})(ge),tq=function(){return _({},Ze,Ct)},nq=function(n,e,r,i){var o,s=n;s[E]?s[E].code===403||(o=s[E].message)!=null&&o.includes("API key")?i(en):i(Mr):r(e)},rq=function(){var n="https://generativelanguage.googleapis.com/v1beta/models?key=";return on(n,Qt,nq,function(e){return"".concat(n).concat(e)})},iq=(function(t){function n(e){var r,i;k(this,n);var o,s,a=JSON.parse(JSON.stringify(e.directConnection)).gemini;if(i=K(this,n,[e,rq(),tq,a]),i.insertKeyPlaceholderText=i.genereteAPIKeyName("Gemini"),i.keyHelpUrl="https://aistudio.google.com/app/apikey",i.urlPrefix="https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent",i.url="",i.permittedErrorPrefixes=["API_KEY_INVALID"],B(a)===ze){var l=a;l.model&&(i.urlPrefix="https://generativelanguage.googleapis.com/v1beta/models/".concat(l.model,":generateContent")),i.cleanConfig(l),i.c
173ompleteConfig(l,(s=(o=e.directConnection)==null?void 0:o.gemini)==null?void 0:s.function_handler)}return(r=i.maxMessages)!==null&&r!==void 0||(i.maxMessages=-1),i}return J(n,t),M(n,[{key:"cleanConfig",value:function(r){delete r.model}},{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return n.getContent(a)});return o.contents=s,this.systemMessage&&(o.systemInstruction={parts:[_({},b,this.systemMessage)]}),o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a,l,c;return v().w(function(u){for(;;)switch(u.n){case 0:if(this.connectSettings){u.n=1;break}throw new Error(sr);case 1:(a=this.messages)!==null&&a!==void 0||(this.messages=o),l=this.preprocessBody(this.rawBody,s),c=this.stream,c&&(B(c)!==ze||!c.simulation)||l.stream?(this.url="".concat(this.urlPrefix.replace(":generateContent",":streamGenerateContent"),"?alt=sse&key=").concat(this.key),rn.request(this,l,o)):(this.url="".concat(this.urlPrefix,"?key=").concat(this.key),Sn.request(this,l,o));case 2:return u.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d,f,h,p;return v().w(function(m){for(;;)switch(m.n){case 0:if(!o[E]){m.n=1;break}throw o[E].message||"Gemini API Error";case 1:if(!((c=(l=(a=o.candidates)==null?void 0:a[0])==null?void 0:l.content)!=null&&c.parts)){m.n=3;break}if(d=o.candidates[0].content.parts,f=d.find(function(g){return g.functionCall}),!(f!=null&&f.functionCall)){m.n=2;break}return m.a(2,this.handleTools([f.functionCall],s));case 2:return h=d.find(function(g){return g[b]}),p=d.find(function(g){var w;return((w=g.inlineData)==null?void 0:w.mimeType)==="image/png"}),m.a(2,_(_({},b,h?.[b]||""),x,(u=p?.inlineData)!=null&&u.data?[_({},Y,"data:image/png;base64,".concat(p.inlineData.data))]:[]));case 3:return m.a(2,_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"handleTools",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d,f,h;return v().w(function(p){for(;;)switch(p.n){case 0:if(!(!o||!s||!this.functionHandler)){p.n=1;break}throw Error(Es);case 1:return a=JSON.parse(JSON.stringify(s)),l=o.map(function(m){return{name:m.name,arguments:JSON.stringify(m.args)}}),p.n=2,this.callToolFunction(this.functionHandler,l);case 2:if(c=p.v,u=c.responses,d=c.processedResponse,!d){p.n=3;break}return p.a(2,d);case 3:if(f={parts:o.map(function(m){return{functionCall:{name:m.name,args:m.args}}}),role:"model"},a.contents.push(f),!(!u.find(function(m){var g=m.response;return typeof g!="string"})&&l.length===u.length)){p.n=4;break}return h={parts:u.map(function(m,g){return{functionResponse:{name:o[g].name,response:{result:m.response}}}}),role:et},p.a(2,(a.contents.push(h),this.makeAnotherRequest(a,this.messages)));case 4:throw Error(rl);case 5:return p.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()}],[{key:"getContent",value:function(r){var i=[];return r[b]&&r[b].trim().length>0&&i.push(_({},b,r[b])),r[x]&&r[x].length>0&&r[x].forEach(function(o){if(o[Y]&&o[Y].includes("data:")){var s=o[Y].split(","),a=el(s,2),l=a[0],c=a[1];i.push({inlineData:{mimeType:l.replace("data:","").replace(";base64",""),data:c}})}}),{parts:i,role:r.role===et?et:"model"}}
173}])})(ge),oq=function(n){return _(_(_({"x-api-key":n},Ze,Ct),"anthropic-version","2023-06-01"),"anthropic-dangerous-direct-browser-access","true")},sq=function(n,e,r,i){var o=n;o[E]?o[E].type===Ln?i(en):i(Mr):r(e)},aq=function(){return on("https://api.anthropic.com/v1/models",Qt,sq)},lq=(function(t){function n(e){var r,i,o,s;k(this,n);var a,l,c,u,d=JSON.parse(JSON.stringify(e.directConnection)).claude;return s=K(this,n,[e,aq(),oq,d]),s.insertKeyPlaceholderText=s.genereteAPIKeyName("Claude"),s.keyHelpUrl="https://console.anthropic.com/settings/keys",s.url="https://api.anthropic.com/v1/messages",s.permittedErrorPrefixes=[Ln,Qr],s._streamToolCalls=_(_(_(_({},ce,"tool_use"),"id",""),"name",""),"input",""),B(d)===ze&&s.completeConfig(d,(l=(a=e.directConnection)==null?void 0:a.claude)==null?void 0:l.function_handler),(r=s.maxMessages)!==null&&r!==void 0||(s.maxMessages=-1),(i=(c=s.rawBody).model)!==null&&i!==void 0||(c.model="claude-sonnet-4-5-20250929"),(o=(u=s.rawBody).max_tokens)!==null&&o!==void 0||(u.max_tokens=4096),s}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:n.getTextWFilesContent(a,n.getFileContent),role:ge.getRoleViaUser(a.role)}});return o.messages=s,this.systemMessage&&(o.system=this.systemMessage),o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:(a=this.messages)!==null&&a!==void 0||(this.messages=o),this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return l.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d;return v().w(function(f){for(;;)switch(f.n){case 0:if(!o[E]){f.n=1;break}throw o[E].message;case 1:if(!(o.content&&o.content.length>0)){f.n=3;break}if(u=o.content.find(function(h){return h.type==="tool_use"}),!u){f.n=2;break}return f.a(2,this.handleTools([u],s));case 2:if(d=o.content.find(function(h){return h.type===b}),!d){f.n=3;break}return f.a(2,_({},b,d[b]));case 3:if(!(o.type==="content_block_delta"&&o.delta&&o.delta.type==="text_delta")){f.n=4;break}return f.a(2,_({},b,o.delta[b]||""));case 4:if(!(o.type==="content_block_start"&&((a=o.content_block)==null?void 0:a.type)==="tool_use")){f.n=5;break}this._streamToolCalls=o.content_block,this._streamToolCalls.input="",f.n=7;break;case 5:if(!(o.type==="content_block_delta"&&((l=o.delta)==null?void 0:l.type)==="input_json_delta")){f.n=6;break}this._streamToolCalls.input+=o.delta.partial_json||"",f.n=7;break;case 6:if(!(o.type==="message_delta"&&((c=o.delta)==null?void 0:c.stop_reason)==="tool_use")){f.n=7;break}return f.a(2,(this._streamToolCalls.input=JSON.parse(this._streamToolCalls.input),this.handleTools([this._streamToolCalls],s)));case 7:return f.a(2,_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"handleTools",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d,f,h;return v().w(function(p){for(;;)switch(p.n){case 0:if(!(!o||!s||!this.functionHandler)){p.n=1;break}throw Error(Es);case 1:return a=JSON.parse(JSON.stringify(s)),l=o.map(function(m){return{name:m.name,arguments:JSON.stringify(m.input)}}),p.n=2,this.callToolFunction(this.functionHandler,l);case 2:if(c=p.v,u=c.responses,d=c.processedResponse,!d){p.n=3;break}return p.a(2,d);case 3:if(f=o.map(function(m){return _(_(_(_({},ce,"tool_use"),"id",m.id),"name",m.name),"input",m.input)}),a.messages.push({role:"assistant",content:f}),!(!u.find(function(m){var g=m.response;return typeof g!="string"})&&l.length===u.length)){p.n=4;break}return h=u.map(function(m,g){return _(_(_({},ce,"tool_result"),"tool_use_id",o[g].id),"content",m.response)}),p.a(2,(a.messages.push({role:et,content:h}),this.makeAnotherRequest(a,this.messages)));case 4:throw Error(rl);case 5:return p.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()}],[{key:"getFileContent",value:function(r){return r.map(function(i){var o,s,a;if(i.type===it){var l=(o=i[Y])==null?void 0:o.split(",")[1],c=((a=(s=i[Y])==null?void 0:s.match(/data:([^;
173]+)/))==null?void 0:a[1])||"image/jpeg";return _(_({},ce,it),"source",_(_(_({},ce,"base64"),"media_type",c),"data",l||""))}return _(_({},ce,b),b,"[Unsupported ".concat(Bt," type: ").concat(i.type,"]"))})}}])})(ge),cq=function(){return{}},uq=function(){},dq=function(){return on("",Qt,uq)},hq=(function(t){function n(e){var r,i,o,s;k(this,n);var a,l,c,u,d=JSON.parse(JSON.stringify(e.directConnection));s=K(this,n,[e,dq(),cq,{key:"placeholder"}]),s.insertKeyPlaceholderText="",s.keyHelpUrl="",s.validateKeyProperty=!1,s.url="http://localhost:11434/api/chat",s.permittedErrorPrefixes=["Error"];var f=d.ollama;return B(f)===ze&&s.completeConfig(f,(l=(a=e.directConnection)==null?void 0:a.ollama)==null?void 0:l.function_handler),(r=s.maxMessages)!==null&&r!==void 0||(s.maxMessages=-1),(i=(c=s.rawBody).model)!==null&&i!==void 0||(c.model="llama3.2"),(o=(u=s.rawBody).stream)!==null&&o!==void 0||(u.stream=!1),s}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){var l={content:a[b]||"",role:ge.getRoleViaUser(a.role)};if(a[x]&&a[x].length>0){var c=n.getImageData(a[x]);c.length>0&&(l[wt]=c)}return l});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:(a=this.messages)!==null&&a!==void 0||(this.messages=o),this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{readable:!0});case 1:return l.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a,l,c;return v().w(function(u){for(;;)switch(u.n){case 0:if(!o[E]){u.n=1;break}throw o[E].message;case 1:if(!o[b]){u.n=2;break}return c=JSON.parse(o[b]),u.a(2,(a=c.message)!=null&&a.tool_calls?this.handleTools({tool_calls:c.message.tool_calls},s):_({},b,((l=c.message)==null?void 0:l.content)||""));case 2:return u.a(2,o.message?o.message.tool_calls?this.handleTools({tool_calls:o.message.tool_calls},s):_({},b,o.message.content||""):_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"handleTools",value:(function(){var e=D(v().m(function i(o,s){var a,l,c,u,d;return v().w(function(f){for(;;)switch(f.n){case 0:if(!(!o.tool_calls||!s||!this.functionHandler)){f.n=1;break}throw Error(Es);case 1:return a=JSON.parse(JSON.stringify(s)),l=o.tool_calls.map(function(h){return{name:h.function.name,arguments:JSON.stringify(h.function.arguments)}}),f.n=2,this.callToolFunction(this.functionHandler,l);case 2:if(c=f.v,u=c.responses,d=c.processedResponse,!d){f.n=3;break}return f.a(2,d);case 3:if(a.messages.push({tool_calls:o.tool_calls,role:Qi,content:""}),!(!u.find(function(h){var p=h.response;return typeof p!="string"})&&l.length===u.length)){f.n=4;break}return f.a(2,(u.forEach(function(h,p){var m,g=(m=o.tool_calls)==null?void 0:m[p];a?.messages.push({role:"tool",tool_name:g?.function.name,content:h.response})}),this.makeAnotherRequest(a,this.messages)));case 4:throw Error(rl);case 5:return f.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()}],[{key:"getImageData",value:function(r){return r.filter(function(i){return i.type===it}).map(function(i){var o;return((o=i[Y])==null?void 0:o.split(",")[1])||""}).filter(function(i){return i.length>0})}}])})(ge),rF=function(n){return _({Authorization:"".concat(Fn).concat(n)},Ze,Ct)},fq=function(n,e,r,i){var o=n;o[E]?o[E].type===Ln||o[E].type===Qr?i(en):i(Mr):r(e)},iF=function(){return on("https://api.x.ai/v1/models",Qt,fq)},oF=(function(t){function n(e){var r,i;k(this,n);var o,s,a=e.directConnection,l=a?.x;i=K(this,n,[e,iF(),rF,l]),i.insertKeyPlaceholderText=i.genereteAPIKeyName("X"),i.keyHelpUrl="https://console.x.ai/team/default/api-keys",i.url=n.IMAGE_GENERATION_URL,i.permittedErrorPrefixes=[Qr,Ln];var c=(o=a?.x)==null?void 0:o[wt];return B(c)===ze&&Object.assign(i.rawBody,c),(r=(s=i.rawBody).model)!==null&&r!==void 0||(s.model="grok-2-image"),i}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=i[i.length-1][b],s=JSON.parse(JSON.stringify(r));return o&&o!==""&&(s.prompt=o),s}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this));case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s;return v().w(function(a){for(;;)switch(a.n){case 0:if(!o[E]){a.n=1;break}throw o[E].message;case 1:return s=o.data.map(function(l){return l.url?_(_({},Y,l.url),ce,it):_(_({},Y,"".concat(eu).concat(l.b64_json)),ce,it)}),a.a(2,_({},x,s))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge);oF.IMAGE_GENERATION_URL="https://api.x.ai/v1/images/generations";var pq=oF,mq=function(n){return _(_({},Xt,"".concat(Fn).concat(n)),Ze,Ct)},gq=function(n,e,r,i){var o=n;o[E]?o[E].type===Qr?i(en):i(Mr):r(e)},vq=function(){return on("https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models",Qt,gq)},yq=(function(t){function n(e){var r,i,o;k(this,n);var s,a,l,c=JSON.parse(JSON.stringify(e.directConnection)).qwen;return o=K(this,n,[e,vq(),mq,c]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("Qwen"),o.keyHelpUrl="https://www.alibabacloud.com/help/en/model-studio/get-api-key",o.url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1/c
173hat/completions",o.permittedErrorPrefixes=["No static","The model",df],B(c)===ze&&o.completeConfig(c,(a=(s=e.directConnection)==null?void 0:s.qwen)==null?void 0:a.function_handler),(r=o.maxMessages)!==null&&r!==void 0||(o.maxMessages=-1),(i=(l=o.rawBody).model)!==null&&i!==void 0||(l.model="qwen-plus"),o}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:n.getTextWImagesContent(a),role:ge.getRoleViaUser(a.role)}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:(a=this.messages)!==null&&a!==void 0||(this.messages=o),this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return l.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:if(!o[E]){l.n=1;break}throw o[E].message;case 1:if(!(o.choices&&o.choices.length>0)){l.n=3;break}if(a=o.choices[0],!a.delta){l.n=2;break}return l.a(2,this.extractStreamResult(a,s));case 2:if(!a.message){l.n=3;break}return l.a(2,a.message.tool_calls?this.handleToolsGeneric({tool_calls:a.message.tool_calls},this.functionHandler,this.messages,s):_({},b,a.message.content||""));case 3:return l.a(2,_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractStreamResult",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:return a.a(2,this.extractStreamResultWToolsGeneric(this,o,this.functionHandler,s))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()}])})(ge),_q=function(n){return _(_({},Xt,"".concat(Fn).concat(n)),Ze,Ct)},bq=function(n,e,r,i){var o=n;o[E]?o[E].type===Ln?i(en):i(Mr):r(e)},wq=function(){return on("https://api.moonshot.ai/v1/models",Qt,bq)},Eq=(function(t){function n(e){var r,i,o;k(this,n);var s,a,l,c=JSON.parse(JSON.stringify(e.directConnection)).kimi;return o=K(this,n,[e,wq(),_q,c]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("Kimi"),o.keyHelpUrl="https://platform.moonshot.ai/console/api-keys",o.url="https://api.moonshot.ai/v1/chat/completions",o.permittedErrorPrefixes=[Cs,"Not found"],B(c)===ze&&o.completeConfig(c,(a=(s=e.directConnection)==null?void 0:s.kimi)==null?void 0:a.function_handler),(r=o.maxMessages)!==null&&r!==void 0||(o.maxMessages=-1),(i=(l=o.rawBody).model)!==null&&i!==void 0||(l.model="moonshot-v1-8k"),o}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:n.getTextWImagesContent(a),role:ge.getRoleViaUser(a.role)}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:(a=this.messages)!==null&&a!==void 0||(this.messages=o),this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return l.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o,s){var a;return v().w(function(l){for(;;)switch(l.n){case 0:if(!o[E]){l.n=1;break}throw o[E].message;case 1:if(!(o.choices&&o.choices.length>0)){l.n=3;break}if(a=o.choices[0],!a.delta){l.n=2;break}return l.a(2,this.extractStreamResult(a,s));case 2:if(!a.message){l.n=3;break}return l.a(2,a.message.tool_calls?this.handleToolsGeneric({tool_calls:a.message.tool_calls},this.functionHandler,this.messages,s):_({},b,a.message.content||""));case 3:return l.a(2,_({},b,""))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractStreamResult",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:return a.a(2,this.extractStreamResultWToolsGeneric(this,o,this.functionHandler,s))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()}])})(ge),Cq=(function(t){function n(e){var r,i,o;k(this,n);var s,a,l=JSON.parse(JSON.stringify(e.directConnection)),c=l.x;o=K(this,n,[e,iF(),rF,c]),o.insertKeyPlaceholderText=o.genereteAPIKeyName("X"),o.keyHelpUrl="https://console.x.ai/team/default/api-keys",o.url="https://api.x.ai/v1/chat/completions",o.permittedErrorPrefixes=[Qr,Ln];var u=(s=l.x)==null?void 0:s.chat;return B(u)===ze&&o.completeConfig(u),(r=o.maxMessages)!==null&&r!==void 0||(o.maxMessages=-1),(i=(a=o.rawBody).model)!==null&&i!==void 0||(a.model="grok-3-latest"),o}return J(n,t),M(n,[{key:"preprocessBody",value:function(r,i){var o=JSON.parse(JSON.stringify(r)),s=this.processMessages(i).map(function(a){return{content:a[b]||"",role:ge.getRoleViaUser(a.role)}});return this.addSystemMessage(s),o.messages=s,o}},{key:"callServiceAPI",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:this.callDirectServiceServiceAPI(o,s,this.preprocessBody.bind(this),{});case 1:return a.a(2)}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"extractResultData",value:(function(){var e=D(v().m(function i(o){var s,a,l,c,u;return v().w(function(d){for(;;)switch(d.n){case 0:if(!o[E]){d.n=1;break}throw o[E].message;case 1:if(o.object!=="chat.completion.chunk"){d.n=2;break}return u=(s=o.choices)==null?void 0:s[0],d.a(2,(a=u?.delta)!=null&&a.content?_({},b,u.delta.content):_({},b,""));case 2:return d.a(2,o.object==="chat.completion"&&(c=(l=o.choices)==null?void 0:l[0])!=null&&c.message?_({},b,o.choices[0].message.content||""):_({},b,""))}},i)}));function r(i){return e.apply(this,arguments)}return r})()}])})(ge),Sq=(function(){function t(){k(this,t)}return M(t,null,[{key:"create",value:function(e){var r=e.directConnection,i=e.connect,o=e.demo,s=e.webModel;if(s)return new KS(e);if(r){if(r.openAI)return r.openAI[wt]?new D7(e):r.openAI.speechToText?new Zz(e):r.openAI.textToSpeech?new Yz(e):r.openAI.assistant?new qz(e):r.openAI.realtime?new Jz(e):r.openAI.completions?new p7(e):new nF(e);if(r.assemblyAI)return new f7(e);if(r.cohere)return new eq(e);
173if(r.huggingFace)return r.huggingFace.textGeneration?new Oz(e):r.huggingFace.summarization?new Pz(e):r.huggingFace.translation?new jz(e):r.huggingFace.fillMask?new Vz(e):r.huggingFace.questionAnswer?new Nz(e):r.huggingFace.audioSpeechRecognition?new Rz(e):r.huggingFace.audioClassification?new Tz(e):r.huggingFace.imageClassification?new kz(e):new Fz(e);if(r.azure){if(r.azure.openAI){if(r.azure.openAI.chat)return new E7(e);if(r.azure.openAI.assistant)return new Wz(e)}if(r.azure.speechToText)return new g7(e);if(r.azure.textToSpeech)return new m7(e);if(r.azure.summarization)return new l7(e);if(r.azure.translation)return new v7(e)}if(r.stabilityAI)return r.stabilityAI.imageToImage?new Lz(e):r.stabilityAI.imageToImageUpscale?new Az(e):r.stabilityAI.imageToImageMasking?new xz(e):new Bz(e);if(r.mistral)return new J7(e);if(r.gemini)return new iq(e);if(r.claude)return new lq(e);if(r.deepSeek)return new U7(e);if(r.miniMax)return new q7(e);if(r.openRouter)return new M7(e);if(r.kimi)return new Eq(e);if(r.x)return r.x[wt]?new pq(e):new Cq(e);if(r.qwen)return new yq(e);if(r.together)return r.together[wt]?new w7(e):r.together.textToSpeech?new zz(e):new S7(e);if(r.bigModel)return r.bigModel[wt]?new y7(e):r.bigModel.textToSpeech?new Hz(e):new C7(e);if(r.groq)return r.groq.textToSpeech?new b7(e):new Y7(e);if(r.perplexity)return new O7(e);if(r.ollama)return new hq(e);if(r.openWebUI)return new L7(e)}return i&&Object.keys(i).length>0&&!o?new Zv(e):new Zv(e,void 0,o||!0)}}])})(),sF=M(function t(){k(this,t)});sF.attibutes={string:function(n){return n},number:function(n){return parseFloat(n)},boolean:function(n){return n==="true"},object:function(n){return JSON.parse(n)},array:function(n){return JSON.parse(n)},function:function(n){return new Function("return ".concat(n))()}};var Dq=sF;function Me(t){return function(n,e){Object.defineProperty(n,e,{});var r=n.constructor,i=e.toLocaleLowerCase();r._attributes_[i]=Dq.attibutes[t],r._attributeToProperty_[i]=e}}var Iq="deep-chat-downwards-mode",Tq="deep-chat-upwards-mode",Mh="submit-button",Fv="loading-button",Ah="disabled-button",CN="text-input-container-start-adjustment",SN="text-input-container-end-adjustment",DN="text-input-container-start-small-adjustment",IN="text-input-container-end-small-adjustment",kq=(function(){function t(n){k(this,t),this._isDisplayed=!1,this._elementRef=this.createIntroPanelWithChild(n),this._isDisplayed=!0}return M(t,[{key:"createIntroPanelWithChild",value:function(e){var r=t.createIntroPanel();return e[N].display==="none"&&(e[N].display="block"),r.appendChild(e),r}},{key:"hide",value:function(){this._isDisplayed&&(this._elementRef[N].display="none",this._isDisplayed=!1)}},{key:"display",value:function(){this._isDisplayed||(this._elementRef[N].display="",this._isDisplayed=!0)}}],[{key:"createIntroPanel",value:function(){var e=U();return e[S].add("intro-panel"),Object.assign(e[N]),e}}])})(),Mq=`<?xml version="1.0" encoding="iso-8859-1"?> 174<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 175 viewBox="50 30 420 450" xml:space="preserve"> 176<g filter="brightness(0) saturate(100%) invert(16%) sepia(0%) saturate(1942%) hue-rotate(215deg) brightness(99%) contrast(93%)"> 177 <g> 178 <path d="M447.933,103.629c-0.034-3.076-1.224-6.09-3.485-8.352L352.683,3.511c-0.004-0.004-0.007-0.005-0.011-0.008 179 C350.505,1.338,347.511,0,344.206,0H89.278C75.361,0,64.04,11.32,64.04,25.237v461.525c0,13.916,11.32,25.237,25.237,25.237 180 h333.444c13.916,0,25.237-11.32,25.237-25.237V103.753C447.96,103.709,447.937,103.672,447.933,103.629z M356.194,40.931 181 l50.834,50.834h-49.572c-0.695,0-1.262-0.567-1.262-1.262V40.931z M423.983,486.763c0,0.695-0.566,1.261-1.261,1.261H89.278 182 c-0.695,0-1.261-0.566-1.261-1.261V25.237c0-0.695,0.566-1.261,1.261-1.261h242.94v66.527c0,13.916,11.322,25.239,25.239,25.239 183 h66.527V486.763z"/> 184 </g> 185</g> 186<g> 187 <g> 188 <path d="M362.088,164.014H149.912c-6.62,0-11.988,5.367-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175 189 c6.62,0,11.988-5.368,11.988-11.988C374.076,169.381,368.707,164.014,362.088,164.014z"/> 190 </g> 191</g> 192<g> 193 <g> 194 <path d="M362.088,236.353H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175 195 c6.62,0,11.988-5.368,11.988-11.988C374.076,241.721,368.707,236.353,362.088,236.353z"/> 196 </g> 197</g> 198<g> 199 <g> 200 <path d="M362.088,308.691H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988h212.175 201 c6.62,0,11.988-5.367,11.988-11.988C374.076,314.06,368.707,308.691,362.088,308.691z"/> 202 </g> 203</g> 204<g> 205 <g> 206 <path d="M256,381.031H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988H256 207 c6.62,0,11.988-5.367,11.988-11.988C267.988,386.398,262.62,381.031,256,381.031z"/> 208 </g> 209</g> 210</svg>`,Kv=(function(){function t(){k(this,t)}return M(t,null,[{key:"createImage",value:function(e,r){var i=new Image;
210return i[Y]=e[Y],r&&Zr.scrollDownOnImageLoad(i[Y],r),Zr.processContent(it,i,i[Y],e.name)}},{key:"createImageMessage",value:function(e,r,i,o){var s=e.createNewMessageElement("",i),a=o?e.scrollToFirstElement.bind(e,i,o):void 0,l=t.createImage(r,a);return s.bubbleElement.appendChild(l),s.bubbleElement[S].add(t.IMAGE_BUBBLE_CLASS),{type:it,elements:s}}},{key:"createAudioElement",value:function(e,r){var i=U($e);return i[Y]=e[Y],i[S].add("audio-player"),i.controls=!0,Xr.IS_SAFARI&&(i[S].add("audio-player-safari"),i[S].add(r===et?"audio-player-safari-end":"audio-player-safari-start")),i}},{key:"autoPlayAudio",value:function(e){e.addEventListener("loadeddata",function(){e.play().catch(function(r){console.warn("Auto-play failed:",r)})})}},{key:"createNewAudioMessage",value:function(e,r,i,o){var s=t.createAudioElement(r,i),a=e.createMessageElementsOnOrientation("",i,o);return a.bubbleElement.appendChild(s),a.bubbleElement[S].add(t.AUDIO_BUBBLE_CLASS),{type:$e,elements:a,audioElement:s}}},{key:"createAnyFile",value:function(e){var r=U();r[S].add("any-file-message-contents");var i=U();i[S].add("any-file-message-icon-container");var o=ko.createSVGElement(Mq);o[S].add("any-file-message-icon"),i.appendChild(o);var s=U();return s[S].add("any-file-message-text"),s.textContent=e.name||Bt,r.appendChild(i),r.appendChild(s),Zr.processContent(nl,r,e[Y],s.textContent)}},{key:"createNewAnyFileMessage",value:function(e,r,i,o){var s=e.createMessageElementsOnOrientation("",i,o),a=t.createAnyFile(r);return s.bubbleElement[S].add(t.ANY_FILE_BUBBLE_CLASS),s.bubbleElement.appendChild(a),{type:Bt,elements:s}}},{key:"createMessages",value:function(e,r,i,o){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return r.map(function(a,l){var c;if(a.ref&&(a=Zr.removeFileRef(a)),Zr.isAudioFile(a)){var u=t.createNewAudioMessage(e,a,i,s),d=(c=e.textToSpeech)==null?void 0:c.audio;return d&&(d.autoPlay&&t.autoPlayAudio(u.audioElement),typeof d.displayAudio=="boolean"&&!d.displayAudio)?void 0:u}return Zr.isImageFile(a)?t.createImageMessage(e,a,i,!s&&o&&l===0):t.createNewAnyFileMessage(e,a,i,s)}).filter(function(a){return a!==void 0})}},{key:"addMessages",value:function(e,r,i,o,s){t.createMessages(e,r,i,o,s).filter(function(a){return a!==void 0}).forEach(function(a){var l=a.type,c=a.elements;Zr.addMessage(e,c,l,i,s)})}}])})();Kv.IMAGE_BUBBLE_CLASS="image-message",Kv.AUDIO_BUBBLE_CLASS="audio-message",Kv.ANY_FILE_BUBBLE_CLASS="any-file-message";var aF=Kv,Aq=(function(){function t(){k(this,t)}return M(t,null,[{key:"removeElements",value:function(e,r){if(r){var i=e.findIndex(function(o){return o===r});e.splice(i,1),r?.outerContainer.remove()}}},{key:"removeFilesMessages",value:function(e,r){var i;(i=r[1][x])==null||i.forEach(function(o){t.removeElements(e.messageElementRefs,o)}),delete r[0][x],delete r[1][x]}},{key:"removeTextHTMLMessage",value:function(e,r,i){var o=r[1][i];t.removeElements(e.messageElementRefs,o),delete r[0][i],delete r[1][i]}},{key:"updateHTMLMessage",value:function(e,r,i){var o,s,a;if(r[1][ke])bs.overwriteElements(e,i,r[1][ke]);else{var l=bs.create(e,i,r[0].role),c=((s=r[1][x])==null?void 0:s[((o=r[1][x])==null?void 0:o.length)-1])||r[1][b],u=c.outerContainer.nextSibling;(a=u?.parentElement)==null||a.insertBefore(l.outerContainer,u),e.messageElementRefs.splice(e.messageElementRefs.length-1,1);var d=e.messageElementRefs.findIndex(function(f){return f===c});e.messageElementRefs.splice(d+1,0,l),r[1][ke]=l}r[0][ke]=i}},{key:"updateFileMessages",value:function(e,r,i){var o,s,a=r[0].role,l=aF.createMessages(e,i,a,!1),c=r[1][ke],u=((s=r[1][x])==null?void 0:s[((o=r[1][x])==null?void 0:o.length)-1])||r[1][b],d=c||u,f=e.messageElementRefs.findIndex(function(p){return p===d});u&&(f+=1);var h=c?.outerContainer||u?.outerContainer.nextSibling;l.forEach(function(p,m){var g=p.type,w=p.elements,C;Zr.setElementProps(e,w,g,a),(C=h.parentElement)==null||C.insertBefore(w.outerContainer,h),e.messageElementRefs.splice(e.messageElementRefs.length-1,1),e.messageElementRefs.splice(f+m,0,w)}),t.removeFilesMessages(e,r),r[1][x]=l.map(function(p){var m=p.elements;return m}),r[0][x]=i}},{key:"updateTextMessage",value:function(e,r,i){var o,s;if(r[1][b])e.renderText(r[1][b].bubbleElement,i,r[0].role);else{var a=e.createElements(i,r[0].role),l=((o=r[1][x])==null?void 0:o[0])||r[1][ke];(s=l.outerContainer.parentElement)==null||s.insertBefore(a.outerContainer,l.outerContainer);var c=e.messageElementRefs.findIndex(function(u){return u===l});e.messageElementRefs.splice(c,0,a),r[1][b]=a}r[0][b]=i}},{key:"isElementActive",value:function(e){var r,i;return RS.isActiveElement((r=e[b])==null?void 0:r.bubbleElement[S])||RS.isActiveElement((i=e[ke])==null?void 0:i.bubbleElement[S])}},{key:"update",value:function(e,r,i){var o=e.messageToElements[i];if(o){if(t.isElementActive(o[1]))return console[E]("Cannot update a message that is being streamed");r[b]&&t.updateTextMessage(e,o,r[b]),r[x]?t.updateFileMessages(e,o,r[x]):t.removeFilesMessages(e,o),r[ke]&&t.updateHTMLMessage(e,o,r[ke]),!r[b]&&o[1][b]&&t.removeTextHTMLMessage(e,o,b),!r[ke]&&o[1][ke]&&t.removeTextHTMLMessage(e,o,ke);var s=e.messageElementRefs,a=e.avatar,l=e.name;Lt.classifyRoleMessages(s),Lt.resetAllRoleElements(s,a,l)}else console[E]("Message index not found. Please use the `getMessages` method to find the correct index")}}])})(),xq=(function(){function t(){k(this,t)}return M(t,null,[{key:"getText",value:function(e,r){var i,o;if(!e.directConnection&&!e.connect&&!e.webModel&&!e.demo)return"Connect to any API using the [connect](".concat(at,"connect#connect-1) property or a popular service via [directConnection](").concat(at,`directConnection/#directConnection). 211 Host AI entirely on your browser via a [webModel](`).concat(at,`webModel). 212 To get started checkout the [Start](https://deepchat.dev/start) page and live code [examples](https://deepchat.dev/examples/frameworks). 213 To remove this message set the [demo](`).concat(at,"modes#demo) property to true.");if(e.directConnection){if(!r.isDirectConnection())return`Please define a valid service inside 214 the [directConnection](`.concat(at,"directConnection/#directConnection) object.");var s=(i=e.directConnection.openAI)==null?void 0:i.chat;if(B(s)=="object"&&(o=s.tools)!=null&&o.find(function(a){return a.type==="function"})&&!s.function_handler)return"Please define the `function_handler` property inside the openAI [chat](".concat(at,"directConnection/openAI#Chat) object.")}else if(e.connect&&!e.connect.url&&!e.connect.handler)return"Please define a `url` or a `handler` property inside the [connect](".concat(at,"connect#connect-1) object.");return null}}])}
214)(),RS=(function(t){function n(e,r,i){var o;k(this,n);var s,a;o=K(this,n,[e]);var l=r.permittedErrorPrefixes,c=r.demo;o._errorMessageOverrides=(s=e.errorMessages)==null?void 0:s.overrides,o._onClearMessages=ol.onClearMessages.bind(o,e),o._onError=ol.onError.bind(o,e),o._isLoadingMessageAllowed=n.getDefaultDisplayLoadingMessage(e,r),B(e.displayLoadingBubble)=="object"&&e.displayLoadingBubble.toggle&&(e.displayLoadingBubble.toggle=o.setLoadingToggle.bind(o)),o._permittedErrorPrefixes=l,o.addSetupMessageIfNeeded(e,r)||o.populateIntroPanel(i),c&&o.prepareDemo(Wt.processDemo(c),e.loadHistory),o.addIntroductoryMessages(e,r);var u=new GS(e,o,r);return o._displayServiceErrorMessages=(a=e.errorMessages)==null?void 0:a.displayServiceErrorMessages,e.getMessages=function(){return Lt.deepCloneMessagesWithReferences(o.messageToElements.map(function(d){var f=el(d,1),h=f[0];return h}))},e.clearMessages=o.clearMessages.bind(o,r),e.refreshMessages=o.refreshTextMessages.bind(o,e.remarkable),e.scrollToBottom=rt.scrollToBottom.bind(o,o),e.addMessage=function(d,f){o.addAnyMessage(Je(Je({},d),{},{sendUpdate:!!f}),!f)},e.updateMessage=function(d,f){return Aq.update(o,d,f)},r.isWebModel()&&r.setUpMessages(o),e.textToSpeech&&Uv.processConfig(e.textToSpeech,function(d){o.textToSpeech=d}),o.elementRef.onscroll=D(v().m(function d(){var f,h;return v().w(function(p){for(;;)switch(p.n){case 0:e.loadHistory&&u.loadHistoryOnScroll(e.loadHistory),(f=o.scrollButton)==null||f.updateScroll(),(h=o.browserStorage)!=null&&h.trackScrollHeight&&o.browserStorage.addScrollHeight(o.elementRef.scrollTop);case 1:return p.a(2)}},d)})),o}
214return J(n,t),M(n,[{key:"setLoadingToggle",value:function(r){var i=this.messageElementRefs[this.messageElementRefs.length-1],o=Xi.isLoadingMessage(i);if(!r&&o)this.removeLastMessage(),delete this._activeLoadingConfig;else{if(this._activeLoadingConfig&&o){var s=Pn.getTargetWrapper(i.bubbleElement);if(s)return this._activeLoadingConfig=r||{},this.updateLoadingMessage(s);this.removeLastMessage()}this._activeLoadingConfig=r||{},this.addLoadingMessage(!0)}}},{key:"prepareDemo",value:function(r,i){var o;if(B(r)=="object"){if(!i&&r.displayLoading){var s=r.displayLoading.history;s!=null&&s.small&&Qa.addMessage(this,!1),s!=null&&s.full&&Qa.addMessage(this)}r.displayErrors&&(r.displayErrors[H]&&this.addNewErrorMessage("",""),r.displayErrors.service&&this.addNewErrorMessage(jt,""),r.displayErrors.speechToText&&this.addNewErrorMessage("speechToText","")),(o=r.displayLoading)!=null&&o.message&&this.addLoadingMessage(),r.response&&(this.customDemoResponse=r.response)}}},{key:"addSetupMessageIfNeeded",value:function(r,i){var o=xq.getText(r,i);if(o){var s=this.createAndAppendNewMessageElement(o,xt);this.applyCustomStyles(s,xt,!1)}return!!o}},{key:"addIntroductoryMessages",value:function(r,i){var o=this;r!=null&&r.shadowRoot&&(this._introMessage=r.introMessage);var s=this._introMessage;i!=null&&i.isWebModel()&&(s??(s=i.getIntroMessage(s)));var a=!(r!=null&&r.history)&&!!(r!=null&&r.loadHistory||i!=null&&i.fetchHistory);s&&(Array.isArray(s)?s.forEach(function(l,c){if(c!==0){var u=o.messageElementRefs[o.messageElementRefs.length-1].innerContainer;Lt.hideRoleElements(u,o.avatar,o.name)}o.addIntroductoryMessage(l,a)}):this.addIntroductoryMessage(s,a))}},{key:"addIntroductoryMessage",value:function(r,i){var o,s;return r!=null&&r[b]?s=this.createAndAppendNewMessageElement(r[b],xt):r!=null&&r[ke]&&(s=bs.add(this,r[ke],xt)),s&&(this.applyCustomStyles(s,xt,!1,(o=this.messageStyles)==null?void 0:o.intro),s.outerContainer[S].add(Xi.INTRO_CLASS),i&&(s.outerContainer[N].display="none")),s}},{key:"removeIntroductoryMessage",value:function(){var r=this.messageElementRefs[0];r.outerContainer[S].contains(Xi.INTRO_CLASS)&&(r.outerContainer.remove(),this.messageElementRefs.shift())}},{key:"addAnyMessage",value:function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return r[E]?this.addNewErrorMessage(jt,r[E],o):this.addNewMessage(r,i,o)}},{key:"tryAddTextMessage",value:function(r,i,o){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;r[b]!==void 0&&o[b]!==null&&(this.addNewTextMessage(r[b],r.role,i,a),!s&&this.textToSpeech&&r.role!==et&&Uv.speak(r[b],this.textToSpeech))}},{key:"tryAddFileMessages",value:function(r,i){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;r[x]&&Array.isArray(r[x])&&aF.addMessages(this,r[x],r.role,i,o)}},{key:"tryAddHTMLMessage",value:function(r,i){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r[ke]!==void 0&&r[ke]!==null){var s=bs.add(this,r[ke],r.role,i,o);!o&&Zc.isElementTemporary(s)&&delete r[ke]}}},{key:"addNewMessage",value:function(r){var i=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a,l,c,u;r.role!==et&&((a=this._hiddenAttachments)==null||a.removeHiddenFiles());var d=n.createMessageContent(r),f=(c=(l=this.textToSpeech)==null?void 0:l.audio)==null?void 0:c.displayText;typeof f=="boolean"&&!f&&delete d[b];var h=rt.isScrollbarAtBottomOfElement(this.elementRef),p={status:r.overwrite};return s?(this.tryAddFileMessages(d,h,s),this.tryAddHTMLMessage(d,p,s),this.tryAddTextMessage(d,p,r,o,s)):(this.tryAddTextMessage(d,p,r,o,s),this.tryAddHTMLMessage(d,p,s),this.tryAddFileMessages(d,h,s)),this.isValidMessageContent(d)&&!s&&(this.updateStateOnMessage(d,r.overwrite,r.sendUpdate,o),p.status||setTimeout(function(){return i.scrollToFirstElement(d.role,h)}),o||(u=this.browserStorage)==null||u.addMessages(this.messageToElements.map(function(m){var g=el(m,1),w=g[0];return w})),this.scrollButton&&d.role!==et&&this.tryUpdateHiddenMessageCount(o,r)),this._activeLoadingConfig&&this.addLoadingMessage(!1),d}},{key:"tryUpdateHiddenMessageCount",value:function(r,i){var o=this;(!r||i.sendUpdate!==void 0)&&setTimeout(function(){var s,a;return(a=(s=o.scrollButton)==null?void 0:s.updateHidden)==null?void 0:a.call(s)})}},{key:"isValidMessageContent",value:function(r){return r[b]||r[ke]||r[x]&&r[x].length>0}},{key:"updateStateOnMessage",value:function(r,i){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!i){var a=Lt.generateMessageBody(r,this.messageElementRefs);this.messageToElements.push([r,a])}o&&this.sendClientUpdate(r,s)}},{key:"removeMessageOnError",value:function(){var r=this.messageElementRefs[this.messageElementRefs.length-1],i=r?.bubbleElement;(i!=null&&i[S].contains(To.MESSAGE_CLASS)&&i.textContent===""||n.isTemporaryElement(r))&&this.removeLastMessage()}},{key:"addNewErrorMessage",value:function(r,i){var o=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a,l,c,u,d,f;(a=this._hiddenAttachments)==null||a.readdHiddenFiles(),this.removeMessageOnError();var h=this.getPermittedMessage(i)||((l=this._errorMessageOverrides)==null?void 0:l[r])||((c=this._errorMessageOverrides)==null?void 0:c[H])||"Error, please try again.",p=this.createMessageElementsOnOrientation(h,E,s);Lt.hideRoleElements(p.innerContainer,this.avatar,this.name);var m=p.bubbleElement,g=p.outerContainer;m[S].add(Yv),this.renderText(m,h);var w=Hv.extractParticularSharedStyles(["fontSize","fontFamily"],(u=this.messageStyles)==null?void 0:u[H]);Hv.applyCustomStylesToElements(p,!1,w),Hv.applyCustomStylesToElements(p,!1,(d=this.messageStyles)==null?void 0:d[E]),s||this.appendOuterContainerElemet(g),this.textToSpeech&&Uv.speak(h,this.textToSpeech),(f=this._onError)==null||f.call(this,h),setTimeout(function(){return rt.scrollToBottom(o)})}},{key:"getPermittedMessage",value:function(r){if(r)for(var i=n.extractErrorMessages(r),o=0;o<i.length;o+=1){var s=i[o];if(typeof s=="string"){if(this._displayServiceErrorMessages)return s;
214if(this._permittedErrorPrefixes){var a=n.checkPermittedErrorPrefixes(this._permittedErrorPrefixes,s);if(a)return a}}}}},{key:"removeError",value:function(){this.isLastMessageError()&&Lt.getLastMessageElement(this.elementRef).remove()}},{key:"addDefaultLoadingMessage",value:function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:xt,o=this.createMessageElements("",i),s=o.bubbleElement;o.bubbleElement[S].add(vs.DOTS_CONTAINER_CLASS);var a=U();return a[S].add("loading-message-dots"),s.appendChild(a),vs.setDots(s,r),o}},{key:"addLoadingMessage",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i,o,s,a,l,c;if(!(Xi.isLoadingMessage(this.messageElementRefs[this.messageElementRefs.length-1])||!this._activeLoadingConfig&&!r&&!this._isLoadingMessageAllowed)){var u=((i=this._activeLoadingConfig)==null?void 0:i.role)||xt,d=((o=this._activeLoadingConfig)==null?void 0:o[N])||((a=(s=this.messageStyles)==null?void 0:s.loading)==null?void 0:a.message),f=d?.[ke],h=f?bs.createElements(this,f,u,!1):this.addDefaultLoadingMessage(d,u);this.appendOuterContainerElemet(h.outerContainer),h.bubbleElement[S].add(vs.BUBBLE_CLASS),this.applyCustomStyles(h,u,!1,d?.styles),(c=(l=this.avatar)==null?void 0:l.getAvatarContainer(h.innerContainer))==null||c[S].add("loading-avatar-container"),!this.focusMode&&rt.isScrollbarAtBottomOfElement(this.elementRef)&&rt.scrollToBottom(this)}}},{key:"updateLoadingMessage",value:function(r){var i,o=(i=this._activeLoadingConfig)==null?void 0:i[N],s=o?.[ke];r.innerHTML=s||""}},{key:"populateIntroPanel",value:function(r){r&&(this._introPanel=new kq(r),Pn.apply(this,this._introPanel._elementRef),this.elementRef.appendChild(this._introPanel._elementRef))}},{key:"addMultipleFiles",value:(function(){var e=D(v().m(function i(o,s){return v().w(function(a){for(;;)switch(a.n){case 0:return a.a(2,(this._hiddenAttachments=s,Promise.all((o||[]).map(function(l){return new Promise(function(c){if(!l.type||l.type===nl){var u=l[Bt].name||Bt;c({name:u,type:nl,ref:l[Bt]})}else{var d=new FileReader;d.readAsDataURL(l[Bt]),d.onload=function(){var f=l[Bt].name;c(_(_(_(_({},Y,d.result),"name",f),"type",l.type),"ref",l[Bt]))}}})}))))}},i,this)}));function r(i,o){return e.apply(this,arguments)}return r})()},{key:"clearMessages",value:function(r,i){var o,s,a,l,c,u=[];this.messageElementRefs.forEach(function(f){n.isActiveElement(f.bubbleElement[S])?u.push(f):f.outerContainer.remove()}),Array.from(this.elementRef.children).forEach(function(f){var h,p=(h=f.children[0])==null?void 0:h.children[0];p!=null&&p[S].contains(Yv)&&f.remove()}),this.messageElementRefs=u;var d=this.messageToElements.filter(function(f){return f[1][b]&&n.isActiveElement(f[1][b].bubbleElement[S])||f[1][ke]&&n.isActiveElement(f[1][ke].bubbleElement[S])});(o=this.messageToElements).splice.apply(o,[0,this.messageToElements.length].concat(Za(d))),i!==!1&&((s=this._introPanel)!=null&&s._elementRef&&this._introPanel.display(),this.addIntroductoryMessages()),(a=this.browserStorage)==null||a.clear(),(l=this.scrollButton)==null||l.clearHidden(),(c=this._onClearMessages)==null||c.call(this),delete r.sessionId}}],[{key:"getDefaultDisplayLoadingMessage",value:function(r,i){var o;return B(r.displayLoadingBubble)=="object"&&r.displayLoadingBubble.toggle?!1:i.websocket?B(r.displayLoadingBubble)===ze?!1:!!r.displayLoadingBubble:(o=B(r.displayLoadingBubble)===ze||r.displayLoadingBubble)!==null&&o!==void 0?o:!0}},{key:"checkPermittedErrorPrefixes",value:function(r,i){for(var o=0;o<r.length;o+=1)if(i.startsWith(r[o]))return i}},{key:"extractErrorMessages",value:function(r){return Array.isArray(r)?r:r instanceof Error?[r.message]:typeof r=="string"?[r]:B(r)=="object"&&r[E]?[r[E]]:[]}},{key:"isActiveElement",value:function(r){return r?r.contains(vs.BUBBLE_CLASS)||r.contains(Qa.CLASS)||r.contains(To.MESSAGE_CLASS):!1}}])})(Xi),Rq=(function(){function t(){k(this,t)}return M(t,null,[{key:"adjustInputPadding",value:function(e,r){r[Qc].length>0&&e[S].add("text-input-inner-start-adjustment"),r[Zi].length>0&&e[S].add("text-input-inner-end-adjustment")}}
214,{key:"adjustForOutsideButton",value:function(e,r,i){i[En].length===0&&i[Gn].length>0?(e[0][S].add(DN),r[S].add(DN)):i[Gn].length===0&&i[En].length>0&&(e[3][S].add(IN),r[S].add(IN))}},{key:"adjustOutsideSubmit",value:function(e,r,i){if(!(i[Qc].length>0||i[Zi].length>0)){if(i[En].length===0&&i[Gn].length>0)return e[0][S].add(CN),r[S].add(CN),i[Gn].map(function(o){return o.button.elementRef[S].add("submit-button-enlarged")});if(i[Gn].length===0&&i[En].length>0)return e[3][S].add(SN),r[S].add(SN),i[En].map(function(o){return o.button.elementRef[S].add("submit-button-enlarged")})}}},{key:"set",value:function(e,r,i,o){t.adjustOutsideSubmit(r,i,o)||t.adjustForOutsideButton(r,i,o),t.adjustInputPadding(e,o)}}])})(),ey=(function(){function t(){k(this,t)}return M(t,null,[{key:"create",value:function(){return Array.from({length:4}).map(function(e,r){var i=U();return i[S].add("input-button-container"),(r===0||r===3)&&i[S].add("outer-button-container"),(r===1||r===2)&&i[S].add("inner-button-container"),i})}},{key:"add",value:function(e,r){e.insertBefore(r[1],e.firstChild),e.insertBefore(r[0],e.firstChild),e.appendChild(r[2]),e.appendChild(r[3])}},{key:"getContainerIndex",value:function(e){return e===Gn?0:e===Qc?1:e===Zi?2:3}},{key:"addButton",value:function(e,r,i){r[S].add(i);var o=t.getContainerIndex(i);e[o].appendChild(r),o===3&&r[S].add(En)}}])})(),TN=["camera","gifs","images","audio","mixedFiles","submit","microphone"],Oq=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" fill="none"> 215 <rect x="2.5" y="2.5" width="17" height="17" rx="2" stroke="#000000" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/> 216</svg> 217`,ef=(function(){function t(){k(this,t)}return M(t,null,[{key:"addHighlightEvents",value:function(e,r){r.addEventListener("mouseenter",function(i){e.highlightedItem=i.target}),r.addEventListener("mouseleave",function(){e.highlightedItem=void 0})}},{key:"addItemEvents",value:function(e,r,i,o){ny.add(r,o),r.addEventListener(ht,function(){i[ht]()}),t.addHighlightEvents(e,r)}},{key:"createItemText",value:function(e,r){var i=U();return Object.assign(i[N],r),i[S].add(t.TEXT_CLASS),i.textContent=e||"File",i}},{key:"createItemIcon",value:function(e,r){var i=U();return Object.assign(i[N],r),i[S].add(t.ICON_CLASS),i.appendChild(e),i}},{key:"populateItem",value:function(e,r,i){var o=e.elementRef,s=e.dropupText,a=e.svg,l=e.customStyles,c=o.children[0],u=l&&Object.values(l).find(function(d){var f;return((f=d.svg)==null?void 0:f.content)===""});c[S].contains(ws.INPUT_BUTTON_INNER_TEXT_CLASS)?(u||r.appendChild(t.createItemIcon(a,i?.iconContainer)),r.appendChild(t.createItemText(c.textContent,i?.[b]))):(u||r.appendChild(t.createItemIcon(o.children[0],i?.iconContainer)),r.appendChild(t.createItemText(s,i?.[b])))}},{key:"createItem",value:function(e,r,i){var o,s=U();Object.assign(s[N],(o=i?.item)==null?void 0:o[H]),t.populateItem(r,s,i),s[S].add(t.MENU_ITEM_CLASS),s.tabIndex=0;var a=r.elementRef;if(r.isCustom)r.setDropupItem(e,s);else{var l=hn.processStateful(i?.item||{});t.addItemEvents(e,s,a,l)}return s}}])})();ef.MENU_ITEM_CLASS="dropup-menu-item",ef.CUSTOM_BUTTON_ITEM_CLASS="dropup-menu-item-custom-button",ef.TEXT_CLASS="dropup-menu-item-text",ef.ICON_CLASS="dropup-menu-item-icon";var Io=ef,Gc=(function(t){function n(e,r,i,o){var s;k(this,n);var a,l,c,u,d,f,h=((u=(c=(l=(a=e?.styles)==null?void 0:a.button)==null?void 0:l[H])==null?void 0:c[b])==null?void 0:u.content)||"Custom ".concat(r),p=Oq,m=Mo.tryCreateConfig("Custom ".concat(r),e?.tooltip);return s=K(this,n,[n.createButtonElement(),p,e?.position,m,((d=e?.
217styles)==null?void 0:d.button)||m&&{},h]),s._state=H,s.isCustom=!0,s._innerElements=s.createInnerElementsForStates(s.customStyles),s._menuStyles=o,s._onClick=e.onClick,s._dropupStyles=(f=e.styles)==null?void 0:f.dropup,s.setSetState(e),s.addClickListener(i),s.changeState(e.initialState,!0),s}return J(n,t),M(n,[{key:"createInnerElementsForStates",value:function(r){var i="custom-icon",o=this.createInnerElements(i,H,r);return _(_(_({},H,o),"active",this.genStateInnerElements(i,"active",o,r)),"disabled",this.genStateInnerElements(i,"disabled",o,r))}},{key:"setSetState",value:function(r){var i=this;r.setState=function(o){o===H&&i.changeToDefault(),o==="active"&&i.changeToActive(),o==="disabled"&&i.changeToDisabled()}}},{key:"addClickListener",value:function(r){var i=this;rt.assignButtonEvents(this.elementRef,function(){var o,s=(o=i._onClick)==null?void 0:o.call(i,i._state);r?.(),(s===H||s==="active"||s==="disabled")&&i.changeState(s)})}},{key:"changeState",value:function(r,i){r==="disabled"?this.changeToDisabled(i):r==="active"?this.changeToActive(i):this.changeToDefault(i)}},{key:"applyDropupContentStyles",value:function(r){var i=Array.from(this.elementRef.children);if(r!=null&&r[b]){var o=i.find(function(a){return a[S].contains(Io.TEXT_CLASS)});o&&Object.assign(o[N],r[b])}if(r!=null&&r.iconContainer){var s=i.find(function(a){return a[S].contains(Io.ICON_CLASS)});s&&Object.assign(s[N],r.iconContainer)}}},{key:"resetDropupItem",value:function(r){var i,o,s;this.elementRef=Pn.replaceElementWithNewClone(this.elementRef,this._originalElementRef),this.elementRef.innerHTML="",((i=r?.svg)==null?void 0:i.content)===""||this.elementRef.appendChild(Io.createItemIcon(this.svg,(o=this._menuStyles)==null?void 0:o.iconContainer)),this.elementRef.appendChild(Io.createItemText(this.dropupText,(s=this._menuStyles)==null?void 0:s[b]))}},{key:"assignDropupItemStyle",value:function(r,i){var o;this.elementRef.parentElement&&this._originalElementRef&&this.resetDropupItem(i),Io.addHighlightEvents(this._menu,this.elementRef),this.applyDropupContentStyles(r),Object.assign(this.elementRef[N],(o=r?.item)==null?void 0:o[H]);var s=hn.processStateful(r?.item||{});ny.add(this.elementRef,s),this.addClickListener()}},{key:"changeToDefault",value:function(r){var i,o,s,a,l,c;!r&&this._state===H||(this.elementRef[S].contains(Io.MENU_ITEM_CLASS)?this.assignDropupItemStyle((i=this._dropupStyles)==null?void 0:i[H],(o=this.customStyles)==null?void 0:o[H]):(this.changeElementsByState(this._innerElements[H]),(s=this.customStyles)!=null&&s.active&&ir.unsetAllCSS(this.elementRef,(a=this.customStyles)==null?void 0:a.active),(l=this.customStyles)!=null&&l.disabled&&ir.unsetAllCSS(this.elementRef,(c=this.customStyles)==null?void 0:c.disabled),this.reapplyStateStyle(H,["active","disabled"])),this.elementRef[S].remove(n.DISABLED_CONTAINER_CLASS,n.ACTIVE_CONTAINER_CLASS),this.elementRef[S].add(n.DEFAULT_CONTAINER_CLASS),Cn.removeAriaDisabled(this.elementRef),this._state=H)}},{key:"changeToActive",value:function(r){var i,o;!r&&this._state==="active"||(this.elementRef[S].contains(Io.MENU_ITEM_CLASS)?this.assignDropupItemStyle((i=this._dropupStyles)==null?void 0:i.active,(o=this.customStyles)==null?void 0:o.active):(this.changeElementsByState(this._innerElements.active),this.reapplyStateStyle("active",["disabled",H])),this.elementRef[S].remove(n.DISABLED_CONTAINER_CLASS,n.DEFAULT_CONTAINER_CLASS),this.elementRef[S].add(n.ACTIVE_CONTAINER_CLASS),Cn.removeAriaDisabled(this.elementRef),this._state="active")}},{key:"changeToDisabled",value:function(r){var i,o,s,a,l,c;!r&&this._state==="disabled"||(this.elementRef[S].contains(Io.MENU_ITEM_CLASS)?this.assignDropupItemStyle((i=this._dropupStyles)==null?void 0:i.disabled,(o=this.customStyles)==null?void 0:o.disabled):(this.changeElementsByState(this._innerElements.disabled),(s=this.customStyles)!=null&&s.active&&ir.unsetAllCSS(this.elementRef,(a=this.customStyles)==null?void 0:a.active),(l=this.customStyles)!=null&&l[H]&&ir.unsetAllCSS(this.elementRef,(c=this.customStyles)==null?void 0:c[H]),this.reapplyStateStyle("disabled",[H,"active"])),this.elementRef[S].remove(n.ACTIVE_CONTAINER_CLASS,n.DEFAULT_CONTAINER_CLASS),this.elementRef[S].add(n.DISABLED_CONTAINER_CLASS),Cn.addAriaDisabled(this.elementRef),this._state="disabled")}},{key:"setDropupItem",value:function(r,i){this._menu=r,this.elementRef=i,this._originalElementRef=i.cloneNode(!0),this.changeState(this._state,!0)}},{key:"genStateInnerElements",value:function(r,i,o,s){var a,l,c,u,d=this.createInnerElements(r,i,s),f=(l=(a=s?.[i])==null?void 0:a.svg)==null?void 0:l.content,h=(u=(c=s?.[i])==null?void 0:c[b])==null?void 0:u.content;if(f===void 0||h===void 0){var p=nf.parseSVGTextElements(o),m=p.svg,g=p[b],w=nf.parseSVGTextElements(d),C=w.svg,T=w[b],I=[];n.addToInnerElements(I,f,m,C),n.addToInnerElements(I,h,g,T),d=I}return d}}],[{key:"createButtonElement",value:function(){var r=U();return r[S].add("input-button",n.BUTTON_CLASS),r}},{key:"addToInnerElements",value:function(r,i,o,s){i===void 0&&o?r.push(o.cloneNode(!0)):s&&r.push(s)}},{key:"add",value:function(r,i){var o=r.customButtons,s=r.focusInput,a=r.dropupStyles;o?.forEach(function(l,c){var u={button:new n(l,c+1,s,a?.menu)};i["".concat(n.INDICATOR_PREFIX).concat(c+1)]=u})}}])})(ul);Gc.INDICATOR_PREFIX="custom",Gc.BUTTON_CLASS="custom-button",Gc.DISABLED_CONTAINER_CLASS="custom-button-container-disabled",Gc.DEFAULT_CONTAINER_CLASS="custom-button-container-default",Gc.ACTIVE_CONTAINER_CLASS="custom-button-container-active";var rf=Gc,Nq=`<?xml version="1.0" encoding="utf-8"?> 218<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg"> 219 <path d="M16 0c-8.836 0-16 7.163-16 16s7.163 16 16 16c8.837 0 16-7.163 16-16s-7.163-16-16-16zM16 30.032c-7.72 0-14-6.312-14-14.032s6.28-14 14-14 14 6.28 14 14-6.28 14.032-14 14.032zM23 15h-6v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1v6h-6c-0.552 0-1 0.448-1 1s0.448 1 1 1h6v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6h6c0.552 0 1-0.448 1-1s-0.448-1-1-1z"></path> 220</svg>`,kN=(function(){function t(){k(this,t)}return M(t,null,[{key:"focusItemWhenOnEdge",value:function(e,r){var i=e.elementRef,o=r?i.children[0]:i.children[i.children.length-1];t.focusSiblingItem(e,o,r,!0)}},{key:"focusSiblingItem",value:function(e,r,i){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=o?r:r[i?"nextSibling":"previousSibling"];s?(r.dispatchEvent(new MouseEvent("mouseleave")),s.dispatchEvent(new MouseEvent("mouseenter")),s.focus()):(r.dispatchEvent(new MouseEvent("mouseleave")),t.focusItemWhenOnEdge(e,i))}}])})(),Pq=(function(){function t(n,e){var r=this;k(this,t);var i;this._isOpen=!0,this._styles=e,this.elementRef=t.createElement((i=this._styles)==null?void 0:i.container),this.close(),setTimeout(function(){return r.addWindowEvents(n)})}return M(t,[{key:"open",value:function(){this.elementRef[N].display="block",this._isOpen=!0}},{key:"close",value:function(){this._isOpen&&(this.elementRef[N].display="none",this._isOpen=!1)}},{key:"toggle",value:function(){this._isOpen?this.close():this.open()}},{key:"addItem",value:function(e){var r=Io.createItem(this,e,this._styles);this.elementRef.appendChild(r)}},{key:"addWindowEvents",value:function(e){this.clickEvent=this.windowClick.bind(this,e),window.addEventListener(ht,this.clickEvent),this.keyDownEvent=this.windowKeyDown.bind(this,e),window.addEventListener("keydown",this.keyDownEvent)}},{key:"windowClick",value:function(e,r){var i;!e.isConnected&&this.clickEvent?window.removeEventListener(ht,this.clickEvent):e.parentElement!==((i=r.target.shadowRoot)==null?void 0:i.children[0])&&this.close()}},{key:"windowKeyDown",value:function(e,r){var i,o,s;!e.isConnected&&this.keyDownEvent?window.removeEventListener("keydown",this.keyDownEvent):this._isOpen&&(r.key===dn.ESCAPE?(this.close(),(i=this.highlightedItem)==null||i.dispatchEvent(new MouseEvent("mouseleave"))):r.key===dn.ENTER?((o=this.highlightedItem)==null||o[ht](),(s=this.highlightedItem)==null||s.dispatchEvent(new MouseEvent("mouseleave"))):r.key===dn.ARROW_DOWN?kN.focusSiblingItem(this,this.highlightedItem||this.elementRef.children[this.elementRef.children.length-1],!0):r.key===dn.ARROW_UP&&kN.focusSiblingItem(this,this.highlightedItem||this.elementRef.children[0],!1))}}],[{key:"createElement",value:function(e){var r=U();return r.id=Yr,Object.assign(r[N],e),r}}])})(),lF=(function(t){function n(e,r){var i;k(this,n);var o,s,a=Mo.tryCreateConfig("Options",(o=r?.button)==null?void 0:o.tooltip);i=K(this,n,[n.createButtonElement(),Nq,void 0,a,{styles:(s=r?.button)==null?void 0:s.styles}]);var l=i.createInnerElementsForStates(i.customStyles);return i._menu=new Pq(e,r?.menu),i.addClickEvent(),i.buttonContainer=n.createButtonContainer(),i.changeElementsByState(l.styles),i.buttonContainer.appendChild(i.elementRef),i.elementRef[S].add(n.BUTTON_ICON_CLASS),i.buttonContainer.appendChild(i._menu.elementRef),i.reapplyStateStyle("styles"),i.addContainerEvents(e),i}return J(n,t),M(n,[{key:"createInnerElementsForStates",value:function(r){return{styles:this.createInnerElements("dropup-icon","styles",r)}}},{key:"addClickEvent",value:function(){var r=this;this.elementRef.onclick=this._menu.toggle.bind(this._menu),this.elementRef.onkeydown=function(i){i.key===dn.ENTER&&setTimeout(function(){r._menu.toggle(
220);var o=r._menu.elementRef.children[0];o.focus(),o.dispatchEvent(new MouseEvent("mouseenter"))})}}},{key:"addItem",value:function(r){this._menu.addItem(r)}},{key:"addContainerEvents",value:function(r){var i=this;r.addEventListener(ht,function(o){var s=o.target[S];!s.contains(n.BUTTON_ICON_CLASS)&&!s.contains(rf.DISABLED_CONTAINER_CLASS)&&i._menu.close()})}}],[{key:"createButtonElement",value:function(){var r=U();return r[S].add("input-button"),r}},{key:"createButtonContainer",value:function(){var r=U();return r.id="dropup-container",r}},{key:"getPosition",value:function(r,i){var o,s;return(o=i?.button)!=null&&o.position?Wt.processPosition((s=i?.button)==null?void 0:s.position):r[Gn].length>0&&r[En].length===0?En:Gn}}])})(ul);lF.BUTTON_ICON_CLASS="dropup-button";var MN=lF,Fq=(function(){function t(){k(this,t)}return M(t,null,[{key:"addToDropup",value:function(e,r,i,o){var s=new MN(i,o);TN.forEach(function(l){var c=r[Yr].findIndex(function(d){return d.buttonType===l}),u=r[Yr][c];u&&(s.addItem(u.button),r[Yr].splice(c,1))}),r[Yr].forEach(function(l){var c=l.button;return s.addItem(c)});var a=MN.getPosition(r,o);ey.addButton(e,s.buttonContainer,a),r[a].push({})}},{key:"addToSideContainer",value:function(e,r){[Qc,Zi,Gn,En].forEach(function(i){var o=i;r[o].forEach(function(s){ey.addButton(e,s.button.elementRef,o)})})}},{key:"setPosition",value:function(e,r,i){var o=Je(Je({},e[r]),{},{buttonType:r});i.push(o),delete e[r]}},{key:"createPositionsToButtonsObj",value:function(){return _(_(_(_(_({},Yr,[]),Gn,[]),Qc,[]),Zi,[]),En,[])}},{key:"generatePositionToButtons",value:function(e){var r=t.createPositionsToButtonsObj();Object.keys(e).forEach(function(o){var s,a=(s=e[o])==null?void 0:s.button.position;a&&t.setPosition(e,o,r[a])}),r[Zi].length===0&&e.submit&&t.setPosition(e,"submit",r[Zi]),r[En].length===0&&(e.submit?t.setPosition(e,"submit",r[En]):e.microphone?t.setPosition(e,Yi,r[En]):e.camera?t.setPosition(e,or,r[En]):e["".concat(rf.INDICATOR_PREFIX,"1")]&&t.setPosition(e,"".concat(rf.INDICATOR_PREFIX,"1"),r[En])),e.submit&&t.setPosition(e,"submit",r[Gn].length===0?r[Gn]:r[Zi]),e.microphone&&t.setPosition(e,Yi,r[Gn].length===0?r[Gn]:r[Zi]);var i=Object.keys(e);return i.length>1||r[Yr].length>0?(TN.forEach(function(o){e[o]&&r[Yr].push(Je(Je({},e[o]),{},{buttonType:o}))}
220),i.forEach(function(o){var s=o;s.startsWith(rf.INDICATOR_PREFIX)&&e[s]&&r[Yr].push(Je(Je({},e[s]),{},{customType:s}))})):i.length===1&&t.setPosition(e,i[0],r[En].length===0?r[En]:r[Gn]),r}},{key:"addButtons",value:function(e,r,i,o){var s=t.generatePositionToButtons(r);return t.addToSideContainer(e,s),s[Yr].length>0&&t.addToDropup(e,s,i,o),s}}])})(),Lq=`<?xml version="1.0" encoding="utf-8"?> 221<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 222<path d="M20 10.9696L11.9628 18.5497C10.9782 19.4783 9.64274 20 8.25028 20C6.85782 20 5.52239 19.4783 4.53777 18.5497C3.55315 17.6211 3 16.3616 3 15.0483C3 13.7351 3.55315 12.4756 4.53777 11.547L12.575 3.96687C13.2314 3.34779 14.1217 3 15.05 3C15.9783 3 16.8686 3.34779 17.525 3.96687C18.1814 4.58595 18.5502 5.4256 18.5502 6.30111C18.5502 7.17662 18.1814 8.01628 17.525 8.63535L9.47904 16.2154C9.15083 16.525 8.70569 16.6989 8.24154 16.6989C7.77738 16.6989 7.33224 16.525 7.00403 16.2154C6.67583 15.9059 6.49144 15.4861 6.49144 15.0483C6.49144 14.6106 6.67583 14.1907 7.00403 13.8812L14.429 6.88674" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 223</svg>`,jq=`<?xml version="1.0" encoding="utf-8"?> 224<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> 225 <path d="M20,15.2928932 L20,5.5 C20,4.67157288 19.3284271,4 18.5,4 L5.5,4 C4.67157288,4 4,4.67157288 4,5.5 L4,12.2928932 L7.14644661,9.14644661 C7.34170876,8.95118446 7.65829124,8.95118446 7.85355339,9.14644661 L13.5,14.7928932 L16.1464466,12.1464466 C16.3417088,11.9511845 16.6582912,11.9511845 16.8535534,12.1464466 L20,15.2928932 Z M20,16.7071068 L16.5,13.2071068 L13.8535534,15.8535534 C13.6582912,16.0488155 13.3417088,16.0488155 13.1464466,15.8535534 L7.5,10.2071068 L4,13.7071068 L4,18.5 C4,19.3284271 4.67157288,20 5.5,20 L18.5,20 C19.3284271,20 20,19.3284271 20,18.5 L20,16.7071068 Z M3,5.5 C3,4.11928813 4.11928813,3 5.5,3 L18.5,3 C19.8807119,3 21,4.11928813 21,5.5 L21,18.5 C21,19.8807119 19.8807119,21 18.5,21 L5.5,21 C4.11928813,21 3,19.8807119 3,18.5 L3,5.5 Z M15,6 L17,6 C17.5522847,6 18,6.44771525 18,7 L18,9 C18,9.55228475 17.5522847,10 17,10 L15,10 C14.4477153,10 14,9.55228475 14,9 L14,7 C14,6.44771525 14.4477153,6 15,6 Z M15,7 L15,9 L17,9 L17,7 L15,7 Z"/> 226</svg> 227`,Bq=`<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-49.49 -49.49 593.87 593.87" stroke-width="3.95908" transform="rotate(0)"> 228 <g stroke-width="0"></g> 229 <g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.98977"></g> 230 <g> 231 <g> 232 <g> 233 <path d="M163.205,76.413v293.301c-3.434-3.058-7.241-5.867-11.486-8.339c-21.38-12.452-49.663-15.298-77.567-7.846 c-49.038,13.096-80.904,54.519-71.038,92.337c4.019,15.404,14.188,28.221,29.404,37.087c13.553,7.894,29.87,11.933,47.115,11.933 c9.962,0,20.231-1.356,30.447-4.087c42.74-11.406,72.411-44.344,72.807-77.654h0.011v-0.162c0.002-0.166,0-0.331,0-0.496V187.072 l290.971-67.3v178.082c-3.433-3.055-7.238-5.863-11.481-8.334c-21.385-12.452-49.654-15.308-77.567-7.846 c-49.038,13.087-80.904,54.519-71.038,92.356c4.019,15.385,14.183,28.212,29.404,37.067c13.548,7.894,29.875,11.933,47.115,11.933 c9.962,0,20.231-1.356,30.452-4.087c42.74-11.413,72.411-44.346,72.804-77.654h0.004v-0.065c0.003-0.236,0.001-0.469,0-0.704V0 L163.205,76.413z M104.999,471.779c-22.543,6.038-45.942,3.846-62.572-5.846c-10.587-6.163-17.591-14.817-20.255-25.038 c-7.144-27.375,18.452-58.029,57.062-68.346c8.409-2.25,16.938-3.346,25.188-3.346c13.87,0,26.962,3.115,37.389,9.192 c10.587,6.163,17.591,14.817,20.255,25.029c0.809,3.102,1.142,6.248,1.139,9.4v0.321h0.014 C162.99,437.714,139.082,462.678,104.999,471.779z M182.898,166.853V92.067l290.971-67.298v74.784L182.898,166.853z M415.677,399.923c-22.558,6.038-45.942,3.837-62.587-5.846c-10.587-6.163-17.587-14.817-20.25-25.019 c-7.144-27.385,18.452-58.058,57.058-68.365c8.414-2.25,16.942-3.346,25.192-3.346c13.875,0,26.962,3.115,37.385,9.192 c10.596,6.163,17.596,14.817,20.26,25.029v0.01c0.796,3.05,1.124,6.144,1.135,9.244v0.468h0.02 C473.668,365.851,449.763,390.814,415.677,399.923z"> 234 </path> 235 </g> 236 </g> 237 </g> 238</svg>`,Vq=`<?xml version="1.0" encoding="UTF-8" standalone="no"?> 239<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 5.9266752 5.6408391" height="21.31971" width="22.4"> 240 <g> 241 <path d="m 5.2564627,1.548212 c -3.1136005,-0.4796804 -1.5568006,-0.2398402 0,0 z M 2.0001198,2.0922063 c 0.1556781,0 0.2657489,0.020893 0.3917849,0.080366 0.081154,0.038347 0.1153492,0.134065 0.076377,0.2138602 -0.038973,0.07979 -0.1363527,0.1134129 -0.2175069,0.075091 -0.078199,-0.036919 -0.1407455,-0.048792 -0.250655,-0.048792 -0.2260486,0 -0.3921482,0.2042182 -0.3921482,0.4801409 0,0.2761822 0.1663188,0.4810688 0.3921482,0.4810688 0.1117901,0 0.2064255,-0.046133 0.255659,-0.1284198 l 0.00162,-0.00389 V 3.0534032 l -0.098011,1.75e-4 c -0.081844,0 -0.1495979,-0.059305 -0.1612403,-0.1365887 l -0.00175,-0.023683 c 0,-0.08047 0.060311,-0.1470874 0.1389
241194,-0.1585331 l 0.024085,-0.00195 h 0.2612303 c 0.081842,0 0.149598,0.059305 0.1612404,0.1365891 l 0.00175,0.023683 -3.398e-4,0.3968809 v 0 l -0.00168,0.014211 v 0 l -0.00553,0.023034 v 0 l -0.00532,0.014145 c -0.098178,0.22826 -0.3236506,0.3528713 -0.5706303,0.3528713 -0.4240855,0 -0.7181621,-0.3622714 -0.7181621,-0.8016063 0,-0.4391857 0.2940275,-0.8006848 0.7181621,-0.8006848 z m 1.2034759,0.031275 c 0.081843,0 0.1495977,0.059305 0.1612403,0.1365891 l 0.00175,0.023683 v 1.2211775 c 0,0.088516 -0.07298,0.1602721 -0.1630073,0.1602721 -0.081841,0 -0.1495972,-0.059305 -0.1612397,-0.1365892 L 3.040589,3.5049308 V 2.2837527 c 0,-0.088516 0.07298,-0.1602721 0.1630067,-0.1602714 z m 0.7813442,0 0.5209469,0.00195 c 0.090025,3.048e-4 0.1627543,0.072306 0.1624458,0.1608234 -2.809e-4,0.08047 -0.06083,0.1468798 -0.1394772,0.158066 l -0.024092,0.00195 -0.3575326,-0.0013 v 0.4497782 l 0.2928918,2.27e-4 c 0.081842,0 0.1495979,0.059305 0.1612403,0.136589 l 0.00175,0.023683 c 0,0.080469 -0.06031,0.1470871 -0.1389193,0.1585393 l -0.024092,0.00195 -0.2928919,-2.336e-4 1.563e-4,0.2860316 c 0,0.080471 -0.06031,0.1470873 -0.1389193,0.1585395 l -0.024085,0.00195 c -0.081843,0 -0.1495979,-0.059305 -0.1612403,-0.1365826 l -0.00175,-0.023691 V 2.2841354 c 2.798e-4,-0.08047 0.060829,-0.1468797 0.1394758,-0.1580594 z"/> 242 <path d="m 5.0894191,1.0943261 c 0,-0.21918999 -0.177687,-0.39686999 -0.396876,-0.39686999 h -3.43959 c -0.2191879,0 -0.391262,0.1777519 -0.3968759,0.39686999 l -0.027082,3.4379266 c 0.040152,0.2939927 0.4235456,0.409415 0.4235456,0.409415 l 3.4785583,-0.00851 c 0,0 0.3008506,-0.1402998 0.3236271,-0.4201576 0.042911,-0.5272495 0.034693,-1.6106146 0.034693,-3.4186761 z m -4.49792494,0 c 0,-0.36530999 0.29614504,-0.66145999 0.66145894,-0.66145999 h 3.43959 c 0.365314,0 0.66146,0.29615 0.66146,0.66145999 v 3.43959 c 0,0.36532 -0.296146,0.66146 -0.66146,0.66146 h -3.43959 c -0.3653139,0 -0.66145894,-0.29614 -0.66145894,-0.66146 z"/> 243 </g> 244</svg> 245`,Uq=_(_(_(_({},wt,{id:"upload-images-icon",svgString:jq,dropupText:"Image"}),Jc,{id:"upload-gifs-icon",svgString:Vq,dropupText:"GIF"}),$e,{id:"upload-audio-icon",svgString:Bq,dropupText:"Audio"}),"mixedFiles",{id:"upload-mixed-files-icon",svgString:Lq,dropupText:"File"}),cF=(function(t){function n(e){var r;k(this,n),e?.position===Yr&&(e.position=En);var i=Mo.tryCreateConfig("Microphone",e?.tooltip);return r=K(this,n,[n.createMicrophoneElement(),zP,e?.position,i,e]),r.isActive=!1,r._innerElements=r.createInnerElementsForStates(r.customStyles),r.changeToDefault(),r}return J(n,t),M(n,[{key:"createInnerElementsForStates",value:function(r){var i="microphone-icon";return _(_(_(_({},H,this.createInnerElements(i,H,r)),"active",this.createInnerElements(i,"active",r)),"unsupported",this.createInnerElements(i,"unsupported",r)),"commandMode",this.createInnerElements(i,"commandMode",r))}},{key:"changeToActive",value:function(){this.changeElementsByState(this._innerElements.active),this.toggleIconFilter("active"),this.reapplyStateStyle("active",[H,"commandMode"]),this.isActive=!0}},{key:"changeToDefault",value:function(){this.changeElementsByState(this._innerElements[H]),this.toggleIconFilter(H),this.reapplyStateStyle(H,["active","commandMode"]),this.isActive=!1}},{key:"changeToCommandMode",value:function(){this.changeElementsByState(this._innerElements.commandMode),this.toggleIconFilter("command"),this.reapplyStateStyle("commandMode",["active"])}},{key:"changeToUnsupported",value:function(){this.changeElementsByState(this._innerElements.unsupported),this.elementRef[S].add("unsupported-microphone"),this.reapplyStateStyle("unsupported",["active"])}},{key:"toggleIconFilter",value:function(r){var i=this.elementRef.children[0];if(i.tagName.toLocaleLowerCase()==="svg")switch(r){case H:i[S].remove("active-microphone-icon","command-microphone-icon"),i[S].add("default-microphone-icon");break;case"active":i[S].remove("default-microphone-icon","command-microphone-icon"),i[S].add("active-microphone-icon");break;case"command":i[S].remove("active-microphone-icon","default-microphone-icon"),i[S].add("command-microphone-icon");break}}}],[{key:"createMicrophoneElement",value:function(){var r=U();return r.id="microphone-button",r[S].add("input-button"),r}}])})(ul);function Hq(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Lv={},xh={},Rh={},Oh={},Nh={},AN;function cy(){if(AN)return Nh;AN=1,Object.defineProperty(Nh,"__esModule",{value:!0}),Nh.Text=void 0;var t=(function(){function n(){k(this,n)}return M(n,null,[{key:"capitalize",value:function(r){return r.replace(n.FIRST_CHAR_REGEX,function(i){return i.toUpperCase()})}},{key:"lineBreak",value:function(r){return r.replace(n.DOUBLE_LINE,"<p></p>").replace(n.ONE_LINE,"<br>")}},{key:"isCharDefined",value:function(r){return r!==void 0&&r!=="\xA0"&&r!==" "&&r!==` 246`&&r!==""}},{key:"breakupIntoWordsArr",value:function(r){return r.split(/(\W+)/)}}])})();return Nh.Text=t,t.FIRST_CHAR_REGEX=/\S/,t.DOUBLE_LINE=/\n\n/g,t.ONE_LINE=/\n/g,Nh}var xN;function uF(){if(xN)return Oh;xN=1,Object.defineProperty(Oh,"__esModule",{value:!0}),Oh.Translate=void 0;var t=cy(),n=(function(){function e(){k(this,e)}return M(e,null,[{key:"translate",value:function(i,o){for(var s=t.Text.breakupIntoWordsArr(i),a=0;a<s.length;a+=1)o[s[a]]&&(s[a]=o[s[a]]);return s.join("")}}])})();return Oh.Translate=n,Oh}var RN;function $q(){if(RN)return Rh;RN=1,Object.defineProperty(Rh,"__esModule",{value:!0}),Rh.WebSpeechTranscript=void 0;var t=uF(),n=(function(){function e(){k(this,e)}return M(e,null,[{key:"extract",value:function(i,o,s){for(var a="",l=i.resultIndex;l<i.results.length;++l){var c=i.results[l][0].transcript;s&&(c=t.Translate.translate(c,s)),i.results[l].isFinal?o+=c:a+=c}return{interimTranscript:a,finalTranscript:o,newText:a||o}}},{key:"extractSafari",value:function(i,o,s){for(var a="",l=i.resultIndex;l<i.results.length;++l){var c=i.results[l][0].transcript;s&&(c=t.Translate.translate(c,s)),a+=c}return{interimTranscript:"",finalTranscript:a,newText:a}}}])})();return Rh.WebSpeechTranscript=n,Rh}var Ph={},ON;function eD(){if(ON)return Ph;
246ON=1,Object.defineProperty(Ph,"__esModule",{value:!0}),Ph.Browser=void 0;var t=M(function n(){k(this,n)});return Ph.Browser=t,t.IS_SAFARI=function(){return t._IS_SAFARI===void 0&&(t._IS_SAFARI=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),t._IS_SAFARI},Ph}var Fh={},Lh={},NN;function zq(){if(NN)return Lh;NN=1,Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.EventListeners=void 0;var t=(function(){function n(){k(this,n)}return M(n,null,[{key:"getElementIfFocusedOnAvailable",value:function(r,i){return Array.isArray(r)?r.find(function(o){return i===o}):i===r?r:void 0}},{key:"keyDownWindow",value:function(r){var i=this;r.element&&n.getElementIfFocusedOnAvailable(r.element,document.activeElement)&&(n.KEY_DOWN_TIMEOUT!==null&&clearTimeout(n.KEY_DOWN_TIMEOUT),n.KEY_DOWN_TIMEOUT=setTimeout(function(){n.KEY_DOWN_TIMEOUT=null,i.resetRecording(r)},500))}},{key:"mouseDownWindow",value:function(r,i){this.mouseDownElement=n.getElementIfFocusedOnAvailable(r,i.target)}},{key:"mouseUpWindow",value:function(r){this.mouseDownElement&&this.resetRecording(r),this.mouseDownElement=void 0}},{key:"add",value:function(r,i){var o=i?.insertInCursorLocation===void 0||i?.insertInCursorLocation;i!=null&&i.element&&o&&(r.mouseDownEvent=n.mouseDownWindow.bind(r,i.element),document.addEventListener("mousedown",r.mouseDownEvent),r.mouseUpEvent=n.mouseUpWindow.bind(r,i),document.addEventListener("mouseup",r.mouseUpEvent),r.keyDownEvent=n.keyDownWindow.bind(r,i),document.addEventListener("keydown",r.keyDownEvent))}},{key:"remove",value:function(r){document.removeEventListener("mousedown",r.mouseDownEvent),document.removeEventListener("mouseup",r.mouseUpEvent),document.removeEventListener("keydown",r.keyDownEvent)}}])})();return Lh.EventListeners=t,t.KEY_DOWN_TIMEOUT=null,Lh}var jh={},PN;function qq(){if(PN)return jh;PN=1,Object.defineProperty(jh,"__esModule",{value:!0}),jh.PreResultUtils=void 0;var t=(function(){function n(){k(this,n)}return M(n,null,[{key:"process",value:function(r,i,o,s,a){var l=s?.(i,o);return l?(setTimeout(function(){l.restart?r.resetRecording(a):l.stop&&r.stop()}),(l.stop||l.restart)&&l.removeNewText):!1}}])})();return jh.PreResultUtils=t,jh}var Bh={},Vh={},FN;function dF(){if(FN)return Vh;FN=1,Object.defineProperty(Vh,"__esModule",{value:!0}),Vh.AutoScroll=void 0;var t=(function(){function n(){k(this,n)}return M(n,null,[{key:"changeStateIfNeeded",value:function(r,i){i&&!r.isCursorAtEnd&&(r.endPadding="",r.scrollingSpan.innerHTML=" ")}},{key:"scrollGeneric",value:function(r,i){r.isCursorAtEnd?i.scrollTop=i.scrollHeight:r.scrollingSpan.scrollIntoView({block:"nearest"})}},{key:"scrollSafariPrimitiveToEnd",value:function(r){r.scrollLeft=r.scrollWidth,r.scrollTop=r.scrollHeight}},{key:"isElementOverflown",value:function(r){return r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth}},{key:"isRequired",value:function(r,i){return r&&n.isElementOverflown(i)}}])})();return Vh.AutoScroll=t,Vh}var Uh={},LN;function uy(){if(LN)return Uh;LN=1,Object.defineProperty(Uh,"__esModule",{value:!0}),Uh.Elements=void 0;var t=(function(){function n(){k(this,n)}return M(n,null,[{key:"isPrimitiveElement",value:function(r){return r.tagName==="INPUT"||r.tagName==="TEXTAREA"}},{key:"createInterimSpan",value:function(){var r=document.createElement("span");return r.style.color="grey",r.style.pointerEvents="none",r}},{key:"createGenericSpan",value:function(){var r=document.createElement("span");return r.style.pointerEvents="none",r}},{key:"appendSpans",value:function(r,i){if(r.spansPopulated=!0,r.insertInCursorLocation&&document.activeElement===i){var o=window.getSelection();if(o!=null&&o.focusNode){var s=o.getRangeAt(0);s.insertNode(r.scrollingSpan),s.insertNode(r.interimSpan),s.insertNode(r.finalSpan),s.collapse(!1),o.removeAllRanges(),o.addRange(s);return}}i.appendChild(r.finalSpan),i.appendChild(r.interimSpan),i.appendChild(r.scrollingSpan)}},{key:"applyCustomColors",value:function(r,i){i.interim&&(r.interimSpan.style.color=i.interim),i.final&&(r.finalSpan.style.color=i.final)}},{key:"isInsideShadowDOM",value:function(r){return r.getRootNode()instanceof ShadowRoot}}])})();return Uh.Elements=t,Uh}var Hh={},jN;function dy(){if(jN)return Hh;jN=1,Object.defineProperty(Hh,"__esModule",{value:!0}),Hh.Cursor=void 0;var t=(function(){function n(){k(this,n)}return M(n,null,[{key:"setOffsetForGeneric",value:function(r,i){for(var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=0,a=0;a<r.childNodes.length;a+=1){var l=r.childNodes[a];if(l.childNodes.length>0){var c=n.setOffsetForGeneric(l,i,o);if(c===-1)return-1;o+=c}else if(l.textContent!==null){if(o+l.textContent.length>i){var u=document.createRange();u.setStart(l,i-o),u.collapse(!0);var d=window.getSelection();return d?.removeAllRanges(),d?.addRange(u),r.focus(),-1}o+=l.textContent.length,s+=l.textContent.length}}return s}},{key:"focusEndOfGeneric",value:function(r){var i=document.createRange();i.selectNodeContents(r),i.collapse(!1);var o=window.getSelection();o&&(o.removeAllRanges(),o.addRange(i))}},{key:"setOffsetForSafariGeneric",value:function(r,i){var o=window.getSelection();if(o){var s=n.getGenericElementCursorOffset(r,o,!0);n.setOffsetForGeneric(r,s+i)}}},{key:"setOffsetForPrimitive",value:function(r,i,o){o&&r.blur(),r.setSelectionRange(i,i),r.focus()}},{key:"getGenericElementCursorOffset",value:function(r,i,o){var s=0;if(i.rangeCount>0){var a=i.getRangeAt(0),l=a.cloneRange();
246l.selectNodeContents(r),o?l.setEnd(a.startContainer,a.startOffset):l.setEnd(a.endContainer,a.endOffset),s=l.toString().length}return s}}])})();return Hh.Cursor=t,Hh}var BN;function hF(){if(BN)return Bh;BN=1,Object.defineProperty(Bh,"__esModule",{value:!0}),Bh.CommandUtils=void 0;var t=dF(),n=uy(),e=eD(),r=dy(),i=cy(),o=(function(){function s(){k(this,s)}return M(s,null,[{key:"processCommand",value:function(l,c){return(!c||!c.caseSensitive)&&(l=l.toLowerCase()),c?.substrings===!1?i.Text.breakupIntoWordsArr(l):l}},{key:"process",value:function(l){var c;return((c=l.settings)===null||c===void 0?void 0:c.caseSensitive)===!0?l:Object.keys(l).reduce(function(u,d){var f=l[d];return u[d]=typeof f=="string"?s.processCommand(f,l.settings):f,u},{})}},{key:"toggleCommandModeOn",value:function(l){var c;l.isWaitingForCommand=!0,(c=l.onCommandModeTrigger)===null||c===void 0||c.call(l,!0)}},{key:"toggleCommandModeOff",value:function(l){var c;l.isWaitingForCommand&&((c=l.onCommandModeTrigger)===null||c===void 0||c.call(l,!1),l.isWaitingForCommand=!1)}},{key:"setText",value:function(l,c,u,d){s.toggleCommandModeOff(l),n.Elements.isPrimitiveElement(d)?(d.value=u,l.isTargetInShadow||r.Cursor.setOffsetForPrimitive(d,u.length,!0),e.Browser.IS_SAFARI()&&l.autoScroll&&t.AutoScroll.scrollSafariPrimitiveToEnd(d)):(d.textContent=u,l.isTargetInShadow||r.Cursor.focusEndOfGeneric(d),setTimeout(function(){return t.AutoScroll.scrollGeneric(l,d)})),l.resetRecording(c)}},{key:"checkIfMatchesSubstring",value:function(l,c){return c.includes(l)}},{key:"checkIfMatchesWord",value:function(l,c,u){for(var d=l,f=u.length-1;f>=0;f-=1){for(var h=f,p=d.length-1;u[h]===d[p]&&p>=0;)h-=1,p-=1;if(p<0)return!0}return!1}},{key:"execCommand",value:function(l,c,u,d,f){var h,p,m,g=l.commands;if(!(!g||!d||!u)){var w=((h=g.settings)===null||h===void 0?void 0:h.caseSensitive)===!0?c:c.toLowerCase(),C=i.Text.breakupIntoWordsArr(w),T=((p=g.settings)===null||p===void 0?void 0:p.substrings)===!1?s.checkIfMatchesWord:s.checkIfMatchesSubstring;if(g.commandMode&&T(g.commandMode,w,C))return l.setInterimColorToFinal(),setTimeout(function(){return s.toggleCommandModeOn(l)}),{doNotProcessTranscription:!1};if(!(g.commandMode&&!l.isWaitingForCommand)){if(g.stop&&T(g.stop,w,C))return s.toggleCommandModeOff(l),setTimeout(function(){return l.stop()}),{doNotProcessTranscription:!1};if(g.pause&&T(g.pause,w,C))return s.toggleCommandModeOff(l),l.setInterimColorToFinal(),setTimeout(function(){var I;l.isPaused=!0,(I=l.onPauseTrigger)===null||I===void 0||I.call(l,!0)}),{doNotProcessTranscription:!1};if(g.resume&&T(g.resume,w,C))return l.isPaused=!1,(m=l.onPauseTrigger)===null||m===void 0||m.call(l,!1),s.toggleCommandModeOff(l),l.resetRecording(u),{doNotProcessTranscription:!0};if(g.reset&&T(g.reset,w,C))return f!==void 0&&s.setText(l,u,f,d),{doNotProcessTranscription:!0};if(g.removeAllText&&T(g.removeAllText,w,C))return s.setText(l,u,"",d),{doNotProcessTranscription:!0}}}}}])})();return Bh.CommandUtils=o,Bh}var $h={},VN;function Wq(){if(VN)return $h;VN=1,Object.defineProperty($h,"__esModule",{value:!0}),$h.Highlight=void 0;var t=uy(),n=dy(),e=(function(){function r(){k(this,r)}return M(r,null,[{key:"setStateForPrimitive",value:function(o,s){var a,l;s.selectionStart!==null&&(a=s.selectionStart),s.selectionEnd!==null&&(l=s.selectionEnd),o.isHighlighted=a!==l}},{key:"setStateForGeneric",value:function(o,s){var a=window.getSelection();if(a!=null&&a.focusNode){var l=n.Cursor.getGenericElementCursorOffset(s,a,!0),c=n.Cursor.getGenericElementCursorOffset(s,a,!1);o.isHighlighted=l!==c}}},{key:"setState",value:function(o,s){document.activeElement===s&&(t.Elements.isPrimitiveElement(s)?r.setStateForPrimitive(o,s):r.setStateForGeneric(o,s))}},{key:"removeForGeneric",value:function(o,s){var a=window.getSelection();if(a){var l=n.Cursor.getGenericElementCursorOffset(s,a,!0);a.deleteFromDocument(),n.Cursor.setOffsetForGeneric(s,l),o.isHighlighted=!1}}},{key:"removeForPrimitive",value:function(o,s){var a=s.selectionStart,l=s.selectionEnd,c=s.value;if(a&&l){var u=c.substring(0,a)+c.substring(l);s.value=u,n.Cursor.setOffsetForPrimitive(s,a,o.autoScroll)}o.isHighlighted=!1}}])})();return $h.Highlight=e,$h}var zh={},UN;function Gq(){if(UN)return zh;UN=1,Object.defineProperty(zh,"__esModule",{value:!0}),zh.Padding=void 0;var t=uy(),n=dy(),e=cy(),r=(function(){function i(){k(this,i)}return M(i,null,[{key:"setStateForPrimitiveElement",value:function(s,a){if(document.activeElement===a&&a.selectionStart!==null){var l=a.selectionStart,c=a.value[l-1],u=a.selectionEnd===null?l:a.selectionEnd,d=a.value[u];e.Text.isCharDefined(c)&&(s.startPadding=" ",s.numberOfSpacesBeforeNewText=1),e.Text.isCharDefined(d)&&(s.endPadding=" ",s.numberOfSpacesAfterNewText=1),s.isCursorAtEnd=a.value.length===u;return}var f=a.value[a.value.length-1];e.Text.isCharDefined(f)&&(s.startPadding=" ",s.numberOfSpacesBeforeNewText=1),s.isCursorAtEnd=!0}},{key:"setStateForGenericElement",value:function(s,a){var l,c,u;if(document.activeElement===a){var d=window.getSelection();if(d!=null&&d.focusNode){var f=n.Cursor.getGenericElementCursorOffset(a,d,!0),h=(l=a.textContent)===null||l===void 0?void 0:l[f-1],p=n.Cursor.getGenericElementCursorOffset(a,d,!1),m=(c=a.textContent)===null||c===void 0?void 0:c[p];e.Text.isCharDefined(h)&&(s.startPadding=" "),e.Text.isCharDefined(m)&&(s.endPadding=" "),s.isCursorAtEnd=((u=a.textContent)===null||u===void 0?void 0:u.length)===p;return}}var g=a.innerText.charAt(a.innerText.length-1);e.Text.isCharDefined(g)&&(s.startPadding=" "),s.isCursorAtEnd=!0}},{key:"setState",value:function(s,a){t.Elements.isPrimitiveElement(a)?i.setStateForPrimitiveElement(s,a):i.setStateForGenericElement(s,a)}}
246,{key:"adjustStateAfterRecodingPrimitiveElement",value:function(s,a){if(s.primitiveTextRecorded=!0,s.insertInCursorLocation&&document.activeElement===a&&(a.selectionEnd!==null&&(s.endPadding=s.endPadding+a.value.slice(a.selectionEnd)),a.selectionStart!==null)){s.startPadding=a.value.slice(0,a.selectionStart)+s.startPadding;return}s.startPadding=a.value+s.startPadding}},{key:"adjustSateForNoTextPrimitiveElement",value:function(s){s.numberOfSpacesBeforeNewText===1&&(s.startPadding=s.startPadding.substring(0,s.startPadding.length-1),s.numberOfSpacesBeforeNewText=0),s.numberOfSpacesAfterNewText===1&&(s.endPadding=s.endPadding.substring(1),s.numberOfSpacesAfterNewText=0)}}])})();return zh.Padding=r,zh}var HN;function fF(){if(HN)return Fh;HN=1,Object.defineProperty(Fh,"__esModule",{value:!0}),Fh.Speech=void 0;var t=zq(),n=qq(),e=hF(),r=dF(),i=Wq(),o=uy(),s=Gq(),a=eD(),l=dy(),c=cy(),u=(function(){function d(){k(this,d),this.finalTranscript="",this.interimSpan=o.Elements.createInterimSpan(),this.finalSpan=o.Elements.createGenericSpan(),this.scrollingSpan=o.Elements.createGenericSpan(),this.isCursorAtEnd=!1,this.spansPopulated=!1,this.startPadding="",this.endPadding="",this.numberOfSpacesBeforeNewText=0,this.numberOfSpacesAfterNewText=0,this.isHighlighted=!1,this.primitiveTextRecorded=!1,this.recognizing=!1,this._displayInterimResults=!0,this.insertInCursorLocation=!0,this.autoScroll=!0,this.isRestarting=!1,this.isPaused=!1,this.isWaitingForCommand=!1,this.isTargetInShadow=!1,this.cannotBeStopped=!1,this.resetState()}return M(d,[{key:"prepareBeforeStart",value:function(h){var p,m;if(h!=null&&h.element)if(t.EventListeners.add(this,h),Array.isArray(h.element)){var g=h.element.find(function(w){return w===document.activeElement})||h.element[0];if(!g)return;this.prepare(g)}else this.prepare(h.element);h?.displayInterimResults!==void 0&&(this._displayInterimResults=h.displayInterimResults),h!=null&&h.textColor&&(this._finalTextColor=(p=h?.textColor)===null||p===void 0?void 0:p.final,o.Elements.applyCustomColors(this,h.textColor)),h?.insertInCursorLocation!==void 0&&(this.insertInCursorLocation=h.insertInCursorLocation),h?.autoScroll!==void 0&&(this.autoScroll=h.autoScroll),this._onResult=h?.onResult,this._onPreResult=h?.onPreResult,this._onStart=h?.onStart,this._onStop=h?.onStop,this._onError=h?.onError,this.onCommandModeTrigger=h?.onCommandModeTrigger,this.onPauseTrigger=h?.onPauseTrigger,this._options=h,!((m=this._options)===null||m===void 0)&&m.commands&&(this.commands=e.CommandUtils.process(this._options.commands))}},{key:"prepare",value:function(h){s.Padding.setState(this,h),i.Highlight.setState(this,h),this.isTargetInShadow=o.Elements.isInsideShadowDOM(h),o.Elements.isPrimitiveElement(h)?(this._primitiveElement=h,this._originalText=this._primitiveElement.value):(this._genericElement=h,this._originalText=this._genericElement.textContent)}},{key:"resetRecording",value:function(h){this.isRestarting=!0,this.stop(!0),this.resetState(!0),this.start(h,!0)}},{key:"updateElements",value:function(h,p,m){var g,w=c.Text.capitalize(p);if(!(this.finalTranscript===w&&h==="")){n.PreResultUtils.process(this,m,h==="",this._onPreResult,this._options)&&(h="",m="");var C=this.commands&&e.CommandUtils.execCommand(this,m,this._options,this._primitiveElement||this._genericElement,this._originalText);if(C){if(C.doNotProcessTranscription)return;h="",m=""}if(!(this.isPaused||this.isWaitingForCommand)){(g=this._onResult)===null||g===void 0||g.call(this,m,h===""),this.finalTranscript=w,this._displayInterimResults||(h="");var T=this.finalTranscript===""&&h==="";this._primitiveElement?this.updatePrimitiveElement(this._primitiveElement,h,T):this._genericElement&&this.updateGenericElement(this._genericElement,h,T)}}}},{key:"updatePrimitiveElement",value:function(h,p,m){this.isHighlighted&&i.Highlight.removeForPrimitive(this,h),this.primitiveTextRecorded||s.Padding.adjustStateAfterRecodingPrimitiveElement(this,h),m&&s.Padding.adjustSateForNoTextPrimitiveElement(this);var g=this.startPadding+this.finalTranscript+p;if(h.value=g+this.endPadding,!this.isTargetInShadow){var w=g.length+this.numberOfSpacesAfterNewText;l.Cursor.setOffsetForPrimitive(h,w,this.autoScroll)}this.autoScroll&&a.Browser.IS_SAFARI()&&this.isCursorAtEnd&&r.AutoScroll.scrollSafariPrimitiveToEnd(h)}},{key:"updateGenericElement",value:function(h,p,m){this.isHighlighted&&i.Highlight.removeForGeneric(this,h),this.spansPopulated||o.Elements.appendSpans(this,h);var g=(m?"":this.startPadding)+c.Text.lineBreak(this.finalTranscript);this.finalSpan.innerHTML=g;var w=r.AutoScroll.isRequired(this.autoScroll,h);r.AutoScroll.changeStateIfNeeded(this,w);var C=c.Text.lineBreak(p)+(m?"":this.endPadding);this.interimSpan.innerHTML=C,a.Browser.IS_SAFARI()&&this.insertInCursorLocation&&l.Curs
246or.setOffsetForSafariGeneric(h,g.length+C.length),w&&r.AutoScroll.scrollGeneric(this,h),m&&(this.scrollingSpan.innerHTML="")}},{key:"finalise",value:function(h){this._genericElement&&(h?(this.finalSpan=o.Elements.createGenericSpan(),this.setInterimColorToFinal(),this.interimSpan=o.Elements.createInterimSpan(),this.scrollingSpan=o.Elements.createGenericSpan()):this._genericElement.textContent=this._genericElement.textContent,this.spansPopulated=!1),t.EventListeners.remove(this)}},{key:"setInterimColorToFinal",value:function(){this.interimSpan.style.color=this._finalTextColor||"black"}},{key:"resetState",value:function(h){this._primitiveElement=void 0,this._genericElement=void 0,this.finalTranscript="",this.finalSpan.innerHTML="",this.interimSpan.innerHTML="",this.scrollingSpan.innerHTML="",this.startPadding="",this.endPadding="",this.isHighlighted=!1,this.primitiveTextRecorded=!1,this.numberOfSpacesBeforeNewText=0,this.numberOfSpacesAfterNewText=0,h||(this.stopTimeout=void 0)}},{key:"setStateOnStart",value:function(){var h;this.recognizing=!0,this.isRestarting?this.isRestarting=!1:(h=this._onStart)===null||h===void 0||h.call(this)}},{key:"setStateOnStop",value:function(){var h;this.recognizing=!1,this.isRestarting||(h=this._onStop)===null||h===void 0||h.call(this)}},{key:"setStateOnError",value:function(h){var p;(p=this._onError)===null||p===void 0||p.call(this,h),this.recognizing=!1}}])})();return Fh.Speech=u,Fh}var $N;function Kq(){if($N)return xh;$N=1,Object.defineProperty(xh,"__esModule",{value:!0}),xh.WebSpeech=void 0;var t=$q(),n=eD(),e=fF(),r=(function(i){function o(){return k(this,o),K(this,o)}return J(o,i),M(o,[{key:"start",value:function(a){var l;this._extractText===void 0&&(this._extractText=n.Browser.IS_SAFARI()?t.WebSpeechTranscript.extractSafari:t.WebSpeechTranscript.extract),this.validate()&&(this.prepareBeforeStart(a),this.instantiateService(a),(l=this._service)===null||l===void 0||l.start(),this._translations=a?.translations)}},{key:"validate",value:function(){return o.getAPI()?!0:(this.error("Speech Recognition is unsupported"),!1)}},{key:"instantiateService",value:function(a){var l,c,u=o.getAPI();this._service=new u,this._service.continuous=!0,this._service.interimResults=(l=a?.displayInterimResults)!==null&&l!==void 0?l:!0,this._service.lang=((c=a?.language)===null||c===void 0?void 0:c.trim())||"en-US",this.setEvents()}},{key:"setEvents",value:function(){var a=this;this._service&&(this._service.onstart=function(){a.setStateOnStart()},this._service.onerror=function(l){n.Browser.IS_SAFARI()&&l.message==="Another request is started"||l.error==="aborted"&&a.isRestarting||l.error!=="no-speech"&&a.error(l.message||l.error)},this._service.onaudioend=function(){a.setStateOnStop()},this._service.onend=function(){a._stopping=!1},this._service.onresult=function(l){if(B(l.results)>"u"&&a._service)a._service.onend=null,a._service.stop();else if(a._extractText&&!a._stopping){var c=a._extractText(l,a.finalTranscript,a._translations),u=c.interimTranscript,d=c.finalTranscript,f=c.newText;a.updateElements(u,d,f)}})}},{key:"stop",value:function(a){var l;this._stopping=!0,(l=this._service)===null||l===void 0||l.stop(),this.finalise(a)}},{key:"error",value:function(a){console.error(a),this.setStateOnError(a),this.stop()}}],[{key:"getAPI",value:function(){return window.webkitSpeechRecognition||window.SpeechRecognition}}])})(e.Speech);return xh.WebSpeech=r,xh}var qh={},zN;function Jq(){if(zN)return qh;zN=1,Object.defineProperty(qh,"__esModule",{value:!0}),qh.GlobalState=void 0;var t=(function(){function n(){k(this,n)}return M(n,null,[{key:"doubleClickDetector",value:function(){return n.doubleClickPending?!0:(n.doubleClickPending=!0,setTimeout(function(){n.doubleClickPending=!1},300),!1)}}])})();return qh.GlobalState=t,t.doubleClickPending=!1,qh}var Wh={},Gh={},qN;function Yq(){if(qN)return Gh;qN=1,Object.defineProperty(Gh,"__esModule",{value:!0}),Gh.PreventConnectionStop=void 0;var t=(function(){function n(){k(this,n)}return M(n,null,[{key:"applyPrevention",value:function(r){clearTimeout(r._manualConnectionStopPrevention),r.cannotBeStopped=!0,r._manualConnectionStopPrevention=setTimeout(function(){r.cannotBeStopped=!1},800)}},{key:"clearPrevention",value:function(r){clearTimeout(r._manualConnectionStopPrevention),r.cannotBeStopped=!1}}])})();return Gh.PreventConnectionStop=t,Gh}var Kh={},jv={},WN;
246function Zq(){return WN||(WN=1,Object.defineProperty(jv,"__esModule",{value:!0}),jv.README_URL=void 0,jv.README_URL="https://github.com/OvidijusParsiunas/speech-to-element"),jv}var GN;function Xq(){if(GN)return Kh;GN=1,Object.defineProperty(Kh,"__esModule",{value:!0}),Kh.AzureSpeechConfig=void 0;var t=Zq(),n=(function(){function e(){k(this,e)}return M(e,null,[{key:"validateOptions",value:function(i,o){return o?!o.subscriptionKey&&!o.token&&!o.retrieveToken?(i("Please define a 'subscriptionKey', 'token' or 'retrieveToken' property - more info: ".concat(t.README_URL)),!1):o.region?!0:(i("Please define a 'region' property - more info: ".concat(t.README_URL)),!1):(i("Please provide subscription details - more info: ".concat(t.README_URL)),!1)}},{key:"getNewSpeechConfig",value:(function(){var r=D(v().m(function o(s,a){return v().w(function(l){for(;;)switch(l.n){case 0:if(!a.region){l.n=1;break}return l.a(2,a.subscriptionKey?s.fromSubscription(a.subscriptionKey.trim(),a.region.trim()):a.token?s.fromAuthorizationToken(a.token.trim(),a.region.trim()):a.retrieveToken?a.retrieveToken().then(function(c){return a.region?s.fromAuthorizationToken(c?.trim()||"",a.region.trim()):null}).catch(function(c){return console.error(c),null}):null);case 1:return l.a(2)}},o)}));function i(o,s){return r.apply(this,arguments)}return i})()},{key:"process",value:function(i,o){o.endpointId&&(i.endpointId=o.endpointId.trim()),o.language&&(i.speechRecognitionLanguage=o.language.trim())}},{key:"get",value:(function(){var r=D(v().m(function o(s,a){var l;return v().w(function(c){for(;;)switch(c.n){case 0:return c.n=1,e.getNewSpeechConfig(s,a);case 1:return l=c.v,c.a(2,(l&&e.process(l,a),l))}},o)}));function i(o,s){return r.apply(this,arguments)}return i})()}])})();return Kh.AzureSpeechConfig=n,Kh}var Jh={},KN;function Qq(){if(KN)return Jh;KN=1,Object.defineProperty(Jh,"__esModule",{value:!0}),Jh.StopTimeout=void 0;var t=(function(){function n(){k(this,n)}return M(n,null,[{key:"set",value:function(r){r.stopTimeout=setTimeout(function(){return r.stop()},r.stopTimeoutMS)}},{key:"reset",value:function(r,i){r.stopTimeoutMS=i||n.DEFAULT_MS,n.stop(r),n.set(r)}},{key:"stop",value:function(r){r.stopTimeout&&clearTimeout(r.stopTimeout)}}])})();return Jh.StopTimeout=t,t.DEFAULT_MS=2e4,Jh}var Yh={},JN;function eW(){if(JN)return Yh;JN=1,Object.defineProperty(Yh,"__esModule",{value:!0}),Yh.AzureAudioConfig=void 0;var t=(function(){function n(){k(this,n)}return M(n,null,[{key:"get",value:function(r,i){return i?r.fromMicrophoneInput(i):r.fromDefaultMicrophoneInput()}}])})();return Yh.AzureAudioConfig=t,Yh}var Zh={},YN;function tW(){if(YN)return Zh;YN=1,Object.defineProperty(Zh,"__esModule",{value:!0}),Zh.AzureTranscript=void 0;var t=uF(),n=(function(){function e(){k(this,e)}return M(e,null,[{key:"extract",value:function(i,o,s,a){return a&&(i=t.Translate.translate(i,a)),s?{interimTranscript:"",finalTranscript:o+i,newText:i}:{interimTranscript:i,finalTranscript:o,newText:i}}}])})();return Zh.AzureTranscript=n,Zh}var ZN;function nW(){if(ZN)return Wh;ZN=1,Object.defineProperty(Wh,"__esModule",{value:!0}),Wh.Azure=void 0;var t=Yq(),n=Xq(),e=Qq(),r=eW(),i=tW(),o=fF(),s=(function(a){function l(){var c;return k(this,l),c=K(this,l,arguments),c._newTextPadding="",c}return J(l,a),M(l,[{key:"start",value:function(u,d){this._newTextPadding="",this.stopTimeout===void 0&&e.StopTimeout.reset(this,u?.stopAfterSilenceMs),this.prepareBeforeStart(u),this.startAsync(u),d||t.PreventConnectionStop.applyPrevention(this)}},{key:"startAsync",value:(function(){var c=D(v().m(function d(f){var h,p;return v().w(function(m){for(;;)switch(m.n){case 0:if(p=this.validate(f),!p){m.n=2;break}return m.n=1,this.instantiateService(f);case 1:this._translations=f?.translations,(h=this._service)===null||h===void 0||h.startContinuousRecognitionAsync(function(){},this.error);case 2:return m.a(2)}},d,this)}));function u(d){return c.apply(this,arguments)}return u})()},{key:"validate",value:function(u){return l.getAPI()?n.AzureSpeechConfig.validateOptions(this.error.bind(this),u):(this.moduleNotFound(),!1)}},{key:"instantiateService",value:(function(){var c=D(v().m(function d(f){var h,p,m,g,w,C,T,I,F;return v().w(function($){for(;;)switch($.n){case 0:return h=l.getAPI(),p=r.AzureAudioConfig.get(h.AudioConfig,f.deviceId),$.n=1,n.AzureSpeechConfig.get(h.SpeechConfig,f);case 1:m=$.v,m?(f.autoLanguage&&f.autoLanguage.languages.length>0?(w=f.autoLanguage,C=w.type,T=w.languages,I=T.slice(0,C==="Continuous"?10:4),F=h.AutoDetectSourceLanguageConfig.fromLanguages(I),C==="Continuous"&&(F.mode=1),g=h.SpeechRecognizer.FromConfig(m,F,p)):g=new h.SpeechRecognizer(m,p),this.setEvents(g),this._service=g,f.retrieveToken&&this.retrieveTokenInterval(f.retrieveToken)):this.error("Unable to contact Azure server");case 2:return $.a(2)}},d,this)}));function u(d){return c.apply(this,arguments)}return u})()},{key:"setEvents",value:function(u){u.recognizing=this.onRecognizing.bind(this),u.recognized=this.onRecognized.bind(this),u.sessionStarted=this.onSessionStarted.bind(this),u.canceled=this.onCanceled.bind(this),u.sessionStopped=this.onSessionStopped.bind(this)}},{key:"onRecognizing",value:function(u,d){if(!this._stopping){var f=i.AzureTranscript.extract(this._newTextPadding+d.result.text,this.finalTranscript,!1,this._translations),h=f.interimTranscript,p=f.finalTranscript,m=f.newText;e.StopTimeout.reset(this,this.stopTimeoutMS),this.updateElements(h,p,m)}}},{key:"onRecognized",value:function(u,d){var f=d.result;switch(f.reason){case window.SpeechSDK.ResultReason.Canceled:break;case window.SpeechSDK.ResultReason.RecognizedSpeech:if(f.text&&!this._stopping){var h=i.AzureTranscript.extract(this._newTextPadding+f.text,this.finalTranscript,!0,this._translations),p=h.interimTranscript,m=h.finalTranscript,g=h.newText;e.StopTimeout.reset(this,this.stopTimeoutMS),this.updateElements(p,m,g),m!==""&&(this._newTextPadding=" ")}break}}},{key:"onCanceled",value:function(u,d){d.reason===window.SpeechSDK.CancellationReason.Error&&this.error(d.errorDetails)}},{key:"onSessionStarted",value:function(){t.PreventConnectionStop.clearPrevention(this),this.setStateOnStart()}},{key:"onSessionStopped",value:function(){this._retrieveTokenInterval||clearInterval(this._retrieveTokenInterval),this._stopping=!1,this.setStateOnStop()}},{key:"retrieveTokenInterval",value:function(u){var d=this;this._retrieveTokenInterval=setInterval(function(){u?.().then(function(f){d._service&&(d._service.authorizationToken=f?.trim()||"")}).catch(function(f){d.error(f)})},1e4)}},{key:"stop",value:function(u){var d;!u&&this._retrieveTokenInterval&&clearInterval(this._retrieveTokenInterval),this._stopping=!0,(d=this._service)===null||d===void 0||d.stopContinuousRecognitionAsync(),e.StopTimeout.stop(this),this.finalise(u)}},{key:"moduleNotFound",value:function(){console.error("speech recognition module not found:"),console.error(`please install the 'microsoft-cognitiveservices-speech-sdk' npm package or add a script tag: <script src="https://aka.ms/csspeech/jsbrowserpackageraw"><\/script>`),this.setStateOnError("speech recognition module not found")}},{key:"error",value:function(u){this._retrieveTokenInterval&&clearInterval(this._retrieveTokenInterval),console.error(u),this.setStateOnError(u),this.stop()}}],[{key:"getAPI",value:function(){return window.SpeechSDK}}])})(o.Speech);return Wh.Azure=s,Wh}var XN;function rW(){if(XN)return Lv;
246XN=1,Object.defineProperty(Lv,"__esModule",{value:!0});var t=Kq(),n=hF(),e=Jq(),r=nW(),i=(function(){function o(){k(this,o)}return M(o,null,[{key:"toggle",value:function(a,l){var c,u,d=a.toLocaleLowerCase().trim();!((c=e.GlobalState.service)===null||c===void 0)&&c.recognizing?this.stop():d==="webspeech"?o.startWebSpeech(l):d==="azure"?o.startAzure(l):(console.error("service not found - must be either 'webspeech' or 'azure'"),(u=l?.onError)===null||u===void 0||u.call(l,"service not found - must be either 'webspeech' or 'azure'"))}},{key:"startWebSpeech",value:function(a){o.stop()||(e.GlobalState.service=new t.WebSpeech,e.GlobalState.service.start(a))}},{key:"isWebSpeechSupported",value:function(){return!!t.WebSpeech.getAPI()}},{key:"startAzure",value:function(a){var l;o.stop()||!((l=e.GlobalState.service)===null||l===void 0)&&l.cannotBeStopped||(e.GlobalState.service=new r.Azure,e.GlobalState.service.start(a))}},{key:"stop",value:function(){var a;return e.GlobalState.doubleClickDetector()?!0:(!((a=e.GlobalState.service)===null||a===void 0)&&a.recognizing&&e.GlobalState.service.stop(),!1)}},{key:"endCommandMode",value:function(){e.GlobalState.service&&n.CommandUtils.toggleCommandModeOff(e.GlobalState.service)}}])})();return Lv.default=i,Lv}var iW=rW(),Jv=Hq(iW),oW=(function(){function t(n,e){k(this,t),this._silenceMS=2e3,this._stop=!0,typeof e=="boolean"&&e===!1&&(this._stop=!1),typeof n=="number"&&(this._silenceMS=n)}return M(t,[{key:"setSilenceTimeout",value:function(e,r){var i=this;this._silenceTimeout=setTimeout(function(){var o;(o=e.submit)==null||o.call(e),Jv.stop(),i._stop||setTimeout(r,tD.MICROPHONE_RESET_TIMEOUT_MS)},this._silenceMS)}},{key:"clearSilenceTimeout",value:function(){this._silenceTimeout&&clearTimeout(this._silenceTimeout)}},{key:"resetSilenceTimeout",value:function(e,r){this.clearSilenceTimeout(),this.setSilenceTimeout(e,r)}},{key:"onPause",value:function(e,r,i){e?this.resetSilenceTimeout(r,i):this.clearSilenceTimeout()}}])})(),pF=(function(t){function n(e,r,i){var o;k(this,n);var s=B(e.speechToText)=="object"?e.speechToText:{};o=K(this,n,[s?.button]);var a=o.processConfiguration(r,e.speechToText),l=a.serviceName,c=a.processedConfig;if(o._addErrorMessage=i,l==="webspeech"&&!Jv.isWebSpeechSupported())o.changeToUnsupported();else{var u=!e.textInput||!e.textInput.disabled;rt.assignButtonEvents(o.elementRef,o.buttonClick.bind(o,r,u,l,c))}return setTimeout(function(){o._validationHandler=e._validationHandler}),o}return J(n,t),M(n,[{key:"processConfiguration",value:function(r,i){var o,s,a,l,c,u,d=B(i)=="object"?i:{},f=B(d.webSpeech)=="object"?d.webSpeech:{},h=d.azure||{},p=Je(Je({displayInterimResults:(o=d.displayInterimResults)!==null&&o!==void 0?o:void 0,textColor:(s=d.textColor)!==null&&s!==void 0?s:void 0,translations:(a=d.translations)!==null&&a!==void 0?a:void 0,commands:(l=d.commands)!==null&&l!==void 0?l:void 0,events:(c=d.events)!==null&&c!==void 0?c:void 0},f),h),m=(u=d.commands)==null?void 0:u.submit;return m&&(p.onPreResult=function(g){return g.toLowerCase().includes(m)?(setTimeout(function(){var w;return(w=r.submit)==null?void 0:w.call(r)}),Jv.endCommandMode(),{restart:!0,removeNewText:!0}):null}),d.submitAfterSilence&&(this._silenceSubmit=new oW(d.submitAfterSilence,d.stopAfterSubmit)),{serviceName:n.getServiceName(d),processedConfig:p}}},{key:"buttonClick",value:function(r,i,o,s){var a=this,l=s?.events;r.removePlaceholderStyle(),Jv.toggle(o,Je({insertInCursorLocation:!1,element:i?r.inputElementRef:void 0,onError:function(){var u;a.onError(),(u=a._silenceSubmit)==null||u.clearSilenceTimeout()},onStart:function(){var u;a.changeToActive(),(u=l?.onStart)==null||u.call(l)},onStop:function(){var u,d,f;(u=a._validationHandler)==null||u.call(a),(d=a._silenceSubmit)==null||d.clearSilenceTimeout(),a.changeToDefault(),(f=l?.onStop)==null||f.call(l)},onPauseTrigger:function(u){var d,f;(d=a._silenceSubmit)==null||d.onPause(u,r,a.elementRef.onclick),(f=l?.onPauseTrigger)==null||f.call(l,u)},onPreResult:function(u,d){var f;(f=l?.onPreResult)==null||f.call(l,u,d)},onResult:function(u,d){var f,h,p;d&&((f=a._validationHandler)==null||f.call(a)),(h=a._silenceSubmit)==null||h.resetSilenceTimeout(r,a.elementRef.onclick),(p=l?.onResult)==null||p.call(l,u,d)},onCommandModeTrigger:function(u){var d;a.onCommandModeTrigger(u),(d=l?.onCommandModeTrigger)==null||d.call(l,u)}}
246,s))}},{key:"onCommandModeTrigger",value:function(r){r?this.changeToCommandMode():this.changeToActive()}},{key:"onError",value:function(){this._addErrorMessage("speechToText","speech input error")}}],[{key:"getServiceName",value:function(r){return r.azure?"azure":"webspeech"}},{key:"toggleSpeechAfterSubmit",value:function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;r[ht](),i||setTimeout(function(){return r[ht]()},n.MICROPHONE_RESET_TIMEOUT_MS)}}])})(cF);pF.MICROPHONE_RESET_TIMEOUT_MS=300;var tD=pF,nD=(function(){function t(n,e,r,i,o){var s=this;k(this,t),this._attachments=[],this._fileCountLimit=99,this._acceptedFormat="",this._hiddenAttachments=new Set,r.maxNumberOfFiles&&(this._fileCountLimit=r.maxNumberOfFiles),this._toggleContainerDisplay=i,this._fileAttachmentsContainerRef=o,r.acceptedFormats&&(this._acceptedFormat=r.acceptedFormats),setTimeout(function(){s._validationHandler=n._validationHandler,s._onInput=e.onInput})}return M(t,[{key:"attemptAddFile",value:function(e,r){var i;return t.isFileTypeValid(e,this._acceptedFormat)?(this.addAttachmentBasedOnType(e,r,!0),(i=this._onInput)==null||i.call(this,!0),!0):!1}},{key:"addAttachmentBasedOnType",value:function(e,r,i){var o=t.getTypeFromBlob(e);if(o===it){var s=t.createImageAttachment(r);this.addFileAttachment(e,it,s,i)}else if(o===$e){var a=OS.createAudioAttachment(r);this.addFileAttachment(e,$e,a,i)}else{var l=t.createAnyFileAttachment(e.name);this.addFileAttachment(e,nl,l,i)}}},{key:"addFileAttachment",value:function(e,r,i,o){var s,a=t.createContainer(i);if(this._attachments.length>=this._fileCountLimit){var l=this._attachments[this._attachments.length-1].removeButton;l?.[ht]();var c=this._fileAttachmentsContainerRef.children;this._fileAttachmentsContainerRef.insertBefore(a,c[0])}else this._fileAttachmentsContainerRef.appendChild(a);var u={file:e,attachmentContainerElement:a,fileType:r};return o&&(u.removeButton=this.createRemoveAttachmentButton(u),a.appendChild(u.removeButton)),this._toggleContainerDisplay(!0),this._attachments.push(u),this._fileAttachmentsContainerRef.scrollTop=this._fileAttachmentsContainerRef.scrollHeight,(s=this._validationHandler)==null||s.call(this),u}},{key:"createRemoveAttachmentButton",value:function(e){var r=U();r[S].add("remove-file-attachment-button"),r.onclick=this.removeAttachment.bind(this,e);var i=U();return i[S].add("x-icon"),i.innerText="\xD7",r.appendChild(i),r}},{key:"removeAttachment",value:function(e,r){var i,o,s=this._attachments.findIndex(function(l){return l===e});if(!(s<0)){(i=this._onInput)==null||i.call(this,!!(r!=null&&r.isTrusted));var a=this._attachments[s].attachmentContainerElement;this._attachments.splice(s,1),OS.stopAttachmentPlayback(a),a.remove(),this._toggleContainerDisplay(!1),(o=this._validationHandler)==null||o.call(this)}}},{key:"getFiles",value:function(){return Array.from(this._attachments).map(function(e){return _(_({},Bt,e[Bt]),"type",e.fileType)})}},{key:"hideAttachments",value:function(){var e=this;this._hiddenAttachments.clear(),this._attachments.forEach(function(r){setTimeout(function(){var i;return(i=r.removeButton)==null?void 0:i[ht]()}),e._hiddenAttachments.add(r)})}},{key:"removeAttachments",value:function(){this._attachments.forEach(function(e){setTimeout(function(){var r;return(r=e.removeButton)==null?void 0:r[ht]()})}),this._hiddenAttachments.clear()}},{key:"readdAttachments",value:function(){var e=this,r;Array.from(this._hiddenAttachments).forEach(function(i){e._fileAttachmentsContainerRef.appendChild(i.attachmentContainerElement),e._attachments.push(i)}),(r=this._onInput)==null||r.call(this,!1),this._hiddenAttachments.clear()}}],[{key:"isFileTypeValid",value:function(e,r){if(r==="")return!0;for(var i=r.split(","),o=0;o<i.length;o++){var s=i[o].trim();if(e.type===s)return!0;if(s.startsWith(".")){var a=s.slice(1);if(e.name.endsWith(a))return!0}else if(e.name.endsWith(s)||s.endsWith("/*")&&e.type.startsWith(s.slice(0,-2)))return!0}return!1}},{key:"getTypeFromBlob",value:function(e){var r=e.type;return r.startsWith(it)?it:r.startsWith($e)?$e:nl}},{key:"createImageAttachment",value:function(e){var r=new Image;return r[Y]=e,r[S].add("image-attachment"),r}},{key:"createAnyFileAttachment",value:function(e){var r=U();r[S].add("border-bound-attachment"),Xr.IS_SAFARI&&r[S].add("border-bound-attachment-safari");var i=U();i[S].add("any-file-attachment-text");var o=U();return o[S].add("file-attachment-text-container"),o.appendChild(i),i.textContent=e,r.appendChild(o),r}},{key:"createContainer",value:function(e){var r=U();return r[S].add("file-attachment"),r.appendChild(e),r}}])})(),mF=(function(t){function n(e,r,i,o,s){return k(this,n),K(this,n,[e,r,i,o,s])}return J(n,t),M(n,[{key:"createTimer",value:function(r,i){var o=this,s=0,a=i!==void 0&&i<n.TIMER_LIMIT_S?i:n.TIMER_LIMIT_S;return setInterval(function(){var l;s+=1,s===a&&((l=o.stopPlaceholderCallback)==null||l.call(o),o.clearTimer()),s===600&&r[S].add("audio-placeholder-text-4-digits");var c=Math.floor(s/60),u=(s%60).toString().padStart(2,"0");r.textContent="".concat(c,":").concat(u)},1e3)}},{key:"createPlaceholderAudioAttachment",value:function(r){var i=n.createAudioContainer(),o=U();o[S].add("audio-placeholder-text-3-digits");var s=U();s[S].add("file-attachment-text-container","audio-placeholder-text-3-digits-container"),s.appendChild(o);var a=ko.createSVGElement(AS);return a[S].add("attachment-icon","stop-icon","not-removable-attachment-icon"),o.textContent="0:00",this._activePlaceholderTimer=this.createTimer(o,r),i.appendChild(s),this.addPlaceholderAudioAttachmentEvents(i,a,s),i}},{key:"addPlaceholderAudioAttachmentEvents",value:function(r,i,o){var s=this,a=function(){return r.replaceChildren(i)};r.addEventListener("mouseenter",a);var l=function(){return r.replaceChildren(o)};r.addEventListener("mouseleave",l);var c=function(){var d;return(d=s.stopPlaceholderCallback)==null?void 0:d.call(s)};r.addEventListener(ht,c)}},{key:"addPlaceholderAttachment",value:function(r,i){var o=this.createPlaceholderAudioAttachment(i);this._activePlaceholderAttachment=this.addFileAttachment(new File([],""),$e,o,!1),this.stopPlaceholderCallback=r}},{key:"completePlaceholderAttachment",value:function(r,i){var o=this._activePlaceholderAttachment;o&&(o[Bt]=r,n.addAudioElements(o.attachmentContainerElement.children[0],i),o.removeButton=this.createRemoveAttachmentButton(o),o.attachmentContainerElement.appendChild(o.removeButton),this._activePlaceholderAttachment=void 0,this.clearTimer())}},{key:"removePlaceholderAttachment",value:function(){this._activePlaceholderAttachment&&(this.removeAttachment(this._activePlaceholderAttachment),this._activePlaceholderAttachment=void 0,this.clearTimer())}},{key:"clearTimer",value:function(){this._activePlaceholderTimer!==void 0&&(clearInterval(this._activePlaceholderTimer),this._activePlaceholderTimer=void 0,this.stopPlaceholderCallback=void 0)}}],[{key:"createAudioContainer",value:function(){var r=U();return r[S].add("border-bound-attachment","audio-attachment-icon-container"),Xr.IS_SAFARI&&r[S].add("border-bound-attachment-safari"),r}},{key:"addAudioElements",value:function(r,i){var o=r.parentElement?rt.cloneElement(r):r,s=U($e);s[Y]=i;var a=ko.createSVGElement(WP);a[S].add("attachment-icon","play-icon");var l=ko.createSVGElement(AS);l[S].add("attachment-icon","stop-icon"),o.replaceChildren(a),s.onplay=function(){o.replaceChildren(l)},s.onpause=function(){o.replaceChildren(a),s.currentTime=0},s.onended=function(){o.replaceChildren(a)},rt.assignButtonEvents(o,function(){s.paused?s.play():s.pause()})}},{key:"createAudioAttachment",value:function(r){var i=n.createAudioContainer();return n.addAudioElements(i,r),i}},{key:"stopAttachmentPlayback",value:function(r){var i,o,s;(s=(o=(i=r.children[0])==null?void 0:i.children)==null?void 0:o[0])!=null&&s[S].contains("stop-icon")&&r.children[0][ht]()}}])})(nD);mF.TIMER_LIMIT_S=5999;var OS=mF,sW=(function(){function t(){k(this,t)}return M(t,null,[{key:"create",value:function(e,r,i,o,s,a){return a===$e?new OS(e,r,i,o,s):new nD(e,r,i,o,s)}}])})(),rD=(function(){function t(n,e,r){k(this,t),this._fileAttachmentsTypes=[],this.elementRef=this.createAttachmentContainer();var i=B(r)=="object"&&!!r.displayFileAttachmentContainer;this.toggleContainerDisplay(i),n.appendChild(this.elementRef),e&&Object.assign(this.elementRef[N],e)}return M(t,[{key:"addType",value:function(e,r,i,o){var s=sW.create(e,r,i,this.toggleContainerDisplay.bind(this),this.elementRef,o);return this._fileAttachmentsTypes.push(s),s}},{key:"createAttachmentContainer",value:function(){var e=U();return e.id="file-attachment-container",e}},{key:"toggleContainerDisplay",value:function(e){e?this.elementRef[N].display="block":this.elementRef.children.length===0&&(this.elementRef[N].display="none")}},{key:"getAllFileData",value:function(){var e=this._fileAttachmentsTypes.map(function(r){return r.getFiles()}).flat();return e.length>0?e:void 0}},{key:"completePlaceholders",value:(function(){var n=D(v().m(function r(){return v().w(function(i){for(;;)switch(i.n){case 0:return i.n=1,Promise.all(this._fileAttachmentsTypes.map((function(){var o=D(v().m(function s(a){var l;return v().w(function(c){for(;;)switch(c.n){case 0:return c.a(2,(l=a.stopPlaceholderCallback)==null?void 0:l.call(a))}},s)}));return function(s){return o.apply(this,arguments)}})()));case 1:return i.a(2)}},r,this)}));function e(){return n.apply(this,arguments)}return e})()},{key:"addFilesToAnyType",value:function(e){t.addFilesToType(e,this._fileAttachmentsTypes)}},{key:"hideFiles",value:function(){this._fileAttachmentsTypes.forEac
246h(function(e){return e.hideAttachments()}),this.elementRef.replaceChildren(),this.toggleContainerDisplay(!1)}},{key:"removeHiddenFiles",value:function(){this._fileAttachmentsTypes.forEach(function(e){return e.removeAttachments()})}},{key:"readdHiddenFiles",value:function(){this._fileAttachmentsTypes.forEach(function(e){return e.readdAttachments()}),this.toggleContainerDisplay(!0)}},{key:"getNumberOfTypes",value:function(){return this._fileAttachmentsTypes.length}}],[{key:"addFilesToType",value:function(e,r){e.forEach(function(i){var o=new FileReader;o.readAsDataURL(i),o.onload=function(s){for(var a=0;a<r.length&&!r[a].attemptAddFile(i,s.target.result);a+=1);}})}}])})(),gF=(function(){function t(n,e,r){k(this,t),this._isOpen=!1,this._contentRef=t.createModalContent(e,r?.backgroundColor),this._buttonPanel=t.createButtonPanel(r?.backgroundColor),this._elementRef=t.createContainer(this._contentRef,r),this._elementRef.appendChild(this._buttonPanel),n.appendChild(this._elementRef),this._backgroundPanelRef=t.createDarkBackgroundPanel(),n.appendChild(this._backgroundPanelRef),this.addWindowEvents(n)}return M(t,[{key:"isOpen",value:function(){return this._isOpen}},{key:"addButtons",value:function(){for(var e=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];i.forEach(function(s){Cn.addAttributes(s),e._buttonPanel.appendChild(s)})}},{key:"close",value:function(){var e=this;this._elementRef[S].remove("show-modal"),this._elementRef[S].add("hide-modal"),this._backgroundPanelRef[S].remove("show-modal-background"),this._backgroundPanelRef[S].add("hide-modal-background"),this._isOpen=!1,setTimeout(function(){e._elementRef[N].display="none",e._backgroundPanelRef[N].display="none"},t.MODAL_CLOSE_TIMEOUT_MS)}},{key:"displayModalElements",value:function(){this._elementRef[N].display="flex",this._elementRef[S].remove("hide-modal"),this._elementRef[S].add("show-modal"),this._backgroundPanelRef[N].display="block",this._backgroundPanelRef[S].remove("hide-modal-background"),this._backgroundPanelRef[S].add("show-modal-background"),this._isOpen=!0}},{key:"openTextModal",value:function(e){this._contentRef.innerHTML=e,this.displayModalElements()}},{key:"addCloseButton",value:function(e,r,i){var o=this,s=r?t.createSVGButton(e):t.createTextButton(e);return this.addButtons(s),rt.assignButtonEvents(s,function(){o.close(),setTimeout(function(){i?.()},140)}),s}},{key:"addWindowEvents",value:function(e){this.keyDownEvent=this.windowKeyDown.bind(this,e),window.addEventListener("keydown",this.keyDownEvent)}},{key:"windowKeyDown",value:function(e,r){var i,o;!e.isConnected&&this.keyDownEvent?window.removeEventListener("keydown",this.keyDownEvent):this._isOpen&&(r.key===dn.ESCAPE?(this.close(),(i=this.extensionCloseCallback)==null||i.call(this)):r.key===dn.ENTER&&(this.close(),(o=this.extensionCloseCallback)==null||o.call(this)))}}],[{key:"createContainer",value:function(e,r){var i=U();return i[S].add("modal"),i.appendChild(e),r&&delete r.backgroundColor,Object.assign(i[N],r),i}},{key:"createModalContent",value:function(e,r){var i,o=U();return(i=o[S]).add.apply(i,Za(e)),r&&(o[N].backgroundColor=r),U().appendChild(o),o}},{key:"createButtonPanel",value:function(e){var r=U();return r[S].add("modal-button-panel"),e&&(r[N].backgroundColor=e),r}},{key:"createDarkBackgroundPanel",value:function(){var e=U();return e.id="modal-background-panel",e}},{key:"createTextButton",value:function(e){var r=U();return r[S].add("modal-button"),r.textContent=e,r}},{key:"createSVGButton",value:function(e){var r=U();r[S].add("modal-button","modal-svg-button");var i=ko.createSVGElement(e);return i[S].add("modal-svg-button-icon"),r.appendChild(i),r}},{key:"createTextModalFunc",value:function(e,r,i){var o;if(B(r)=="object"&&(o=r[x])!=null&&o.infoModal){var s=new t(e,["modal-content"],r[x].infoModal.containerStyle);return s.addCloseButton("OK",!1,i),s.openTextModal.bind(s,r.infoModalTextMarkUp||"")}}}])})();gF.MODAL_CLOSE_TIMEOUT_MS=190;var tf=gF,aW=(function(t){function n(e,r,i,o,s,a){var l;k(this,n);var c,u,d,f,h,p,m,g,w,C,T=Wt.processPosition((c=i?.button)==null?void 0:c.position),I=((f=(d=(u=i?.button)==null?void 0:u.styles)==null?void 0:d[b])==null?void 0:f.content)||a,F=Mo.tryCreateConfig("Upload File",(h=i?.button)==null?void 0:h.tooltip);l=K(this,n,[n.createButtonElement(),s,T,F,i.button,I]);var $=l.createInnerElementsForStates(o,l.customStyles);return l._inputElement=n.createInputElement((p=i?.[x])==null?void 0:p.acceptedFormats),l.addClickEvent(e,i),l.changeElementsByState($.styles),l.reapplyStateStyle("styles"),l._fileAttachmentsType=r,l._openM
246odalOnce=((g=(m=i[x])==null?void 0:m.infoModal)==null?void 0:g.openModalOnce)===!1||(C=(w=i[x])==null?void 0:w.infoModal)==null?void 0:C.openModalOnce,l}return J(n,t),M(n,[{key:"createInnerElementsForStates",value:function(r,i){return{styles:this.createInnerElements(r,"styles",i)}}},{key:"triggerImportPrompt",value:function(r){r.onchange=this.import.bind(this,r),r[ht]()}},{key:"import",value:function(r){rD.addFilesToType(Array.from(r[x]||[]),[this._fileAttachmentsType]),r.value=""}},{key:"addClickEvent",value:function(r,i){var o=this.triggerImportPrompt.bind(this,this._inputElement),s=tf.createTextModalFunc(r,i,o);this.elementRef.onclick=this[ht].bind(this,s)}},{key:"click",value:function(r){r&&(this._openModalOnce===void 0||this._openModalOnce===!0)?(r(),this._openModalOnce===!0&&(this._openModalOnce=!1)):this.triggerImportPrompt(this._inputElement)}}],[{key:"createInputElement",value:function(r){var i=U("input");return i.type=Bt,i.accept=r||"",i.hidden=!0,i.multiple=!0,i}},{key:"createButtonElement",value:function(){var r=U();return r[S].add("input-button"),r}}])})(ul),QN=(function(){function t(){k(this,t)}return M(t,null,[{key:"create",value:function(e,r,i){var o=t.createElement(i);t.addEvents(o,e,r),e.appendChild(o)}},{key:"createElement",value:function(e){var r=U();return r.id="drag-and-drop",B(e)===ze&&Object.assign(r[N],e),r}},{key:"addEvents",value:function(e,r,i){r.ondragenter=function(o){o.preventDefault(),t.display(e)},e.ondragleave=function(o){o.preventDefault(),t.hide(e)},e.ondragover=function(o){o.preventDefault()},e.ondrop=function(o){o.preventDefault(),t.uploadFile(i,o),t.hide(e)}}},{key:"uploadFile",value:function(e,r){var i,o=(i=r.dataTransfer)==null?void 0:i[x];o&&e.addFilesToAnyType(Array.from(o))}},{key:"display",value:function(e){e[N].display="block"}},{key:"hide",value:function(e){e[N].display="none"}},{key:"isEnabled",value:function(e,r){return r!==void 0&&r===!1?!1:!!r||e.getNumberOfTypes()>0}}])})(),lW=(function(){function t(){k(this,t)}return M(t,null,[{key:"validate",value:function(e,r,i,o,s,a,l){var c=i.isSubmitProgrammaticallyDisabled?!1:e(o,s,l);return c?r.changeToSubmitIcon():r.changeToDisabledIcon(),a?.addInputText(o||""),c}},{key:"useValidationFunc",value:(function(){var n=D(v().m(function r(i,o,s,a,l,c){var u,d,f;return v().w(function(h){for(;;)switch(h.n){case 0:return u=o.isTextInputEmpty()?"":o.inputElementRef.textContent,h.n=1,s.completePlaceholders();case 1:return d=s.getAllFileData(),f=d?.map(function(p){return p[Bt]}),h.a(2,t.validate(i,a,l,u,f,c))}},r)}));function e(r,i,o,s,a,l){return n.apply(this,arguments)}return e})()},{key:"useValidationFuncProgrammatic",value:(function(){var n=D(v().m(function r(i,o,s,a,l){var c,u;return v().w(function(d){for(;;)switch(d.n){case 0:return u=(c=o[x])==null?void 0:c.map(function(f){return f[Bt]}),d.a(2,t.validate(i,s,a,o[b],u,l,!0))}},r)}));function e(r,i,o,s,a){return n.apply(this,arguments)}return e})()},{key:"validateWebsocket",value:function(e,r){var i=e.websocket,o=e.connectSettings;return i&&o.url!==Ao.URL&&!uf.canSendMessage(i)?(r.changeToDisabledIcon(),!1):!0}},{key:"attach",value:function(e,r,i,o,s,a){var l=e.validateInput||Wt.processValidateInput(e);e._validationHandler=(function(){var c=D(v().m(function u(d){var f;return v().w(function(h){for(;;)switch(h.n){case 0:if(!(s.status.loadingActive||s.status.requestInProgress||!t.validateWebsocket(r,s))){h.n=1;break}return h.a(2,!1);case 1:return f=l||r.canSendMessage,h.a(2,f?d?t.useValidationFuncProgrammatic(f,d,s,r,a):t.useValidationFunc(f,i,o,s,r,a):null)}},u)}));return function(u){return c.apply(this,arguments)}})()}}])})(),vF=(function(){function t(){k(this,t)}return M(t,null,[{key:"getFileName",value:function(e,r){var i=new Date,o=String(i.getHours()).padStart(2,"0"),s=String(i.getMinutes()).padStart(2,"0"),a=String(i.getSeconds()).padStart(2,"0");return"".concat(e,"-").concat(o,"-").concat(s,"-").concat(a,".").concat(r)}}])})(),cW=(function(t){function n(e,r){var i;k(this,n);var o,s;return i=K(this,n,[r.button]),i._waitingForBrowserApproval=!1,i._audioType=e,i._extension=((o=r[x])==null?void 0:o.format)||"mp3",i._maxDurationSeconds=(s=r[x])==null?void 0:s.maxDurationSeconds,rt.assignButtonEvents(i.elementRef,i.buttonClick.bind(Xc(i))),i}return J(n,t),M(n,[{key:"buttonClick",value:function(){this._waitingForBrowserApproval||(this.isActive?this.stop():(this._waitingForBrowserApproval=!0,this.record()))}},{key:"stop",value:function(){var r=this;return new Promise(function(i){var o,s;r.changeToDefault(),(o=r._mediaRecorder)==null||o.stop(),(s=r._mediaStream)==null||s.getTracks().forEac
246h(function(a){return a.stop()}),setTimeout(function(){i()},10)})}},{key:"record",value:function(){var r=this;navigator.mediaDevices.getUserMedia({audio:!0}).then(function(i){r.changeToActive(),r._mediaRecorder=new MediaRecorder(i),r._audioType.addPlaceholderAttachment(r.stop.bind(r),r._maxDurationSeconds),r._mediaStream=i,r._mediaRecorder.addEventListener("dataavailable",function(o){r.createFile(o)}),r._mediaRecorder[_s]()}).catch(function(i){console[E](i),r.stop()}).finally(function(){r._waitingForBrowserApproval=!1})}},{key:"createFile",value:function(r){var i=this,o=new Blob([r.data],{type:"audio/".concat(this._extension)}),s=vF.getFileName(this._newFilePrefix||$e,this._extension),a=new File([o],s,{type:o.type}),l=new FileReader;l.readAsDataURL(a),l.onload=function(c){i._audioType.completePlaceholderAttachment(a,c.target.result)}}}])})(cF),uW=`<?xml version="1.0" standalone="no"?> 247<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> 248<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="1" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round"> 249 <line x1="22" y1="2" x2="11" y2="14"></line> 250 <polygon points="22 2 15 22 11 14 2 10 22 2"></polygon> 251</svg> 252`,eP=(function(){function t(){k(this,t)}return M(t,null,[{key:"resetSubmit",value:function(e,r){r?e.unsetCustomStateStyles(["loading","submit"]):e.unsetCustomStateStyles(["stop","loading","submit"]),e.reapplyStateStyle("submit")}},{key:"overwriteDefaultStyleWithSubmit",value:function(e,r){if(e.submit){var i=JSON.parse(JSON.stringify(e[r]||{}));Do.overwritePropertyObjectFromAnother(i,e.submit,["container",H]),Do.overwritePropertyObjectFromAnother(i,e.submit,[b,"styles",H]),Do.overwritePropertyObjectFromAnother(i,e.submit,["svg","styles",H]),e[r]=i}}},{key:"setUpDisabledButton",value:function(e){Do.setPropertyValueIfDoesNotExist(e,["submit","container",H,"backgroundColor"],""),Do.setPropertyValueIfDoesNotExist(e,["disabled","container",H,"backgroundColor"],r$),Do.setPropertyValueIfDoesNotExist(e.submit,["svg","styles",H,"filter"],""),Do.setPropertyValueIfDoesNotExist(e.disabled,["svg","styles",H,"filter"],"brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"),Do.setPropertyValueIfDoesNotExist(e.disabled,[b,"styles",H,"color"],"grey"),t.overwriteDefaultStyleWithSubmit(e,"disabled")}},{key:"process",value:function(e){var r=JSON.parse(JSON.stringify(e||{}));return t.overwriteDefaultStyleWithSubmit(r,"loading"),t.overwriteDefaultStyleWithSubmit(r,"stop"),e!=null&&e.alwaysEnabled||t.setUpDisabledButton(r),r}}])})(),dW=(function(t){function n(e,r,i,o,s,a){var l;k(this,n);var c=eP.process(e.submitButtonStyles),u=uW,d=Mo.tryCreateConfig("Submit",c?.tooltip);return l=K(this,n,[n.createButtonContainerElement(),u,c?.position,d,c]),l._isSVGLoadingIconOverriden=!1,l.status={requestInProgress:!1,loadingActive:!1},l._messages=i,l._textInput=r,l._fileAttachments=s,l._innerElements=l.createInnerElementsForStates(),l._stopClicked={listener:function(){}},l._serviceIO=o,l._alwaysEnabled=!!(c!=null&&c.alwaysEnabled),e.disableSubmitButton=l.disableSubmitButton.bind(Xc(l),o),l.attemptOverwriteLoadingStyle(e),a.microphone&&l.setUpSpeechToText(a.microphone.button,e.speechToText),setTimeout(function(){var f;l._validationHandler=e._validationHandler,l.assignHandlers(l._validationHandler),(f=l._validationHandler)==null||f.call(Xc(l))}),l}return J(n,t),M(n,[{key:"createInnerElementsForStates",value:function(){var r=this.createCustomElements(),i=r.submit,o=r.loading,s=r.stop;return{submit:i,loading:o||[n.createLoadingIconElement()],stop:s||[n.createStopIconElement()],disabled:this.createDisabledIconElement(i)}}},{key:"createCustomElements",value:function(){var r=this,i=ws.createCustomElements("submit",this.svg,this.customStyles),o={loading:void 0,stop:void 0};return Object.keys(o).forEach(function(s){var a=s,l=ws.createCustomElements(a,r.svg,r.customStyles);l&&(o[a]=l)}),o.submit=i||this.buildDefaultIconElement("submit-icon"),o}},{key:"createDisabledIconElement",value:function(r){return ws.createCustomElements("disabled",this.svg,this.customStyles)||[r[0].cloneNode(!0)]}},{key:"attemptOverwriteLoadingStyle",value:function(r){var i,o,s,a,l,c,u,d,f;if(!((o=(i=this.customStyles)==null?void 0:i.submit)!=null&&o.svg||(l=(a=(s=this.customStyles)==null?void 0:s.loading)==null?void 0:a.svg)!=null&&l.content||(d=(u=(c=this.customStyles)==null?void 0:c.loading)==null?void 0:u[b])!=null&&d.content)&&(r.displayLoadingBubble===void 0||r.displayLoadingBubble===!0)){var h=U("style");h.textContent=` 253 .loading-button > * { 254 filter: brightness(0) saturate(100%) invert(72%) sepia(0%) saturate(3044%) hue-rotate(322deg) brightness(100%) 255 contrast(96%) !important; 256 }`,(f=r.shadowRoot)==null||f.appendChild(h),this._isSVGLoadingIconOverriden=!0}}},{key:"assignHandlers",value:function(r){this._serviceIO.completionsHandlers={onFinish:this.resetSubmit.bind(this,r)},this._serviceIO.streamHandlers={onOpen:this.changeToStopIcon.bind(this),onClose:this.resetSubmit.bind(this,r),stopClicked:this._stopClicked};var i=this._serviceIO.stream;B(i)=="object"&&typeof i.simulation=="number"&&(this._serviceIO.streamHandlers.simulationInterim=i.simulation)}},{key:"setUpSpeechToText",value:function(r,i){this._microphoneButton=r,this._stopSTTAfterSubmit=B(i)=="object"?i.stopAfterSubmit:!1}},{key:"resetSubmit",value:function(r){this.status.requestInProgress=!1,this.status.loadingActive=!1,r()}},{key:"submitFromInput",value:(function(){var e=D(v().m(function i(){var o=this,s,a;return v().w(function(l){for(;;)switch(l.n){case 0:return l.n=1,this._fileAttachments.completePlaceholders();case 1:s=this._fileAttachments.getAllFileData(),this._textInput.isTextInputEmpty()?this.attemptSubmit(_(_({},b,""),x,s)):(a=this._textInput.inputElementRef.innerText.trim(),this.attemptSubmit(_(_({},b,a),x,s))),(Xr.IS_SAFARI||Xr.IS_MOBILE)&&setTimeout(function(){return af.focusEndOfInput(o._textInput.inputElementRef)});case 2:return l.a(2)}},i,this)}));function r(){return e.apply(this,arguments)}return r})()},{key:"programmaticSubmit",value:(function(){var e=D(v().m(function i(o){var s=this,a;return v().w(function(l){for(;;
256)switch(l.n){case 0:typeof o=="string"&&(o=Wt.processSubmitUserMessage(o)),a=_({},b,o[b]),o[x]&&(a[x]=Array.from(o[x]).map(function(c){return{file:c,type:nD.getTypeFromBlob(c)}})),o.custom&&(a.custom=o.custom),setTimeout(function(){return s.attemptSubmit(a,!0)});case 1:return l.a(2)}},i)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"attemptSubmit",value:(function(){var e=D(v().m(function i(o){var s=this,a,l,c,u,d,f,h,p=arguments,m,g,w;return v().w(function(C){for(;;)switch(C.n){case 0:return a=p.length>1&&p[1]!==void 0?p[1]:!1,C.n=1,(l=this._validationHandler)==null?void 0:l.call(this,a?o:void 0);case 1:if(m=C.v,g=!1,m!==g){C.n=2;break}return C.a(2);case 2:if(this.changeToLoadingIcon(),this._textInput.clear(),Xr.IS_MOBILE&&setTimeout(function(){return s._textInput.inputElementRef.focus()}),w=typeof this._messages.focusMode!="boolean"&&(c=this._messages.focusMode)!=null&&c.fade,!w){C.n=3;break}return C.n=3,xP.fadeAnimation(this._messages.elementRef,this._messages.focusMode.fade);case 3:return C.n=4,this.addNewMessage(o);case 4:return this._serviceIO.isWebModel()||this._messages.addLoadingMessage(),f=(u=o[x])==null?void 0:u.map(function(T){return T[Bt]}),h=_(_({},b,o[b]===""?void 0:o[b]),x,f),C.n=5,this._serviceIO.callAPI(h,this._messages);case 5:(d=this._fileAttachments)==null||d.hideFiles();case 6:return C.a(2)}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"addNewMessage",value:(function(){var e=D(v().m(function i(o){var s,a,l,c,u;return v().w(function(d){for(;;)switch(d.n){case 0:if(s=o.text,a=o.files,l=o.custom,c={role:et,custom:l},s&&(c[b]=s),u=a,!u){d.n=2;break}return d.n=1,this._messages.addMultipleFiles(a,this._fileAttachments);case 1:c[x]=d.v;case 2:this._serviceIO.sessionId&&(c._sessionId=this._serviceIO.sessionId),Object.keys(c).length>0&&this._messages.addNewMessage(c);case 3:return d.a(2)}},i,this)}));function r(i){return e.apply(this,arguments)}return r})()},{key:"stopStream",value:function(){var r,i,o;(i=(r=this._serviceIO.streamHandlers).onAbort)==null||i.call(r),(o=this._stopClicked)==null||o.listener(),this._validationHandler&&this.resetSubmit(this._validationHandler)}},{key:"changeToStopIcon",value:function(){this._serviceIO.websocket||(this.elementRef[S].remove(Fv,Ah,Mh),Cn.removeAriaAttributes(this.elementRef),this.changeElementsByState(this._innerElements.stop),this.reapplyStateStyle("stop",["loading","submit"]),rt.assignButtonEvents(this.elementRef,this.stopStream.bind(this)),this.status.loadingActive=!1)}},{key:"changeToLoadingIcon",value:function(){this._serviceIO.websocket||(this._isSVGLoadingIconOverriden||this.changeElementsByState(this._innerElements.loading),this.elementRef[S].remove(Mh,Ah),Cn.removeAriaDisabled(this.elementRef),this.elementRef[S].add(Fv),Cn.addAriaBusy(this.elementRef),this.reapplyStateStyle("loading",["submit"]),rt.assignButtonEvents(this.elementRef,function(){}),this.status.requestInProgress=!0,this.status.loadingActive=!0)}},{key:"changeToSubmitIcon",value:function(){var r=this;this.elementRef[S].contains(Mh)||(this.elementRef[S].remove(Fv,Ah),Cn.removeAriaAttributes(this.elementRef),this.elementRef[S].add(Mh),this.changeElementsByState(this._innerElements.submit),eP.resetSubmit(this,this.status.loadingActive),rt.assignButtonEvents(this.elementRef,function(){var i;r.submitFromInput(),(i=r._microphoneButton)!=null&&i.isActive&&tD.toggleSpeechAfterSubmit(r._microphoneButton.elementRef,!!r._stopSTTAfterSubmit),setTimeout(function(){return af.focusEndOfInput(r._textInput.inputElementRef)})}))}},{key:"changeToDisabledIcon",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this._alwaysEnabled&&!r?this.changeToSubmitIcon():this.elementRef[S].contains(Ah)||(this.elementRef[S].remove(Fv,Mh),Cn.removeAriaBusy(this.elementRef),this.elementRef[S].add(Ah),Cn.addAriaDisabled(this.elementRef),this.changeElementsByState(this._innerElements.disabled),this.reapplyStateStyle("disabled",["submit"]),rt.assignButtonEvents(this.elementRef,function(){}))}},{key:"disableSubmitButton",value:function(r,i){var o;r.isSubmitProgrammaticallyDisabled=i!==!1,!(this.status.requestInProgress||this.status.loadingActive)&&(i===!1?(o=this._val
256idationHandler)==null||o.call(this):this.changeToDisabledIcon(!0))}}],[{key:"createButtonContainerElement",value:function(){var r=U();return r[S].add("input-button"),r}},{key:"createLoadingIconElement",value:function(){var r=U();return r[S].add("loading-submit-button"),r}},{key:"createStopIconElement",value:function(){var r=U();return r.id="stop-icon",r}}])})(ul),hW=`<?xml version="1.0" encoding="utf-8"?> 257<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"> 258 <path d="M27.1 14.313V5.396L24.158 8.34c-2.33-2.325-5.033-3.503-8.11-3.503C9.902 4.837 4.901 9.847 4.899 16c.001 6.152 5.003 11.158 11.15 11.16 4.276 0 9.369-2.227 10.836-8.478l.028-.122h-3.23l-.022.068c-1.078 3.242-4.138 5.421-7.613 5.421a8 8 0 0 1-5.691-2.359A7.993 7.993 0 0 1 8 16.001c0-4.438 3.611-8.049 8.05-8.049 2.069 0 3.638.58 5.924 2.573l-3.792 3.789H27.1z"/> 259</svg> 260`,fW=`<?xml version="1.0" encoding="utf-8"?> 261<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg"> 262 <path d="M0 16q0 3.264 1.28 6.208t3.392 5.12 5.12 3.424 6.208 1.248 6.208-1.248 5.12-3.424 3.392-5.12 1.28-6.208-1.28-6.208-3.392-5.12-5.088-3.392-6.24-1.28q-3.264 0-6.208 1.28t-5.12 3.392-3.392 5.12-1.28 6.208zM4 16q0-3.264 1.6-6.016t4.384-4.352 6.016-1.632 6.016 1.632 4.384 4.352 1.6 6.016-1.6 6.048-4.384 4.352-6.016 1.6-6.016-1.6-4.384-4.352-1.6-6.048z"></path> 263</svg> 264`,pW=`<?xml version="1.0" encoding="utf-8"?> 265<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"> 266 <path d="M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z"/> 267</svg>`,mW=`<?xml version="1.0" encoding="utf-8"?> 268<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 269 <path d="M4.89163 13.2687L9.16582 17.5427L18.7085 8" stroke="#000000" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/> 270</svg>`,gW=(function(t){function n(e,r,i,o){var s;k(this,n),s=K(this,n,[e,["modal-content","modal-camera-content"],i]),s._stopped=!1,s._format="image/png",s._canvas=U("canvas"),s._canvas[S].add("camera-modal-canvas");var a=s.addButtonsAndTheirEvents(r),l=a.captureButton,c=a.submitButton;return s._captureButton=l,s._submitButton=c,s._captureIcon=s._captureButton.children[0],s._refreshIcon=ko.createSVGElement(hW),s._refreshIcon[S].add("modal-svg-button-icon","modal-svg-refresh-icon"),o?.format==="jpeg"&&(s._format="image/jpeg"),o!=null&&o.dimensions&&(s._dimensions=o.dimensions),s._contentRef.appendChild(s._canvas),s.extensionCloseCallback=s.stop,s}return J(n,t),M(n,[{key:"addButtonsAndTheirEvents",value:function(r){var i=tf.createSVGButton(fW);i[S].add("modal-svg-camera-button"),i.children[0][S].add("modal-svg-camera-icon");var o=this.addCloseButton(pW,!0);o[S].add("modal-svg-close-button"),o.children[0][S].add("modal-svg-close-icon");var s=tf.createSVGButton(mW);return s[S].add("modal-svg-submit-button"),this.addButtons(i,s),this.addButtonEvents(i,o,s,r),{captureButton:i,submitButton:s}}},{key:"addButtonEvents",value:function(r,i,o,s){var a=this;rt.assignButtonEvents(r,this.capture.bind(this)),rt.assignButtonEvents(i,this.stop.bind(this)),rt.assignButtonEvents(o,function(){var l=a.getFile();l&&rD.addFilesToType([l],[s]),a.stop(),a.close()})}},{key:"stop",value:function(){var r=this;this._mediaStream&&this._mediaStream.getTracks().forEach(function(i){return i.stop()}),this._stopped=!0,setTimeout(function(){r._captureButton.replaceChildren(r._captureIcon),r._captureButton[S].replace("modal-svg-refresh-button","modal-svg-camera-button");var i=r._canvas.getContext("2d");i?.clearRect(0,0,r._canvas.width,r._canvas.height)},tf.MODAL_CLOSE_TIMEOUT_MS)}},{key:"start",value:function(){var r=this;this._dataURL=void 0,this._submitButton[S].add("modal-svg-submit-disabled"),this._stopped=!1,navigator.mediaDevices.getUserMedia({video:this._dimensions||!0}).then(function(i){if(r._mediaStream=i,!r.isOpen())return r.stop();var o=U("video");o.srcObject=i,o.play(),requestAnimationFrame(r.updateCanvas.bind(r,o,r._canvas))}).catch(function(i){console[E](i),r.stop(),r.close()})}},{key:"capture",value:function(){this._dataURL?(this._captureButton.replaceChildren(this._captureIcon),this._captureButton[S].replace("modal-svg-refresh-button","modal-svg-camera-button"),this._submitButton[S].add("modal-svg-submit-disabled"),this._dataURL=void 0):(this._captureButton.replaceChildren(this._refreshIcon),this._captureButton[S].replace("modal-svg-camera-button","modal-svg-refresh-button"),this._submitButton[S].remove("modal-svg-submit-disabled"),this._dataURL=this._canvas.toDataURL())}},{key:"getFile",value:function(){if(this._dataURL){for(var r=atob(this._dataURL.split(",")[1]),i=new Array(r.length),o=0;o<r.length;o++)i[o]=r.charCodeAt(o);var s=new Uint8Array(i),a=new Blob([s],{type:this._format}),l=this._format==="image/jpeg"?"jpeg":"png",c=vF.getFileName(this._newFilePrefix||"photo",l);return new File([a],c,{type:a.type})}}},{key:"updateCanvas",value:function(r,i){if(!this._stopped){if(!this._dataURL){i.width=r.videoWidth,i.height=r.videoHeight;var o=i.getContext("2d");o?.drawImage(r,0,0,i.width,i.height)}requestAnimationFrame(this.updateCanvas.bind(this,r,i))}}},{key:"openCameraModal",value:function(r){this.displayModalElements(),r[_s]()}}],[{key:"createCameraModalFunc",value:function(r,i,o,s){var a=new n(r,i,o,s);return a.openCameraModal.bind(a,a)}}])})(tf),vW=`<?xml version="1.0" encoding="utf-8"?> 271<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg"> 272 <path d="M29 7h-4.599l-2.401-4h-12l-2.4 4h-4.6c-1 0-3 1-3 2.969v16.031c0 1.657 1.5 3 2.792 3h26.271c1.313 0 2.938-1.406 2.938-2.968v-16.032c0-1-1-3-3-3zM30 26.032c0 0.395-0.639 0.947-0.937 0.969h-26.265c-0.232-0.019-0.797-0.47-0.797-1v-16.031c0-0.634 0.851-0.953 1-0.969h5.732l2.4-4h9.802l1.785 3.030 0.55 0.97h5.731c0.705 0 0.99 0.921 1 1v16.032zM16 10c-3.866 0-7 3.134-7 7s3.134 7 7 7 7-3.134 7-7-3.134-7-7-7zM16 22c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z"></path> 273</svg>
273`,yW=(function(t){function n(e,r,i){var o;k(this,n);var s,a,l,c,u,d,f=Wt.processPosition((s=i?.button)==null?void 0:s.position),h=((c=(l=(a=i?.button)==null?void 0:a.styles)==null?void 0:l[b])==null?void 0:c.content)||"Photo",p=Mo.tryCreateConfig("Camera",(u=i?.button)==null?void 0:u.tooltip),m=((d=i?.button)==null?void 0:d.styles)||{};o=K(this,n,[n.createButtonElement(),vW,f,p,m,h]);var g=o.createInnerElementsForStates(o.customStyles);return i&&o.addClickEvent(e,r,i.modalContainerStyle,i[x]),o.changeElementsByState(g.styles),o.reapplyStateStyle("styles"),o}return J(n,t),M(n,[{key:"createInnerElementsForStates",value:function(r){return{styles:this.createInnerElements("camera-icon","styles",r)}}},{key:"addClickEvent",value:function(r,i,o,s){var a=gW.createCameraModalFunc(r,i,o,s);rt.assignButtonEvents(this.elementRef,a)}}],[{key:"createButtonElement",value:function(){var r=U();return r[S].add("input-button"),r}}])})(ul),_W=(function(){function t(n,e,r,i){k(this,t),this.elementRef=t.createPanelElement(n.inputAreaStyle);var o={},s=this.createFileUploadComponents(n,r,i,o),a=new pP(n,r,s,e.browserStorage);n.speechToText&&!o.microphone&&(o.microphone={button:new tD(n,a,e.addNe
273wErrorMessage.bind(e))});var l=new dW(n,a,e,r,s,o);a.submit=l.submitFromInput.bind(l),lW.attach(n,r,a,s,l,e.browserStorage),n.submitUserMessage=l.programmaticSubmit.bind(l),o.submit={button:l},n.customButtons&&rf.add(n,o),t.addElements(this.elementRef,a,o,i,s,n.dropupStyles),t.assignOnInput(n,r,s,a)}return M(t,[{key:"createFileUploadComponents",value:function(e,r,i,o){var s,a,l,c,u=new rD(this.elementRef,e.attachmentContainerStyle,r.demo);if(t.createUploadButtons(e,r,r.fileTypes||{},u,i,o),(s=r[or])!=null&&s[x]){var d=((a=o[wt])==null?void 0:a.fileType)||u.addType(e,r,r[or][x],wt);o[or]={button:new yW(i,d,r[or])}}if((l=r.recordAudio)!=null&&l[x]){var f=((c=o[$e])==null?void 0:c.fileType)||u.addType(e,r,r.recordAudio[x],$e);o.microphone={button:new cW(f,r.recordAudio)}}return QN.isEnabled(u,e.dragAndDrop)&&QN.create(i,u,e.dragAndDrop),u}}],[{key:"createPanelElement",value:function(e){var r=U();return r.id="input",Object.assign(r[N],e),r}},{key:"createUploadButtons",value:function(e,r,i,o,s,a){Object.keys(i).forEach(function(l){var c=l,u=i[c];if(u[x]){var d=o.addType(e,r,u[x],c),f=Uq[c],h=f.id,p=f.svgString,m=f.dropupText,g=new aW(s,d,u,h,p,m);a[c]={button:g,fileType:d}}})}},{key:"addElements",value:function(e,r,i,o,s,a){rt.addElements(e,r.elementRef);var l=ey.create(),c=Fq.addButtons(l,i,o,a);Rq.set(r.inputElementRef,l,s.elementRef,c),ey.add(e,l)}},{key:"assignOnInput",value:function(e,r,i,o){r.onInput=function(s){setTimeout(function(){var a=i.getAllFileData(),l=o.inputElementRef.innerText.trim(),c=_({},b,l);a&&(c[x]=a.map(function(u){return u[Bt]})),ol.onInput(e,c,s)})}}}])})(),bW=(function(){function t(){k(this,t)}return M(t,null,[{key:"createElements",value:function(e,r,i){var o=U();o.id="chat-view";var s=!e.focusMode&&e.upwardsMode;o.classList.add(s?Tq:Iq);var a=new RS(e,r,i);r.websocket&&uf.createConnection(r,a);var l=new _W(e,a,r,o),c=s?a.elementRef.parentElement:a.elementRef;return rt.addElements(o,c,l.elementRef),o}},{key:"render",value:function(e,r,i,o){var s=t.createElements(e,i,o);r.replaceChildren(s),i.isCustomView()&&i.setUpView(s,r)}}])})(),wW=`#validate-property-key-view{height:100%;position:relative;display:flex;justify-content:center;align-items:center;padding:8px}#loading-validate-key-property{display:inline-block;width:50px;height:50px}#loading-validate-key-property:after{content:" ";display:block;width:38px;height:38px;margin:1px;border-radius:50%;border:5px solid #5fb2ff;border-color:#5fb2ff transparent #5fb2ff transparent;animation:loading-spinner 1.4s linear infinite}#deep-chat-openai-realtime-container{height:100%;width:100%}#deep-chat-openai-realtime-avatar-container{height:60%;width:100%;display:flex;justify-content:center;align-items:center}#deep-chat-openai-realtime-avatar{border-radius:50%;height:110px;border:1px solid rgb(215,215,215);padding:8px;-webkit-user-select:none;user-select:none;margin-top:20px}#deep-chat-openai-realtime-buttons-container{height:40%;display:flex;position:relative}.deep-chat-openai-realtime-button-container{height:100%;width:50%;display:flex;justify-content:center;align-items:center}.deep-chat-openai-realtime-button{width:70px;height:70px;border-radius:50%;display:flex;justify-content:center;align-items:center;cursor:pointer}.deep-chat-openai-realtime-button-default{background-color:#e3e3e3}.deep-chat-openai-realtime-button-default:hover{background-color:#d4d4d4}.deep-chat-openai-realtime-button-default:active{background-color:#c5c5c5}.deep-chat-openai-realtime-button-loading{opacity:.7;pointer-events:none}.deep-chat-openai-realtime-microphone-active{background-color:#ffe7e7}.deep-chat-openai-realtime-microphone-active:hover{background-color:#ffdede}.deep-chat-openai-realtime-microphone-active:active{background-color:#ffd2d2}.deep-chat-openai-realtime-microphone>*{height:30px;width:30px}.deep-chat-openai-realtime-microphone-active>*{filter:brightness(0) saturate(100%) invert(35%) sepia(60%) saturate(1360%) hue-rotate(325deg) brightness(95%) contrast(92%)}.deep-chat-openai-realtime-toggle>*{height:32px;width:32px;padding-inline-start:3px;filter:brightness(0) saturate(100%) invert(22%) sepia(0%) saturate(4537%) hue-rotate(208deg) brightness(105%) contrast(91%)}.deep-chat-openai-realtime-button-unavailable{opacity:.45;pointer-events:none}#deep-chat-openai-realtime-error{color:red;position:absolute;top:calc(50% + 40px);inset-inline-start:50%;transform:translate(-50%,-50%);font-size:17px}#deep-chat-openai-realtime-loading{position:absolute;font-size:15px;top:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}#insert-key-view{height:100%;position:relative}#insert-key-contents{text-align:center;position:absolute;inset-block-start:44%;inset-inline-start:50%;transform:translate(-50%,-50%);width:82%;display:flex;max-width:700px}#insert-key-title{margin-bottom:15px}#insert-key-input-container{margin-inline-end:2.7em;width:calc(100% - 80px)}#insert-key-input{padding:.3em 1.7em .3em .3em;border-width:1px;border-style:solid;border-radius:3px;width:100%;font-size:inherit}.insert-key-input-valid{border-color:gray}.insert-key-input-invalid{border-color:red}#visibility-icon-container{position:relative;float:inline-end;cursor:pointer;-webkit-user-select:none;user-select:none}.visibility-icon{filter:brightness(0) saturate(100%) invert(63%) sepia(1%) saturate(9%) hue-rotate(43deg) brightness(98%) contrast(92%);position:absolute;inset-inline-end:-1.7em;inset-block-start:-1.43em}#visible-icon{inset-block-start:-1.4em}.visibility-icon:hover{filter:unset}.visibility-icon>*{pointer-events:none}#start-button{border:1px solid grey;color:#454545;border-radius:4px;width:3em;display:flex;justify-content:center;align-items:center;cursor:pointer;padding:.28em .3em;-webkit-user-select:none;user-select:none;background-color:#fff}#start-button:hover{background-color:#f2f2f2}#start-button:active{background-color:#d2d2d2}#insert-key-help-text-container{width:100%;position:absolute;margin-top:32px;margin-bottom:20px}#insert-key-help-text-contents{width:100%;position:absolute}#insert-key-input-invalid-text{display:block;margin-top:1em;margin-bottom:.5em;color:red}.insert-key-input-help-text{display:block;margin-top:16px}#loading-key{display:inline-block;width:16px;height:16px}#loading-key:after{content:" ";display:block;width:11px;height:11px;margin:1px;border-radius:50%;border:2px solid #0084ff;border-color:#0084ff transparent #0084ff transparent;animation:loading-spinner 1.2s linear infinite}#error-view{color:red;font-size:1.2em;line-height:1.3em;margin-top:-5px;text-align:center;height:100%;display:flex;justify-content:center;align-items:center;padding-inline:8px}@keyframes loading-spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.intro-panel{position:absolute;display:flex;justify-content:center;right:0;bottom:0;left:0;margin:auto;height:fit-content;top:-2.5em}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*! 274 Theme: a11y-dark 275 Author: @ericwbailey 276 Maintainer: @ericwbailey 277 278 Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css 279*/.hljs{background:#2b2b2b;color:#f8f8f2}.hljs-comment,.hljs-quote{color:#d4d0ab}.hljs-deletion,.hljs-name,.hljs-regexp,.hljs-selector-class,.hljs-selector-id,.hljs-tag,.hljs-template-variable,.hljs-variable{color:#ffa07a}.hljs-built_in,.hljs-link,.hljs-literal,.hljs-meta,.hljs-number,.hljs-params,.hljs-type{color:#f5ab35}.hljs-attribute{color:gold}.hljs-addition,.hljs-bullet,.hljs-string,.hljs-symbol{color:#abe338}.hljs-section,.hljs-title{color:#00e0e0}
279.hljs-keyword,.hljs-selector-tag{color:#dcc6e0}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}@media screen and (-ms-high-contrast:active){.hljs-addition,.hljs-attribute,.hljs-built_in,.hljs-bullet,.hljs-comment,.hljs-link,.hljs-literal,.hljs-meta,.hljs-number,.hljs-params,.hljs-quote,.hljs-string,.hljs-symbol,.hljs-type{color:highlight}.hljs-keyword,.hljs-selector-tag{font-weight:700}}#messages,.deep-chat-upwards-mode #messages>div{overflow:auto;overflow-anchor:none}.deep-chat-upwards-mode #messages{height:100%;display:flex;flex-direction:column;justify-content:flex-end}.outer-message-container:last-child{margin-bottom:5px}.inner-message-container{display:flex;margin-inline:auto;width:calc(97.5% - 24px);max-width:100%}.message-bubble{margin-top:10px;word-wrap:break-word;width:fit-content;max-width:60%;border-radius:10px;padding:.42em .55em;height:fit-content;line-height:1.26em
vendor: 19,232 bytes, line 279
279}.user-message-text{color:#fff;background-color:#0084ff;margin-inline-end:0px;margin-inline-start:auto}.ai-message-text{color:#000;background-color:#e4e6eb;margin-inline-start:0px;margin-inline-end:auto}.deep-chat-last-group-messages-active{height:100%}#scroll-button{position:absolute;top:75%;left:50%;right:50%;transform:translate(-50%,-50%);transition:opacity .1s ease;display:flex;opacity:0;padding:8px;background-color:#fff;border:.5px solid #000000;justify-content:center;align-items:center;white-space:nowrap;cursor:pointer}#scroll-button:hover{background-color:#fafafa}.loading-history-message-full-view{position:absolute;height:70%;width:100%;display:flex;align-items:center}.deep-chat-upwards-mode #messages .loading-history-message-full-view{height:100%}.loading-history-message-small{height:20px;margin-bottom:30px}.loading-history-message-small>div>div{scale:.6}.loading-history-message{margin-top:0;width:100%;max-width:100%;display:flex;justify-content:center;background-color:unset}.loading-history{width:70px}.loading-history div{position:absolute;width:var(--loading-history-width);height:var(--loading-history-height);margin:var(--loading-history-margin);border:var(--loading-history-border);border-radius:50%;animation:loading-spinner 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:var(--loading-history-color) transparent transparent transparent}.loading-history div:nth-child(1){animation-delay:-.45s}.loading-history div:nth-child(2){animation-delay:-.3s}.loading-history div:nth-child(3){animation-delay:-.15s}.html-message{max-width:unset}.error-message-text{margin-inline:auto;background-color:#f4c0c0;color:#474747;text-align:center;max-width:95%;margin-top:14px;margin-bottom:10px}.deep-chat-loading-message-dots-container{width:1em;padding-top:.6em;padding-bottom:.6em;padding-inline-start:1.3em;padding-inline-end:.75em}.loading-message-dots{position:relative;width:.45em;height:.45em;border-radius:5px;background-color:var(--loading-message-color);color:var(--loading-message-color);animation:loading-message-dots 1s infinite linear alternate;animation-delay:.5s}.loading-message-dots:before,.loading-message-dots:after{content:"";display:inline-block;position:absolute;top:0}.loading-message-dots:before{inset-inline-start:-.7em;width:.45em;height:.45em;border-radius:5px;background-color:var(--loading-message-color);color:var(--loading-message-color);animation:loading-message-dots 1s infinite alternate;animation-delay:0s}.loading-message-dots:after{inset-inline-start:.7em;width:.45em;height:.45em;border-radius:5px;background-color:var(--loading-message-color);color:var(--loading-message-color);animation:loading-message-dots 1s infinite alternate;animation-delay:1s}@keyframes loading-message-dots{0%{background-color:var(--loading-message-color)}50%,to{background-color:var(--loading-message-color-fade)}}.message-bubble>p:first-child,.message-bubble>.partial-render-message>p:first-child,.html-wrapper>p:first-child{margin-top:0}.message-bubble>p:last-child,.message-bubble>.partial-render-message:last-child>p,.html-wrapper>p:last-child{margin-bottom:0}pre{overflow:auto;display:block;word-break:break-all;word-wrap:break-word;border-radius:7px;background:#2b2b2b;color:#f8f8f2;margin-top:.8em;margin-bottom:.8em;padding:.6em;font-size:.9em;line-height:1.5em}.image-message{padding:0;display:flex;background-color:#ddd}.image-message>*,.image-message>*>*{width:100%;border-radius:8px;display:flex}.audio-message{width:60%;max-width:300px;height:2.2em;max-height:54px;padding:0;background-color:unset}.audio-player{width:100%;height:100%}.audio-player-safari{height:fit-content;width:40px}.audio-player-safari-start{float:inline-start}.audio-player-safari-end{float:inline-end}.any-file-message{padding:1px}.any-file-message-contents{display:flex}.any-file-message-icon-container{width:1.3em;min-width:1.3em;position:relative;border-radius:4px;margin-inline-start:6px;margin-inline-end:2px}.any-file-message-icon{background-color:#fff;border-radius:4px;position:absolute;width:1em;height:1.25em;padding:1px;margin-top:auto;margin-bottom:auto;top:0;bottom:0}.any-file-message-text{padding-top:5px;overflow-wrap:anywhere;padding-bottom:5px;padding-inline-end:7px}.message-bubble>a{color:inherit}.start-item-position{margin-inline-end:10px}.end-item-position{margin-inline-start:10px}.role-hidden{display:none}.avatar{padding-top:5px;width:1.5em;height:1.5em;border-radius:1px}.avatar-container{margin-top:9px}.name{margin-top:16px;font-size:15px}#drag-and-drop{position:absolute;display:none;z-index:10;height:calc(100% - 10px);width:calc(100% - 10px);background-color:#70c6ff4d;border:5px dashed #6dafff}#file-attachment-container{position:absolute;height:3.6em;width:calc(80% - 4px);top:-2.5em;border-radius:5px;overflow:auto;text-align:start;background-color:#d7d7d73b;padding-inline-start:4px}.file-attachment{width:2.85em;height:2.85em;display:inline-flex;margin-inline-end:.6em;margin-bottom:.44em;margin-top:4px;position:relative;background-color:#fff;border-radius:5px}.image-attachment{width:100%;height:100%;object-fit:cover;border-radius:5px}.border-bound-attachment{width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid #c3c3c3;border-radius:5px;overflow:hidden}.border-bound-attachment-safari{width:calc(100% - 1px);height:calc(100% - 1px)}.audio-attachment-icon-container{cursor:pointer}.audio-attachment-icon-container:hover{background-color:#f8f8f8}.attachment-icon{inset-inline:0;bottom:0;top:2px;margin:auto;position:absolute;width:25px;-webkit-user-select:none;user-select:none}.not-removable-attachment-icon{top:0;right:0;bottom:0;left:0}.play-icon{filter:brightness(0) saturate(100%) invert(17%) sepia(0%) saturate(1392%) hue-rotate(67deg) brightness(98%) contrast(97%)}.stop-icon{filter:brightness(0) saturate(100%) invert(29%) sepia(90%) saturate(1228%) hue-rotate(198deg) brightness(93%) contrast(98%)}.audio-placeholder-text-3-digits{padding-inline-start:.26rem}.audio-placeholder-text-4-digits{padding-inline-start:.1rem}.any-file-attachment{padding:2px 0}.file-attachment-text-container{position:absolute;width:inherit;display:flex;align-items:center;height:100%;top:-1px}.audio-placeholder-text-3-digits-container{padding-top:1px;cursor:default}.any-file-attachment-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding-inline-start:.13em;margin-inline:auto}.remove-file-attachment-button{height:1.25em;width:1.25em;border:1px solid #cfcfcf;border-radius:25px;background-color:#fff;top:-4px;inset-inline-end:-5px;position:absolute;display:flex;justify-content:center;cursor:pointer;-webkit-user-select:none;user-select:none}.remove-file-attachment-button:hover{background-color:#e4e4e4}.remove-file-attachment-button:active{background-color:#d7d7d7}.x-icon{color:#4e4e4e;top:-.075em;position:relative;font-size:1.05em}.modal{display:none;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:80%;max-width:420px;max-height:80%;margin:auto;top:0;right:0;bottom:0;left:0;z-index:3}.modal-content{border-top:1px solid rgb(217,217,217);border-inline:1px solid rgb(217,217,217);border-start-start-radius:inherit;border-start-end-radius:inherit;background-color:#fff;overflow-y:auto;height:fit-content;max-height:calc(100% - 3.3em);width:100%}.modal-content>p{margin-inline:1em}.modal-content>ul{margin-inline-end:1em}.modal-button-panel{height:3.3em;border:1px solid;border-color:rgb(223,223,223) rgb(217,217,217) rgb(217,217,217);border-end-start-radius:inherit;border-end-end-radius:inherit;background-color:#fff;text-align:center;justify-content:center;display:flex;width:100%}.modal-button{min-width:2.5em;text-align:center;color:#fff;border-radius:5px;padding:.4em .4em .3em;height:1.25em;background-color:#3279b2;inset-block:0;margin-top:auto;margin-bottom:auto;cursor:pointer;-webkit-user-select:none;user-select:none;margin-inline:.31em}.modal-button:hover{background-color:#276da7}.modal-button:active{background-color:#1b5687}.modal-svg-button{padding:0 0 2px;width:2em;height:1.8em}.modal-svg-button-icon{width:100%;height:100%;filter:brightness(0) saturate(100%) invert(100%) sepia(15%) saturate(4%) hue-rotate(346deg) brightness(101%) contrast(102%)}#modal-background-panel{position:absolute;width:100%;height:100%;background-color:#00000042;z-index:2;display:none}.show-modal-background{animation:fadeInBackground .3s ease-in-out}@keyframes fadeInBackground{0%{opacity:0}to{opacity:1}}.show-modal{animation:fadeInModal .3s ease-in-out}@keyframes fadeInModal{0%{opacity:0;scale:.95}to{opacity:1;scale:1}}.hide-modal-background{animation:fadeOutBackground .2s ease-in-out}@keyframes fadeOutBackground{0%{opacity:1}to{opacity:0}}.hide-modal{animation:fadeOutModal .2s ease-in-out}@keyframes fadeOutModal{0%{opacity:1;scale:1}to{opacity:0;scale:.95}}.modal-camera-content{overflow:hidden;text-align:center;border:unset;height:100%;background-color:#2a2a2a;display:flex;justify-content:center}.camera-modal-canvas{max-width:100%;max-height:100%;margin-top:auto;margin-bottom:auto}.modal-svg-submit-button{background-color:green}.modal-svg-submit-button:hover{background-color:#007500}.modal-svg-submit-button:active{background-color:#006500}.modal-svg-submit-disabled{pointer-events:none;background-color:#747474}.modal-svg-close-button{height:1.56em;padding-top:.37em;padding-bottom:0;background-color:#c13e3e}.modal-svg-close-button:hover{background-color:#b43434}.modal-svg-close-button:active{background-color:#972929}.modal-svg-close-icon{width:80%;height:80%}.modal-svg-camera-button{height:1.6em;padding-top:.38em;padding-bottom:0}.modal-svg-camera-icon{height:76%}.modal-svg-refresh-icon{height:105%}.modal-svg-refresh-button{height:1.66em;padding-top:.11em;padding-bottom:.21em}.input-button-container{position:relative;z-index:1}.inside-end{position:absolute;inset-inline-end:calc(10% + .35em);inset-block-end:.85em}.inside-start{position:absolute;inset-inline-start:calc(10% + .35em);inset-block-end:.85em}.outside-start{position:absolute;inset-inline-end:calc(11px - .55em);inset-block-end:.88em}.outside-end{position:absolute;inset-inline-start:calc(11px - .55em);inset-block-end:.88em}#upload-images-icon{position:absolute;pointer-events:none;width:1.45em;height:1.45em;inset-inline-start:.11em;inset-block-end:.08em;filter:brightness(0) saturate(100%) invert(43%) sepia(0%) saturate(740%) hue-rotate(77deg) brightness(99%) contrast(92%)}#upload-gifs-icon{position:absolute;pointer-events:none;width:1.5em;height:1.48em;inset-inline-start:.07em;inset-block-end:.08em;filter:brightness(0) saturate(100%) invert(49%) sepia(0%) saturate(2586%) hue-rotate(12deg) brightness(93%) contrast(90%)}#upload-audio-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;inset-inline-start:.17em;inset-block-end:.2em;filter:brightness(0) saturate(100%) invert(15%) sepia(0%) saturate(337%) hue-rotate(125deg) brightness(91%) contrast(94%);transform:scaleX(.95)}#camera-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;inset-inline-start:.23em;inset-block-end:.2em;filter:brightness(0) saturate(100%) invert(52%) sepia(0%) saturate(161%) hue-rotate(164deg) brightness(91%) contrast(92%);transform:scaleX(.95)}#upload-mixed-files-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;inset-inline-start:.25em;inset-block-end:.2em;filter:brightness(0) saturate(100%) invert(53%) sepia(0%) saturate(36%) hue-rotate(74deg) brightness(98%) contrast(93%);transform:scaleX(.95)}#interim-text{color:gray}#microphone-button{padding-top:.5px}.outer-button-container>#microphone-button{padding-bottom:1px}#microphone-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;inset-inline-start:.25em;inset-block-end:.25em}.default-microphone-icon{filter:brightness(0) saturate(100%) invert(32%) sepia(0%) saturate(924%) hue-rotate(46deg) brightness(95%) contrast(99%)}.active-microphone-icon{filter:brightness(0) saturate(100%) invert(10%) sepia(97%) saturate(7495%) hue-rotate(0deg) brightness(101%) contrast(107%);border-radius:10px}.command-microphone-icon{filter:brightness(0) saturate(100%) invert(42%) sepia(96%) saturate(1067%) hue-rotate(77deg) brightness(99%) contrast(102%)}.unsupported-microphone{display:none}#submit-icon{height:100%;filter:brightness(0) saturate(100%) invert(32%) sepia(0%) saturate(924%) hue-rotate(46deg) brightness(95%) contrast(99%);width:1.21em}#stop-icon{background-color:#acacac;position:absolute;width:.95em;height:.95em;inset-inline-start:.35em;inset-block-end:.35em;border-radius:2px}.submit-button-enlarged{scale:1.1;margin-inline:.3em}.loading-submit-button{position:relative;inset-inline-start:calc(-9990px + .275em);width:.22em;height:.22em;border-radius:5px;background-color:#848484;color:#848484;box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484;animation:loading-submit-button 1.5s infinite linear;inset-block-end:-.75em}@keyframes loading-submit-button{0%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}16.667%{box-shadow:9990px -6px #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}33.333%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}50%{box-shadow:9990px 0 #848484,calc(9990px + .44em) -6px 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}66.667%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}83.333%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) -6px 0 0 #848484}to{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}}.tooltip{position:absolute;visibility:hidden;z-index:1;pointer-events:none;padding:5px;padding-inline:7px;background-color:#333;border-radius:5px;width:max-content}.tooltip-text{color:#fff;font-size:13px}.input-button{border-radius:4px;cursor:pointer;margin-bottom:.2em;-webkit-user-select:none;user-select:none}.input-button-svg{width:1.65em;height:1.65em}.input-button-svg-text{padding:1px;height:1.65em;display:flex}.input-button-svg-text>svg{padding:.22rem}.input-button-svg-text>div{margin-inline-start:2px}.input-button:hover,.input-button:focus-visible{background-color:#9c9c9c2e}.input-button:active{background-color:#9c9c9c5e}.input-button:active:not(:hover){background-color:transparent}.loading-button{cursor:auto}.loading-button:hover{background-color:unset}.text-button{filter:unset!important;display:flex;justify-content:center;align-items:center;margin-inline:4px;height:1.6em;width:max-content}#custom-icon{height:100%;width:1.2em}.custom-button-container-default{color:#505050}.custom-button-container-default>.dropup-menu-item-icon{color:unset}.custom-button-container-default>svg{filter:brightness(0) saturate(100%) invert(39%) sepia(1%) saturate(0%) hue-rotate(83deg) brightness(93%) contrast(90%)}.custom-button-container-default>.dropup-menu-item-icon>svg{position:absolute;inset-inline-start:.2em}.custom-button-container-active{background-color:#edf7ff;color:#0285ff}.custom-button-container-active:hover,.custom-button-container-active:focus-visible{background-color:#def0ff}.custom-button-container-active:active{background-color:#d2eaff}.custom-button-container-active>svg{filter:brightness(0) saturate(100%) invert(32%) sepia(34%) saturate(4196%) hue-rotate(196deg) brightness(107%) contrast(104%)}.custom-button-container-disabled{color:#aeaeae;cursor:auto}.custom-button-container-disabled>div{pointer-events:none}.custom-button-container-disabled:hover,.custom-button-container-disabled:focus-visible{background-color:transparent}.custom-button-container-disabled:active{background-color:transparent}.custom-button-container-disabled>svg{filter:brightness(0) saturate(100%) invert(67%) sepia(0%) saturate(818%) hue-rotate(28deg) brightness(102%) contrast(100%)}#text-input-container{background-color:#fff;width:80%;display:flex;border:1px solid #0000001a;border-radius:5px;margin-top:.8em;margin-bottom:.8em;box-shadow:#959da533 0 1px 12px;overflow-y:auto;max-height:200px;position:relative}.text-input-container-start-adjustment{margin-inline-start:1.5em}.text-input-container-end-adjustment{margin-inline-end:1.5em}.text-input-container-start-small-adjustment{margin-inline-start:1.1em}.text-input-container-start-small-adjustment>.outside-start{inset-inline-end:calc(14px - .55em)}.text-input-container-end-small-adjustment{margin-inline-end:1.1em}.text-input-container-end-small-adjustment>.outside-end{inset-inline-start:calc(14px - .55em)}#text-input{text-align:start;outline:none;word-wrap:break-word;line-break:auto}.text-input-styling{padding:.4em .5em;overflow:overlay;width:100%}.text-input-inner-start-adjustment{padding-inline-start:2.2em}.text-input-inner-end-adjustment{padding-inline-end:2em}.text-input-disabled{pointer-events:none;-webkit-user-select:none;user-select:none}[contenteditable]:empty:before{content:attr(deep-chat-placeholder-text);pointer-events:none}[contenteditable][textcolor]:empty:before{color:gray}.outside-end>#dropup-menu,.inside-end>#dropup-menu{inset-inline-end:0px}#dropup-icon{position:absolute;pointer-events:none;width:1.16em;height:1.2em;inset-inline-start:.265em;bottom:.43em;filter:brightness(0) saturate(100%) invert(54%) sepia(0%) saturate(724%) hue-rotate(6deg) brightness(92%) contrast(90%)}.dropup-button>*{pointer-events:none}#dropup-menu{background-color:#fff;position:absolute;transform:translateY(-100%);border-radius:5px;z-index:1;top:-.49em;box-shadow:#0003 -1px 2px 10px,#0000001a 0 2px 4px;cursor:pointer;-webkit-user-select:none;user-select:none}.dropup-menu-item{height:1.4em;padding-inline-start:.35em;padding-inline-end:.84em;padding-top:.28em;padding-bottom:.28em;display:flex;position:relative}.dropup-menu-item:hover,.dropup-menu-item:focus-visible{background-color:#f3f3f3}.dropup-menu-item:active{background-color:#ebebeb}.dropup-menu-item:active:not(:hover){background-color:transparent}.dropup-menu-item:first-child{padding-top:.49em;border-start-start-radius:inherit;border-start-end-radius:inherit}.dropup-menu-item:last-child{padding-bottom:.45em;border-end-start-radius:inherit;border-end-end-radius:inherit}.dropup-menu-item-icon{width:1.39em;position:relative}.dropup-menu-item-icon>svg{bottom:0!important;top:0!important;margin-bottom:auto;margin-top:auto}#dropup-menu-item-icon-element-custom{position:absolute;pointer-events:none;width:1.21em;height:1.21em;inset-inline-start:.28em;filter:brightness(0) saturate(100%) invert(15%) sepia(0%) saturate(337%) hue-rotate(125deg) brightness(91%) contrast(94%)}.dropup-menu-item-text{margin-inline-start:.56em;margin-top:.08em;width:max-content}#input{width:100%;display:inline-flex;text-align:center;margin-inline:auto;margin-top:auto;position:relative;justify-content:center}#chat-view{height:100%;grid-template-columns:100%}.deep-chat-downwards-mode{display:grid}.deep-chat-upwards-mode{display:flex;flex-direction:column}::-webkit-scrollbar{width:9px;height:9px}::-webkit-scrollbar-thumb{background-color:#d0d0d0;border-radius:5px}::-webkit-scrollbar-track{background-color:#f2f2f2}.deep-chat-web-model-button{margin-top:10px;margin-bottom:5px;margin-inline-start:1px}:host{all:initial;display:table-cell
279}#container{height:inherit;width:inherit;overflow:hidden}`,EW=Object.defineProperty,Ae=function(n,e,r,i){for(var o=void 0,s=n.length-1,a;s>=0;s--)(a=n[s])&&(o=a(e,r,o)||o);return o&&EW(e,r,o),o},Se=(function(t){function n(){var e;k(this,n);var r;return e=K(this,n),e.getMessages=function(){return[]},e.submitUserMessage=function(){return console.warn(rN("submitUserMessage"))},e.addMessage=function(){return console.warn(rN("addMessage"))},e.updateMessage=function(){},e.clearMessages=function(){},e.focusInput=function(){return af.focusFromParentElement(e._elementRef)},e.refreshMessages=function(){},e.scrollToBottom=function(){},e.disableSubmitButton=function(){},e.setPlaceholderText=function(){},e._hasBeenRendered=!1,e._auxiliaryStyleApplied=!1,e._elementRef=U(),e._elementRef.id="container",e.attachShadow({mode:"open"}).appendChild(e._elementRef),(r=e.shadowRoot)==null||r.appendChild(Mo.buildElement()),sS.apply(wW,e.shadowRoot),setTimeout(function(){e._hasBeenRendered||e.onRender()},20),e}return J(n,t),M(n,[{key:"changeToChatView",value:function(){this._activeService&&(this._activeService.validateKeyProperty=!1),this.onRender()}},{key:"onRender",value:function(){var r;cP.attemptAppendStyleSheetToHead(this.style),Wt.processConnect(this),(!this._activeService||this._activeService.demo)&&(this._activeService=Sq.create(this)),this.auxiliaryStyle&&!this._auxiliaryStyleApplied&&(sS.apply(this.auxiliaryStyle,this.shadowRoot),this._auxiliaryStyleApplied=!0),sS.applyDefaultStyleToComponent(this.style,this.chatStyle),Wt.checkForContainerStyles(this,this._elementRef),this._activeService.key&&this._activeService.validateKeyProperty?s$.render(this._elementRef,this.changeToChatView.bind(this),this._activeService):!(this._activeService instanceof ge)||this._activeService.key?((r=this._childElement)!==null&&r!==void 0||(this._childElement=this.children[0]),bW.render(this,this._elementRef,this._activeService,this._childElement)):this._activeService instanceof ge&&Cz.render(this._elementRef,this.changeToChatView.bind(this),this._activeService),this._hasBeenRendered||ol.onRender(this),this._hasBeenRendered=!0}},{key:"disconnectedCallback",value:function(){KS.chat=void 0}}])})(_z);Ae([Me("object")],Se.prototype,"connect");Ae([Me("object")],Se.prototype,"directConnection");Ae([Me("object")],Se.prototype,"webModel");Ae([Me("object")],Se.prototype,"requestBodyLimits");Ae([Me("function")],Se.prototype,"requestInterceptor");Ae([Me("function")],Se.prototype,"responseInterceptor");Ae([Me("function")],Se.prototype,"validateInput");Ae([Me("function")],Se.prototype,"loadHistory");Ae([Me("object")],Se.prototype,"chatStyle");Ae([Me("object")],Se.prototype,"attachmentContainerStyle");Ae([Me("object")],Se.prototype,"dropupStyles");Ae([Me("object")],Se.prototype,"inputAreaStyle");Ae([Me("object")],Se.prototype,"textInput");Ae([Me("object")],Se.prototype,"defaultInput");Ae([Me("object")],Se.prototype,"submitButtonStyles");Ae([Me("object")],Se.prototype,"customButtons");Ae([Me("string")],Se.prototype,"auxiliaryStyle");Ae([Me("array")],Se.prototype,"history");Ae([Me("object")],Se.prototype,"browserStorage");Ae([Me("object")],Se.prototype,"introMessage");Ae([Me("object")],Se.prototype,"avatars");Ae([Me("object")],Se.prototype,"names");Ae([Me("object")],Se.prototype,"displayLoadingBubble");Ae([Me("object")],Se.prototype,"errorMessages");Ae([Me("object")],Se.prototype,"messageStyles");Ae([Me("object")],Se.prototype,"textToSpeech");Ae([Me("object")],Se.prototype,"speechToText");Ae([Me("object")],Se.prototype,"images");Ae([Me("object")],Se.prototype,"gifs");Ae([Me("object")],Se.prototype,"camera");Ae([Me("object")],Se.prototype,"audio");Ae([Me("object")],Se.prototype,"microphone");Ae([Me("object")],Se.prototype,"mixedFiles");Ae([Me("object")],Se.prototype,"dragAndDrop");Ae([Me("object")],Se.prototype,"htmlWrappers");Ae([Me("object")],Se.prototype,"htmlClassUtilities");Ae([Me("object")],Se.prototype,"remarkable");Ae([Me("object")],Se.prototype,"focusMode");Ae([Me("boolean")],Se.prototype,"upwardsMode");Ae([Me("object")],Se.prototype,"scrollButton");Ae([Me("object")],Se.prototype,"hiddenMessages");Ae([Me("number")],Se.prototype,"maxVisibleMessages");Ae([Me("function")],Se.prototype,"onMessage");Ae([Me("function")],Se.prototype,"onClearMessages");Ae([Me("function")],Se.prototype,"onComponentRender");Ae([Me("function")],Se.prototype,"onInput");Ae([Me("function")],Se.prototype,"onError");Ae([Me("object")],Se.prototype,"demo");Ae([Me("object")],Se.prototype,"_insertKeyViewStyles");customElements.define("deep-chat",Se);var yF=Symbol("");function _F(t){return new Proxy(t,{has(n,e){return!!this.get(n,e,void 0)},get(n,e){let r=nt(n);return!SW(r)||!(e in r)?(id(n[e])&&n[e][yF]&&delete n[e],n[e]):(id(n[e])||(Object.defineProperty(n,e,{value:le(()=>n()[e]),configurable:!0}),n[e][yF]=!0),_F(n[e]))}})}var CW=[WeakSet,WeakMap,Promise,Date,Error,RegExp,ArrayBuffer,DataView,Function];function SW(t){if(t===null||typeof t!="object"||DW(t))return!1;let n=Object.getPrototypeOf(t);if(n===Object.prototype)return!0;for(;n&&n!==Object.prototype;){if(CW.includes(n.constructor))return!1;n=Object.getPrototypeOf(n)}return n===Object.prototype}function DW(t){return typeof t?.[Symbol.iterator]=="function"}var IW=new WeakMap,ar=Symbol("");function ei(t,...n){let e=nt(()=>hy(t)),r=n.reduce((s,a)=>A(A({},s),typeof a=="function"?a(s):a),e),i=t[ar],o=Reflect.ownKeys(t[ar]);for(let s of Reflect.ownKeys(r))if(o.includes(s)){let a=s;e[a]!==r[a]&&i[a].set(r[a])}kW(t)}function hy(t){let n=t[ar];return Reflect.ownKeys(t[ar]).reduce((e,r)=>{let i=n[r]();return Z(A({},e),{[r]:i})},{})}function TW(t){return IW.get(t[ar])||[]}function kW(t){let n=TW(t);for(let e of n){let r=nt(()=>hy(t));e(r)}}function bF(...t){let n=[...t],e=typeof n[0]=="function"?{}:n.shift(),r=n;return(()=>{class o{constructor(){let a=r.reduce((m,g)=>g(m),MW()),{stateSignals:l,props:c,methods:u,hooks:d}=a,f=A(A(A({}
vendor: 4,404 bytes, line 279
279,l),c),u);this[ar]=a[ar];for(let m of Reflect.ownKeys(f))this[m]=f[m];let{onInit:h,onDestroy:p}=d;h&&h(),p&&y(Ye).onDestroy(p)}static \u0275fac=function(l){return new(l||o)};static \u0275prov=O({token:o,factory:o.\u0275fac,providedIn:e.providedIn||null})}return o})()}function MW(){return{[ar]:{},stateSignals:{},props:{},methods:{},hooks:{}}}function iD(...t){let n=typeof t[0]=="function"?t:t.slice(1);return e=>n.reduce((r,i)=>i(r),e)}function wF(t){return n=>{let e=t(A(A(A({[ar]:n[ar]},n.stateSignals),n.props),n.methods));return Z(A({},n),{props:A(A({},n.props),e)})}}function fy(t){return n=>{let e=A(A(A({[ar]:n[ar]},n.stateSignals),n.props),n.methods),r=typeof t=="function"?t(e):t,i=(o,s)=>s?()=>{o&&o(),s(e)}:o;return Z(A({},n),{hooks:{onInit:i(n.hooks.onInit,r.onInit),onDestroy:i(n.hooks.onDestroy,r.onDestroy)}})}}function py(t){return n=>{let e=t(A(A(A({[ar]:n[ar]},n.stateSignals),n.props),n.methods));return Z(A({},n),{methods:A(A({},n.methods),e)})}}function my(t){return n=>{let e=typeof t=="function"?t():t,r=Reflect.ownKeys(e),i=n[ar],o={};for(let s of r)i[s]=Ee(e[s]),o[s]=_F(i[s]);return Z(A({},n),{stateSignals:A(A({},n.stateSignals),o)})}}var $0e=Symbol("DEVTOOLS_FEATURE");var AW=new P("ReduxDevtoolsConfig"),xW=(()=>{class t{#e=Ee({});get stores(){return this.#e()}#n;#r=ln(()=>{if(this.#n===void 0)throw new Error("no callback function defined");let e=this.#e(),r=Object.entries(e).reduce((i,[o,s])=>Z(A({},i),{[o]:hy(s)}),{});this.#n(r)});track(e,r){this.#e.update(i=>Z(A({},i),{[e]:r}))}onChange(e){this.#n=e}removeStore(e){this.#e.update(r=>Object.entries(r).reduce((i,[o,s])=>(o!==e&&(i[o]=s),i),{}))}notifyRenamedStore(e){this.#e()[e]&&this.#e.update(r=>A({},r))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),oD=new Set,EF={send:()=>{}},CF=(()=>{class t{#e={};#n=wm(y(po));#r=[];#i=A({name:"NgRx SignalStore"},y(AW,{optional:!0}));#t={};#o=1;#s=y(Ke).runOutsideAngular(()=>this.#n&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__.connect(this.#i):EF);constructor(){this.#n}ngOnDestroy(){oD.clear()}syncToDevTools(e){let r=Object.entries(e).reduce((s,[a,l])=>{let{options:c,name:u}=this.#e[a];return s[u]=c.map(l),s},{});this.#t=A(A({},this.#t),r);let i=Array.from(oD),o=i.length?i.join(", "):"Store Update";oD.clear(),this.#s.send({type:o},this.#t)}getNextId(){return String(this.#o++)}addStore(e,r,i,o){let s=r,a=Object.values(this.#e).map(c=>c.name);if(a.includes(s)&&!o.indexNames)throw new Error(`An instance of the store ${s} already exists. Enable automatic indexing via withDevTools('${s}', { indexNames: true }), or rename it upon instantiation.`);for(let c=1;a.includes(s);c++)s=`${r}-${c}`;this.#e[e]={name:s,options:o};let l=o.tracker;this.#r.includes(l)||this.#r.push(l),l.onChange(c=>this.syncToDevTools(c)),l.track(e,i)}removeStore(e){let r=this.#e[e].name;this.#e=Object.entries(this.#e).reduce((i,[o,s])=>(o!==e&&(i[o]=s),i),{}),this.#t=Object.entries(this.#t).reduce((i,[o,s])=>(o!==r&&(i[o]=s),i),{});for(let i of this.#r)i.removeStore(e)}renameStore(e,r){let i=this.#e[e];if(!i)return;let o=i.name;if(o===r)return;if(Object.entries(this.#e).filter(([a])=>a!==e).map(([,a])=>a.name).includes(r))throw new Error(`NgRx Toolkit/DevTools: cannot rename from ${o} to ${r}. ${r} is already assigned to another SignalStore instance.`);this.#e=Object.entries(this.#e).reduce((a,[l,c])=>(l===e?a[l]=Z(A({},c),{name:r}):a[l]=c,a),{}),this.#t=Object.entries(this.#t).reduce((a,[l,c])=>(l!==o&&(a[l]=c),a),{}),this.#r.forEach(a=>a.notifyRenamedStore(e))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),RW="___renameDevtoolsName",SF="___uniqueDevtoolsId",OW=Symbol("DEVTOOL_PROP");function DF(t,...n){return iD(py(()=>{let e=y(CF),r=e.getNextId();return{[RW]:i=>{e.renameStore(r,i)},[SF]:()=>r}}),wF(()=>({[OW]:n.filter(Boolean).map(e=>e.name)})),fy(e=>{let r=y(CF),i=String(e[SF]());return{onInit(){let o={indexNames:!n.some(s=>s.indexNames===!1),map:n.find(s=>s.map)?.map??(s=>s),tracker:y(n.find(s=>s.tracker)?.tracker||xW)};r.addStore(i,t,e,o)},onDestroy(){r.removeStore(i)}}}))}var z0e=Symbol("SYNC_STATUS");var q0e=iD(my({}));function IF(t,n){let e=n?.injector??y(Re),r=new ve,i=t(r).subscribe();e.get(Ye).onDestroy(()=>i.unsubscribe());let o=(s,a)=>
279{if(NW(s))return r.next(s),{destroy:Ci};let l=PW(),c=a?.injector??l??e;if(typeof s=="function"){let d=ln(()=>{let f=s();nt(()=>r.next(f))},{injector:c});return i.add({unsubscribe:()=>d.destroy()}),d}let u=s.subscribe(d=>r.next(d));return i.add(u),c!==e&&c.get(Ye).onDestroy(()=>u.unsubscribe()),{destroy:()=>u.unsubscribe()}};return o.destroy=i.unsubscribe.bind(i),o}function NW(t){return typeof t!="function"&&!cr(t)}function PW(){try{return y(Re)}catch{return}}var gy=class t{supabase=y(nr);getConfig(){let n=this.supabase.from("config").select("max_user_message_length, max_conversations_per_user").order("updated_at",{ascending:!1}).limit(1);return Xe(n).pipe(te(({data:e,error:r})=>{if(r)throw r;if(e.length===0)throw new Error("Failed to fetch config");return e[0]}))}static \u0275fac=function(e){return new(e||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})};var gr=class extends Error{constructor(e,r={},i){super(e);this.code=e;this.payload=r;this.originalError=i}},vy=class t extends gr{static code="undefined_user";constructor(){super(t.code)}},yy=class t extends gr{static code="chat_number_limit_reached";constructor(n){super(t.code,{},n)}},_y=class t extends gr{static code="chat_with_this_name_already_exists";constructor(n){super(t.code,{},n)}},by=class t extends gr{static code="undefined_chat_creation_error";constructor(n){super(t.code,{},n)}},wy=class t extends gr{constructor(e,r){super(t.code,{conversationId:e},r);this.conversationId=e}static code="conversation_requirements_not_found"},Ey=class t extends gr{constructor(e,r){super(t.code,{conversationId:e},r);this.conversationId=e}static code="conversation_not_found"},Cy=class t extends gr{constructor(e,r){super(t.code,{conversationId:e},r);this.conversationId=e}static code="conversation_deletion_error"},Sy=class t extends gr{static code="messages_fetching_error";constructor(n){super(t.code,{},n)}};var ti=class t{supabase=y(nr);authService=y(Nn);user=er(this.authService.user.pipe(un()));addNewConversation(n){if(!this.user())throw new vy;let e=this.supabase.rpc("create_conversation",{user_id_param:this.user().id,conversation_name:n});return Xe(e).pipe(te(({data:r,error:i})=>{if(i)switch(i?.code){case"23505":throw new _y(i);case"P0001":throw new yy(i);default:throw new by(i)}return r}))}deleteConversation(n){let e=this.supabase.from("conversation").delete().eq("id",n);return Xe(e).pipe(te(({data:r,error:i})=>{if(i)throw new Cy(n,i)}))}getUserConversations(){let n=this.supabase.from("conversation").select("id, name, created_at, updated_at").order("updated_at",{ascending:!1});return Xe(n).pipe(te(({data:e,error:r})=>{if(r)throw r;return e}))}getConversationHints(n){let e=this.supabase.from("conversation").select("hints").eq("id",n);return Xe(e).pipe(te(({data:r,error:i})=>{if(i)throw i;return r[0].hints}))}getConversationRequirements(n){let e=this.supabase.from("user_conversation_requirements").select("id, discovered, group_name_pl, group_name_en, group_code, category_name_pl, category_name_en, requirement_content_pl, requirement_content_en, requirement_extras").eq("conversation_id",n);return Xe(e).pipe(te(({data:r,error:i})=>{if(i)throw i;if(r!==null&&r.length===0)throw new wy(n);return r}))}static \u0275fac=function(e){return new(e||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})};var sD="plot_data",ou=class t{sectionsCodesToIconsMap={client_data:"person",basic_information:"info",construction_and_technology:"construction",layout_and_aesthetics:"home",plot_data:"home_pin"};geoportaIdentifyParcelUrl="https://mapy.geoportal.gov.pl/imap/Imgp_2.html?identifyParcel=";http=y(es);chatService=y(ti);translate=y(Jt);authService=y(Nn);getSummary(n){return this.chatService.getConversationRequirements(n).pipe(te(e=>this.createSummary(e)))}createSummary(n){let e=this.translate.getCurrentLang().toLowerCase(),r=`category_name_${e}`,i=`group_name_${e}`,o=`requirement_content_${e}`,s={},a={};n.forEach(u=>{let d=u[i];s[d]||(s[d]=[]),s[d].push(u),a[d]=u.group_code});let l=Object.keys(s).map(u=>{let d=a[u],f=this.sectionsCodesToIconsMap[d]??"info",h=s[u].map(p=>({id:p.id,name:p[r],value:p[o],discovered:p.discovered,ordinalNumber:p.requirement_extras?.ordinal_number,areaHa:p.requirement_extras?.area_ha,city:p.requirement_extras?.city}));
279if(d===sD){if(h.length!==1)throw new Error("Plot data should have only one requirement containing data of the specific plot");let p=h[0],m=p.value,g=p.ordinalNumber;p.geoportalUrl=`${this.geoportaIdentifyParcelUrl}${m}`,p.mapImageUrl=`${Kr.supabaseUrl}/storage/v1/object/public/parcel-maps/${g}.png`,p.areaHa=p.areaHa}return{name:u,code:d,icon:f,progress:0,requirements:h}});l.sort((u,d)=>u.name.localeCompare(d.name)),l.forEach(u=>{u.progress=u.requirements.reduce((d,f)=>f.discovered?d+1:d,0)/u.requirements.length});let c=l.find(u=>u.code===sD);if(!c)throw new Error("Plot data section not found");return{sections:l.filter(u=>u.code!==sD),plotSection:c,progress:l.reduce((u,d)=>u+d.progress,0)/l.length}}downloadSummaryAsPDF(n,e="pl"){try{this.authService.getAccessToken().pipe(It(1)).pipe(Tt(r=>{let i=new _i().set("conversationId",n.id).set("language",e);return this.http.get(`${Kr.supabaseUrl}/functions/v1/generate-summary-pdf`,{responseType:"blob",params:i,headers:{Authorization:`Bearer ${r}`}})})).subscribe(r=>{let o=`${n.name?this.sanitizeFilename(n.name):this.translate.instant("summary.pdf_filename")}.pdf`;this.saveBlobAsFile(r,o)})}catch(r){throw new gr("download_summary_failed",{},r)}}sanitizeFilename(n){let e=n.replace(/[\\/:*?"<>|]/g,"_").replace(/[\x00-\x1f\x80-\x9f]/g,"").trim().replace(/\s+/g,"_");return e.length>0?e.substring(0,150):"summary"}saveBlobAsFile(n,e){let r=document.createElement("a");r.setAttribute("download",e),r.href=window.URL.createObjectURL(n),r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(r.href)}static \u0275fac=function(e){return new(e||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})};var Dy={state:"loading",error:null,conversationId:null,conversation:null,conversations:null,summary:null,chatInputHints:[],config:null},pn=bF({providedIn:"root"},my(Dy),py((t,n=y(ti),e=y(ou),r=y(gy),i=y(Jt))=>({loadData:IF(pu(_t(o=>o!==null),Kt(()=>ei(t,{state:"loading",error:null})),Tt(o=>n.getUserConversations().pipe(Tt(s=>{if(s.length===0)return ei(t,Z(A({},Dy),{state:"no_conversations_yet"})),an;let a;if(o==="latest")a=s.sort((l,c)=>c.updated_at-l.updated_at)[0];else{let l=s.find(c=>c.id===o);if(!l)return ei(t,Z(A({},Dy),{conversations:s,state:"error",error:new Ey(o)})),an;a=l}return Us([e.getSummary(a.id),n.getConversationHints(a.id),r.getConfig()]).pipe(te(([l,c,u])=>({summary:l,conversations:s,selectedConversation:a,chatInputHints:c,config:u})))}),Kt(({summary:s,conversations:a,selectedConversation:l,chatInputHints:c,config:u})=>{ei(t,{state:"ready",error:null,conversation:l,conversations:a,chatInputHints:c,summary:s,config:u})}),oo(s=>(console.error("Error loading data:",s),ei(t,Z(A({},Dy),{state:"error",error:s})),an)))))),setConversationId(o){ei(t,{conversationId:o})},setError(o){ei(t,{state:"error",error:o})},setState(o){ei(t,{state:o})},setChatInputHints(o){ei(t,{chatInputHints:o})},setDiscoveries(o){if(t.summary===null)throw new Error("This method can only be called when summary is populated");if(!o||o.length===0)return;let s=new Map(o.map(u=>[u.id,u])),a=A({},t.summary()),l=[],c=a.plotSection.requirements[0].id;if(s.has(c)){this.loadData(t.conversationId);return}a.sections.forEach(u=>{u.requirements.forEach(d=>{let f=s.get(d.id);f&&(d.discovered=!0,d.value=f[`content_${i.getCurrentLang()}`],l.push(d.id))}),u.progress=u.requirements.reduce((d,f)=>d+(f.discovered?1:0),0)/u.requirements.length}),l.length!==o.length&&console.warn(`Number of updated requirements (${l.length}) does not match number of discoveries (${o.length})`,`Following ids from discoveries were not found in summary: ${o.filter(u=>!l.includes(u.id))}`),a.progress=a.sections.reduce((u,d)=>u+d.progress,0)/a.sections.length,ei(t,{summary:a})}})),fy({onInit(t){t.loadData(t.conversationId)}}),DF("chat"));var FW=()=>["conversationNameAlreadyTaken"];function LW(t,n){t&1&&(L(0,"div",1),Ce(1,"mvc-loader"),V())}function jW(t,n){if(t&1){let e=$t();L(0,"h2",2),j(1),X(2,"translate"),V(),L(3,"form",3),Ge("ngSubmit",function(){gt(e);let i=ie();return vt(i.onSubmitClicked())}),L(4,"div",4)(5,"label",5),j(6),X(7,"translate"),V(),L(8,"div",6),Ce(9,"input",7),X(10,"translate"),V(),Ce(11,"mvc-form-validation-message",8),V(),L(12,"div",9)(13,"button",10),Ge("click",function(){gt(e);let i=ie();return vt(i.onCancelClicked())}),j(14),X(15,"translate"),V(),L(16,"button",11),Ge("click",function(){gt(e);let i=ie();return vt(i.onSubmitClicked())}),j(17),X(18,"translate"),V()()()}if(t&2){let e=ie();R(),me(ne(2,10,"chat_create_dialog.title")),R(2),ue("formGroup",e.form),R(3),me(ne(7,12,"chat_create_dialog.name")),R(3),ue("placeholder",ec(ne(10,14,"chat_create_dialog.name_placeholder"))),R(2),ue("control",e.form.controls.name)("customErrors",$n(20,FW)),R(3),me(ne(15,16,"chat_create_dialog.cancel")),R(2),ue("disabled",e.loading()||!e.form.valid),R(),me(ne(18,18,"chat_create_dialog.save"))}}function BW(t){return n=>t.has(n.value)?{conversationNameAlreadyTaken:{value:n.value}}:null}var Ss=class t{conversationService=y(ti);destroyRef=y(Ye);router=y(cn);store=y(pn);dialogRef=y(So);formBuilder=y(dv);form;loading=Ee(!0,{});ngOnInit(){this.conversationService.getUserConversations().pipe(It(1),te(n=>new Map(n.map(e=>[e.name,void 0]))),un(this.destroyRef)).subscribe({next:n=>{this.form=this.formBuilder.group({name:["",[Co.required,Co.maxLength(100),Co.minLength(5),BW(n)]]})},complete:()=>this.loading.set(!1),error:n=>{throw this.loading.set(!1),n}})}onSubmitClicked(){this.loading.set(!0),this.conversationService.addNewConversation(this.form.value.name).pipe(un(this.destroyRef)).subscribe({next:n=>{this.router.navigate([`/conversation/${n}`]),this.store.setConversationId(n),this.dialogRef.close(!0)},complete:()=>this.loading.set(!1),error:n=>{throw this.loading.set(!1),this.dialogRef.close(!1),n}})}onCancelClicked(){this.dialogRef.close(!1)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-chat-creation-dialog"]],decls:3,vars:2,consts:[[1,"dialog"],[1,"dialog-form-overlay"],[1,"title"],[1,"login-form",3,"ngSubmit","formGroup"],[1,"input-group"],["for","email"],[1,"input-wrapper","relative","flex","items-center"],["id","email","cdkFocusInitial","","formControlName","name","type","text",1,"input-field","pl2",3,"placeholder"],[3,"control","customErrors"],[1,"actions"],[1,"btn","hoverable","fully-rounded",3,"click"],["type","submit",1,"btn","hoverable","fully-rounded",3,"click","disabled"]],template:function(e,r){e&1&&(L(0,"div",0),be(1,LW,2,0,"div",1),be(2,jW,19,21),V()),e&2&&(R(),we(r.loading()?1:-1),R(),we(r.loading()?-1:2))},dependencies:[st,hv,cv,Pc,Fc,ov,_h,yh,Lc,Gi,qt,zt],encapsulation:2})};var TF="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var hf=(t=21)=>{let n="",e=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)n+=TF[e[t]&63];return n};var VW=["*"],Iy=class t{static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-hint-chips"]],ngContentSelectors:VW,decls:2,vars:0,consts:[["role","button",1,"hoverable","chips","clickable","p1","m1","rounded-corners"]],template:function(e,r){e&1&&(Jl(),Te(0,"button",0),Yl(1),Ne())},styles:[".chips[_ngcontent-%COMP%]{display:inline-block;background:linear-gradient(50deg,var(--primary) 0%,var(--secondary) 88%);font-weight:bolder;border-radius:.6rem;box-shadow:0 14px 28px #00000040,0 10px 10px #00000038;transition:transform .3s ease-in-out;color:#000!important}.chips[_ngcontent-%COMP%]:hover{transform:translateY -5px}"]})};var UW=(t,n)=>n.text;function HW(t,n){if(t&1){let e=$t();L(0,"mvc-hint-chips",3),Ge("click",function(){let i=gt(e).$implicit,o=ie();
279return vt(o.hintClicked.emit(i.text))}),j(1),V()}if(t&2){let e=n.$implicit;R(),me(e.text)}}var Ty=class t{store=y(pn);translate=y(Jt);isExpanded=Ee(!1,{});hintClicked=hd();contentId=`collapsible-content-${hf()}`;headerId=`collapsible-header-${hf()}`;languageChange=er(this.translate.onLangChange);defaultHints=le(()=>{let n=this.languageChange();return[{text:this.translate.instant("chat.input_hints.default_hint_1")},{text:this.translate.instant("chat.input_hints.default_hint_2")}]},{});hints=le(()=>{let n=this.store.chatInputHints();return n&&n.length>0?n.slice(0,3):this.defaultHints()},{});constructor(){ln(()=>{let n=this.store.chatInputHints();(!n||n.length===0)&&this.isExpanded.set(!0)})}toggle(){this.isExpanded.update(n=>!n)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-chat-input-hints"]],outputs:{hintClicked:"hintClicked"},decls:7,vars:14,consts:[["type","button",1,"bulb-button","collapsible-trigger",3,"click","id"],["src","/app/assets/light_bulb.png","alt","{{ 'chat.input_hints.light_bulb_alt' | translate'}}"],["role","region",1,"collapsible-content","pr1",3,"id"],[3,"click"]],template:function(e,r){e&1&&(L(0,"div")(1,"button",0),X(2,"translate"),Ge("click",function(){return r.toggle()}),Ce(3,"img",1),V(),L(4,"div",2),Br(5,HW,2,1,"mvc-hint-chips",null,UW),V()()),e&2&&(R(),Er("bulb-on",r.isExpanded()),ue("id",r.headerId),ut("title",ne(2,12,r.isExpanded()?"chat.input_hints.title_closed":"chat.input_hints.title_opened"))("aria-expanded",r.isExpanded())("aria-controls",r.contentId),R(3),Bi("visibility",r.isExpanded()?"visible":"hidden"),Er("is-open",r.isExpanded()),ue("id",r.contentId),ut("aria-hidden",!r.isExpanded()),R(),Vr(r.hints()))},dependencies:[st,Iy,qt,zt],styles:['@charset "UTF-8";.bulb-button[_ngcontent-%COMP%]{width:1.5rem;position:relative}.bulb-button[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{position:relative;display:block;max-width:100%;height:auto;z-index:3}.bulb-on[_ngcontent-%COMP%]:after{content:"";position:absolute;left:50%;top:31%;transform:translate(-50%,-50%);width:.5rem;height:.5rem;border-radius:100%;-webkit-box-shadow:0px 0px 93px 1rem rgba(255,211,0,.7);-moz-box-shadow:0px 0px 93px 1rem rgba(255,211,0,.7);box-shadow:0 0 1rem .7rem #ffd300b3;z-index:1}.collapsible-content[_ngcontent-%COMP%]{position:absolute;right:0;bottom:-.5rem;margin-right:1rem;width:300px;max-width:78vw;display:flex;flex-direction:column;align-items:end}']})};var ky=class t{supabase=y(nr);getMessages(n){let e=this.supabase.from("messages").select("role, content").eq("conversation_id",n).order("created_at",{ascending:!0});return Xe(e).pipe(te(({data:r,error:i})=>{if(i)throw new Sy(i);return r.map(o=>({role:o.role.toLowerCase()==="user"?"user":"ai",text:o.content}))}))}static \u0275fac=function(e){return new(e||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})};var $W=["deepChat"],zW=t=>({"glass card elevated":t}),qW=(t,n,e)=>({default:t,service:n,speechToText:e}),WW=t=>({overrides:t}),GW=()=>({width:"100%",padding:0,"border-top":"var(--border)"}),KW=()=>({padding:"12px 12px 12px 12px",boxShadow:"none",width:"100%",background:"rgba(0, 0, 0, 0.2)",border:"var(--border)",borderRadius:"14px",marginLeft:"0.5rem",marginRight:"0.5rem",transition:"all 0.3s ease"}),JW=()=>({color:"var(--text-light)"}),YW=()=>({outline:"none",borderColor:"#00f2fe",background:"rgba(0, 0, 0, 0.3)",boxShadow:"0 0 15px rgba(0, 242, 254, 0.1)"}),ZW=(t,n,e)=>({container:t,text:n,focus:e}),XW=()=>({color:"rgba(var(--text-light-rgb), 0.8)"}),QW=(t,n)=>({text:t,style:n}),eG=(t,n,e,r)=>({disabled:t,styles:n,placeholder:e,characterLimit:r}),tG=t=>({disabled:t}),nG=()=>({borderRadius:"100%",padding:"0.5rem",marginBottom:"0.5rem",marginRight:"0.5rem",transition:"background-color 0.15s ease-in-out"}),rG=()=>({"text-shadow":"0 0 15px rgba(var(--primary-rgb), 0.6)"}),iG=()=>({}),oG=(t,n,e)=>({default:t,hover:n,click:e}),sG=(t,n)=>({filter:"unset !important",stroke:t,cursor:n}),kF=t=>({default:t}),aG=t=>({styles:t}),lG=(t,n)=>({container:t,svg:n}),cG=t=>({submit:t,alwaysEnabled:!0,position:"inside-end"}),uG=()=>({backgroundColor:"rgba(0, 0, 0, 0.2)",borderTopRightRadius:"2px",padding:"0.75rem"}
279),MF=t=>({bubble:t}),dG=()=>({backgroundColor:"rgba(var(--primary-rgb), 0.25)",color:"white",borderTopLeftRadius:"2px",padding:"0.75rem"}),hG=(t,n)=>({user:t,ai:n});function fG(t,n){t&1&&(Ce(0,"mvc-loader",2),X(1,"translate")),t&2&&ue("size","50px")("text",ne(1,2,"chat.loading_messages"))}function pG(t,n){t&1&&(Ce(0,"mvc-loader",2),X(1,"translate")),t&2&&ue("size","50px")("text",ne(1,2,"chat.loading_conversation"))}function mG(t,n){if(t&1){let e=$t();L(0,"div",3),j(1),X(2,"translate"),L(3,"button",10),Ge("click",function(){gt(e);let i=ie();return vt(i.retry())}),j(4),X(5,"translate"),V()()}t&2&&(R(),Qe(" ",ne(2,2,"chat.error_message")," "),R(3),Qe(" ",ne(5,4,"retry")))}function gG(t,n){if(t&1){let e=$t();L(0,"div",4),j(1),X(2,"translate"),L(3,"button",10),Ge("click",function(){gt(e);let i=ie();return vt(i.onAddNewConversationClicked())}),j(4),X(5,"translate"),V()()}t&2&&(R(),Qe(" ",ne(2,2,"chat.conversation_not_found")," "),R(3),Qe(" ",ne(5,4,"bottom_nav.add_button_title")))}function vG(t,n){t&1&&(L(0,"div",5)(1,"p",11),j(2),X(3,"translate"),V(),L(4,"span",12),j(5," chat "),V()()),t&2&&(R(2),Qe(" ",ne(3,1,"chat.welcome")," "))}function yG(t,n){if(t&1){let e=$t();L(0,"mvc-chat-input-hints",13),Ge("hintClicked",function(i){gt(e);let o=ie();return vt(o.onHintClicked(i))}),V()}}function _G(t,n){if(t&1&&(L(0,"div",8)(1,"div",14)(2,"span",15),j(3," info "),V(),j(4),X(5,"translate"),V(),L(6,"p",16),j(7),X(8,"translate"),L(9,"a",17),j(10),X(11,"translate"),V()()()),t&2){let e=ie();R(4),Qe(" ",ne(5,5,"chat.chat_finished_title")," "),R(3),Qe("",ne(8,7,"chat.chat_finished_message")," "),R(2),ue("routerLink",sw("/conversation/",e.conversationId(),"/summary")),R(),Qe(" ",ne(11,9,"chat.go_to_summary")," ")}}function bG(t,n){t&1&&(L(0,"div",9),j(1,"dsfds"),V())}var My=class t{destroyRef=y(Ye);store=y(pn);authService=y(Nn);messagesService=y(ky);translate=y(Jt);dialog=y(gs);deepChatElementRef=fa("deepChat",{});deepChat=null;accessToken=er(this.authService.getAccessToken().pipe(un()));languageCode=er(this.translate.onLangChange.pipe(te(()=>this.translate.getCurrentLang())),{initialValue:this.translate.getCurrentLang()});data=Ee({messages:[],state:"loading_conversation"},{});noMessages=Ee(!1,{});messagesSubscription=null;showHints=le(()=>this.data().state==="ready"&&this.chatProgress()<1,{});chatProgress=le(()=>this.store.summary()?.progress||0,{});conversationId=this.store.conversationId;chatEndpointConnectionConfig=le(()=>({url:`${Kr.supabaseUrl}/functions/v1/chat`,method:"POST",headers:{apikey:Kr.supabaseKey,"Content-Type":"application/json"}}),{});conversationProgress=le(()=>this.store.summary()?.progress||0,{});textInputDisabled=le(()=>this.data().state!=="ready"||this.store.summary()?.progress===void 0||this.store.summary()?.progress>=1,{});maxUserMessageLength=le(()=>this.store.config()?.max_user_message_length||250,{});requestInterceptor=n=>(this.noMessages.set(!1),{headers:Z(A({},n.headers),{Authorization:`Bearer ${this.accessToken()}`}),body:{languageCode:this.languageCode(),message:n.body.messages[0].text,conversationId:this.store.conversation()?.id}});responseInterceptor=n=>{let e=n;return e.error||e.status&&e.status>=400?(console.error("Error from chat endpoint",e),{error:!0}):(n=n,n.message?(this.store.setChatInputHints(n.hints||[]),this.store.setDiscoveries(n.discoveries||[]),{text:n.message}):(console.error("Invalid response format from chat endpoint",n),{error:!0}))};constructor(){OA(this.store.state).pipe(un(this.destroyRef),Kt(n=>{n==="loading"?this.data.set({messages:[],state:"loading_conversation"}):n==="error"&&this.data.set({messages:[],state:"notFound"})}),_t(n=>n==="ready"),Tt(()=>{let n=this.store.conversation().id;return this.data.set({messages:[],state:"loading_messages"}),this.messagesService.getMessages(n).pipe(It(1))})).subscribe({next:n=>{this.noMessages.set(n.length===0),this.data.set({messages:n,state:"ready"})},error:n=>this.store.setError(n)})}ngAfterViewInit(){let n=this.deepChatElementRef()?.nativeElement;this.deepChat=n}onHintClicked(n){let e=this.deepChat.shadowRoot?.querySelector("#text-input");e&&(e.innerText=n,e.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n})),e.focus(),this.moveCursorToEnd(e))}onAddNewConversationClicked(){this.dialog.open(Ss,{width:"400px",maxWidth:"100%",minWidth:"400px"})}retry(){this.store.loadData(this.store.conversation()?.id)}moveCursorToEnd(n){let e=document.createRange(),r=window.getSelection();e.selectNodeContents(n),e.collapse(!1),r?.removeAllRanges(),r?.addRange(e)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-chat"]],viewQuery:function(e,r){e&1&&Yo(r.deepChatElementRef,$W,5),e&2&&Li()},decls:15,vars:85,consts:[["deepChat",""],[1,"chat-wrapper","block","relative","flex","flex-column","ml2","mr2",3,"ngClass"],[1,"loader",3,"size","text"],[1,"message-container"],[1,"message-container","ml2","mr2"],[1,"init-message","center","absolute","p2","rounded-corners","text-light"],["auxiliaryStyle",` 280 ::-webkit-scrollbar {
281 width: 6px; 282 } 283 ::-webkit-scrollbar-track { 284 background: transparent; 285 } 286 ::-webkit-scrollbar-thumb { 287 background-color: rgba(255, 255, 255, 0.1); 288 backdrop-filter: blur(5px); 289 border-radius: 20px; 290 }`,1,"deep-chat",2,"border","none","width","100%","height","100%","max-height","var(--chat-max-height)","font-size","1rem","border-radius","0","background-color","var(--bg-light)","position","relative","overflow","hidden",3,"hidden","history","errorMessages","inputAreaStyle","textInput","submitButton","submitButtonStyles","messageStyles","connect","requestInterceptor","responseInterceptor"],[1,"hints"],[1,"chat-finished-message","p1"],[1,"bottom-nav-placeholder"],[1,"btn","p1","neon-btn-secondary","mt2","fully-rounded",3,"click"],[1,"text-lighter"],["aria-hidden","true",1,"icon","material-symbols-outlined","mt2"],[1,"hints",3,"hintClicked"],[1,"flex","items-center","mb1"],[1,"material-symbols-outlined","mr1"],[1,"mb1"],[1,"block","text-primary",3,"routerLink"]],template:function(e,r){e&1&&(L(0,"div",1),be(1,fG,2,4,"mvc-loader",2),be(2,pG,2,4,"mvc-loader",2),be(3,mG,6,6,"div",3),be(4,gG,6,6,"div",4),be(5,vG,6,3,"div",5),Ce(6,"deep-chat",6,0),X(8,"translate"),X(9,"translate"),X(10,"translate"),X(11,"translate"),be(12,yG,1,0,"mvc-chat-input-hints",7),be(13,_G,12,11,"div",8),V(),be(14,bG,2,0,"div",9)),e&2&&(ue("ngClass",Nt(28,zW,r.data().state==="ready")),R(),we(r.data().state==="loading_messages"?1:-1),R(),we(r.data().state==="loading_conversation"?2:-1),R(),we(r.data().state==="error"?3:-1),R(),we(r.data().state==="notFound"?4:-1),R(),we(r.data().state==="ready"&&r.noMessages()?5:-1),R(),ue("hidden",r.data().state!=="ready"&&r.data().messages.length===0)("history",r.data().messages)("errorMessages",Nt(34,WW,ha(30,qW,ne(8,20,"chat.user_message_error"),ne(9,22,"chat.user_message_error"),ne(10,24,"chat.user_message_error"))))("inputAreaStyle",$n(36,GW))("textInput",aw(48,eG,r.textInputDisabled(),ha(40,ZW,$n(37,KW),$n(38,JW),$n(39,YW)),Sr(45,QW,ne(11,26,"chat.placeholder"),$n(44,XW)),r.maxUserMessageLength()))("submitButton",Nt(53,tG,r.textInputDisabled()))("submitButtonStyles",Nt(72,cG,Sr(69,lG,ha(58,oG,$n(55,nG),$n(56,rG),$n(57,iG)),Nt(67,aG,Nt(65,kF,Sr(62,sG,r.chatProgress()>=1?"var(--text-light)":"var(--primary)",r.chatProgress()>=1?"not-allowed":"pointer"))))))("messageStyles",Nt(83,kF,Sr(80,hG,Nt(75,MF,$n(74,uG)),Nt(78,MF,$n(77,dG)))))("connect",r.chatEndpointConnectionConfig())("requestInterceptor",r.requestInterceptor)("responseInterceptor",r.responseInterceptor),R(6),we(r.data().state==="ready"&&r.showHints()?12:-1),R(),we(r.data().state==="ready"&&r.chatProgress()>=1?13:-1),R(),we(r.data().state==="error"?14:-1))},dependencies:[st,ma,vo,os,qt,Ty,Gi,zt],styles:["[_nghost-%COMP%]{--padding-top-bottom: 1rem;width:100%;display:flex;justify-content:center;--chat-max-height: calc(100dvh - (var(--app-bar-height) + 2 * var(--padding-top-bottom) + 2rem));height:calc(var(--chat-max-height))}@media(max-width:768px){[_nghost-%COMP%]{--chat-max-height: calc(100dvh - (var(--app-bar-height) + var(--nav-bar-height) + 1rem))}}.chat-wrapper[_ngcontent-%COMP%]{flex:1;padding:0;width:500px;max-width:500px;overflow:hidden}@media(min-width:1025px){.chat-wrapper[_ngcontent-%COMP%]{max-width:750px}}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%]{margin:0!important;border:unset;border-radius:unset}}.deep-chat[_ngcontent-%COMP%]{border:none;width:100%;height:100%;font-size:1rem;border-radius:var(--corner-radius);background-color:var(--bg-light);position:relative;overflow:hidden}.init-message[_ngcontent-%COMP%]{text-align:center;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:2;width:calc(100% - 4.5rem);font-size:1.1rem}.init-message[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{font-size:8rem;color:rgba(var(--text-light-rgb),.2)}.hints[_ngcontent-%COMP%]{position:absolute;bottom:6rem;right:1.5rem;z-index:2}.loader[_ngcontent-%COMP%]{position:relative;top:50%;transform:translateY(-100%)}[hidden][_ngcontent-%COMP%]{display:none!important}.message-container[_ngcontent-%COMP%]{text-align:center;color:var(--text-light);display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;margin:1rem;z-index:1}.message-container[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{min-width:100px}.chat-finished-message[_ngcontent-%COMP%]{background-color:var(--bg-dark);border-top:1px solid rgba(var(--text-light-rgb),.2);text-align:center;color:var(--text-light);position:absolute;z-index:2;bottom:0;left:0;height:4.2rem;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.chat-finished-message[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{width:calc(100% - 3rem)}"]})};var Ay=class t{static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-home"]],decls:2,vars:0,consts:[[1,"main-container","pt2","pb2"]],template:function(e,r){e&1&&(L(0,"div",0),Ce(1,"mvc-chat"),V())},dependencies:[My],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column}@media(max-width:768px){.main-container[_ngcontent-%COMP%]{padding-top:0!important}}"]})};var Ds=(function(t){return t[t.None=0]="None",t[t.Ctrl=1]="Ctrl",t[t.Shift=2]="Shift",t[t.Alt=4]="Alt",t[t.Meta=8]="Meta",t.Any="Any",t})(Ds||{}),aD=class{configs=[];handle(n){for(let e of this.configs)e.matcher(n)&&(e.handler(n),e.preventDefault&&n.preventDefault(),e.stopPropagation&&n.stopPropagation())}};function wG(t){return(+t.ctrlKey&&Ds.Ctrl)|(+t.shiftKey&&Ds.Shift)|(+t.altKey&&Ds.Alt)|(+t.metaKey&&Ds.Meta)}function EG(t,n){let e=wG(t),r=Array.isArray(n)?n:[n];return r.includes(Ds.Any)?!0:r.some(i=>e===i)}var su=class extends aD{options={preventDefault:!0,stopPropagation:!0};on(...n){let{modifiers:e,key:r,handler:i,options:o}=this._normalizeInputs(...n);return this.configs.push(A(A({handler:i,matcher:s=>this._isMatch(s,r,e)},this.options),o)),this}_normalizeInputs(...n){let e=Array.isArray(n[0])||n[0]in Ds,r=e?n[0]:Ds.None,i=e?n[1]:n[0],o=e?n[2]:n[1],s=e?n[3]:n[2];return{key:i,handler:o,modifiers:r,options:s??{}}}_isMatch(n,e,r){return EG(n,r)?e instanceof RegExp?e.test(n.key):(typeof e=="string"?e:e()).toLowerCase()===n.key.toLowerCase():!1}};function ft(t){let n=Os(t);return n.toString=()=>`[Computed: ${n()}]`,n[Gt].debugName="",n}function sn(t){let[n,e,r]=hu(t);return n[Gt].debugName="",Object.assign(n,{set:e,update:r,asReadonly:()=>n})}var xy=class{inputs;prevActiveItem=sn(void 0);prevActiveIndex=ft(()=>this.prevActiveItem()?this.inputs.items().indexOf(this.prevActiveItem()):-1);activeIndex=ft(()=>this.inputs.activeItem()?this.inputs.items().indexOf(this.inputs.activeItem()):-1);constructor(n){this.inputs=n}isListDisabled(){return this.inputs.disabled()||this.inputs.items().every(n=>n.disabled())}getActiveDescendant(){if(!this.isListDisabled()&&this.inputs.focusMode()!=="roving")return this.inputs.activeItem()?.id()??void 0}getListTabIndex(){return this.isListDisabled()||this.inputs.focusMode()==="activedescendant"?0:-1}getItemTabIndex(n){return this.isListDisabled()||this.inputs.focusMode()==="activedescendant"?-1:this.inputs.activeItem()===n?0:-1}focus(n,e){return this.isListDisabled()||!this.isFocusable(n)?!1:(this.prevActiveItem.set(this.inputs.activeItem()),this.inputs.activeItem.set(n),(e?.focusElement||e?.focusElement===void 0)&&(this.inputs.focusMode()==="roving"?n.element
290()?.focus():this.inputs.element()?.focus()),!0)}isFocusable(n){return!n.disabled()||this.inputs.softDisabled()}},Ry=class{inputs;constructor(n){this.inputs=n}goto(n,e){return n?this.inputs.focusManager.focus(n,e):!1}next(n){return this._advance(1,n)}peekNext(){return this._peek(1)}prev(n){return this._advance(-1,n)}peekPrev(){return this._peek(-1)}first(n){let e=this.peekFirst();return e?this.goto(e,n):!1}last(n){let e=this.peekLast();return e?this.goto(e,n):!1}peekFirst(n=this.inputs.items()){return n.find(e=>this.inputs.focusManager.isFocusable(e))}peekLast(n=this.inputs.items()){for(let e=n.length-1;e>=0;e--)if(this.inputs.focusManager.isFocusable(n[e]))return n[e]}_advance(n,e){let r=this._peek(n);return r?this.goto(r,e):!1}_peek(n){let e=this.inputs.items(),r=e.length,i=this.inputs.focusManager.activeIndex(),o=s=>this.inputs.wrap()?(s+n+r)%r:s+n;for(let s=o(i);s!==i&&s<r&&s>=0;s=o(s))if(this.inputs.focusManager.isFocusable(e[s]))return e[s]}};var lD=class{inputs;rangeStartIndex=sn(0);rangeEndIndex=sn(0);selectedItems=ft(()=>this.inputs.items().filter(n=>this.inputs.values().includes(n.value())));constructor(n){this.inputs=n}select(n,e={anchor:!0}){if(n=n??this.inputs.focusManager.inputs.activeItem(),!n||n.disabled()||!n.selectable()||this.inputs.values().includes(n.value()))return;this.inputs.multi()||this.deselectAll();let r=this.inputs.items().findIndex(i=>i===n);e.anchor&&this.beginRangeSelection(r),this.inputs.values.update(i=>i.concat(n.value()))}deselect(n){n=n??this.inputs.focusManager.inputs.activeItem(),n&&!n.disabled()&&n.selectable()&&this.inputs.values.update(e=>e.filter(r=>r!==n.value()))}toggle(n){n=n??this.inputs.focusManager.inputs.activeItem(),n&&(this.inputs.values().includes(n.value())?this.deselect(n):this.select(n))}toggleOne(){let n=this.inputs.focusManager.inputs.activeItem();n&&(this.inputs.values().includes(n.value())?this.deselect():this.selectOne())}selectAll(){if(this.inputs.multi()){for(let n of this.inputs.items())this.select(n,{anchor:!1});this.beginRangeSelection()}}deselectAll(){for(let n of this.inputs.values()){let e=this.inputs.items().find(r=>r.value()===n);e?this.deselect(e):this.inputs.values.update(r=>r.filter(i=>i!==n))}}toggleAll(){this.inputs.items().filter(e=>!e.disabled()&&e.selectable()).map(e=>e.value()).every(e=>this.inputs.values().includes(e))?this.deselectAll():this.selectAll()}selectOne(){let n=this.inputs.focusManager.inputs.activeItem();n&&(n.disabled()||!n.selectable())||(this.deselectAll(),!(this.inputs.values().length>0&&!this.inputs.multi())&&this.select())}selectRange(n={anchor:!0}){this.inputs.focusManager.prevActiveIndex()===this.rangeStartIndex()&&n.anchor&&this.beginRangeSelection(this.inputs.focusManager.prevActiveIndex());let r=this._getItemsFromIndex(this.rangeStartIndex()),i=this._getItemsFromIndex(this.rangeEndIndex()).filter(o=>!r.includes(o));for(let o of i)this.deselect(o);for(let o of r)this.select(o,{anchor:!1});if(r.length){let o=r.pop(),s=this.inputs.items().findIndex(a=>a===o);this.rangeEndIndex.set(s)}}beginRangeSelection(n=this.inputs.focusManager.activeIndex()){this.rangeStartIndex.set(n),this.rangeEndIndex.set(n)}_getItemsFromIndex(n){if(n===-1)return[];let e=Math.max(this.inputs.focusManager.activeIndex(),n),r=Math.min(this.inputs.focusManager.activeIndex(),n),i=[];for(let o=r;o<=e;o++)i.push(this.inputs.items()[o]);return this.inputs.focusManager.activeIndex()<n?i.reverse():i}},cD=class{inputs;timeout;focusManager;isTyping=ft(()=>this._query().length>0);_query=sn("");_startIndex=sn(void 0);constructor(n){this.inputs=n,this.focusManager=n.focusManager}search(n){if(n.length!==1||!this.isTyping()&&n===" ")return!1;this._startIndex()===void 0&&this._startIndex.set(this.focusManager.activeIndex()),clearTimeout(this.timeout),this._query.update(r=>r+n.toLowerCase());let e=this._getItem();return e&&this.focusManager.focus(e),this.timeout=setTimeout(()=>{this._query.set(""),this._startIndex.set(void 0)},this.inputs.typeaheadDelay()),!0}_getItem(){let n=this.focusManager.inputs.items(),e=n.slice(this._startIndex()+1),r=n.slice(0,this._startIndex());n=e.concat(r),n.push(this.inputs.items()[this._startIndex()]);let i=[];for(let o of n)this.focusManager.isFocusable(o)&&i.push(o);return i.find(o=>o.searchTerm().toLowerCase().startsWith(this._query()))}},ff=class{inputs;navigationBehavior;selectionBehavior;typeaheadBehavior;focusBehavior;disabled=ft(()=>this.focusBehavior.isListDisabled());activeDescendant=ft(()=>this.focusBehavior.getActiveDescendant());tabIndex=ft(()=>this.focusBehavior.getListTabIndex());activeIndex=ft(()=>this.focusBehavior.activeIndex());_anchorIndex=sn(0);_wrap=sn(!0);constructor(n){this.inputs=n,this.focusBehavior=new xy(n),this.selectionBehavior=new lD(Z(A({},n),{focusManager:this.focusBehavior})),this.typeaheadBehavior=new cD(Z(A({},n),{focusManager:this.focusBehavior})),this.navigationBehavior=new Ry(Z(A({},n),{focusManager:this.focusBehavior,wrap:ft(()=>this._wrap()&&this.inputs.wrap())}))}getItemTabindex(n){return this.focusBehavior.getItemTabIndex(n)}first(n){this._navigate(n,()=>this.navigationBehavior.first(n))}last(n){this._navigate(n,()=>this.navigationBehavior.last(n))}next(n){this._navigate(n,()=>this.navigationBehavior.next(n))}prev(n){this._navigate(n,()=>this.navigationBehavior.prev(n))}goto(n,e){this._navigate(e,()=>this.navigationBehavior.goto(n,e))}unfocus(){this.inputs.activeItem.set(void 0)}anchor(n){this._anchorIndex.set(n)}search(n,e){this._navigate(e,()=>
290this.typeaheadBehavior.search(n))}isTyping(){return this.typeaheadBehavior.isTyping()}select(n){this.selectionBehavior.select(n)}selectOne(){this.selectionBehavior.selectOne()}deselect(n){this.selectionBehavior.deselect(n)}deselectAll(){this.selectionBehavior.deselectAll()}toggle(n){this.selectionBehavior.toggle(n)}toggleOne(){this.selectionBehavior.toggleOne()}toggleAll(){this.selectionBehavior.toggleAll()}isFocusable(n){return this.focusBehavior.isFocusable(n)}updateSelection(n={anchor:!0}){n.toggle&&this.selectionBehavior.toggle(),n.select&&this.selectionBehavior.select(),n.selectOne&&this.selectionBehavior.selectOne(),n.selectRange&&this.selectionBehavior.selectRange(),n.anchor||this.anchor(this.selectionBehavior.rangeStartIndex())}_navigate(n={},e){n?.selectRange&&(this._wrap.set(!1),this.selectionBehavior.rangeStartIndex.set(this._anchorIndex())),e()&&this.updateSelection(n),this._wrap.set(!0)}};var pf=class t{inputs;id;role=()=>"menu";disabled=()=>this.inputs.disabled();visible=ft(()=>this.inputs.parent()?!!this.inputs.parent()?.expanded():!0);listBehavior;isFocused=sn(!1);hasBeenFocused=sn(!1);hasBeenHovered=sn(!1);_openTimeout;_closeTimeout;tabIndex=()=>this.listBehavior.tabIndex();shouldFocus=ft(()=>{let n=this.root();return n instanceof xo?!0:n instanceof ni||n instanceof t?n.isFocused():!1});_expandKey=ft(()=>this.inputs.textDirection()==="rtl"?"ArrowLeft":"ArrowRight");_collapseKey=ft(()=>this.inputs.textDirection()==="rtl"?"ArrowRight":"ArrowLeft");dynamicSpaceKey=ft(()=>this.listBehavior.isTyping()?"":" ");typeaheadRegexp=/^.$/;root=ft(()=>{let n=this.inputs.parent();if(!n)return this;if(n instanceof xo)return n;let e=n.inputs.parent();return e instanceof ni?e:e?.root()});keydownManager=ft(()=>new su().on("ArrowDown",()=>this.next()).on("ArrowUp",()=>this.prev()).on("Home",()=>this.first()).on("End",()=>this.last()).on("Enter",()=>this.trigger()).on("Escape",()=>this.closeAll()).on(this._expandKey,()=>this.expand()).on(this._collapseKey,()=>this.collapse()).on(this.dynamicSpaceKey,()=>this.trigger()).on(this.typeaheadRegexp,n=>this.listBehavior.search(n.key)));constructor(n){this.inputs=n,this.id=n.id,this.listBehavior=new ff(Z(A({},n),{values:sn([])}))}setDefaultState(){this.inputs.parent()||this.listBehavior.goto(this.inputs.items()[0],{focusElement:!1})}onKeydown(n){this.keydownManager().handle(n)}onMouseOver(n){if(!this.visible())return;this.hasBeenHovered.set(!0);let e=this.inputs.items().find(o=>o.element()?.contains(n.target));if(!e)return;let r=this.inputs.parent(),i=this?.inputs.activeItem();if(r instanceof dl){let o=r.inputs.parent();o instanceof t&&(o._clearTimeouts(),o.listBehavior.goto(r,{focusElement:!1}))}i&&i!==e&&this._closeItem(i),e.expanded()&&this._clearCloseTimeout(),this._openItem(e),this.listBehavior.goto(e,{focusElement:this.shouldFocus()})}_closeItem(n){this._clearOpenTimeout(),this._closeTimeout||(this._closeTimeout=setTimeout(()=>{n.close(),this._closeTimeout=void 0},this.inputs.expansionDelay()))}_openItem(n){this._clearOpenTimeout(),this._openTimeout=setTimeout(()=>{n.open(),this._openTimeout=void 0},this.inputs.expansionDelay())}onMouseOut(n){if(this._clearOpenTimeout(),this.isFocused())return;let e=this.root(),r=this.inputs.parent(),i=n.relatedTarget;if(!e||!r||r instanceof xo)return;let o=r.inputs.parent();!o||o instanceof ni||o.inputs.element()?.contains(i)||r.close()}onClick(n){let e=n.target,r=this.inputs.items().find(i=>i.element()?.contains(e));r&&(r.open(),this.listBehavior.goto(r),this.submit(r))}onFocusIn(){this.isFocused.set(!0),this.hasBeenFocused.set(!0)}onFocusOut(n){let e=this.inputs.parent(),r=e?.inputs.element(),i=n.relatedTarget;i||(this.isFocused.set(!1),this.inputs.parent()?.close({refocus:!0})),!(e instanceof dl&&e.inputs.parent()?.inputs.items().filter(l=>l!==e)?.find(l=>l.element()?.contains(i)))&&this.visible()&&!r?.contains(i)&&!this.inputs.element()?.contains(i)&&(this.isFocused.set(!1),this.inputs.parent()?.close())}prev(){this.inputs.activeItem()?.close(),this.listBehavior.prev()}next(){this.inputs.activeItem()?.close(),this.listBehavior.next()}first(){this.inputs.activeItem()?.close(),this.listBehavior.first()}last(){this.inputs.activeItem()?.close(),this.listBehavior.last()}
290trigger(){this.inputs.activeItem()?.hasPopup()?this.inputs.activeItem()?.open({first:!0}):this.submit()}submit(n=this.inputs.activeItem()){let e=this.root();if(n&&!n.disabled()){let r=e instanceof t,i=e instanceof ni,o=e instanceof xo;!n.submenu()&&o&&e.close({refocus:!0}),!n.submenu()&&i&&(e.close(),e?.inputs.onSelect?.(n.value())),!n.submenu()&&r&&(e.inputs.activeItem()?.close({refocus:!0}),e?.inputs.onSelect?.(n.value()))}}collapse(){let n=this.root(),e=this.inputs.parent();e instanceof dl&&!(e.inputs.parent()instanceof ni)?e.close({refocus:!0}):n instanceof ni&&n.prev()}expand(){let n=this.root(),e=this.inputs.activeItem();e?.submenu()?e.open({first:!0}):n instanceof ni&&n.next()}close(){this.inputs.parent()?.close()}closeAll(){let n=this.root();n instanceof xo&&n.close({refocus:!0}),n instanceof ni&&n.close(),n instanceof t&&n.inputs.activeItem()?.close({refocus:!0})}_clearTimeouts(){this._clearOpenTimeout(),this._clearCloseTimeout()}_clearOpenTimeout(){this._openTimeout&&(clearTimeout(this._openTimeout),this._openTimeout=void 0)}_clearCloseTimeout(){this._closeTimeout&&(clearTimeout(this._closeTimeout),this._closeTimeout=void 0)}},ni=class{inputs;listBehavior;tabIndex=()=>this.listBehavior.tabIndex();_nextKey=ft(()=>this.inputs.textDirection()==="rtl"?"ArrowLeft":"ArrowRight");_previousKey=ft(()=>this.inputs.textDirection()==="rtl"?"ArrowRight":"ArrowLeft");dynamicSpaceKey=ft(()=>this.listBehavior.isTyping()?"":" ");typeaheadRegexp=/^.$/;isFocused=sn(!1);hasBeenFocused=sn(!1);disabled=()=>this.inputs.disabled();keydownManager=ft(()=>new su().on(this._nextKey,()=>this.next()).on(this._previousKey,()=>this.prev()).on("End",()=>this.listBehavior.last()).on("Home",()=>this.listBehavior.first()).on("Enter",()=>this.inputs.activeItem()?.open({first:!0})).on("ArrowUp",()=>this.inputs.activeItem()?.open({last:!0})).on("ArrowDown",()=>this.inputs.activeItem()?.open({first:!0})).on(this.dynamicSpaceKey,()=>this.inputs.activeItem()?.open({first:!0})).on(this.typeaheadRegexp,n=>this.listBehavior.search(n.key)));constructor(n){this.inputs=n,this.listBehavior=new ff(n)}setDefaultState(){this.inputs.activeItem.set(this.inputs.items()[0])}onKeydown(n){this.keydownManager().handle(n)}onClick(n){let e=this.inputs.items().find(r=>r.element()?.contains(n.target));e&&(this.goto(e),e.expanded()?e.close():e.open())}onMouseOver(n){let e=this.inputs.items().find(r=>r.element()?.contains(n.target));e&&this.goto(e,{focusElement:this.isFocused()})}onFocusIn(){this.isFocused.set(!0),this.hasBeenFocused.set(!0)}onFocusOut(n){let e=n.relatedTarget;this.inputs.element()?.contains(e)||(this.isFocused.set(!1),this.close())}goto(n,e){let r=this.inputs.activeItem();this.listBehavior.goto(n,e),r?.expanded()&&(r?.close(),this.inputs.activeItem()?.open()),n===r&&n.expanded()&&n.submenu()?.inputs.activeItem()&&(n.submenu()?.inputs.activeItem()?.close(),n.submenu()?.listBehavior.unfocus())}next(){let n=this.inputs.activeItem();this.listBehavior.next(),n?.expanded()&&(n?.close(),this.inputs.activeItem()?.open({first:!0}))}prev(){let n=this.inputs.activeItem();this.listBehavior.prev(),n?.expanded()&&(n?.close(),this.inputs.activeItem()?.open({first:!0}))}close(){this.inputs.activeItem()?.close({refocus:this.isFocused()})}},xo=class{inputs;expanded=sn(!1);hasBeenFocused=sn(!1);role=()=>"button";hasPopup=()=>!0;menu;tabIndex=ft(()=>this.expanded()&&this.menu()?.inputs.activeItem()?-1:0);disabled=()=>this.inputs.disabled();keydownManager=ft(()=>new su().on(" ",()=>this.open({first:!0})).on("Enter",()=>this.open({first:!0})).on("ArrowDown",()=>this.open({first:!0})).on("ArrowUp",()=>this.open({last:!0})).on("Escape",()=>this.close({refocus:!0})));constructor(n){this.inputs=n,this.menu=this.inputs.menu}onKeydown(n){this.inputs.disabled()||this.keydownManager().handle(n)}onClick(){this.inputs.disabled()||(this.expanded()?this.close():this.open({first:!0}))}onFocusIn(){this.hasBeenFocused.set(!0)}onFocusOut(n){let e=this.inputs.element(),r=n.relatedTarget;this.expanded()&&!e?.contains(r)&&!this.inputs.menu()?.inputs.element()?.contains(r)&&this.close()}open(n){this.expanded.set(!0),n?.first?this.inputs.menu()?.first():n?.last&&this.inputs.menu()?.last()}close(n={}){this.expanded.set(!1),this.menu()?.listBehavior.unfocus(),n.refocus&&this.inputs.element
290()?.focus();let e=this.inputs.menu()?.inputs.items()??[];for(;e.length;){let r=e.pop();r?._expanded.set(!1),r?.inputs.parent()?.listBehavior.unfocus(),e=e.concat(r?.submenu()?.inputs.items()??[])}}},dl=class{inputs;value;id;disabled=()=>this.inputs.parent()?.disabled()||this.inputs.disabled();searchTerm;element;active=ft(()=>this.inputs.parent()?.inputs.activeItem()===this);hasBeenFocused=sn(!1);tabIndex=ft(()=>this.submenu()&&this.submenu()?.inputs.activeItem()?-1:this.inputs.parent()?.listBehavior.getItemTabindex(this)??-1);index=ft(()=>this.inputs.parent()?.inputs.items().indexOf(this)??-1);expanded=ft(()=>this.submenu()?this._expanded():null);_expanded=sn(!1);controls=sn(void 0);role=()=>"menuitem";hasPopup=ft(()=>!!this.submenu());submenu;selectable;constructor(n){this.inputs=n,this.id=n.id,this.value=n.value,this.element=n.element,this.submenu=this.inputs.submenu,this.searchTerm=n.searchTerm,this.selectable=ft(()=>!this.submenu())}open(n){this.disabled()||(this._expanded.set(!0),n?.first&&this.submenu()?.first(),n?.last&&this.submenu()?.last())}close(n={}){this._expanded.set(!1),n.refocus&&this.inputs.parent()?.listBehavior.goto(this);let e=this.inputs.submenu()?.inputs.items()??[];for(;e.length;){let r=e.pop();r?._expanded.set(!1),r?.inputs.parent()?.listBehavior.unfocus(),e=e.concat(r?.submenu()?.inputs.items()??[]);let i=r?.inputs.parent();i instanceof pf&&i._clearTimeouts()}}onFocusIn(){this.hasBeenFocused.set(!0)}};var uD=(()=>{class t{contentVisible=Ee(!1);preserveContent=fd(!1);static \u0275fac=function(r){return new(r||t)};static \u0275dir=Oe({type:t,inputs:{preserveContent:[1,"preserveContent"]},outputs:{preserveContent:"preserveContentChange"}})}return t})();var AF=(()=>{class t{_elementRef=y(We);element=this._elementRef.nativeElement;textDirection=y(Ei).valueSignal;menu=Le(void 0);expanded=le(()=>this._pattern.expanded());hasPopup=le(()=>this._pattern.hasPopup());disabled=Le(!1,{transform:At});softDisabled=Le(!0,{transform:At});_pattern=new xo({textDirection:this.textDirection,element:le(()=>this._elementRef.nativeElement),menu:le(()=>this.menu()?._pattern),disabled:()=>this.disabled()});constructor(){ln(()=>this.menu()?.parent.set(this))}open(){this._pattern.open({first:!0})}close(){this._pattern.close()}static \u0275fac=function(r){return new(r||t)};static \u0275dir=Oe({type:t,selectors:[["button","ngMenuTrigger",""]],hostVars:6,hostBindings:function(r,i){if(r&1&&Ge("click",function(){return i._pattern.onClick()})("keydown",function(s){return i._pattern.onKeydown(s)})("focusout",function(s){return i._pattern.onFocusOut(s)})("focusin",function(){return i._pattern.onFocusIn()}),r&2){let o;ut("tabindex",i._pattern.tabIndex())("disabled",!i.softDisabled()&&i._pattern.disabled()?!0:null)("aria-disabled",i._pattern.disabled())("aria-haspopup",i.hasPopup())("aria-expanded",i.expanded())("aria-controls",(o=i._pattern.menu())==null?null:o.id())}},inputs:{menu:[1,"menu"],disabled:[1,"disabled"],softDisabled:[1,"softDisabled"]},exportAs:["ngMenuTrigger"]})}return t})(),dD=new P("MENU_COMPONENT"),mf=(()=>{class t{_elementRef=y(We);element=this._elementRef.nativeElement;id=Le(y(Ji).getId("ng-menu-item-",!0));value=Le.required();disabled=Le(!1);searchTerm=fd("");parent=y(dD,{optional:!0});submenu=Le(void 0);active=le(()=>this._pattern.active());expanded=le(()=>this._pattern.expanded());hasPopup=le(()=>this._pattern.hasPopup());_pattern=new dl({id:this.id,value:this.value,element:le(()=>this._elementRef.nativeElement),disabled:this.disabled,searchTerm:this.searchTerm,parent:le(()=>this.parent?._pattern),submenu:le(()=>this.submenu()?._pattern)});constructor(){ln(()=>this.submenu()?.parent.set(this))}open(){this._pattern.open({first:!0})}close(){this._pattern.close()}static \u0275fac=function(r){return new(r||t)};static \u0275dir=Oe({type:t,selectors:[["","ngMenuItem",""]],hostAttrs:["role","menuitem"],hostVars:6,hostBindings:function(r,i){if(r&1&&Ge("focusin",function(){return i._pattern.onFocusIn()}),r&2){let o;ut("tabindex",i._pattern.tabIndex())("data-active",i.active())("aria-haspopup",i.hasPopup())("aria-expanded",i.expanded())("aria-disabled",i._pattern.disabled())("aria-controls",(o=i._pattern.submenu())==null?null:o.id())}},inputs:{id:[1,"id"],value:[1,"value"],disabled:[1,"disabled"],searchTerm:[1,"searchTerm"],submenu:[1,"submenu"]}
290,outputs:{searchTerm:"searchTermChange"},exportAs:["ngMenuItem"]})}return t})(),SG=(()=>{class t{_allItems=mw(mf,{descendants:!0});_items=()=>this._allItems().filter(e=>e.parent===this);_elementRef=y(We);element=this._elementRef.nativeElement;disabled=Le(!1,{transform:At});softDisabled=Le(!0,{transform:At});textDirection=y(Ei).valueSignal;values=fd([]);wrap=Le(!0,{transform:At});typeaheadDelay=Le(500);_pattern;_itemPatterns=Ee([]);onSelect=hd();constructor(){this._pattern=new ni(Z(A({},this),{items:this._itemPatterns,multi:()=>!1,softDisabled:()=>!0,focusMode:()=>"roving",orientation:()=>"horizontal",selectionMode:()=>"explicit",onSelect:e=>this.onSelect.emit(e),activeItem:Ee(void 0),element:le(()=>this._elementRef.nativeElement)})),pa(()=>{this._itemPatterns.set(this._items().map(e=>e._pattern))}),pa(()=>{this._pattern.hasBeenFocused()||this._pattern.setDefaultState()})}close(){this._pattern.close()}static \u0275fac=function(r){return new(r||t)};static \u0275dir=Oe({type:t,selectors:[["","ngMenuBar",""]],contentQueries:function(r,i,o){r&1&&dm(o,i._allItems,mf,5),r&2&&Li()},hostAttrs:["role","menubar"],hostVars:3,hostBindings:function(r,i){r&1&&Ge("keydown",function(s){return i._pattern.onKeydown(s)})("mouseover",function(s){return i._pattern.onMouseOver(s)})("click",function(s){return i._pattern.onClick(s)})("focusin",function(){return i._pattern.onFocusIn()})("focusout",function(s){return i._pattern.onFocusOut(s)}),r&2&&ut("disabled",!i.softDisabled()&&i._pattern.disabled()?!0:null)("aria-disabled",i._pattern.disabled())("tabindex",i._pattern.tabIndex())},inputs:{disabled:[1,"disabled"],softDisabled:[1,"softDisabled"],values:[1,"values"],wrap:[1,"wrap"],typeaheadDelay:[1,"typeaheadDelay"]},outputs:{values:"valuesChange",onSelect:"onSelect"},exportAs:["ngMenuBar"],features:[Cr([{provide:dD,useExisting:t}])]})}return t})(),xF=(()=>{class t{_deferredContentAware=y(uD,{optional:!0});_allItems=mw(mf,{descendants:!0});_items=le(()=>this._allItems().filter(e=>e.parent===this));_elementRef=y(We);element=this._elementRef.nativeElement;textDirection=y(Ei).valueSignal;id=Le(y(Ji).getId("ng-menu-",!0));wrap=Le(!0,{transform:At});typeaheadDelay=Le(500);disabled=Le(!1,{transform:At});parent=Ee(void 0);_pattern;_itemPatterns=()=>this._items().map(e=>e._pattern);visible=le(()=>this._pattern.visible());tabIndex=le(()=>this._pattern.tabIndex());onSelect=hd();expansionDelay=Le(100);constructor(){this._pattern=new pf(Z(A({},this),{parent:le(()=>this.parent()?._pattern),items:this._itemPatterns,multi:()=>!1,softDisabled:()=>!0,focusMode:()=>"roving",orientation:()=>"vertical",selectionMode:()=>"explicit",activeItem:Ee(void 0),element:le(()=>this._elementRef.nativeElement),onSelect:e=>this.onSelect.emit(e)})),pa(()=>{let e=this.parent();e instanceof mf&&e.parent instanceof SG?this._deferredContentAware?.contentVisible.set(!0):this._deferredContentAware?.contentVisible.set(this._pattern.visible()||!!this.parent()?._pattern.hasBeenFocused())}),pa(()=>{if(this._pattern.visible()){let e=nt(()=>this._pattern.inputs.activeItem());this._pattern.listBehavior.goto(e)}}),pa(()=>{!this._pattern.hasBeenFocused()&&!this._pattern.hasBeenHovered()&&this._items().length&&nt(()=>this._pattern.setDefaultState())})}close(){this._pattern.close()}static \u0275fac=function(r){return new(r||t)};static \u0275dir=Oe({type:t,selectors:[["","ngMenu",""]],contentQueries:function(r,i,o){r&1&&dm(o,i._allItems,mf,5),r&2&&Li()},hostAttrs:["role","menu"],hostVars:4,hostBindings:function(r,i){r&1&&Ge("keydown",function(s){return i._pattern.onKeydown(s)})("mouseover",function(s){return i._pattern.onMouseOver(s)})("mouseout",function(s){return i._pattern.onMouseOut(s)})("focusout",function(s){return i._pattern.onFocusOut(s)})("focusin",function(){return i._pattern.onFocusIn()})("click",function(s){return i._pattern.onClick(s)}),r&2&&ut("id",i._pattern.id())("aria-disabled",i._pattern.disabled())("tabindex",i.tabIndex())("data-visible",i.visible())},inputs:{id:[1,"id"],wrap:[1,"wrap"],typeaheadDelay:[1,"typeaheadDelay"],disabled:[1,"disabled"],expansionDelay:[1,"expansionDelay"]},outputs:{onSelect:"onSelect"},exportAs:["ngMenu"],features:[Cr([{provide:dD,useExisting:t}]),Yb([{directive:uD,inputs:["preserveContent","preserveContent"]}])]})}return t})();var IG=(t,n,e)=>({"background-color":t,"width.px":n,"height.px":e}),TG=(t,n)=>({"font-size.px":t,color:n});function kG(t,n){if(t&1&&(L(0,"div",0),zo(),L(1,"svg",1)(2,"text",2),j(3),V()()()),t&2){let e=ie();ue("title",e.username())("ngStyle",ha(5,IG,e.avatarColor(),e.size(),e.size())),R(),ut("viewBox","0 0 "+e.size()+" "+e.size()),R(),ue("ngStyle",Sr(9,TG,e.size()/2.4,e.lettersColor())),R(),Qe(" ",e.avatarLetters()," ")}}var Oy=class t{size=Le(40,{});username=Le("",{});rgbValues=le(()=>{let n=this.username(),e=0;for(let s=0;s<n.length;s++)e=n.charCodeAt(s)+((e<<5)-e);let r=(e&16711680)>>16,i=(e&65280)>>8,o=e&255;return{r,g:i,b:o}},{});avatarColor=le(()=>{let{r:n,g:e,b:r}=this.rgbValues();return`rgb(${n}, ${e}, ${r})`},{});avatarLetters=le(()=>this.username()?this.username().split(/\s/).map(e=>e.toUpperCase().slice(0,1)).slice(0,2).join(""):"",{});lettersColor=le(()=>{let{r:n,g:e,b:r}=this.rgbValues();return .299*n+.587*e+.114*r>128?"#000000":"#ffffff"},{});static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-avatar"]],inputs:{size:[1,"size"],username:[1,"username"]},decls:1,vars:1,consts:[[1,"avatar-circle","clickable",3,"title","ngStyle"],["xmlns","http://www.w3.org/2000/svg"],["x","50%","y","54%",3,"ngStyle"]],template:function(e,r){e&1&&be(0,kG,4,12,"div",0),e&2&&we(r.username()?0:-1)}
290,dependencies:[st,Dw],styles:[".avatar-circle[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;border-radius:50%;font-size:80%;font-weight:600;cursor:pointer;overflow:hidden;transition:all .2s ease-in-out}.avatar-circle[_ngcontent-%COMP%]:hover{filter:brightness(.9)}text[_ngcontent-%COMP%]{text-anchor:middle;dominant-baseline:middle}"]})};var au=class t{value=Le(0,{});size=Le(120,{});strokeWidth=Le(8,{});displayValue=le(()=>this.value()*100,{});radius=le(()=>(this.size()-this.strokeWidth())/2,{});circumference=le(()=>2*Math.PI*this.radius(),{});offset=le(()=>this.circumference()-this.value()*this.circumference(),{});static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-progress-circle"]],inputs:{value:[1,"value"],size:[1,"size"],strokeWidth:[1,"strokeWidth"]},decls:14,vars:22,consts:[[1,"progress-container"],[1,"progress-svg"],[1,"circle-bg"],["stroke","url(#progressGradient)",1,"circle-progress"],["id","progressGradient","x1","0%","y1","0%","x2","100%","y2","0%"],["offset","0%","stop-color","#00f2fe"],["offset","100%","stop-color","#7000ff"],[1,"percentage"],[1,"number"],[1,"symbol"]],template:function(e,r){e&1&&(Te(0,"div",0),zo(),Te(1,"svg",1),Ko(2,"circle",2)(3,"circle",3),Te(4,"defs")(5,"linearGradient",4),Ko(6,"stop",5)(7,"stop",6),Ne()()(),Ol(),Te(8,"div",7)(9,"span",8),j(10),X(11,"number"),Ne(),Te(12,"span",9),j(13,"%"),Ne()()()),e&2&&(Bi("width",r.size(),"px")("height",r.size(),"px"),R(),ut("width",r.size())("height",r.size()),R(),ut("cx",r.size()/2)("cy",r.size()/2)("r",r.radius())("stroke-width",r.strokeWidth()),R(),Bi("stroke-dasharray",r.circumference())("stroke-dashoffset",r.offset()),ut("cx",r.size()/2)("cy",r.size()/2)("r",r.radius())("stroke-width",r.strokeWidth()),R(7),me(mo(11,19,r.displayValue(),"1.0-0")))},dependencies:[st,Iw],styles:[".progress-container[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;justify-content:center}.progress-container[_ngcontent-%COMP%] .progress-svg[_ngcontent-%COMP%]{transform:rotate(-90deg);filter:drop-shadow(0 0 8px rgba(0,242,254,.3))}.progress-container[_ngcontent-%COMP%] circle[_ngcontent-%COMP%]{fill:none;stroke-linecap:round;transition:stroke-dashoffset .8s cubic-bezier(.4,0,.2,1)}.progress-container[_ngcontent-%COMP%] .circle-bg[_ngcontent-%COMP%]{stroke:#ffffff0d}.progress-container[_ngcontent-%COMP%] .percentage[_ngcontent-%COMP%]{position:absolute;display:flex;flex-direction:column;align-items:center;color:#fff;font-family:Plus Jakarta Sans,sans-serif}.progress-container[_ngcontent-%COMP%] .percentage[_ngcontent-%COMP%] .number[_ngcontent-%COMP%]{font-size:1rem;font-weight:800;line-height:1;background:linear-gradient(135deg,#fff,#cbd5e1);-webkit-background-clip:text;-webkit-text-fill-color:transparent}.progress-container[_ngcontent-%COMP%] .percentage[_ngcontent-%COMP%] .symbol[_ngcontent-%COMP%]{font-size:.75rem;font-weight:400;color:#94a3b8;margin-top:2px}"]})};var to=class t{isOpen=Ee(!1,{});get isOpen$(){return this.isOpen.asReadonly()}open(){this.isOpen.set(!0)}close(){this.isOpen.set(!1)}toggle(){this.isOpen.update(n=>!n)}static \u0275fac=function(e){return new(e||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})};function MG(t,n){if(t&1){let e=$t();Te(0,"button",1),Ur("click",function(){gt(e);let i=ie();return vt(i.toggle())}),Te(1,"span",2),j(2,"menu"),Ne()()}}var Is=class t{store=y(pn);menuService=y(to);elementRef=y(We);shouldShow=le(()=>this.store.state()!=="no_conversations_yet",{});focusOnInit=Le(!1,{});preventDefault=Le(!1,{});toggle(){this.preventDefault()||this.menuService.toggle()}ngAfterViewChecked(){setTimeout(()=>{this.focusOnInit()&&this.elementRef.nativeElement?.querySelector("button")?.focus()},500)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-side-menu-button"]],inputs:{focusOnInit:[1,"focusOnInit"],preventDefault:[1,"preventDefault"]},decls:1,vars:1,consts:[[1,"menu-btn","hoverable","fully-rounded","text-light"],[1,"menu-btn","hoverable","fully-rounded","text-light",3,"click"],[1,"material-symbols-outlined"]],template:function(e,r){e&1&&be(0,MG,3,0,"button",0),e&2&&we(r.shouldShow()?0:-1)},dependencies:[st],styles:[".menu-btn[_ngcontent-%COMP%]{width:3rem;height:3rem}"]})};var lu=class t{PREDEFINED_QUERIES={desktop:"(min-width: 1025px)",tablet:"(min-width: 769px) and (max-width: 1024px)",mobile:"(max-width: 768px)"};breakpointObserver=y(Ch);templateRef=y(Xn);viewContainer=y(Hn);destroyRef=y(Ye);hasView=!1;set mvcMediaShow(n){let e=n.split(" and ");e.forEach((r,i)=>{this.PREDEFINED_QUERIES[r]&&(e[i]=this.PREDEFINED_QUERIES[r])}
290),this.breakpointObserver.observe(e).pipe(un(this.destroyRef)).subscribe(r=>{r.matches&&!this.hasView?(this.viewContainer.createEmbeddedView(this.templateRef),this.hasView=!0):!r.matches&&this.hasView&&(this.viewContainer.clear(),this.hasView=!1)})}static \u0275fac=function(e){return new(e||t)};static \u0275dir=Oe({type:t,selectors:[["","mvcMediaShow",""]],inputs:{mvcMediaShow:"mvcMediaShow"}})};var Ny=class t{translate=y(Jt);currentLanguage=this.translate.getCurrentLang();changeLanguage(n){localStorage.setItem("language",n),this.translate.use(n)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-language-picker"]],decls:12,vars:4,consts:[[1,"lang-picker-container"],["for","lang-select",1,"sr-only"],[1,"lang-select-wrapper"],["id","lang-select",1,"lang-select",3,"ngModelChange","keydown","ngModel"],["value","pl"],["value","en"],["aria-hidden","true",1,"material-symbols-outlined","lang-icon"]],template:function(e,r){e&1&&(L(0,"div",0)(1,"label",1),j(2),X(3,"translate"),V(),L(4,"div",2)(5,"select",3),Ge("ngModelChange",function(o){return r.changeLanguage(o)})("keydown",function(o){return o.stopPropagation()}),L(6,"option",4),j(7,"PL"),V(),L(8,"option",5),j(9,"EN"),V()(),L(10,"span",6),j(11,"expand_more"),V()()()),e&2&&(R(2),me(ne(3,2,"app_bar.choose_language")),R(3),ue("ngModel",r.currentLanguage))},dependencies:[qt,fO,cO,dO,uv,Fc,RC,zt],styles:['@charset "UTF-8";.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.lang-picker-container[_ngcontent-%COMP%]{display:flex;align-items:center}.lang-select-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center}.lang-select[_ngcontent-%COMP%]{appearance:none;-webkit-appearance:none;-moz-appearance:none;background:#ffffff1a;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,.2);color:#fff;padding:5px 30px 5px 12px;border-radius:8px;cursor:pointer;transition:all .3s ease;min-height:32px;line-height:normal}.lang-select[_ngcontent-%COMP%]:hover{background:#fff3}.lang-icon[_ngcontent-%COMP%]{position:absolute;right:8px;pointer-events:none;font-size:18px!important;color:#ffffffb3}.lang-select[_ngcontent-%COMP%] option[_ngcontent-%COMP%]{background-color:#1a0b2e;color:#fff}']})};var AG=["formatMenu"],xG=t=>({origin:t,usePopover:"inline"}),RG=()=>({originX:"start",originY:"bottom",overlayX:"end",overlayY:"top",offsetY:10,offsetX:50}),OG=t=>[t];function NG(t,n){t&1&&Ce(0,"mvc-side-menu-button")}function PG(t,n){if(t&1&&(L(0,"h1",6),j(1),V()),t&2){let e,r=ie();R(),me(((e=r.conversation())==null?null:e.name)??"")}}function FG(t,n){if(t&1&&Ce(0,"mvc-progress-circle",7),t&2){let e=ie();ue("value",e.summary().progress)("size",50)("strokeWidth",4)}}function LG(t,n){if(t&1){let e=$t();L(0,"div",11,1)(2,"div",12),j(3),V(),L(4,"div")(5,"div",13)(6,"span",14),j(7),X(8,"translate"),V(),Ce(9,"span",15)(10,"mvc-language-picker"),V(),L(11,"button",16),Ge("keydown.enter",function(){gt(e);let i=ie(2);return vt(i.signOut())})("keydown.space",function(){gt(e);let i=ie(2);return vt(i.signOut())})("click",function(){gt(e);let i=ie(2);return vt(i.signOut())}),L(12,"span",17),j(13,"logout"),V(),L(14,"span",18),j(15),X(16,"translate"),V()()()()}if(t&2){let e=ie(2);R(3),me(e.user().email),R(4),Qe("",ne(8,3,"app_bar.choose_language"),":"),R(8),me(ne(16,5,"app_bar.sign_out"))}}function jG(t,n){if(t&1&&(L(0,"button",8,0),Ce(3,"mvc-avatar",9),V(),Rn(4,LG,17,7,"ng-template",10)),t&2){let e=ji(1),r=ji(2),i=ie();ue("menu",i.formatMenu()),R(3),ue("size",40)("username",i.user().email),R(),ue("cdkConnectedOverlayOpen",r.expanded())("cdkConnectedOverlay",Nt(6,xG,e))("cdkConnectedOverlayPositions",Nt(9,OG,$n(8,RG)))}}var cu=class t{supabase=y(Nn);store=y(pn);summary=this.store.summary;conversation=this.store.conversation;user=er(this.supabase.user.pipe(un()));formatMenu=fa("formatMenu",{});signOut(){this.supabase.signOut()}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-app-bar"]],viewQuery:function(e,r){e&1&&Yo(r.formatMenu,AG,5),e&2&&Li()},decls:7,vars:4,consts:[["origin","","trigger","ngMenuTrigger"],["formatMenu","ngMenu"],[1,"app-bar-placeholder"],[1,"app-bar","glass","fixed","flex","p2","text-light","items-center"],[4,"mvcMediaShow"],[1,"title","flex-1"],[1,"center"],[1,"inline","mr1","ml2",3,"value","size","strokeWidth"],["ngMenuTrigger","",1,"clickable","m0","p0","fully-rounded",3,"menu"],[1,"block",3,"size","username"],["cdkAttachPopoverAsChild","",3,"cdkConnectedOverlayOpen","cdkConnectedOverlay","cdkConnectedOverlayPositions"],["ngMenu","",1,"menu","glass","card","mr1"],[1,"p2","center","border-bottom"],[1,"pl2","pr2","pt1","pb1","flex","justify-space-between","items-center","border-bottom"],[1,"mr1"],[1,"flex-1"],["type","button","tabindex","0",1,"menu-item","logout-btn","flex","items-center","p2","w-100",3,"keydown.enter","keydown.space","click"],["aria-hidden","true",1,"icon","material-symbols-outlined","mr2"],[1,"label"]],template:function(e,r){if(e&1&&(Ce(0,"div",2),L(1,"div",3),Rn(2,NG,1,0,"mvc-side-menu-button",4),L(3,"div",5),be(4,PG,2,1,"h1",6),be(5,FG,1,3,"mvc-progress-circle",7),V(),be(6,jG,5,11),V()),e&2){let i;R(2),ue("mvcMediaShow","mobile"),R(2),we((i=r.conversation())!=null&&i.name?4:-1),R(),we(r.summary()?5:-1),R(),we(r.user()?6:-1)}},dependencies:[st,Oy,Is,lu,au,AF,xF,Av,tS,qt,Ny,Hc,zt],styles:[".app-bar[_ng
290content-%COMP%]{width:calc(100% - 2rem);top:0;left:0;z-index:9;border-bottom:var(--border);height:var(--app-bar-height)}@media(min-width:769px){.app-bar[_ngcontent-%COMP%]{padding-left:var(--nav-bar-width)!important;width:calc(100% - 1rem - var(--nav-bar-width))}}.app-bar-placeholder[_ngcontent-%COMP%]{height:65px}.title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}h1[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:700;max-width:calc(100vw - 12rem);text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.logout-btn[_ngcontent-%COMP%]{cursor:pointer;border:none;width:100%;font-size:unset}.logout-btn[_ngcontent-%COMP%]:hover{background-color:#ffffff1a}.logout-btn[_ngcontent-%COMP%]:focus{outline:2px solid var(--text-light);outline-offset:-3px}.menu[_ngcontent-%COMP%]{min-width:200px}.menu-item[_ngcontent-%COMP%]{border-radius:0 0 calc(var(--corner-radius) * .75) calc(var(--corner-radius) * .75)!important}"]})};var Py=class t{dialogRef=y(So);data=y(rS);static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-chat-delete-dialog"]],decls:17,vars:13,consts:[[1,"dialog"],[1,"title"],[1,"mt2","center","bold"],[1,"actions"],["cdkFocusInitial","",1,"btn","hoverable","fully-rounded",3,"click"],[1,"btn","hoverable","fully-rounded",3,"click"]],template:function(e,r){e&1&&(Te(0,"div",0)(1,"h2",1),j(2),X(3,"translate"),Ne(),Te(4,"div")(5,"p"),j(6),X(7,"translate"),Ne(),Te(8,"p",2),j(9),Ne()(),Te(10,"div",3)(11,"button",4),Ur("click",function(){return r.dialogRef.close(!1)}),j(12),X(13,"translate"),Ne(),Te(14,"button",5),Ur("click",function(){return r.dialogRef.close(!0)}),j(15),X(16,"translate"),Ne()()()),e&2&&(R(2),me(ne(3,5,"chat_delete_dialog.title")),R(4),me(ne(7,7,"chat_delete_dialog.message")),R(3),Qe('"',r.data.conversationName,'"'),R(3),me(ne(13,9,"chat_delete_dialog.cancel")),R(3),me(ne(16,11,"chat_delete_dialog.accept")))},dependencies:[qt,zt],encapsulation:2})};var BG=(t,n)=>n.id;function VG(t,n){if(t&1){let e=$t();Te(0,"li",3),Ur("click",function(){let i=gt(e).$implicit,o=ie();return vt(o.selectConversation(i.id))}),Te(1,"span",4),j(2),Ne(),Te(3,"div",5)(4,"button",6),X(5,"translate"),Ur("click",function(i){let o=gt(e).$implicit,s=ie();return vt(s.deleteConversation(o,i))}),Te(6,"span",7),j(7,"delete"),Ne()()()()}if(t&2){let e=n.$implicit,r=ie();Er("active",e.id===r.selectedConversationId()),R(2),Qe(" ",e.name," "),R(2),ut("title",ne(5,4,"history.delete_title"))}}var uu=class t{store=y(pn);chatService=y(ti);router=y(cn);dialog=y(gs);sideMenuService=y(to);selectedConversationId=le(()=>this.store.conversation()?.id??null,{});history=this.store.conversations;selectConversation(n){this.router.navigate(["/conversation",n,"chat"],{replaceUrl:!1,queryParamsHandling:"merge",onSameUrlNavigation:"reload"}),this.store.setConversationId(n),this.sideMenuService.close()}deleteConversation(n,e){e.stopPropagation(),this.dialog.open(Py,{minWidth:"300px",data:{conversationName:n.name}}).closed.pipe(Tt(r=>r?this.chatService.deleteConversation(n.id):an)).subscribe(()=>{this.store.conversationId()===n.id?(this.router.navigate(["/"]),this.store.setConversationId("latest")):this.store.loadData(this.store.conversationId)})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-chat-history"]],decls:6,vars:3,consts:[[1,"pl2","bold","text-light","mb2"],[1,"text-light"],["tabindex","0",1,"flex","items-center","pl2","rounded-corners","hoverable","clickable",3,"active"],["tabindex","0",1,"flex","items-center","pl2","rounded-corners","hoverable","clickable",3,"click"],[1,"title","flex-1"],[1,"actions"],[1,"icon-btn",3,"click"],[1,"material-symbols-outlined"]],template:function(e,r){e&1&&(Te(0,"h3",0),j(1),X(2,"translate"),Ne(),Te(3,"ul",1),Br(4,VG,8,6,"li",2,BG),Ne()),e&2&&(R(),me(ne(2,1,"history.title")),R(3),Vr(r.history()))},dependencies:[st,vo,qt,zt],styles:[".action[_ngcontent-%COMP%]{height:1.65em;width:1.65em}a[_ngcontent-%COMP%]{text-decoration:none;color:unset}.title[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.active[_ngcontent-%COMP%]{background-color:rgba(var(--primary-rgb),.15)!important}"]})};var UG=["formatMenu"],HG=["categorizeMenu"],$G=t=>["/conversation",t,"chat"],zG=t=>["/conversation",t,"summary"];function qG(t,n){if(t&1){let e=$t();L(0,"mvc-side-menu-button",8),Ge("click",function(i){gt(e);let o=ie();return vt(o.onSideMenuButtonClickedOnDesktopScreen(i))}),V()}t&2&&ue("preventDefault",!0)}function WG(t,n){t&1&&Ce(0,"mvc-side-menu-button",9)}function GG(t,n){t&1&&Ce(0,"mvc-chat-history",10)}function KG(t,n){if(t&1&&(ca(0),be(1,GG,1,0,"mvc-chat-history",10),ua()),t&2){let e=ie();R(),we(e.opened()?1:-1)}}function JG(t,n){t&1&&Ce(0,"div",11)}function YG(t,n){t&1&&Jo(0)}function ZG(t,n){if(t&1&&(ca(0),Rn(1,YG,1,0,"ng-container",12),ua()),t&2){ie();let e=ji(11);R(),ue("ngTemplateOutlet",e)}}
290function XG(t,n){if(t&1&&(L(0,"a",7)(1,"span",13),j(2,"chat_bubble"),V(),L(3,"span",14),j(4),X(5,"translate"),V()()),t&2){let e=ie();ue("routerLink",Nt(4,$G,e.conversationId())),R(4),me(ne(5,2,"bottom_nav.chat"))}}function QG(t,n){t&1&&Jo(0)}function eK(t,n){if(t&1&&(ca(0),Rn(1,QG,1,0,"ng-container",12),ua()),t&2){ie();let e=ji(11);R(),ue("ngTemplateOutlet",e)}}function tK(t,n){if(t&1&&(L(0,"a",7)(1,"span",13),j(2,"summarize"),V(),L(3,"span",14),j(4),X(5,"translate"),V()()),t&2){let e=ie();ue("routerLink",Nt(4,zG,e.conversationId())),R(4),me(ne(5,2,"bottom_nav.summary"))}}function nK(t,n){if(t&1){let e=$t();L(0,"div",15)(1,"button",16),X(2,"translate"),Ge("click",function(){gt(e);let i=ie();return vt(i.onAddNewConversationClicked())}),L(3,"span",17),j(4,"add"),V()(),L(5,"span",18),j(6),X(7,"translate"),V()()}if(t&2){let e=ie();R(),ue("disabled",e.chatAddButtonDisabled()),ut("title",ne(2,3,"bottom_nav.add_button_title")),R(5),me(ne(7,5,"bottom_nav.add_chat"))}}var Fy=class t{authService=y(Nn);dialog=y(gs);store=y(pn);sideMenuServicer=y(to);conversationId=this.store.conversationId;opened=Ee(!0,{});showNavItems=le(()=>this.store.state()!=="loading"&&this.store.conversation()!==null&&this.store.error()===null,{});chatAddButtonDisabled=le(()=>{if(this.store.conversations()===null)return!0;let n=this.store.config()?.max_conversations_per_user||3;return this.store.conversations().length>=n},{});user=er(this.authService.user.pipe(un()));formatMenu=fa("formatMenu",{});categorizeMenu=fa("categorizeMenu",{});async signOut(){try{await this.authService.signOut()}catch(n){console.error("Error signing out:",n)}}onAddNewConversationClicked(){this.dialog.open(Ss,{width:"400px",maxWidth:"100%",minWidth:"400px"})}onSideMenuButtonClickedOnDesktopScreen(n){this.opened.set(!this.opened());let e=window.getComputedStyle(document.documentElement),r=e.getPropertyValue("--nav-bar-width-opened"),i=e.getPropertyValue("--nav-bar-width-closed");document.documentElement.style.setProperty("--nav-bar-width",this.opened()?r:i)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-nav"]],viewQuery:function(e,r){e&1&&(Yo(r.formatMenu,UG,5),Yo(r.categorizeMenu,HG,5)),e&2&&Li(2)},decls:12,vars:10,consts:[["addButton",""],[1,"nav-container","glass","justify-center"],[1,"nav-content","items-center"],["class","menu-btn",3,"preventDefault","click",4,"mvcMediaShow"],["class","menu-btn",4,"mvcMediaShow"],[4,"mvcMediaShow"],["class","flex-1",4,"mvcMediaShow"],["routerLinkActive","active",1,"nav-item",3,"routerLink"],[1,"menu-btn",3,"click","preventDefault"],[1,"menu-btn"],[1,"history"],[1,"flex-1"],[4,"ngTemplateOutlet"],["aria-hidden","true",1,"material-symbols-outlined"],[1,"label"],[1,"flex","items-center","flex-column"],[1,"add-btn","neon-btn-secondary","fully-rounded","bold","flex","items-center","justify-center",3,"click","disabled"],[1,"material-symbols-outlined"],[1,"add-btn-label","label"]],template:function(e,r){e&1&&(L(0,"nav",1)(1,"div",2),Rn(2,qG,1,1,"mvc-side-menu-button",3)(3,WG,1,0,"mvc-side-menu-button",4)(4,KG,2,1,"ng-container",5)(5,JG,1,0,"div",6)(6,ZG,2,1,"ng-container",5),be(7,XG,6,6,"a",7),Rn(8,eK,2,1,"ng-container",5),be(9,tK,6,6,"a",7),V()(),Rn(10,nK,8,7,"ng-template",null,0,ld)),e&2&&(R(),Er("opened",r.opened()),R(),ue("mvcMediaShow","desktop"),R(),ue("mvcMediaShow","tablet"),R(),ue("mvcMediaShow","desktop"),R(),ue("mvcMediaShow","desktop and tablet"),R(),ue("mvcMediaShow","desktop and tablet"),R(),we(r.showNavItems()?7:-1),R(),ue("mvcMediaShow","mobile"),R(),we(r.showNavItems()?9:-1))},dependencies:[st,vd,vo,os,fE,Is,uu,lu,qt,zt],styles:['[_nghost-%COMP%]{position:fixed;z-index:10;display:flex}@media(max-width:768px){[_nghost-%COMP%]{--nav-bar-padding: 1.5rem;border-left:none;border-right:none;bottom:-1px;left:50%;transform:translate(-50%);width:100%}[_nghost-%COMP%] .add-btn-label[_ngcontent-%COMP%]{margin-top:.4rem!important;transform:unset!important}[_nghost-%COMP%] .label[_ngcontent-%COMP%]{font-size:.7rem;transform:translateY(.7rem)}[_nghost-%COMP%] .nav-container[_ngcontent-%COMP%]{width:100%;border:var(--border);padding:1rem var(--nav-bar-padding);height:calc(var(--nav-bar-height) - 2 * var(--nav-bar-padding));border-right:none;border-left:none}[_nghost-%COMP%] .nav-content[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;max-height:100%}[_nghost-%COMP%] .nav-content[_ngcontent-%COMP%] .nav-item[_ngcontent-%COMP%]{margin-right:1.5rem;margin-left:1.5rem}}@media(min-width:769px)and (max-width:1024px){[_nghost-%COMP%] .menu-btn[_ngcontent-%COMP%]{transform:translate(0)!important}}@media(min-width:769px){[_nghost-%COMP%]{--nav-bar-padding: 1rem;top:50%;left:0;transform:translateY(-50%);height:100%}[_nghost-%COMP%] .label[_ngcontent-%COMP%]{font-size:.9rem}[_nghost-%COMP%] .nav-container[_ngcontent-%COMP%]{background:#303337ab!important;height:100dvh;max-height:100dvh;display:flex;padding-top:5rem!important;align-items:flex-start;border:none;border-right:1px solid rgba(255,255,255,.15);padding:1.5rem var(--nav-bar-padding);height:100%;width:calc(var(--nav-bar-width) - 2 * var(--nav-bar-padding));transition:width .2s ease}[_nghost-%COMP%] .nav-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:30px;width:100%;height:calc(100dvh - 6.5rem)}}.history[_ngcontent-%COMP%]{width:100%}.nav-item[_ngcontent-%COMP%]{width:3.5rem;display:flex;flex-direction:column;align-items:center;text-decoration:none;color:rgba(var(--text-light-rgb),.7);transition:all .3s ease;gap:4px}.nav-item[_ngcontent-%COMP%] .material-symbols-outlined[_ngcontent-%COMP%]{font-size:27px;transition:transform .3s ease}@media(min-width:769px){.nav-item[_ngcontent-%COMP%] .material-symbols-outlined[_ngcontent-%COMP%]{font-size:35px}}.nav-item[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{font-weight:500;text-transform:uppercase;letter-spacing:1px}.nav-item.active[_ngcontent-%COMP%]{color:var(--primary);text-shadow:0 0 15px rgba(var(--primary-rgb),.6)}.nav-item.active[_ngcontent-%COMP%] .material-symbols-outlined[_ngcontent-%COMP%]{transform:translateY(-2px);font-variation-settings:"FILL" 1}.nav-item[_ngcontent-%COMP%]:hover:not(.active){color:rgba(var(--text-light-rgb),1)}.menu-btn[_ngcontent-%COMP%]{position:absolute;top:.5rem;transition:transform .2s ease;left:3.25rem}.add-btn[_ngcontent-%COMP%]{width:3rem;height:3rem;font-weight:700}@media(max-width:768px){.add-btn[_ngcontent-%COMP%]{margin-left:1.5rem;margin-right:1.5rem}}.opened[_ngcontent-%COMP%] .menu-btn[_ngcontent-%COMP%]{transform:translate(-1.25rem)}.add-btn-label[_ngcontent-%COMP%]{margin-top:1rem;color:rgba(var(--text-light-rgb),.7)}.label[_ngcontent-%COMP%]{font-weight:500;text-transform:uppercase;letter-spacing:1px}']})};var rK=["*"],iK=(t,n)=>({closed:t,opened:n});function oK(t,n){if(t&1){let e=$t();L(0,"div",4),Ge("click",function(){gt(e);let i=ie();return vt(i.close())}),V()}}var Ly=class t{service=y(to);isOpen=this.service.isOpen$;close(){this.service.close()}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-side-menu"]],ngContentSelectors:rK,decls:5,vars:7,consts:[["cdkTrapFocus","",1,"side-drawer","glass","text-light",3,"ngClass"],[1,"menu-btn",3,"focusOnInit"],[1,"side-drawer-content","pl2","pr2"],[1,"overlay"],[1,"overlay",3,"click"]],template:function(e,r){e&1&&(Jl(),L(0,"div",0),Ce(1,"mvc-side-menu-button",1),L(2,"div",2),Yl(3),V()(),be(4,oK,1,0,"div",3)),e&2&&(ue("ngClass",Sr(4,iK,!r.isOpen(),r.isOpen())),ut("inert",r.isOpen()?null:""),R(),ue("focusOnInit",!0),R(3),we(r.isOpen()?4:-1))},dependencies:[st,ma,Is,Hc,$C],styles:[".side-drawer[_ngcontent-%COMP%]{position:fixed;top:0;left:0;height:100dvh;max-height:100dvh;z-index:12;transition:all .25s cubic-bezier(.4,0,.2,1);border-right:var(--border);min-width:300px}.closed[_ngcontent-%COMP%]{transform:translate(-100%);visibility:hidden;pointer-events:none}.closed[_ngcontent-%COMP%] .menu-btn[_ngcontent-%COMP%]{opacity:0}
290.opened[_ngcontent-%COMP%] .menu-btn[_ngcontent-%COMP%]{opacity:1}.menu-btn[_ngcontent-%COMP%]{position:absolute;top:.5rem;left:2.25rem;transition:opacity .15s ease-in-out;transition-delay:.15s}.menu-btn[_ngcontent-%COMP%]:focus-visible{outline:3px solid var(--text-light)}.menu-btn[_ngcontent-%COMP%]:focus{outline:3px solid var(--text-light)}.side-drawer-content[_ngcontent-%COMP%]{margin-top:calc(var(--app-bar-height) + 2rem);height:calc(100dvh - var(--app-bar-height) - 2rem);overflow:auto}.overlay[_ngcontent-%COMP%]{height:100dvh;width:100vw;z-index:11;position:absolute;top:0;left:0}"]})};var jy=class t{translate=y(Jt);route=y($r);router=y(cn);conversationId=er(this.route.children[0].paramMap.pipe(te(n=>n.get("conversationId")??"latest")));store=y(pn);constructor(){this.reloadDataOnLanguageChange(),ln(()=>{this.store.state()==="no_conversations_yet"&&this.router.navigate(["/welcome"])})}reloadDataOnLanguageChange(){this.translate.onLangChange.pipe(_t(()=>!!this.store.conversation()),un()).subscribe(()=>{this.store.loadData(this.store.conversation().id)}),ln(()=>{let n=this.conversationId();n&&this.store.setConversationId(n)})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-main"]],decls:8,vars:0,consts:[[1,"ml2","mr2"],[1,"bg-houses-repeat"],[1,"bottom-nav-placeholder"]],template:function(e,r){e&1&&(Ce(0,"mvc-nav")(1,"mvc-app-bar"),L(2,"mvc-side-menu"),Ce(3,"mvc-chat-history",0),V(),L(4,"main"),Ce(5,"router-outlet")(6,"div",1),V(),Ce(7,"div",2))},dependencies:[vo,Da,cu,Fy,Ly,uu],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;height:100%}.bottom-nav-placeholder[_ngcontent-%COMP%]{height:0}@media(min-width:769px){main[_ngcontent-%COMP%]{padding-left:var(--nav-bar-width)}}.bg-houses-repeat[_ngcontent-%COMP%]{height:100dvh;width:100vw;position:absolute;top:0;left:0;opacity:.4}"]})};var sK=t=>({disabled:t});function aK(t,n){if(t&1&&(L(0,"span",1),j(1),V()),t&2){let e=ie();R(),me(e.icon())}}function lK(t,n){if(t&1&&(L(0,"span",2),j(1),V()),t&2){let e=ie();R(),me(e.text())}}var By=class t{text=Le(void 0,{});icon=Le(void 0,{});disabled=Le(!1,{});static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-floating-action-button"]],inputs:{text:[1,"text"],icon:[1,"icon"],disabled:[1,"disabled"]},decls:3,vars:6,consts:[[1,"fab","p2","rounded-corners","neon-btn-primary","flex","items-center","justify-center",3,"ngClass","disabled"],[1,"icon","material-symbols-outlined","mr1"],[1,"text"]],template:function(e,r){e&1&&(L(0,"button",0),be(1,aK,2,1,"span",1),be(2,lK,2,1,"span",2),V()),e&2&&(ue("ngClass",Nt(4,sK,r.disabled()))("disabled",r.disabled()),R(),we(r.icon()?1:-1),R(),we(r.text()?2:-1))},dependencies:[st,ma],styles:[".fab[_ngcontent-%COMP%]{position:fixed;bottom:2rem;right:2rem;z-index:1000;overflow:hidden;font-size:1rem;box-shadow:0 0 15px #00000040,0 0 15px #00000038}.fab[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{font-size:1.5rem}@media(max-width:768px){.fab[_ngcontent-%COMP%]{bottom:6rem;right:1rem;z-index:12}}.fab[disabled][_ngcontent-%COMP%]{background-color:var(--text-light)!important;pointer-events:none!important}.fab-button.active[_ngcontent-%COMP%] .material-symbols-outlined[_ngcontent-%COMP%]{transform:rotate(45deg)}"]})};var RF=t=>({section:t}),OF=(t,n)=>n.name;function cK(t,n){t&1&&Jo(0)}function uK(t,n){if(t&1&&(Ce(0,"img",12),L(1,"a",13),j(2),L(3,"span",14),j(4," open_in_new "),V()()),t&2){ie();let e=gi(1);ut("src",e.mapImageUrl,Zu),R(),ut("href",e.geoportalUrl,Zu),R(),Qe("",e.value," ")}}function dK(t,n){t&1&&Jo(0)}function hK(t,n){if(t&1&&(L(0,"li",8)(1,"span",9),j(2),V(),L(3,"span",10),j(4),V()()),t&2){let e=n.$implicit;R(2),Qe("",e.name,":"),R(2),me(e.value)}}function fK(t,n){if(t&1&&(L(0,"div",11),Rn(1,dK,1,0,"ng-container",5),L(2,"div",6)(3,"ul",7),Br(4,hK,5,2,"li",8,OF),V()()()),t&2){let e=n.$implicit;ie(2);let r=ji(7);R(),ue("ngTemplateOutlet",r)("ngTemplateOutletContext",Nt(2,RF,e)),R(3),Vr(e.requirements)}}function pK(t,n){if(t&1&&(L(0,"div",4),Ql(1),Rn(2,cK,1,0,"ng-container",5),L(3,"div",6),be(4,uK,5,3),L(5,"ul",7)(6,"li",8)(7,"span",9),j(8),X(9,"translate"),V(),L(10,"span",10),j(11),V()(),L(12,"li",8)(13,"span",9),j(14),X(15,"translate"),V(),L(16,"span",10),j(17),V()()()()(),Br(18,fK,6,4,"div",11,OF)),t&2){let e=ie(),r=ji(7),i=e.data();R();let o=ad(i.plotSection.requirements[0]);R(),ue("ngTemplateOutlet",r)("ngTemplateOutletContext",Nt(12,RF,i.plotSection)),R(2),we(o.discovered?4:-1),R(4),Qe("",ne(9,8,"summary.city"),":"),R(3),me(o.city),R(3),Qe("",ne(15,10,"summary.area_ha"),":"),R(3),me(o.areaHa),R(),Vr(i.sections)}}
290function mK(t,n){if(t&1&&(L(0,"div",15)(1,"span",16),j(2),V(),L(3,"h2"),j(4),V(),Ce(5,"span",17)(6,"mvc-progress-circle",18),V()),t&2){let e=n.section;R(2),me(e.icon),R(2),me(e.name),R(2),ue("value",e.progress)("size",50)("strokeWidth",4)}}var Vy=class t{store=y(pn);summaryService=y(ou);translate=y(Jt);data=this.store.summary;downloadPDF(){this.store.conversation()&&this.summaryService.downloadSummaryAsPDF(this.store.conversation(),this.translate.getCurrentLang())}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-summary"]],decls:8,vars:10,consts:[["sectionCardHeader",""],[1,"main-container","container","pl2","pr2","pt1","pb1","flex","flex-row","flex-1"],[1,"bg-houses-repeat"],[3,"click","icon","text","title"],[1,"glass","plot-card","card"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"summary-panel","bg-light","rounded-corners","p2"],[1,"summary-list","flex","flex-column","pl2"],[1,"summary-item"],[1,"mr1"],[1,"value"],[1,"glass","card"],["alt","Mapa dzia\u0142ki",1,"plot-map"],["target","_blank",1,"plot-link","inline-block","mt1","mb1"],[1,"icon-small","material-symbols-outlined"],[1,"summary-heading","p2"],[1,"icon","material-symbols-outlined"],[1,"flex-1"],[1,"ml1",3,"value","size","strokeWidth"]],template:function(e,r){if(e&1){let i=$t();L(0,"div",1),be(1,pK,20,14),V(),Ce(2,"div",2),L(3,"mvc-floating-action-button",3),X(4,"translate"),X(5,"translate"),Ge("click",function(){return gt(i),vt(r.downloadPDF())}),V(),Rn(6,mK,7,5,"ng-template",null,0,ld)}e&2&&(R(),we(r.data()?1:-1),R(2),ue("text",ec(ne(4,6,"summary.download_pdf")))("title",ec(ne(5,8,"summary.download_pdf")))("icon","download"))},dependencies:[st,vd,au,By,qt,zt],styles:['@charset "UTF-8";.card[_ngcontent-%COMP%]{padding:0;color:var(--text-light);max-width:350px}@media(max-width:768px){.card[_ngcontent-%COMP%]{width:100%;border-radius:0;border-left:none;border-right:none}}@media(min-width:769px)and (max-width:1024px){.card[_ngcontent-%COMP%]{width:50%}}.container[_ngcontent-%COMP%]{width:unset;gap:1rem;display:flex;flex-direction:row;flex-wrap:wrap}@media(max-width:768px){.container[_ngcontent-%COMP%]{flex-wrap:wrap!important;padding-left:0!important;padding-right:0!important;padding-bottom:calc(var(--nav-bar-height) + 4.5rem)!important}}@media(min-width:769px)and (max-width:1024px){.container[_ngcontent-%COMP%]{flex-wrap:wrap!important}}.summary-heading[_ngcontent-%COMP%]{font-size:1.2rem;color:var(--text-color-white);display:flex;align-items:center}.summary-heading[_ngcontent-%COMP%]{display:flex;justify-content:center;font-size:1.2rem;color:var(--text-light);text-align:center;border-bottom:var(--border)}.summary-heading[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{font-size:3rem;margin-right:1rem}.summary-panel[_ngcontent-%COMP%]{flex-grow:1}.summary-list[_ngcontent-%COMP%]{list-style-type:circle;list-style-position:outside}.summary-item[_ngcontent-%COMP%]{display:list-item;text-align:left;line-height:1.5rem}.value[_ngcontent-%COMP%]{filter:brightness(75%);color:var(--primary)}.plot-map[_ngcontent-%COMP%]{width:100%}.plot-link[_ngcontent-%COMP%]{color:var(--primary);text-overflow:ellipsis}.plot-link[_ngcontent-%COMP%] .icon-small[_ngcontent-%COMP%]{font-size:1rem}']})};var Uy=class t{static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-page-not-found"]],decls:2,vars:0,template:function(e,r){e&1&&(Te(0,"p"),j(1,"page-not-found works!"),Ne())},encapsulation:2})};function gK(t,n){t&1&&Ce(0,"mvc-loader",0)}function vK(t,n){if(t&1){let e=$t();L(0,"main",1)(1,"h1",2),j(2),X(3,"translate"),L(4,"span",3),j(5),X(6,"translate"),V(),j(7,"!"),V(),zo(),L(8,"svg",4),Ce(9,"rect",5)(10,"line",6)(11,"circle",7)(12,"circle",8)(13,"circle",9)(14,"path",10)(15,"circle",11)(16,"circle",12)(17,"circle",13)(18,"path",14)(19,"path",15),V(),Ol(),L(20,"p",16),j(21),X(22,"translate"),V(),L(23,"p",17),j(24),X(25,"translate"),V(),L(26,"div",18)(27,"button",19),Ge("click",function(){gt(e);let i=ie();return vt(i.onAddNewConversationClicked())}),j(28),X(29,"translate"),V()()()}t&2&&(R(2),me(ne(3,5,"welcome.title")),R(3),me(ne(6,7,"auth.title")),R(16),Qe(" ",ne(22,9,"welcome.message")," "),R(3),me(ne(25,11,"welcome.hint")),R(4),Qe(" ",ne(29,13,"bottom_nav.add_button_title")))}var Hy=class t{dialog=y(gs);store=y(pn);router=y(cn);conversationService=y(ti);destroyRef=y(Ye);loading=Ee(!0,{});ngOnInit(){this.conversationService.getUserConversations().pipe(It(1),un(this.destroyRef)).subscribe(n=>{n.length>0?this.router.navigate(["/conversation","latest"]):(this.store.setState("no_conversations_yet"),this.loading.set(!1))})}onAddNewConversationClicked(){this.dialog.open(Ss,{width:"400px",maxWidth:"100%",minWidth:"400px"})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-welcome"]],decls:3,vars:1,consts:[[1,"mt2"],[1,"main-container","flex","flex-column","p2"],[1,"text-light","bolder","center"],[1,"brand-title"],["id","welcome-screen-image","viewBox","0 0 240 180","fill","none","xmlns","http://www.w3.org/2000/svg"],["x","20","y","20","width","200","height","140","rx","8","stroke","var(--primary)","stroke-width","2"],["x1","20","y1","45","x2","220","y2","45","stroke","var(--primary)","stroke-width","2"],["cx","36","cy","32.5","r","2.5","fill","var(--primary)"],["cx","48","cy","32.5","r","2.5","fill","var(--primary)"],["cx","60","cy","32.5","r","2.5","fill","var(--primary)"],["d","M80 70H160C165.523 70 170 74.4772 170 80V120C170 125.523 165.523 130 160 130H105L80 145V130H80C74.4772 130 70 125.523 70 120V80C70 74.4772 74.4772 70 80 70Z","stroke","var(--primary)","stroke-width","2","stroke-dasharray","6 6"],["cx","115","cy","100","r","14","stroke","var(--primary)","stroke-width","2","fill","none"],["cx","110","cy","97","r","1.5","fill","var(--primary)"],["cx","120","cy","97","r","1.5","fill","var(--primary)"],["d","M109 104 Q115 110 121 104","stroke","var(--primary)","stroke-width","2","stroke-linecap","round","fill","none"],["d","M145 80 Q145 88 153 88 Q145 88 145 96 Q145 88 137 88 Q145 88 145 80 Z","fill","var(--primary)"],[1,"mt1","center","text-lighter"],[1,"text-lighter","center","mt1"],[1,"flex","justify-center"],[1,"btn","p1","neon-btn-secondary","mt2","fully-rounded",3,"click"]],template:function(e,r){e&1&&(Ce(0,"mvc-app-bar"),be(1,gK,1,0,"mvc-loader",0)(2,vK,30,15,"main",1)),e&2&&(R(),we(r.loading()?1:2))},dependencies:[cu,qt,Gi,zt],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column}h1[_ngcontent-%COMP%]{font-size:2rem}.btn[_ngcontent-%COMP%]{font-size:1.1rem}.main-container[_ngcontent-%COMP%]{width:auto}p[_ngcontent-%COMP%]{max-width:24rem}#welcome-screen-image[_ngcontent-%COMP%]{width:100%;max-width:26rem;margin:auto}"]})};var NF=[{path:"welcome",canActivate:[()=>y(Nn).canActivate()],component:Hy},{path:"conversation",canActivate:[()=>y(Nn).canActivate()],component:jy,children:[{path:":conversationId",children:[{path:"chat",component:Ay},{path:"summary",component:Vy},{path:"",redirectTo:"chat",pathMatch:"full"}]},{path:"",redirectTo:"latest/chat",pathMatch:"full"}]},{path:"auth",component:fv},{path:"",redirectTo:"conversation",pathMatch:"full"},{path:"**",component:Uy}];var Ts=class t{_toasts=Ee([],{});toasts=this._toasts.asReadonly();lastToastData=null;show(n,e,r="info"){if(this.newToastIsTheSameAsTheLastOne({title:n,message:e,type:r})&&Date.now()-this.lastToastData.timestamp<Kr.toastsDuration)return;let i=hf();this._toasts.update(o=>[{id:i,title:n,message:e,type:r},...o]),this.lastToastData={toastData:{id:i,title:n,message:e,type:r},timestamp:Date.now()},setTimeout(()=>{this.remove(i)},Kr.toastsDuration)}remove(n){this._toasts.update(e=>e.filter(r=>r.id!==n))}newToastIsTheSameAsTheLastOne(n){return this.lastToastData?n.title===this.lastToastData.toastData.title&&n.message===this.lastToastData.toastData.message&&n.type===this.lastToastData.toastData.type:!1}static \u0275fac=function(e){return new(e||t)};static \u0275prov=O({token:t,factory:t.\u0275fac,providedIn:"root"})};var $y=class{toastsService=y(Ts);translate=y(Jt);handleError(n){if(n instanceof gr){let e=this.translate.instant("errors_messages."+n.code+".title"),r=this.translate.instant("errors_messages."+n.code+".message");this.toastsService.show(e,r,"error")}else if(n?.message==="ResizeObserver loop completed with undelivered notifications."){console.error(n);return}else if(n instanceof Xo){console.error(n);let e=this.translate.instant("errors_messages.undefined.title"),r=this.translate.instant("errors_messages.undefined.message");this.toastsService.show(e,r,"error")}else console.error(n)}};var PF={providers:[x0(),pE(NF,ag()),Vw(),tx(),Kl(()=>{let t=y(Jt);return t.addLangs(["pl","en"]),t.setFallbackLang("en"),t.use(localStorage.getItem("language")||"en")}),hx({loader:fx({prefix:"i18n/",suffix:".json"}),fallbackLang:"en",lang:"en"}),{provide:nr,useValue:RR(Kr.supabaseUrl,Kr.supabaseKey)},{provide:ur,useClass:$y}]};function yK(t,n){if(t&1&&(Te(0,"p",5),j(1),Ne()),t&2){let e=ie();R(),me(e.message())}}var zy=class t{id=Le.required({});title=Le.required({});message=Le.required({});type=Le.required({});toastsService=y(Ts);get icon(){switch(this.type()){case"success":return"check_circle";case"error":return"error";default:return"info"}}dismiss(){this.toastsService.remove(this.id())}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-toast"]],inputs:{id:[1,"id"],title:[1,"title"],message:[1,"message"],type:[1,"type"]},decls:11,vars:5,consts:[[1,"toast-wrapper","pt1","pb1","pl1","pr1","m1","glass","fully-rounded"],[1,"flex","items-center"],[1,"material-symbols-outlined","icon"],[1,"ml1"],[1,"title"],[1,"message","mt1","text-light"],[1,"icon-btn","ml1",3,"click"],[1,"material-symbols-outlined"]],template:function(e,r){e&1&&(Te(0,"div",0)(1,"div",1)(2,"span",2),j(3),Ne(),Te(4,"div",3)(5,"span",4),j(6),Ne(),be(7,yK,2,1,"p",5),Ne(),Te(8,"button",6),Ur("click",function(){return r.dismiss()}),Te(9,"span",7),j(10,"close"),Ne()()()()),e&2&&(ow(r.type()),R(3),me(r.icon),R(3),me(r.title()),R(),we(r.message()?7:-1))},dependencies:[st],styles:["[_nghost-%COMP%]{display:block;pointer-events:auto;animation:_ngcontent-%COMP%_slideIn .3s ease-out}.glass[_ngcontent-%COMP%]{backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);box-shadow:0 8px 32px #0000005e}.success[_ngcontent-%COMP%]{background:rgba(var(--success-rgb),.05);border:1px solid rgba(var(--success-rgb),.1)!important;color:var(--success)}.error[_ngcontent-%COMP%]{background:rgba(var(--danger-rgb),.05);border:1px solid rgba(var(--danger-rgb),.1)!important;color:rgb(var(--danger-rgb))}.info[_ngcontent-%COMP%]{background:rgba(var(--primary-rgb),.05);border:1px solid rgba(var(--primary-rgb),.1)!important;color:var(--text-light)}.message[_ngcontent-%COMP%]{font-size:.8rem;color:rgba(var(--text-light-rgb),.95)}@keyframes _ngcontent-%COMP%_slideIn{0%{transform:translate(100%);opacity:0}
290to{transform:translate(0);opacity:1}}"]})};var _K=(t,n)=>n.id;function bK(t,n){if(t&1&&Ce(0,"mvc-toast",1),t&2){let e=n.$implicit;ue("id",e.id)("title",e.title)("message",e.message)("type",e.type)}}var qy=class t{toastService=y(Ts);toasts=this.toastService.toasts;static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-toasts-container"]],decls:3,vars:0,consts:[[1,"toast-container","mr1"],["]","",3,"id","title","message","type"]],template:function(e,r){e&1&&(L(0,"div",0),Br(1,bK,1,4,"mvc-toast",1,_K),V()),e&2&&(R(),Vr(r.toasts()))},dependencies:[st,zy],styles:["[_nghost-%COMP%]{pointer-events:none!important}.toast-container[_ngcontent-%COMP%]{display:flex;margin-top:calc(var(--app-bar-height) + 2rem);flex-direction:column;align-items:flex-end}"]})};var Wy=class t{title=Ee("my-virtual-client",{});overlay=y(Mv);ngOnInit(){this.initializeToastsContainer()}initializeToastsContainer(){this.overlay.create({positionStrategy:this.overlay.position().global().top("0px").right("0px"),scrollStrategy:this.overlay.scrollStrategies.noop(),panelClass:"toast-backdrop"}).attach(new ps(qy))}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=ae({type:t,selectors:[["mvc-root"]],decls:1,vars:0,template:function(e,r){e&1&&Ce(0,"router-outlet")},dependencies:[Da],styles:["[_nghost-%COMP%]{min-height:100dvh}"]})};Fw(Wy,PF).catch(t=>console.error(t));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.