PageSourceSearch

https://app.intellimate.ai/_next/static/chunks/pages/_app-94c7485c88c82208.js

js intellimate.ai collected 2026-10-05 14:19:44 UTC 441,011 bytes, 34 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5cacb893-cb21-4509-a98f-fbd1b790b368",e._sentryDebugIdIdentifier="sentry-dbid-5cacb893-cb21-4509-a98f-fbd1b790b368")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[636],{92:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return r(8703)}])},4902:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__addDisposableResource:()=>L,__assign:()=>s,__asyncDelegator:()=>E,__asyncGenerator:()=>S,__asyncValues:()=>j,__await:()=>_,__awaiter:()=>p,__classPrivateFieldGet:()=>I,__classPrivateFieldIn:()=>R,__classPrivateFieldSet:()=>P,__createBinding:()=>m,__decorate:()=>o,__disposeResources:()=>M,__esDecorate:()=>u,__exportStar:()=>y,__extends:()=>i,__generator:()=>g,__importDefault:()=>N,__importStar:()=>C,__makeTemplateObject:()=>A,__metadata:()=>f,__param:()=>l,__propKey:()=>d,__read:()=>b,__rest:()=>a,__rewriteRelativeImportExtension:()=>U,__runInitializers:()=>c,__setFunctionName:()=>h,__spread:()=>w,__spreadArray:()=>k,__spreadArrays:()=>x,__values:()=>v,default:()=>$});var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function o(e,t,r,n){var i,s=arguments.length,a=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(s<3?i(a):s>3?i(t,r,a):i(t,r))||a);return s>3&&a&&Object.defineProperty(t,r,a),a}function l(e,t){return function(r,n){t(r,n,e)}}function u(e,t,r,n,i,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var o,l=n.kind,u="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?n.static?e:e.prototype:null,d=t||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),h=!1,f=r.length-1;f>=0;f--){var p={};for(var g in n)p[g]="access"===g?{}:n[g];for(var g in n.access)p.access[g]=n.access[g];p.addInitializer=function(e){if(h)throw TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var m=(0,r[f])("accessor"===l?{get:d.get,set:d.set}:d[u],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(o=a(m.get))&&(d.get=o),(o=a(m.set))&&(d.set=o),(o=a(m.init))&&i.unshift(o)}else(o=a(m))&&("field"===l?i.unshift(o):d[u]=o)}c&&Object.defineProperty(c,n.name,d),h=!0}function c(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function h(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function f(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,r,n){return new(r||(r=Promise))(function(i,s){function a(e){try{l(n.next(e))}catch(e){s(e)}}function o(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((n=n.apply(e,t||[])).next())})}function g(e,t){var r,n,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(l){var u=[o,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,n=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){s.label=u[1];break}if(6===u[0]&&s.label<i[1]){s.label=i[1],i=u;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(u);break}i[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var m=Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);
vendor: 1,832 bytes, line 1
1(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function y(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||m(t,e,r)}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return a}function w(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e}function x(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var s=arguments[t],a=0,o=s.length;a<o;a++,i++)n[i]=s[a];return n}function k(e,t,r){if(r||2==arguments.length)for(var n,i=0,s=t.length;i<s;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function _(e){return this instanceof _?(this.v=e,this):new _(e)}function S(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),s=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),n[Symbol.asyncIterator]=function(){return this},n;function a(e,t){i[e]&&(n[e]=function(t){return new Promise(function(r,n){
1s.push([e,t,r,n])>1||o(e,t)})},t&&(n[e]=t(n[e])))}function o(e,t){try{var r;(r=i[e](t)).value instanceof _?Promise.resolve(r.value.v).then(l,u):c(s[0][2],r)}catch(e){c(s[0][3],e)}}function l(e){o("next",e)}function u(e){o("throw",e)}function c(e,t){e(t),s.shift(),s.length&&o(s[0][0],s[0][1])}}function E(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:_(e[n](t)),done:!1}:i?i(t):t}:i}}function j(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=v(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){var s,a,o;s=n,a=i,o=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){s({value:e,done:o})},a)})}}}function A(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var T=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},O=function(e){return(O=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function C(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=O(e),n=0;n<r.length;n++)"default"!==r[n]&&m(t,e,r[n]);return T(t,e),t}function N(e){return e&&e.__esModule?e:{default:e}}function I(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function P(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}function R(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function L(e,t,r){if(null!=t){var n,i;if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object expected.");if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],r&&(i=n)}if("function"!=typeof n)throw TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var D="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function M(e){function t(t){e.error=e.hasError?new D(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var r,n=0;return function i(){for(;r=e.stack.pop();)try{if(!r.async&&1===n)return n=0,e.stack.push(r),Promise.resolve().then(i);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(s).then(i,function(e){return t(e),i()})}else n|=1}catch(e){t(e)}if(1===n)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function U(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,n,i,s){return r?t?".jsx":".js":!n||i&&s?n+i+"."+s.toLowerCase()+"js":e}):e}let $={__extends:i,__assign:s,__rest:a,__decorate:o,__param:l,__esDecorate:u,__runInitializers:c,__propKey:d,__setFunctionName:h,__metadata:f,__awaiter:p,__generator:g,__createBinding:m,__exportStar:y,__values:v,__read:b,__spread:w,__spreadArrays:x,__spreadArray:k,__await:_,__asyncGenerator:S,__asyncDelegator:E,__asyncValues:j,__makeTemplateOb
1ject:A,__importStar:C,__importDefault:N,__classPrivateFieldGet:I,__classPrivateFieldSet:P,__classPrivateFieldIn:R,__addDisposableResource:L,__disposeResources:M,__rewriteRelativeImportExtension:U}},5925:(e,t,r)=>{"use strict";r.d(t,{g:()=>p});var n=r(37876),i=r(14232),s=r(88992),a=r(28249),o=r(8728),l=r(11508),u=r(61052),c=r(55892),d=r(16317),h=r(32446),f=r(89099);function p(e){let{onClose:t}=e,{signUp:r,user:p}=(0,c.A)(),{createWorkspace:g}=(0,d.h)(),m=(0,f.useRouter)(),{register:y,handleSubmit:v,formState:{errors:b},setError:w}=(0,s.mN)(),[x,k]=(0,i.useState)(!1),[_,S]=(0,i.useState)(!1),E=async e=>{try{k(!0),h.oR.warning("Submitting Your Request"),await r(e.email,e.password,e.firstName,e.lastName,e.company),await g(e.company,e.company),S(!0)}catch(e){console.error("Sign up error:",e),w("root",{type:"manual",message:e instanceof Error?e.message:"Failed to create account"})}finally{h.oR.success("Account created successfully: check inbox to confirm Email address"),k(!1)}};return _?(0,n.jsx)("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:(0,n.jsxs)("div",{className:"flex min-h-screen items-center justify-center p-4 text-center",children:[(0,n.jsx)("div",{className:"fixed inset-0 bg-gray-900 bg-opacity-75 transition-opacity",onClick:t}),(0,n.jsxs)("div",{className:"relative w-full max-w-md transform overflow-hidden rounded-lg bg-gray-800 p-6 text-left shadow-xl transition-all",children:[(0,n.jsx)("div",{className:"absolute right-0 top-0 pr-4 pt-4",children:(0,n.jsx)("button",{type:"button",className:"rounded-md text-gray-400 hover:text-gray-300 focus:outline-none",onClick:t,children:(0,n.jsx)(a.A,{className:"h-6 w-6"})})}),(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)(o.A,{className:"mx-auto h-12 w-12 text-indigo-400"}),(0,n.jsx)("h3",{className:"mt-4 text-xl font-medium text-white",children:"Check your email"}),(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)("p",{className:"text-sm text-gray-300",children:"We've sent you an email with a confirmation link. Please check your inbox and click the link to activate your account."})}),(0,n.jsx)("div",{className:"mt-6",children:(0,n.jsx)("button",{type:"button",onClick:t,className:"inline-flex justify-center px-4 py-2 text-sm font-medium text-gray-300 hover:text-white",children:"Close this window"})})]})]})]})}):(0,n.jsx)("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:(0,n.jsxs)("div",{className:"flex min-h-screen items-center justify-center p-4 text-center",children:[(0,n.jsx)("div",{className:"fixed inset-0 bg-gray-900 bg-opacity-75 transition-opacity",onClick:t}),(0,n.jsxs)("div",{className:"relative w-full max-w-md transform overflow-hidden rounded-lg bg-gray-800 p-6 text-left shadow-xl transition-all",children:[(0,n.jsx)("div",{className:"absolute right-0 top-0 pr-4 pt-4",children:(0,n.jsx)("button",{type:"button",className:"rounded-md text-gray-400 hover:text-gray-300 focus:outline-none",onClick:t,children:(0,n.jsx)(a.A,{className:"h-6 w-6"})})}),(0,n.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:text-left",children:[(0,n.jsx)("h3",{className:"text-lg font-medium leading-6 text-white mb-6",children:p?"You are currently signed in":"Create your account"}),b.root&&(0,n.jsx)("div",{className:"mb-4 bg-red-900/50 border-l-4 border-red-500 p-4",children:(0,n.jsxs)("div",{className:"flex",children:[(0,n.jsx)(l.A,{className:"h-5 w-5 text-red-400"}),(0,n.jsx)("p",{className:"ml-3 text-sm text-red-200",children:b.root.message})]})}),p?(0,n.jsx)("div",{children:(0,n.jsx)("button",{onClick:()=>m.push("/dashboard"),className:"w-full flex justify-center items-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:"Go to Dashboard"})}):(0,n.jsxs)("form",{onSubmit:v(E),className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"firstName",className:"block text-sm font-medium text-gray-300",children:"First Name"}),(0,n.jsx)("input",{type:"text",id:"firstName",...y("firstName",{required:"First name is required"}),className:"mt-1 block w-full rounded-md border-gray-600 bg-gray-700 text-white shadow-sm focus:border-indigo-500 focus:ring-indigo-500"}),b.firstName&&(0,n.jsx)("p",{className:"mt-1 text-sm text-red-500",children:b.firstName.message})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"lastName",className:"block text-sm font-medium text-gray-300",children:"Last Name"}),(0,n.jsx)("input",{type:"text",id:"lastName",...y("lastName",{required:"Last name is required"}),className:"mt-1 block w-full rounded-md border-gray-600 bg-gray-700 text-white shadow-sm focus:border-indigo-500 focus:ring-indigo-500"}),b.lastName&&(0,n.jsx)("p",{className:"mt-1 text-sm text-red-500",children:b.lastName.message})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"company",className:"block text-sm font-medium text-gray-300",children:"Company Name"}),(0,n.jsx)("input",{type:"text",id:"company",...y("company",{required:"Company name is required"}),className:"mt-1 block w-full rounded-md border-gray-600 bg-gray-700 text-white shadow-sm focus:border-indigo-500 focus:ring-indigo-500"}),b.company&&(0,n.jsx)("p",{className:"mt-1 text-sm text-red-500",children:b.company.message})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-300",children:"Email"}),(0,n.jsx)("input",{type:"email",id:"email",...y("email",{required:"Email is required",pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Invalid email address"}}),className:"mt-1 block w-full rounded-md border-gray-600 bg-gray-700 text-white shadow-sm focus:border-indigo-500 focus:ring-indigo-500"}),b.email&&(0,n.jsx)("p",{className:"mt-1 text-sm text-red-500",children:b.email.message})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-300",children:"Password"}),(0,n.jsx)("input",{type:"password",id:"password",...y("password",{required:"Password is required",minLength:{value:8,message:"Password must be at least 8 characters"}}),className:"mt-1 block w-full rounded-md border-gray-600 bg-gray-700 text-white shadow-sm focus:border-indigo-500 focus:ring-indigo-500"}),b.password&&(0,n.jsx)("p",{className:"mt-1 text-sm text-red-500",children:b.password.message})]}),(0,n.jsx)("div",{className:"mt-6",children:(0,n.jsx)("button",{type:"submit",disabled:x,className:"w-full flex justify-center items-center py-2 px-4 border border-transparent roun
1ded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50",children:x?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.A,{className:"animate-spin h-4 w-4 mr-2"}),"Creating account..."]}):"Create account"})})]})]})]})]})})}},6781:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]])},8703:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>J});var n=r(37876);r(65454),r(93754);var i=r(16617),s=r(55892),a=r(16317),o=r(73908),l=r(57880),u=r(89099),c=r(14232),d=r(90999);let h=e=>{let{children:t}=e,{user:r,loading:i}=(0,s.A)(),a=(0,u.useRouter)(),[o,l]=(0,c.useState)(!1);return((0,c.useEffect)(()=>{console.log("use effect"),l(!0)},[]),(0,c.useEffect)(()=>{if(o){var e;let t=window.localStorage.getItem("sb-oaiypqxpvqgrtcaxdvac-auth-token"),r=JSON.parse(t);d.sE(null==r||null==(e=r.user)?void 0:e.id),t||a.push("/login")}},[r,a,o]),i)?(0,n.jsx)("div",{children:"Loading..."}):(0,n.jsx)(n.Fragment,{children:t})};var f=r(15092),p=r(54080),g=r(48230),m=r.n(g),y=r(73884),v=r(28249),b=r(21086),w=r(63147);function x(){let{user:e}=(0,s.A)(),{loading:t,hasUnread:r,entries:i,markSeen:a}=(0,b.u9)(),o=(0,f.s)(),[l,u]=(0,c.useState)(!1);function d(){u(!1),r&&a()}if((0,c.useEffect)(()=>{if(t||!(null==e?void 0:e.id)||!r)return;let n="".concat("whats-new:auto-opened:").concat(e.id);try{if(window.sessionStorage.getItem(n))return;window.sessionStorage.setItem(n,"1")}catch(e){}u(!0)},[t,r,null==e?void 0:e.id]),(0,c.useEffect)(()=>{if(!l)return;let e=e=>{"Escape"===e.key&&d()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[l,r]),!(null==e?void 0:e.id)||!l||"hidden"===o.surfaces.whats_new)return null;let h="own"===o.surfaces.product_identity&&!!o.providerName;return(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-gray-500/75 p-4 dark:bg-gray-900/80",role:"dialog","aria-modal":"true","aria-labelledby":"whats-new-title",onClick:d,children:(0,n.jsxs)("div",{className:"flex max-h-[85vh] w-full max-w-3xl flex-col overflow-hidden rounded-lg bg-white shadow-xl dark:bg-gray-800",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-200 px-6 py-4 dark:border-gray-700",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h2",{id:"whats-new-title",className:"flex items-center gap-2 text-xl font-semibold text-gray-900 dark:text-white",children:[(0,n.jsx)(y.A,{className:"h-5 w-5 text-indigo-600 dark:text-indigo-400"}),"What's New"]}),(0,n.jsx)("p",{className:"mt-0.5 text-sm text-gray-500 dark:text-gray-400",children:h?"The latest product updates.":"The latest updates to Intellimate AI."})]}),(0,n.jsx)("button",{type:"button",onClick:d,"aria-label":"Close",className:"text-gray-400 hover:text-gray-500 dark:hover:text-gray-300",children:(0,n.jsx)(v.A,{className:"h-6 w-6"})})]}),(0,n.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-6 py-4",children:(0,n.jsx)(w.c3,{entries:i,siblingCta:o.surfaces.sibling_cta,providerName:o.providerName})}),(0,n.jsxs)("div",{className:"flex items-center justify-between border-t border-gray-200 px-6 py-3 dark:border-gray-700",children:[(0,n.jsx)(m(),{href:"/whats-new",onClick:d,className:"rounded-md px-3 py-1.5 text-sm font-medium text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",children:"View all updates"}),(0,n.jsx)("button",{type:"button",onClick:d,className:"rounded-md bg-indigo-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-indigo-700",children:"Got it"})]})]})})}var k=r(77328),_=r.n(k);function S(e){let{children:t}=e,{user:r}=(0,s.A)(),{setUserRole:a}=(0,l.S)(),{updateMainFavnLogos:o,theme:u}=(0,i.D)(),d=(0,f.s)(),h="own"===d.surfaces.product_identity&&!!d.providerName;return(0,c.useEffect)(()=>{r&&(o(u),a(null==r?void 0:r.role))},[u,r]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(_(),{children:[(0,n.jsx)("title",{children:h?d.providerName:" Intellimate AI"}),(0,n.jsx)("meta",{name:"description",content:"Intellimate AI, the intelligent automation platform: assess a process, model the business case, and measure what shipped."})]}),(0,n.jsxs)("div",{className:"min-h-screen bg-gray-100 dark:bg-gray-900",children:[r&&(0,n.jsx)(p.V,{}),r&&(0,n.jsx)(x,{}),(0,n.jsx)("main",{className:"lg:pl-64 pt-16 lg:pt-0",children:t})]})]})}let E=e=>{let{children:t}=e;return(0,n.jsx)(S,{children:t})},j=e=>{let{children:t}=e;return(0,n.jsx)(h,{children:(0,n.jsx)(E,{children:t})})};var A=r(58725),T=r(63200),O=r(88628),C=r(51655);function N(e){let{onClose:t}=e,{user:r}=(0,s.A)();return(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50 p-4",children:(0,n.jsxs)("div",{className:"relative w-full max-w-md rounded-lg bg-gray-800 shadow-xl",children:[(0,n.jsx)("button",{onClick:t,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-300","aria-label":"Close sign in",children:(0,n.jsx)(v.A,{className:"h-6 w-6"})}),(0,n.jsxs)("div",{className:"p-8",children:[(0,n.jsx)("h2",{className:"mb-6 text-2xl font-bold text-white",children:r?"You are currently signed in":"Sign In"}),(0,n.jsx)(C.b,{variant:"modal",onSignedIn:t})]})]})})}var I=r(5925);let P="https://intellimate.ai";function R(){let[e,t]=(0,c.useState)(!1),[r,i]=(0,c.useState)(!1),[a,o]=(0,c.useState)(!1),{user:l}=(0,s.A)(),u=[{name:"Features",href:"".concat(P,"/features")},{name:"Solutions",href:"".concat(P,"/solutions"),submenu:[{name:"For Businesses",href:"".concat(P,"/businesses")},{name:"For Agencies",href:"".concat(P,"/agencies")},{name:"For Enterprises",href:"".concat(P,"/enterprises")}]},{name:"Pricing",href:"".concat(P,"/pricing")},{name:"Contact",href:"".concat(P,"/contact")}];return(0,n.jsxs)("nav",{className:"bg-gray-900 border-b border-gray-700",children:[(0,n.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:(0,n.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(m(),{href:"/",passHref:!0,className:"flex-shrink-0 flex items-center",children:(0,n.jsx)("img",{src:"/intellimate-ai-intelligent-automation-platform-logo2-dark.png",alt:"intellimate-ai-intelligent-automation-platform-logo2",className:"h-8 w-40 text-indigo-400",id:"intellimate_logo_"})}),(0,n.jsx)("div",{className:"hidden sm:ml-8 sm:flex sm:items-center sm:space-x-4",children:u.map(e=>(0,n.jsx)("div",{className:"relative group",children:e.submenu?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{className:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-300 hover:text-white rounded-md",children:[e.name,(0,n.jsx)(A.A,{className:"ml-1 h-4 w-4"})]}),(0,n.jsx)("div",{className:"absolute left-0 w-48 mt-1 pt-1 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 ease-in-out",children:(0,n.jsx)("div",{className:"relative py-1 bg-gray-800 rounded-md shadow-lg ring-1 ring-black ring-opacity-5",children:e.submenu.map(e=>(0,n.jsx)(m(),{href:e.href,passHref:!0,className:"block px-4 py-2 text-sm text-gray-300 hover:bg-gray-700 hover:text-white",children:e.name},e.name))})})]}):(0,n.jsx)(m(),{href:e.href,passHref:!0,className:"px-3 py-2 text-sm font-medium text-gray-300 hover:text-white rounded-md",children:e.name})},e.name))})]}),(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("div",{className:"hidden sm:flex sm:items-center",children:l?(0,n.jsxs)(m(),{href:"/dashboard",passHref:!0,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700",children:[(0,n.jsx)(T.A,{className:"h-4 w-4 mr-2"}),"Dashboard"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{onClick:()=>i(!0),className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700",children:"Sign In"}),(0,n.jsx)("button",{onClick:()=>o(!0),className:"ml-4 inline-flex items-center px-4 py-2 border border-gray-600 text-sm font-medium rounded-md text-gray-300 hover:text-white hover:border-gray-500",children:"Sign Up"})]})}),(0,n.jsx)("div",{className:"flex sm:hidden",children:(0,n.jsx)("button",{onClick:()=>t(!e),className:"inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-800",children:e?(0,n.jsx)(v.A,{className:"block h-6 w-6"}):(0,n.jsx)(O.A,{className:"block h-6 w-6"})})})]})]})}),e&&(0,n.jsx)("div",{className:"sm:hidden",children:(0,n.jsxs)("div",{className:"pt-2 pb-3 space-y-1",children:[u.map(e=>(0,n.jsx)(c.Fragment,{children:e.submenu?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"block pl-3 pr-4 py-2 text-base font-medium text-gray-300 border-l-4 border-transparent",children:e.name}),e.submenu.map(e=>(0,n.jsx)(m(),{href:e.href,passHref:!0,className:"block pl-8 pr-4 py-2 text-sm text-gray-300 hover:text-white hover:bg-gray-800 border-l-4 border-transparent",onClick:()=>t(!1),children:e.name},e.name))]}):(0,n.jsx)(m(),{href:e.href,passHref:!0,className:"block pl-3 pr-4 py-2 text-base font-medium text-gray-300 hover:text-white hover:bg-gray-800 border-l-4 border-transparent",onClick:()=>t(!1),children:e.name})},e.name)),l?(0,n.jsx)(m(),{href:"/dashboard",passHref:!0,className:"block pl-3 pr-4 py-2 text-base font-medium text-indigo-400 hover:text-indigo-300 hover:bg-gray-800 border-l-4 border-transparent",onClick:()=>t(!1),children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(T.A,{className:"h-4 w-4 mr-2"}),"Dashboard"]})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{onClick:()=>{i(!0),t(!1)},className:"block w-full text-left pl-3 pr-4 py-2 text-base font-medium text-indigo-400 hover:text-indigo-300 hover:bg-gray-800 border-l-4 border-transparent",children:"Sign In"}),(0,n.jsx)("button",{onClick:()=>{o(!0),t(!1)},className:"block w-full text-left pl-3 pr-4 py-2 text-base font-medium text-indigo-400 hover:text-indigo-300 hover:bg-gray-800 border-l-4 border-transparent",children:"Sign Up"})]})]})}),r&&(0,n.jsx)(N,{onClose:()=>i(!1)}),a&&(0,n.jsx)(I.g,{onClose:()=>o(!1)})]})}var L=r(8728),D=r(73305),M=r(6781),U=r(70251),$=r(17963);let F=(0,$.A)("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);var B=r(39046),z=r(22017);let q=(0,$.A)("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7
1a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),V="https://intellimate.ai";function H(){let e={product:[{name:"Features",href:"".concat(V,"/features")},{name:"Solutions",href:"".concat(V,"/solutions")},{name:"Pricing",href:"".concat(V,"/pricing")},{name:"Roadmap",href:"".concat(V,"/roadmap")}],company:[{name:"About Us",href:"".concat(V,"/about")},{name:"Careers",href:"".concat(V,"/careers")},{name:"Blog",href:"/blog"},{name:"Contact",href:"".concat(V,"/contact")}],legal:[{name:"Privacy Policy",href:"".concat(V,"/privacy")},{name:"Terms of Service",href:"".concat(V,"/terms")},{name:"Disclaimers",href:"".concat(V,"/disclaimers")},{name:"Accessibility",href:"".concat(V,"/accessibility")},{name:"End User License Agreement",href:"".concat(V,"/eula")}],contact:[{name:"[email protected]",href:"mailto:[email protected]",icon:L.A},{name:"(717) 256-3886",href:"tel:+1-717-256-3886",icon:D.A},{name:"York, PA",href:"#",icon:M.A}],social:[{name:"Facebook",href:"https://facebook.com/intellimateai",icon:U.A},{name:"Instagram",href:"https://instagram.com/intellimateai",icon:F},{name:"X (Twitter)",href:"https://x.com/intellimateai",icon:B.A},{name:"LinkedIn",href:"https://www.linkedin.com/company/intellimate-ai/",icon:z.A},{name:"Pinterest",href:"https://www.pinterest.com/intellimate-ai",icon:q}]};return(0,n.jsx)("footer",{className:"bg-gray-900 border-t border-gray-800",children:(0,n.jsxs)("div",{className:"max-w-7xl mx-auto py-12 px-4 sm:px-6 lg:px-8",children:[(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-8",children:[(0,n.jsxs)("div",{className:"col-span-1 md:col-span-3",children:[(0,n.jsx)(m(),{href:"/",passHref:!0,className:"flex items-center",children:(0,n.jsx)("span",{className:"text-xl font-semibold text-white",children:"Intellimate AI"})}),(0,n.jsx)("p",{className:"mt-4 text-sm text-gray-400",children:"Transforming businesses through intelligent automation solutions."}),(0,n.jsx)("div",{className:"mt-6 flex space-x-4",children:e.social.map(e=>(0,n.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-gray-300 transition-colors","aria-label":e.name,children:(0,n.jsx)(e.icon,{className:"h-5 w-5"})},e.name))})]}),(0,n.jsxs)("div",{className:"md:col-span-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-400 tracking-wider uppercase",children:"Product"}),(0,n.jsx)("ul",{className:"mt-4 space-y-4",children:e.product.map(e=>(0,n.jsx)("li",{children:(0,n.jsx)(m(),{href:e.href,passHref:!0,className:"text-base text-gray-300 hover:text-white",children:e.name})},e.name))})]}),(0,n.jsxs)("div",{className:"md:col-span-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-400 tracking-wider uppercase",children:"Company"}),(0,n.jsx)("ul",{className:"mt-4 space-y-4",children:e.company.map(e=>(0,n.jsx)("li",{children:(0,n.jsx)(m(),{href:e.href,passHref:!0,className:"text-base text-gray-300 hover:text-white",children:e.name})},e.name))})]}),(0,n.jsxs)("div",{className:"md:col-span-2",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-400 tracking-wider uppercase",children:"Legal"}),(0,n.jsx)("ul",{className:"mt-4 space-y-4",children:e.legal.map(e=>(0,n.jsx)("li",{children:(0,n.jsx)(m(),{href:e.href,passHref:!0,className:"text-base text-gray-300 hover:text-white",children:e.name})},e.name))})]}),(0,n.jsxs)("div",{className:"md:col-span-3",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-400 tracking-wider uppercase",children:"Contact"}),(0,n.jsx)("ul",{className:"mt-4 space-y-4",children:e.contact.map(e=>(0,n.jsx)("li",{children:(0,n.jsxs)("a",{href:e.href,className:"text-base text-gray-300 hover:text-white flex items-center",children:[(0,n.jsx)(e.icon,{className:"h-5 w-5 mr-2"}),e.name]})},e.name))})]})]}),(0,n.jsx)("div",{className:"mt-8 pt-8 border-t border-gray-800",children:(0,n.jsxs)("p",{className:"text-base text-gray-400 text-center",children:["\xa9 ",new Date().getFullYear()," Intellimate. All rights reserved."]})})]})})}let W=e=>{let{children:t}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(R,{}),(0,n.jsx)("main",{children:t}),(0,n.jsx)(H,{})]})};var K=r(32446);function J(e){var t;let{Component:r,pageProps:c}=e,d=(0,u.useRouter)(),h=["/","/about","/terms","/login","/accessibility","/careers","/contact","/disclaimers","/eula","/features","/pricing","/privacy","/roadmap","/solutions","/blog","/business/assessment","/assessment/thank-you","/discover","/assessments/coi-calculator"].some(e=>"/blog"===e?d.pathname.startsWith("/blog"):"/business/assessment"===e?d.pathname.startsWith("/business/assessment"):"/discover"===e?d.pathname.startsWith("/discover"):d.pathname===e)?W:j,f=null!=(t=r.getLayout)?t:e=>(0,n.jsx)(h,{children:e});return(0,n.jsx)(i.N,{children:(0,n.jsx)(l.w,{children:(0,n.jsx)(s.O,{children:(0,n.jsx)(a.$,{children:(0,n.jsxs)(o.w,{children:[f((0,n.jsx)(r,{...c})),(0,n.jsx)(K.N9,{position:"bottom-right",autoClose:1e3,hideProgressBar:!1,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"dark",transition:K.GP})]})})})})})}},8728:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]])},11508:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},12572:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},13415:(e,t,r)=>{"use strict";r.d(t,{N:()=>t7});var n,i,s,a,o,l,u,c,d,h,f,p,g,m=r(4902);
1class y extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class v extends y{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class b extends y{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class w extends y{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}!function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"}(n||(n={}));class x{constructor(e,{headers:t={},customFetch:i,region:s=n.Any}={}){this.url=e,this.headers=t,this.region=s,this.fetch=(e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,90785)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)})(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return(0,m.__awaiter)(this,arguments,void 0,function*(e,t={}){var r;try{let n,{headers:i,method:s,body:a,signal:o}=t,l={},{region:u}=t;u||(u=this.region);let c=new URL(`${this.url}/${e}`);u&&"any"!==u&&(l["x-region"]=u,c.searchParams.set("forceFunctionRegion",u)),a&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)?"undefined"!=typeof Blob&&a instanceof Blob||a instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",n=a):"string"==typeof a?(l["Content-Type"]="text/plain",n=a):"undefined"!=typeof FormData&&a instanceof FormData?n=a:(l["Content-Type"]="application/json",n=JSON.stringify(a)):n=a;let d=yield this.fetch(c.toString(),{method:s||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),i),body:n,signal:o}).catch(e=>{if("AbortError"===e.name)throw e;throw new v(e)}),h=d.headers.get("x-relay-error");if(h&&"true"===h)throw new b(d);if(!d.ok)throw new w(d);let f=(null!=(r=d.headers.get("Content-Type"))?r:"text/plain").split(";")[0].trim();return{data:"application/json"===f?yield d.json():"application/octet-stream"===f||"application/pdf"===f?yield d.blob():"text/event-stream"===f?d:"multipart/form-data"===f?yield d.formData():yield d.text(),error:null,response:d}}catch(e){if(e instanceof Error&&"AbortError"===e.name)return{data:null,error:new v(e)};return{data:null,error:e,response:e instanceof w||e instanceof b?e.context:void 0}}})}}let{tE:k,lc:_,pT:S,ZS:E,le:j,kf:A}=r(39503);var T=r(65364);class O{static detectEnvironment(){var e;if("undefined"!=typeof WebSocket)return{type:"native",constructor:WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocket)return{type:"native",constructor:globalThis.WebSocket};if(void 0!==r.g&&void 0!==r.g.WebSocket)return{type:"native",constructor:r.g.WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocketPair&&void 0===globalThis.WebSocket)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("undefined"!=typeof globalThis&&globalThis.EdgeRuntime||"undefined"!=typeof navigator&&(null==(e=navigator.userAgent)?void 0:e.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(void 0!==T){let e=T.versions;if(e&&e.node){let t=parseInt(e.node.replace(/^v/,"").split(".")[0]);return t>=22?void 0!==globalThis.WebSocket?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${t} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${t} detected without native WebSocket support.`,workaround:'For Node.js < 22, install "ws" package and provide it via the transport option:\nimport ws from "ws"\nnew 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 e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`
2
3Suggested solution: ${e.workaround}`),Error(t)}static createWebSocket(e,t){return new(this.getWebSocketConstructor())(e,t)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return"native"===e.type||"ws"===e.type}catch(e){return!1}}}!function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"}(i||(i={})),function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"}(s||(s={})),function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"}(a||(a={})),(o||(o={})).websocket="websocket",function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"}(l||(l={}));class C{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):"string"==typeof e?t(JSON.parse(e)):t({})}
3_binaryDecode(e){let t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){let n=t.getUint8(1),i=t.getUint8(2),s=this.HEADER_LENGTH+2,a=r.decode(e.slice(s,s+n));s+=n;let o=r.decode(e.slice(s,s+i));return s+=i,{ref:null,topic:a,event:o,payload:JSON.parse(r.decode(e.slice(s,e.byteLength)))}}}class N{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}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))}}!function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"}(u||(u={}));let I=(e,t,r={})=>{var n;let i=null!=(n=r.skipTypes)?n:[];return t?Object.keys(t).reduce((r,n)=>(r[n]=P(n,e,t,i),r),{}):{}},P=(e,t,r,n)=>{let i=t.find(t=>t.name===e),s=null==i?void 0:i.type,a=r[e];return s&&!n.includes(s)?R(s,a):L(a)},R=(e,t)=>{if("_"===e.charAt(0))return $(t,e.slice(1,e.length));switch(e){case u.bool:return D(t);case u.float4:case u.float8:case u.int2:case u.int4:case u.int8:case u.numeric:case u.oid:return M(t);case u.json:case u.jsonb:return U(t);case u.timestamp:return F(t);case u.abstime:case u.date:case u.daterange:case u.int4range:case u.int8range:case u.money:case u.reltime:case u.text:case u.time:case u.timestamptz:case u.timetz:case u.tsrange:case u.tstzrange:default:return L(t)}},L=e=>e,D=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},M=e=>{if("string"==typeof e){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},U=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){console.log(`JSON parse error: ${e}`)}return e},$=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,n=e[r];if("{"===e[0]&&"}"===n){let n,i=e.slice(1,r);try{n=JSON.parse("["+i+"]")}catch(e){n=i?i.split(","):[]}return n.map(e=>R(t,e))}return e},F=e=>"string"==typeof e?e.replace(" ","T"):e,B=e=>{let t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),""===t.pathname||"/"===t.pathname?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class z{constructor(e,t,r={},n=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=n,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,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(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var r;return this._hasReceived(e)&&t(null==(r=this.receivedResp)?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let e=e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}
3){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}!function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"}(c||(c={}));class q{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let r=(null==t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},e=>{let{onJoin:t,onLeave:r,onSync:n}=this.caller;this.joinRef=this.channel._joinRef(),this.state=q.syncState(this.state,e,t,r),this.pendingDiffs.forEach(e=>{this.state=q.syncDiff(this.state,e,t,r)}),this.pendingDiffs=[],n()}),this.channel._on(r.diff,{},e=>{let{onJoin:t,onLeave:r,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=q.syncDiff(this.state,e,t,r),n())}),this.onJoin((e,t,r)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:r})}),this.onLeave((e,t,r)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:r})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,r,n){let i=this.cloneDeep(e),s=this.transformState(t),a={},o={};return this.map(i,(e,t)=>{s[e]||(o[e]=t)}),this.map(s,(e,t)=>{let r=i[e];if(r){let n=t.map(e=>e.presence_ref),i=r.map(e=>e.presence_ref),s=t.filter(e=>0>i.indexOf(e.presence_ref)),l=r.filter(e=>0>n.indexOf(e.presence_ref));s.length>0&&(a[e]=s),l.length>0&&(o[e]=l)}else a[e]=t}),this.syncDiff(i,{joins:a,leaves:o},r,n)}static syncDiff(e,t,r,n){let{joins:i,leaves:s}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),n||(n=()=>{}),this.map(i,(t,n)=>{var i;let s=null!=(i=e[t])?i:[];if(e[t]=this.cloneDeep(n),s.length>0){let r=e[t].map(e=>e.presence_ref),n=s.filter(e=>0>r.indexOf(e.presence_ref));e[t].unshift(...n)}r(t,s,n)}),this.map(s,(t,r)=>{let i=e[t];if(!i)return;let s=r.map(e=>e.presence_ref);i=i.filter(e=>0>s.indexOf(e.presence_ref)),e[t]=i,n(t,i,r),0===i.length&&delete e[t]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return Object.getOwnPropertyNames(e=this.cloneDeep(e)).reduce((t,r)=>{let n=e[r];return"metas"in n?t[r]=n.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):t[r]=n,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}!function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"}(d||(d={})),function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"}(h||(h={})),function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"}(f||(f={}));class V{constructor(e,t={config:{}},r){var n,i;if(this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=s.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new z(this,a.join,this.params,this.timeout),this.rejoinTimer=new N(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=s.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=s.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=s.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=s.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=s.errored,this.rejoinTimer.scheduleTimeout())}),this._on(a.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new q(this),this.broadcastEndpointURL=B(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(null==(i=null==(n=this.params.config)?void 0:n.broadcast)?void 0:i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,t=this.timeout){var r,n,i;if(this.socket.isConnected()||this.socket.connect(),this.state==s.closed){let{config:{broadcast:a,presence:o,private:l}}=this.params,u=null!=(n=null==(r=this.bindings.postgres_changes)?void 0:r.map(e=>e.filter))?n:[],c=!!this.bindings[h.PRESENCE]&&this.bindings[h.PRESENCE].length>0||(null==(i=this.params.config.presence)?void 0:i.enabled)===!0,d={},p={broadcast:a,presence:Object.assign(Object.assign({},o),{enabled:c}),postgres_changes:u,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(t=>null==e?void 0:e(f.CHANNEL_ERROR,t)),this._onClose(()=>null==e?void 0:e(f.CLOSED)),this.updateJoinPayload(Object.assign({config:p},d)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:t})=>{var r;if(this.socket.setAuth(),void 0===t){null==e||e(f.SUBSCRIBED);return}{let n=this.bindings.postgres_changes,i=null!=(r=null==n?void 0:n.length)?r:0,a=[];for(let r=0;r<i;r++){let i=n[r],{filter:{event:o,schema:l,table:u,filter:c}}=i,d=t&&t[r];if(d&&d.event===o&&d.schema===l&&d.table===u&&d.filter===c)a.push(Object.assign(Object.assign({},i),{id:d.id}));else{this.unsubscribe(),this.state=s.errored,null==e||e(f.CHANNEL_ERROR,Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,e&&e(f.SUBSCRIBED);return}}).receive("error",t=>{this.state=s.errored,null==e||e(f.CHANNEL_ERROR,Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",()=>{null==e||e(f.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){return this.state===s.joined&&e===h.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(e,t,r)}async httpSend(e,t,r={}){var n;let i=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(null==t)return Promise.reject("Payload is required for httpSend()");let s={method:"POST",headers:{Authorization:i,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:t,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,s,null!=(n=r.timeout)?n:this.timeout);if(202===a.status)return{success:!0};let o=a.statusText;
3try{let e=await a.json();o=e.error||e.message||o}catch(e){}return Promise.reject(Error(o))}async send(e,t={}){var r,n;if(this._canPush()||"broadcast"!==e.type)return new Promise(r=>{var n,i,s;let a=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null==(s=null==(i=null==(n=this.params)?void 0:n.config)?void 0:i.broadcast)?void 0:s.ack)||r("ok"),a.receive("ok",()=>r("ok")),a.receive("error",()=>r("error")),a.receive("timeout",()=>r("timed out"))});{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:i,payload:s}=e,a={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:i,payload:s,private:this.private}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,a,null!=(r=t.timeout)?r:this.timeout);return await (null==(n=e.body)?void 0:n.cancel()),e.ok?"ok":"error"}catch(e){if("AbortError"===e.name)return"timed out";return"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=s.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(a.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(n=>{(r=new z(this,a.leave,{},e)).receive("ok",()=>{t(),n("ok")}).receive("timeout",()=>{t(),n("timed out")}).receive("error",()=>{n("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{null==r||r.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=s.closed,this.bindings={}}async _fetchWithTimeout(e,t,r){let n=new AbortController,i=setTimeout(()=>n.abort(),r),s=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:n.signal}));return clearTimeout(i),s}_push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let n=new z(this,e,t,r);return this._canPush()?n.send():this._addToPushBuffer(n),n}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>100){let e=this.pushBuffer.shift();e&&(e.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${e.event}`,e.payload))}}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var n,i;let s=e.toLocaleLowerCase(),{close:o,error:l,leave:u,join:c}=a;if(r&&[o,l,u,c].indexOf(s)>=0&&r!==this._joinRef())return;let d=this._onMessage(s,t,r);if(t&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(s)?null==(n=this.bindings.postgres_changes)||n.filter(e=>{var t,r,n;return(null==(t=e.filter)?void 0:t.event)==="*"||(null==(n=null==(r=e.filter)?void 0:r.event)?void 0:n.toLocaleLowerCase())===s}).map(e=>e.callback(d,r)):null==(i=this.bindings[s])||i.filter(e=>{var r,n,i,a,o,l;if(!["broadcast","presence","postgres_changes"].includes(s))return e.type.toLocaleLowerCase()===s;if("id"in e){let s=e.id,a=null==(r=e.filter)?void 0:r.event;return s&&(null==(n=t.ids)?void 0:n.includes(s))&&("*"===a||(null==a?void 0:a.toLocaleLowerCase())===(null==(i=t.data)?void 0:i.type.toLocaleLowerCase()))}{let r=null==(o=null==(a=null==e?void 0:e.filter)?void 0:a.event)?void 0:o.toLocaleLowerCase();return"*"===r||r===(null==(l=null==t?void 0:t.event)?void 0:l.toLocaleLowerCase())}}).map(e=>{if("object"==typeof d&&"ids"in d){let e=d.data,{schema:t,table:r,commit_timestamp:n,type:i,errors:s}=e;d=Object.assign(Object.assign({},{schema:t,table:r,commit_timestamp:n,eventType:i,new:{},old:{},errors:s}),this._getPayloadRecords(e))}e.callback(d,r)})}_isClosed(){return this.state===s.closed}_isJoined(){return this.state===s.joined}_isJoining(){return this.state===s.joining}_isLeaving(){return this.state===s.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){let n=e.toLocaleLowerCase(),i={type:n,filter:t,callback:r};return this.bindings[n]?this.bindings[n].push(i):this.bindings[n]=[i],this}_off(e,t){let r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(e=>{var n;return!((null==(n=e.type)?void 0:n.toLocaleLowerCase())===r&&V.isEqual(e.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(a.close,{},e)}_onError(e){this._on(a.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=s.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=I(e.columns,e.record)),("UPDATE"===e.type||"DELET
3E"===e.type)&&(t.old=I(e.columns,e.old_record)),t}}let H=()=>{},W={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},K=[1e3,2e3,5e3,1e4],J=`
4  addEventListener("message", (e) => {
5    if (e.data.event === "start") {
6      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
7    }
8  });`;class G{constructor(e,t){var n;if(this.accessTokenValue=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=1e4,this.transport=null,this.heartbeatIntervalMs=W.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=H,this.ref=0,this.reconnectTimer=null,this.logger=H,this.conn=null,this.sendBuffer=[],this.serializer=new C,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,90785)).then(({default:t})=>t(...e)).catch(e=>{throw Error(`Failed to load @supabase/node-fetch: ${e.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):fetch),(...e)=>t(...e)},!(null==(n=null==t?void 0:t.params)?void 0:n.apikey))throw Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${o.websocket}`,this.httpEndpoint=B(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||null!==this.conn&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=O.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");let e=t.message;if(e.includes("Node.js"))throw Error(`${e}
9
10To use Realtime in Node.js, you need to provide a WebSocket implementation:
11
12Option 1: Use Node.js 22+ which has native WebSocket support
13Option 2: Install and provide the "ws" package:
14
15  npm install ws
16
17  import ws from "ws"
18  const client = new RealtimeClient(url, {
19    ...options,
20    transport: ws
21  })`);throw Error(`WebSocket not available: ${e}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}disconnect(e,t){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")},e?this.conn.close(e,null!=t?t:""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){let t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){let e=await Promise.all(this.channels.map(e=>e.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case i.connecting:return l.Connecting;case i.open:return l.Open;case i.closing:return l.Closing;default:return l.Closed}}isConnected(){return this.connectionState()===l.Open}isConnecting(){return"connecting"===this._connectionState}isDisconnecting(){return"disconnecting"===this._connectionState}channel(e,t={config:{}}){let r=`realtime:${e}`,n=this.getChannels().find(e=>e.topic===r);if(n)return n;{let r=new V(`realtime:${e}`,t,this);return this.channels.push(r),r}}push(e){let{topic:t,event:r,payload:n,ref:i}=e,s=()=>{this.encode(e,e=>{var t;null==(t=this.conn)||t.send(e)})};this.log("push",`${t} ${r} (${i})`,n),this.isConnected()?s():this.sendBuffer.push(s)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;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,null==(e=this.conn)||e.close(1e3,"heartbeat timeout"),setTimeout(()=>{var e;this.isConnected()||null==(e=this.reconnectTimer)||e.scheduleTimeout()},W.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(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>
210&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t._isJoined()||t._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,e=>{if("phoenix"===e.topic&&"phx_reply"===e.event)try{this.heartbeatCallback("ok"===e.payload.status?"ok":"error")}catch(e){this.log("error","error in heartbeat callback",e)}e.ref&&e.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);let{topic:t,event:r,payload:n,ref:i}=e,s=i?`(${i})`:"",a=n.status||"";this.log("receive",`${a} ${t} ${r} ${s}`.trim(),n),this.channels.filter(e=>e._isMember(t)).forEach(e=>e._trigger(r,n,i)),this._triggerStateCallbacks("message",e)})}_clearTimer(e){var t;"heartbeat"===e&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):"reconnect"===e&&(null==(t=this.reconnectTimer)||t.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=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),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 e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log("worker","worker error",e.message),this.workerRef.terminate()},this.workerRef.onmessage=e=>{"keepAlive"===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||null==(t=this.reconnectTimer)||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(a.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?",n=new URLSearchParams(t);return`${e}${r}${n}`}_workerObjectUrl(e){let t;if(e)t=e;else{let e=new Blob([J],{type:"application/javascript"});t=URL.createObjectURL(e)}return t}_setConnectionState(e,t=!1){this._connectionState=e,"connecting"===e?this._wasManualDisconnect=!1:"disconnecting"===e&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t;t=e||(this.accessToken?await this.accessToken():this.accessTokenValue),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{t&&e.updateJoinPayload({access_token:t,version:"realtime-js/2.76.1"}),e.joinedOnce&&e._isJoined()&&e._push(a.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(t=>{this.log("error",`error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}_setupReconnectionTimer(){this.reconnectTimer=new N(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},W.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var t,r,n,i,s,a,o,l,u;if(this.transport=null!=(t=null==e?void 0:e.transport)?t:null,this.timeout=null!=(r=null==e?void 0:e.timeout)?r:1e4,this.heartbeatIntervalMs=null!=(n=null==e?void 0:e.heartbeatIntervalMs)?n:W.HEARTBEAT_INTERVAL,this.worker=null!=(i=null==e?void 0:e.worker)&&i,this.accessToken=null!=(s=null==e?void 0:e.accessToken)?s:null,this.heartbeatCallback=null!=(a=null==e?void 0:e.heartbeatCallback)?a:H,(null==e?void 0:e.params)&&(this.params=e.params),(null==e?void 0:e.logger)&&(this.logger=e.logger),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=null!=(o=null==e?void 0:e.reconnectAfterMs)?o:e=>K[e-1]||1e4,this.encode=null!=(l=null==e?void 0:e.encode)?l:(e,t)=>
21t(JSON.stringify(e)),this.decode=null!=(u=null==e?void 0:e.decode)?u:this.serializer.decode.bind(this.serializer),this.worker){if("undefined"!=typeof window&&!window.Worker)throw Error("Web Worker is not supported");this.workerUrl=null==e?void 0:e.workerUrl}}}class Y extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function X(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}class Z extends Y{constructor(e,t,r){super(e),this.name="StorageApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Q extends Y{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}let ee=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,90785)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)},et=e=>{if(Array.isArray(e))return e.map(e=>et(e));if("function"==typeof e||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([e,r])=>{t[e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""))]=et(r)}),t},er=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e);function en(e,t,n,i,s,a){return(0,m.__awaiter)(this,void 0,void 0,function*(){return new Promise((o,l)=>{e(n,((e,t,r,n)=>{let i={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&n?((e=>{if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)})(n)?(i.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),i.body=JSON.stringify(n)):i.body=n,(null==t?void 0:t.duplex)&&(i.duplex=t.duplex),Object.assign(Object.assign({},i),r)):i})(t,i,s,a)).then(e=>{if(!e.ok)throw e;return(null==i?void 0:i.noResolveJson)?e:e.json()}).then(e=>o(e)).catch(e=>(0,m.__awaiter)(void 0,void 0,void 0,function*(){e instanceof(yield(0,m.__awaiter)(void 0,void 0,void 0,function*(){return"undefined"==typeof Response?(yield Promise.resolve().then(r.bind(r,90785))).Response:Response}))&&!(null==i?void 0:i.noResolveJson)?e.json().then(t=>{let r=e.status||500,n=(null==t?void 0:t.statusCode)||r+"";l(new Z(er(t),r,n))}).catch(e=>{l(new Q(er(e),e))}):l(new Q(er(e),e))}))})})}function ei(e,t,r,n){return(0,m.__awaiter)(this,void 0,void 0,function*(){return en(e,"GET",t,r,n)})}function es(e,t,r,n,i){return(0,m.__awaiter)(this,void 0,void 0,function*(){return en(e,"POST",t,n,i,r)})}function ea(e,t,r,n,i){return(0,m.__awaiter)(this,void 0,void 0,function*(){return en(e,"PUT",t,n,i,r)})}function eo(e,t,r,n,i){return(0,m.__awaiter)(this,void 0,void 0,function*(){return en(e,"DELETE",t,n,i,r)})}
21class el{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}execute(){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}}class eu{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[p]="BlobDownloadBuilder",this.promise=null}asStream(){return new el(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{let e=yield this.downloadFn();return{data:yield e.blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}}p=Symbol.toStringTag;var ec=r(88220).Buffer;let ed={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},eh={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ef{constructor(e,t={},r,n){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=r,this.fetch=ee(n)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,t,r,n){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{let i,s=Object.assign(Object.assign({},eh),n),a=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(s.upsert)}),o=s.metadata;"undefined"!=typeof Blob&&r instanceof Blob?((i=new FormData).append("cacheControl",s.cacheControl),o&&i.append("metadata",this.encodeMetadata(o)),i.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?((i=r).append("cacheControl",s.cacheControl),o&&i.append("metadata",this.encodeMetadata(o))):(i=r,a["cache-control"]=`max-age=${s.cacheControl}`,a["content-type"]=s.contentType,o&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(o)))),(null==n?void 0:n.headers)&&(a=Object.assign(Object.assign({},a),n.headers));let l=this._removeEmptyFolders(t),u=this._getFinalPath(l),c=yield("PUT"==e?ea:es)(this.fetch,`${this.url}/object/${u}`,i,Object.assign({headers:a},(null==s?void 0:s.duplex)?{duplex:s.duplex}:{}));return{data:{path:l,id:c.Id,fullPath:c.Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}upload(e,t,r){return(0,m.__awaiter)(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}uploadToSignedUrl(e,t,r,n){return(0,m.__awaiter)(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),s=this._getFinalPath(i),a=new URL(this.url+`/object/upload/sign/${s}`);a.searchParams.set("token",t);try{let e,t=Object.assign({upsert:eh.upsert},n),s=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?((e=new FormData).append("cacheControl",t.cacheControl),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r).append("cacheControl",t.cacheControl):(e=r,s["cache-control"]=`max-age=${t.cacheControl}`,s["content-type"]=t.contentType);let o=yield ea(this.fetch,a.toString(),e,{headers:s});return{data:{path:i,fullPath:o.Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}createSignedUploadUrl(e,t){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e),n=Object.assign({},this.headers);(null==t?void 0:t.upsert)&&(n["x-upsert"]="true");let i=yield es(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:n}),s=new URL(this.url+i.url),a=s.searchParams.get("token");if(!a)throw new Y("No token returned by API");return{data:{signedUrl:s.toString(),path:e,token:a},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}update(e,t,r){return(0,m.__awaiter)(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t,r){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield es(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,de
21stinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}copy(e,t,r){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:{path:(yield es(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}createSignedUrl(e,t,r){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),i=yield es(this.fetch,`${this.url}/object/sign/${n}`,Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers}),s=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:i={signedUrl:encodeURI(`${this.url}${i.signedURL}${s}`)},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}createSignedUrls(e,t,r){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{let n=yield es(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:n.map(e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${i}`):null})),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}download(e,t){let r=void 0!==(null==t?void 0:t.transform)?"render/image/authenticated":"object",n=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),i=n?`?${n}`:"",s=this._getFinalPath(e);return new eu(()=>ei(this.fetch,`${this.url}/${r}/${s}${i}`,{headers:this.headers,noResolveJson:!0}),this.shouldThrowOnError)}info(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{let e=yield ei(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:et(e),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}exists(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{return yield function(e,t,r,n){return(0,m.__awaiter)(this,void 0,void 0,function*(){return en(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),void 0)})}(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e)&&e instanceof Q){let t=e.originalError;if([400,404].includes(null==t?void 0:t.status))return{data:!1,error:e}}throw e}})}getPublicUrl(e,t){let r=this._getFinalPath(e),n=[],i=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==i&&n.push(i);let s=void 0!==(null==t?void 0:t.transform),a=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==a&&n.push(a);let o=n.join("&");return""!==o&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${s?"render/image":"object"}/public/${r}${o}`)}}}remove(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eo(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}list(e,t,r){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{let n=Object.assign(Object.assign(Object.assign({},ed),t),{prefix:e||""});return{data:yield es(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}listV2(e,t){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{let r=Object.assign({},e);return{data:yield es(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},t),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return void 0!==ec?ec.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}let ep="2.76.1",eg={"X-Client-Info":`storage-js/${ep}`};class em{constructor(e,t={},r,n){this.shouldThrowOnError=!1;let i=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},eg),t),this.fetch=ee(r)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield ei(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}getBucket(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield ei(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}createBucket(e){return(0,m.__awaiter)(this,arguments,void 0,function*(e,t={public:!1}){try{return{data:yield es(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}updateBucket(e,t){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield ea(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}emptyBucket(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield es(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}deleteBucket(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eo(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}}class ey{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},eg),t),this.fetch=ee(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield es(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}listBuckets(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{let t=new URLSearchParams;(null==e?void 0:e.limit)!==void 0&&t.set("limit",e.limit.toString()),(null==e?void 0:e.offset)!==void 0&&t.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&t.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&t.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&t.set("search",e.search);let r=t.toString(),n=r?`${this.url}/bucket?${r}`:`${this.url}/bucket`,i=yield ei(this.fetch,n,{headers:this.headers});return{data:Array.isArray(i)?i.filter(e=>"ANALYTICS"===e.type):[],error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}deleteBucket(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eo(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(X(e))return{data:null,error:e};throw e}})}}let ev={"X-Client-Info":`storage-js/${ep}`,"Content-Type":"application/json"};
21class eb extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function ew(e){return"object"==typeof e&&null!==e&&"__isStorageVectorsError"in e}class ex extends eb{constructor(e,t,r){super(e),this.name="StorageVectorsApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class ek extends eb{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}}!function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"}(g||(g={}));let e_=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,90785)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)},eS=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e);function eE(e,t,r,n,i){return(0,m.__awaiter)(this,void 0,void 0,function*(){return function(e,t,r,n,i,s){return(0,m.__awaiter)(this,void 0,void 0,function*(){return new Promise((a,o)=>{e(r,((e,t,r,n)=>{let i={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&n?((e=>{if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)})(n)?(i.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),i.body=JSON.stringify(n)):i.body=n,Object.assign(Object.assign({},i),r)):i})(t,n,i,s)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;let t=e.headers.get("content-type");return t&&t.includes("application/json")?e.json():{}}).then(e=>a(e)).catch(e=>(0,m.__awaiter)(void 0,void 0,void 0,function*(){if(!(e&&"object"==typeof e&&"status"in e&&"ok"in e&&"number"==typeof e.status)||(null==n?void 0:n.noResolveJson))o(new ek(eS(e),e));else{let t=e.status||500;"function"==typeof e.json?e.json().then(e=>{let r=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||t+"";o(new ex(eS(e),t,r))}).catch(()=>{o(new ex(e.statusText||`HTTP ${t} error`,t,t+""))}):o(new ex(e.statusText||`HTTP ${t} error`,t,t+""))}}))})})}(e,"POST",t,n,i,r)})}class ej{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},ev),t),this.fetch=e_(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:(yield eE(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}getIndex(e,t){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eE(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}listIndexes(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eE(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}deleteIndex(e,t){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:(yield eE(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}}class eA{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},ev),t),this.fetch=e_(r)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw Error("Vector batch size must be between 1 and 500 items");return{data:(yield eE(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}getVectors(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eE(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}listVectors(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw Error("segmentCount must be between 1 and 16");
21if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:yield eE(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}queryVectors(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eE(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}deleteVectors(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw Error("Keys batch size must be between 1 and 500 items");return{data:(yield eE(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}}class eT{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},ev),t),this.fetch=e_(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:(yield eE(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}getBucket(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eE(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}listBuckets(){return(0,m.__awaiter)(this,arguments,void 0,function*(e={}){try{return{data:yield eE(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}deleteBucket(e){return(0,m.__awaiter)(this,void 0,void 0,function*(){try{return{data:(yield eE(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(ew(e))return{data:null,error:e};throw e}})}}class eO extends eT{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new eC(this.url,this.headers,e,this.fetch)}}class eC extends ej{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}createIndex(e){let t=Object.create(null,{createIndex:{get:()=>super.createIndex}});return(0,m.__awaiter)(this,void 0,void 0,function*(){return t.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){let e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return(0,m.__awaiter)(this,arguments,void 0,function*(t={}){return e.listIndexes.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){let t=Object.create(null,{getIndex:{get:()=>super.getIndex}});return(0,m.__awaiter)(this,void 0,void 0,function*(){return t.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){let t=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return(0,m.__awaiter)(this,void 0,void 0,function*(){return t.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new eN(this.url,this.headers,this.vectorBucketName,e,this.fetch)}}class eN extends eA{constructor(e,t,r,n,i){super(e,t,i),this.vectorBucketName=r,this.indexName=n}putVectors(e){let t=Object.create(null,{putVectors:{get:()=>super.putVectors}});return(0,m.__awaiter)(this,void 0,void 0,function*(){return t.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){let t=Object.create(null,{getVectors:{get:()=>super.getVectors}});return(0,m.__awaiter)(this,void 0,void 0,function*(){return t.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){let e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return(0,m.__awaiter)(this,arguments,void 0,function*(t={}){return e.listVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){let t=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return(0,m.__awaiter)(this,void 0,void 0,function*(){return t.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){let t=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return(0,m.__awaiter)(this,void 0,void 0,function*(){return t.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class eI extends em{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new ef(this.url,this.headers,e,this.fetch)}get vectors(){return new eO(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new ey(this.url+"/iceberg",this.headers,this.fetch)}}let eP="";eP="undefined"!=typeof Deno?"deno":"undefined"!=typeof document?"web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";let eR={headers:{"X-Client-Info":`supabase-js-${eP}/2.76.1`}},eL={schema:"public"},eD={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},eM={};var eU=r(90785);let e$="2.76.1",eF={"X-Client-Info":`gotrue-js/${e$}`},eB="X-Supabase-Api-Version",ez={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},eq=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;
21class eV extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function eH(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class eW extends eV{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}class eK extends eV{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class eJ extends eV{constructor(e,t,r,n){super(e,r,n),this.name=t,this.status=r}}class eG extends eJ{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class eY extends eJ{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class eX extends eJ{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class eZ extends eJ{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class eQ extends eJ{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class e0 extends eJ{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function e1(e){return eH(e)&&"AuthRetryableFetchError"===e.name}class e2 extends eJ{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}class e4 extends eJ{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}let e3="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),e5=" 	\n\r=".split(""),e6=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<e5.length;t+=1)e[e5[t].charCodeAt(0)]=-2;for(let t=0;t<e3.length;t+=1)e[e3[t].charCodeAt(0)]=t;return e})();function e8(e,t,r){if(null!==e)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;)r(e3[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6;else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;)r(e3[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6}function e7(e,t,r){let n=e6[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else if(-2===n)return;else throw Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}function e9(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},n={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=e=>{!function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}}(e,n,r)};for(let t=0;t<e.length;t+=1)e7(e.charCodeAt(t),i,s);return t.join("")}function te(e){let t=[],r={queue:0,queuedBits:0},n=e=>{t.push(e)};for(let t=0;t<e.length;t+=1)e7(e.charCodeAt(t),r,n);return new Uint8Array(t)}function tt(e){let t=[],r={queue:0,queuedBits:0},n=e=>{t.push(e)};return e.forEach(e=>e8(e,r,n)),e8(null,r,n),t.join("")}let tr=()=>"undefined"!=typeof window&&"undefined"!=typeof document,tn={tested:!1,writable:!1},ti=()=>{if(!tr())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(tn.tested)return tn.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),tn.tested=!0,tn.writable=!0}catch(e){tn.tested=!0,tn.writable=!1}return tn.writable},ts=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,90785)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)},ta=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},to=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return r}},tl=async(e,t)=>{await e.removeItem(t)};class tu{constructor(){this.promise=new tu.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function tc(e){let t=e.split(".");if(3!==t.length)throw new e4("Invalid JWT structure");for(let e=0;e<t.length;e++)if(!eq.test(t[e]))throw new e4("JWT not in base64url format");
21return{header:JSON.parse(e9(t[0])),payload:JSON.parse(e9(t[1])),signature:te(t[2]),raw:{header:t[0],payload:t[1]}}}async function td(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function th(e){return("0"+e.toString(16)).substr(-2)}async function tf(e){let t=new TextEncoder().encode(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>String.fromCharCode(e)).join("")}async function tp(e){return"undefined"==typeof crypto||void 0===crypto.subtle||"undefined"==typeof TextEncoder?(console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e):btoa(await tf(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function tg(e,t,r=!1){let n=function(){let e=new Uint32Array(56);if("undefined"==typeof crypto){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length,r="";for(let n=0;n<56;n++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,th).join("")}(),i=n;r&&(i+="/PASSWORD_RECOVERY"),await ta(e,`${t}-code-verifier`,i);let s=await tp(n),a=n===s?"plain":"s256";return[s,a]}tu.promiseConstructor=Promise;let tm=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i,ty=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function tv(e){if(!ty.test(e))throw Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function tb(){return new Proxy({},{get:(e,t)=>{if("__isUserNotAvailableProxy"===t)return!0;if("symbol"==typeof t){let e=t.toString();if("Symbol(Symbol.toPrimitive)"===e||"Symbol(Symbol.toStringTag)"===e||"Symbol(util.inspect.custom)"===e)return}throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function tw(e){return JSON.parse(JSON.stringify(e))}let tx=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),tk=[502,503,504];async function t_(e){var t;let r,n;if(!("object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json))throw new e0(tx(e),0);if(tk.includes(e.status))throw new e0(tx(e),e.status);try{r=await e.json()}catch(e){throw new eK(tx(e),e)}let i=function(e){let t=e.headers.get(eB);if(!t||!t.match(tm))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch(e){return null}}(e);if(i&&i.getTime()>=ez["2024-01-01"].timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?n=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(n=r.error_code),n){if("weak_password"===n)throw new e2(tx(r),e.status,(null==(t=r.weak_password)?void 0:t.reasons)||[]);else if("session_not_found"===n)throw new eG}else if("object"==typeof r&&r&&"object"==typeof r.weak_password&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((e,t)=>e&&"string"==typeof t,!0))throw new e2(tx(r),e.status,r.weak_password.reasons);throw new eW(tx(r),e.status||500,n)}async function tS(e,t,r,n){var i;let s=Object.assign({},null==n?void 0:n.headers);s[eB]||(s[eB]=ez["2024-01-01"].name),(null==n?void 0:n.jwt)&&(s.Authorization=`Bearer ${n.jwt}`);let a=null!=(i=null==n?void 0:n.query)?i:{};(null==n?void 0:n.redirectTo)&&(a.redirect_to=n.redirectTo);let o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await tE(e,t,r+o,{headers:s,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function tE(e,t,r,n,i,s){let a,o=((e,t,r,n)=>{let i={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==t?void 0:t.headers),i.body=JSON.stringify(n),Object.assign(Object.assign({},i),r))})(t,n,i,s);try{a=await e(r,Object.assign({},o))}catch(e){throw console.error(e),new e0(tx(e),0)}if(a.ok||await t_(a),null==n?void 0:n.noResolveJson)return a;try{return await a.json()}catch(e){await t_(e)}}function tj(e){var t,r,n;let i=null;(n=e).access_token&&n.refresh_token&&n.expires_in&&(i=Object.assign({},e),e.expires_at||(i.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:i,user:null!=(t=e.user)?t:e},error:null}}function tA(e){let t=tj(e);return!t.error&&e.weak_password&&"object"==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,t)=>
21e&&"string"==typeof t,!0)&&(t.data.weak_password=e.weak_password),t}function tT(e){var t;return{data:{user:null!=(t=e.user)?t:e},error:null}}function tO(e){return{data:e,error:null}}function tC(e){let{action_link:t,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s}=e;return{data:{properties:{action_link:t,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s},user:Object.assign({},(0,m.__rest)(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function tN(e){return e}let tI=["global","local","others"];class tP{constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=ts(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),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,t=tI[0]){if(0>tI.indexOf(t))throw Error(`@supabase/auth-js: Parameter scope must be one of ${tI.join(", ")}`);try{return await tS(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(eH(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await tS(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:tT})}catch(e){if(eH(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=(0,m.__rest)(e,["options"]),n=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(n.new_email=null==r?void 0:r.newEmail,delete n.newEmail),await tS(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:tC,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(eH(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await tS(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:tT})}catch(e){if(eH(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,n,i,s,a,o;try{let l={nextPage:null,lastPage:0,total:0},u=await tS(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(i=null==(n=null==e?void 0:e.perPage)?void 0:n.toString())?i:""},xform:tN});if(u.error)throw u.error;let c=await u.json(),d=null!=(s=u.headers.get("x-total-count"))?s:0,h=null!=(o=null==(a=u.headers.get("link"))?void 0:a.split(","))?o:[];return h.length>0&&(h.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(d)),{data:Object.assign(Object.assign({},c),l),error:null}}catch(e){if(eH(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){tv(e);try{return await tS(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:tT})}catch(e){if(eH(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){tv(e);try{return await tS(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:tT})}catch(e){if(eH(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){tv(e);try{return await tS(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:tT})}catch(e){if(eH(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){tv(e.userId);try{let{data:t,error:r}=await tS(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:r}}catch(e){if(eH(e))return{data:null,error:e};throw e}}async _deleteFactor(e){tv(e.userId),tv(e.id);try{return{data:await tS(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(eH(e))return{data:null,error:e};throw e}}async _listOAuthClients(e){var t,r,n,i,s,a,o;try{let l={nextPage:null,lastPage:0,total:0},u=await tS(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(i=null==(n=null==e?void 0:e.perPage)?void 0:n.toString())?i:""},xform:tN});if(u.error)throw u.error;let c=await u.json(),d=null!=(s=u.headers.get("x-total-count"))?s:0,h=null!=(o=null==(a=u.headers.get("link"))?void 0:a.split(","))?o:[];return h.length>
210&&(h.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(d)),{data:Object.assign(Object.assign({},c),l),error:null}}catch(e){if(eH(e))return{data:{clients:[]},error:e};throw e}}async _createOAuthClient(e){try{return await tS(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(eH(e))return{data:null,error:e};throw e}}async _getOAuthClient(e){try{return await tS(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(eH(e))return{data:null,error:e};throw e}}async _deleteOAuthClient(e){try{return await tS(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(eH(e))return{data:null,error:e};throw e}}async _regenerateOAuthClientSecret(e){try{return await tS(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(eH(e))return{data:null,error:e};throw e}}}function tR(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}let tL={debug:!!(globalThis&&ti()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"))};class tD extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class tM extends tD{}async function tU(e,t,r){tL.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let n=new globalThis.AbortController;return t>0&&setTimeout(()=>{n.abort(),tL.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async n=>{if(n){tL.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,n.name);try{return await r()}finally{tL.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,n.name)}}if(0===t)throw tL.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new tM(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(tL.debug)try{let e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null,"  "))}catch(e){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",e)}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 r()}))}function t$(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}class tF extends Error{constructor({message:e,code:t,cause:r,name:n}){var i;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=null!=(i=null!=n?n:r instanceof Error?r.name:void 0)?i:"Unknown Error",this.code=t}}class tB extends tF{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}class tz{createNewAbortSignal(){if(this.controller){let e=Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}let tq=new tz;function tV(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function tH(){var e,t;return!!(tr()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&"function"==typeof(null==(e=null==navigator?void 0:navigator.credentials)?void 0:e.create)&&"function"==typeof(null==(t=null==navigator?void 0:navigator.credentials)?void 0:t.get))}async function tW(e){try{let t=await navigator.credentials.create(e);if(!t)return{data:null,error:new tB("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new tB("Browser returned unexpected credential type",t)};return{data:t,error:null}}catch(t){return{data:null,error:function({error:e,options:t}){var r,n,i;let{publicKey:s}=t;if(!s)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new tF({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if((null==(r=s.authenticatorSelection)?void 0:r.requireResidentKey)===!0)return new tF({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});else if("conditional"===t.mediation&&(null==(n=s.authenticatorSelection)?void 0:n.userVerification)==="required")return new tF({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});else if((null==(i=s.authenticatorSelection)?void 0:i.userVerification)==="required")return new tF({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else if("InvalidStateError"===e.name)return new tF({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});else if("NotAllowedError"===e.name)return new tF({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("NotSupportedError"===e.name)return new tF(0===s.pubKeyCredParams.filter(e=>"public-key"===e.type).length?{message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}:{message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});else if("SecurityError"===e.name){let t=window.location.hostname;if(!tV(t))return new tF({message:`${window.location.hostname}
21 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(s.rp.id!==t)return new tF({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new tF({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new tF({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return new tF({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}({error:t,options:e})}}}async function tK(e){try{let t=await navigator.credentials.get(e);if(!t)return{data:null,error:new tB("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new tB("Browser returned unexpected credential type",t)};return{data:t,error:null}}catch(t){return{data:null,error:function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new tF({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("NotAllowedError"===e.name)return new tF({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("SecurityError"===e.name){let t=window.location.hostname;if(!tV(t))return new tF({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new tF({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new tF({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return new tF({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}({error:t,options:e})}}}let tJ={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"},tG={userVerification:"preferred",hints:["security-key"]};function tY(...e){let t=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),n={};for(let i of e)if(i)for(let e in i){let s=i[e];if(void 0!==s)if(Array.isArray(s))n[e]=s;else if(r(s))n[e]=s;else if(t(s)){let r=n[e];t(r)?n[e]=tY(r,s):n[e]=tY(s)}else n[e]=s}return n}class tX{constructor(e){this.client=e,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(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:r,signal:n},i){try{var s,a,o,l;let{data:u,error:c}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!u)return{data:null,error:c};let d=null!=n?n:tq.createNewAbortSignal();if("create"===u.webauthn.type){let{user:e}=u.webauthn.credential_options.publicKey;e.name||(e.name=`${e.id}:${r}`),e.displayName||(e.displayName=e.name)}switch(u.webauthn.type){case"create":{let t=(s=u.webauthn.credential_options.publicKey,a=null==i?void 0:i.create,tY(tJ,s,a||{})),{data:r,error:n}=await tW({publicKey:t,signal:d});if(r)return{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:r}},error:null};return{data:null,error:n}}case"request":{let t=(o=u.webauthn.credential_options.publicKey,l=null==i?void 0:i.request,tY(tG,o,l||{})),{data:r,error:n}=await tK(Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:t,signal:d}));if(r)return{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:r}},error:null};return{data:null,error:n}}}}catch(e){if(eH(e))return{data:null,error:e};return{data:null,error:new eK("Unexpected error in challenge",e)}}}async _verify({challengeId:e,factorId:t,webauthn:r}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:t="undefined"!=typeof window?window.location.hostname:void 0,rpOrigins:r="undefined"!=typeof window?[window.location.origin]:void 0,signal:n}},i){if(!t)return{data:null,error:new eV("rpId is required for WebAuthn authentication")};try{if(!tH())return{data:null,error:new eK("Browser does not support WebAuthn",null)};let{data:s,error:a}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:r},signal:n},{request:i});if(!s)return{data:null,error:a};let{webauthn:o}=s;return this._verify({factorId:e,challengeId:s.challengeId,webauthn:{type:o.type,rpId:t,rpOrigins:r,credential_response:o.credential_response}})}catch(e){if(eH(e))return{data:null,error:e};return{data:null,error:new eK("Unexpected error in authenticate",e)}}}async _register({friendlyName:e,rpId:t="undefined"!=typeof window?window.location.hostname:void 0,rpOrigins:r="undefined"!=typeof window?[window.location.origin]:void 0,signal:n},i){if(!t)return{data:null,error:new eV("rpId is required for WebAuthn registration")};try{if(!tH())return{data:null,error:new eK("Browser does not support WebAuthn",null)};let{data:s,error:a}=await this._enroll({friendlyName:e});if(!s)return await this.client.mfa.listFactors().then(t=>{var r;return null==(r=t.data)?void 0:r.all.find(t=>"webauthn"===t.factor_type&&t.friendly_name===e&&"unverified"!==t.status)}).then(e=>e?this.client.mfa.unenroll({factorId:null==e?void 0:e.id}):void 0),{data:null,error:a};let{data:o,error:l}=await this._challenge({factorId:s.id,friendlyName:s.friendly_name,webauthn:{rpId:t,rpOrigins:r},signal:n},{create:i});if(!o)return{data:null,error:l};return this._verify({factorId:s.id,challengeId:o.challengeId,webauthn:{rpId:t,rpOrigins:r,type:o.webauthn.type,credential_response:o.webauthn.credential_response}})}catch(e){if(eH(e))return{data:null,error:e};return{data:null,error:new eK("Unexpected error in register",e)}}}}if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!=typeof self&&(self.globalThis=self)}let tZ={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:eF,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function tQ(e,t,r){return await r()}let t0={};class t1{get jwks(){var e,t;return null!=(t=null==(e=t0[this.storageKey])?void 0:e.jwks)?t:{keys:[]}}set jwks(e){t0[this.storageKey]=Object.assign(Object.assign({},t0[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!=(t=null==(e=t0[this.storageKey])?void 0:e.cachedAt)?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){t0[this.storageKey]=Object.assign(Object.assign({},t0[this.storageKey]),{cachedAt:e})}constructor(e){var t,r;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,this.instanceID=t1.nextInstanceID,t1.nextInstanceID+=1,this.instanceID>0&&tr()&&console.warn("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.");let n=Object.assign(Object.assign({},tZ),e);if(this.logDebugMessages=!!n.debug,"function"==typeof n.debug&&(this.logger=n.debug),this.persistSession=n.persistSession,this.storageKey=n.storageKey,this.autoRefreshToken=n.autoRefreshToken,this.admin=new tP({url:n.url,headers:n.headers,fetch:n.fetch}),this.url=n.url,this.headers=n.headers,this.fetch=ts(n.fetch),this.lock=n.lock||tQ,this.detectSessionInUrl=n.detectSessionInUrl,this.flowType=n.flowType,this.hasCustomAuthorizationHeader=n.hasCustomAuthorizationHeader,n.lock?this.lock=n.lock:tr()&&(null==(t=null==globalThis?void 0:globalThis.navigator)?void 0:t.locks)?this.lock=tU:this.lock=tQ,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 tX(this)},this.persistSession?(n.storage?this.storage=n.storage:ti()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=tR(this.memoryStorage)),n.userStorage&&(this.userStorage=n.userStorage)):(this.memoryStorage={},this.storage=tR(this.memoryStorage)),tr()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null==(r=this.broadcastChannel)||r.addEventListener("message",async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${e$}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))()),await this.initializePromise}async _initialize(){var e;try{let t=function(e){let t={},r=new URL(e);if(r.hash&&"#"===r.hash[0])try{new URLSearchParams(r.hash.substring(1)).forEac
21h((e,r)=>{t[r]=e})}catch(e){}return r.searchParams.forEach((e,r)=>{t[r]=e}),t}(window.location.href),r="none";if(this._isImplicitGrantCallback(t)?r="implicit":await this._isPKCECallback(t)&&(r="pkce"),tr()&&this.detectSessionInUrl&&"none"!==r){let{data:n,error:i}=await this._getSessionFromURL(t,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),eH(i)&&"AuthImplicitGrantRedirectError"===i.name){let t=null==(e=i.details)?void 0:e.code;if("identity_already_exists"===t||"identity_not_found"===t||"single_identity_not_deletable"===t)return{error:i}}return await this._removeSession(),{error:i}}let{session:s,redirectType:a}=n;return this._debug("#_initialize()","detected session in URL",s,"redirect type",a),await this._saveSession(s),setTimeout(async()=>{"recovery"===a?await this._notifyAllSubscribers("PASSWORD_RECOVERY",s):await this._notifyAllSubscribers("SIGNED_IN",s)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(eH(e))return{error:e};return{error:new eK("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,n;try{let{data:i,error:s}=await tS(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:null!=(r=null==(t=null==e?void 0:e.options)?void 0:t.data)?r:{},gotrue_meta_security:{captcha_token:null==(n=null==e?void 0:e.options)?void 0:n.captchaToken}},xform:tj});if(s||!i)return{data:{user:null,session:null},error:s};let a=i.session,o=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:o,session:a},error:null}}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}}async signUp(e){var t,r,n;try{let i;if("email"in e){let{email:r,password:n,options:s}=e,a=null,o=null;"pkce"===this.flowType&&([a,o]=await tg(this.storage,this.storageKey)),i=await tS(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==s?void 0:s.emailRedirectTo,body:{email:r,password:n,data:null!=(t=null==s?void 0:s.data)?t:{},gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:a,code_challenge_method:o},xform:tj})}else if("phone"in e){let{phone:t,password:s,options:a}=e;i=await tS(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:s,data:null!=(r=null==a?void 0:a.data)?r:{},channel:null!=(n=null==a?void 0:a.channel)?n:"sms",gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:tj})}else throw new eX("You must provide either an email or phone number and a password");let{data:s,error:a}=i;if(a||!s)return{data:{user:null,session:null},error:a};let o=s.session,l=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if("email"in e){let{email:r,password:n,options:i}=e;t=await tS(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:tA})}else if("phone"in e){let{phone:r,password:n,options:i}=e;t=await tS(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:tA})}else throw new eX("You must provide either an email or phone number and a password");let{data:r,error:n}=t;if(n)return{data:{user:null,session:null},error:n};if(!r||!r.session||!r.user)return{data:{user:null,session:null},error:new eY};return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:n}}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,r,n,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null==(t=e.options)?void 0:t.redirectTo,scopes:null==(r=e.options)?void 0:r.scopes,queryParams:null==(n=e.options)?void 0:n.queryParams,skipBrowserRedirect:null==(i=e.options)?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,r,n,i,s,a,o,l,u,c,d,h;let f,p;if("message"in e)f=e.message,p=e.signature;else{let c,{chain:d,wallet:g,statement:m,options:y}=e;if(tr())if("object"==typeof g)c=g;else{let e=window;if("ethereum"in e&&"object"==typeof e.ethereum&&"request"in e.ethereum&&"function"==typeof e.ethereum.request)c=e.ethereum;else throw 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("object"!=typeof g||!(null==y?void 0:y.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");c=g}let v=new URL(null!=(t=null==y?void 0:y.url)?t:window.location.href),b=await c.request({method:"eth_requestAccounts"}).then(e=>e).catch(()=>{throw Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let w=t$(b[0]),x=null==(r=null==y?void 0:y.signInWithEthereum)?void 0:r.chainId;
21x||(x=parseInt(await c.request({method:"eth_chainId"}),16)),f=function(e){var t;let{chainId:r,domain:n,expirationTime:i,issuedAt:s=new Date,nonce:a,notBefore:o,requestId:l,resources:u,scheme:c,uri:d,version:h}=e;if(!Number.isInteger(r))throw Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!d)throw Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if("1"!==h)throw Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);if(null==(t=e.statement)?void 0:t.includes("\n"))throw Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`);let f=t$(e.address),p=c?`${c}://${n}`:n,g=e.statement?`${e.statement}
22`:"",m=`${p} wants you to sign in with your Ethereum account:
23${f}
24
25${g}`,y=`URI: ${d}
26Version: ${h}
27Chain ID: ${r}${a?`
28Nonce: ${a}`:""}
29Issued At: ${s.toISOString()}`;if(i&&(y+=`
30Expiration Time: ${i.toISOString()}`),o&&(y+=`
31Not Before: ${o.toISOString()}`),l&&(y+=`
32Request ID: ${l}`),u){let e="\nResources:";for(let t of u){if(!t||"string"!=typeof t)throw Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${t}`);e+=`
33- ${t}`}y+=e}return`${m}
34${y}`}({domain:v.host,address:w,statement:m,uri:v.href,version:"1",chainId:x,nonce:null==(n=null==y?void 0:y.signInWithEthereum)?void 0:n.nonce,issuedAt:null!=(s=null==(i=null==y?void 0:y.signInWithEthereum)?void 0:i.issuedAt)?s:new Date,expirationTime:null==(a=null==y?void 0:y.signInWithEthereum)?void 0:a.expirationTime,notBefore:null==(o=null==y?void 0:y.signInWithEthereum)?void 0:o.notBefore,requestId:null==(l=null==y?void 0:y.signInWithEthereum)?void 0:l.requestId,resources:null==(u=null==y?void 0:y.signInWithEthereum)?void 0:u.resources}),p=await c.request({method:"personal_sign",params:[(h=f,"0x"+Array.from(new TextEncoder().encode(h),e=>e.toString(16).padStart(2,"0")).join("")),w]})}try{let{data:t,error:r}=await tS(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},(null==(c=e.options)?void 0:c.captchaToken)?{gotrue_meta_security:{captcha_token:null==(d=e.options)?void 0:d.captchaToken}}:null),xform:tj});if(r)throw r;if(!t||!t.session||!t.user)return{data:{user:null,session:null},error:new eY};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign({},t),error:r}}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSolana(e){var t,r,n,i,s,a,o,l,u,c,d,h;let f,p;if("message"in e)f=e.message,p=e.signature;else{let d,{chain:h,wallet:g,statement:m,options:y}=e;if(tr())if("object"==typeof g)d=g;else{let e=window;if("solana"in e&&"object"==typeof e.solana&&("signIn"in e.solana&&"function"==typeof e.solana.signIn||"signMessage"in e.solana&&"function"==typeof e.solana.signMessage))d=e.solana;else throw 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("object"!=typeof g||!(null==y?void 0:y.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");d=g}let v=new URL(null!=(t=null==y?void 0:y.url)?t:window.location.href);if("signIn"in d&&d.signIn){let e,t=await d.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==y?void 0:y.signInWithSolana),{version:"1",domain:v.host,uri:v.href}),m?{statement:m}:null));if(Array.isArray(t)&&t[0]&&"object"==typeof t[0])e=t[0];else if(t&&"object"==typeof t&&"signedMessage"in t&&"signature"in t)e=t;else throw Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in e&&"signature"in e&&("string"==typeof e.signedMessage||e.signedMessage instanceof Uint8Array)&&e.signature instanceof Uint8Array)f="string"==typeof e.signedMessage?e.signedMessage:new TextDecoder().decode(e.signedMessage),p=e.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in d)||"function"!=typeof d.signMessage||!("publicKey"in d)||"object"!=typeof d||!d.publicKey||!("toBase58"in d.publicKey)||"function"!=typeof d.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");f=[`${v.host} wants you to sign in with your Solana account:`,d.publicKey.toBase58(),...m?["",m,""]:[""],"Version: 1",`URI: ${v.href}`,`Issued At: ${null!=(n=null==(r=null==y?void 0:y.signInWithSolana)?void 0:r.issuedAt)?n:new Date().toISOString()}`,...(null==(i=null==y?void 0:y.signInWithSolana)?void 0:i.notBefore)?[`Not Before: ${y.signInWithSolana.notBefore}`]:[],...(null==(s=null==y?void 0:y.signInWithSolana)?void 0:s.expirationTime)?[`Expiration Time: ${y.signInWithSolana.expirationTime}`]:[],...(null==(a=null==y?void 0:y.signInWithSolana)?void 0:a.chainId)?[`Chain ID: ${y.signInWithSolana.chainId}`]:[],...(null==(o=null==y?void 0:y.signInWithSolana)?void 0:o.nonce)?[`Nonce: ${y.signInWithSolana.nonce}`]:[],...(null==(l=null==y?void 0:y.signInWithSolana)?void 0:l.requestId)?[`Request ID: ${y.signInWithSolana.requestId}`]:[],...(null==(c=null==(u=null==y?void 0:y.signInWithSolana)?void 0:u.resources)?void 0:c.length)?["Resources",...y.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");let e=await d.signMessage(new TextEncoder().encode(f),"utf8");if(!e||!(e instanceof Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=e}}try{let{data:t,error:r}=await tS(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:f,signature:tt(p)},(null==(d=e.options)?void 0:d.captchaToken)?{gotrue_meta_security:{captcha_token:null==(h=e.options)?void 0:h.captchaToken}}:null),xform:tj});if(r)throw r;if(!t||!t.session||!t.user)return{data:{user:null,session:null},error:new eY};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign({},t),error:r}}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}}async _exchangeCodeForSession(e){let t=await to(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(null!=t?t:"").split("/");try{let{data:t,error:i}=await tS(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:tj});if(await tl(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user)return{data:{user:null,session:null,redirectType:null},error:new eY};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign(Object.assign({},t),{redirectType:null!=n?n:null}),error:i}}catch(e){if(eH(e))return{data:{user:null,session:null,redirectType:null},error:e};throw e}}async signInWithIdToken(e){try{let{options:t,provider:r,token:n,access_token:i,nonce:s}=e,{data:a,error:o}=await tS(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:i,nonce:s,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:tj});if(o)return{data:{user:null,session:null},error:o};if(!a||!a.session||!a.user)return{data:{user:null,session:null},error:new eY};return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:a,error:o}}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,r,n,i,s;try{if("email"in e){let{email:n,options:i}=e,s=null,a=null;"pkce"===this.flowType&&([s,a]=await tg(this.storage,this.storageKey));let{error:o}=await tS(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:n,data:null!=(t=null==i?void 0:i.data)?t:{},create_user:null==(r=null==i?void 0:i.shouldCreateUser)||r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:s,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:o}}if("phone"in e){let{phone:t,options:r}=e,{data:a,error:o}=await tS(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!=(n=null==r?void 0:r.data)?n:{},create_user:null==(i=null==r?void 0:r.shouldCreateUser)||i,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!=(s=null==r?void 0:r.channel)?s:"sms"}});return{data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o}}throw new eX("You must provide either an email or phone number.")}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,r;try{let n,i;"options"in e&&(n=null==(t=e.options)?void 0:t.redirectTo,i=null==(r=e.options)?void 0:r.captchaToken);let{data:s,error:a}=await tS(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:tj});if(a)throw a;if(!s)throw Error("An error occurred on token verification.");let o=s.session,l=s.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,r,n;try{let i=null,s=null;return"pkce"===this.flowType&&([i,s]=await tg(this.storage,this.storageKey)),await tS(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:null!=(r=null==(t=e.options)?void 0:t.redirectTo)?r:void 0}),(null==(n=null==e?void 0:e.options)?void 0:n.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:s}),headers:this.headers,xform:tO})}catch(e){if(eH(e))return{data:null,error:e};throw e}}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:t},error:r}=e;if(r)throw r;if(!t)throw new eG;let{error:n}=await tS(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:n}})}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{let t=`${this.url}/resend`;if("email"in e){let{email:r,type:n,options:i}=e,{error:s}=await tS(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},redirectTo:null==i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:s}}if("phone"in e){let{phone:r,type:n,options:i}=e,{data:s,error:a}=await tS(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:null==s?void 0:s.message_id},error:a}}throw new eX("You must provide either an email or phone number and a type")}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){let e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}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 t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",Error().stack);try{let e=null,t=await to(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not val
34id"),await this._removeSession())),!e)return{data:{session:null},error:null};let r=!!e.expires_at&&1e3*e.expires_at-Date.now()<9e4;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){let t=await to(this.userStorage,this.storageKey+"-user");(null==t?void 0:t.user)?e.user=t.user:e.user=tb()}if(this.storage.isServer&&e.user){let t=this.suppressGetSessionWarning;e=new Proxy(e,{get:(e,r,n)=>(t||"user"!==r||(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."),t=!0,this.suppressGetSessionWarning=!0),Reflect.get(e,r,n))})}return{data:{session:e},error:null}}let{data:n,error:i}=await this._callRefreshToken(e.refresh_token);if(i)return{data:{session:null},error:i};return{data:{session:n},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{if(e)return await tS(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:tT});return await this._useSession(async e=>{var t,r,n;let{data:i,error:s}=e;if(s)throw s;return(null==(t=i.session)?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await tS(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!=(n=null==(r=i.session)?void 0:r.access_token)?n:void 0,xform:tT}):{data:{user:null},error:new eG}})}catch(e){if(eH(e))return eH(e)&&"AuthSessionMissingError"===e.name&&(await this._removeSession(),await tl(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:e};throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{let{data:n,error:i}=r;if(i)throw i;if(!n.session)throw new eG;let s=n.session,a=null,o=null;"pkce"===this.flowType&&null!=e.email&&([a,o]=await tg(this.storage,this.storageKey));let{data:l,error:u}=await tS(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:s.access_token,xform:tT});if(u)throw u;return s.user=l.user,await this._saveSession(s),await this._notifyAllSubscribers("USER_UPDATED",s),{data:{user:s.user},error:null}})}catch(e){if(eH(e))return{data:{user:null},error:e};throw e}}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 eG;let t=Date.now()/1e3,r=t,n=!0,i=null,{payload:s}=tc(e.access_token);if(s.exp&&(n=(r=s.exp)<=t),n){let{data:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return{data:{user:null,session:null},error:r};if(!t)return{data:{user:null,session:null},error:null};i=t}else{let{data:n,error:s}=await this._getUser(e.access_token);if(s)throw s;i={access_token:e.access_token,refresh_token:e.refresh_token,user:n.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(e){if(eH(e))return{data:{session:null,user:null},error:e};throw e}}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 t=>{var r;if(!e){let{data:n,error:i}=t;if(i)throw i;e=null!=(r=n.session)?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new eG;let{data:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:n?{data:{user:n.user,session:n},error:null}:{data:{user:null,session:null},error:null}})}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e,t){try{if(!tr())throw new eZ("No browser detected.");
34if(e.error||e.error_description||e.error_code)throw new eZ(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if("pkce"===this.flowType)throw new eQ("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new eZ("Not a valid implicit grant flow url.")}if("pkce"===t){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new eQ("No code detected.");let{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;let n=new URL(window.location.href);return n.searchParams.delete("code"),window.history.replaceState(window.history.state,"",n.toString()),{data:{session:t.session,redirectType:null},error:null}}let{provider_token:r,provider_refresh_token:n,access_token:i,refresh_token:s,expires_in:a,expires_at:o,token_type:l}=e;if(!i||!a||!s||!l)throw new eZ("No session defined in URL");let u=Math.round(Date.now()/1e3),c=parseInt(a),d=u+c;o&&(d=parseInt(o));let h=d-u;1e3*h<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${h}s, should have been closer to ${c}s`);let f=d-c;u-f>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",f,d,u):u-f<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",f,d,u);let{data:p,error:g}=await this._getUser(i);if(g)throw g;let m={provider_token:r,provider_refresh_token:n,access_token:i,expires_in:c,expires_at:d,refresh_token:s,token_type:l,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:m,redirectType:e.type},error:null}}catch(e){if(eH(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await to(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}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 t=>{var r;let{data:n,error:i}=t;if(i)return{error:i};let s=null==(r=n.session)?void 0:r.access_token;if(s){let{error:t}=await this.admin.signOut(s,e);if(t&&!(eH(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status||403===t.status)))return{error:t}}return"others"!==e&&(await this._removeSession(),await tl(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){let t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),r={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,r),(async()=>{await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,n;try{let{data:{session:n},error:i}=t;if(i)throw i;await (null==(r=this.stateChangeEmitters.get(e))?void 0:r.callback("INITIAL_SESSION",n)),this._debug("INITIAL_SESSION","callback id",e,"session",n)}catch(t){await (null==(n=this.stateChangeEmitters.get(e))?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,n=null;"pkce"===this.flowType&&([r,n]=await tg(this.storage,this.storageKey,!0));try{return await tS(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(eH(e))return{data:null,error:e};throw e}}async getUserIdentities(){var e;try{let{data:t,error:r}=await this.getUser();if(r)throw r;return{data:{identities:null!=(e=t.user.identities)?e:[]},error:null}}catch(e){if(eH(e))return{data:null,error:e};throw e}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{let{data:r,error:n}=await this._useSession(async t=>{var r,n,i,s,a;let{data:o,error:l}=t;if(l)throw l;let u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null==(r=e.options)?void 0:r.redirectTo,scopes:null==(n=e.options)?void 0:n.scopes,queryParams:null==(i=e.options)?void 0:i.queryParams,skipBrowserRedirect:!0});return await tS(this.fetch,"GET",u,{headers:this.headers,jwt:null!=(a=null==(s=o.session)?void 0:s.access_token)?a:void 0})});if(n)throw n;return!tr()||(null==(t=e.options)?void 0:t.skipBrowserRedirect)||window.location.assign(null==r?void 0:r.url),{data:{provider:e.provider,url:null==r?void 0:r.url},error:null}}catch(t){if(eH(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var r;try{let{error:n,data:{session:i}}=t;if(n)throw n;let{options:s,provider:a,token:o,access_token:l,nonce:u}=e,{data:c,error:d}=await tS(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!=(r=null==i?void 0:i.access_token)?r:void 0,body:{provider:a,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:tj});if(d)return{data:{user:null,session:null},error:d};if(!c||!c.session||!c.user)return{data:{user:null,session:null},error:new eY};return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("USER_UPDATED",c.session)),{data:c,error:d}}catch(e){if(eH(e))return{data:{user:null,session:null},error:e};throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,n;let{data:i,error:s}=t;if(s)throw s;
34return await tS(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!=(n=null==(r=i.session)?void 0:r.access_token)?n:void 0})})}catch(e){if(eH(e))return{data:null,error:e};throw e}}async _refreshAccessToken(e){let t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{var r,n;let i=Date.now();return await (r=async r=>(r>0&&await td(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await tS(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:tj})),n=(e,t)=>{let r=200*Math.pow(2,e);return t&&e1(t)&&Date.now()+r-i<3e4},new Promise((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{let t=await r(i);if(!n(i,null,t))return void e(t)}catch(e){if(!n(i,e))return void t(e)}})()}))}catch(e){if(this._debug(t,"error",e),eH(e))return{data:{session:null,user:null},error:e};throw e}finally{this._debug(t,"end")}}_isValidSession(e){return"object"==typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){let r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),tr()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let n=await to(this.storage,this.storageKey);if(n&&this.userStorage){let t=await to(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!t&&(t={user:n.user},await ta(this.userStorage,this.storageKey+"-user",t)),n.user=null!=(e=null==t?void 0:t.user)?e:tb()}else if(n&&!n.user&&!n.user){let e=await to(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(n.user=e.user,await tl(this.storage,this.storageKey+"-user"),await ta(this.storage,this.storageKey,n)):n.user=tb()}if(this._debug(r,"session from storage",n),!this._isValidSession(n)){this._debug(r,"session is not valid"),null!==n&&await this._removeSession();return}let i=(null!=(t=n.expires_at)?t:1/0)*1e3-Date.now()<9e4;if(this._debug(r,`session has${i?"":" not"} expired with margin of 90000s`),i){if(this.autoRefreshToken&&n.refresh_token){let{error:e}=await this._callRefreshToken(n.refresh_token);e&&(console.error(e),e1(e)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else if(n.user&&!0===n.user.__isUserNotAvailableProxy)try{let{data:e,error:t}=await this._getUser(n.access_token);!t&&(null==e?void 0:e.user)?(n.user=e.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(e){console.error("Error getting user data:",e),this._debug(r,"error getting user data, skipping SIGNED_IN notification",e)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(e){this._debug(r,"error",e),console.error(e);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new eG;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new tu;let{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new eG;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);let n={data:t.session,error:null};return this.refreshingDeferred.resolve(n),n}catch(e){if(this._debug(n,"error",e),eH(e)){let r={data:null,error:e};return e1(e)||await this._removeSession(),null==(t=this.refreshingDeferred)||t.resolve(r),r}throw null==(r=this.refreshingDeferred)||r.reject(e),e}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,t,r=!0){let n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let n=[],i=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){n.push(e)}});if(await Promise.all(i),n.length>0){for(let e=0;e<n.length;e+=1)console.error(n[e]);throw n[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let t=Object.assign({},e),r=t.user&&!0===t.user.__isUserNotAvailableProxy;if(this.userStorage){!r&&t.user&&await ta(this.userStorage,this.storageKey+"-user",{user:t.user});let e=Object.assign({},t);delete e.user;let n=tw(e);await ta(this.storage,this.storageKey,n)}else{let e=tw(t);await ta(this.storage,this.storageKey,e)}}async _removeSession(){this._debug("#_removeSession()"),await tl(this.storage,this.storageKey),await tl(this.storage,this.storageKey+"-code-verifier"),await tl(this.storage,this.storageKey+"-user"),this.userStorage&&await tl(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&tr()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
34catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),3e4);this.autoRefreshTicker=e,e&&"object"==typeof e&&"function"==typeof e.unref?e.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&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 t=>{let{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");let n=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),n<=3&&await this._callRefreshToken(r.refresh_token)})}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof tD)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!tr()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if("visible"!==document.visibilityState)return void this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){let n=[`provider=${encodeURIComponent(t)}`];if((null==r?void 0:r.redirectTo)&&n.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),(null==r?void 0:r.scopes)&&n.push(`scopes=${encodeURIComponent(r.scopes)}`),"pkce"===this.flowType){let[e,t]=await tg(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});n.push(r.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);n.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&n.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:n,error:i}=t;return i?{data:null,error:i}:await tS(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token})})}catch(e){if(eH(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,n;let{data:i,error:s}=t;if(s)return{data:null,error:s};let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:"totp"===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await tS(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:null==(r=null==i?void 0:i.session)?void 0:r.access_token});return l?{data:null,error:l}:("totp"===e.factorType&&"totp"===o.type&&(null==(n=null==o?void 0:o.totp)?void 0:n.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(e){if(eH(e))return{data:null,error:e};throw e}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r,n,i;let{data:s,error:a}=t;if(a)return{data:null,error:a};let o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?(n=e.webauthn.credential_response,"toJSON"in n&&"function"==typeof n.toJSON?n.toJSON():{id:n.id,rawId:n.id,response:{attestationObject:tt(new Uint8Array(n.response.attestationObject)),clientDataJSON:tt(new Uint8Array(n.response.clientDataJSON))},type:"public-key",clientExtensionResults:n.getClientExtensionResults(),authenticatorAttachment:null!=(i=n.authenticatorAttachment)?i:void 0}):function(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();let r=e.getClientExtensionResults(),n=e.response;
34return{id:e.id,rawId:e.id,response:{authenticatorData:tt(new Uint8Array(n.authenticatorData)),clientDataJSON:tt(new Uint8Array(n.clientDataJSON)),signature:tt(new Uint8Array(n.signature)),userHandle:n.userHandle?tt(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:null!=(t=e.authenticatorAttachment)?t:void 0}}(e.webauthn.credential_response)})}:{code:e.code}),{data:l,error:u}=await tS(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:null==(r=null==s?void 0:s.session)?void 0:r.access_token});return u?{data:null,error:u}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),{data:l,error:u})})}catch(e){if(eH(e))return{data:null,error:e};throw e}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;let{data:n,error:i}=t;if(i)return{data:null,error:i};let s=await tS(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});if(s.error)return s;let{data:a}=s;if("webauthn"!==a.type)return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:function(e){if(!e)throw Error("Credential creation options are required");if("undefined"!=typeof PublicKeyCredential&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(e);let{challenge:t,user:r,excludeCredentials:n}=e,i=(0,m.__rest)(e,["challenge","user","excludeCredentials"]),s=te(t).buffer,a=Object.assign(Object.assign({},r),{id:te(r.id).buffer}),o=Object.assign(Object.assign({},i),{challenge:s,user:a});if(n&&n.length>0){o.excludeCredentials=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e];o.excludeCredentials[e]=Object.assign(Object.assign({},t),{id:te(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return o}(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:function(e){if(!e)throw Error("Credential request options are required");if("undefined"!=typeof PublicKeyCredential&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseRequestOptionsFromJSON)return PublicKeyCredential.parseRequestOptionsFromJSON(e);let{challenge:t,allowCredentials:r}=e,n=(0,m.__rest)(e,["challenge","allowCredentials"]),i=te(t).buffer,s=Object.assign(Object.assign({},n),{challenge:i});if(r&&r.length>0){s.allowCredentials=Array(r.length);for(let e=0;e<r.length;e++){let t=r[e];s.allowCredentials[e]=Object.assign(Object.assign({},t),{id:te(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return s}(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if(eH(e))return{data:null,error:e};throw e}})}async _challengeAndVerify(e){let{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;let{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};let n={all:[],phone:[],totp:[],webauthn:[]};for(let r of null!=(e=null==t?void 0:t.factors)?e:[])n.all.push(r),"verified"===r.status&&n[r.factor_type].push(r);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,r;let{data:{session:n},error:i}=e;if(i)return{data:null,error:i};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:s}=tc(n.access_token),a=null;s.aal&&(a=s.aal);let o=a;return(null!=(r=null==(t=n.user.factors)?void 0:t.filter(e=>"verified"===e.status))?r:[]).length>0&&(o="aal2"),{data:{currentLevel:a,nextLevel:o,currentAuthenticationMethods:s.amr||[]},error:null}}))}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(t=>t.kid===e);if(r)return r;let n=Date.now();if((r=this.jwks.keys.find(t=>t.kid===e))&&this.jwks_cached_at+6e5>n)return r;let{data:i,error:s}=await tS(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(s)throw s;return i.keys&&0!==i.keys.length&&(this.jwks=i,this.jwks_cached_at=n,r=i.keys.find(t=>t.kid===e))?r:null}async getClaims(e,t={}){try{let r=e;if(!r){let{data:e,error:t}
34=await this.getSession();if(t||!e.session)return{data:null,error:t};r=e.session.access_token}let{header:n,payload:i,signature:s,raw:{header:a,payload:o}}=tc(r);(null==t?void 0:t.allowExpired)||function(e){if(!e)throw Error("Missing exp claim");if(e<=Math.floor(Date.now()/1e3))throw Error("JWT has expired")}(i.exp);let l=!n.alg||n.alg.startsWith("HS")||!n.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(n.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks);if(!l){let{error:e}=await this.getUser(r);if(e)throw e;return{data:{claims:i,header:n,signature:s},error:null}}let u=function(e){switch(e){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 Error("Invalid alg claim")}}(n.alg),c=await crypto.subtle.importKey("jwk",l,u,!0,["verify"]);if(!await crypto.subtle.verify(u,c,s,function(e){let t=[];return!function(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){let t=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(n,t)}}(e,e=>t.push(e)),new Uint8Array(t)}(`${a}.${o}`)))throw new e4("Invalid JWT signature");return{data:{claims:i,header:n,signature:s},error:null}}catch(e){if(eH(e))return{data:null,error:e};throw e}}}t1.nextInstanceID=0;let t2=t1;class t4 extends t2{constructor(e){super(e)}}class t3{constructor(e,t,r){var n,i,s;this.supabaseUrl=e,this.supabaseKey=t;let a=function(e){let t=null==e?void 0:e.trim();if(!t)throw Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(t.endsWith("/")?t:t+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}(e);if(!t)throw 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 o=`sb-${a.hostname.split(".")[0]}-auth-token`,l=function(e,t){var r,n;let{db:i,auth:s,realtime:a,global:o}=e,{db:l,auth:u,realtime:c,global:d}=t,h={db:Object.assign(Object.assign({},l),i),auth:Object.assign(Object.assign({},u),s),realtime:Object.assign(Object.assign({},c),a),storage:{},global:Object.assign(Object.assign(Object.assign({},d),o),{headers:Object.assign(Object.assign({},null!=(r=null==d?void 0:d.headers)?r:{}),null!=(n=null==o?void 0:o.headers)?n:{})}),accessToken:async()=>""};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}(null!=r?r:{},{db:eL,realtime:eM,auth:Object.assign(Object.assign({},eD),{storageKey:o}),global:eR});this.storageKey=null!=(n=l.auth.storageKey)?n:"",this.headers=null!=(i=l.global.headers)?i:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!=(s=l.auth)?s:{},this.headers,l.global.fetch),this.fetch=((e,t,r)=>{let n=(e=>{let t;return t=e||("undefined"==typeof fetch?eU.default:fetch),(...e)=>t(...e)})(r),i="undefined"==typeof Headers?eU.Headers:Headers;return async(r,s)=>{var a;let o=null!=(a=await t())?a:e,l=new i(null==s?void 0:s.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${o}`),n(r,Object.assign(Object.assign({},s),{headers:l}))}})(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.rest=new k(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new eI(this.storageUrl.href,this.headers,this.fetch,null==r?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new x(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}
34channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t;if(this.accessToken)return await this.accessToken();let{data:r}=await this.auth.getSession();return null!=(t=null==(e=r.session)?void 0:e.access_token)?t:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:i,storageKey:s,flowType:a,lock:o,debug:l},u,c){let d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new t4({url:this.authUrl.href,headers:Object.assign(Object.assign({},d),u),storageKey:s,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:i,flowType:a,lock:o,debug:l,fetch:c,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new G(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,r){("TOKEN_REFRESHED"===e||"SIGNED_IN"===e)&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}}var t5=r(65364);(function(){if("undefined"!=typeof window||void 0===t5)return!1;let e=t5.version;if(null==e)return!1;let t=e.match(/^v(\d+)\./);return!!t&&18>=parseInt(t[1],10)})()&&console.warn(`⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217`);let t6="https://oaiypqxpvqgrtcaxdvac.supabase.co",t8="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9haXlwcXhwdnFncnRjYXhkdmFjIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzA5MDEzNzIsImV4cCI6MjA0NjQ3NzM3Mn0.GPlSRnWlLoacOOyJja-hKaXDs5pgHU1Xlbg1EwkTMiI";if(!t6||!t8)throw Error("Missing Supabase environment variables");let t7=new t3(t6,t8,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0}})},14e3:(e,t,r)=>{e.exports=r(95092)},14136:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]])},14159:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ServerInsertedHTMLContext:function(){return i},useServerInsertedHTML:function(){return s}});let n=r(88365)._(r(14232)),i=n.default.createContext(null);function s(e){let t=(0,n.useContext)(i);t&&t(e)}},15092:(e,t,r)=>{"use strict";r.d(t,{s:()=>c});var n=r(14232),i=r(18334),s=r(38514),a=r(16317),o=r(13415);let l={loading:!1,agencyManaged:!1,surfaces:{...s.tn},providerName:null,logoUrl:null},u="wl-surfaces:";function c(){var e;let{activeWorkspace:t}=(0,a.h)(),r=null!=(e=null==t?void 0:t.id)?e:null,[c,d]=(0,n.useState)({...l,loading:!0});return(0,n.useEffect)(()=>{let e=!1;if(!r)return void d(l);let t=function(e){try{var t,r,n;let i=window.sessionStorage.getItem("".concat(u).concat(e));if(!i)return null;let a=JSON.parse(i);return{loading:!0,agencyManaged:!!a.agencyManaged,surfaces:{...s.tn,...null!=(t=a.surfaces)?t:{}},providerName:null!=(r=a.providerName)?r:null,logoUrl:null!=(n=a.logoUrl)?n:null}}catch(e){return null}}(r);return t?d(t):d(e=>({...e,loading:!0})),(async()=>{try{var t,n,a,c;let{data:i}=await o.N.auth.getSession(),h=null==(t=i.session)?void 0:t.access_token;if(!h){e||d(l);return}
34let f=await fetch("/api/agency/surfaces?workspaceId=".concat(encodeURIComponent(r)),{headers:{Authorization:"Bearer ".concat(h)}});if(!f.ok)throw Error("surfaces ".concat(f.status));let p=await f.json(),g={loading:!1,agencyManaged:!!p.agencyManaged,surfaces:{...s.tn,...null!=(n=p.surfaces)?n:{}},providerName:null!=(a=p.providerName)?a:null,logoUrl:null!=(c=p.logoUrl)?c:null};try{let{loading:e,...t}=g;window.sessionStorage.setItem("".concat(u).concat(r),JSON.stringify(t))}catch(e){}e||d(g)}catch(t){i.Cp(t,{tags:{feature:"white-label-surfaces"}}),e||d(l)}})(),()=>{e=!0}},[r]),c}},15997:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});let n=r(4902).__importDefault(r(67711));class i{constructor(e,{headers:t={},schema:r,fetch:n}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n}select(e,t){let{head:r=!1,count:i}=null!=t?t:{},s=!1,a=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!s?"":('"'===e&&(s=!s),e)).join("");return this.url.searchParams.set("select",a),i&&this.headers.append("Prefer",`count=${i}`),new n.default({method:r?"HEAD":"GET",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:r=!0}={}){var i;if(t&&this.headers.append("Prefer",`count=${t}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new n.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(i=this.fetch)?i:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:i,defaultToNull:s=!0}={}){var a;if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&this.url.searchParams.set("on_conflict",t),i&&this.headers.append("Prefer",`count=${i}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new n.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(a=this.fetch)?a:fetch})}update(e,{count:t}={}){var r;return t&&this.headers.append("Prefer",`count=${t}`),new n.default({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(r=this.fetch)?r:fetch})}delete({count:e}={}){var t;return e&&this.headers.append("Prefer",`count=${e}`),new n.default({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:null!=(t=this.fetch)?t:fetch})}}t.default=i},16317:(e,t,r)=>{"use strict";r.d(t,{$:()=>l,h:()=>u});var n=r(37876),i=r(14232),s=r(55892),a=r(60506);let o=(0,i.createContext)(void 0);function l(e){let{children:t}=e,{user:r}=(0,s.A)(),[l,u]=(0,i.useState)([]),[c,d]=(0,i.useState)(null),[h,f]=(0,i.useState)(!0),[p,g]=(0,i.useState)(null),[m,y]=(0,i.useState)(0),v=(0,i.useRef)(!1),b=async()=>{if(!r)return;let e=Date.now();if(!(e-m<1e3)){y(e);try{g(null);let e=await a.FS(null==r?void 0:r.id);if(u(t=>JSON.stringify(t)!==JSON.stringify(e)?e:t),c){let t=e.find(e=>e.id===c.id);t&&d(t)}c||!(e.length>0)||v.current||(d(e[0]),v.current=!0)}catch(e){g(e instanceof Error?e.message:"Failed to load workspaces")}finally{f(!1)}}},w=async(e,t)=>{if(!r)throw Error("User must be logged in to create a workspace");try{f(!0),g(null);let n=await a.sK(e,t,r.id);u(e=>[...e,n]),d(n)}catch(e){throw g(e instanceof Error?e.message:"Failed to create workspace"),e}finally{f(!1)}};return(0,i.useEffect)(()=>{r||(u([]),d(null))},[r]),(0,n.jsx)(o.Provider,{value:{workspaces:l,activeWorkspace:c,setActiveWorkspace:d,isLoading:h,error:p,refreshWorkspaces:b,createWorkspace:w},children:t})}function u(){let e=(0,i.useContext)(o);if(void 0===e)throw Error("useWorkspace must be used within a WorkspaceProvider");return e}},16617:(e,t,r)=>{"use strict";r.d(t,{D:()=>o,N:()=>a});var n=r(37876),i=r(14232);let s=(0,i.createContext)(void 0);function a(e){let{children:t}=e,[r,a]=(0,i.useState)("dark");(0,i.useEffect)(()=>{try{let e=localStorage.getItem("theme");e&&a(e)}catch(e){}},[]);let o=e=>{if("undefined"!=typeof document){let t=document.getElementById("theme-favicon"),r=document.getElementById("intellimate_logo");t&&(t.href="dark"===e?"/intellimate-ai-intelligent-automation-platform-favicon-dark.png":"/intellimate-ai-intelligent-automation-platform-favicon-light.png"),r&&(r.src="dark"===e?"/intellimate-ai-intelligent-automation-platform-logo-dark.png":"/intellimate-ai-intelligent-automation-platform-logo-light.png")}};return(0,i.useEffect)(()=>{try{localStorage.setItem("theme",r)}catch(e){}"dark"===r?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),o(r)},[r]),(0,n.jsx)(s.Provider,{value:{theme:r,toggleTheme:()=>{a(e=>"light"===e?"dark":"light")}
34,updateMainFavnLogos:o},children:t})}function o(){let e=(0,i.useContext)(s);if(void 0===e)throw Error("useTheme must be used within a ThemeProvider");return e}},17933:(e,t,r)=>{"use strict";function n(e){return{userId:e.user_id,role:e.role,permissions:[]}}function i(e){var t;return{id:e.id,name:e.name,companyName:e.company_name,assessmentStatus:"pending",members:(null!=(t=e.workspace_members)?t:[]).map(n)}}function s(e){var t,r,n;return{id:e.id,title:e.title,category:e.category,description:e.description,details:null!=(t=e.details)?t:void 0,messages:null!=(r=e.messages)?r:[],aiAnalysis:null!=(n=e.ai_analysis)?n:void 0,status:e.status,createdAt:e.created_at,updatedAt:e.updated_at,createdBy:e.created_by,workspaceId:e.workspace_id}}function a(e){let t={};return void 0!==e.title&&(t.title=e.title),void 0!==e.description&&(t.description=e.description),void 0!==e.category&&(t.category=e.category),void 0!==e.status&&(t.status=e.status),void 0!==e.details&&(t.details=e.details),void 0!==e.messages&&(t.messages=e.messages),void 0!==e.aiAnalysis&&(t.ai_analysis=e.aiAnalysis),t}function o(e){var t,r,n;return{id:e.id,userId:e.user_id,tier:e.tier,status:e.status,currentPeriodStart:null!=(t=e.current_period_start)?t:"",currentPeriodEnd:null!=(r=e.current_period_end)?r:"",cancelAtPeriodEnd:null!=(n=e.cancel_at_period_end)&&n}}r.d(t,{$A:()=>i,Hu:()=>s,Kj:()=>a,hb:()=>o})},17963:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(14232);let i=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let a=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:u="",children:c,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:r,strokeWidth:l?24*Number(o)/Number(a):o,className:i("lucide",u),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(c)?c:[c]])}),o=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:o,...l}=r;return(0,n.createElement)(a,{ref:s,iconNode:t,className:i("lucide-".concat(e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),o),...l})});return r.displayName="".concat(e),r}},18444:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unstable_rethrow",{enumerable:!0,get:function(){return n}});let n=r(34318).unstable_rethrow;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},21086:(e,t,r)=>{"use strict";r.d(t,{Ic:()=>k,KB:()=>f,u9:()=>x,wn:()=>h});var n=r(14232),i=r(18334),s=r(13415),a=r(55892),o=r(28330);let l=s.N;async function u(e){let{includeDrafts:t}=e,r=l.from("changelog_entries").select("*").order("published_at",{ascending:!1});t||(r=r.eq("is_published",!0));let{data:n,error:i}=await r;if(i)throw Error(i.message);return null!=n?n:[]}async function c(e){let{data:t,error:r}=await l.from("changelog_reads").select("user_id, last_seen_entry_id, last_seen_at").eq("user_id",e).maybeSingle();if(r)throw Error(r.message);return null!=t?t:null}async function d(e,t){let r=new Date().toISOString(),{error:n}=await l.from("changelog_reads").upsert({user_id:e,last_seen_entry_id:t,last_seen_at:r,updated_at:r},{onConflict:"user_id"});if(n)throw Error(n.message)}async function h(e,t){var r,n,i,s,a,o,u,c;let d=null==(r=e.title)?void 0:r.trim();if(!d)throw Error("Title is required");let h={title:d,body:null!=(a=e.body)?a:"",type_tags:null!=(o=e.type_tags)?o:[],audience:(null==(n=e.audience)?void 0:n.length)?e.audience:["everyone"],area:(null==(i=e.area)?void 0:i.trim())||null,media_url:(null==(s=e.media_url)?void 0:s.trim())||null,is_published:null==(u=e.is_published)||u,published_at:null!=(c=e.published_at)?c:new Date().toISOString()};if(e.id){let{error:t}=await l.from("changelog_entries").update(h).eq("id",e.id);if(t)throw Error(t.message)}else{let{error:e}=await l.from("changelog_entries").insert({...h,created_by:t});if(e)throw Error(e.message)}}async function f(e){let{error:t}=await l.from("changelog_entries").delete().eq("id",e);if(t)throw Error(t.message)}let p={userId:null,entries:[],readState:null,loading:!0},g=p,m=new Set,y=null;function v(e){g={...g,...e}
34,m.forEach(e=>e())}async function b(e){v({userId:e,loading:!0});try{let[t,r]=await Promise.all([u({includeDrafts:!0}),c(e)]);if(g.userId!==e)return;v({entries:t,readState:r,loading:!1})}catch(t){i.Cp(t,{tags:{feature:"whats-new"}}),g.userId===e&&v({loading:!1})}}function w(e){return y=b(e).finally(()=>{y=null})}function x(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{user:r}=(0,a.A)(),s=null!=(e=null==r?void 0:r.id)?e:null,o=!!t.includeDrafts,[,l]=(0,n.useState)(0);(0,n.useEffect)(()=>{let e=()=>l(e=>e+1);return m.add(e),s&&(g.userId===s&&(y||!g.loading)?null!=y||Promise.resolve():w(s)),()=>{m.delete(e)}},[s]);let u=(0,n.useCallback)(async()=>{s&&await w(s)},[s]),c=g.userId===s?g:{...p,loading:!!s},{hasUnread:h,latestId:f}=function(e,t){var r,n;let i=null!=(r=e.find(e=>e.is_published))?r:null,s=(null==t?void 0:t.last_seen_at)?Date.parse(t.last_seen_at):0;return{hasUnread:!!i&&Date.parse(i.published_at)>s,latestId:null!=(n=null==i?void 0:i.id)?n:null}}(c.entries,c.readState),b=o?c.entries:c.entries.filter(e=>e.is_published),x=(0,n.useCallback)(async()=>{if(s&&f){v({readState:{user_id:s,last_seen_entry_id:f,last_seen_at:new Date().toISOString()}});try{await d(s,f)}catch(e){i.Cp(e,{tags:{feature:"whats-new"}})}}},[s,f]);return{entries:b,loading:c.loading,hasUnread:h,latestId:f,markSeen:x,refresh:u}}function k(){let{user:e}=(0,a.A)();return(0,o.j)(null==e?void 0:e.role)}},21174:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},22017:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]])},25527:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]])},28249:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},28330:(e,t,r)=>{"use strict";r.d(t,{j:()=>i});let n=["iai_admin","iai_support","iai_marketing"];function i(e){return!!e&&n.includes(e)}},28419:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},29053:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},32446:(e,t,r)=>{"use strict";r.d(t,{N9:()=>I,GP:()=>C,oR:()=>_});var n=r(14232);let i=function(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=function e(t){var r,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var s=t.length;for(r=0;r<s;r++)t[r]&&(n=e(t[r]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}(e))&&(n&&(n+=" "),n+=t);return n},s=e=>"number"==typeof e&&!isNaN(e),a=e=>"string"==typeof e||"function"==typeof e?e:null,o=e=>(0,n.isValidElement)(e)||"string"==typeof e||"function"==typeof e||s(e);function l(e){let{enter:t,exit:r,appendPosition:i=!1,collapse:s=!0,collapseDuration:a=300}=e;return function(e){let{children:o,position:l,preventExitTransition:u,done:c,nodeRef:d,isIn:h,playToast:f}=e,p=i?`${t}--${l}`:t,g=i?`${r}--${l}`:r,m=(0,n.useRef)(0);return(0,n.useLayoutEffect)(()=>{let e=d.current,t=p.split(" "),r=n=>{n.target===d.current&&(f(),e.removeEventListener("animationend",r),e.removeEventListener("animationcancel",r),0===m.current&&"animationcancel"!==n.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",r),e.addEventListener("animationcancel",r)},[]),(0,n.useEffect)(()=>{let e=d.current,t=()=>{e.removeEventListener("animationend",t),s?function(e,t,r){void 0===r&&(r=300);let{scrollHeight:n,style:i}=e;requestAnimationFrame(()=>{i.minHeight="initial",i.height=n+"px",i.transition=`all ${r}ms`,requestAnimationFrame(()=>{i.height="0",i.padding="0",i.margin="0",setTimeout(t,r)})})}(e,c,a):c()};h||(u?t():(m.current=1,e.className+=` ${g}`,e.addEventListener("animationend",t)))},[h]),n.createElement(n.Fragment,null,o)}}function u(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}let c=new Map,d=[],h=new Set,f=e=>
34h.forEach(t=>t(e));function p(e,t){var r;if(t)return!(null==(r=c.get(t))||!r.isToastActive(e));let n=!1;return c.forEach(t=>{t.isToastActive(e)&&(n=!0)}),n}function g(e,t){o(e)&&(c.size>0||d.push({content:e,options:t}),c.forEach(r=>{r.buildToast(e,t)}))}function m(e,t){c.forEach(r=>{null!=t&&null!=t&&t.containerId?(null==t?void 0:t.containerId)===r.id&&r.toggle(e,null==t?void 0:t.id):r.toggle(e,null==t?void 0:t.id)})}function y(e){let{delay:t,isRunning:r,closeToast:s,type:a="default",hide:o,className:l,style:u,controlledProgress:c,progress:d,rtl:h,isIn:f,theme:p}=e,g=o||c&&0===d,m={...u,animationDuration:`${t}ms`,animationPlayState:r?"running":"paused"};c&&(m.transform=`scaleX(${d})`);let y=i("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${p}`,`Toastify__progress-bar--${a}`,{"Toastify__progress-bar--rtl":h}),v="function"==typeof l?l({rtl:h,type:a,defaultClassName:y}):i(y,l);return n.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":g},n.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${p} Toastify__progress-bar--${a}`}),n.createElement("div",{role:"progressbar","aria-hidden":g?"true":"false","aria-label":"notification timer",className:v,style:m,...{[c&&d>=1?"onTransitionEnd":"onAnimationEnd"]:c&&d<1?null:()=>{f&&s()}}}))}let v=1,b=()=>""+v++;function w(e,t){return g(e,t),t.toastId}function x(e,t){var r;return{...t,type:t&&t.type||e,toastId:(r=t)&&("string"==typeof r.toastId||s(r.toastId))?r.toastId:b()}}function k(e){return(t,r)=>w(t,x(e,r))}function _(e,t){return w(e,x("default",t))}_.loading=(e,t)=>
34w(e,x("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),_.promise=function(e,t,r){let n,{pending:i,error:s,success:a}=t;i&&(n="string"==typeof i?_.loading(i,r):_.loading(i.render,{...r,...i}));let o={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(e,t,i)=>{if(null==t)return void _.dismiss(n);let s={type:e,...o,...r,data:i},a="string"==typeof t?{render:t}:t;return n?_.update(n,{...s,...a}):_(a.render,{...s,...a}),i},u="function"==typeof e?e():e;return u.then(e=>l("success",a,e)).catch(e=>l("error",s,e)),u},_.success=k("success"),_.info=k("info"),_.error=k("error"),_.warning=k("warning"),_.warn=_.warning,_.dark=(e,t)=>w(e,x("default",{theme:"dark",...t})),_.dismiss=function(e){var t;if(c.size>0){if(null==e||"string"==typeof(t=e)||s(t))c.forEach(t=>{t.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){let t=c.get(e.containerId);t?t.removeToast(e.id):c.forEach(t=>{t.removeToast(e.id)})}}else d=d.filter(t=>null!=e&&t.options.toastId!==e)},_.clearWaitingQueue=function(e){void 0===e&&(e={}),c.forEach(t=>{!t.props.limit||e.containerId&&t.id!==e.containerId||t.clearQueue()})},_.isActive=p,_.update=function(e,t){void 0===t&&(t={});let r=((e,t)=>{var r;let{containerId:n}=t;return null==(r=c.get(n||1))?void 0:r.toasts.get(e)})(e,t);if(r){let{props:n,content:i}=r,s={delay:100,...n,...t,toastId:t.toastId||e,updateId:b()};s.toastId!==e&&(s.staleId=e);let a=s.render||i;delete s.render,w(a,s)}},_.done=e=>{_.update(e,{progress:1})},_.onChange=function(e){return h.add(e),()=>{h.delete(e)}},_.play=e=>m(!0,e),_.pause=e=>m(!1,e);let S="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,E=e=>{let{theme:t,type:r,isLoading:i,...s}=e;return n.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===t?"currentColor":`var(--toastify-icon-color-${r})`,...s})},j={info:function(e){return n.createElement(E,{...e},n.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return n.createElement(E,{...e},n.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return n.createElement(E,{...e},n.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return n.createElement(E,{...e},n.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return n.createElement("div",{className:"Toastify__spinner"})}},A=e=>{let{isRunning:t,preventExitTransition:r,toastRef:s,eventHandlers:a,playToast:o}=function(e){var t,r;let[i,s]=(0,n.useState)(!1),[a,o]=(0,n.useState)(!1),l=(0,n.useRef)(null),u=(0,n.useRef)({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:d,pauseOnHover:h,closeToast:f,onClick:p,closeOnClick:g}=e;function m(){s(!0)}function y(){s(!1)}function v(t){let r=l.current;u.canDrag&&r&&(u.didMove=!0,i&&y(),u.delta="x"===e.draggableDirection?t.clientX-u.start:t.clientY-u.start,u.start!==t.clientX&&(u.canCloseOnClick=!1),r.style.transform=`translate3d(${"x"===e.draggableDirection?`${u.delta}px, var(--y)`:`0, calc(${u.delta}px + var(--y))`},0)`,r.style.opacity=""+(1-Math.abs(u.delta/u.removalDistance)))}function b(){document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",b);let t=l.current;if(u.canDrag&&u.didMove&&t){if(u.canDrag=!1,Math.abs(u.delta)>u.removalDistance)return o(!0),e.closeToast(),void e.collapseAll();t.style.transition="transform 0.2s, opacity 0.2s",t.style.removeProperty("transform"),t.style.removeProperty("opacity")}}null==(r=c.get((t={id:e.toastId,containerId:e.containerId,fn:s}).containerId||1))||r.setToggle(t.id,t.fn),(0,n.useEffect)(()=>
34{if(e.pauseOnFocusLoss)return document.hasFocus()||y(),window.addEventListener("focus",m),window.addEventListener("blur",y),()=>{window.removeEventListener("focus",m),window.removeEventListener("blur",y)}},[e.pauseOnFocusLoss]);let w={onPointerDown:function(t){if(!0===e.draggable||e.draggable===t.pointerType){u.didMove=!1,document.addEventListener("pointermove",v),document.addEventListener("pointerup",b);let r=l.current;u.canCloseOnClick=!0,u.canDrag=!0,r.style.transition="none","x"===e.draggableDirection?(u.start=t.clientX,u.removalDistance=r.offsetWidth*(e.draggablePercent/100)):(u.start=t.clientY,u.removalDistance=r.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent)/100)}},onPointerUp:function(t){let{top:r,bottom:n,left:i,right:s}=l.current.getBoundingClientRect();"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&t.clientX>=i&&t.clientX<=s&&t.clientY>=r&&t.clientY<=n?y():m()}};return d&&h&&(w.onMouseEnter=y,e.stacked||(w.onMouseLeave=m)),g&&(w.onClick=e=>{p&&p(e),u.canCloseOnClick&&f()}),{playToast:m,pauseToast:y,isRunning:i,preventExitTransition:a,toastRef:l,eventHandlers:w}}(e),{closeButton:l,children:u,autoClose:d,onClick:h,type:f,hideProgressBar:p,closeToast:g,transition:m,position:v,className:b,style:w,bodyClassName:x,bodyStyle:k,progressClassName:_,progressStyle:S,updateId:E,role:A,progress:T,rtl:O,toastId:C,deleteToast:N,isIn:I,isLoading:P,closeOnClick:R,theme:L}=e,D=i("Toastify__toast",`Toastify__toast-theme--${L}`,`Toastify__toast--${f}`,{"Toastify__toast--rtl":O},{"Toastify__toast--close-on-click":R}),M="function"==typeof b?b({rtl:O,position:v,type:f,defaultClassName:D}):i(D,b),U=function(e){let{theme:t,type:r,isLoading:i,icon:s}=e,a=null,o={theme:t,type:r};return!1===s||("function"==typeof s?a=s({...o,isLoading:i}):(0,n.isValidElement)(s)?a=(0,n.cloneElement)(s,o):i?a=j.spinner():r in j&&(a=j[r](o))),a}(e),$=!!T||!d,F={closeToast:g,type:f,theme:L},B=null;return!1===l||(B="function"==typeof l?l(F):(0,n.isValidElement)(l)?(0,n.cloneElement)(l,F):function(e){let{closeToast:t,theme:r,ariaLabel:i="close"}=e;return n.createElement("button",{className:`Toastify__close-button Toastify__close-button--${r}`,type:"button",onClick:e=>{e.stopPropagation(),t(e)},"aria-label":i},n.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},n.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}(F)),n.createElement(m,{isIn:I,done:N,position:v,preventExitTransition:r,nodeRef:s,playToast:o},n.createElement("div",{id:C,onClick:h,"data-in":I,className:M,...a,style:w,ref:s},n.createElement("div",{...I&&{role:A},className:"function"==typeof x?x({type:f}):i("Toastify__toast-body",x),style:k},null!=U&&n.createElement("div",{className:i("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!P})},U),n.createElement("div",null,u)),B,n.createElement(y,{...E&&!$?{key:`pb-${E}`}:{},rtl:O,theme:L,delay:d,isRunning:t,isIn:I,closeToast:g,hide:p,type:f,style:S,className:_,controlledProgress:$,progress:T||0})))}
34,T=function(e,t){return void 0===t&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},O=l(T("bounce",!0)),C=(l(T("slide",!0)),l(T("zoom"))),N=(l(T("flip")),{position:"top-right",transition:O,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"});function I(e){let t={...N,...e},r=e.stacked,[l,h]=(0,n.useState)(!0),m=(0,n.useRef)(null),{getToastToRender:y,isToastActive:v,count:b}=function(e){let{subscribe:t,getSnapshot:r,setProps:i}=(0,n.useRef)(function(e){let t=e.containerId||1;return{subscribe(r){let i=function(e,t,r){let i=1,l=0,c=[],d=[],h=[],f=t,p=new Map,g=new Set,m=()=>{h=Array.from(p.values()),g.forEach(e=>e())},y=e=>{d=null==e?[]:d.filter(t=>t!==e),m()},v=e=>{let{toastId:t,onOpen:i,updateId:s,children:a}=e.props,o=null==s;e.staleId&&p.delete(e.staleId),p.set(t,e),d=[...d,e.props.toastId].filter(t=>t!==e.staleId),m(),r(u(e,o?"added":"updated")),o&&"function"==typeof i&&i((0,n.isValidElement)(a)&&a.props)};return{id:e,props:f,observe:e=>(g.add(e),()=>g.delete(e)),toggle:(e,t)=>{p.forEach(r=>{null!=t&&t!==r.props.toastId||"function"==typeof r.toggle&&r.toggle(e)})},removeToast:y,toasts:p,clearQueue:()=>{l-=c.length,c=[]},buildToast:(t,d)=>{var h,g;if((t=>{let{containerId:r,toastId:n,updateId:i}=t,s=p.has(n)&&null==i;return(r?r!==e:1!==e)||s})(d))return;let{toastId:b,updateId:w,data:x,staleId:k,delay:_}=d,S=()=>{y(b)},E=null==w;E&&l++;let j={...f,style:f.toastStyle,key:i++,...Object.fromEntries(Object.entries(d).filter(e=>{let[t,r]=e;return null!=r})),toastId:b,updateId:w,data:x,closeToast:S,isIn:!1,className:a(d.className||f.toastClassName),bodyClassName:a(d.bodyClassName||f.bodyClassName),progressClassName:a(d.progressClassName||f.progressClassName),autoClose:!d.isLoading&&(h=d.autoClose,g=f.autoClose,!1===h||s(h)&&h>0?h:g),deleteToast(){let e=p.get(b),{onClose:t,children:i}=e.props;"function"==typeof t&&t((0,n.isValidElement)(i)&&i.props),r(u(e,"removed")),p.delete(b),--l<0&&(l=0),c.length>0?v(c.shift()):m()}};j.closeButton=f.closeButton,!1===d.closeButton||o(d.closeButton)?j.closeButton=d.closeButton:!0===d.closeButton&&(j.closeButton=!o(f.closeButton)||f.closeButton);let A=t;(0,n.isValidElement)(t)&&"string"!=typeof t.type?A=(0,n.cloneElement)(t,{closeToast:S,toastProps:j,data:x}):"function"==typeof t&&(A=t({closeToast:S,toastProps:j,data:x}));let T={content:A,props:j,staleId:k};f.limit&&f.limit>0&&l>f.limit&&E?c.push(T):s(_)?setTimeout(()=>{v(T)},_):v(T)},setProps(e){f=e},setToggle:(e,t)=>{p.get(e).toggle=t},isToastActive:e=>d.some(t=>t===e),getSnapshot:()=>h}}(t,e,f);c.set(t,i);let l=i.observe(r);return d.forEach(e=>g(e.content,e.options)),d=[],()=>{l(),c.delete(t)}},setProps(e){var r;null==(r=c.get(t))||r.setProps(e)},getSnapshot(){var e;return null==(e=c.get(t))?void 0:e.getSnapshot()}}}(e)).current;i(e);let l=(0,n.useSyncExternalStore)(t,r,r);return{getToastToRender:function(t){if(!l)return[];let r=new Map;return e.newestOnTop&&l.reverse(),l.forEach(e=>{let{position:t}=e.props;r.has(t)||r.set(t,[]),r.get(t).push(e)}),Array.from(r,e=>t(e[0],e[1]))},isToastActive:p,count:null==l?void 0:l.length}}(t),{className:w,style:x,rtl:k,containerId:E}=t;function j(){r&&(h(!0),_.play())}return S(()=>{if(r){var e;let r=m.current.querySelectorAll('[data-in="true"]'),n=null==(e=t.position)?void 0:e.includes("top"),i=0,s=0;Array.from(r).reverse().forEach((e,t)=>{e.classList.add("Toastify__toast--stacked"),t>0&&(e.dataset.collapsed=`${l}`),e.dataset.pos||(e.dataset.pos=n?"top":"bot");let r=i*(l?.2:1)+(l?0:12*t);e.style.setProperty("--y",`${n?r:-1*r}px`),e.style.setProperty("--g","12"),e.style.setProperty("--s",""+(1-(l?s:0))),i+=e.offsetHeight,s+=.025})}},[l,b,r]),n.createElement("div",{ref:m,className:"Toastify",id:E,onMouseEnter:()=>{r&&(h(!1),_.pause())},onMouseLeave:j},y((e,t)=>{let s=t.length?{...x}:{...x,pointerEvents:"none"};return n.createElement("div",{className:function(e){let t=i("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":k});return"function"==typeof w?w({position:e,rtl:k,defaultClassName:t}):i(t,a(w))}(e),style:s,key:`container-${e}`},t.map(e=>{let{content:t,props:i}=e;return n.createElement(A,{...i,stacked:r,collapseAll:j,isIn:v(i.toastId,i.containerId),style:i.style,key:`toast-${i.key}`},t)}))}))}},34009:(e,t,r)=>{"use strict";
34Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return k},useLinkStatus:function(){return x}});let n=r(88365),i=r(37876),s=n._(r(14232)),a=r(84727),o=r(1623),l=r(170),u=r(70464),c=r(20125),d=r(242),h=r(63786),f=r(34327),p=r(9094),g=r(89203);r(35785);let m=new Set;function y(e,t,r,n){if((0,o.isLocalURL)(t)){if(!n.bypassPrefetchedCheck){let i=t+"%"+r+"%"+(void 0!==n.locale?n.locale:"locale"in e?e.locale:void 0);if(m.has(i))return;m.add(i)}e.prefetch(t,r,n).catch(e=>{})}}function v(e){return"string"==typeof e?e:(0,l.formatUrl)(e)}let b=s.default.forwardRef(function(e,t){let r,n,{href:l,as:m,children:b,prefetch:w=null,passHref:x,replace:k,shallow:_,scroll:S,locale:E,onClick:j,onNavigate:A,onMouseEnter:T,onTouchStart:O,legacyBehavior:C=!1,...N}=e;r=b,C&&("string"==typeof r||"number"==typeof r)&&(r=(0,i.jsx)("a",{children:r}));let I=s.default.useContext(d.RouterContext),P=!1!==w,{href:R,as:L}=s.default.useMemo(()=>{if(!I){let e=v(l);return{href:e,as:m?v(m):e}}let[e,t]=(0,a.resolveHref)(I,l,!0);return{href:e,as:m?(0,a.resolveHref)(I,m):t||e}},[I,l,m]),D=s.default.useRef(R),M=s.default.useRef(L);C&&(n=s.default.Children.only(r));let U=C?n&&"object"==typeof n&&n.ref:t,[$,F,B]=(0,h.useIntersection)({rootMargin:"200px"}),z=s.default.useCallback(e=>{(M.current!==L||D.current!==R)&&(B(),M.current=L,D.current=R),$(e)},[L,R,B,$]),q=(0,g.useMergedRef)(z,U);s.default.useEffect(()=>{I&&F&&P&&y(I,R,L,{locale:E})},[L,R,F,E,P,null==I?void 0:I.locale,I]);let V={ref:q,onClick(e){C||"function"!=typeof j||j(e),C&&n.props&&"function"==typeof n.props.onClick&&n.props.onClick(e),I&&(e.defaultPrevented||function(e,t,r,n,i,s,a,l,u){let{nodeName:c}=e.currentTarget;if(!("A"===c.toUpperCase()&&function(e){let t=e.currentTarget.getAttribute("target");return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)||e.currentTarget.hasAttribute("download"))){if(!(0,o.isLocalURL)(r)){i&&(e.preventDefault(),location.replace(r));return}e.preventDefault(),(()=>{if(u){let e=!1;if(u({preventDefault:()=>{e=!0}}),e)return}let e=null==a||a;"beforePopState"in t?t[i?"replace":"push"](r,n,{shallow:s,locale:l,scroll:e}):t[i?"replace":"push"](n||r,{scroll:e})})()}}(e,I,R,L,k,_,S,E,A))},onMouseEnter(e){C||"function"!=typeof T||T(e),C&&n.props&&"function"==typeof n.props.onMouseEnter&&n.props.onMouseEnter(e),I&&y(I,R,L,{locale:E,priority:!0,bypassPrefetchedCheck:!0})},onTouchStart:function(e){C||"function"!=typeof O||O(e),C&&n.props&&"function"==typeof n.props.onTouchStart&&n.props.onTouchStart(e),I&&y(I,R,L,{locale:E,priority:!0,bypassPrefetchedCheck:!0})}};if((0,u.isAbsoluteUrl)(L))V.href=L;else if(!C||x||"a"===n.type&&!("href"in n.props)){let e=void 0!==E?E:null==I?void 0:I.locale;V.href=(null==I?void 0:I.isLocaleDomain)&&(0,f.getDomainLocale)(L,e,null==I?void 0:I.locales,null==I?void 0:I.domainLocales)||(0,p.addBasePath)((0,c.addLocale)(L,e,null==I?void 0:I.defaultLocale))}return C?s.default.cloneElement(n,V):(0,i.jsx)("a",{...N,...V,children:r})}),w=(0,s.createContext)({pending:!1}),x=()=>(0,s.useContext)(w),k=b;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},34318:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unstable_rethrow",{enumerable:!0,get:function(){return function e(t){if((0,i.isNextRouterError)(t)||(0,n.isBailoutToCSRError)(t))throw t;t instanceof Error&&"cause"in t&&e(t.cause)}}});let n=r(1677),i=r(40497);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},34327:(e,t,r)=>{"use strict";function n(e,t,r,n){return!1}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getDomainLocale",{enumerable:!0,get:function(){return n}}),r(19783),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esMo
34dule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},35785:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"errorOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},37601:(e,t)=>{"use strict";function r(e){return Array.isArray(e)?e[1]:e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getSegmentValue",{enumerable:!0,get:function(){return r}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},37966:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]])},38514:(e,t,r)=>{"use strict";r.d(t,{cy:()=>a,tn:()=>n});var n=Object.freeze({whats_new:"app",suite_pages:"app",sibling_cta:"app",product_identity:"app",email_identity:"app"}),i={whats_new:["app","hidden"],suite_pages:["app","hidden"],sibling_cta:["app","reseller_lead","hidden"],product_identity:["app","own"],email_identity:["app","own"]},s=Object.keys(n);function a(e){let t=e&&"object"==typeof e&&!Array.isArray(e)?e:{},r={};for(let e of s){let s=t[e];i[e].includes(s)&&s!==n[e]&&(r[e]=s)}return Object.keys(r).length>0?r:null}},39046:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]])},39503:(e,t,r)=>{"use strict";t.kf=t.le=t.ZS=t.pT=t.lc=t.tE=void 0;let n=r(4902),i=n.__importDefault(r(74761));t.tE=i.default;let s=n.__importDefault(r(15997));t.lc=s.default;let a=n.__importDefault(r(67711));t.pT=a.default;let o=n.__importDefault(r(59341));t.ZS=o.default;let l=n.__importDefault(r(40377));t.le=l.default;let u=n.__importDefault(r(51528));t.kf=u.default,i.default,s.default,a.default,o.default,l.default,u.default},40377:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});let n=r(4902),i=n.__importDefault(r(90785)),s=n.__importDefault(r(51528));class a{constructor(e){var t,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!=(t=e.shouldThrowOnError)&&t,this.signal=e.signal,this.isMaybeSingle=null!=(r=e.isMaybeSingle)&&r,e.fetch?this.fetch=e.fetch:"undefined"==typeof fetch?this.fetch=i.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json");let r=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async e=>{var t,r,n,i;let a=null,o=null,l=null,u=e.status,c=e.statusText;if(e.ok){if("HEAD"!==this.method){let r=await e.text();""===r||(o="text/csv"===this.headers.get("Accept")||this.headers.get("Accept")&&(null==(t=this.headers.get("Accept"))?void 0:t.includes("application/vnd.pgrst.plan+text"))?r:JSON.parse(r))}let i=null==(r=this.headers.get("Prefer"))?void 0:r.match(/count=(exact|planned|estimated)/),s=null==(n=e.headers.get("content-range"))?void 0:n.split("/");i&&s&&s.length>1&&(l=parseInt(s[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(o)&&(o.length>1?(a={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,l=null,u=406,c="Not Acceptable"):o=1===o.length?o[0]:null)}else{let t=await e.text();try{a=JSON.parse(t),Array.isArray(a)&&404===e.status&&(o=[],a=null,u=200,c="OK")}catch(r){404===e.status&&""===t?(u=204,c="No Content"):a={message:t}}if(a&&this.isMaybeSingle&&(null==(i=null==a?void 0:a.details)?void 0:i.includes("0 rows"))&&(a=null,u=200,c="OK"),a&&this.shouldThrowOnError)throw new s.default(a)}return{error:a,data:o,count:l,status:u,statusText:c}});return this.shouldThrowOnError||(r=r.catch(e=>{var t,r,n;return{error:{message:`${null!=(t=null==e?void 0:e.name)?t:"FetchError"}: ${null==e?void 0:e.message}`,details:`${null!=(r=null==e?void 0:e.stack)?r:""}`,hint:"",code:`${null!=(n=null==e?void 0:e.code)?n:""}`},data:null,count:null,status:0,statusText:""}}
34)),r.then(e,t)}returns(){return this}overrideTypes(){return this}}t.default=a},45691:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},46293:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},48230:(e,t,r)=>{e.exports=r(34009)},48945:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=null;if(!e||"string"!=typeof e)return r;var n=(0,i.default)(e),s="function"==typeof t;return n.forEach(function(e){if("declaration"===e.type){var n=e.property,i=e.value;s?t(n,i,e):i&&((r=r||{})[n]=i)}}),r};var i=n(r(66720))},49891:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]])},51528:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
34de=e.code}}t.default=r},51655:(e,t,r)=>{"use strict";r.d(t,{b:()=>d});var n=r(37876),i=r(14232),s=r(63200),a=r(11508),o=r(61052),l=r(89099),u=r(55892),c=r(32446);function d(e){let{variant:t,onSignedIn:r}=e,d=(0,l.useRouter)(),{login:h,resetPassword:f,user:p}=(0,u.A)(),{formData:g,error:m,success:y,isSubmitting:v,isResetting:b,handleChange:w,handleSubmit:x,handleResetPassword:k}=function(e){let{initialData:t,onSubmit:r,onReset:n}=e,[s,a]=(0,i.useState)(t),[o,l]=(0,i.useState)(null),[u,c]=(0,i.useState)(null),[d,h]=(0,i.useState)(!1),[f,p]=(0,i.useState)(!1),g=async e=>{e.preventDefault(),l(null),c(null),h(!0);try{if(!s.email.trim()||!s.password.trim())throw Error("Email and password are required");await r(s)}catch(e){console.error("Form submission failed:",e),l(e instanceof Error?e.message:"An error occurred")}finally{h(!1)}};return{formData:s,error:o,success:u,isSubmitting:d,isResetting:f,handleChange:e=>{a(t=>({...t,[e.target.name]:e.target.value}))},handleSubmit:g,handleResetPassword:async e=>{if(!e.trim())return void l("Please enter your email address");l(null),c(null),p(!0);try{n&&(await n(e),c("Password reset instructions have been sent to your email"))}catch(e){l(e instanceof Error?e.message:"Failed to send reset email")}finally{p(!1)}}}}({initialData:{email:"",password:""},onSubmit:async e=>{let t=await h(e.email,e.password);localStorage.setItem("user",JSON.stringify(t)),null==r||r(),c.oR.success("You are logged in!"),d.push("/dashboard")},onReset:async e=>{await f(e)}});if(p)return(0,n.jsxs)("button",{type:"button",onClick:()=>d.push("/dashboard"),className:"flex w-full items-center justify-center gap-2 rounded-lg bg-indigo-500 py-2 text-base font-medium text-white hover:bg-indigo-400",children:[(0,n.jsx)(s.A,{className:"h-4 w-4"}),(0,n.jsx)("span",{children:"Go to Dashboard"})]});let _="page"===t,S=_?"mt-1 block w-full rounded-md border border-[#24304C] bg-[#0B101E] px-3 py-2 text-[#EBF0F4] placeholder:text-[#6B7A94] focus:border-[#7872F4] focus:ring-1 focus:ring-[#7872F4] focus:outline-none":"mt-1 block w-full rounded-md border-gray-600 bg-gray-700 text-white shadow-sm focus:border-indigo-500 focus:ring-indigo-500",E=_?"block text-sm font-medium text-[#EBF0F4]":"block text-sm font-medium text-gray-300";return(0,n.jsxs)("form",{onSubmit:x,className:_?"space-y-4":"space-y-6",children:[m&&(0,n.jsx)("div",{className:"border-l-4 border-red-500 bg-red-900/50 p-4",children:(0,n.jsxs)("div",{className:"flex",children:[(0,n.jsx)(a.A,{className:"h-5 w-5 text-red-400"}),(0,n.jsx)("p",{className:"ml-3 text-sm text-red-200",children:m})]})}),y&&(0,n.jsx)("div",{className:"border-l-4 border-green-500 bg-green-900/50 p-4",children:(0,n.jsxs)("div",{className:"flex",children:[(0,n.jsx)(a.A,{className:"h-5 w-5 text-green-400"}),(0,n.jsx)("p",{className:"ml-3 text-sm text-green-200",children:y})]})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"email",className:E,children:"Email"}),(0,n.jsx)("input",{type:"email",id:"email",name:"email",value:g.email,onChange:w,placeholder:_?"[email protected]":void 0,className:S,required:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"password",className:E,children:"Password"}),(0,n.jsx)("input",{type:"password",id:"password",name:"password",value:g.password,onChange:w,placeholder:_?"Enter your password":void 0,className:S,required:!0})]}),_?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"flex items-center justify-end",children:(0,n.jsx)("button",{type:"button",onClick:()=>k(g.email),disabled:b,className:"text-sm text-[#7872F4] hover:underline disabled:opacity-50",children:b?"Sending...":"Forgot password?"})}),(0,n.jsxs)("button",{type:"submit",disabled:v,className:"flex w-full items-center justify-center rounded-md bg-[#7872F4] px-4 py-2 text-sm font-medium text-[#1B1A3C] hover:bg-[#8D88F6] disabled:opacity-50",children:[v&&(0,n.jsx)(o.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Sign In"]})]}):(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("button",{type:"submit",disabled:v,className:"mr-4 flex flex-1 items-center justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 focus:outline-none disabled:opacity-50",children:v?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in..."]}):"Sign In"}),(0,n.jsx)("button",{type:"button",onClick:()=>k(g.email),disabled:b,className:"text-sm text-indigo-400 hover:text-indigo-300",children:b?"Sending...":"Forgot Password?"})]})]})}},53296:(e,t,r)=>{"use strict";r.d(t,{m:()=>n});let n={iai_admin:["manage:users","manage:workspaces","view:analytics","manage:assessments","manage:clients","customize:tools","view:reports","manage:projects","access:support"],iai_support:["view:analytics","view:reports","access:support"],iai_marketing:["view:analytics","view:reports"],iai_finance:["view:analytics","view:reports"],agency_admin:["view:dashboard","view:analytics","view:reports","access:support","access:settings","update:profile","customize:tools","manage:workspaces","manage:assessments","manage:users","manage:projects","manage:links","manage:agency-profile"],agency_user:["manage:assessments","view:reports","manage:projects"],agency_customer:["view:dashboard","access:support","access:settings","update:profile"],company_admin:["view:analytics","view:reports","manage:projects","manage:users"],company_manager:["manage:projects","view:reports"],company_user:["view:reports"],waitlist_user:["access:support","access:settings","view:knowledgebase","view:resources","update:profile","view:dashboard","manage:users"]}},54080:(e,t,r)=>{"use strict";r.d(t,{V:()=>q});var n=r(37876),i=r(14232),s=r(89099),a=r(48230),o=r.n(a),l=r(55892),u=r(16317),c=r(14136),d=r(58725),h=r(46293),f=r(63906),p=r(60383),g=r(28249),m=r(11508),y=r(84300);function v(e){var t,r,s;let{onClose:a}=e,{user:d}
34=(0,l.A)(),{createWorkspace:h}=(0,u.h)(),{usage:f}=(0,y.R)(),p=!(null!=(s=null==f||null==(r=f.usage)||null==(t=r.workspaces)?void 0:t.isAtLimit)&&s),[v,b]=(0,i.useState)(""),[w,x]=(0,i.useState)(""),[k,_]=(0,i.useState)(""),[S,E]=(0,i.useState)(!1),j=async e=>{if(e.preventDefault(),d){if(!p)return void _("Your subscription plan does not allow creating additional workspaces. Please upgrade your plan.");try{E(!0),_(""),await h(v,w),a()}catch(e){_(e instanceof Error?e.message:"Failed to create workspace")}finally{E(!1)}}};return(0,n.jsx)("div",{className:"fixed inset-0 bg-gray-500/75 dark:bg-gray-900/80 flex items-center justify-center p-4 z-50",children:(0,n.jsxs)("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:[(0,n.jsx)("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,n.jsx)(c.A,{className:"h-6 w-6 text-indigo-600 dark:text-indigo-400"}),(0,n.jsx)("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Create New Workspace"})]}),(0,n.jsx)("button",{onClick:a,className:"text-gray-400 hover:text-gray-500 dark:hover:text-gray-300 transition-colors",children:(0,n.jsx)(g.A,{className:"h-6 w-6"})})]})}),(0,n.jsxs)("form",{onSubmit:j,className:"p-6",children:[k&&(0,n.jsx)("div",{className:"mb-4 bg-red-50 border-l-4 border-red-400 p-4",children:(0,n.jsxs)("div",{className:"flex",children:[(0,n.jsx)(m.A,{className:"h-5 w-5 text-red-400"}),(0,n.jsx)("p",{className:"ml-3 text-sm text-red-700",children:k})]})}),!p&&(0,n.jsx)("div",{className:"mb-4 bg-yellow-50 border-l-4 border-yellow-400 p-4",children:(0,n.jsxs)("div",{className:"flex",children:[(0,n.jsx)(m.A,{className:"h-5 w-5 text-yellow-400"}),(0,n.jsxs)("div",{className:"ml-3",children:[(0,n.jsx)("p",{className:"text-sm text-yellow-700",children:"You've reached the workspace limit for your current plan."}),(0,n.jsx)(o(),{href:"/subscription",className:"mt-2 inline-flex text-sm text-yellow-700 underline hover:text-yellow-600",children:"Upgrade your plan"})]})]})}),(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Workspace Name"}),(0,n.jsx)("input",{type:"text",id:"name",value:v,onChange:e=>b(e.target.value),className:"mt-1 block w-full rounded-md border-gray-300 dark:border-gray-600 shadow-sm    focus:border-indigo-500 focus:ring-indigo-500    dark:bg-gray-700 dark:text-white dark:placeholder-gray-400   transition-colors",required:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"companyName",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Company Name"}),(0,n.jsx)("input",{type:"text",id:"companyName",value:w,onChange:e=>x(e.target.value),className:"mt-1 block w-full rounded-md border-gray-300 dark:border-gray-600 shadow-sm    focus:border-indigo-500 focus:ring-indigo-500    dark:bg-gray-700 dark:text-white dark:placeholder-gray-400   transition-colors",required:!0})]}),(0,n.jsxs)("div",{className:"mt-6 flex justify-end space-x-3",children:[(0,n.jsx)("button",{type:"button",onClick:a,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium    text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700   hover:bg-gray-50 dark:hover:bg-gray-600   focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500    dark:focus:ring-offset-gray-800   transition-colors",children:"Cancel"}),(0,n.jsx)("button",{type:"submit",disabled:S||!p,className:"inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm    text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700   dark:bg-indigo-500 dark:hover:bg-indigo-600   focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500   dark:focus:ring-offset-gray-800   disabled:opacity-50 disabled:cursor-not-allowed   transition-colors",children:S?"Creating...":"Create Worksp
34ace"})]})]})]})]})})}var b=r(13415);function w(){let{activeWorkspace:e,workspaces:t,setActiveWorkspace:r,refreshWorkspaces:s}=(0,u.h)(),{user:a}=(0,l.A)(),[g,m]=(0,i.useState)(!1),[y,w]=(0,i.useState)(!1);(0,i.useEffect)(()=>{(async()=>{await s()})()},[a,g]);let x=async e=>{try{var t;let{data:n}=await b.N.auth.getSession(),i=null==n||null==(t=n.session)?void 0:t.access_token;fetch("/api/workspace-members/switch",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i)},body:JSON.stringify({workspaceId:e.id})}).catch(console.error),r(e),m(!1)}catch(t){console.error("Error switching workspace:",t),r(e),m(!1)}},k=(null==a?void 0:a.role)&&["iai_admin","iai_support","agency_admin","company_admin"].includes(a.role);return(0,n.jsxs)("div",{className:"relative mt-4 px-4",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>m(!g),className:"inline-flex items-center justify-between w-full px-4 py-2 border border-gray-300 dark:border-gray-600 shadow-sm text-sm font-medium rounded-md text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800",children:[(0,n.jsxs)("div",{className:"flex items-center min-w-0",children:[(0,n.jsx)(c.A,{className:"h-5 w-5 mr-2 text-gray-500 dark:text-gray-400 flex-shrink-0"}),(0,n.jsx)("span",{className:"truncate",children:(null==e?void 0:e.name)||"Select Workspace"})]}),(0,n.jsx)(d.A,{className:"h-4 w-4 ml-2 text-gray-500 transition-transform ".concat(g?"rotate-180":"")})]}),g&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"fixed inset-0 z-40 lg:hidden",onClick:()=>m(!1)}),(0,n.jsxs)("div",{className:"absolute left-4 right-4 mt-2 rounded-md shadow-lg bg-white dark:bg-gray-700 ring-1 ring-black ring-opacity-5 z-50 max-h-96 overflow-y-auto",children:[(0,n.jsx)("div",{className:"py-1",children:(null==t?void 0:t.length)===0?(0,n.jsx)("div",{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400",children:"No workspaces available"}):null==t?void 0:t.map(t=>(0,n.jsx)("button",{onClick:()=>x(t),className:"block w-full text-left px-4 py-2 text-sm transition-colors ".concat((null==e?void 0:e.id)===t.id?"bg-indigo-50 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-200":"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-600"),children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(c.A,{className:"h-4 w-4 mr-2 flex-shrink-0"}),(0,n.jsx)("span",{className:"truncate",children:t.name}),(null==e?void 0:e.id)===t.id&&(0,n.jsx)("span",{className:"ml-auto text-xs bg-indigo-100 dark:bg-indigo-800 text-indigo-600 dark:text-indigo-300 px-2 py-0.5 rounded-full",children:"Active"})]})},t.id))}),e&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"border-t border-gray-200 dark:border-gray-600"}),(0,n.jsxs)("div",{className:"py-1",children:[k&&(0,n.jsxs)(o(),{href:"/workspace/members",onClick:()=>m(!1),className:"flex items-center w-full px-4 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-600",children:[(0,n.jsx)(h.A,{className:"h-4 w-4 mr-2"}),"Manage Members"]}),(0,n.jsxs)(o(),{href:"/settings",onClick:()=>m(!1),className:"flex items-center w-full px-4 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-600",children:[(0,n.jsx)(f.A,{className:"h-4 w-4 mr-2"}),"Workspace Settings"]})]})]}),(0,n.jsx)("div",{className:"border-t border-gray-200 dark:border-gray-600"}),(0,n.jsx)("div",{className:"py-1",children:(0,n.jsxs)("button",{onClick:()=>{w(!0),m(!1)},className:"flex items-center w-full px-4 py-2 text-sm text-indigo-600 dark:text-indigo-400 hover:bg-gray-100 dark:hover:bg-gray-600",children:[(0,n.jsx)(p.A,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})})]})]}),y&&(0,n.jsx)(v,{onClose:()=>w(!1)})]})}var x=r(12572),k=r(25527),_=r(17963);let S=(0,_.A)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);var E=r(29053),j=r(88628),A=r(57880),T=r(63200);let O=(0,_.A)("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);var C=r(73884),N=r(78881),I=r(80310),P=r(91853),R=r(90146),L=r(37966),D=r(68693),M=r(49891),U=r(21174);let $=(0,_.A)("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);var F=r(15092),B=r(21086);let z=(e,t)=>null==e?void 0:e.map(e=>{let r=Array.isArray(e.permission)?e.permission.some(e=>t.includes(e)):t.includes(e.permission),n=e.submenu?z(e.submenu,t):void 0;return r||n&&n.length>0?{...e,submenu:n}:null}
34).filter(Boolean);function q(){let{user:e,logout:t}=(0,l.A)(),[r,a]=(0,i.useState)(!1),[u,d]=(0,i.useState)(!1),[p,m]=(0,i.useState)([]),y=(0,s.useRouter)(),{permissions:v}=(0,A.S)(),b=[{name:"Dashboard",href:"/dashboard",icon:T.A,permission:["view:dashboard"]},{name:"Suite",href:"/suite",icon:O,permission:["view:dashboard"]},{name:"What's New",href:"/whats-new",icon:C.A,permission:["view:dashboard"]},{name:"Projects",href:"/projects",icon:N.A,permission:["view:projects","manage:projects"],requiresWorkspace:!0},{name:"Opportunities",icon:I.A,href:"/opportunities",requiresWorkspace:!0,permission:["view:oppertunities"]},{name:"Business Profile",icon:c.A,href:"/business-profile",requiresWorkspace:!0,permission:["view:dashboard"]},{name:"Agency Portfolio",icon:P.A,href:"/agency-portfolio",permission:["view:dashboard"]},{name:"Resources",href:"/resources",permission:["view:resources"],icon:R.A,submenu:[{name:"Assessments",href:"/assessments",icon:L.A,permission:["view:assessments","manage:assessments"]},{name:"Knowledge Base",href:"/knowledgebase",icon:D.A,permission:["view:knowledgebase"]}]},{name:"Users",icon:h.A,href:"/users",permission:["manage:users"],requiresWorkspace:!0},{name:"Workspaces",icon:c.A,href:"/workspaces",permission:["manage:workspaces"]},{name:"Workspace Members",icon:h.A,href:"/workspace/members",permission:["manage:users","manage:workspaces"],requiresWorkspace:!0},{name:"Tools",icon:M.A,href:"/tools",requiresWorkspace:!0,permission:["view:tools"]},{name:"Audit Log",icon:U.A,href:"/audit",permission:["view:analytics"]},{name:"Support",icon:$,href:"/support",permission:["view:support","access:support"]},{name:"Settings",icon:f.A,href:"/settings",permission:["view:settings","access:settings"]},{name:"Manage Users",icon:h.A,href:"/manage-users",permission:["manage:users"],requiresWorkspace:!0},{name:"Manage Permissions",icon:h.A,href:"/manage-permissions",permission:["manage:users"],requiresWorkspace:!0},{name:"Agency Links",icon:M.A,href:"/agency-links",permission:["manage:links"],requiresWorkspace:!0},{name:"Agency Profile",icon:c.A,href:"/agency-profile",permission:["manage:agency-profile"]}],{hasUnread:_}=(0,B.u9)(),{surfaces:q,providerName:V,logoUrl:H}=(0,F.s)(),W="own"===q.product_identity&&!!V,K=async()=>{try{await t(),y.push("/login")}catch(e){console.error("Logout failed:",e)}};(0,i.useEffect)(()=>{let e=z(b,v);e.length>0&&m(e)},[v]);let J=()=>(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)("button",{onClick:()=>d(!u),className:"flex items-center w-full",children:[(0,n.jsx)("img",{className:"inline-block h-9 w-9 rounded-full",src:(null==e?void 0:e.avatar)||"/default-avatar.png",alt:"user_avatar"}),(0,n.jsxs)("div",{className:"ml-3",children:[(0,n.jsxs)("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[null==e?void 0:e.firstName," ",null==e?void 0:e.lastName]}),(0,n.jsx)("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:null==e?void 0:e.email})]})]}),u&&(0,n.jsx)("div",{className:"absolute bottom-full left-4 right-4 mt-2 rounded-md shadow-lg bg-white dark:bg-gray-700 ring-1 ring-black ring-opacity-5 z-50",children:(0,n.jsxs)("div",{className:"py-1",children:[v.includes("update:profile")&&(0,n.jsxs)(o(),{href:"/profile",className:"flex items-center px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600",onClick:()=>d(!1),children:[(0,n.jsx)(x.A,{className:"mr-3 h-5 w-5 text-gray-400 dark:text-gray-500"}),"Edit Profile"]}),(null==e?void 0:e.role)!=="waitlist_user"&&(0,n.jsxs)(o(),{href:"/subscription",className:"flex items-center px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600",onClick:()=>d(!1),children:[(0,n.jsx)(k.A,{className:"mr-3 h-5 w-5 text-gray-400 dark:text-gray-500"}),"Subscription"]}),(0,n.jsxs)("button",{onClick:()=>{d(!1),K()},className:"flex items-center w-full px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600",children:[(0,n.jsx)(S,{className:"mr-3 h-5 w-5 text-gray-400 dark:text-gray-500"}),"Log Out"]})]})})]}),G=()=>(0,n.jsx)("nav",{className:"mt-5 flex-1 px-2 space-y-1",children:null==p?void 0:p.filter(e=>
34("/whats-new"!==e.href||"hidden"!==q.whats_new)&&("/suite"!==e.href||"hidden"!==q.suite_pages)).map(e=>{let t=y.pathname===e.href||e.submenu&&e.submenu.some(e=>y.pathname===e.href);return(0,n.jsxs)("div",{children:[(0,n.jsxs)(o(),{href:e.href,className:"group flex items-center px-2 py-2 text-sm font-medium rounded-md ".concat(t?"bg-indigo-50 dark:bg-indigo-900 text-indigo-600 dark:text-indigo-300":"text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-gray-200"),children:[e.name,"/whats-new"===e.href&&_&&(0,n.jsx)("span",{className:"ml-2 inline-block h-2 w-2 rounded-full bg-indigo-500","aria-label":"New updates",title:"New updates"}),e.submenu&&(0,n.jsx)(E.A,{className:"ml-auto h-4 w-4 ".concat(t?"text-indigo-500 dark:text-indigo-400":"text-gray-400 dark:text-gray-500")})]}),e.submenu&&(0,n.jsx)("div",{className:"ml-8 mt-1 space-y-1",children:e.submenu.map(e=>(0,n.jsx)(o(),{href:e.href,className:"group flex items-center px-2 py-2 text-sm font-medium rounded-md ".concat(y.pathname===e.href?"bg-indigo-50 dark:bg-indigo-900 text-indigo-600 dark:text-indigo-300":"text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-gray-200"),children:e.name},e.name))})]},e.name)})});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"fixed top-0 left-0 right-0 lg:hidden flex items-center justify-between px-4 h-16 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 z-40",children:[(0,n.jsx)("button",{onClick:()=>a(!0),className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:(0,n.jsx)(j.A,{className:"h-6 w-6"})}),(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("img",{src:W&&H?H:"/logo.svg",alt:W?null!=V?V:"logo":"Intellimate AI",className:W&&H?"h-8 w-auto max-w-[10rem] object-contain":"h-8 w-8 text-indigo-400"}),(0,n.jsx)("span",{className:"ml-2 text-lg font-semibold text-gray-900 dark:text-white",children:W?V:"Intellimate AI"})]}),(0,n.jsx)("div",{className:"w-10"})," "]}),(0,n.jsxs)("div",{className:"fixed inset-0 flex z-40 lg:hidden ".concat(r?"opacity-100":"opacity-0 pointer-events-none"),children:[(0,n.jsx)("div",{className:"fixed inset-0 bg-gray-600 bg-opacity-75 transition-opacity duration-300 ease-in-out ".concat(r?"opacity-100":"opacity-0"),onClick:()=>a(!1)}),(0,n.jsxs)("div",{className:"relative flex-1 flex flex-col max-w-xs w-full bg-white dark:bg-gray-800 transform transition ease-in-out duration-300 ".concat(r?"translate-x-0":"-translate-x-full"),children:[(0,n.jsx)("div",{className:"absolute top-0 right-0 -mr-12 pt-2",children:(0,n.jsx)("button",{className:"ml-1 flex items-center justify-center h-10 w-10 rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white dark:focus:ring-gray-900",onClick:()=>a(!1),children:(0,n.jsx)(g.A,{className:"h-6 w-6 text-white dark:text-gray-300"})})}),(0,n.jsxs)("div",{className:"flex-1 flex flex-col pt-5 pb-4 overflow-y-auto",children:[(0,n.jsx)("div",{className:"flex items-center flex-shrink-0 px-4",children:W&&H?(0,n.jsx)("img",{src:H,alt:null!=V?V:"logo",className:"h-8 w-auto max-w-[12rem] object-contain"}):(0,n.jsx)("img",{src:"/Intellimate_Logo1_dark.png",alt:"logo",className:"h-8 w-8 text-indigo-400",id:"intellimate-logo"})}),(0,n.jsx)(w,{}),(0,n.jsx)(G,{})]}),(0,n.jsx)("div",{className:"flex-shrink-0 flex border-t border-gray-200 dark:border-gray-700 p-4",children:(0,n.jsx)(J,{})})]})]}),(0,n.jsx)("div",{className:"hidden lg:flex lg:w-64 lg:flex-col lg:fixed lg:inset-y-0",children:(0,n.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700",children:[(0,n.jsxs)("div",{className:"flex-1 flex flex-col pt-5 pb-4 overflow-y-auto",children:[(0,n.jsx)("div",{className:"flex items-center flex-shrink-0 px-4",children:W&&H?(0,n.jsx)("img",{src:H,alt:null!=V?V:"logo",className:"h-8 w-auto max-w-[12rem] object-contain"}
34):(0,n.jsx)("img",{src:"/Intellimate_Logo1_dark.png",alt:"intellimate-ai-intelligent-automation-platform-logo2",className:"h-8 w-40 text-indigo-400",id:"intellimate_logo"})}),(0,n.jsx)(w,{}),(0,n.jsx)(G,{})]}),(0,n.jsx)("div",{className:"flex-shrink-0 flex border-t border-gray-200 dark:border-gray-700 p-4",children:(0,n.jsx)(J,{})})]})})]})}},55892:(e,t,r)=>{"use strict";r.d(t,{A:()=>d,O:()=>c});var n=r(37876),i=r(14232),s=r(14e3),a=r(90999),o=r(13415),l=r(57880);let u=(0,i.createContext)(void 0);function c(e){let{children:t}=e,[r,c]=(0,i.useState)(null),[d,h]=(0,i.useState)(!0),f=(0,s.useRouter)(),{setUserRole:p}=(0,l.S)(),g=async()=>{try{let{data:{session:e},error:t}=await o.N.auth.getSession();if(t)throw t;if(e){console.log("Session found via Supabase:",e);let t=await a.sE(e.user.id);t?c(t):(console.log("User details not found."),c(null))}else console.log("No session found, redirecting to login..."),c(null)}catch(e){console.error("Session check failed:",e),c(null)}finally{h(!1)}};(0,i.useEffect)(()=>{g(),o.N.auth.onAuthStateChange((e,t)=>{"SIGNED_IN"===e&&t?(console.log("User signed in"),a.sE(t.user.id).then(e=>{e?c(e):(console.log("User details not found after sign-in."),c(null))}).catch(e=>{console.error("Error fetching user details on sign-in:",e),c(null)})):"SIGNED_OUT"===e&&(console.log("User signed out"),c(null))})},[f]);let m=(0,i.useCallback)(async(e,t)=>{try{console.log("AuthService SignIn");let r=await a.Jv(e,t);return console.log("User authenticated, setting user data."),c(r),p(null==r?void 0:r.role),f.push("/dashboard"),r}catch(e){throw console.error("Login failed:",e),e}},[f]),y=(0,i.useCallback)(async(e,t,r,n,i)=>{try{console.log("AuthService SignUp");let s=await a.Hh(e,t,r,n,i);console.log("Set user"),c(s),console.log("Redirecting..."),f.push("/dashboard")}catch(e){throw console.error("Sign up failed:",e),e}},[f]),v=(0,i.useCallback)(async()=>{try{await o.N.auth.signOut(),Object.keys(localStorage).filter(e=>e.startsWith("sb-")||"user"===e).forEach(e=>localStorage.removeItem(e)),c(null),f.push("/")}catch(e){throw console.error("Logout failed:",e),e}},[f]),b=(0,i.useCallback)(e=>{var t;return null!=(t=null==r?void 0:r.permissions.includes(e))&&t},[r]),w=(0,i.useCallback)(e=>e.some(e=>b(e)),[b]),x=(0,i.useCallback)(e=>e.every(e=>b(e)),[b]),k=(0,i.useCallback)(async e=>{await a.xw(e)},[]),_=(0,i.useCallback)(async e=>{let{data:{user:t}}=await o.N.auth.getUser();if(!t)throw Error("Not authenticated");let{error:r}=await o.N.from("users").update({first_name:e.firstName,last_name:e.lastName}).eq("id",t.id);if(r)throw r;let n=await a.sE(t.id);n&&c(n)},[]),S=(0,i.useCallback)(async(e,t)=>{let{error:r}=await o.N.auth.updateUser({email:e});if(r)throw r},[]),E=(0,i.useCallback)(async(e,t)=>{let{error:r}=await o.N.auth.updateUser({password:t});if(r)throw r},[]),j=async e=>{let t="heros/".concat(e.name),{data:r,error:n}=await o.N.storage.from("heros").upload(t,e);return n?(console.error("Error uploading image: ",n),null):null==r?void 0:r.path};async function A(e,t){try{let{statusText:r,error:n}=await o.N.from("users").update({avatar:t}).eq("id",e);if(r){let t=await a.sE(e);t?c(t):(console.log("User details not found."),c(null))}if(n)return console.error("Error updating avatar URL:",n),{data:null,url:t,error:n};return{url:"null",data:null,error:n}}catch(e){return console.error("Unexpected error:",e),{url:"null",data:null,error:e}}}let T=async e=>{if(!e)return{message:"No file provided",avatarUrl:void 0,imageUploadError:void 0};let t=await j(e);if(!t||!r)return{message:"Image upload failed: Invalid file or user.",avatarUrl:void 0,imageUploadError:void 0};{let e=(e=>{let{data:t}=o.N.storage.from("heros").getPublicUrl(e);return t.publicUrl})(t);try{let{url:t,error:n}=await A(r.id,e);if(t)return a.sE(r.id),{message:"Profile Image Updated",avatarUrl:t,imageUploadError:void 0};return{message:"Failed to save avatar URL",avatarUrl:void 0,imageUploadError:n||"Unknown error occurred"}}catch(e){return{message:"Error saving avatar URL",avatarUrl:void 0,imageUploadError:e instanceof Error?e.message:"Unknown error"}}}};return(0,n.jsx)(u.Provider,{value:{user:r,setUser:c,loading:d,login:m,signUp:y,logout:v,hasPermission:b,hasAnyPermission:w,hasAllPermissions:x,handleImageUpload:T,resetPassword:k,updateProfile:_,updateEmail:S,updatePassword:E},children:t})}function d(){let e=(0,i.useContext)(u);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e}},57880:(e,t,r)=>{"use strict";r.d(t,{S:()=>l,w:()=>o});var n=r(37876),i=r(14232),s=r(13415);let a=(0,i.createContext)(void 0);function o(e){let{children:t}=e,[r,o]=(0,i.useState)([]),l=async e=>{try{console.log("setUserRole Function");let{data:r,error:n}=await s.N.from("role_permissions").select("*").eq("role_name",e);if(n)throw n;if(r&&r.length>0){var t;let e=(null==(t=r[0])?void 0:t.default_permissions)||[];o(e)}else o([])}catch(e){console.error("Error fetching role permissions:",e),o([])}};return(0,i.useEffect)(()=>{},[]),(0,n.jsx)(a.Provider,{value:{permissions:r,setUserRole:l},children:t})}function l(){let e=(0,i.useContext)(a);if(void 0===e)throw Error("usePermissions must be used within a PermissionsProvider");return e}},58725:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},59341:(e,t,r)=>{"use strict";
34Object.defineProperty(t,"__esModule",{value:!0});let n=r(4902).__importDefault(r(40377));class i extends n.default{select(e){let t=!1,r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:i=n}={}){let s=i?`${i}.order`:"order",a=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let n=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){let i=void 0===n?"offset":`${n}.offset`,s=void 0===n?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(s,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return"GET"===this.method?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}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:i=!1,format:s="text"}={}){var a;let o=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,i?"wal":null].filter(Boolean).join("|"),l=null!=(a=this.headers.get("Accept"))?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${l}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}}t.default=i},60383:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},60506:(e,t,r)=>{"use strict";r.d(t,{AE:()=>l,FS:()=>a,sK:()=>s,uk:()=>o});var n=r(13415),i=r(17933);async function s(e,t,r){try{let{data:i,error:s}=await n.N.from("workspaces").insert({name:e,company_name:t,owner_id:r,created_at:new Date().toISOString(),updated_at:new Date().toISOString()}).select().single();if(s)throw s;let{error:a}=await n.N.from("workspace_members").insert({workspace_id:i.id,user_id:r,role:"company_user",created_at:new Date().toISOString(),updated_at:new Date().toISOString()});if(a)throw a;
34return{id:i.id,name:i.name,companyName:i.company_name,assessmentStatus:"pending",members:[{userId:r,role:"company_admin",permissions:["view:analytics","view:reports","manage:projects"]}]}}catch(e){throw console.error("Error creating workspace:",e),e}}async function a(e){try{let{data:t,error:r}=await n.N.from("workspaces").select("\n        *,\n        workspace_members!inner(*),\n        users:owner_id(*)\n      ").eq("workspace_members.user_id",e);if(r)throw r;return(null!=t?t:[]).map(i.$A)}catch(e){throw console.error("Error fetching workspaces:",e),e}}async function o(e){try{let{data:t,error:r}=await n.N.from("workspace_members").select("*, workspaces(name)").eq("user_id",e);if(r)throw r;return t.map(e=>{var t;return{...e,workspace_name:null==(t=e.workspaces)?void 0:t.name}})}catch(e){throw console.error("Error fetching workspace members:",e),e}}let l=async(e,t,r)=>{try{let{error:i}=await n.N.from("workspace_members").update({access_level:r}).eq("workspace_id",e).eq("user_id",t);if(i)throw i;console.log("Access Updated successfully!")}catch(e){console.error("Error removing access:",e),alert("Failed to remove access.")}}},61052:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]])},63147:(e,t,r)=>{"use strict";r.d(t,{c3:()=>w,$q:()=>b,WN:()=>y});var n=r(37876),i=r(14232),s=r(99615),a=r(48230),o=r.n(a),l=r(45691),u=r(28419),c=r(18334),d=r(16317),h=r(13415);let f={loading:!1,accelimate:"unknown",vigilimate:"unknown"},p=new Map,g=[{key:"accelimate",pattern:/\bAccelimate AI\b/,name:"Accelimate AI",url:"https://accelimate.com",tagline:"Websites, CRM, marketing, billing and the tools to run the whole business."},{key:"vigilimate",pattern:/\bVigilimate AI\b/,name:"Vigilimate AI",url:"https://vigilimate.com",tagline:"Training, certification, compliance and verifiable credentials for your people."}];function m(e){let{entry:t,mode:r="app",providerName:s=null}=e,a=function(){var e;let{activeWorkspace:t}=(0,d.h)(),r=null!=(e=null==t?void 0:t.id)?e:null,[n,s]=(0,i.useState)({...f,loading:!0});return(0,i.useEffect)(()=>{let e=!1;if(!r)return void s({loading:!1,accelimate:"not_owned",vigilimate:"not_owned"});let t=p.get(r);return t?void s({...t,loading:!1}):((async()=>{try{var t;let{data:n}=await h.N.auth.getSession(),i=null==(t=n.session)?void 0:t.access_token;if(!i){e||s(f);return}let a=await fetch("/api/suite/siblings?workspaceId=".concat(encodeURIComponent(r)),{headers:{Authorization:"Bearer ".concat(i)}});if(!a.ok)throw Error("siblings ".concat(a.status));let o=await a.json();p.set(r,o),e||s({...o,loading:!1})}catch(t){c.Cp(t,{tags:{feature:"sibling-entitlements"}}),e||s(f)}})(),()=>{e=!0})},[r]),n}(),{activeWorkspace:m}=(0,d.h)(),[y,v]=(0,i.useState)({});async function b(e){v(t=>({...t,[e]:"sending"}));try{var t;let{data:r}=await h.N.auth.getSession(),n=null==(t=r.session)?void 0:t.access_token,i=null==m?void 0:m.id;if(!n||!i)throw Error("no session/workspace for interest");let s=await fetch("/api/suite/interest",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)},body:JSON.stringify({workspaceId:i,product:e})});if(!s.ok)throw Error("interest ".concat(s.status));let a=await s.json();v(t=>({...t,[e]:a.already?"already":"sent"}))}catch(t){c.Cp(t,{tags:{feature:"sibling-interest"}}),v(t=>({...t,[e]:"failed"}))}}let w="".concat(t.title,"\n").concat(t.body),x="hidden"===r?[]:g.filter(e=>e.pattern.test(w)&&"owned"!==a[e.key]);return x.length?(0,n.jsx)("div",{className:"mt-4 space-y-2",children:x.map(e=>(0,n.jsx)("div",{className:"rounded-lg border border-indigo-200 bg-indigo-50/60 p-3 dark:border-indigo-800 dark:bg-indigo-950/40",children:"reseller_lead"===r?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:["Interested in what ",e.name," adds?"]}),(0,n.jsxs)("p",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-400",children:[null!=s?s:"Your provider"," can add it to your plan."]}),(0,n.jsxs)("div",{className:"mt-2",children:["sent"===y[e.key]||"already"===y[e.key]?(0,n.jsx)("p",{className:"text-xs font-medium text-indigo-600 dark:text-indigo-400",children:"sent"===y[e.key]?"Request sent — ".concat(null!=s?s:"your provider"," will follow up."):"Already requested — ".concat(null!=s?s:"your provider"," has it.")}):(0,n.jsx)("button",{type:"button",onClick:()=>b(e.key),disabled:"sending"===y[e.key],className:"text-xs font-medium text-indigo-600 hover:underline disabled:opacity-60 dark:text-indigo-400",children:"sending"===y[e.key]?"Sending…":"Ask ".concat(null!=s?s:"your provider"," about it")}),"failed"===y[e.key]?(0,n.jsx)("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Could not send — try again."}):null]})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"unknown"===a[e.key]?e.name:"Not using ".concat(e.name," yet?")}),(0,n.jsx)("p",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-400",children:e.tagline}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[(0,n.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-md bg-indigo-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-indigo-700",children:["About ",e.name," ",(0,n.jsx)(l.A,{className:"h-3.5 w-3.5"})]}
34),(0,n.jsxs)(o(),{href:"/suite",className:"inline-flex items-center gap-1 rounded-md px-3 py-1.5 text-xs font-medium text-indigo-600 hover:bg-indigo-100 dark:text-indigo-400 dark:hover:bg-indigo-900/50",children:["See the suite ",(0,n.jsx)(u.A,{className:"h-3.5 w-3.5"})]})]})]})},e.name))}):null}function y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"short";return new Date(e).toLocaleDateString("en-US",{month:"short"===t?"short":"long",day:"numeric",year:"numeric"})}function v(e){let{tag:t}=e;return(0,n.jsx)("span",{className:"inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium ".concat(function(e){let t=e.toLowerCase();return"feature"===t||"new"===t?"bg-indigo-600 text-white dark:bg-indigo-500":"fix"===t||"bugfix"===t?"bg-red-100 text-red-800 dark:bg-red-900/60 dark:text-red-200":"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-200"}(t)),children:t})}function b(){return(0,n.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full border border-gray-300 px-1.5 py-0.5 text-[10px] font-medium text-gray-600 dark:border-gray-600 dark:text-gray-300",children:"Draft"})}function w(e){var t,r,a,o;let{entries:l,siblingCta:u="app",providerName:c=null}=e,[d,h]=(0,i.useState)(null!=(r=null==(t=l[0])?void 0:t.id)?r:null);(0,i.useEffect)(()=>{l.length&&!l.some(e=>e.id===d)&&h(l[0].id)},[l,d]);let f=null!=(o=null!=(a=l.find(e=>e.id===d))?a:l[0])?o:null;return l.length?(0,n.jsxs)("div",{className:"grid min-h-0 flex-1 grid-cols-1 gap-4 md:grid-cols-[240px_1fr]",children:[(0,n.jsx)("nav",{className:"min-h-0 overflow-y-auto md:border-r md:border-gray-200 md:pr-2 md:dark:border-gray-700","aria-label":"Product updates",children:(0,n.jsx)("ul",{className:"space-y-1",children:l.map(e=>{let t=e.id===(null==f?void 0:f.id);return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",onClick:()=>h(e.id),"aria-current":t?"true":void 0,className:"w-full rounded-md px-3 py-2 text-left transition-colors ".concat(t?"bg-gray-100 dark:bg-gray-700":"hover:bg-gray-50 dark:hover:bg-gray-700/60"),children:[(0,n.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-gray-500 dark:text-gray-400",children:y(e.published_at)}),(0,n.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5 text-sm font-medium text-gray-900 dark:text-white",children:[(0,n.jsx)("span",{className:"truncate",children:e.title}),!e.is_published&&(0,n.jsx)(b,{})]})]})},e.id)})})}),(0,n.jsx)("article",{className:"min-h-0 overflow-y-auto pr-1",children:f&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400",children:y(f.published_at,"long")}),(0,n.jsxs)("h3",{className:"mt-1 flex flex-wrap items-center gap-2 text-lg font-semibold text-gray-900 dark:text-white",children:[f.title,f.type_tags.map(e=>(0,n.jsx)(v,{tag:e},e)),!f.is_published&&(0,n.jsx)(b,{})]}),f.area&&(0,n.jsx)("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:f.area}),(0,n.jsx)("hr",{className:"my-3 border-gray-200 dark:border-gray-700"}),f.media_url&&(0,n.jsx)(x,{url:f.media_url,title:f.title}),(0,n.jsx)("div",{className:"prose prose-sm prose-indigo max-w-none dark:prose-invert",children:(0,n.jsx)(s.o,{children:f.body||"_No details._"})}),(0,n.jsx)(m,{entry:f,mode:u,providerName:c})]})})]}):(0,n.jsx)("div",{className:"flex h-full min-h-[200px] items-center justify-center text-sm text-gray-500 dark:text-gray-400",children:"No updates yet — check back soon."})}function x(e){let{url:t,title:r}=e,i=/\.(mp4|webm|mov)(\?|$)/i.test(t);return(0,n.jsx)("div",{className:"mb-3 overflow-hidden rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-900",children:i?(0,n.jsx)("video",{src:t,controls:!0,"aria-label":r,className:"max-h-[320px] w-full"}):(0,n.jsx)("img",{src:t,alt:r,className:"max-h-[320px] w-full object-cover"})})}},63200:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]])},63786:(e,t,r)=>{"use strict";
34Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useIntersection",{enumerable:!0,get:function(){return l}});let n=r(14232),i=r(43273),s="function"==typeof IntersectionObserver,a=new Map,o=[];function l(e){let{rootRef:t,rootMargin:r,disabled:l}=e,u=l||!s,[c,d]=(0,n.useState)(!1),h=(0,n.useRef)(null),f=(0,n.useCallback)(e=>{h.current=e},[]);return(0,n.useEffect)(()=>{if(s){if(u||c)return;let e=h.current;if(e&&e.tagName)return function(e,t,r){let{id:n,observer:i,elements:s}=function(e){let t,r={root:e.root||null,margin:e.rootMargin||""},n=o.find(e=>e.root===r.root&&e.margin===r.margin);if(n&&(t=a.get(n)))return t;let i=new Map;return t={id:r,observer:new IntersectionObserver(e=>{e.forEach(e=>{let t=i.get(e.target),r=e.isIntersecting||e.intersectionRatio>0;t&&r&&t(r)})},e),elements:i},o.push(r),a.set(r,t),t}(r);return s.set(e,t),i.observe(e),function(){if(s.delete(e),i.unobserve(e),0===s.size){i.disconnect(),a.delete(n);let e=o.findIndex(e=>e.root===n.root&&e.margin===n.margin);e>-1&&o.splice(e,1)}}}(e,e=>e&&d(e),{root:null==t?void 0:t.current,rootMargin:r})}else if(!c){let e=(0,i.requestIdleCallback)(()=>d(!0));return()=>(0,i.cancelIdleCallback)(e)}},[u,r,t,c,h.current]),[f,c,(0,n.useCallback)(()=>{d(!1)},[])]}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},63906:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},65454:()=>{},66720:e=>{var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e){return e?e.replace(l,""):""}e.exports=function(e,l){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];l=l||{};var c=1,d=1;function h(e){var t=e.match(r);t&&(c+=t.length);var n=e.lastIndexOf("\n");d=~n?e.length-n:d+e.length}function f(){var e={line:c,column:d};return function(t){return t.position=new p(e),y(n),t}}function p(e){this.start=e,this.end={line:c,column:d},this.source=l.source}p.prototype.content=e;var g=[];function m(t){var r=Error(l.source+":"+c+":"+d+": "+t);if(r.reason=t,r.filename=l.source,r.line=c,r.column=d,r.source=e,l.silent)g.push(r);else throw r}function y(t){var r=t.exec(e);if(r){var n=r[0];return h(n),e=e.slice(n.length),r}}function v(e){var t;for(e=e||[];t=b();)!1!==t&&e.push(t);return e}function b(){var t=f();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var r=2;""!=e.charAt(r)&&("*"!=e.charAt(r)||"/"!=e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return m("End of comment missing");var n=e.slice(2,r-2);return d+=2,h(n),e=e.slice(r),d+=2,t({type:"comment",comment:n})}}y(n);var w,x=[];for(v(x);w=function(){var e=f(),r=y(i);if(r){if(b(),!y(s))return m("property missing ':'");var n=y(a),l=e({type:"declaration",property:u(r[0].replace(t,"")),value:n?u(n[0].replace(t,"")):""});return y(o),l}}();)!1!==w&&(x.push(w),v(x));return x}},67711:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});let n=r(4902).__importDefault(r(59341));class i extends n.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){let r=Array.from(new Set(t)).map(e=>"string"==typeof e&&RegExp("[,()]").test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:n}={}){let i="";"plain"===n?i="pl":"phrase"===n?i="ph":"websearch"===n&&(i="w");let s=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${i}fts${s}.${t}`),this}match(e){return Object.entries(e).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}}t.default=i},68693:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},69122:(e,t,r)=>{"use strict";
34Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"notFound",{enumerable:!0,get:function(){return i}});let n=""+r(38811).HTTP_ERROR_FALLBACK_ERROR_CODE+";404";function i(){let e=Object.defineProperty(Error(n),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});throw e.digest=n,e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},69591:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ReadonlyURLSearchParams:function(){return c},RedirectType:function(){return i.RedirectType},forbidden:function(){return a.forbidden},notFound:function(){return s.notFound},permanentRedirect:function(){return n.permanentRedirect},redirect:function(){return n.redirect},unauthorized:function(){return o.unauthorized},unstable_isUnrecognizedActionError:function(){return d},unstable_rethrow:function(){return l.unstable_rethrow}});let n=r(75026),i=r(61481),s=r(69122),a=r(79331),o=r(90376),l=r(18444);class u extends Error{constructor(){super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams")}}class c extends URLSearchParams{append(){throw new u}delete(){throw new u}set(){throw new u}sort(){throw new u}}function d(){throw Object.defineProperty(Error("`unstable_isUnrecognizedActionError` can only be used on the client."),"__NEXT_ERROR_CODE",{value:"E776",enumerable:!1,configurable:!0})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},70251:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]])},73305:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]])},73884:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])},73908:(e,t,r)=>{"use strict";r.d(t,{U:()=>c,w:()=>u});var n=r(37876),i=r(14232);let s=(0,i.createContext)(void 0),a=["workforce","technology","operations"],o={workforce:["turnover_rate","process_automation","skills_gap","remote_work","training_investment","current_training"],technology:["automation_level","data_management","cloud_infrastructure","system_integration","tech_investment"],operations:["process_efficiency","error_rates","customer_response","supply_chain","resource_utilization","resource_limitations"]},l={currentSection:"workforce",currentSubsection:"turnover_rate",data:{workforce:{turnoverRate:null,turnoverReasons:[],processAutomation:{level:null,barriers:null,manualProcesses:[]},skillsGap:{assessment:null,priorities:[]},remoteWork:{capabilities:[],challenges:[],infrastructure:null},trainingInvestment:{level:null,barriers:null},currentTraining:{methods:{onTheJob:null,selfPaced:null,instructorLed:null,peerLearning:null,onlineCourses:null}}},technology:{automationLevel:{maturity:null,currentTools:[],targetAreas:[]},dataManagement:{dataQuality:null,dataGovernance:null,dataAccessibility:null,analyticsCapability:null}
34,cloudInfrastructure:{adoptionLevel:null,services:[],barriers:[]},systemIntegration:{maturityLevel:null,integrationMethods:[],challenges:[]},techInvestment:{level:null,priorities:[],barriers:[]}},operations:{processEfficiency:{level:null,bottlenecks:[],improvementAreas:[]},errorRates:{level:null,commonErrors:[],impactAreas:[]},customerResponse:{level:null,channels:[],painPoints:[]},supplyChain:{level:null,vulnerabilities:[],mitigations:[]},resourceUtilization:{level:null,constraints:[],opportunities:[]}}},progress:{workforce:{completed:!1,subsections:{turnover_rate:!1,process_automation:!1,skills_gap:!1,remote_work:!1,training_investment:!1,current_training:!1}},technology:{completed:!1,subsections:{automation_level:!1,data_management:!1,cloud_infrastructure:!1,system_integration:!1,tech_investment:!1}},operations:{completed:!1,subsections:{process_efficiency:!1,error_rates:!1,customer_response:!1,supply_chain:!1,resource_utilization:!1,resource_limitations:!1}}}},u=e=>{let{children:t}=e,[r,u]=(0,i.useState)(l);return(0,n.jsx)(s.Provider,{value:{state:r,updateWorkforceData:e=>{u(t=>({...t,data:{...t.data,workforce:{...t.data.workforce,...e}}}))},updateTechnologyData:e=>{u(t=>({...t,data:{...t.data,technology:{...t.data.technology,...e}}}))},updateOperationsData:e=>{u(t=>({...t,data:{...t.data,operations:{...t.data.operations,...e}}}))},moveToNextSubsection:()=>{u(e=>{let t=a.indexOf(e.currentSection),r=o[e.currentSection],n=r.indexOf(e.currentSubsection);if(n<r.length-1)return{...e,currentSubsection:r[n+1]};if(t<a.length-1){let r=a[t+1];return{...e,currentSection:r,currentSubsection:o[r][0]}}return e})},moveToPreviousSubsection:()=>{u(e=>{let t=a.indexOf(e.currentSection),r=o[e.currentSection],n=r.indexOf(e.currentSubsection);if(n>0)return{...e,currentSubsection:r[n-1]};if(t>0){let r=a[t-1],n=o[r];return{...e,currentSection:r,currentSubsection:n[n.length-1]}}return e})},saveAndExit:()=>{}},children:t})},c=()=>{let e=(0,i.useContext)(s);if(void 0===e)throw Error("useAssessment must be used within an AssessmentProvider");return e}},74761:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});let n=r(4902),i=n.__importDefault(r(15997)),s=n.__importDefault(r(67711));class a{constructor(e,{headers:t={},schema:r,fetch:n}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.fetch=n}from(e){let t=new URL(`${this.url}/${e}`);return new i.default(t,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new a(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:n=!1,count:i}={}){var a;let o,l,u=new URL(`${this.url}/rpc/${e}`);r||n?(o=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{u.searchParams.append(e,t)})):(o="POST",l=t);let c=new Headers(this.headers);return i&&c.set("Prefer",`count=${i}`),new s.default({method:o,url:u,headers:c,schema:this.schemaName,body:l,fetch:null!=(a=this.fetch)?a:fetch})}}t.default=a},75026:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{getRedirectError:function(){return a},getRedirectStatusCodeFromError:function(){return d},getRedirectTypeFromError:function(){return c},getURLFromRedirectError:function(){return u},permanentRedirect:function(){return l},redirect:function(){return o}});let n=r(46843),i=r(61481),s=void 0;function a(e,t,r){void 0===r&&(r=n.RedirectStatusCode.TemporaryRedirect);let s=Object.defineProperty(Error(i.REDIRECT_ERROR_CODE),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return s.digest=i.REDIRECT_ERROR_CODE+";"+t+";"+e+";"+r+";",s}function o(e,t){var r;throw null!=t||(t=(null==s||null==(r=s.getStore())?void 0:r.isAction)?i.RedirectType.push:i.RedirectType.replace),a(e,t,n.RedirectStatusCode.TemporaryRedirect)}function l(e,t){throw void 0===t&&(t=i.RedirectType.replace),a(e,t,n.RedirectStatusCode.PermanentRedirect)}function u(e){return(0,i.isRedirectError)(e)?e.digest.split(";").slice(2,-2).join(";"):null}function c(e){if(!(0,i.isRedirectError)(e))throw Object.defineProperty(Error("Not a redirect error"),"__NEXT_ERROR_CODE",{value:"E260",enumerable:!1,
34configurable:!0});return e.digest.split(";",2)[1]}function d(e){if(!(0,i.isRedirectError)(e))throw Object.defineProperty(Error("Not a redirect error"),"__NEXT_ERROR_CODE",{value:"E260",enumerable:!1,configurable:!0});return Number(e.digest.split(";").at(-2))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77328:(e,t,r)=>{e.exports=r(29269)},78881:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]])},79331:(e,t,r)=>{"use strict";function n(){throw Object.defineProperty(Error("`forbidden()` is experimental and only allowed to be enabled when `experimental.authInterrupts` is enabled."),"__NEXT_ERROR_CODE",{value:"E488",enumerable:!1,configurable:!0})}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"forbidden",{enumerable:!0,get:function(){return n}}),r(38811).HTTP_ERROR_FALLBACK_ERROR_CODE,("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},80310:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},83817:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{UnrecognizedActionError:function(){return r},unstable_isUnrecognizedActionError:function(){return n}});class r extends Error{constructor(...e){super(...e),this.name="UnrecognizedActionError"}}function n(e){return!!(e&&"object"==typeof e&&e instanceof r)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},84300:(e,t,r)=>{"use strict";r.d(t,{R:()=>d});var n=r(14232),i=r(13415);let s={free:{workspaces:1,projects:1,team_members:1,assessments:10,api_calls:100,nlp_tokens:25e3},business:{workspaces:1,projects:10,team_members:1,assessments:100,api_calls:1e3,nlp_tokens:5e5},agency:{workspaces:15,projects:1/0,team_members:1/0,assessments:1/0,api_calls:1/0,nlp_tokens:2e6}};async function a(e,t){var r;let n={...s[e]};if(!t)return n;let{data:a}=await i.N.from("subscription_plans").select("limits").eq("tier",t).eq("is_active",!0).maybeSingle();for(let[e,t]of Object.entries(null!=(r=null==a?void 0:a.limits)?r:{}))"number"==typeof t&&e in n&&(n[e]=t);return n}async function o(e,t,r){try{let{data:n,error:s}=await i.N.rpc("get_usage",{p_user_id:e,p_workspace_id:t,p_metric_name:r});if(s)return console.error("Error getting usage:",s),0;return n||0}catch(e){return console.error("Error getting usage:",e),0}}async function l(e){try{let{data:r,error:n}=await i.N.from("subscriptions").select("tier, plan, status").eq("user_id",e).single();if(n||!r)return{tier:"free",plan:null};if("active"===r.status||"trialing"===r.status){var t;return{tier:r.tier,plan:null!=(t=r.plan)?t:null}}return{tier:"free",plan:null}}catch(e){return console.error("Error getting user plan:",e),{tier:"free",plan:null}}}async function u(e,t){let{tier:r,plan:n}=await l(e),i=await a(r,n),s={},u=!1,c=!1;for(let r of["workspaces","projects","team_members","assessments","api_calls","nlp_tokens"]){let n=await o(e,t,r),a=i[r],l=a===1/0?0:Math.round(n/a*100),d=a!==1/0&&n>=a,h=a!==1/0&&l>=80;s[r]={metric:r,current:n,limit:a,percentage:l,isAtLimit:d,isNearLimit:h},d?c=!0:h&&(u=!0)}return{tier:r,plan:n,usage:s,overallHealth:c?"critical":u?"warning":"good"}}var c=r(17933);
34function d(e){let[t,r]=(0,n.useState)({subscription:null,tier:"free",isLoading:!0,error:null,usage:null}),s=(0,n.useCallback)(async()=>{try{let{data:{user:t}}=await i.N.auth.getUser();if(!t)return void r(e=>({...e,isLoading:!1}));let{data:n,error:s}=await i.N.from("subscriptions").select("*").eq("user_id",t.id).single();if(s&&"PGRST116"!==s.code){console.error("Error fetching subscription:",s),r(e=>({...e,isLoading:!1,error:"Failed to load subscription"}));return}let a=(null==n?void 0:n.status)==="active"||(null==n?void 0:n.status)==="trialing"?n.tier:"free",o=await u(t.id,e||null);r({subscription:n?(0,c.hb)(n):null,tier:a,isLoading:!1,error:null,usage:o})}catch(e){console.error("Error in useSubscription:",e),r(e=>({...e,isLoading:!1,error:"Failed to load subscription data"}))}},[e]);(0,n.useEffect)(()=>{s();let e=i.N.channel("subscription_changes").on("postgres_changes",{event:"*",schema:"public",table:"subscriptions"},()=>{s()}).subscribe();return()=>{i.N.removeChannel(e)}},[s]);let a=(0,n.useCallback)(()=>{r(e=>({...e,isLoading:!0})),s()},[s]);return{...t,refresh:a}}},88220:e=>{!function(){var t={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,s=l(e),a=s[0],o=s[1],u=new i((a+o)*3/4-o),c=0,d=o>0?a-4:a;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],a=0,o=n-i;a<o;a+=16383)s.push(function(e,t,n){for(var i,s=[],a=t;a<n;a+=3)i=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}(e,a,a+16383>o?o:a+16383));return 1===i?s.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&s.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),s.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=s.length;a<o;++a)r[a]=s[a],n[s.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),i=r(783),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!o.isEncoding(i))throw TypeError("Unknown encoding: "+i);var s=0|f(n,i),l=a(s),u=l.write(n,i);return u!==s&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return d(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(O(e,ArrayBuffer)||e&&O(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(O(e,SharedArrayBuffer)||e&&O(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),o.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return o.from(c,t,r);var p=function(e){if(o.isBuffer(e)){var t=0|h(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(p)return p;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');
vendor: 16,517 bytes, line 34
34if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),a(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(u(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)};function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||O(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return A(e).length;default:if(i)return n?-1:E(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){var i,s,a,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s<r;++s)i+=C[e[s]];return i}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,s=t,a=r,0===s&&a===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(s,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){var s;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var s,a=1,o=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,o/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(s=r;s<o;s++)if(u(e,s)===u(t,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===l)return c*a}else -1!==c&&(s-=s-c),c=-1}else for(r+l>o&&(r=o-l),s=r;s>=0;s--){for(var d=!0,h=0;h<l;h++)if(u(e,s+h)!==u(t,h)){d=!1;break}if(d)return s}return -1}o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(O(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),O(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(O(s,Uint8Array)&&(s=o.from(s)),!o.isBuffer(s))throw TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(o.prototype[s]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(O(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var s=i-n,a=r-t,l=Math.min(s,a),u=this.slice(n,i),c=e.slice(t,r),d=0;d<l;++d)if(u[d]!==c[d]){s=u[d],a=c[d];break}return s<a?-1:+(a<s)},o.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)};function v(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s,a,o,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:(192&(s=e[i+1]))==128&&(l=(31&u)<<6|63&s)>127&&(c=l);break;case 3:s=e[i+1],a=e[i+2],(192&s)==128&&(192&a)==128&&(l=(15&u)<<12|(63&s)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:s=e[i+1],a=e[i+2],o=e[i+3],(192&s)==128&&(192&a)==128&&(192&o)==128&&(l=(15&u)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d}var h=n,f=h.length;if(f<=4096)return String.fromCharCode.apply(String,h);for(var p="",g=0;g<f;)p+=String.fromCharCode.apply(String,h.slice(g,g+=4096));return p}function b(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function w(e,t,r,n,i,s){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function x(e,t,r,n,i,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,n,s){return t*=1,r>>>=0,s||x(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function _(e,t,r,n,s){return t*=1,r>>>=0,s||x(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,s,a,o,l,u,c,d,h=this.length-t;if((void 0===r||r>h)&&(r=h),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var f=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;n>s/2&&(n=s/2);for(var a=0;a<n;++a){var o,l=parseInt(t.substr(2*a,2),16);if((o=l)!=o)break;e[r+a]=l}return a}(this,e,t,r);case"utf8":case"utf-8":return i=t,s=r,T(E(e,this.length-i),this,i,s);case"ascii":return a=t,o=r,T(j(e),this,a,o);case"latin1":case"binary":return function(e,t,r,n){return T(j(t),e,r,n)}(this,e,t,r);case"base64":return l=t,u=r,T(A(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,d=r,T(function(e,t){for(var r,n,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,d);default:if(f)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),f=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},o.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var s=1,a=0;for(this[t]=255&e;++a<r&&(s*=256);)this[t+a]=e/s&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;w(this,e,t,r,i,0)}var s=r-1,a=1;for(this[t+s]=255&e;--s>=0&&(a*=256);)this[t+s]=e/a&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var s=0,a=1,o=0;for(this[t]=255&e;++s<r&&(a*=256);)e<0&&0===o&&0!==this[t+s-1]&&(o=1),this[t+s]=(e/a|0)-o&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);w(this,e,t,r,i-1,-i)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a|0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return _(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return _(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var s=i-1;s>=0;--s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,s=e.charCodeAt(0);("utf8"===n&&s<128||"latin1"===n)&&(e=s)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var a=o.isBuffer(e)?e:o.from(e,n),l=a.length;
34if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%l]}return this};var S=/[^+/0-9A-Za-z-_]/g;function E(e,t){t=t||1/0;for(var r,n=e.length,i=null,s=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319||a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function j(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function A(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function O(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var C=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,n,i){var s,a,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,d=r?i-1:0,h=r?-1:1,f=e[t+d];for(d+=h,s=f&(1<<-c)-1,f>>=-c,c+=o;c>0;s=256*s+e[t+d],d+=h,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+e[t+d],d+=h,c-=8);if(0===s)s=1-u;else{if(s===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),s-=u}return(f?-1:1)*a*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var a,o,l,u=8*s-i-1,c=(1<<u)-1,d=c>>1,h=5960464477539062e-23*(23===i),f=n?0:s-1,p=n?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(a++,l/=2),a+d>=c?(o=0,a=c):a+d>=1?(o=(t*l-1)*Math.pow(2,i),a+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&o,f+=p,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*g}}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var s=r[e]={exports:{}},a=!0;try{t[e](s,s.exports,n),a=!1}finally{a&&delete r[e]}return s.exports}n.ab="//",e.exports=n(72)}()},88628:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]])},88992:(e,t,r)=>{"use strict";r.d(t,{Gb:()=>w,Jt:()=>d,hZ:()=>p,mN:()=>X});var n=r(14232),i=e=>e instanceof Date,s=e=>null==e,a=e=>!s(e)&&!Array.isArray(e)&&"object"==typeof e&&!i(e),o="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function l(e){let t,r=Array.isArray(e),n="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(!(o&&(e instanceof Blob||n))&&(r||a(e))))return e;else if(t=r?[]:{},r||(e=>{let t=e.constructor&&e.constructor.prototype;return a(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(let r in e)e.hasOwnProperty(r)&&(t[r]=l(e[r]));else t=e;return t}var u=e=>Array.isArray(e)?e.filter(Boolean):[],c=e=>void 0===e,d=(e,t,r)=>{if(!t||!a(e))return r;let n=u(t.split(/[,[\].]+?/)).reduce((e,t)=>s(e)?e:e[t],e);return c(n)||n===e?c(e[t])?r:e[t]:n},h=e=>/^\w*$/.test(e),f=e=>u(e.replace(/["|']|\]/g,"").split(/\.|\[/)),p=(e,t,r)=>{let n=-1,i=h(t)?[t]:f(t),s=i.length,o=s-1;for(;++n<s;){let t=i[n],s=r;if(n!==o){let r=e[t];
34s=a(r)||Array.isArray(r)?r:isNaN(+i[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}return e};let g={BLUR:"blur",FOCUS_OUT:"focusout"},m={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},y={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};n.createContext(null);var v=e=>a(e)&&!Object.keys(e).length,b=e=>Array.isArray(e)?e:[e],w=(e,t,r,n,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:i||!0}}:{},x=e=>({isOnSubmit:!e||e===m.onSubmit,isOnBlur:e===m.onBlur,isOnChange:e===m.onChange,isOnAll:e===m.all,isOnTouch:e===m.onTouched}),k=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let _=(e,t,r,n)=>{for(let i of r||Object.keys(e)){let r=d(e,i);if(r){let{_f:e,...s}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!n)return!0;else if(e.ref&&t(e.ref,e.name)&&!n)return!0;else if(_(s,t))break}else if(a(s)&&_(s,t))break}}};var S=(e,t,r)=>{let n=b(d(e,r));return p(n,"root",t[r]),p(e,r,n),e},E=e=>"function"==typeof e,j=e=>{if(!o)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},A=e=>"string"==typeof e;let T={value:!1,isValid:!1},O={value:!0,isValid:!0};var C=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!c(e[0].attributes.value)?c(e[0].value)||""===e[0].value?O:{value:e[0].value,isValid:!0}:O:T}return T};let N={isValid:!1,value:null};var I=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,N):N;function P(e,t,r="validate"){if(A(e)||Array.isArray(e)&&e.every(A)||"boolean"==typeof e&&!e)return{type:r,message:A(e)?e:"",ref:t}}var R=e=>!a(e)||e instanceof RegExp?{value:e,message:""}:e,L=async(e,t,r,n,i)=>{let{ref:o,refs:l,required:u,maxLength:h,minLength:f,min:p,max:g,pattern:m,validate:b,name:x,valueAsNumber:k,mount:_,disabled:S}=e._f,T=d(t,x);if(!_||S)return{};let O=l?l[0]:o,N=e=>{n&&O.reportValidity&&(O.setCustomValidity("boolean"==typeof e?"":e||""),O.reportValidity())},L={},D="radio"===o.type,M="checkbox"===o.type,U=(k||"file"===o.type)&&c(o.value)&&c(T)||j(o)&&""===o.value||""===T||Array.isArray(T)&&!T.length,$=w.bind(null,x,r,L),F=(e,t,r,n=y.maxLength,i=y.minLength)=>{let s=e?t:r;L[x]={type:e?n:i,message:s,ref:o,...$(e?n:i,s)}};if(i?!Array.isArray(T)||!T.length:u&&(!(D||M)&&(U||s(T))||"boolean"==typeof T&&!T||M&&!C(l).isValid||D&&!I(l).isValid)){let{value:e,message:t}=A(u)?{value:!!u,message:u}:R(u);if(e&&(L[x]={type:y.required,message:t,ref:O,...$(y.required,t)},!r))return N(t),L}if(!U&&(!s(p)||!s(g))){let e,t,n=R(g),i=R(p);if(s(T)||isNaN(T)){let r=o.valueAsDate||new Date(T),s=e=>new Date(new Date().toDateString()+" "+e),a="time"==o.type,l="week"==o.type;"string"==typeof n.value&&T&&(e=a?s(T)>s(n.value):l?T>n.value:r>new Date(n.value)),"string"==typeof i.value&&T&&(t=a?s(T)<s(i.value):l?T<i.value:r<new Date(i.value))}else{let r=o.valueAsNumber||(T?+T:T);s(n.value)||(e=r>n.value),s(i.value)||(t=r<i.value)}if((e||t)&&(F(!!e,n.message,i.message,y.max,y.min),!r))return N(L[x].message),L}if((h||f)&&!U&&("string"==typeof T||i&&Array.isArray(T))){let e=R(h),t=R(f),n=!s(e.value)&&T.length>+e.value,i=!s(t.value)&&T.length<+t.value;if((n||i)&&(F(n,e.message,t.message),!r))return N(L[x].message),L}if(m&&!U&&"string"==typeof T){let{value:e,message:t}=R(m);if(e instanceof RegExp&&!T.match(e)&&(L[x]={type:y.pattern,message:t,ref:o,...$(y.pattern,t)},!r))return N(t),L}if(b){if(E(b)){let e=P(await b(T,t),O);if(e&&(L[x]={...e,...$(y.validate,e.message)},!r))return N(e.message),L}else if(a(b)){let e={};for(let n in b){if(!v(e)&&!r)break;let i=P(await b[n](T,t),O,n);i&&(e={...i,...$(n,i.message)},N(i.message),r&&(L[x]=e))}if(!v(e)&&(L[x]={ref:O,...e},!r))return L}}return N(!0),L};function D(e,t){let r=Array.isArray(t)?t:h(t)?[t]:f(t),n=1===r.length?e:function(e,t){let r=t.slice(0,-1).length,n=0;for(;n<r;)e=c(e)?n++:e[t[n++]];return e}(e,r),i=r.length-1,s=r[i];return n&&delete n[s],0!==i&&(a(n)&&v(n)||Array.isArray(n)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!c(e[t]))return!1;return!0}(n))&&D(e,r.slice(0,-1)),e}var M=()=>{let e=[];return{get observers(){return e},next:t=>{for(let r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},U=e=>s(e)||"object"!=typeof e;function $(e,t){if(U(e)||U(t))return e===t;if(i(e)&&i(t))return e.getTime()===t.getTime();let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;
34for(let s of r){let r=e[s];if(!n.includes(s))return!1;if("ref"!==s){let e=t[s];if(i(r)&&i(e)||a(r)&&a(e)||Array.isArray(r)&&Array.isArray(e)?!$(r,e):r!==e)return!1}}return!0}var F=e=>j(e)&&e.isConnected,B=e=>{for(let t in e)if(E(e[t]))return!0;return!1};function z(e,t={}){let r=Array.isArray(e);if(a(e)||r)for(let r in e)Array.isArray(e[r])||a(e[r])&&!B(e[r])?(t[r]=Array.isArray(e[r])?[]:{},z(e[r],t[r])):s(e[r])||(t[r]=!0);return t}var q=(e,t)=>(function e(t,r,n){let i=Array.isArray(t);if(a(t)||i)for(let i in t)Array.isArray(t[i])||a(t[i])&&!B(t[i])?c(r)||U(n[i])?n[i]=Array.isArray(t[i])?z(t[i],[]):{...z(t[i])}:e(t[i],s(r)?{}:r[i],n[i]):n[i]=!$(t[i],r[i]);return n})(e,t,z(t)),V=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>c(e)?e:t?""===e?NaN:e?+e:e:r&&"string"==typeof e?new Date(e):n?n(e):e;function H(e){let t=e.ref;if(e.refs?!e.refs.every(e=>e.disabled):!t.disabled)return"file"===t.type?t.files:"radio"===t.type?I(e.refs).value:"select-multiple"===t.type?[...t.selectedOptions].map(({value:e})=>e):"checkbox"===t.type?C(e.refs).value:V(c(t.value)?e.ref.value:t.value,e)}var W=e=>c(e)?e:e instanceof RegExp?e.source:a(e)?e.value instanceof RegExp?e.value.source:e.value:e;let K="AsyncFunction";var J=e=>!!e&&!!e.validate&&!!(E(e.validate)&&e.validate.constructor.name===K||a(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===K));function G(e,t,r){let n=d(e,r);if(n||h(r))return{error:n,name:r};let i=r.split(".");for(;i.length;){let n=i.join("."),s=d(t,n),a=d(e,n);if(s&&!Array.isArray(s)&&r!==n)break;if(a&&a.type)return{name:n,error:a};i.pop()}return{name:r}}let Y={mode:m.onSubmit,reValidateMode:m.onChange,shouldFocusError:!0};function X(e={}){let t=n.useRef(void 0),r=n.useRef(void 0),[h,f]=n.useState({isDirty:!1,isValidating:!1,isLoading:E(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:E(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...function(e={}){let t,r={...Y,...e},n={submitCount:0,isDirty:!1,isLoading:E(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},h={},f=(a(r.defaultValues)||a(r.values))&&l(r.defaultValues||r.values)||{},y=r.shouldUnregister?{}:l(f),w={action:!1,mount:!1,watch:!1},A={mount:new Set,unMount:new Set,array:new Set,watch:new Set},T=0,O={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},C={values:M(),array:M(),state:M()},N=x(r.mode),I=x(r.reValidateMode),P=r.criteriaMode===m.all,R=async e=>{if(!r.disabled&&(O.isValid||e)){let e=r.resolver?v((await K()).errors):await Z(h,!0);e!==n.isValid&&C.state.next({isValid:e})}},U=(e,t)=>{!r.disabled&&(O.isValidating||O.validatingFields)&&((e||Array.from(A.mount)).forEach(e=>{e&&(t?p(n.validatingFields,e,t):D(n.validatingFields,e))}),C.state.next({validatingFields:n.validatingFields,isValidating:!v(n.validatingFields)}))},B=(e,t,r,n)=>{let i=d(h,e);if(i){let s=d(y,e,c(r)?d(f,e):r);c(s)||n&&n.defaultChecked||t?p(y,e,t?s:H(i._f)):et(e,s),w.mount&&R()}},z=(e,t,i,s,a)=>{let o=!1,l=!1,u={name:e};if(!r.disabled){let r=!!(d(h,e)&&d(h,e)._f&&d(h,e)._f.disabled);if(!i||s){O.isDirty&&(l=n.isDirty,n.isDirty=u.isDirty=Q(),o=l!==u.isDirty);let i=r||$(d(f,e),t);l=!!(!r&&d(n.dirtyFields,e)),i||r?D(n.dirtyFields,e):p(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,o=o||O.dirtyFields&&!i!==l}if(i){let t=d(n.touchedFields,e);t||(p(n.touchedFields,e,i),u.touchedFields=n.touchedFields,o=o||O.touchedFields&&t!==i)}o&&a&&C.state.next(u)}return o?u:{}},K=async e=>{U(e,!0);let t=await r.resolver(y,r.context,((e,t,r,n)=>{let i={};for(let r of e){let e=d(t,r);e&&p(i,r,e._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:n}})(e||A.mount,h,r.criteriaMode,r.shouldUseNativeValidation));return U(e),t},X=async e=>{let{errors:t}=await K(e);if(e)for(let r of e){let e=d(t,r);e?p(n.errors,r,e):D(n.errors,r)}else n.errors=t;return t},Z=async(e,t,i={valid:!0})=>{for(let s in e){let a=e[s];if(a){let{_f:e,...o}=a;if(e){let o=A.array.has(e.name),l=a._f&&J(a._f);l&&O.validatingFields&&U([s],!0);let u=await L(a,y,P,r.shouldUseNativeValidation&&!t,o);if(l&&O.validatingFields&&U([s]),u[e.name]&&(i.valid=!1,t))break;t||(d(u,e.name)?o?S(n.errors,u,e.name):p(n.errors,e.name,u[e.name]):D(n.errors,e.name))}v(o)||await Z(o,t,i)}}return i.valid},Q=(e,t)=>!r.disabled&&(e&&t&&p(y,e,t),!$(eo(),f)),ee=(e,t,r)=>{let n,i,s,a,o;return n=e,i=A,s={...w.mount?y:c(t)?f:"string"==typeof e?{[e]:t}:t},a=r,o=t,"string"==typeof n?(a&&i.watch.add(n),d(s,n,o)):Array.isArray(n)?n.map(e=>(a&&i.watch.add(e),d(s,e))):(a&&(i.watchAll=!0),s)},et=(e,t,r={})=>{let n=d(h,e),i=t;if(n){let r=n._f;r&&(r.disabled||p(y,e,V(t,r)),i=j(r.ref)&&s(t)?"":t,"select-multiple"===r.ref.type?[...r.ref.options].forEac
34h(e=>e.selected=i.includes(e.value)):r.refs?"checkbox"===r.ref.type?r.refs.length>1?r.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find(t=>t===e.value):i===e.value)):r.refs[0]&&(r.refs[0].checked=!!i):r.refs.forEach(e=>e.checked=e.value===i):"file"===r.ref.type?r.ref.value="":(r.ref.value=i,r.ref.type||C.values.next({name:e,values:{...y}})))}(r.shouldDirty||r.shouldTouch)&&z(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&ea(e)},er=(e,t,r)=>{for(let n in t){let s=t[n],o=`${e}.${n}`,l=d(h,o);(A.array.has(e)||a(s)||l&&!l._f)&&!i(s)?er(o,s,r):et(o,s,r)}},en=(e,t,r={})=>{let i=d(h,e),a=A.array.has(e),o=l(t);p(y,e,o),a?(C.array.next({name:e,values:{...y}}),(O.isDirty||O.dirtyFields)&&r.shouldDirty&&C.state.next({name:e,dirtyFields:q(f,y),isDirty:Q(e,o)})):!i||i._f||s(o)?et(e,o,r):er(e,o,r),k(e,A)&&C.state.next({...n}),C.values.next({name:w.mount?e:void 0,values:{...y}})},ei=async e=>{w.mount=!0;let s=e.target,o=s.name,l=!0,u=d(h,o),c=e=>{l=Number.isNaN(e)||i(e)&&isNaN(e.getTime())||$(e,d(y,o,e))};if(u){let i,w,M,F=s.type?H(u._f):a(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,B=e.type===g.BLUR||e.type===g.FOCUS_OUT,q=!((M=u._f).mount&&(M.required||M.min||M.max||M.maxLength||M.minLength||M.pattern||M.validate))&&!r.resolver&&!d(n.errors,o)&&!u._f.deps||(f=B,m=d(n.touchedFields,o),b=n.isSubmitted,x=I,!(_=N).isOnAll&&(!b&&_.isOnTouch?!(m||f):(b?x.isOnBlur:_.isOnBlur)?!f:(b?!x.isOnChange:!_.isOnChange)||f)),V=k(o,A,B);p(y,o,F),B?(u._f.onBlur&&u._f.onBlur(e),t&&t(0)):u._f.onChange&&u._f.onChange(e);let W=z(o,F,B,!1),J=!v(W)||V;if(B||C.values.next({name:o,type:e.type,values:{...y}}),q)return O.isValid&&("onBlur"===r.mode?B&&R():R()),J&&C.state.next({name:o,...V?{}:W});if(!B&&V&&C.state.next({...n}),r.resolver){let{errors:e}=await K([o]);if(c(F),l){let t=G(n.errors,h,o),r=G(e,h,t.name||o);i=r.error,o=r.name,w=v(e)}}else U([o],!0),i=(await L(u,y,P,r.shouldUseNativeValidation))[o],U([o]),c(F),l&&(i?w=!1:O.isValid&&(w=await Z(h,!0)));if(l){u._f.deps&&ea(u._f.deps);var f,m,b,x,_,S=o,E=w,j=i;let e=d(n.errors,S),s=O.isValid&&"boolean"==typeof E&&n.isValid!==E;if(r.delayError&&j){let e;e=()=>{p(n.errors,S,j),C.state.next({errors:n.errors})},(t=t=>{clearTimeout(T),T=setTimeout(e,t)})(r.delayError)}else clearTimeout(T),t=null,j?p(n.errors,S,j):D(n.errors,S);if((j?!$(e,j):e)||!v(W)||s){let e={...W,...s&&"boolean"==typeof E?{isValid:E}:{},errors:n.errors,name:S};n={...n,...e},C.state.next(e)}}}},es=(e,t)=>{if(d(n.errors,t)&&e.focus)return e.focus(),1},ea=async(e,t={})=>{let i,s,a=b(e);if(r.resolver){let t=await X(c(e)?e:a);i=v(t),s=e?!a.some(e=>d(t,e)):i}else e?((s=(await Promise.all(a.map(async e=>{let t=d(h,e);return await Z(t&&t._f?{[e]:t}:t)}))).every(Boolean))||n.isValid)&&R():s=i=await Z(h);return C.state.next({..."string"!=typeof e||O.isValid&&i!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:i}:{},errors:n.errors}),t.shouldFocus&&!s&&_(h,es,e?a:A.mount),s},eo=e=>{let t={...w.mount?y:f};return c(e)?t:"string"==typeof e?d(t,e):e.map(e=>d(t,e))},el=(e,t)=>({invalid:!!d((t||n).errors,e),isDirty:!!d((t||n).dirtyFields,e),error:d((t||n).errors,e),isValidating:!!d(n.validatingFields,e),isTouched:!!d((t||n).touchedFields,e)}),eu=(e,t,r)=>{let i=(d(h,e,{_f:{}})._f||{}).ref,{ref:s,message:a,type:o,...l}=d(n.errors,e)||{};p(n.errors,e,{...l,...t,ref:i}),C.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&i&&i.focus&&i.focus()},ec=(e,t={})=>{for(let i of e?b(e):A.mount)A.mount.delete(i),A.array.delete(i),t.keepValue||(D(h,i),D(y,i)),t.keepError||D(n.errors,i),t.keepDirty||D(n.dirtyFields,i),t.keepTouched||D(n.touchedFields,i),t.keepIsValidating||D(n.validatingFields,i),r.shouldUnregister||t.keepDefaultValue||D(f,i);C.values.next({values:{...y}}),C.state.next({...n,...!t.keepDirty?{}:{isDirty:Q()}}),t.keepIsValid||R()},ed=({disabled:e,name:t,field:r,fields:n,value:i})=>{if("boolean"==typeof e&&w.mount||e){let s=e?void 0:c(i)?H(r?r._f:d(n,t)._f):i;!e&&(e||c(s))||p(y,t,s),z(t,s,!1,!1,!0)}},eh=(e,t={})=>{let n=d(h,e),i="boolean"==typeof t.disabled||"boolean"==typeof r.disabled;return(p(h,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),A.mount.add(e),n)?ed({field:n,disabled:"boolean"==typeof t.disabled?t.disabled:r.disabled,name:e,value:t.value}):B(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:W(t.min),max:W(t.max),minLength:W(t.minLength),maxLength:W(t.maxLength),pattern:W(t.pattern)}:{}
34,name:e,onChange:ei,onBlur:ei,ref:i=>{if(i){let r;eh(e,t),n=d(h,e);let s=c(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,a="radio"===(r=s).type||"checkbox"===r.type,o=n._f.refs||[];(a?o.find(e=>e===s):s===n._f.ref)||(p(h,e,{_f:{...n._f,...a?{refs:[...o.filter(F),s,...Array.isArray(d(f,e))?[{}]:[]],ref:{type:s.type,name:e}}:{ref:s}}}),B(e,!1,void 0,s))}else{let i;(n=d(h,e,{}))._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(i=A.array,!i.has(e.substring(0,e.search(/\.\d+(\.|$)/))||e)||!w.action)&&A.unMount.add(e)}}}},ef=()=>r.shouldFocusError&&_(h,es,A.mount),ep=(e,t)=>async i=>{let s;if(i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist()),r.disabled){t&&await t({...n.errors},i);return}let a=l(y);if(C.state.next({isSubmitting:!0}),r.resolver){let{errors:e,values:t}=await K();n.errors=e,a=t}else await Z(h);if(D(n.errors,"root"),v(n.errors)){C.state.next({errors:{}});try{await e(a,i)}catch(e){s=e}}else t&&await t({...n.errors},i),ef(),setTimeout(ef);if(C.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:v(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},eg=(e,t={})=>{let i=e?l(e):f,s=l(i),a=v(e),u=a?f:s;if(t.keepDefaultValues||(f=i),!t.keepValues){if(t.keepDirtyValues)for(let e of Array.from(new Set([...A.mount,...Object.keys(q(f,y))])))d(n.dirtyFields,e)?p(u,e,d(y,e)):en(e,d(u,e));else{if(o&&c(e))for(let e of A.mount){let t=d(h,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(j(e)){let t=e.closest("form");if(t){t.reset();break}}}}h={}}y=r.shouldUnregister?t.keepDefaultValues?l(f):{}:l(u),C.array.next({values:{...u}}),C.values.next({values:{...u}})}A={mount:t.keepDirtyValues?A.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},w.mount=!O.isValid||!!t.keepIsValid||!!t.keepDirtyValues,w.watch=!!r.shouldUnregister,C.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!a&&(t.keepDirty?n.isDirty:!!(t.keepDefaultValues&&!$(e,f))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:a?{}:t.keepDirtyValues?t.keepDefaultValues&&y?q(f,y):n.dirtyFields:t.keepDefaultValues&&e?q(f,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},em=(e,t)=>eg(E(e)?e(y):e,t);return{control:{register:eh,unregister:ec,getFieldState:el,handleSubmit:ep,setError:eu,_executeSchema:K,_getWatch:ee,_getDirty:Q,_updateValid:R,_removeUnmounted:()=>{for(let e of A.unMount){let t=d(h,e);t&&(t._f.refs?t._f.refs.every(e=>!F(e)):!F(t._f.ref))&&ec(e)}A.unMount=new Set},_updateFieldArray:(e,t=[],i,s,a=!0,o=!0)=>{if(s&&i&&!r.disabled){if(w.action=!0,o&&Array.isArray(d(h,e))){let t=i(d(h,e),s.argA,s.argB);a&&p(h,e,t)}if(o&&Array.isArray(d(n.errors,e))){let t,r=i(d(n.errors,e),s.argA,s.argB);a&&p(n.errors,e,r),u(d(t=n.errors,e)).length||D(t,e)}if(O.touchedFields&&o&&Array.isArray(d(n.touchedFields,e))){let t=i(d(n.touchedFields,e),s.argA,s.argB);a&&p(n.touchedFields,e,t)}O.dirtyFields&&(n.dirtyFields=q(f,y)),C.state.next({name:e,isDirty:Q(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else p(y,e,t)},_updateDisabledField:ed,_getFieldArray:e=>u(d(w.mount?y:f,e,r.shouldUnregister?d(f,e,[]):[])),_reset:eg,_resetDefaultValues:()=>E(r.defaultValues)&&r.defaultValues().then(e=>{em(e,r.resetOptions),C.state.next({isLoading:!1})}),_updateFormState:e=>{n={...n,...e}},_disableForm:e=>{"boolean"==typeof e&&(C.state.next({disabled:e}),_(h,(t,r)=>{let n=d(h,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:C,_proxyFormState:O,_setErrors:e=>{n.errors=e,C.state.next({errors:n.errors,isValid:!1})},get _fields(){return h},get _formValues(){return y},get _state(){return w},set _state(value){w=value},get _defaultValues(){return f},get _names(){return A},set _names(value){A=value},get _formState(){return n},set _formState(value){n=value},get _options(){return r},set _options(value){r={...r,...value}}},trigger:ea,register:eh,handleSubmit:ep,watch:(e,t)=>E(e)?C.values.subscribe({next:r=>e(ee(void 0,t),r)}):ee(e,t,!0),setValue:en,getValues:eo,reset:em,resetField:(e,t={})=>{d(h,e)&&(c(t.defaultValue)?en(e,l(d(f,e))):(en(e,t.defaultValue),p(f,e,l(t.defaultValue))),t.keepTouched||D(n.touchedFields,e),t.keepDirty||(D(n.dirtyFields,e),n.isDirty=t.defaultValue?Q(e,l(d(f,e))):Q()),!t.keepError&&(D(n.errors,e),O.isValid&&R()),C.state.next({...n}))},clearErrors:e=>
34{e&&b(e).forEach(e=>D(n.errors,e)),C.state.next({errors:e?n.errors:{}})},unregister:ec,setError:eu,setFocus:(e,t={})=>{let r=d(h,e),n=r&&r._f;if(n){let e=n.refs?n.refs[0]:n.ref;e.focus&&(e.focus(),t.shouldSelect&&E(e.select)&&e.select())}},getFieldState:el}}(e),formState:h});let y=t.current.control;y._options=e;var w={subject:y._subjects.state,next:e=>{((e,t,r,n)=>{r(e);let{name:i,...s}=e;return v(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(e=>t[e]===(!n||m.all))})(e,y._proxyFormState,y._updateFormState,!0)&&f({...y._formState})}};let A=n.useRef(w);return A.current=w,n.useEffect(()=>{let e=!w.disabled&&A.current.subject&&A.current.subject.subscribe({next:A.current.next});return()=>{e&&e.unsubscribe()}},[w.disabled]),n.useEffect(()=>y._disableForm(e.disabled),[y,e.disabled]),n.useEffect(()=>{if(y._proxyFormState.isDirty){let e=y._getDirty();e!==h.isDirty&&y._subjects.state.next({isDirty:e})}},[y,h.isDirty]),n.useEffect(()=>{e.values&&!$(e.values,r.current)?(y._reset(e.values,y._options.resetOptions),r.current=e.values,f(e=>({...e}))):y._resetDefaultValues()},[e.values,y]),n.useEffect(()=>{e.errors&&y._setErrors(e.errors)},[e.errors,y]),n.useEffect(()=>{y._state.mount||(y._updateValid(),y._state.mount=!0),y._state.watch&&(y._state.watch=!1,y._subjects.state.next({...y._formState})),y._removeUnmounted()}),n.useEffect(()=>{e.shouldUnregister&&y._subjects.values.next({values:y._getWatch()})},[e.shouldUnregister,y]),t.current.formState=((e,t,r,n=!0)=>{let i={defaultValues:t._defaultValues};for(let s in e)Object.defineProperty(i,s,{get:()=>(t._proxyFormState[s]!==m.all&&(t._proxyFormState[s]=!n||m.all),r&&(r[s]=!0),e[s])});return i})(h,y),t.current}},89203:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useMergedRef",{enumerable:!0,get:function(){return i}});let n=r(14232);function i(e,t){let r=(0,n.useRef)(null),i=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=i.current;t&&(i.current=null,t())}else e&&(r.current=s(e,n)),t&&(i.current=s(t,n))},[e,t])}function s(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},90146:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]])},90376:(e,t,r)=>{"use strict";function n(){throw Object.defineProperty(Error("`unauthorized()` is experimental and only allowed to be used when `experimental.authInterrupts` is enabled."),"__NEXT_ERROR_CODE",{value:"E411",enumerable:!1,configurable:!0})}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unauthorized",{enumerable:!0,get:function(){return n}}),r(38811).HTTP_ERROR_FALLBACK_ERROR_CODE,("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},90785:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Headers:()=>a,Request:()=>o,Response:()=>l,default:()=>s,fetch:()=>i});var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw Error("unable to locate global object")}();let i=n.fetch,s=n.fetch.bind(n),a=n.Headers,o=n.Request,l=n.Response},90999:(e,t,r)=>{"use strict";r.d(t,{Hh:()=>a,Jv:()=>o,sE:()=>l,xw:()=>u});var n=r(13415),i=r(53296);async function s(e,t,r,n,i,s){if(!e||!t||!r||!n||!i)throw Error("All fields are required");let a=await fetch("/api/auth/signup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t,firstName:r,lastName:n,company:i,role:s})}),o=await a.json().catch(()=>null);if(!a.ok)throw Error((null==o?void 0:o.error)||"Failed to create account");return o.profile}async function a(e,t,r,n,i){return s(e,t,r,n,i,"company_user")}async function o(e,t){if(!e||!t)throw Error("Email and password are required");try{let r=await fetch("/api/auth/native-signin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e.trim().toLowerCase(),password:t.trim()})}),s=await r.text(),a=null;try{a=s?JSON.parse(s):null}catch(e){a=null}if(!r.ok||!(null==a?void 0:a.access_token)||!(null==a?void 0:a.refresh_token))throw Error((null==a?void 0:a.error)||"Incorrect email or password.");let{data:{user:o},error:l}=await n.N.auth.setSession({access_token:a.access_token,refresh_token:a.refresh_token});if(l)throw l;if(o){let{data:e,error:t}=await n.N.from("users").select("\n        id,\n        email,\n        first_name,\n        last_name,\n        avatar,\n        role,\n        company,\n        created_at,\n        updated_at,\n        settings,\n        workspace_members!workspace_members_user_id_fkey!inner (\n          workspace_id\n        )\n      ").eq("id",o.id
34).single();if(t)throw console.error("Profile error: ",t),t;if(!e)throw Error("User profile not found");return{id:e.id,email:e.email,firstName:e.first_name,lastName:e.last_name,role:e.role,company:e.company,permissions:i.m[e.role]||[],workspaces:e.workspace_members.map(e=>e.workspace_id),createdAt:e.created_at,updatedAt:e.updated_at,avatar:e.avatar,settings:e.settings}}throw Error("Authentication failed")}catch(e){throw console.error("Authentication error:",e),e}}async function l(e){try{if(!e||"undefined"===e)return console.error("Invalid userId provided to getUserDetails:",e),null;let{data:t,error:r}=await n.N.from("users").select("\n        id,\n        email,\n        first_name,\n        last_name,\n        role,\n        company,\n        created_at,\n        updated_at,\n        settings,\n        avatar,\n        workspace_members!workspace_members_user_id_fkey!inner (\n          workspace_id\n        )\n      ").eq("id",e).single();if(r)throw r;if(!t)return null;return{id:t.id,email:t.email,firstName:t.first_name,lastName:t.last_name,role:t.role,company:t.company,permissions:i.m[t.role]||[],workspaces:t.workspace_members.map(e=>e.workspace_id),createdAt:t.created_at,updatedAt:t.updated_at,avatar:t.avatar,settings:t.settings}}catch(e){throw console.error("Error fetching user details:",e),e}}async function u(e){if(!e)throw Error("Email is required");await fetch("/api/auth/reset-request",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e.trim().toLowerCase()})})}},91853:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(17963).A)("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]])},93754:()=>{},95092:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{ReadonlyURLSearchParams:function(){return l.ReadonlyURLSearchParams},RedirectType:function(){return l.RedirectType},ServerInsertedHTMLContext:function(){return u.ServerInsertedHTMLContext},forbidden:function(){return l.forbidden},notFound:function(){return l.notFound},permanentRedirect:function(){return l.permanentRedirect},redirect:function(){return l.redirect},unauthorized:function(){return l.unauthorized},unstable_isUnrecognizedActionError:function(){return c.unstable_isUnrecognizedActionError},unstable_rethrow:function(){return l.unstable_rethrow},useParams:function(){return g},usePathname:function(){return f},useRouter:function(){return p},useSearchParams:function(){return h},useSelectedLayoutSegment:function(){return y},useSelectedLayoutSegments:function(){return m},useServerInsertedHTML:function(){return u.useServerInsertedHTML}});let n=r(14232),i=r(15792),s=r(88797),a=r(37601),o=r(1744),l=r(69591),u=r(14159),c=r(83817),d=void 0;function h(){let e=(0,n.useContext)(s.SearchParamsContext);return(0,n.useMemo)(()=>e?new l.ReadonlyURLSearchParams(e):null,[e])}function f(){return null==d||d("usePathname()"),(0,n.useContext)(s.PathnameContext)}function p(){let e=(0,n.useContext)(i.AppRouterContext);if(null===e)throw Object.defineProperty(Error("invariant expected app router to be mounted"),"__NEXT_ERROR_CODE",{value:"E238",enumerable:!1,configurable:!0});return e}function g(){return null==d||d("useParams()"),(0,n.useContext)(s.PathParamsContext)}function m(e){void 0===e&&(e="children"),null==d||d("useSelectedLayoutSegments()");let t=(0,n.useContext)(i.LayoutRouterContext);return t?function e(t,r,n,i){let s;if(void 0===n&&(n=!0),void 0===i&&(i=[]),n)s=t[1][r];else{var l;let e=t[1];s=null!=(l=e.children)?l:Object.values(e)[0]}if(!s)return i;let u=s[0],c=(0,a.getSegmentValue)(u);return!c||c.startsWith(o.PAGE_SEGMENT_KEY)?i:(i.push(c),e(s,r,!1,i))}(t.parentTree,e):null}function y(e){void 0===e&&(e="children"),null==d||d("useSelectedLayoutSegment()");let t=m(e);if(!t||0===t.length)return null;let r="children"===e?t[0]:t[t.length-1];return r===o.DEFAULT_SEGMENT_KEY?null:r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esMo
34dule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},99615:(e,t,r)=>{"use strict";r.d(t,{o:()=>rI});var n={};r.r(n),r.d(n,{boolean:()=>m,booleanish:()=>y,commaOrSpaceSeparated:()=>k,commaSeparated:()=>x,number:()=>b,overloadedBoolean:()=>v,spaceSeparated:()=>w});var i={};r.r(i),r.d(i,{attentionMarkers:()=>tN,contentInitial:()=>tE,disable:()=>tI,document:()=>tS,flow:()=>tA,flowInitial:()=>tj,insideSpan:()=>tC,string:()=>tT,text:()=>tO});let s=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,a=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,o={};function l(e,t){return((t||o).jsx?a:s).test(e)}let u=/[ \t\n\f\r]/g;function c(e){return""===e.replace(u,"")}class d{constructor(e,t,r){this.property=e,this.normal=t,r&&(this.space=r)}}function h(e,t){let r={},n={},i=-1;for(;++i<e.length;)Object.assign(r,e[i].property),Object.assign(n,e[i].normal);return new d(r,n,t)}function f(e){return e.toLowerCase()}d.prototype.property={},d.prototype.normal={},d.prototype.space=null;class p{constructor(e,t){this.property=e,this.attribute=t}}p.prototype.space=null,p.prototype.boolean=!1,p.prototype.booleanish=!1,p.prototype.overloadedBoolean=!1,p.prototype.number=!1,p.prototype.commaSeparated=!1,p.prototype.spaceSeparated=!1,p.prototype.commaOrSpaceSeparated=!1,p.prototype.mustUseProperty=!1,p.prototype.defined=!1;let g=0,m=_(),y=_(),v=_(),b=_(),w=_(),x=_(),k=_();function _(){return 2**++g}let S=Object.keys(n);
34class E extends p{constructor(e,t,r,i){let s=-1;if(super(e,t),function(e,t,r){r&&(e[t]=r)}(this,"space",i),"number"==typeof r)for(;++s<S.length;){let e=S[s];!function(e,t,r){r&&(e[t]=r)}(this,S[s],(r&n[e])===n[e])}}}E.prototype.defined=!0;let j={}.hasOwnProperty;function A(e){let t,r={},n={};for(t in e.properties)if(j.call(e.properties,t)){let i=e.properties[t],s=new E(t,e.transform(e.attributes||{},t),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(t)&&(s.mustUseProperty=!0),r[t]=s,n[f(t)]=t,n[f(s.attribute)]=t}return new d(r,n,e.space)}let T=A({space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),O=A({space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function C(e,t){return t in e?e[t]:t}function N(e,t){return C(e,t.toLowerCase())}let I=A({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:N,properties:{xmlns:null,xmlnsXLink:null}}),P=A({transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:y,ariaAutoComplete:null,ariaBusy:y,ariaChecked:y,ariaColCount:b,ariaColIndex:b,ariaColSpan:b,ariaControls:w,ariaCurrent:null,ariaDescribedBy:w,ariaDetails:null,ariaDisabled:y,ariaDropEffect:w,ariaErrorMessage:null,ariaExpanded:y,ariaFlowTo:w,ariaGrabbed:y,ariaHasPopup:null,ariaHidden:y,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:w,ariaLevel:b,ariaLive:null,ariaModal:y,ariaMultiLine:y,ariaMultiSelectable:y,ariaOrientation:null,ariaOwns:w,ariaPlaceholder:null,ariaPosInSet:b,ariaPressed:y,ariaReadOnly:y,ariaRelevant:null,ariaRequired:y,ariaRoleDescription:w,ariaRowCount:b,ariaRowIndex:b,ariaRowSpan:b,ariaSelected:y,ariaSetSize:b,ariaSort:null,ariaValueMax:b,ariaValueMin:b,ariaValueNow:b,ariaValueText:null,role:null}}),R=A({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:N,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:x,acceptCharset:w,accessKey:w,action:null,allow:null,allowFullScreen:m,allowPaymentRequest:m,allowUserMedia:m,alt:null,as:null,async:m,autoCapitalize:null,autoComplete:w,autoFocus:m,autoPlay:m,blocking:w,capture:null,charSet:null,checked:m,cite:null,className:w,cols:b,colSpan:null,content:null,contentEditable:y,controls:m,controlsList:w,coords:b|x,crossOrigin:null,data:null,dateTime:null,decoding:null,default:m,defer:m,dir:null,dirName:null,disabled:m,download:v,draggable:y,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:m,formTarget:null,headers:w,height:b,hidden:m,high:b,href:null,hrefLang:null,htmlFor:w,httpEquiv:w,id:null,imageSizes:null,imageSrcSet:null,inert:m,inputMode:null,integrity:null,is:null,isMap:m,itemId:null,itemProp:w,itemRef:w,itemScope:m,itemType:w,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:m,low:b,manifest:null,max:null,maxLength:b,media:null,method:null,min:null,minLength:b,multiple:m,muted:m,name:null,nonce:null,noModule:m,noValidate:m,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:m,optimum:b,pattern:null,ping:w,placeholder:null,playsInl
34ine:m,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:m,referrerPolicy:null,rel:w,required:m,reversed:m,rows:b,rowSpan:b,sandbox:w,scope:null,scoped:m,seamless:m,selected:m,shadowRootClonable:m,shadowRootDelegatesFocus:m,shadowRootMode:null,shape:null,size:b,sizes:null,slot:null,span:b,spellCheck:y,src:null,srcDoc:null,srcLang:null,srcSet:null,start:b,step:null,style:null,tabIndex:b,target:null,title:null,translate:null,type:null,typeMustMatch:m,useMap:null,value:y,width:b,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:w,axis:null,background:null,bgColor:null,border:b,borderColor:null,bottomMargin:b,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:m,declare:m,event:null,face:null,frame:null,frameBorder:null,hSpace:b,leftMargin:b,link:null,longDesc:null,lowSrc:null,marginHeight:b,marginWidth:b,noResize:m,noHref:m,noShade:m,noWrap:m,object:null,profile:null,prompt:null,rev:null,rightMargin:b,rules:null,scheme:null,scrolling:y,standby:null,summary:null,text:null,topMargin:b,valueType:null,version:null,vAlign:null,vLink:null,vSpace:b,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:m,disableRemotePlayback:m,prefix:null,property:null,results:b,security:null,unselectable:null}}),L=A({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav
34-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:C,properties:{about:k,accentHeight:b,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:b,amplitude:b,arabicForm:null,ascent:b,attributeName:null,attributeType:null,azimuth:b,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:b,by:null,calcMode:null,capHeight:b,className:w,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:b,diffuseConstant:b,direction:null,display:null,dur:null,divisor:b,dominantBaseline:null,download:m,dx:null,dy:null,edgeMode:null,editable:null,elevation:b,enableBackground:null,end:null,event:null,exponent:b,externalResourcesRequired:null,fill:null,fillOpacity:b,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:x,g2:x,glyphName:x,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:b,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:b,horizOriginX:b,horizOriginY:b,id:null,ideographic:b,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:b,k:b,k1:b,k2:b,k3:b,k4:b,kernelMatrix:k,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:b,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:b,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,on
34Zoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:b,overlineThickness:b,paintOrder:null,panose1:null,path:null,pathLength:b,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:w,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:b,pointsAtY:b,pointsAtZ:b,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:k,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:k,rev:k,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:k,requiredFeatures:k,requiredFonts:k,requiredFormats:k,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:b,specularExponent:b,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:b,strikethroughThickness:b,string:null,stroke:null,strokeDashArray:k,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:b,strokeOpacity:b,strokeWidth:null,style:null,surfaceScale:b,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:k,tabIndex:b,tableValues:null,target:null,targetX:b,targetY:b,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:k,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:b,underlineThickness:b,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:b,values:null,vAlphabetic:b,vMathematical:b,vectorEffect:null,vHanging:b,vIdeographic:b,version:null,vertAdvY:b,vertOriginX:b,vertOriginY:b,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:b,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),D=h([O,T,I,P,R],"html"),M=h([O,T,I,P,L],"svg"),U=/^data[-\w.:]+$/i,$=/-[a-z]/g,F=/[A-Z]/g;function B(e){return"-"+e.toLowerCase()}function z(e){return e.charAt(1).toUpperCase()}let q={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};var V=r(48945);let H=V.default||V,W=J("end"),K=J("start");function J(e){return function(t){let r=t&&t.position&&t.position[e]||{};if("number"==typeof r.line&&r.line>0&&"number"==typeof r.column&&r.column>0)return{line:r.line,column:r.column,offset:"number"==typeof r.offset&&r.offset>-1?r.offset:void 0}}}function G(e){return e&&"object"==typeof e?"position"in e||"type"in e?X(e.position):"start"in e||"end"in e?X(e):"line"in e||"column"in e?Y(e):"":""}function Y(e){return Z(e&&e.line)+":"+Z(e&&e.column)}function X(e){return Y(e&&e.start)+"-"+Y(e&&e.end)}function Z(e){return e&&"number"==typeof e?e:1}class Q extends Error{constructor(e,t,r){super(),"string"==typeof t&&(r=t,t=void 0);let n="",i={},s=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?n=e:!i.cause&&e&&(s=!0,n=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof r){let e=r.indexOf(":");-1===e?i.ruleId=r:(i.source=r.slice(0,e),i.ruleId=r.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=n,this.line=a?a.line:void 0,this.name=G(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}Q.prototype.file="",Q.prototype.name="",Q.prototype.reason="",Q.prototype.message="",Q.prototype.stack="",Q.prototype.column=void 0,Q.prototype.line=void 0,Q.prototype.ancestors=void 0,Q.prototype.cause=void 0,Q.prototype.fatal=void 0,Q.prototype.place=void 0,Q.prototype.ruleId=void 0,Q.prototype.source=void 0;let ee={}.hasOwnProperty,et=new Map,er=/[A-Z]/g,en=/-([a-z])/g,ei=new Set(["table","tbody","thead","tfoot","tr"]),es=new Set(["td","th"]),ea="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function eo(e,t,r){return"element"===t.type?function(e,t,r){let n=e.sc
34hema;"svg"===t.tagName.toLowerCase()&&"html"===n.space&&(e.schema=M),e.ancestors.push(t);let i=ed(e,t.tagName,!1),s=function(e,t){let r,n,i={};for(n in t.properties)if("children"!==n&&ee.call(t.properties,n)){let s=function(e,t,r){let n=function(e,t){let r=f(t),n=t,i=p;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&"data"===r.slice(0,4)&&U.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace($,z);n="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!$.test(e)){let r=e.replace(F,B);"-"!==r.charAt(0)&&(r="-"+r),t="data"+r}}i=E}return new i(n,t)}(e.schema,t);if(!(null==r||"number"==typeof r&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?function(e,t){let r={};return(""===e[e.length-1]?[...e,""]:e).join((r.padRight?" ":"")+","+(!1===r.padLeft?"":" ")).trim()}(r):r.join(" ").trim()),"style"===n.property){let t="object"==typeof r?r:function(e,t){let r={};try{H(t,function(e,t){let n=e;"--"!==n.slice(0,2)&&("-ms-"===n.slice(0,4)&&(n="ms-"+n.slice(4)),n=n.replace(en,ef)),r[n]=t})}catch(t){if(!e.ignoreInvalidStyle){let r=new Q("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:t,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=ea+"#cannot-parse-style-attribute",r}}return r}(e,String(r));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,r={};for(t in e)ee.call(e,t)&&(r[function(e){let t=e.replace(er,ep);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return r}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&n.space?q[n.property]||n.property:n.attribute,r]}}(e,n,t.properties[n]);if(s){let[n,a]=s;e.tableCellAlignToStyle&&"align"===n&&"string"==typeof a&&es.has(t.tagName)?r=a:i[n]=a}}return r&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r),i}(e,t),a=ec(e,t);return ei.has(t.tagName)&&(a=a.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&c(e.value):c(e))})),el(e,s,i,t),eu(s,a),e.ancestors.pop(),e.schema=n,e.create(t,i,s,r)}(e,t,r):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}eh(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function(e,t,r){let n=e.schema;"svg"===t.name&&"html"===n.space&&(e.schema=M),e.ancestors.push(t);let i=null===t.name?e.Fragment:ed(e,t.name,!0),s=function(e,t){let r={};for(let n of t.attributes)if("mdxJsxExpressionAttribute"===n.type)if(n.data&&n.data.estree&&e.evaluater){let t=n.data.estree.body[0];t.type;let i=t.expression;i.type;let s=i.properties[0];s.type,Object.assign(r,e.evaluater.evaluateExpression(s.argument))}else eh(e,t.position);else{let i,s=n.name;if(n.value&&"object"==typeof n.value)if(n.value.data&&n.value.data.estree&&e.evaluater){let t=n.value.data.estree.body[0];t.type,i=e.evaluater.evaluateExpression(t.expression)}else eh(e,t.position);else i=null===n.value||n.value;r[s]=i}return r}(e,t),a=ec(e,t);return el(e,s,i,t),eu(s,a),e.ancestors.pop(),e.schema=n,e.create(t,i,s,r)}(e,t,r):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);eh(e,t.position)}(e,t):"root"===t.type?function(e,t,r){let n={};return eu(n,ec(e,t)),e.create(t,e.Fragment,n,r)}(e,t,r):"text"===t.type?t.value:void 0}function el(e,t,r,n){"string"!=typeof r&&r!==e.Fragment&&e.passNode&&(t.node=n)}function eu(e,t){if(t.length>0){let r=t.length>1?t:t[0];r&&(e.children=r)}}function ec(e,t){let r=[],n=-1,i=e.passKeys?new Map:et;for(;++n<t.children.length;){let s,a=t.children[n];if(e.passKeys){let e="element"===a.type?a.tagName:"mdxJsxFlowElement"===a.type||"mdxJsxTextElement"===a.type?a.name:void 0;if(e){let t=i.get(e)||0;s=e+"-"+t,i.set(e,t+1)}}let o=eo(e,a,s);void 0!==o&&r.push(o)}return r}function ed(e,t,r){let n;if(r)if(t.includes(".")){let e,r=t.split("."),i=-1;for(;++i<r.length;){let t=l(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(i&&"Literal"===t.type),optional:!1}:t}n=e}else n=l(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else n={type:"Literal",value:t};if("Literal"===n.type){let t=n.value;return ee.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(n);eh(e)}function eh(e,t){let r=new Q("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=ea+"#cannot-handle-mdx-estrees-without-createevaluater",r}function ef(e,t){return t.toUpperCase()}function ep(e){return"-"+e.toLowerCase()}let eg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]};var em=r(37876);let ey={};function ev(e,t,r){var n;if((n=e)&&"object"==typeof n){if("value"in e)return"html"!==e.type||r?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return eb(e.children,t,r)}return Array.isArray(e)?eb(e,t,r):""}function eb(e,t,r){let n=[],i=-1;for(;++i<e.length;)n[i]=ev(e[i],t,r);return n.join("")}function ew(e,t,r,n){let i,s=e.length,a=0;if(t=t<0?-t>s?0:s+t:t>s?s:t,r=r>0?r:0,n.length<1e4)(i=Array.from(n)).unshift(t,r),e.splice(...i);else for(r&&e.splice(t,r);a<n.length;)(i=n.slice(a,a+1e4)).unshift(t,0),e.splice(...i),a+=1e4,t+=1e4}function ex(e,t){return e.length>0?(ew(e,e.length,0,t),e):t}class ek{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let r=null==t?1/0:t;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,t,r){this.setCursor(Math.trunc(e));let n=this.right.splice(this.right.length-(t||0),1/0);return r&&e_(this.left,r),n.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),e_(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),e_(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);e_(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);e_(this.left,t.reverse())}}}function e_(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function eS(e){let t,r,n,i,s,a,o,l={},u=-1,c=new ek(e);for(;++u<c.length;){for(;u in l;)u=l[u];if(t=c.get(u),u&&"chunkFlow"===t[1].type&&"listItemPrefix"===c.get(u-1)[1].type&&((n=0)<(a=t[1]._tokenizer.events).length&&"lineEndingBlank"===a[n][1].type&&(n+=2),n<a.length&&"content"===a[n][1].type))for(;++n<a.length&&"content"!==a[n][1].type;)"chunkText"===a[n][1].type&&(a[n][1]._isInFirstContentOfListItem=!0,n++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let r,n,i=e.get(t)[1],s=e.get(t)[2],a=t-1,o=[],l=i._tokenizer||s.parser[i.contentType](i.start),u=l.events,c=[],d={},h=-1,f=i,p=0,g=0,m=[0];for(;f;){for(;e.get(++a)[1]!==f;);o.push(a),!f._tokenizer&&(r=s.sliceStream(f),f.next||r.push(null),n&&l.defineSki
34p(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(r),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),n=f,f=f.next}for(f=i;++h<u.length;)"exit"===u[h][0]&&"enter"===u[h-1][0]&&u[h][1].type===u[h-1][1].type&&u[h][1].start.line!==u[h][1].end.line&&(g=h+1,m.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):m.pop(),h=m.length;h--;){let t=u.slice(m[h],m[h+1]),r=o.pop();c.push([r,r+t.length-1]),e.splice(r,2,t)}for(c.reverse(),h=-1;++h<c.length;)d[p+c[h][0]]=p+c[h][1],p+=c[h][1]-c[h][0]-1;return d}(c,u)),u=l[u],o=!0);else if(t[1]._container){for(n=u,r=void 0;n--;)if("lineEnding"===(i=c.get(n))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(r&&(c.get(r)[1].type="lineEndingBlank"),i[1].type="lineEnding",r=n);else break;r&&(t[1].end={...c.get(r)[1].start},(s=c.slice(r,u)).unshift(t),c.splice(r,u-r+1,s))}}return ew(e,0,1/0,c.slice(0)),!o}let eE={}.hasOwnProperty,ej=eU(/[A-Za-z]/),eA=eU(/[\dA-Za-z]/),eT=eU(/[#-'*+\--9=?A-Z^-~]/);function eO(e){return null!==e&&(e<32||127===e)}let eC=eU(/\d/),eN=eU(/[\dA-Fa-f]/),eI=eU(/[!-/:-@[-`{-~]/);function eP(e){return null!==e&&e<-2}function eR(e){return null!==e&&(e<0||32===e)}function eL(e){return -2===e||-1===e||32===e}let eD=eU(/\p{P}|\p{S}/u),eM=eU(/\s/);function eU(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function e$(e,t,r,n){let i=n?n-1:1/0,s=0;return function(n){return eL(n)?(e.enter(r),function n(a){return eL(a)&&s++<i?(e.consume(a),n):(e.exit(r),t(a))}(n)):t(n)}}let eF={tokenize:function(e){let t,r=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),e$(e,r,"linePrefix"))},function(r){return e.enter("paragraph"),function r(n){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(n){if(null===n){e.exit("chunkText"),e.exit("paragraph"),e.consume(n);return}return eP(n)?(e.consume(n),e.exit("chunkText"),r):(e.consume(n),t)}(n)}(r)});return r}},eB={tokenize:function(e){let t,r,n,i=this,s=[],a=0;return o;function o(t){if(a<s.length){let r=s[a];return i.containerState=r[1],e.attempt(r[0].continuation,l,u)(t)}return u(t)}function l(e){if(a++,i.containerState._closeFlow){let r;i.containerState._closeFlow=void 0,t&&y();let n=i.events.length,s=n;for(;s--;)if("exit"===i.events[s][0]&&"chunkFlow"===i.events[s][1].type){r=i.events[s][1].end;break}m(a);let o=n;for(;o<i.events.length;)i.events[o][1].end={...r},o++;return ew(i.events,s+1,0,i.events.slice(n)),i.events.length=o,u(e)}return o(e)}function u(r){if(a===s.length){if(!t)return h(r);if(t.currentConstruct&&t.currentConstruct.concrete)return p(r);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(ez,c,d)(r)}function c(e){return t&&y(),m(a),h(e)}function d(e){return i.parser.lazy[i.now().line]=a!==s.length,n=i.now().offset,p(e)}function h(t){return i.containerState={},e.attempt(ez,f,p)(t)}function f(e){return a++,s.push([i.currentConstruct,i.containerState]),h(e)}function p(n){if(null===n){t&&y(),m(0),e.consume(n);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:r}),function t(r){if(null===r){g(e.exit("chunkFlow"),!0),m(0),e.consume(r);return}return eP(r)?(e.consume(r),g(e.exit("chunkFlow")),a=0,i.interrupt=void 0,o):(e.consume(r),t)}(n)}function g(e,s){let o=i.sliceStream(e);if(s&&o.push(null),e.previous=r,r&&(r.next=e),r=e,t.defineSkip(e.start),t.write(o),i.parser.lazy[e.start.line]){let e,r,s=t.events.length;for(;s--;)if(t.events[s][1].start.offset<n&&(!t.events[s][1].end||t.events[s][1].end.offset>n))return;let o=i.events.length,l=o;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){r=i.events[l][1].end;break}e=!0}for(m(a),s=o;s<i.events.length;)i.events[s][1].end={...r},s++;ew(i.events,l+1,0,i.events.slice(o)),i.events.length=s}}function m(t){let r=s.length;for(;r-- >t;){let t=s[r];i.containerState=t[1],t[0].exit.call(i,e)}s.length=t}function y(){t.write([null]),r=void 0,t=void 0,i.containerState._closeFlow=void 0}}},ez={tokenize:function(e,t,r){return e$(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},eq={partial:!0,tokenize:function(e,t,r){return function(t){return eL(t)?e$(e,n,"linePrefix")(t):n(t)};function n(e){return null===e||eP(e)?t(e):r(e)}}},eV={resolve:function(e){return eS(e),e},tokenize:function(e,t){let r;return function(t){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),n(t)};function n(t){return null===t?i(t):eP(t)?e.check(eH,s,i)(t):(e.consume(t),n)}function i(r){return e.exit("chunkContent"),e.exit("content"),t(r)}function s(t){return e.consume(t),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,n}}},eH={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),e$(e,i,"linePrefix")};function i(i){if(null===i||eP(i))return r(i);let s=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(i):e.interrupt(n.parser.constructs.flow,r,t)(i)}}},eW={tokenize:function(e){let t=this,r=e.attempt(eq,function(n){return null===n?void e.consume(n):(e.enter("lineEndingBlank"),e.consume(n),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r)},e.attempt(this.parser.constructs.flowInitial,n,e$(e,e.attempt(this.parser.constructs.flow,n,e.attempt(eV,n)),"linePrefix")));return r;function n(n){return null===n?void e.consume(n):(e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),t.currentConstruct=void 0,r)}}},eK={resolveAll:eX()},eJ=eY("string"),eG=eY("text");function eY(e){return{resolveAll:eX("text"===e?eZ:void 0),tokenize:function(t){let r=this,n=this.parser.constructs[e],i=t.attempt(n,s,a);return s;function s(e){return l(e)?i(e):a(e)}function a(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),o)}function o(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),o)}function l(e){if(null===e)return!0;let t=n[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(r,r.previous))return!0}return!1}}}}function eX(e){return function(t,r){let n,i=-1;for(;++i<=t.length;)void 0===n?t[i]&&"data"===t[i][1].type&&(n=i,i++):t[i]&&"data"===t[i][1].type||(i!==n+2&&(t[n][1].end=t[i-1][1].end,t.splice(n+2,i-n-2),i=n+2),n=void 0);return e?e(t,r):t}}function eZ(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||"lineEnding"===e[r][1].type)&&"data"===e[r-1][1].type){let n,i=e[r-1][1],s=t.sliceStream(i),a=s.length,o=-1,l=0;for(;a--;){let e=s[a];if("string"==typeof e){for(o=e.length;32===e.charCodeAt(o-1);)l++,o--;if(o)break;o=-1}else if(-2===e)n=!0,l++;else if(-1===e);else{a++;break}}if(l){let s={type:r===e.length||n||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?o:i.start._bufferIndex+o,_index:i.start._index+a,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...s.start},i.start.offset===i.end.offset?Object.assign(i,s):(e.splice(r,0,["enter",s,t],["exit",s,t]),r+=2)}r++}return e}let eQ={name:"thematicBreak",tokenize:function(e,t,r){let n,i=0;return function(s){var a;return e.enter("thematicBreak"),n=a=s,function s(a){return a===n?(e.enter("thematicBreakSequence"),function t(r){return r===n?(e.consume(r),i++,t):(e.exit("thematicBreakSequence"),eL(r)?e$(e,s,"whitespace")(r):s(r))}(a)):i>=3&&(null===a||eP(a))?(e.exit("thematicBreak"),t(a)):r(a)}(a)}}},e0={continuation:{tokenize:function(e,t,r){let n=this;return n.containerState._closeFlow=void 0,e.check(eq,function(r){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,e$(e,t,"listItemIndent",n.containerState.size+1)(r)},function(r){return n.containerState.furtherBlankLines||!eL(r)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine
34=void 0,i(r)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(e2,t,i)(r))});function i(i){return n.containerState._closeFlow=!0,n.interrupt=void 0,e$(e,e.attempt(e0,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,r){let n=this,i=n.events[n.events.length-1],s=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,a=0;return function(t){let i=n.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!n.containerState.marker||t===n.containerState.marker:eC(t)){if(n.containerState.type||(n.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(eQ,r,o)(t):o(t);if(!n.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return eC(i)&&++a<10?(e.consume(i),t):(!n.interrupt||a<2)&&(n.containerState.marker?i===n.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),o(i)):r(i)}(t)}return r(t)};function o(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||t,e.check(eq,n.interrupt?r:l,e.attempt(e1,c,u))}
34function l(e){return n.containerState.initialBlankLine=!0,s++,c(e)}function u(t){return eL(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),c):r(t)}function c(r){return n.containerState.size=s+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(r)}}},e1={partial:!0,tokenize:function(e,t,r){let n=this;return e$(e,function(e){let i=n.events[n.events.length-1];return!eL(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):r(e)},"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},e2={partial:!0,tokenize:function(e,t,r){let n=this;return e$(e,function(e){let i=n.events[n.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===n.containerState.size?t(e):r(e)},"listItemIndent",n.containerState.size+1)}},e4={continuation:{tokenize:function(e,t,r){let n=this;return function(t){return eL(t)?e$(e,i,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(n){return e.attempt(e4,t,r)(n)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,r){let n=this;return function(t){if(62===t){let r=n.containerState;return r.open||(e.enter("blockQuote",{_container:!0}),r.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return r(t)};function i(r){return eL(r)?(e.enter("blockQuotePrefixWhitespace"),e.consume(r),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(r))}}};function e3(e,t,r,n,i,s,a,o,l){let u=l||1/0,c=0;return function(t){return 60===t?(e.enter(n),e.enter(i),e.enter(s),e.consume(t),e.exit(s),d):null===t||32===t||41===t||eO(t)?r(t):(e.enter(n),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),p(t))};function d(r){return 62===r?(e.enter(s),e.consume(r),e.exit(s),e.exit(i),e.exit(n),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),h(r))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(o),d(t)):null===t||60===t||eP(t)?r(t):(e.consume(t),92===t?f:h)}function f(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function p(i){return!c&&(null===i||41===i||eR(i))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(n),t(i)):c<u&&40===i?(e.consume(i),c++,p):41===i?(e.consume(i),c--,p):null===i||32===i||40===i||eO(i)?r(i):(e.consume(i),92===i?g:p)}function g(t){return 40===t||41===t||92===t?(e.consume(t),p):p(t)}}function e5(e,t,r,n,i,s){let a,o=this,l=0;return function(t){return e.enter(n),e.enter(i),e.consume(t),e.exit(i),e.enter(s),u};function u(d){return l>999||null===d||91===d||93===d&&!a||94===d&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(d):93===d?(e.exit(s),e.enter(i),e.consume(d),e.exit(i),e.exit(n),t):eP(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(t){return null===t||91===t||93===t||eP(t)||l++>999?(e.exit("chunkString"),u(t)):(e.consume(t),a||(a=!eL(t)),92===t?d:c)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}}function e6(e,t,r,n,i,s){let a;return function(t){return 34===t||39===t||40===t?(e.enter(n),e.enter(i),e.consume(t),e.exit(i),a=40===t?41:t,o):r(t)};function o(r){return r===a?(e.enter(i),e.consume(r),e.exit(i),e.exit(n),t):(e.enter(s),l(r))}function l(t){return t===a?(e.exit(s),o(a)):null===t?r(t):eP(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),e$(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===a||null===t||eP(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return t===a||92===t?(e.consume(t),u):u(t)}}function e8(e,t){let r;return function n(i){return eP(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):eL(i)?e$(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}function e7(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let e9={partial:!0,tokenize:function(e,t,r){return function(t){return eR(t)?e8(e,n)(t):r(t)};function n(t){return e6(e,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return eL(t)?e$(e,s,"whitespace")(t):s(t)}function s(e){return null===e||eP(e)?t(e):r(e)}}},te={name:"codeIndented",tokenize:function(e,t,r){let n=this;
34return function(t){return e.enter("codeIndented"),e$(e,i,"linePrefix",5)(t)};function i(t){let i=n.events[n.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(r){return null===r?s(r):eP(r)?e.attempt(tt,t,s)(r):(e.enter("codeFlowValue"),function r(n){return null===n||eP(n)?(e.exit("codeFlowValue"),t(n)):(e.consume(n),r)}(r))}(t):r(t)}function s(r){return e.exit("codeIndented"),t(r)}}},tt={partial:!0,tokenize:function(e,t,r){let n=this;return i;function i(t){return n.parser.lazy[n.now().line]?r(t):eP(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):e$(e,s,"linePrefix",5)(t)}function s(e){let s=n.events[n.events.length-1];return s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(e):eP(e)?i(e):r(e)}}},tr={name:"setextUnderline",resolveTo:function(e,t){let r,n,i,s=e.length;for(;s--;)if("enter"===e[s][0]){if("content"===e[s][1].type){r=s;break}"paragraph"===e[s][1].type&&(n=s)}else"content"===e[s][1].type&&e.splice(s,1),i||"definition"!==e[s][1].type||(i=s);let a={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[n][1].type="setextHeadingText",i?(e.splice(n,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e},tokenize:function(e,t,r){let n,i=this;return function(t){var a;let o,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){o="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||o)?(e.enter("setextHeadingLine"),n=t,a=t,e.enter("setextHeadingLineSequence"),function t(r){return r===n?(e.consume(r),t):(e.exit("setextHeadingLineSequence"),eL(r)?e$(e,s,"lineSuffix")(r):s(r))}(a)):r(t)};function s(n){return null===n||eP(n)?(e.exit("setextHeadingLine"),t(n)):r(n)}}},tn=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ti=["pre","script","style","textarea"],ts={partial:!0,tokenize:function(e,t,r){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),e.attempt(eq,t,r)}}},ta={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return eP(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):r(t)};function i(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},to={partial:!0,tokenize:function(e,t,r){let n=this;return function(t){return null===t?r(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return n.parser.lazy[n.now().line]?r(e):t(e)}}},tl={concrete:!0,name:"codeFenced",tokenize:function(e,t,r){let n,i=this,s={partial:!0,tokenize:function(e,t,r){let s=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a};function a(t){return e.enter("codeFencedFence"),eL(t)?e$(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===n?(e.enter("codeFencedFenceSequence"),function t(i){return i===n?(s++,e.consume(i),t):s>=o?(e.exit("codeFencedFenceSequence"),eL(i)?e$(e,u,"whitespace")(i):u(i)):r(i)}(t)):r(t)}function u(n){return null===n||eP(n)?(e.exit("codeFencedFence"),t(n)):r(n)}}},a=0,o=0;return function(t){var s=t;let u=i.events[i.events.length-1];return a=u&&"linePrefix"===u[1].type?u[2].sliceSerialize(u[1],!0).length:0,n=s,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===n?(o++,e.consume(i),t):o<3?r(i):(e.exit("codeFencedFenceSequence"),eL(i)?e$(e,l,"whitespace")(i):l(i))}(s)};function l(s){return null===s||eP(s)?(e.exit("codeFencedFence"),i.interrupt?t(s):e.check(to,c,p)(s)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||eP(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):eL(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),e$(e,u,"whitespace")(i)):96===i&&i===n?r(i):(e.consume(i),t)}(s))}
34function u(t){return null===t||eP(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||eP(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===n?r(i):(e.consume(i),t)}(t))}function c(t){return e.attempt(s,p,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return a>0&&eL(t)?e$(e,f,"linePrefix",a+1)(t):f(t)}function f(t){return null===t||eP(t)?e.check(to,c,p)(t):(e.enter("codeFlowValue"),function t(r){return null===r||eP(r)?(e.exit("codeFlowValue"),f(r)):(e.consume(r),t)}(t))}function p(r){return e.exit("codeFenced"),t(r)}}},tu=document.createElement("i");function tc(e){let t="&"+e+";";tu.innerHTML=t;let r=tu.textContent;return(59!==r.charCodeAt(r.length-1)||"semi"===e)&&r!==t&&r}let td={name:"characterReference",tokenize:function(e,t,r){let n,i,s=this,a=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),o};function o(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),n=31,i=eA,u(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),n=6,i=eN,u):(e.enter("characterReferenceValue"),n=7,i=eC,u(t))}function u(o){if(59===o&&a){let n=e.exit("characterReferenceValue");return i!==eA||tc(s.sliceSerialize(n))?(e.enter("characterReferenceMarker"),e.consume(o),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):r(o)}return i(o)&&a++<n?(e.consume(o),u):r(o)}}},th={name:"characterEscape",tokenize:function(e,t,r){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),n};function n(n){return eI(n)?(e.enter("characterEscapeValue"),e.consume(n),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(n)}}},tf={name:"lineEnding",tokenize:function(e,t){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e$(e,t,"linePrefix")}}};function tp(e,t,r){let n=[],i=-1;for(;++i<e.length;){let s=e[i].resolveAll;s&&!n.includes(s)&&(t=s(t,r),n.push(s))}return t}let tg={name:"labelEnd",resolveAll:function(e){let t=-1,r=[];for(;++t<e.length;){let n=e[t][1];if(r.push(e[t]),"labelImage"===n.type||"labelLink"===n.type||"labelEnd"===n.type){let e="labelImage"===n.type?4:2;n.type="data",t+=e}}return e.length!==r.length&&ew(e,0,e.length,r),e},resolveTo:function(e,t){let r,n,i,s,a=e.length,o=0;for(;a--;)if(r=e[a][1],n){if("link"===r.type||"labelLink"===r.type&&r._inactive)break;"enter"===e[a][0]&&"labelLink"===r.type&&(r._inactive=!0)}else if(i){if("enter"===e[a][0]&&("labelImage"===r.type||"labelLink"===r.type)&&!r._balanced&&(n=a,"labelLink"!==r.type)){o=2;break}}else"labelEnd"===r.type&&(i=a);let l={type:"labelLink"===e[n][1].type?"link":"image",start:{...e[n][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[n][1].start},end:{...e[i][1].end}},c={type:"labelText",start:{...e[n+o+2][1].end},end:{...e[i-2][1].start}};return s=ex(s=[["enter",l,t],["enter",u,t]],e.slice(n+1,n+o+3)),s=ex(s,[["enter",c,t]]),s=ex(s,tp(t.parser.constructs.insideSpan.null,e.slice(n+o+4,i-3),t)),s=ex(s,[["exit",c,t],e[i-2],e[i-1],["exit",u,t]]),s=ex(s,e.slice(i+1)),s=ex(s,[["exit",l,t]]),ew(e,n,e.length,s),e},tokenize:function(e,t,r){let n,i,s=this,a=s.events.length;for(;a--;)if(("labelImage"===s.events[a][1].type||"labelLink"===s.events[a][1].type)&&!s.events[a][1]._balanced){n=s.events[a][1];break}return function(t){return n?n._inactive?c(t):(i=s.parser.defined.includes(e7(s.sliceSerialize({start:n.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),o):r(t)};function o(t){return 40===t?e.attempt(tm,u,i?u:c)(t):91===t?e.attempt(ty,u,i?l:c)(t):i?u(t):c(t)}function l(t){return e.attempt(tv,u,c)(t)}function u(e){return t(e)}function c(e){return n._balanced=!0,r(e)}}},tm={tokenize:function(e,t,r){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),n};function n(t){return eR(t)?e8(e,i)(t):i(t)}function i(t){return 41===t?u(t):e3(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function s(t){return eR(t)?e8(e,o)(t):u(t)}function a(e){return r(e)}function o(t){return 34===t||39===t||40===t?e6(e,l,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):u(t)}function l(t){return eR(t)?e8(e,u)(t):u(t)}function u(n){return 41===n?(e.enter("resourceMarker"),e.consume(n),e.exit("resourceMarker"),e.exit("resource"),t):r(n)}}},ty={tokenize:function(e,t,r){let n=this;return function(t){return e5.call(n,e,i,s,"reference","referenceMarker","referenceString")(t)};function i(e){return n.parser.defined.includes(e7(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(e):r(e)}function s(e){return r(e)}}},tv={tokenize:function(e,t,r){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),n};function n(n){return 93===n?(e.enter("referenceMarker"),e.consume(n),e.exit("referenceMarker"),e.exit("reference"),t):r(n)}}},tb={name:"labelStartImage",resolveAll:tg.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),s):r(t)}function s(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}};function tw(e){return null===e||eR(e)||eM(e)?1:eD(e)?2:void 0}let tx={name:"attention",resolveAll:function(e,t){let r,n,i,s,a,o,l,u,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close){for(r=c;r--;)if("exit"===e[r][0]&&"attentionSequence"===e[r][1].type&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCo
34deAt(0)===t.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[r][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;o=e[r][1].end.offset-e[r][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;let d={...e[r][1].end},h={...e[c][1].start};tk(d,-o),tk(h,o),s={type:o>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:o>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:h},i={type:o>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[c][1].start}},n={type:o>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[c][1].start={...a.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=ex(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=ex(l,[["enter",n,t],["enter",s,t],["exit",s,t],["enter",i,t]]),l=ex(l,tp(t.parser.constructs.insideSpan.null,e.slice(r+1,c),t)),l=ex(l,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",n,t]]),e[c][1].end.offset-e[c][1].start.offset?(u=2,l=ex(l,[["enter",e[c][1],t],["exit",e[c][1],t]])):u=0,ew(e,r-1,c-r+3,l),c=r+l.length-u-2;break}}for(c=-1;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e},tokenize:function(e,t){let r,n=this.parser.constructs.attentionMarkers.null,i=this.previous,s=tw(i);return function(a){return r=a,e.enter("attentionSequence"),function a(o){if(o===r)return e.consume(o),a;let l=e.exit("attentionSequence"),u=tw(o),c=!u||2===u&&s||n.includes(o),d=!s||2===s&&u||n.includes(i);return l._open=!!(42===r?c:c&&(s||!d)),l._close=!!(42===r?d:d&&(u||!c)),t(o)}(a)}}};function tk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let t_={name:"labelStartLink",resolveAll:tg.resolveAll,tokenize:function(e,t,r){let n=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?r(e):t(e)}}},tS={42:e0,43:e0,45:e0,48:e0,49:e0,50:e0,51:e0,52:e0,53:e0,54:e0,55:e0,56:e0,57:e0,62:e4},tE={91:{name:"definition",tokenize:function(e,t,r){let n,i=this;return function(t){var n;return e.enter("definition"),n=t,e5.call(i,e,s,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(n)};function s(t){return(n=e7(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),a):r(t)}function a(t){return eR(t)?e8(e,o)(t):o(t)}function o(t){return e3(e,l,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(e9,u,u)(t)}function u(t){return eL(t)?e$(e,c,"whitespace")(t):c(t)}function c(s){return null===s||eP(s)?(e.exit("definition"),i.parser.defined.push(n),t(s)):r(s)}}}},tj={[-2]:te,[-1]:te,32:te},tA={35:{name:"headingAtx",resolve:function(e,t){let r,n,i=e.length-2,s=3;return"whitespace"===e[3][1].type&&(s+=2),i-2>s&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(s===i-1||i-4>s&&"whitespace"===e[i-2][1].type)&&(i-=s+1===i?2:4),i>s&&(r={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},n={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},ew(e,s,i-s+1,[["enter",r,t],["enter",n,t],["exit",n,t],["exit",r,t]])),e},tokenize:function(e,t,r){let n=0;return function(i){var s;return e.enter("atxHeading"),s=i,e.enter("atxHeadingSequence"),function i(s){return 35===s&&n++<6?(e.consume(s),i):null===s||eR(s)?(e.exit("atxHeadingSequence"),function r(n){return 35===n?(e.enter("atxHeadingSequence"),function t(n){return 35===n?(e.consume(n),t):(e.exit("atxHeadingSequence"),r(n))}(n)):null===n||eP(n)?(e.exit("atxHeading"),t(n)):eL(n)?e$(e,r,"whitespace")(n):(e.enter("atxHeadingText"),function t(n){return null===n||35===n||eR(n)?(e.exit("atxHeadingText"),r(n)):(e.consume(n),t)}(n))}(s)):r(s)}(s)}}},42:eQ,45:[tr,eQ],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,r){let n,i,s,a,o,l=this;return function(t){var r;return r=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(r),u};function u(a){return 33===a?(e.consume(a),c):47===a?(e.consume(a),i=!0,f):63===a?(e.consume(a),n=3,l.interrupt?t:I):ej(a)?(e.consume(a),s=String.fromCharCode(a),p):r(a)}function c(i){return 45===i?(e.consume(i),n=2,d):91===i?(e.consume(i),n=
345,a=0,h):ej(i)?(e.consume(i),n=4,l.interrupt?t:I):r(i)}function d(n){return 45===n?(e.consume(n),l.interrupt?t:I):r(n)}function h(n){let i="CDATA[";return n===i.charCodeAt(a++)?(e.consume(n),a===i.length)?l.interrupt?t:S:h:r(n)}function f(t){return ej(t)?(e.consume(t),s=String.fromCharCode(t),p):r(t)}function p(a){if(null===a||47===a||62===a||eR(a)){let o=47===a,u=s.toLowerCase();return!o&&!i&&ti.includes(u)?(n=1,l.interrupt?t(a):S(a)):tn.includes(s.toLowerCase())?(n=6,o)?(e.consume(a),g):l.interrupt?t(a):S(a):(n=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(a):i?function t(r){return eL(r)?(e.consume(r),t):k(r)}(a):m(a))}return 45===a||eA(a)?(e.consume(a),s+=String.fromCharCode(a),p):r(a)}function g(n){return 62===n?(e.consume(n),l.interrupt?t:S):r(n)}function m(t){return 47===t?(e.consume(t),k):58===t||95===t||ej(t)?(e.consume(t),y):eL(t)?(e.consume(t),m):k(t)}function y(t){return 45===t||46===t||58===t||95===t||eA(t)?(e.consume(t),y):v(t)}function v(t){return 61===t?(e.consume(t),b):eL(t)?(e.consume(t),v):m(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),o=t,w):eL(t)?(e.consume(t),b):function t(r){return null===r||34===r||39===r||47===r||60===r||61===r||62===r||96===r||eR(r)?v(r):(e.consume(r),t)}(t)}function w(t){return t===o?(e.consume(t),o=null,x):null===t||eP(t)?r(t):(e.consume(t),w)}function x(e){return 47===e||62===e||eL(e)?m(e):r(e)}function k(t){return 62===t?(e.consume(t),_):r(t)}function _(t){return null===t||eP(t)?S(t):eL(t)?(e.consume(t),_):r(t)}function S(t){return 45===t&&2===n?(e.consume(t),T):60===t&&1===n?(e.consume(t),O):62===t&&4===n?(e.consume(t),P):63===t&&3===n?(e.consume(t),I):93===t&&5===n?(e.consume(t),N):eP(t)&&(6===n||7===n)?(e.exit("htmlFlowData"),e.check(ts,R,E)(t)):null===t||eP(t)?(e.exit("htmlFlowData"),E(t)):(e.consume(t),S)}function E(t){return e.check(ta,j,R)(t)}function j(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A}function A(t){return null===t||eP(t)?E(t):(e.enter("htmlFlowData"),S(t))}function T(t){return 45===t?(e.consume(t),I):S(t)}function O(t){return 47===t?(e.consume(t),s="",C):S(t)}function C(t){if(62===t){let r=s.toLowerCase();return ti.includes(r)?(e.consume(t),P):S(t)}return ej(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),C):S(t)}function N(t){return 93===t?(e.consume(t),I):S(t)}function I(t){return 62===t?(e.consume(t),P):45===t&&2===n?(e.consume(t),I):S(t)}function P(t){return null===t||eP(t)?(e.exit("htmlFlowData"),R(t)):(e.consume(t),P)}function R(r){return e.exit("htmlFlow"),t(r)}}},61:tr,95:eQ,96:tl,126:tl},tT={38:td,92:th},tO={[-5]:tf,[-4]:tf,[-3]:tf,33:tb,38:td,42:tx,60:[{name:"autolink",tokenize:function(e,t,r){let n=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return ej(t)?(e.consume(t),s):64===t?r(t):o(t)}function s(t){return 43===t||45===t||46===t||eA(t)?(n=1,function t(r){return 58===r?(e.consume(r),n=0,a):(43===r||45===r||46===r||eA(r))&&n++<32?(e.consume(r),t):(n=0,o(r))}(t)):o(t)}function a(n){return 62===n?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):null===n||32===n||60===n||eO(n)?r(n):(e.consume(n),a)}function o(t){return 64===t?(e.consume(t),l):eT(t)?(e.consume(t),o):r(t)}function l(i){return eA(i)?function i(s){return 46===s?(e.consume(s),n=0,l):62===s?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(s),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(s){if((45===s||eA(s))&&n++<63){let r=45===s?t:i;return e.consume(s),r}return r(s)}(s)}(i):r(i)}}},{name:"htmlText",tokenize:function(e,t,r){let n,i,s,a=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),o};function o(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),w):63===t?(e.consume(t),v):ej(t)?(e.consume(t),k):r(t)}function l(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),i=0,f):ej(t)?(e.consume(t),y):r(t)}function u(t){return 45===t?(e.consume(t),h):r(t)}function c(t){return null===t?r(t):45===t?(e.consume(t),d):eP(t)?(s=c,C(t)):(e.consume(t),c)}function d(t){return 45===t?(e.consume(t),h):c(t)}function h(e){return 62===e?O(e):45===e?d(e):c(e)}function f(t){let n="CDATA[";return t===n.charCodeAt(i++)?(e.consume(t),i===n.length?p:f):r(t)}function p(t){return null===t?r(t):93===t?(e.consume(t),g):eP(t)?(s=p,C(t)):(e.consume(t),p)}function g(t){return 93===t?(e.consume(t),m):p(t)}function m(t){return 62===t?O(t):93===t?(e.consume(t),m):p(t)}function y(t){return null===t||62===t?O(t):eP(t)?(s=y,C(t)):(e.consume(t),y)}function v(t){return null===t?r(t):63===t?(e.consume(t),b):eP(t)?(s=v,C(t)):(e.consume(t),v)}function b(e){return 62===e?O(e):v(e)}function w(t){return ej(t)?(e.consume(t),x):r(t)}function x(t){return 45===t||eA(t)?(e.consume(t),x):function t(r){return eP(r)?(s=t,C(r)):eL(r)?(e.consume(r),t):O(r)}(t)}function k(t){return 45===t||eA(t)?(e.consume(t),k):47===t||62===t||eR(t)?_(t):r(t)}function _(t){return 47===t?(e.consume(t),O):58===t||95===t||ej(t)?(e.consume(t),S):eP(t)?(s=_,C(t)):eL(t)?(e.consume(t),_):O(t)}function S(t){return 45===t||46===t||58===t||95===t||eA(t)?(e.consume(t),S):function t(r){return 61===r?(e.consume(r),E):eP(r)?(s=t,C(r)):eL(r)?(e.consume(r),t):_(r)}(t)}function E(t){return null===t||60===t||61===t||62===t||96===t?r(t):34===t||39===t?(e.consume(t),n=t,j):eP(t)?(s=E,C(t)):eL(t)?(e.consume(t),E):(e.consume(t),A)}function j(t){return t===n?(e.consume(t),n=void 0,T):null===t?r(t):eP(t)?(s=j,C(t)):(e.consume(t),j)}function A(t){return null===t||34===t||39===t||60===t||61===t||96===t?r(t):47===t||62===t||eR(t)?_(t):(e.consume(t),A)}
34function T(e){return 47===e||62===e||eR(e)?_(e):r(e)}function O(n){return 62===n?(e.consume(n),e.exit("htmlTextData"),e.exit("htmlText"),t):r(n)}function C(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),N}function N(t){return eL(t)?e$(e,I,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):I(t)}function I(t){return e.enter("htmlTextData"),s(t)}}}],91:t_,92:[{name:"hardBreakEscape",tokenize:function(e,t,r){return function(t){return e.enter("hardBreakEscape"),e.consume(t),n};function n(n){return eP(n)?(e.exit("hardBreakEscape"),t(n)):r(n)}}},th],93:tg,95:tx,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,r,n=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[n][1].type||"space"===e[n][1].type)){for(t=i;++t<n;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[n][1].type="codeTextPadding",i+=2,n-=2;break}}for(t=i-1,n++;++t<=n;)void 0===r?t!==n&&"lineEnding"!==e[t][1].type&&(r=t):(t===n||"lineEnding"===e[t][1].type)&&(e[r][1].type="codeTextData",t!==r+2&&(e[r][1].end=e[t-1][1].end,e.splice(r+2,t-r-2),n-=t-r-2,t=r+2),r=void 0);return e},tokenize:function(e,t,r){let n,i,s=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(r){return 96===r?(e.consume(r),s++,t):(e.exit("codeTextSequence"),a(r))}(t)};function a(l){return null===l?r(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),a):96===l?(i=e.enter("codeTextSequence"),n=0,function r(a){return 96===a?(e.consume(a),n++,r):n===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(a)):(i.type="codeTextData",o(a))}(l)):eP(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):(e.enter("codeTextData"),o(l))}function o(t){return null===t||32===t||96===t||eP(t)?(e.exit("codeTextData"),a(t)):(e.consume(t),o)}}}},tC={null:[tx,eK]},tN={null:[42,95]},tI={null:[]},tP=/[\0\t\n\r]/g;function tR(e,t){let r=Number.parseInt(e,t);return r<9||11===r||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(65535&r)==65535||(65535&r)==65534||r>1114111?"�":String.fromCodePoint(r)}let tL=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function tD(e,t,r){if(t)return t;if(35===r.charCodeAt(0)){let e=r.charCodeAt(1),t=120===e||88===e;return tR(r.slice(t?2:1),t?16:10)}return tc(r)||e}let tM={}.hasOwnProperty;function tU(e){return{line:e.line,column:e.column,offset:e.offset}}function t$(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+G({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+G({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+G({start:t.start,end:t.end})+") is still open")}function tF(e){let t=this;t.parser=function(r){var n,s;let a,o,l,u;return"string"!=typeof(n={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(s=n,n=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:n(y),autolinkProtocol:u,autolinkEmail:u,atxHeading:n(p),blockQuote:n(function(){return{type:"blockquote",children:[]}}),characterEscape:u,characterReference:u,codeFenced:n(f),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:n(f,i),codeText:n(function(){return{type:"inlineCode",value:""}},i),codeTextData:u,data:u,codeFlowValue:u,definition:n(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:n(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:n(g),hardBreakTrailing:n(g),htmlFlow:n(m,i),htmlFlowData:u,htmlText:n(m,i),htmlTextData:u,image:n(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:n(y),listItem:n(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:n(v,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:n(v),paragraph:n(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:n(p),strong:n(function(){return{type:"strong",children:[]}}),thematicBreak:n(function(){return{type:"thematicBreak"}})},exit:{atxHeading:a(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:a(),autolinkEmail:function(e){c.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){c.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:a(),characterEscapeValue:c,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t,r=this.sliceSerialize(e),n=this.data.characterReferenceType;n?(t=tR(r,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):t=tc(r);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=tU(e.end)},codeFenced:a(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:c,codeIndented:a(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:a(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:c,data:c,definition:a(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=e7(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:a(),hardBreakEscape:a(d),hardBreakTrailing:a(d),htmlFlow:a(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:c,htmlText:a(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:c,image:a(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),r=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===r.type?r.children=e.children:r.alt=t},labelText:function(e){let t=this.sliceSerialize(e),r=this.stack[this.stack.length-2];r.label=t.replace(tL,tD),r.identifier=e7(t).toLowerCase()},lineEnding:function(e){let r=this.stack[this.stack.length-1];if(this.data.atHardBreak){r.children[r.children.length-1].position.end=tU(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(r.type)&&(u.call(this,e),c.call(this,e))},link:a(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:function(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.label=t,r.identifier=e7(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:a(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:a(),thematicBreak:a()}};!function e(t,r){let n=-1;for(;++n<r.length;){let i=r[n];Array.isArray(i)?e(t,i):function(e,t){let r;for(r in t)if(tM.call(t,r))switch(r){case"canContainEols":{let n=t[r];n&&e[r].push(...n);break}case"transforms":{let n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{let n=t[r];n&&Object.assign(e[r],n)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let r={};return function(e){let n={type:"root",children:[]},a={stack:[n],tokenStack:[],config:t,enter:s,exit:o,buffer:i,resume:l,data:r},u=[],c=-1;for(;++c<e.length;)("listOrdered"===e[c][1].type||"listUnordered"===e[c][1].type)&&("enter"===e[c][0]?u.push(c):c=function(e,t,r){let n,i,s,a,o=t-1,l=-1,u=!1;for(;++o<=r;){let t=e[o];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,a=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!n||a||l||s||(s=o),a=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:a=void 0}
34if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(n){let a=o;for(i=void 0;a--;){let t=e[a];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",u=!0),t[1].type="lineEnding",i=a}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}s&&(!i||s<i)&&(n._spread=!0),n.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||o,0,["exit",n,t[2]]),o++,r++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};n=i,e.splice(o,0,["enter",i,t[2]]),o++,r++,s=void 0,a=!0}}}return e[t][1]._spread=u,r}(e,u.pop(),c));for(c=-1;++c<e.length;){let r=t[e[c][0]];tM.call(r,e[c][1].type)&&r[e[c][1].type].call(Object.assign({sliceSerialize:e[c][2].sliceSerialize},a),e[c][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||t$).call(a,void 0,e[0])}for(n.position={start:tU(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:tU(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c<t.transforms.length;)n=t.transforms[c](n)||n;return n};function n(e,t){return function(r){s.call(this,e(r),r),t&&t.call(this,r)}}function i(){this.stack.push({type:"fragment",children:[]})}function s(e,t,r){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,r||void 0]),e.position={start:tU(t.start),end:void 0}}function a(e){return function(t){e&&e.call(this,t),o.call(this,t)}}function o(e,t){let r=this.stack.pop(),n=this.tokenStack.pop();if(n)n[0].type!==e.type&&(t?t.call(this,e,n[0]):(n[1]||t$).call(this,e,n[0]));else throw Error("Cannot close `"+e.type+"` ("+G({start:e.start,end:e.end})+"): it’s not open");r.position.end=tU(e.end)}function l(){return ev(this.stack.pop(),"boolean"!=typeof ey.includeImageAlt||ey.includeImageAlt,"boolean"!=typeof ey.includeHtml||ey.includeHtml)}function u(e){let t=this.stack[this.stack.length-1].children,r=t[t.length-1];r&&"text"===r.type||((r={type:"text",value:""}).position={start:tU(e.start),end:void 0},t.push(r)),this.stack.push(r)}function c(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=tU(e.end)}function d(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function p(){return{type:"heading",depth:0,children:[]}}function g(){return{type:"break"}}function m(){return{type:"html",value:""}}function y(){return{type:"link",title:null,url:"",children:[]}}function v(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(s)(function(e){for(;!eS(e););return e}((function(e){let t={constructs:function(e){let t={},r=-1;for(;++r<e.length;)!function(e,t){let r;for(r in t){let n,i=(eE.call(e,r)?e[r]:void 0)||(e[r]={}),s=t[r];
34if(s)for(n in s){eE.call(i,n)||(i[n]=[]);let e=s[n];!function(e,t){let r=-1,n=[];for(;++r<t.length;)("after"===t[r].add?e:n).push(t[r]);ew(e,0,0,n)}(i[n],Array.isArray(e)?e:e?[e]:[])}}}(t,e[r]);return t}([i,...(e||{}).extensions||[]]),content:r(eF),defined:[],document:r(eB),flow:r(eW),lazy:{},string:r(eJ),text:r(eG)};return t;function r(e){return function(r){return function(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0},i={},s=[],a=[],o=[],l={attempt:p(function(e,t){g(e,t.from)}),check:p(f),consume:function(e){eP(e)?(n.line++,n.column=1,n.offset+=-3===e?2:1,m()):-1!==e&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===a[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=e},enter:function(e,t){let r=t||{};return r.type=e,r.start=h(),u.events.push(["enter",r,u]),o.push(r),r},exit:function(e){let t=o.pop();return t.end=h(),u.events.push(["exit",t,u]),t},interrupt:p(f,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,m()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let r,n=-1,i=[];for(;++n<e.length;){let s,a=e[n];if("string"==typeof a)s=a;else switch(a){case -5:s="\r";break;case -4:s="\n";break;case -3:s="\r\n";break;case -2:s=t?" ":"	";break;case -1:if(!t&&r)continue;s=" ";break;default:s=String.fromCharCode(a)}r=-2===a,i.push(s)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(a=ex(a,e),function(){let e;for(;n._index<a.length;){let r=a[n._index];if("string"==typeof r)for(e=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===e&&n._bufferIndex<r.length;){var t;t=r.charCodeAt(n._bufferIndex),c=c(t)}else c=c(r)}}(),null!==a[a.length-1])?[]:(g(t,0),u.events=tp(s,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&s.push(t),u;function d(e){return function(e,t){let r,n=t.start._index,i=t.start._bufferIndex,s=t.end._index,a=t.end._bufferIndex;if(n===s)r=[e[n].slice(i,a)];else{if(r=e.slice(n,s),i>-1){let e=r[0];"string"==typeof e?r[0]=e.slice(i):r.shift()}a>0&&r.push(e[s].slice(0,a))}return r}(a,e)}function h(){let{_bufferIndex:e,_index:t,line:r,column:i,offset:s}=n;return{_bufferIndex:e,_index:t,line:r,column:i,offset:s}}function f(e,t){t.restore()}function p(e,t){return function(r,i,s){var a;let c,d,f,p;return Array.isArray(r)?g(r):"tokenize"in r?g([r]):(a=r,function(e){let t=null!==e&&a[e],r=null!==e&&a.null;return g([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(r)?r:r?[r]:[]])(e)});function g(e){return(c=e,d=0,0===e.length)?s:y(e[d])}function y(e){return function(r){return(p=function(){let e=h(),t=u.previous,r=u.currentConstruct,i=u.events.length,s=Array.from(o);return{from:i,restore:function(){n=e,u.previous=t,u.currentConstruct=r,u.events.length=i,o=s,m()}}}(),f=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?b(r):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,v,b)(r)}}function v(t){return e(f,p),i}function b(e){return(p.restore(),++d<c.length)?y(c[d]):s}}}function g(e,t){e.resolveAll&&!s.includes(e)&&s.push(e),e.resolve&&ew(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function m(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}(t,e,r)}}})(s).document().write((o=1,l="",u=!0,function(e,t,r){let n,i,s,c,d,h=[];for(e=l+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),s=0,l="",u&&(65279===e.charCodeAt(0)&&s++,u=void 0);s<e.length;){if(tP.lastIndex=s,c=(n=tP.exec(e))&&void 0!==n.index?n.index:e.length,d=e.charCodeAt(c),!n){l=e.slice(s);break}if(10===d&&s===c&&a)h.push(-3),a=void 0;else switch(a&&(h.push(-5),a=void 0),s<c&&(h.push(e.slice(s,c)),o+=c-s),d){case 0:h.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),h.push(-2);o++<i;)h.push(-1);break;case 10:h.push(-4),o=1;break;default:a=!0,o=1}s=c+1}return r&&(a&&h.push(-5),l&&h.push(l),h.push(null)),h})(r,n,!0))))}}let tB="object"==typeof self?self:globalThis,tz=e=>((e,t)=>{let r=(t,r)=>(e.set(r,t),t),n=i=>{if(e.has(i))return e.get(i);let[s,a]=t[i];switch(s){case 0:case -1:return r(a,i);case 1:{let e=r([],i);
34for(let t of a)e.push(n(t));return e}case 2:{let e=r({},i);for(let[t,r]of a)e[n(t)]=n(r);return e}case 3:return r(new Date(a),i);case 4:{let{source:e,flags:t}=a;return r(new RegExp(e,t),i)}case 5:{let e=r(new Map,i);for(let[t,r]of a)e.set(n(t),n(r));return e}case 6:{let e=r(new Set,i);for(let t of a)e.add(n(t));return e}case 7:{let{name:e,message:t}=a;return r(new tB[e](t),i)}case 8:return r(BigInt(a),i);case"BigInt":return r(Object(BigInt(a)),i)}return r(new tB[s](a),i)};return n})(new Map,e)(0),{toString:tq}={},{keys:tV}=Object,tH=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let r=tq.call(e).slice(8,-1);switch(r){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},tW=([e,t])=>0===e&&("function"===t||"symbol"===t),tK=(e,{json:t,lossy:r}={})=>{let n=[];return((e,t,r,n)=>{let i=(e,t)=>{let i=n.push(e)-1;return r.set(t,i),i},s=n=>{if(r.has(n))return r.get(n);let[a,o]=tH(n);switch(a){case 0:{let t=n;switch(o){case"bigint":a=8,t=n.toString();break;case"function":case"symbol":if(e)throw TypeError("unable to serialize "+o);t=null;break;case"undefined":return i([-1],n)}return i([a,t],n)}case 1:{if(o)return i([o,[...n]],n);let e=[],t=i([a,e],n);for(let t of n)e.push(s(t));return t}case 2:{if(o)switch(o){case"BigInt":return i([o,n.toString()],n);case"Boolean":case"Number":case"String":return i([o,n.valueOf()],n)}if(t&&"toJSON"in n)return s(n.toJSON());let r=[],l=i([a,r],n);for(let t of tV(n))(e||!tW(tH(n[t])))&&r.push([s(t),s(n[t])]);return l}case 3:return i([a,n.toISOString()],n);case 4:{let{source:e,flags:t}=n;return i([a,{source:e,flags:t}],n)}case 5:{let t=[],r=i([a,t],n);for(let[r,i]of n)(e||!(tW(tH(r))||tW(tH(i))))&&t.push([s(r),s(i)]);return r}case 6:{let t=[],r=i([a,t],n);for(let r of n)(e||!tW(tH(r)))&&t.push(s(r));return r}}let{message:l}=n;return i([a,{name:o,message:l}],n)};return s})(!(t||r),!!t,new Map,n)(e),n},tJ="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?tz(tK(e,t)):structuredClone(e):(e,t)=>tz(tK(e,t));function tG(e){let t=[],r=-1,n=0,i=0;for(;++r<e.length;){let s=e.charCodeAt(r),a="";if(37===s&&eA(e.charCodeAt(r+1))&&eA(e.charCodeAt(r+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){let t=e.charCodeAt(r+1);s<56320&&t>56319&&t<57344?(a=String.fromCharCode(s,t),i=1):a="�"}else a=String.fromCharCode(s);a&&(t.push(e.slice(n,r),encodeURIComponent(a)),n=r+i+1,a=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function tY(e,t){let r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function tX(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let tZ=function(e){var t,r;if(null==e)return t0;if("function"==typeof e)return tQ(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],r=-1;for(;++r<e.length;)t[r]=tZ(e[r]);return tQ(function(...e){let r=-1;for(;++r<t.length;)if(t[r].apply(this,e))return!0;return!1})}(e):(t=e,tQ(function(e){let r;for(r in t)if(e[r]!==t[r])return!1;return!0}))}if("string"==typeof e){return r=e,tQ(function(e){return e&&e.type===r})}throw Error("Expected function, string, or object as test")};function tQ(e){return function(t,r,n){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof r?r:void 0,n||void 0))}}function t0(){return!0}let t1=[];function t2(e,t,r,n){let i,s,a,o;"function"==typeof t&&"function"!=typeof r?(s=void 0,a=t,i=r):(s=t,a=r,i=n);var l=s,u=function(e,t){let r=t[t.length-1],n=r?r.children.indexOf(e):void 0;return a(e,n,r)},c=i;"function"==typeof l&&"function"!=typeof u?(c=u,u=l):o=l;let d=tZ(o),h=c?-1:1;(function e(t,r,n){let i=t&&"object"==typeof t?t:{};if("string"==typeof i.type){let e="string"==typeof i.tagName?i.tagName:"string"==typeof i.name?i.name:void 0;Object.defineProperty(s,"name",{value:"node ("+t.type+(e?"<"+e+">":"")+")"})}return s;function s(){var i;let s,a,o,f=t1;if((!l||d(t,r,n[n.length-1]||void 0))&&!1===(f=Array.isArray(i=u(t,n))?i:"number"==typeof i?[!0,i]:null==i?t1:[i])[0])return f;if("children"in t&&t.children&&t.children&&"skip"!==f[0])for(a=(c?t.children.length:-1)+h,o=n.concat(t);a>-1&&a<t.children.length;){if(!1===(s=e(t.children[a],a,o)())[0])return s;a="number"==typeof s[1]?s[1]:a+h}return f}})(e,void 0,[])()}function t4(e,t){let r=t.referenceType,n="]";if("collapsed"===r?n+="[]":"full"===r&&(n+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+n}];let i=e.all(t),s=i[0];s&&"text"===s.type?s.value="["+s.value:i.unshift({type:"text",value:"["});let a=i[i.length-1];return a&&"text"===a.type?a.value+=n:i.push({type:"text",value:n}),i}function t3(e){let t=e.spread;return null==t?e.children.length>1:t}function t5(e,t,r){let n=0,i=e.length;if(t){let t=e.codePointAt(n);for(;9===t||32===t;)n++,t=e.codePointAt(n)}if(r){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}let t6={blockquote:function(e,t){let r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)},break:function(e,t){let r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:"\n"}]},code:function(e,t){let r=t.value?t.value+"\n":"",n={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(n.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s={type:"element",tagName:"pre",properties:{},children:[s=e.applyData(t,s)]},e.patch(t,s),s},delete:function(e,t){let r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},emphasis:function(e,t){let r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}
34,footnoteReference:function(e,t){let r,n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),s=tG(i.toLowerCase()),a=e.footnoteOrder.indexOf(i),o=e.footnoteCounts.get(i);void 0===o?(o=0,e.footnoteOrder.push(i),r=e.footnoteOrder.length):r=a+1,o+=1,e.footnoteCounts.set(i,o);let l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(r)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){let r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},html:function(e,t){if(e.options.allowDangerousHtml){let r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}},imageReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return t4(e,t);let i={src:tG(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(i.title=n.title);let s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)},image:function(e,t){let r={src:tG(t.url)};null!==t.alt&&void 0!==t.alt&&(r.alt=t.alt),null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)},inlineCode:function(e,t){let r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);let n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)},linkReference:function(e,t){let r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return t4(e,t);let i={href:tG(n.url||"")};null!==n.title&&void 0!==n.title&&(i.title=n.title);let s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)},link:function(e,t){let r={href:tG(t.url)};null!==t.title&&void 0!==t.title&&(r.title=t.title);let n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},listItem:function(e,t,r){let n=e.all(t),i=r?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let r=e.children,n=-1;for(;!t&&++n<r.length;)t=t3(r[n])}return t}(r):t3(t),s={},a=[];if("boolean"==typeof t.checked){let e,r=n[0];r&&"element"===r.type&&"p"===r.tagName?e=r:(e={type:"element",tagName:"p",properties:{},children:[]},n.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let o=-1;for(;++o<n.length;){let e=n[o];(i||0!==o||"element"!==e.type||"p"!==e.tagName)&&a.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?a.push(e):a.push(...e.children)}let l=n[n.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&a.push({type:"text",value:"\n"});let u={type:"element",tagName:"li",properties:s,children:a};return e.patch(t,u),e.applyData(t,u)},list:function(e,t){let r={},n=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(r.start=t.start);++i<n.length;){let e=n[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}let s={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,s),e.applyData(t,s)},paragraph:function(e,t){let r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},root:function(e,t){let r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)},strong:function(e,t){let r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},table:function(e,t){let r=e.all(t),n=r.shift(),i=[];if(n){let r={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],r),i.push(r)}if(r.length>0){let n={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},s=K(t.children[1]),a=W(t.children[t.children.length-1]);s&&a&&(n.position={start:s,end:a}),i.push(n)}let s={type:"element",tagName:"table",properties:{}
34,children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)},tableCell:function(e,t){let r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},tableRow:function(e,t,r){let n=r?r.children:void 0,i=0===(n?n.indexOf(t):1)?"th":"td",s=r&&"table"===r.type?r.align:void 0,a=s?s.length:t.children.length,o=-1,l=[];for(;++o<a;){let r=t.children[o],n={},a=s?s[o]:void 0;a&&(n.align=a);let u={type:"element",tagName:i,properties:n,children:[]};r&&(u.children=e.all(r),e.patch(r,u),u=e.applyData(r,u)),l.push(u)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)},text:function(e,t){let r={type:"text",value:function(e){let t=String(e),r=/\r?\n|\r/g,n=r.exec(t),i=0,s=[];for(;n;)s.push(t5(t.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return s.push(t5(t.slice(i),i>0,!1)),s.join("")}(String(t.value))};return e.patch(t,r),e.applyData(t,r)},thematicBreak:function(e,t){let r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)},toml:t8,yaml:t8,definition:t8,footnoteDefinition:t8};function t8(){}let t7={}.hasOwnProperty,t9={};function re(e,t){e.position&&(t.position=function(e){let t=K(e),r=W(e);if(t&&r)return{start:t,end:r}}(e))}function rt(e,t){let r=t;if(e&&e.data){let t=e.data.hName,n=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===r.type?r.tagName=t:r={type:"element",tagName:t,properties:{},children:"children"in r?r.children:[r]}),"element"===r.type&&i&&Object.assign(r.properties,tJ(i)),"children"in r&&r.children&&null!=n&&(r.children=n)}return r}function rr(e,t){let r=[],n=-1;for(t&&r.push({type:"text",value:"\n"});++n<e.length;)n&&r.push({type:"text",value:"\n"}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:"\n"}),r}function rn(e){let t=0,r=e.charCodeAt(t);for(;9===r||32===r;)t++,r=e.charCodeAt(t);return e.slice(t)}function ri(e,t){let r=function(e,t){let r=t||t9,n=new Map,i=new Map,s={all:function(e){let t=[];if("children"in e){let r=e.children,n=-1;for(;++n<r.length;){let i=s.one(r[n],e);if(i){if(n&&"break"===r[n-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=rn(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=rn(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:rt,definitionById:n,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...t6,...r.handlers},one:function(e,t){let r=e.type,n=s.handlers[r];if(t7.call(s.handlers,r)&&n)return n(s,e,t);if(s.options.passThrough&&s.options.passThrough.includes(r)){if("children"in e){let{children:t,...r}=e,n=tJ(r);return n.children=s.all(e),n}return tJ(e)}return(s.options.unknownHandler||function(e,t){let r=t.data||{},n="value"in t&&!(t7.call(r,"hProperties")||t7.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)})(s,e,t)},options:r,patch:re,wrap:rr};return t2(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?n:i,r=String(e.identifier).toUpperCase();t.has(r)||t.set(r,e)}}),s}(e,t),n=r.one(e,void 0),i=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||tY,n=e.options.footnoteBackLabel||tX,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let s=e.all(i),a=String(i.identifier).toUpperCase(),u=tG(a.toLowerCase()),c=0,d=[],h=e.footnoteCounts.get(a);for(;void 0!==h&&++c<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof r?r:r(l,c);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof n?n:n(l,c),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let f=s[s.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...d)}else s.push(...d);let p={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(s,!0)};e.patch(i,p),o.push(p)}if(0!==o.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...tJ(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)}
34,{type:"text",value:"\n"}]}}(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:"\n"},i),s}function rs(e,t){return e&&"run"in e?async function(r,n){let i=ri(r,{file:n,...t});await e.run(i,n)}:function(r,n){return ri(r,{file:n,...e||t})}}function ra(e){if(e)throw e}var ro=r(99735);function rl(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let ru={basename:function(e,t){let r;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');rc(e);let n=0,i=-1,s=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;s--;)if(47===e.codePointAt(s)){if(r){n=s+1;break}}else i<0&&(r=!0,i=s+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let a=-1,o=t.length-1;for(;s--;)if(47===e.codePointAt(s)){if(r){n=s+1;break}}else a<0&&(r=!0,a=s+1),o>-1&&(e.codePointAt(s)===t.codePointAt(o--)?o<0&&(i=s):(o=-1,i=a));return n===i?i=a:i<0&&(i=e.length),e.slice(n,i)},dirname:function(e){let t;if(rc(e),0===e.length)return".";let r=-1,n=e.length;for(;--n;)if(47===e.codePointAt(n)){if(t){r=n;break}}else t||(t=!0);return r<0?47===e.codePointAt(0)?"/":".":1===r&&47===e.codePointAt(0)?"//":e.slice(0,r)},extname:function(e){let t;rc(e);let r=e.length,n=-1,i=0,s=-1,a=0;for(;r--;){let o=e.codePointAt(r);if(47===o){if(t){i=r+1;break}continue}n<0&&(t=!0,n=r+1),46===o?s<0?s=r:1!==a&&(a=1):s>-1&&(a=-1)}return s<0||n<0||0===a||1===a&&s===n-1&&s===i+1?"":e.slice(s,n)},join:function(...e){let t,r=-1;for(;++r<e.length;)rc(e[r]),e[r]&&(t=void 0===t?e[r]:t+"/"+e[r]);return void 0===t?".":function(e){rc(e);let t=47===e.codePointAt(0),r=function(e,t){let r,n,i="",s=0,a=-1,o=0,l=-1;for(;++l<=e.length;){if(l<e.length)r=e.codePointAt(l);else if(47===r)break;else r=47;if(47===r){if(a===l-1||1===o);else if(a!==l-1&&2===o){if(i.length<2||2!==s||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((n=i.lastIndexOf("/"))!==i.length-1){n<0?(i="",s=0):s=(i=i.slice(0,n)).length-1-i.lastIndexOf("/"),a=l,o=0;continue}}else if(i.length>0){i="",s=0,a=l,o=0;continue}}t&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(a+1,l):i=e.slice(a+1,l),s=l-a-1;a=l,o=0}else 46===r&&o>-1?o++:o=-1}return i}(e,!t);return 0!==r.length||t||(r="."),r.length>0&&47===e.codePointAt(e.length-1)&&(r+="/"),t?"/"+r:r}(t)},sep:"/"};function rc(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}let rd={cwd:function(){return"/"}};function rh(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let rf=["history","path","basename","stem","extname","dirname"];class rp{constructor(e){let t,r;t=e?rh(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":rd.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<rf.length;){let e=rf[n];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(r in t)rf.includes(r)||(this[r]=t[r])}get basename(){return"string"==typeof this.path?ru.basename(this.path):void 0}set basename(e){rm(e,"basename"),rg(e,"basename"),this.path=ru.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?ru.dirname(this.path):void 0}set dirname(e){ry(this.basename,"dirname"),this.path=ru.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?ru.extname(this.path):void 0}set extname(e){if(rg(e,"extname"),ry(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=ru.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){rh(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!rh(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,r=-1;for(;++r<t.length;)if(37===t.codePointAt(r)&&50===t.codePointAt(r+1)){let e=t.codePointAt(r+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),rm(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?ru.basename(this.path,this.extname):void 0}set stem(e){rm(e,"stem"),rg(e,"stem"),this.path=ru.join(this.dirname||"",e+(this.extname||""))}fail(e,t,r){let n=this.message(e,t,r);throw n.fatal=!0,n}info(e,t,r){let n=this.message(e,t,r);return n.fatal=void 0,n}message(e,t,r){let n=new Q(e,t,r);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function rg(e,t){if(e&&e.includes(ru.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+ru.sep+"`")}function rm(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function ry(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let rv=function(e){let t=this.constructor.prototype,r=t[e],n=function(){return r.apply(n,arguments)};return Object.setPrototypeOf(n,t),n},rb={}.hasOwnProperty;class rw extends rv{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let r=-1,n=t.pop();if("function"!=typeof n)throw TypeError("Expected function as last argument, not "+n);!function i(s,...a){let o=e[++r],l=-1;if(s)return void n(s);for(;++l<t.length;)(null===a[l]||void 0===a[l])&&(a[l]=t[l]);t=a,o?(function(e,t){let r;return function(...t){let s,a=e.length>t.length;a&&t.push(n);try{s=e.apply(this,t)}catch(e){if(a&&r)throw e;return n(e)}a||(s&&s.then&&"function"==typeof s.then?s.then(i,n):s instanceof Error?n(s):i(s))};function n(e,...i){r||(r=!0,t(e,...i))}function i(e){n(null,e)}})(o,i)(...a):n(null,...a)}(null,...t)},use:function(r){if("function"!=typeof r)throw TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}};return t}()}copy(){let e=new rw,t=-1;for(;++t<this.attachers.length;){let r=this.attachers[t];e.use(...r)}return e.data(ro(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(rS("data",this.frozen),this.namespace[e]=t,this):rb.call(this.namespace,e)&&this.namespace[e]||void 0:e?(rS("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let r=e.call(this,...t);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=rA(e),r=this.parser||this.Parser;return rk("parse",r),r(String(t),t)}process(e,t){let r=this;return this.freeze(),rk("process",this.parser||this.Parser),r_("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(n,i){let s=rA(e),a=r.parse(s);function o(e,r){e||!r?i(e):n?n(r):t(void 0,r)}r.run(a,s,function(e,t,n){var i,s;if(e||!t||!n)return o(e);let a=r.stringify(t,n);"string"==typeof(i=a)||(s=i)&&"object"==typeof s&&"byteLength"in s&&"byteOffset"in s?n.value=a:n.result=a,o(e,n)})}}processSync(e){let t,r=!1;return this.freeze(),rk("processSync",this.parser||this.Parser),r_("processSync",this.compiler||this.Compiler),this.process(e,function(e,n){r=!0,ra(e),t=n}),rj("processSync","process",r),t}run(e,t,r){rE(e),this.freeze();let n=this.transformers;return r||"function"!=typeof t||(r=t,t=void 0),r?i(void 0,r):new Promise(i);function i(i,s){let a=rA(t);n.run(e,a,function(t,n,a){let o=n||e;t?s(t):i?i(o):r(void 0,o,a)})}}runSync(e,t){let r,n=!1;return this.run(e,t,function(e,t){ra(e),r=t,n=!0}),rj("runSync","run",n),r}stringify(e,t){this.freeze();let r=rA(t),n=this.compiler||this.Compiler;return r_("stringify",n),rE(e),n(e,r)}use(e,...t){let r=this.attachers,n=this.namespace;if(rS("use",this.frozen),null==e);else if("function"==typeof e)a(e,t);
34else if("object"==typeof e)Array.isArray(e)?s(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(n.settings=ro(!0,n.settings,e.settings))}function s(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;){var r=e[t];if("function"==typeof r)a(r,[]);else if("object"==typeof r)if(Array.isArray(r)){let[e,...t]=r;a(e,t)}else i(r);else throw TypeError("Expected usable value, not `"+r+"`")}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function a(e,t){let n=-1,i=-1;for(;++n<r.length;)if(r[n][0]===e){i=n;break}if(-1===i)r.push([e,...t]);else if(t.length>0){let[n,...s]=t,a=r[i][1];rl(a)&&rl(n)&&(n=ro(!0,a,n)),r[i]=[e,n,...s]}}}}let rx=new rw().freeze();function rk(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function r_(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function rS(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function rE(e){if(!rl(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function rj(e,t,r){if(!r)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function rA(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new rp(e)}let rT=[],rO={allowDangerousHtml:!0},rC=/^(https?|ircs?|mailto|xmpp)$/i,rN=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function rI(e){let t=e.allowedElements,r=e.allowElement,n=e.children||"",i=e.className,s=e.components,a=e.disallowedElements,o=e.rehypePlugins||rT,l=e.remarkPlugins||rT,u=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...rO}:rO,c=e.skipHtml,d=e.unwrapDisallowed,h=e.urlTransform||rP,f=rx().use(tF).use(l).use(rs,u).use(o),p=new rp;for(let t of("string"==typeof n&&(p.value=n),rN))Object.hasOwn(e,t.from)&&(t.from,t.to&&t.to,t.id);let g=f.parse(p),m=f.runSync(g,p);return i&&(m={type:"element",tagName:"div",properties:{className:i},children:"root"===m.type?m.children:[m]}),t2(m,function(e,n,i){if("raw"===e.type&&i&&"number"==typeof n)return c?i.children.splice(n,1):i.children[n]={type:"text",value:e.value},n;if("element"===e.type){let t;for(t in eg)if(Object.hasOwn(eg,t)&&Object.hasOwn(e.properties,t)){let r=e.properties[t],n=eg[t];(null===n||n.includes(e.tagName))&&(e.properties[t]=h(String(r||""),t,e))}}if("element"===e.type){let s=t?!t.includes(e.tagName):!!a&&a.includes(e.tagName);if(!s&&r&&"number"==typeof n&&(s=!r(e,n,i)),s&&i&&"number"==typeof n)return d&&e.children?i.children.splice(n,1,...e.children):i.children.splice(n,1),n}}),function(e,t){var r,n,i,s;let a;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let o=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=o,n=t.jsxDEV,a=function(e,t,i,s){let a=Array.isArray(i.children),o=K(e);return n(t,i,s,a,{columnNumber:o?o.column-1:void 0,fileName:r,lineNumber:o?o.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");
34if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,s=t.jsxs,a=function(e,t,r,n){let a=Array.isArray(r.children)?s:i;return n?a(t,r,n):a(t,r)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:o,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?M:D,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},u=eo(l,e,void 0);return u&&"string"!=typeof u?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}(m,{Fragment:em.Fragment,components:s,ignoreInvalidStyle:!0,jsx:em.jsx,jsxs:em.jsxs,passKeys:!0,passNode:!0})}function rP(e){let t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),i=e.indexOf("/");return t<0||i>-1&&t>i||r>-1&&t>r||n>-1&&t>n||rC.test(e.slice(0,t))?e:""}},99735:e=>{"use strict";var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===r.call(e)},a=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var n,i=t.call(e,"constructor"),s=e.constructor&&e.constructor.prototype&&t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!i&&!s)return!1;for(n in e);return void 0===n||t.call(e,n)},o=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,r){if("__proto__"===r){if(!t.call(e,r))return;else if(i)return i(e,r).value}return e[r]};e.exports=function e(){var t,r,n,i,u,c,d=arguments[0],h=1,f=arguments.length,p=!1;for("boolean"==typeof d&&(p=d,d=arguments[1]||{},h=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});h<f;++h)if(t=arguments[h],null!=t)for(r in t)n=l(d,r),d!==(i=l(t,r))&&(p&&i&&(a(i)||(u=s(i)))?(u?(u=!1,c=n&&s(n)?n:[]):c=n&&a(n)?n:{},o(d,{name:r,newValue:e(p,c,i)})):void 0!==i&&o(d,{name:r,newValue:i}));return d}}},e=>{var t=t=>e(e.s=t);e.O(0,[6593,8792],()=>(t(49134),t(92),t(16296))),_N_E=e.O()}]);

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.