@nvwa-app/sdk-web 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var ce=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var jt=Object.prototype.hasOwnProperty;var Ut=(e,t)=>{for(var r in t)ce(e,r,{get:t[r],enumerable:!0})},Dt=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ct(t))!jt.call(e,o)&&o!==r&&ce(e,o,{get:()=>t[o],enumerable:!(s=$t(t,o))||s.enumerable});return e};var Mt=e=>Dt(ce({},"__esModule",{value:!0}),e);var ms={};Ut(ms,{default:()=>le,disableIframeHoverInspector:()=>hs,enableIframeHoverInspector:()=>cs,getIframeSourceLocation:()=>ds,localStorage:()=>be,setupIframeHoverInspector:()=>us,setupIframeSourceLocationListener:()=>ps});module.exports=Mt(ms);var Ht=Object.create,ae=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,Bt=Object.getOwnPropertyNames,Ft=Object.getPrototypeOf,qt=Object.prototype.hasOwnProperty,xe=(e,t)=>()=>(e&&(t=e(e=0)),t),D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Wt=(e,t)=>{for(var r in t)ae(e,r,{get:t[r],enumerable:!0})},$e=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Bt(t))!qt.call(e,o)&&o!==r&&ae(e,o,{get:()=>t[o],enumerable:!(s=kt(t,o))||s.enumerable});return e},Gt=(e,t,r)=>(r=e!=null?Ht(Ft(e)):{},$e(t||!e||!e.__esModule?ae(r,"default",{value:e,enumerable:!0}):r,e)),q=e=>$e(ae({},"__esModule",{value:!0}),e),p=xe(()=>{"use strict"}),M={};Wt(M,{__addDisposableResource:()=>nt,__assign:()=>Y,__asyncDelegator:()=>Je,__asyncGenerator:()=>Ke,__asyncValues:()=>Xe,__await:()=>F,__awaiter:()=>qe,__classPrivateFieldGet:()=>tt,__classPrivateFieldIn:()=>st,__classPrivateFieldSet:()=>rt,__createBinding:()=>K,__decorate:()=>Ue,__disposeResources:()=>ot,__esDecorate:()=>Me,__exportStar:()=>Ge,__extends:()=>Ce,__generator:()=>We,__importDefault:()=>et,__importStar:()=>Ze,__makeTemplateObject:()=>Qe,__metadata:()=>Fe,__param:()=>De,__propKey:()=>ke,__read:()=>ye,__rest:()=>je,__rewriteRelativeImportExtension:()=>at,__runInitializers:()=>He,__setFunctionName:()=>Be,__spread:()=>ze,__spreadArray:()=>Ye,__spreadArrays:()=>Ve,__values:()=>ne,default:()=>ut});function Ce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Z(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function je(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(r[s[o]]=e[s[o]]);return r}function Ue(e,t,r,s){var o=arguments.length,n=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,r):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,r,s);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(n=(o<3?a(n):o>3?a(t,r,n):a(t,r))||n);return o>3&&n&&Object.defineProperty(t,r,n),n}function De(e,t){return function(r,s){t(r,s,e)}}function Me(e,t,r,s,o,n){function a(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var l=s.kind,u=l==="getter"?"get":l==="setter"?"set":"value",i=!t&&e?s.static?e:e.prototype:null,c=t||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),h,m=!1,d=r.length-1;d>=0;d--){var y={};for(var E in s)y[E]=E==="access"?{}:s[E];for(var E in s.access)y.access[E]=s.access[E];y.addInitializer=function(v){if(m)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(v||null))};var g=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[u],y);if(l==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(h=a(g.get))&&(c.get=h),(h=a(g.set))&&(c.set=h),(h=a(g.init))&&o.unshift(h)}else(h=a(g))&&(l==="field"?o.unshift(h):c[u]=h)}i&&Object.defineProperty(i,s.name,c),m=!0}function He(e,t,r){for(var s=arguments.length>2,o=0;o<t.length;o++)r=s?t[o].call(e,r):t[o].call(e);return s?r:void 0}function ke(e){return typeof e=="symbol"?e:"".concat(e)}function Be(e,t,r){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function Fe(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function qe(e,t,r,s){function o(n){return n instanceof r?n:new r(function(a){a(n)})}return new(r||(r=Promise))(function(n,a){function l(c){try{i(s.next(c))}catch(h){a(h)}}function u(c){try{i(s.throw(c))}catch(h){a(h)}}function i(c){c.done?n(c.value):o(c.value).then(l,u)}i((s=s.apply(e,t||[])).next())})}function We(e,t){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,o,n,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(i){return function(c){return u([i,c])}}function u(i){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(r=0)),r;)try{if(s=1,o&&(n=i[0]&2?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[i[0]&2,n.value]),i[0]){case 0:case 1:n=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,o=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){r.label=i[1];break}if(i[0]===6&&r.label<n[1]){r.label=n[1],n=i;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(i);break}n[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}catch(c){i=[6,c],o=0}finally{s=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function Ge(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K(t,e,r)}function ne(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],s=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ye(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var s=r.call(e),o,n=[],a;try{for(;(t===void 0||t-- >0)&&!(o=s.next()).done;)n.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}return n}function ze(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ye(arguments[t]));return e}function Ve(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var s=Array(e),o=0,t=0;t<r;t++)for(var n=arguments[t],a=0,l=n.length;a<l;a++,o++)s[o]=n[a];return s}function Ye(e,t,r){if(r||arguments.length===2)for(var s=0,o=t.length,n;s<o;s++)(n||!(s in t))&&(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))}function F(e){return this instanceof F?(this.v=e,this):new F(e)}function Ke(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(e,t||[]),o,n=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(d){return function(y){return Promise.resolve(y).then(d,h)}}function l(d,y){s[d]&&(o[d]=function(E){return new Promise(function(g,v){n.push([d,E,g,v])>1||u(d,E)})},y&&(o[d]=y(o[d])))}function u(d,y){try{i(s[d](y))}catch(E){m(n[0][3],E)}}function i(d){d.value instanceof F?Promise.resolve(d.value.v).then(c,h):m(n[0][2],d)}function c(d){u("next",d)}function h(d){u("throw",d)}function m(d,y){d(y),n.shift(),n.length&&u(n[0][0],n[0][1])}}function Je(e){var t,r;return t={},s("next"),s("throw",function(o){throw o}),s("return"),t[Symbol.iterator]=function(){return this},t;function s(o,n){t[o]=e[o]?function(a){return(r=!r)?{value:F(e[o](a)),done:!1}:n?n(a):a}:n}}function Xe(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof ne=="function"?ne(e):e[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(n){r[n]=e[n]&&function(a){return new Promise(function(l,u){a=e[n](a),o(l,u,a.done,a.value)})}}function o(n,a,l,u){Promise.resolve(u).then(function(i){n({value:i,done:l})},a)}}function Qe(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Ze(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=ee(e),s=0;s<r.length;s++)r[s]!=="default"&&K(t,e,r[s]);return it(t,e),t}function et(e){return e&&e.__esModule?e:{default:e}}function tt(e,t,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(e):s?s.value:t.get(e)}function rt(e,t,r,s,o){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r}function st(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}function nt(e,t,r){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var s,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=t[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=t[Symbol.dispose],r&&(o=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");o&&(s=function(){try{o.call(this)}catch(n){return Promise.reject(n)}}),e.stack.push({value:t,dispose:s,async:r})}else r&&e.stack.push({async:!0});return t}function ot(e){function t(n){e.error=e.hasError?new lt(n,e.error,"An error was suppressed during disposal."):n,e.hasError=!0}var r,s=0;function o(){for(;r=e.stack.pop();)try{if(!r.async&&s===1)return s=0,e.stack.push(r),Promise.resolve().then(o);if(r.dispose){var n=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(n).then(o,function(a){return t(a),o()})}else s|=1}catch(a){t(a)}if(s===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return o()}function at(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,o,n,a){return s?t?".jsx":".js":o&&(!n||!a)?r:o+n+"."+a.toLowerCase()+"js"}):e}var Z,Y,K,it,ee,lt,ut,W=xe(()=>{"use strict";p(),Z=function(e,t){return Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(r[o]=s[o])},Z(e,t)},Y=function(){return Y=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Y.apply(this,arguments)},K=Object.create?(function(e,t,r,s){s===void 0&&(s=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,o)}):(function(e,t,r,s){s===void 0&&(s=r),e[s]=t[r]}),it=Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t},ee=function(e){return ee=Object.getOwnPropertyNames||function(t){var r=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[r.length]=s);return r},ee(e)},lt=typeof SuppressedError=="function"?SuppressedError:function(e,t,r){var s=new Error(r);return s.name="SuppressedError",s.error=e,s.suppressed=t,s},ut={__extends:Ce,__assign:Y,__rest:je,__decorate:Ue,__param:De,__esDecorate:Me,__runInitializers:He,__propKey:ke,__setFunctionName:Be,__metadata:Fe,__awaiter:qe,__generator:We,__createBinding:K,__exportStar:Ge,__values:ne,__read:ye,__spread:ze,__spreadArrays:Ve,__spreadArray:Ye,__await:F,__asyncGenerator:Ke,__asyncDelegator:Je,__asyncValues:Xe,__makeTemplateObject:Qe,__importStar:Ze,__importDefault:et,__classPrivateFieldGet:tt,__classPrivateFieldSet:rt,__classPrivateFieldIn:st,__addDisposableResource:nt,__disposeResources:ot,__rewriteRelativeImportExtension:at}}),ct=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};e.default=t}),ht=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ct()),s=class{constructor(o){var n,a;this.shouldThrowOnError=!1,this.method=o.method,this.url=o.url,this.headers=new Headers(o.headers),this.schema=o.schema,this.body=o.body,this.shouldThrowOnError=(n=o.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=o.signal,this.isMaybeSingle=(a=o.isMaybeSingle)!==null&&a!==void 0?a:!1,o.fetch?this.fetch=o.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,n){return this.headers=new Headers(this.headers),this.headers.set(o,n),this}then(o,n){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let a=this.fetch,l=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async u=>{var i,c,h,m;let d=null,y=null,E=null,g=u.status,v=u.statusText;if(u.ok){if(this.method!=="HEAD"){let f=await u.text();f===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text")?y=f:y=JSON.parse(f))}let S=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),P=(h=u.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");S&&P&&P.length>1&&(E=parseInt(P[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(y)&&(y.length>1?(d={code:"PGRST116",details:`Results contain ${y.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},y=null,E=null,g=406,v="Not Acceptable"):y.length===1?y=y[0]:y=null)}else{let S=await u.text();try{d=JSON.parse(S),Array.isArray(d)&&u.status===404&&(y=[],d=null,g=200,v="OK")}catch{u.status===404&&S===""?(g=204,v="No Content"):d={message:S}}if(d&&this.isMaybeSingle&&!((m=d?.details)===null||m===void 0)&&m.includes("0 rows")&&(d=null,g=200,v="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:y,count:E,status:g,statusText:v}});return this.shouldThrowOnError||(l=l.catch(u=>{var i,c,h;return{error:{message:`${(i=u?.name)!==null&&i!==void 0?i:"FetchError"}: ${u?.message}`,details:`${(c=u?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(h=u?.code)!==null&&h!==void 0?h:""}`},data:null,count:null,status:0,statusText:""}})),l.then(o,n)}returns(){return this}overrideTypes(){return this}};e.default=s}),dt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ht()),s=class extends r.default{select(o){let n=!1,a=(o??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",a),this.headers.append("Prefer","return=representation"),this}order(o,{ascending:n=!0,nullsFirst:a,foreignTable:l,referencedTable:u=l}={}){let i=u?`${u}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${o}.${n?"asc":"desc"}${a===void 0?"":a?".nullsfirst":".nullslast"}`),this}limit(o,{foreignTable:n,referencedTable:a=n}={}){let l=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${o}`),this}range(o,n,{foreignTable:a,referencedTable:l=a}={}){let u=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(u,`${o}`),this.url.searchParams.set(i,`${n-o+1}`),this}abortSignal(o){return this.signal=o,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:o=!1,verbose:n=!1,settings:a=!1,buffers:l=!1,wal:u=!1,format:i="text"}={}){var c;let h=[o?"analyze":null,n?"verbose":null,a?"settings":null,l?"buffers":null,u?"wal":null].filter(Boolean).join("|"),m=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${m}"; options=${h};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(o){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${o}`),this}};e.default=s}),ge=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(dt()),s=new RegExp("[,()]"),o=class extends r.default{eq(n,a){return this.url.searchParams.append(n,`eq.${a}`),this}neq(n,a){return this.url.searchParams.append(n,`neq.${a}`),this}gt(n,a){return this.url.searchParams.append(n,`gt.${a}`),this}gte(n,a){return this.url.searchParams.append(n,`gte.${a}`),this}lt(n,a){return this.url.searchParams.append(n,`lt.${a}`),this}lte(n,a){return this.url.searchParams.append(n,`lte.${a}`),this}like(n,a){return this.url.searchParams.append(n,`like.${a}`),this}likeAllOf(n,a){return this.url.searchParams.append(n,`like(all).{${a.join(",")}}`),this}likeAnyOf(n,a){return this.url.searchParams.append(n,`like(any).{${a.join(",")}}`),this}ilike(n,a){return this.url.searchParams.append(n,`ilike.${a}`),this}ilikeAllOf(n,a){return this.url.searchParams.append(n,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(n,a){return this.url.searchParams.append(n,`ilike(any).{${a.join(",")}}`),this}is(n,a){return this.url.searchParams.append(n,`is.${a}`),this}in(n,a){let l=Array.from(new Set(a)).map(u=>typeof u=="string"&&s.test(u)?`"${u}"`:`${u}`).join(",");return this.url.searchParams.append(n,`in.(${l})`),this}contains(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cs.{${a.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(a)}`),this}containedBy(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cd.{${a.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(a)}`),this}rangeGt(n,a){return this.url.searchParams.append(n,`sr.${a}`),this}rangeGte(n,a){return this.url.searchParams.append(n,`nxl.${a}`),this}rangeLt(n,a){return this.url.searchParams.append(n,`sl.${a}`),this}rangeLte(n,a){return this.url.searchParams.append(n,`nxr.${a}`),this}rangeAdjacent(n,a){return this.url.searchParams.append(n,`adj.${a}`),this}overlaps(n,a){return typeof a=="string"?this.url.searchParams.append(n,`ov.${a}`):this.url.searchParams.append(n,`ov.{${a.join(",")}}`),this}textSearch(n,a,{config:l,type:u}={}){let i="";u==="plain"?i="pl":u==="phrase"?i="ph":u==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(n,`${i}fts${c}.${a}`),this}match(n){return Object.entries(n).forEach(([a,l])=>{this.url.searchParams.append(a,`eq.${l}`)}),this}not(n,a,l){return this.url.searchParams.append(n,`not.${a}.${l}`),this}or(n,{foreignTable:a,referencedTable:l=a}={}){let u=l?`${l}.or`:"or";return this.url.searchParams.append(u,`(${n})`),this}filter(n,a,l){return this.url.searchParams.append(n,`${a}.${l}`),this}};e.default=o}),pt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ge()),s=class{constructor(o,{headers:n={},schema:a,fetch:l}){this.url=o,this.headers=new Headers(n),this.schema=a,this.fetch=l}select(o,n){let{head:a=!1,count:l}=n??{},u=a?"HEAD":"GET",i=!1,c=(o??"*").split("").map(h=>/\s/.test(h)&&!i?"":(h==='"'&&(i=!i),h)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:u,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(o,{count:n,defaultToNull:a=!0}={}){var l;let u="POST";if(n&&this.headers.append("Prefer",`count=${n}`),a||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let i=o.reduce((c,h)=>c.concat(Object.keys(h)),[]);if(i.length>0){let c=[...new Set(i)].map(h=>`"${h}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:u,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(o,{onConflict:n,ignoreDuplicates:a=!1,count:l,defaultToNull:u=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${a?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),l&&this.headers.append("Prefer",`count=${l}`),u||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let h=o.reduce((m,d)=>m.concat(Object.keys(d)),[]);if(h.length>0){let m=[...new Set(h)].map(d=>`"${d}"`);this.url.searchParams.set("columns",m.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(o,{count:n}={}){var a;let l="PATCH";return n&&this.headers.append("Prefer",`count=${n}`),new r.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}delete({count:o}={}){var n;let a="DELETE";return o&&this.headers.append("Prefer",`count=${o}`),new r.default({method:a,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};e.default=s}),zt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(pt()),s=t.__importDefault(ge()),o=class ft{constructor(a,{headers:l={},schema:u,fetch:i}={}){this.url=a,this.headers=new Headers(l),this.schemaName=u,this.fetch=i}from(a){let l=new URL(`${this.url}/${a}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new ft(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,l={},{head:u=!1,get:i=!1,count:c}={}){var h;let m,d=new URL(`${this.url}/rpc/${a}`),y;u||i?(m=u?"HEAD":"GET",Object.entries(l).filter(([g,v])=>v!==void 0).map(([g,v])=>[g,Array.isArray(v)?`{${v.join(",")}}`:`${v}`]).forEach(([g,v])=>{d.searchParams.append(g,v)})):(m="POST",y=l);let E=new Headers(this.headers);return c&&E.set("Prefer",`count=${c}`),new s.default({method:m,url:d,headers:E,schema:this.schemaName,body:y,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};e.default=o}),Vt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0}),e.PostgrestError=e.PostgrestBuilder=e.PostgrestTransformBuilder=e.PostgrestFilterBuilder=e.PostgrestQueryBuilder=e.PostgrestClient=void 0;var t=(W(),q(M)),r=t.__importDefault(zt());e.PostgrestClient=r.default;var s=t.__importDefault(pt());e.PostgrestQueryBuilder=s.default;var o=t.__importDefault(ge());e.PostgrestFilterBuilder=o.default;var n=t.__importDefault(dt());e.PostgrestTransformBuilder=n.default;var a=t.__importDefault(ht());e.PostgrestBuilder=a.default;var l=t.__importDefault(ct());e.PostgrestError=l.default,e.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:o.default,PostgrestTransformBuilder:n.default,PostgrestBuilder:a.default,PostgrestError:l.default}});p();p();p();p();p();p();var Yt=Object.defineProperty,Kt=Object.defineProperties,Jt=Object.getOwnPropertyDescriptors,Te=Object.getOwnPropertySymbols,Xt=Object.prototype.hasOwnProperty,Qt=Object.prototype.propertyIsEnumerable,Se=(e,t,r)=>t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,L=(e,t)=>{for(var r in t||(t={}))Xt.call(t,r)&&Se(e,r,t[r]);if(Te)for(var r of Te(t))Qt.call(t,r)&&Se(e,r,t[r]);return e},N=(e,t)=>Kt(e,Jt(t)),Zt=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r}},er=async(e,t)=>{var r,s,o,n,a,l;let u=t||{},i={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:u,hooks:i};for(let c of t?.plugins||[]){if(c.init){let h=await((r=c.init)==null?void 0:r.call(c,e.toString(),t));u=h.options||u,e=h.url}i.onRequest.push((s=c.hooks)==null?void 0:s.onRequest),i.onResponse.push((o=c.hooks)==null?void 0:o.onResponse),i.onSuccess.push((n=c.hooks)==null?void 0:n.onSuccess),i.onError.push((a=c.hooks)==null?void 0:a.onError),i.onRetry.push((l=c.hooks)==null?void 0:l.onRetry)}return{url:e,options:u,hooks:i}},Pe=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},tr=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function rr(e){if(typeof e=="number")return new Pe({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new Pe(e);case"exponential":return new tr(e);default:throw new Error("Invalid retry strategy")}}var sr=async e=>{let t={},r=async s=>typeof s=="function"?await s():s;if(e?.auth){if(e.auth.type==="Bearer"){let s=await r(e.auth.token);if(!s)return t;t.authorization=`Bearer ${s}`}else if(e.auth.type==="Basic"){let s=r(e.auth.username),o=r(e.auth.password);if(!s||!o)return t;t.authorization=`Basic ${btoa(`${s}:${o}`)}`}else if(e.auth.type==="Custom"){let s=r(e.auth.value);if(!s)return t;t.authorization=`${r(e.auth.prefix)} ${s}`}}return t},nr=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function or(e){let t=e.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let s=t.split(";").shift()||"";return nr.test(s)?"json":r.has(s)||s.startsWith("text/")?"text":"blob"}function ar(e){try{return JSON.parse(e),!0}catch{return!1}}function mt(e){if(e===void 0)return!1;let t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function Re(e){try{return JSON.parse(e)}catch{return e}}function Ae(e){return typeof e=="function"}function ir(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&Ae(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&Ae(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function lr(e){let t=new Headers(e?.headers),r=await sr(e);for(let[s,o]of Object.entries(r||{}))t.set(s,o);if(!t.has("content-type")){let s=ur(e?.body);s&&t.set("content-type",s)}return t}function ur(e){return mt(e)?"application/json":null}function cr(e){if(!e?.body)return null;let t=new Headers(e?.headers);if(mt(e.body)&&!t.has("content-type")){for(let[r,s]of Object.entries(e?.body))s instanceof Date&&(e.body[r]=s.toISOString());return JSON.stringify(e.body)}return e.body}function hr(e,t){var r;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){let s=(r=e.split("@")[1])==null?void 0:r.split("/")[0];return gt.includes(s)?s.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function dr(e,t){let r;return!e?.signal&&e?.timeout&&(r=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}var pr=class yt extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,yt.prototype)}};async function te(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new pr(r.issues);return r.value}var gt=["get","post","put","patch","delete"],fr=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,r){var s,o,n,a;let l=((o=(s=e.plugins)==null?void 0:s.find(u=>{var i;return(i=u.schema)!=null&&i.config?t.startsWith(u.schema.config.baseURL||"")||t.startsWith(u.schema.config.prefix||""):!1}))==null?void 0:o.schema)||e.schema;if(l){let u=t;(n=l.config)!=null&&n.prefix&&u.startsWith(l.config.prefix)&&(u=u.replace(l.config.prefix,""),l.config.baseURL&&(t=t.replace(l.config.prefix,l.config.baseURL))),(a=l.config)!=null&&a.baseURL&&u.startsWith(l.config.baseURL)&&(u=u.replace(l.config.baseURL,""));let i=l.schema[u];if(i){let c=N(L({},r),{method:i.method,output:i.output});return r?.disableValidation||(c=N(L({},c),{body:i.input?await te(i.input,r?.body):r?.body,params:i.params?await te(i.params,r?.params):r?.params,query:i.query?await te(i.query,r?.query):r?.query})),{url:t,options:c}}}return{url:t,options:r}}}),mr=e=>{async function t(r,s){let o=N(L(L({},e),s),{plugins:[...e?.plugins||[],fr(e||{})]});if(e?.catchAllError)try{return await pe(r,o)}catch(n){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:n}}}return await pe(r,o)}return t};function yr(e,t){let{baseURL:r,params:s,query:o}=t||{query:{},params:{},baseURL:""},n=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let c=e.toString().split("@")[1].split("/")[0];gt.includes(c)&&(e=e.replace(`@${c}/`,"/"))}n.endsWith("/")||(n+="/");let[a,l]=e.replace(n,"").split("?"),u=new URLSearchParams(l);for(let[c,h]of Object.entries(o||{}))h!=null&&u.set(c,String(h));if(s)if(Array.isArray(s)){let c=a.split("/").filter(h=>h.startsWith(":"));for(let[h,m]of c.entries()){let d=s[h];a=a.replace(m,d)}}else for(let[c,h]of Object.entries(s))a=a.replace(`:${c}`,String(h));a=a.split("/").map(encodeURIComponent).join("/"),a.startsWith("/")&&(a=a.slice(1));let i=u.toString();return i=i.length>0?`?${i}`.replace(/\+/g,"%20"):"",n.startsWith("http")?new URL(`${a}${i}`,n):`${n}${a}${i}`}var pe=async(e,t)=>{var r,s,o,n,a,l,u,i;let{hooks:c,url:h,options:m}=await er(e,t),d=ir(m),y=new AbortController,E=(r=m.signal)!=null?r:y.signal,g=yr(h,m),v=cr(m),S=await lr(m),P=hr(h,m),f=N(L({},m),{url:g,headers:S,body:v,method:P,signal:E});for(let T of c.onRequest)if(T){let _=await T(f);_ instanceof Object&&(f=_)}("pipeTo"in f&&typeof f.pipeTo=="function"||typeof((s=t?.body)==null?void 0:s.pipe)=="function")&&("duplex"in f||(f.duplex="half"));let{clearTimeout:j}=dr(m,y),b=await d(f.url,f);j();let _e={response:b,request:f};for(let T of c.onResponse)if(T){let _=await T(N(L({},_e),{response:(o=t?.hookOptions)!=null&&o.cloneResponse?b.clone():b}));_ instanceof Response?b=_:_ instanceof Object&&(b=_.response)}if(b.ok){if(f.method==="HEAD")return{data:"",error:null};let T=or(b),_={data:"",response:b,request:f};if(T==="json"||T==="text"){let H=await b.text(),k=await((n=f.jsonParser)!=null?n:Re)(H);_.data=k}else _.data=await b[T]();f?.output&&f.output&&!f.disableValidation&&(_.data=await te(f.output,_.data));for(let H of c.onSuccess)H&&await H(N(L({},_),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?b.clone():b}));return t?.throw?_.data:{data:_.data,error:null}}let Nt=(l=t?.jsonParser)!=null?l:Re,J=await b.text(),Oe=ar(J),ue=Oe?await Nt(J):null,xt={response:b,responseText:J,request:f,error:N(L({},ue),{status:b.status,statusText:b.statusText})};for(let T of c.onError)T&&await T(N(L({},xt),{response:(u=t?.hookOptions)!=null&&u.cloneResponse?b.clone():b}));if(t?.retry){let T=rr(t.retry),_=(i=t.retryAttempt)!=null?i:0;if(await T.shouldAttemptRetry(_,b)){for(let k of c.onRetry)k&&await k(_e);let H=T.getDelay(_);return await new Promise(k=>setTimeout(k,H)),await pe(e,N(L({},t),{retryAttempt:_+1}))}}if(t?.throw)throw new Zt(b.status,b.statusText,Oe?ue:J);return{data:null,error:N(L({},ue),{status:b.status,statusText:b.statusText})}};p();p();var re=Object.create(null),G=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?re:globalThis),A=new Proxy(re,{get(e,t){return G()[t]??re[t]},has(e,t){let r=G();return t in r||t in re},set(e,t,r){let s=G(!0);return s[t]=r,!0},deleteProperty(e,t){if(!t)return!1;let r=G(!0);return delete r[t],!0},ownKeys(){let e=G(!0);return Object.keys(e)}}),gs=typeof process<"u"&&process.env&&process.env.NODE_ENV||"";function w(e,t){return typeof process<"u"&&process.env?process.env[e]??t:typeof Deno<"u"?Deno.env.get(e)??t:typeof Bun<"u"?Bun.env[e]??t:t}var vs=Object.freeze({get BETTER_AUTH_SECRET(){return w("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return w("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return w("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return w("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return w("NODE_ENV","development")},get PACKAGE_VERSION(){return w("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return w("BETTER_AUTH_TELEMETRY_ENDPOINT","https://telemetry.better-auth.com/v1/track")}}),z=1,O=4,x=8,R=24,Ie={eterm:O,cons25:O,console:O,cygwin:O,dtterm:O,gnome:O,hurd:O,jfbterm:O,konsole:O,kterm:O,mlterm:O,mosh:R,putty:O,st:O,"rxvt-unicode-24bit":R,terminator:R,"xterm-kitty":R},gr=new Map(Object.entries({APPVEYOR:x,BUILDKITE:x,CIRCLECI:R,DRONE:x,GITEA_ACTIONS:R,GITHUB_ACTIONS:R,GITLAB_CI:x,TRAVIS:x})),vr=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function wr(){if(w("FORCE_COLOR")!==void 0)switch(w("FORCE_COLOR")){case"":case"1":case"true":return O;case"2":return x;case"3":return R;default:return z}if(w("NODE_DISABLE_COLORS")!==void 0&&w("NODE_DISABLE_COLORS")!==""||w("NO_COLOR")!==void 0&&w("NO_COLOR")!==""||w("TERM")==="dumb")return z;if(w("TMUX"))return R;if("TF_BUILD"in A&&"AGENT_NAME"in A)return O;if("CI"in A){for(let{0:e,1:t}of gr)if(e in A)return t;return w("CI_NAME")==="codeship"?x:z}if("TEAMCITY_VERSION"in A)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(w("TEAMCITY_VERSION"))!==null?O:z;switch(w("TERM_PROGRAM")){case"iTerm.app":return!w("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(w("TERM_PROGRAM_VERSION"))!==null?x:R;case"HyperTerm":case"MacTerm":return R;case"Apple_Terminal":return x}if(w("COLORTERM")==="truecolor"||w("COLORTERM")==="24bit")return R;if(w("TERM")){if(/truecolor/.exec(w("TERM"))!==null)return R;if(/^xterm-256/.exec(w("TERM"))!==null)return x;let e=w("TERM").toLowerCase();if(Ie[e])return Ie[e];if(vr.some(t=>t.exec(e)!==null))return O}return w("COLORTERM")?O:z}var $={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",undim:"\x1B[22m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",fg:{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},bg:{black:"\x1B[40m",red:"\x1B[41m",green:"\x1B[42m",yellow:"\x1B[43m",blue:"\x1B[44m",magenta:"\x1B[45m",cyan:"\x1B[46m",white:"\x1B[47m"}},fe=["info","success","warn","error","debug"];function Er(e,t){return fe.indexOf(t)<=fe.indexOf(e)}var br={info:$.fg.blue,success:$.fg.green,warn:$.fg.yellow,error:$.fg.red,debug:$.fg.magenta},_r=(e,t,r)=>{let s=new Date().toISOString();return r?`${$.dim}${s}${$.reset} ${br[e]}${e.toUpperCase()}${$.reset} ${$.bright}[Better Auth]:${$.reset} ${t}`:`${s} ${e.toUpperCase()} [Better Auth]: ${t}`},Or=e=>{let t=e?.disabled!==!0,r=e?.level??"error",s=e?.disableColors!==void 0?!e.disableColors:wr()!==1,o=(n,a,l=[])=>{if(!t||!Er(r,n))return;let u=_r(n,a,s);if(!e||typeof e.log!="function"){n==="error"?console.error(u,...l):n==="warn"?console.warn(u,...l):console.log(u,...l);return}e.log(n==="success"?"info":n,a,...l)};return{...Object.fromEntries(fe.map(n=>[n,(...[a,...l])=>o(n,a,l)])),get level(){return r}}},ws=Or();p();p();var ve=class extends Error{constructor(e,t){super(e),this.name="BetterAuthError",this.message=e,this.cause=t,this.stack=""}};function Tr(e){try{return(new URL(e).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new ve(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function V(e,t="/api/auth"){if(Tr(e))return e;let r=e.replace(/\/+$/,"");return!t||t==="/"?r:(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`)}function Sr(e,t,r,s){if(e)return V(e,t);if(s!==!1){let a=A.BETTER_AUTH_URL||A.NEXT_PUBLIC_BETTER_AUTH_URL||A.PUBLIC_BETTER_AUTH_URL||A.NUXT_PUBLIC_BETTER_AUTH_URL||A.NUXT_PUBLIC_AUTH_URL||(A.BASE_URL!=="/"?A.BASE_URL:void 0);if(a)return V(a,t)}let o=r?.headers.get("x-forwarded-host"),n=r?.headers.get("x-forwarded-proto");if(o&&n)return V(`${n}://${o}`,t);if(r){let a=Pr(r.url);if(!a)throw new ve("Could not get origin from request. Please provide a valid base URL.");return V(a,t)}if(typeof window<"u"&&window.location)return V(window.location.origin,t)}function Pr(e){try{return new URL(e).origin}catch{return null}}p();p();p();var me=Symbol("clean"),I=[],C=0,X=4,Rr=0,vt=e=>{let t=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},lc:0,listen(s){return r.lc=t.push(s),()=>{for(let n=C+X;n<I.length;)I[n]===s?I.splice(n,X):n+=X;let o=t.indexOf(s);~o&&(t.splice(o,1),--r.lc||r.off())}},notify(s,o){Rr++;let n=!I.length;for(let a of t)I.push(a,r.value,s,o);if(n){for(C=0;C<I.length;C+=X)I[C](I[C+1],I[C+2],I[C+3]);I.length=0}},off(){},set(s){let o=r.value;o!==s&&(r.value=s,r.notify(o))},subscribe(s){let o=r.listen(s);return s(r.value),o},value:e};return process.env.NODE_ENV!=="production"&&(r[me]=()=>{t=[],r.lc=0,r.off()}),r};p();var Ar=5,B=6,Q=10,Ir=(e,t,r,s)=>(e.events=e.events||{},e.events[r+Q]||(e.events[r+Q]=s(o=>{e.events[r].reduceRight((n,a)=>(a(n),n),{shared:{},...o})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let o=e.events[r],n=o.indexOf(t);o.splice(n,1),o.length||(delete e.events[r],e.events[r+Q](),delete e.events[r+Q])}),Lr=1e3,Nr=(e,t)=>Ir(e,r=>{let s=t(r);s&&e.events[B].push(s)},Ar,r=>{let s=e.listen;e.listen=(...n)=>(!e.lc&&!e.active&&(e.active=!0,r()),s(...n));let o=e.off;if(e.events[B]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let n of e.events[B])n();e.events[B]=[]}},Lr)},process.env.NODE_ENV!=="production"){let n=e[me];e[me]=()=>{for(let a of e.events[B])a();e.events[B]=[],e.active=!1,n()}}return()=>{e.listen=s,e.off=o}});p();var xr=typeof window>"u",$r=(e,t,r,s)=>{let o=vt({data:null,error:null,isPending:!0,isRefetching:!1,refetch:l=>n(l)}),n=l=>{let u=typeof s=="function"?s({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):s;r(t,{...u,query:{...u?.query,...l?.query},async onSuccess(i){o.set({data:i.data,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await u?.onSuccess?.(i)},async onError(i){let{request:c}=i,h=typeof c.retry=="number"?c.retry:c.retry?.attempts,m=c.retryAttempt||0;h&&m<h||(o.set({error:i.error,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await u?.onError?.(i))},async onRequest(i){let c=o.get();o.set({isPending:c.data===null,data:c.data,error:null,isRefetching:!0,refetch:o.value.refetch}),await u?.onRequest?.(i)}}).catch(i=>{o.set({error:i,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch})})};e=Array.isArray(e)?e:[e];let a=!1;for(let l of e)l.subscribe(()=>{xr||(a?n():Nr(o,()=>{let u=setTimeout(()=>{a||(n(),a=!0)},0);return()=>{o.off(),l.off(),clearTimeout(u)}}))});return o};p();var Cr={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},jr=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,Le={true:!0,false:!1,null:null,undefined:void 0,nan:Number.NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},Ur=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Dr(e){return e instanceof Date&&!isNaN(e.getTime())}function Mr(e){let t=Ur.exec(e);if(!t)return null;let[,r,s,o,n,a,l,u,i,c,h]=t,m=new Date(Date.UTC(parseInt(r,10),parseInt(s,10)-1,parseInt(o,10),parseInt(n,10),parseInt(a,10),parseInt(l,10),u?parseInt(u.padEnd(3,"0"),10):0));if(i){let d=(parseInt(c,10)*60+parseInt(h,10))*(i==="+"?-1:1);m.setUTCMinutes(m.getUTCMinutes()+d)}return Dr(m)?m:null}function Hr(e,t={}){let{strict:r=!1,warnings:s=!1,reviver:o,parseDates:n=!0}=t;if(typeof e!="string")return e;let a=e.trim();if(a.length>0&&a[0]==='"'&&a.endsWith('"')&&!a.slice(1,-1).includes('"'))return a.slice(1,-1);let l=a.toLowerCase();if(l.length<=9&&l in Le)return Le[l];if(!jr.test(a)){if(r)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(Cr).some(([u,i])=>{let c=i.test(a);return c&&s&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${u} pattern`),c})&&r)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(a,(u,i)=>{if(u==="__proto__"||u==="constructor"&&i&&typeof i=="object"&&"prototype"in i){s&&console.warn(`[better-json] Dropping "${u}" key to prevent prototype pollution`);return}if(n&&typeof i=="string"){let c=Mr(i);if(c)return c}return o?o(u,i):i})}catch(u){if(r)throw u;return e}}function kr(e,t={strict:!0}){return Hr(e,t)}var Br={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function Fr(e){let t=vt(!1);return{session:$r(t,"/get-session",e,{method:"GET"}),$sessionSignal:t}}var qr=(e,t)=>{let r="credentials"in Request.prototype,s=Sr(e?.baseURL,e?.basePath,void 0,t)??"/api/auth",o=e?.plugins?.flatMap(f=>f.fetchPlugins).filter(f=>f!==void 0)||[],n={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:a,onError:l,onRequest:u,onResponse:i,...c}=e?.fetchOptions||{},h=mr({baseURL:s,...r?{credentials:"include"}:{},method:"GET",jsonParser(f){return f?kr(f,{strict:!1}):null},customFetchImpl:fetch,...c,plugins:[n,...c.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Br],...o]}),{$sessionSignal:m,session:d}=Fr(h),y=e?.plugins||[],E={},g={$sessionSignal:m,session:d},v={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},S=[{signal:"$sessionSignal",matcher(f){return f==="/sign-out"||f==="/update-user"||f.startsWith("/sign-in")||f.startsWith("/sign-up")||f==="/delete-user"||f==="/verify-email"}}];for(let f of y)f.getAtoms&&Object.assign(g,f.getAtoms?.(h)),f.pathMethods&&Object.assign(v,f.pathMethods),f.atomListeners&&S.push(...f.atomListeners);let P={notify:f=>{g[f].set(!g[f].get())},listen:(f,j)=>{g[f].subscribe(j)},atoms:g};for(let f of y)f.getActions&&Object.assign(E,f.getActions?.(h,P,e));return{get baseURL(){return s},pluginsActions:E,pluginsAtoms:g,pluginPathMethods:v,atomListeners:S,$fetch:h,$store:P}};function Wr(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function Gr(e,t,r){let s=t[e],{fetchOptions:o,query:n,...a}=r||{};return s||(o?.method?o.method:a&&Object.keys(a).length>0?"POST":"GET")}function zr(e,t,r,s,o){function n(a=[]){return new Proxy(function(){},{get(l,u){if(typeof u!="string"||u==="then"||u==="catch"||u==="finally")return;let i=[...a,u],c=e;for(let h of i)if(c&&typeof c=="object"&&h in c)c=c[h];else{c=void 0;break}return typeof c=="function"||Wr(c)?c:n(i)},apply:async(l,u,i)=>{let c="/"+a.map(S=>S.replace(/[A-Z]/g,P=>`-${P.toLowerCase()}`)).join("/"),h=i[0]||{},m=i[1]||{},{query:d,fetchOptions:y,...E}=h,g={...m,...y},v=Gr(c,r,h);return await t(c,{...g,body:v==="GET"?void 0:{...E,...g?.body||{}},query:d||g?.query,method:v,async onSuccess(S){if(await g?.onSuccess?.(S),!o)return;let P=o.filter(f=>f.matcher(c));if(P.length)for(let f of P){let j=s[f.signal];if(!j)return;let b=j.get();setTimeout(()=>{j.set(!b)},10)}}})}})}return n()}p();function Vr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Yr(e){let{pluginPathMethods:t,pluginsActions:r,pluginsAtoms:s,$fetch:o,atomListeners:n,$store:a}=qr(e),l={};for(let[i,c]of Object.entries(s))l[`use${Vr(i)}`]=c;let u={...r,...l,$fetch:o,$store:a};return zr(u,o,t,s,n)}p();p();p();function Kr(e){return{authorize(t,r="AND"){let s=!1;for(let[o,n]of Object.entries(t)){let a=e[o];if(!a)return{success:!1,error:`You are not allowed to access resource: ${o}`};if(Array.isArray(n))s=n.every(l=>a.includes(l));else if(typeof n=="object"){let l=n;l.connector==="OR"?s=l.actions.some(u=>a.includes(u)):s=l.actions.every(u=>a.includes(u))}else throw new ve("Invalid access control request");if(s&&r==="OR")return{success:s};if(!s&&r==="AND")return{success:!1,error:`unauthorized to access resource "${o}"`}}return s?{success:s}:{success:!1,error:"Not authorized"}},statements:e}}function wt(e){return{newRole(t){return Kr(t)},statements:e}}var Jr={organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]},we=wt(Jr),Es=we.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),bs=we.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),_s=we.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]});p();p();p();p();p();p();p();p();p();p();p();var Xr=class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let t=new Error("Cancelling existing WebAuthn API call for new one");t.name="AbortError",this.controller.abort(t)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}},Os=new Xr;p();p();p();p();p();p();p();p();var Qr={user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]},Et=wt(Qr),Ts=Et.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),Ss=Et.newRole({user:[],session:[]});p();p();var Zr=()=>({id:"username",$InferServerPlugin:{}}),es=()=>({id:"phoneNumber",$InferServerPlugin:{},atomListeners:[{matcher(e){return e==="/phone-number/update"||e==="/phone-number/verify"},signal:"$sessionSignal"}]}),ts=()=>({id:"better-auth-client",$InferServerPlugin:{}}),rs="/auth",he="nvwa_login_token",se="nvwa_current_jwt",de="nvwa_user_profile",bt=class{constructor(e,t,r){this.storage=r;let s=Yr({baseURL:e,basePath:rs,plugins:[Zr(),es(),ts()],fetchOptions:{customFetchImpl:t,auth:{type:"Bearer",token:async()=>{let o=await this.storage.get(se);if(console.log("jwt",o),o)return o;let n=await this.storage.get(he);return console.log("loginToken",n),n}}}});this.authClient=s}async currentUser(){return await this.storage.get(de)}async getCurrentJwt(){return await this.storage.get(se)}async signUp(e){let t=await this.authClient.signUp.email({email:e.email??`${e.username}@nvwa.app`,name:e.name,username:e.username,displayUsername:e.displayUsername,password:e.password});this.handleLogin(t)}async sendPhoneNumberCode(e){await this.authClient.phoneNumber.sendOtp({phoneNumber:e})}async signInWithPhoneNumberCode(e,t){let r=await this.authClient.phoneNumber.verify({phoneNumber:e,code:t});this.handleLogin(r)}async signInWithPhoneNumber(e,t,r=!1){let s=await this.authClient.signIn.phoneNumber({phoneNumber:e,password:t,rememberMe:r});this.handleLogin(s)}async signInWithUsername(e,t){let r=await this.authClient.signIn.username({username:e,password:t});this.handleLogin(r)}async handleLogin(e){if(e.error)throw new Error(e.error.message);await this.storage.set(he,e.data?.token),await this.storage.set(de,e.data?.user);let{data:t,error:r}=await this.authClient.token();if(r)throw new Error(r.message);await this.storage.set(se,t.token)}async signOut(){await this.storage.remove(he),await this.storage.remove(de)}async updateUserPassword(e,t,r=!1){let s=await this.authClient.changePassword({currentPassword:e,newPassword:t,revokeOtherSessions:r});this.handleLogin(s)}};p();var _t=class{constructor(e){this.http=e}async invoke(e,t){return await(await this.http.fetch("/functions/"+e,{method:t.method||"POST",body:t.body,headers:t.headers})).json()}};p();p();p();var U=class Ot{constructor(t){if(this.headerMap=new Map,t){if(t instanceof Ot)t.forEach((r,s)=>this.set(s,r));else if(Array.isArray(t))for(let[r,s]of t)this.set(r,String(s));else if(typeof t=="object")for(let r of Object.keys(t))this.set(r,String(t[r]))}}append(t,r){let s=t.toLowerCase(),o=this.headerMap.get(s);this.headerMap.set(s,o?`${o}, ${r}`:r)}set(t,r){this.headerMap.set(t.toLowerCase(),String(r))}get(t){return this.headerMap.get(t.toLowerCase())??null}has(t){return this.headerMap.has(t.toLowerCase())}delete(t){this.headerMap.delete(t.toLowerCase())}forEach(t){for(let[r,s]of this.headerMap.entries())t(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}};p();p();var Tt=class{constructor(e,t){this.bodyData=e,this.status=t?.status??200,this.statusText=t?.statusText??"",this.headers=ss(t?.headers),this.ok=this.status>=200&&this.status<300}async text(){return typeof this.bodyData=="string"?this.bodyData:this.bodyData==null?"":typeof this.bodyData=="object"?JSON.stringify(this.bodyData):String(this.bodyData)}async json(){if(typeof this.bodyData=="string")try{return JSON.parse(this.bodyData)}catch{}return this.bodyData}async arrayBuffer(){let e=await this.text();return new TextEncoder().encode(e).buffer}};function ss(e){return e?new U(e):new U}p();p();var St=class{constructor(e,t,r){console.log("NvwaHttpClient constructor",e,t,r),this.storage=e,this.customFetch=t,this.handleUnauthorized=r}async fetch(e,t){return await this.customFetch(e,t)}async fetchWithAuth(e,t){let r=await this.storage.get(se),s=new U(t?.headers);r&&s.set("Authorization",`Bearer ${r}`);let o=await this.customFetch(e,{...t,headers:s});if(o.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return o}};p();var ns="/storage",os=ns+"/generateUploadUrl",Pt=class{constructor(e,t){this.baseUrl=e,this.http=t}async uploadFile(e){let t=await this.http.fetch(this.baseUrl+os,{method:"POST",body:{fileName:e.name||e.fileName,fileSize:e.size||e.fileSize,fileType:e.type||e.fileType}}),{url:r}=await t.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:e,headers:new U({"Content-Type":e.type||e.fileType||"application/octet-stream"})}),{url:o}=await s.json();return{url:o.split("?")[0]}}};p();p();p();var Ne=Gt(Vt(),1),{PostgrestClient:as,PostgrestQueryBuilder:Ps,PostgrestFilterBuilder:Rs,PostgrestTransformBuilder:As,PostgrestBuilder:Is,PostgrestError:Ls}=Ne.default||Ne,is="/entities",Rt=(e,t)=>new as(e+is,{fetch:t.fetchWithAuth.bind(t)});p();var At=class{constructor(e,t){this.baseUrl=e,this.http=t}async execute(e,t){let r=`${this.baseUrl}/skill/${e}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:t?JSON.stringify(t):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};p();var It=class{constructor(){this.hoverOverlay=null,this.selectedOverlay=null,this.tooltip=null,this.hoverElement=null,this.selectedElement=null,this.hoverUpdateHandler=null,this.selectedUpdateHandler=null,this.createStyles()}createStyles(){if(document.getElementById("__nvwa-inspector-overlay-style"))return;let e=document.createElement("style");e.id="__nvwa-inspector-overlay-style",e.textContent=`
1
+ "use strict";var ce=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var jt=Object.prototype.hasOwnProperty;var Ut=(e,t)=>{for(var r in t)ce(e,r,{get:t[r],enumerable:!0})},Dt=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ct(t))!jt.call(e,o)&&o!==r&&ce(e,o,{get:()=>t[o],enumerable:!(s=$t(t,o))||s.enumerable});return e};var Mt=e=>Dt(ce({},"__esModule",{value:!0}),e);var ms={};Ut(ms,{default:()=>le,disableIframeHoverInspector:()=>hs,enableIframeHoverInspector:()=>cs,getIframeSourceLocation:()=>ds,localStorage:()=>be,setupIframeHoverInspector:()=>us,setupIframeSourceLocationListener:()=>ps});module.exports=Mt(ms);var Ht=Object.create,ae=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,Bt=Object.getOwnPropertyNames,Ft=Object.getPrototypeOf,qt=Object.prototype.hasOwnProperty,xe=(e,t)=>()=>(e&&(t=e(e=0)),t),D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Wt=(e,t)=>{for(var r in t)ae(e,r,{get:t[r],enumerable:!0})},$e=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Bt(t))!qt.call(e,o)&&o!==r&&ae(e,o,{get:()=>t[o],enumerable:!(s=kt(t,o))||s.enumerable});return e},Gt=(e,t,r)=>(r=e!=null?Ht(Ft(e)):{},$e(t||!e||!e.__esModule?ae(r,"default",{value:e,enumerable:!0}):r,e)),q=e=>$e(ae({},"__esModule",{value:!0}),e),p=xe(()=>{"use strict"}),M={};Wt(M,{__addDisposableResource:()=>nt,__assign:()=>Y,__asyncDelegator:()=>Je,__asyncGenerator:()=>Ke,__asyncValues:()=>Xe,__await:()=>F,__awaiter:()=>qe,__classPrivateFieldGet:()=>tt,__classPrivateFieldIn:()=>st,__classPrivateFieldSet:()=>rt,__createBinding:()=>K,__decorate:()=>Ue,__disposeResources:()=>ot,__esDecorate:()=>Me,__exportStar:()=>Ge,__extends:()=>Ce,__generator:()=>We,__importDefault:()=>et,__importStar:()=>Ze,__makeTemplateObject:()=>Qe,__metadata:()=>Fe,__param:()=>De,__propKey:()=>ke,__read:()=>ye,__rest:()=>je,__rewriteRelativeImportExtension:()=>at,__runInitializers:()=>He,__setFunctionName:()=>Be,__spread:()=>ze,__spreadArray:()=>Ye,__spreadArrays:()=>Ve,__values:()=>ne,default:()=>ut});function Ce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Z(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function je(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(r[s[o]]=e[s[o]]);return r}function Ue(e,t,r,s){var o=arguments.length,n=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,r):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,r,s);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(n=(o<3?a(n):o>3?a(t,r,n):a(t,r))||n);return o>3&&n&&Object.defineProperty(t,r,n),n}function De(e,t){return function(r,s){t(r,s,e)}}function Me(e,t,r,s,o,n){function a(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var l=s.kind,u=l==="getter"?"get":l==="setter"?"set":"value",i=!t&&e?s.static?e:e.prototype:null,c=t||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),h,m=!1,d=r.length-1;d>=0;d--){var y={};for(var E in s)y[E]=E==="access"?{}:s[E];for(var E in s.access)y.access[E]=s.access[E];y.addInitializer=function(v){if(m)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(v||null))};var g=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[u],y);if(l==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(h=a(g.get))&&(c.get=h),(h=a(g.set))&&(c.set=h),(h=a(g.init))&&o.unshift(h)}else(h=a(g))&&(l==="field"?o.unshift(h):c[u]=h)}i&&Object.defineProperty(i,s.name,c),m=!0}function He(e,t,r){for(var s=arguments.length>2,o=0;o<t.length;o++)r=s?t[o].call(e,r):t[o].call(e);return s?r:void 0}function ke(e){return typeof e=="symbol"?e:"".concat(e)}function Be(e,t,r){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function Fe(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function qe(e,t,r,s){function o(n){return n instanceof r?n:new r(function(a){a(n)})}return new(r||(r=Promise))(function(n,a){function l(c){try{i(s.next(c))}catch(h){a(h)}}function u(c){try{i(s.throw(c))}catch(h){a(h)}}function i(c){c.done?n(c.value):o(c.value).then(l,u)}i((s=s.apply(e,t||[])).next())})}function We(e,t){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,o,n,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(i){return function(c){return u([i,c])}}function u(i){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(r=0)),r;)try{if(s=1,o&&(n=i[0]&2?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[i[0]&2,n.value]),i[0]){case 0:case 1:n=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,o=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){r.label=i[1];break}if(i[0]===6&&r.label<n[1]){r.label=n[1],n=i;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(i);break}n[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}catch(c){i=[6,c],o=0}finally{s=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function Ge(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K(t,e,r)}function ne(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],s=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ye(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var s=r.call(e),o,n=[],a;try{for(;(t===void 0||t-- >0)&&!(o=s.next()).done;)n.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}return n}function ze(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ye(arguments[t]));return e}function Ve(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var s=Array(e),o=0,t=0;t<r;t++)for(var n=arguments[t],a=0,l=n.length;a<l;a++,o++)s[o]=n[a];return s}function Ye(e,t,r){if(r||arguments.length===2)for(var s=0,o=t.length,n;s<o;s++)(n||!(s in t))&&(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))}function F(e){return this instanceof F?(this.v=e,this):new F(e)}function Ke(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(e,t||[]),o,n=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(d){return function(y){return Promise.resolve(y).then(d,h)}}function l(d,y){s[d]&&(o[d]=function(E){return new Promise(function(g,v){n.push([d,E,g,v])>1||u(d,E)})},y&&(o[d]=y(o[d])))}function u(d,y){try{i(s[d](y))}catch(E){m(n[0][3],E)}}function i(d){d.value instanceof F?Promise.resolve(d.value.v).then(c,h):m(n[0][2],d)}function c(d){u("next",d)}function h(d){u("throw",d)}function m(d,y){d(y),n.shift(),n.length&&u(n[0][0],n[0][1])}}function Je(e){var t,r;return t={},s("next"),s("throw",function(o){throw o}),s("return"),t[Symbol.iterator]=function(){return this},t;function s(o,n){t[o]=e[o]?function(a){return(r=!r)?{value:F(e[o](a)),done:!1}:n?n(a):a}:n}}function Xe(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof ne=="function"?ne(e):e[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(n){r[n]=e[n]&&function(a){return new Promise(function(l,u){a=e[n](a),o(l,u,a.done,a.value)})}}function o(n,a,l,u){Promise.resolve(u).then(function(i){n({value:i,done:l})},a)}}function Qe(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Ze(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=ee(e),s=0;s<r.length;s++)r[s]!=="default"&&K(t,e,r[s]);return it(t,e),t}function et(e){return e&&e.__esModule?e:{default:e}}function tt(e,t,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(e):s?s.value:t.get(e)}function rt(e,t,r,s,o){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r}function st(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}function nt(e,t,r){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var s,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=t[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=t[Symbol.dispose],r&&(o=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");o&&(s=function(){try{o.call(this)}catch(n){return Promise.reject(n)}}),e.stack.push({value:t,dispose:s,async:r})}else r&&e.stack.push({async:!0});return t}function ot(e){function t(n){e.error=e.hasError?new lt(n,e.error,"An error was suppressed during disposal."):n,e.hasError=!0}var r,s=0;function o(){for(;r=e.stack.pop();)try{if(!r.async&&s===1)return s=0,e.stack.push(r),Promise.resolve().then(o);if(r.dispose){var n=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(n).then(o,function(a){return t(a),o()})}else s|=1}catch(a){t(a)}if(s===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return o()}function at(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,o,n,a){return s?t?".jsx":".js":o&&(!n||!a)?r:o+n+"."+a.toLowerCase()+"js"}):e}var Z,Y,K,it,ee,lt,ut,W=xe(()=>{"use strict";p(),Z=function(e,t){return Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(r[o]=s[o])},Z(e,t)},Y=function(){return Y=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Y.apply(this,arguments)},K=Object.create?(function(e,t,r,s){s===void 0&&(s=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,o)}):(function(e,t,r,s){s===void 0&&(s=r),e[s]=t[r]}),it=Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t},ee=function(e){return ee=Object.getOwnPropertyNames||function(t){var r=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[r.length]=s);return r},ee(e)},lt=typeof SuppressedError=="function"?SuppressedError:function(e,t,r){var s=new Error(r);return s.name="SuppressedError",s.error=e,s.suppressed=t,s},ut={__extends:Ce,__assign:Y,__rest:je,__decorate:Ue,__param:De,__esDecorate:Me,__runInitializers:He,__propKey:ke,__setFunctionName:Be,__metadata:Fe,__awaiter:qe,__generator:We,__createBinding:K,__exportStar:Ge,__values:ne,__read:ye,__spread:ze,__spreadArrays:Ve,__spreadArray:Ye,__await:F,__asyncGenerator:Ke,__asyncDelegator:Je,__asyncValues:Xe,__makeTemplateObject:Qe,__importStar:Ze,__importDefault:et,__classPrivateFieldGet:tt,__classPrivateFieldSet:rt,__classPrivateFieldIn:st,__addDisposableResource:nt,__disposeResources:ot,__rewriteRelativeImportExtension:at}}),ct=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};e.default=t}),ht=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ct()),s=class{constructor(o){var n,a;this.shouldThrowOnError=!1,this.method=o.method,this.url=o.url,this.headers=new Headers(o.headers),this.schema=o.schema,this.body=o.body,this.shouldThrowOnError=(n=o.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=o.signal,this.isMaybeSingle=(a=o.isMaybeSingle)!==null&&a!==void 0?a:!1,o.fetch?this.fetch=o.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,n){return this.headers=new Headers(this.headers),this.headers.set(o,n),this}then(o,n){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let a=this.fetch,l=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async u=>{var i,c,h,m;let d=null,y=null,E=null,g=u.status,v=u.statusText;if(u.ok){if(this.method!=="HEAD"){let f=await u.text();f===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text")?y=f:y=JSON.parse(f))}let S=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),P=(h=u.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");S&&P&&P.length>1&&(E=parseInt(P[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(y)&&(y.length>1?(d={code:"PGRST116",details:`Results contain ${y.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},y=null,E=null,g=406,v="Not Acceptable"):y.length===1?y=y[0]:y=null)}else{let S=await u.text();try{d=JSON.parse(S),Array.isArray(d)&&u.status===404&&(y=[],d=null,g=200,v="OK")}catch{u.status===404&&S===""?(g=204,v="No Content"):d={message:S}}if(d&&this.isMaybeSingle&&!((m=d?.details)===null||m===void 0)&&m.includes("0 rows")&&(d=null,g=200,v="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:y,count:E,status:g,statusText:v}});return this.shouldThrowOnError||(l=l.catch(u=>{var i,c,h;return{error:{message:`${(i=u?.name)!==null&&i!==void 0?i:"FetchError"}: ${u?.message}`,details:`${(c=u?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(h=u?.code)!==null&&h!==void 0?h:""}`},data:null,count:null,status:0,statusText:""}})),l.then(o,n)}returns(){return this}overrideTypes(){return this}};e.default=s}),dt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ht()),s=class extends r.default{select(o){let n=!1,a=(o??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",a),this.headers.append("Prefer","return=representation"),this}order(o,{ascending:n=!0,nullsFirst:a,foreignTable:l,referencedTable:u=l}={}){let i=u?`${u}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${o}.${n?"asc":"desc"}${a===void 0?"":a?".nullsfirst":".nullslast"}`),this}limit(o,{foreignTable:n,referencedTable:a=n}={}){let l=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${o}`),this}range(o,n,{foreignTable:a,referencedTable:l=a}={}){let u=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(u,`${o}`),this.url.searchParams.set(i,`${n-o+1}`),this}abortSignal(o){return this.signal=o,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:o=!1,verbose:n=!1,settings:a=!1,buffers:l=!1,wal:u=!1,format:i="text"}={}){var c;let h=[o?"analyze":null,n?"verbose":null,a?"settings":null,l?"buffers":null,u?"wal":null].filter(Boolean).join("|"),m=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${m}"; options=${h};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(o){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${o}`),this}};e.default=s}),ge=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(dt()),s=new RegExp("[,()]"),o=class extends r.default{eq(n,a){return this.url.searchParams.append(n,`eq.${a}`),this}neq(n,a){return this.url.searchParams.append(n,`neq.${a}`),this}gt(n,a){return this.url.searchParams.append(n,`gt.${a}`),this}gte(n,a){return this.url.searchParams.append(n,`gte.${a}`),this}lt(n,a){return this.url.searchParams.append(n,`lt.${a}`),this}lte(n,a){return this.url.searchParams.append(n,`lte.${a}`),this}like(n,a){return this.url.searchParams.append(n,`like.${a}`),this}likeAllOf(n,a){return this.url.searchParams.append(n,`like(all).{${a.join(",")}}`),this}likeAnyOf(n,a){return this.url.searchParams.append(n,`like(any).{${a.join(",")}}`),this}ilike(n,a){return this.url.searchParams.append(n,`ilike.${a}`),this}ilikeAllOf(n,a){return this.url.searchParams.append(n,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(n,a){return this.url.searchParams.append(n,`ilike(any).{${a.join(",")}}`),this}is(n,a){return this.url.searchParams.append(n,`is.${a}`),this}in(n,a){let l=Array.from(new Set(a)).map(u=>typeof u=="string"&&s.test(u)?`"${u}"`:`${u}`).join(",");return this.url.searchParams.append(n,`in.(${l})`),this}contains(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cs.{${a.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(a)}`),this}containedBy(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cd.{${a.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(a)}`),this}rangeGt(n,a){return this.url.searchParams.append(n,`sr.${a}`),this}rangeGte(n,a){return this.url.searchParams.append(n,`nxl.${a}`),this}rangeLt(n,a){return this.url.searchParams.append(n,`sl.${a}`),this}rangeLte(n,a){return this.url.searchParams.append(n,`nxr.${a}`),this}rangeAdjacent(n,a){return this.url.searchParams.append(n,`adj.${a}`),this}overlaps(n,a){return typeof a=="string"?this.url.searchParams.append(n,`ov.${a}`):this.url.searchParams.append(n,`ov.{${a.join(",")}}`),this}textSearch(n,a,{config:l,type:u}={}){let i="";u==="plain"?i="pl":u==="phrase"?i="ph":u==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(n,`${i}fts${c}.${a}`),this}match(n){return Object.entries(n).forEach(([a,l])=>{this.url.searchParams.append(a,`eq.${l}`)}),this}not(n,a,l){return this.url.searchParams.append(n,`not.${a}.${l}`),this}or(n,{foreignTable:a,referencedTable:l=a}={}){let u=l?`${l}.or`:"or";return this.url.searchParams.append(u,`(${n})`),this}filter(n,a,l){return this.url.searchParams.append(n,`${a}.${l}`),this}};e.default=o}),pt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ge()),s=class{constructor(o,{headers:n={},schema:a,fetch:l}){this.url=o,this.headers=new Headers(n),this.schema=a,this.fetch=l}select(o,n){let{head:a=!1,count:l}=n??{},u=a?"HEAD":"GET",i=!1,c=(o??"*").split("").map(h=>/\s/.test(h)&&!i?"":(h==='"'&&(i=!i),h)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:u,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(o,{count:n,defaultToNull:a=!0}={}){var l;let u="POST";if(n&&this.headers.append("Prefer",`count=${n}`),a||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let i=o.reduce((c,h)=>c.concat(Object.keys(h)),[]);if(i.length>0){let c=[...new Set(i)].map(h=>`"${h}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:u,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(o,{onConflict:n,ignoreDuplicates:a=!1,count:l,defaultToNull:u=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${a?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),l&&this.headers.append("Prefer",`count=${l}`),u||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let h=o.reduce((m,d)=>m.concat(Object.keys(d)),[]);if(h.length>0){let m=[...new Set(h)].map(d=>`"${d}"`);this.url.searchParams.set("columns",m.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(o,{count:n}={}){var a;let l="PATCH";return n&&this.headers.append("Prefer",`count=${n}`),new r.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}delete({count:o}={}){var n;let a="DELETE";return o&&this.headers.append("Prefer",`count=${o}`),new r.default({method:a,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};e.default=s}),zt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(pt()),s=t.__importDefault(ge()),o=class ft{constructor(a,{headers:l={},schema:u,fetch:i}={}){this.url=a,this.headers=new Headers(l),this.schemaName=u,this.fetch=i}from(a){let l=new URL(`${this.url}/${a}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new ft(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,l={},{head:u=!1,get:i=!1,count:c}={}){var h;let m,d=new URL(`${this.url}/rpc/${a}`),y;u||i?(m=u?"HEAD":"GET",Object.entries(l).filter(([g,v])=>v!==void 0).map(([g,v])=>[g,Array.isArray(v)?`{${v.join(",")}}`:`${v}`]).forEach(([g,v])=>{d.searchParams.append(g,v)})):(m="POST",y=l);let E=new Headers(this.headers);return c&&E.set("Prefer",`count=${c}`),new s.default({method:m,url:d,headers:E,schema:this.schemaName,body:y,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};e.default=o}),Vt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0}),e.PostgrestError=e.PostgrestBuilder=e.PostgrestTransformBuilder=e.PostgrestFilterBuilder=e.PostgrestQueryBuilder=e.PostgrestClient=void 0;var t=(W(),q(M)),r=t.__importDefault(zt());e.PostgrestClient=r.default;var s=t.__importDefault(pt());e.PostgrestQueryBuilder=s.default;var o=t.__importDefault(ge());e.PostgrestFilterBuilder=o.default;var n=t.__importDefault(dt());e.PostgrestTransformBuilder=n.default;var a=t.__importDefault(ht());e.PostgrestBuilder=a.default;var l=t.__importDefault(ct());e.PostgrestError=l.default,e.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:o.default,PostgrestTransformBuilder:n.default,PostgrestBuilder:a.default,PostgrestError:l.default}});p();p();p();p();p();p();var Yt=Object.defineProperty,Kt=Object.defineProperties,Jt=Object.getOwnPropertyDescriptors,Te=Object.getOwnPropertySymbols,Xt=Object.prototype.hasOwnProperty,Qt=Object.prototype.propertyIsEnumerable,Se=(e,t,r)=>t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,L=(e,t)=>{for(var r in t||(t={}))Xt.call(t,r)&&Se(e,r,t[r]);if(Te)for(var r of Te(t))Qt.call(t,r)&&Se(e,r,t[r]);return e},N=(e,t)=>Kt(e,Jt(t)),Zt=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r}},er=async(e,t)=>{var r,s,o,n,a,l;let u=t||{},i={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:u,hooks:i};for(let c of t?.plugins||[]){if(c.init){let h=await((r=c.init)==null?void 0:r.call(c,e.toString(),t));u=h.options||u,e=h.url}i.onRequest.push((s=c.hooks)==null?void 0:s.onRequest),i.onResponse.push((o=c.hooks)==null?void 0:o.onResponse),i.onSuccess.push((n=c.hooks)==null?void 0:n.onSuccess),i.onError.push((a=c.hooks)==null?void 0:a.onError),i.onRetry.push((l=c.hooks)==null?void 0:l.onRetry)}return{url:e,options:u,hooks:i}},Pe=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},tr=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function rr(e){if(typeof e=="number")return new Pe({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new Pe(e);case"exponential":return new tr(e);default:throw new Error("Invalid retry strategy")}}var sr=async e=>{let t={},r=async s=>typeof s=="function"?await s():s;if(e?.auth){if(e.auth.type==="Bearer"){let s=await r(e.auth.token);if(!s)return t;t.authorization=`Bearer ${s}`}else if(e.auth.type==="Basic"){let s=r(e.auth.username),o=r(e.auth.password);if(!s||!o)return t;t.authorization=`Basic ${btoa(`${s}:${o}`)}`}else if(e.auth.type==="Custom"){let s=r(e.auth.value);if(!s)return t;t.authorization=`${r(e.auth.prefix)} ${s}`}}return t},nr=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function or(e){let t=e.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let s=t.split(";").shift()||"";return nr.test(s)?"json":r.has(s)||s.startsWith("text/")?"text":"blob"}function ar(e){try{return JSON.parse(e),!0}catch{return!1}}function mt(e){if(e===void 0)return!1;let t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function Re(e){try{return JSON.parse(e)}catch{return e}}function Ae(e){return typeof e=="function"}function ir(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&Ae(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&Ae(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function lr(e){let t=new Headers(e?.headers),r=await sr(e);for(let[s,o]of Object.entries(r||{}))t.set(s,o);if(!t.has("content-type")){let s=ur(e?.body);s&&t.set("content-type",s)}return t}function ur(e){return mt(e)?"application/json":null}function cr(e){if(!e?.body)return null;let t=new Headers(e?.headers);if(mt(e.body)&&!t.has("content-type")){for(let[r,s]of Object.entries(e?.body))s instanceof Date&&(e.body[r]=s.toISOString());return JSON.stringify(e.body)}return e.body}function hr(e,t){var r;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){let s=(r=e.split("@")[1])==null?void 0:r.split("/")[0];return gt.includes(s)?s.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function dr(e,t){let r;return!e?.signal&&e?.timeout&&(r=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}var pr=class yt extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,yt.prototype)}};async function te(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new pr(r.issues);return r.value}var gt=["get","post","put","patch","delete"],fr=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,r){var s,o,n,a;let l=((o=(s=e.plugins)==null?void 0:s.find(u=>{var i;return(i=u.schema)!=null&&i.config?t.startsWith(u.schema.config.baseURL||"")||t.startsWith(u.schema.config.prefix||""):!1}))==null?void 0:o.schema)||e.schema;if(l){let u=t;(n=l.config)!=null&&n.prefix&&u.startsWith(l.config.prefix)&&(u=u.replace(l.config.prefix,""),l.config.baseURL&&(t=t.replace(l.config.prefix,l.config.baseURL))),(a=l.config)!=null&&a.baseURL&&u.startsWith(l.config.baseURL)&&(u=u.replace(l.config.baseURL,""));let i=l.schema[u];if(i){let c=N(L({},r),{method:i.method,output:i.output});return r?.disableValidation||(c=N(L({},c),{body:i.input?await te(i.input,r?.body):r?.body,params:i.params?await te(i.params,r?.params):r?.params,query:i.query?await te(i.query,r?.query):r?.query})),{url:t,options:c}}}return{url:t,options:r}}}),mr=e=>{async function t(r,s){let o=N(L(L({},e),s),{plugins:[...e?.plugins||[],fr(e||{})]});if(e?.catchAllError)try{return await pe(r,o)}catch(n){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:n}}}return await pe(r,o)}return t};function yr(e,t){let{baseURL:r,params:s,query:o}=t||{query:{},params:{},baseURL:""},n=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let c=e.toString().split("@")[1].split("/")[0];gt.includes(c)&&(e=e.replace(`@${c}/`,"/"))}n.endsWith("/")||(n+="/");let[a,l]=e.replace(n,"").split("?"),u=new URLSearchParams(l);for(let[c,h]of Object.entries(o||{}))h!=null&&u.set(c,String(h));if(s)if(Array.isArray(s)){let c=a.split("/").filter(h=>h.startsWith(":"));for(let[h,m]of c.entries()){let d=s[h];a=a.replace(m,d)}}else for(let[c,h]of Object.entries(s))a=a.replace(`:${c}`,String(h));a=a.split("/").map(encodeURIComponent).join("/"),a.startsWith("/")&&(a=a.slice(1));let i=u.toString();return i=i.length>0?`?${i}`.replace(/\+/g,"%20"):"",n.startsWith("http")?new URL(`${a}${i}`,n):`${n}${a}${i}`}var pe=async(e,t)=>{var r,s,o,n,a,l,u,i;let{hooks:c,url:h,options:m}=await er(e,t),d=ir(m),y=new AbortController,E=(r=m.signal)!=null?r:y.signal,g=yr(h,m),v=cr(m),S=await lr(m),P=hr(h,m),f=N(L({},m),{url:g,headers:S,body:v,method:P,signal:E});for(let T of c.onRequest)if(T){let _=await T(f);_ instanceof Object&&(f=_)}("pipeTo"in f&&typeof f.pipeTo=="function"||typeof((s=t?.body)==null?void 0:s.pipe)=="function")&&("duplex"in f||(f.duplex="half"));let{clearTimeout:j}=dr(m,y),b=await d(f.url,f);j();let _e={response:b,request:f};for(let T of c.onResponse)if(T){let _=await T(N(L({},_e),{response:(o=t?.hookOptions)!=null&&o.cloneResponse?b.clone():b}));_ instanceof Response?b=_:_ instanceof Object&&(b=_.response)}if(b.ok){if(f.method==="HEAD")return{data:"",error:null};let T=or(b),_={data:"",response:b,request:f};if(T==="json"||T==="text"){let H=await b.text(),k=await((n=f.jsonParser)!=null?n:Re)(H);_.data=k}else _.data=await b[T]();f?.output&&f.output&&!f.disableValidation&&(_.data=await te(f.output,_.data));for(let H of c.onSuccess)H&&await H(N(L({},_),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?b.clone():b}));return t?.throw?_.data:{data:_.data,error:null}}let Nt=(l=t?.jsonParser)!=null?l:Re,J=await b.text(),Oe=ar(J),ue=Oe?await Nt(J):null,xt={response:b,responseText:J,request:f,error:N(L({},ue),{status:b.status,statusText:b.statusText})};for(let T of c.onError)T&&await T(N(L({},xt),{response:(u=t?.hookOptions)!=null&&u.cloneResponse?b.clone():b}));if(t?.retry){let T=rr(t.retry),_=(i=t.retryAttempt)!=null?i:0;if(await T.shouldAttemptRetry(_,b)){for(let k of c.onRetry)k&&await k(_e);let H=T.getDelay(_);return await new Promise(k=>setTimeout(k,H)),await pe(e,N(L({},t),{retryAttempt:_+1}))}}if(t?.throw)throw new Zt(b.status,b.statusText,Oe?ue:J);return{data:null,error:N(L({},ue),{status:b.status,statusText:b.statusText})}};p();p();var re=Object.create(null),G=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?re:globalThis),A=new Proxy(re,{get(e,t){return G()[t]??re[t]},has(e,t){let r=G();return t in r||t in re},set(e,t,r){let s=G(!0);return s[t]=r,!0},deleteProperty(e,t){if(!t)return!1;let r=G(!0);return delete r[t],!0},ownKeys(){let e=G(!0);return Object.keys(e)}}),gs=typeof process<"u"&&process.env&&process.env.NODE_ENV||"";function w(e,t){return typeof process<"u"&&process.env?process.env[e]??t:typeof Deno<"u"?Deno.env.get(e)??t:typeof Bun<"u"?Bun.env[e]??t:t}var vs=Object.freeze({get BETTER_AUTH_SECRET(){return w("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return w("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return w("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return w("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return w("NODE_ENV","development")},get PACKAGE_VERSION(){return w("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return w("BETTER_AUTH_TELEMETRY_ENDPOINT","https://telemetry.better-auth.com/v1/track")}}),z=1,O=4,x=8,R=24,Ie={eterm:O,cons25:O,console:O,cygwin:O,dtterm:O,gnome:O,hurd:O,jfbterm:O,konsole:O,kterm:O,mlterm:O,mosh:R,putty:O,st:O,"rxvt-unicode-24bit":R,terminator:R,"xterm-kitty":R},gr=new Map(Object.entries({APPVEYOR:x,BUILDKITE:x,CIRCLECI:R,DRONE:x,GITEA_ACTIONS:R,GITHUB_ACTIONS:R,GITLAB_CI:x,TRAVIS:x})),vr=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function wr(){if(w("FORCE_COLOR")!==void 0)switch(w("FORCE_COLOR")){case"":case"1":case"true":return O;case"2":return x;case"3":return R;default:return z}if(w("NODE_DISABLE_COLORS")!==void 0&&w("NODE_DISABLE_COLORS")!==""||w("NO_COLOR")!==void 0&&w("NO_COLOR")!==""||w("TERM")==="dumb")return z;if(w("TMUX"))return R;if("TF_BUILD"in A&&"AGENT_NAME"in A)return O;if("CI"in A){for(let{0:e,1:t}of gr)if(e in A)return t;return w("CI_NAME")==="codeship"?x:z}if("TEAMCITY_VERSION"in A)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(w("TEAMCITY_VERSION"))!==null?O:z;switch(w("TERM_PROGRAM")){case"iTerm.app":return!w("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(w("TERM_PROGRAM_VERSION"))!==null?x:R;case"HyperTerm":case"MacTerm":return R;case"Apple_Terminal":return x}if(w("COLORTERM")==="truecolor"||w("COLORTERM")==="24bit")return R;if(w("TERM")){if(/truecolor/.exec(w("TERM"))!==null)return R;if(/^xterm-256/.exec(w("TERM"))!==null)return x;let e=w("TERM").toLowerCase();if(Ie[e])return Ie[e];if(vr.some(t=>t.exec(e)!==null))return O}return w("COLORTERM")?O:z}var $={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",undim:"\x1B[22m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",fg:{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},bg:{black:"\x1B[40m",red:"\x1B[41m",green:"\x1B[42m",yellow:"\x1B[43m",blue:"\x1B[44m",magenta:"\x1B[45m",cyan:"\x1B[46m",white:"\x1B[47m"}},fe=["info","success","warn","error","debug"];function Er(e,t){return fe.indexOf(t)<=fe.indexOf(e)}var br={info:$.fg.blue,success:$.fg.green,warn:$.fg.yellow,error:$.fg.red,debug:$.fg.magenta},_r=(e,t,r)=>{let s=new Date().toISOString();return r?`${$.dim}${s}${$.reset} ${br[e]}${e.toUpperCase()}${$.reset} ${$.bright}[Better Auth]:${$.reset} ${t}`:`${s} ${e.toUpperCase()} [Better Auth]: ${t}`},Or=e=>{let t=e?.disabled!==!0,r=e?.level??"error",s=e?.disableColors!==void 0?!e.disableColors:wr()!==1,o=(n,a,l=[])=>{if(!t||!Er(r,n))return;let u=_r(n,a,s);if(!e||typeof e.log!="function"){n==="error"?console.error(u,...l):n==="warn"?console.warn(u,...l):console.log(u,...l);return}e.log(n==="success"?"info":n,a,...l)};return{...Object.fromEntries(fe.map(n=>[n,(...[a,...l])=>o(n,a,l)])),get level(){return r}}},ws=Or();p();p();var ve=class extends Error{constructor(e,t){super(e),this.name="BetterAuthError",this.message=e,this.cause=t,this.stack=""}};function Tr(e){try{return(new URL(e).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new ve(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function V(e,t="/api/auth"){if(Tr(e))return e;let r=e.replace(/\/+$/,"");return!t||t==="/"?r:(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`)}function Sr(e,t,r,s){if(e)return V(e,t);if(s!==!1){let a=A.BETTER_AUTH_URL||A.NEXT_PUBLIC_BETTER_AUTH_URL||A.PUBLIC_BETTER_AUTH_URL||A.NUXT_PUBLIC_BETTER_AUTH_URL||A.NUXT_PUBLIC_AUTH_URL||(A.BASE_URL!=="/"?A.BASE_URL:void 0);if(a)return V(a,t)}let o=r?.headers.get("x-forwarded-host"),n=r?.headers.get("x-forwarded-proto");if(o&&n)return V(`${n}://${o}`,t);if(r){let a=Pr(r.url);if(!a)throw new ve("Could not get origin from request. Please provide a valid base URL.");return V(a,t)}if(typeof window<"u"&&window.location)return V(window.location.origin,t)}function Pr(e){try{return new URL(e).origin}catch{return null}}p();p();p();var me=Symbol("clean"),I=[],C=0,X=4,Rr=0,vt=e=>{let t=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},lc:0,listen(s){return r.lc=t.push(s),()=>{for(let n=C+X;n<I.length;)I[n]===s?I.splice(n,X):n+=X;let o=t.indexOf(s);~o&&(t.splice(o,1),--r.lc||r.off())}},notify(s,o){Rr++;let n=!I.length;for(let a of t)I.push(a,r.value,s,o);if(n){for(C=0;C<I.length;C+=X)I[C](I[C+1],I[C+2],I[C+3]);I.length=0}},off(){},set(s){let o=r.value;o!==s&&(r.value=s,r.notify(o))},subscribe(s){let o=r.listen(s);return s(r.value),o},value:e};return process.env.NODE_ENV!=="production"&&(r[me]=()=>{t=[],r.lc=0,r.off()}),r};p();var Ar=5,B=6,Q=10,Ir=(e,t,r,s)=>(e.events=e.events||{},e.events[r+Q]||(e.events[r+Q]=s(o=>{e.events[r].reduceRight((n,a)=>(a(n),n),{shared:{},...o})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let o=e.events[r],n=o.indexOf(t);o.splice(n,1),o.length||(delete e.events[r],e.events[r+Q](),delete e.events[r+Q])}),Lr=1e3,Nr=(e,t)=>Ir(e,r=>{let s=t(r);s&&e.events[B].push(s)},Ar,r=>{let s=e.listen;e.listen=(...n)=>(!e.lc&&!e.active&&(e.active=!0,r()),s(...n));let o=e.off;if(e.events[B]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let n of e.events[B])n();e.events[B]=[]}},Lr)},process.env.NODE_ENV!=="production"){let n=e[me];e[me]=()=>{for(let a of e.events[B])a();e.events[B]=[],e.active=!1,n()}}return()=>{e.listen=s,e.off=o}});p();var xr=typeof window>"u",$r=(e,t,r,s)=>{let o=vt({data:null,error:null,isPending:!0,isRefetching:!1,refetch:l=>n(l)}),n=l=>{let u=typeof s=="function"?s({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):s;r(t,{...u,query:{...u?.query,...l?.query},async onSuccess(i){o.set({data:i.data,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await u?.onSuccess?.(i)},async onError(i){let{request:c}=i,h=typeof c.retry=="number"?c.retry:c.retry?.attempts,m=c.retryAttempt||0;h&&m<h||(o.set({error:i.error,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await u?.onError?.(i))},async onRequest(i){let c=o.get();o.set({isPending:c.data===null,data:c.data,error:null,isRefetching:!0,refetch:o.value.refetch}),await u?.onRequest?.(i)}}).catch(i=>{o.set({error:i,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch})})};e=Array.isArray(e)?e:[e];let a=!1;for(let l of e)l.subscribe(()=>{xr||(a?n():Nr(o,()=>{let u=setTimeout(()=>{a||(n(),a=!0)},0);return()=>{o.off(),l.off(),clearTimeout(u)}}))});return o};p();var Cr={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},jr=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,Le={true:!0,false:!1,null:null,undefined:void 0,nan:Number.NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},Ur=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Dr(e){return e instanceof Date&&!isNaN(e.getTime())}function Mr(e){let t=Ur.exec(e);if(!t)return null;let[,r,s,o,n,a,l,u,i,c,h]=t,m=new Date(Date.UTC(parseInt(r,10),parseInt(s,10)-1,parseInt(o,10),parseInt(n,10),parseInt(a,10),parseInt(l,10),u?parseInt(u.padEnd(3,"0"),10):0));if(i){let d=(parseInt(c,10)*60+parseInt(h,10))*(i==="+"?-1:1);m.setUTCMinutes(m.getUTCMinutes()+d)}return Dr(m)?m:null}function Hr(e,t={}){let{strict:r=!1,warnings:s=!1,reviver:o,parseDates:n=!0}=t;if(typeof e!="string")return e;let a=e.trim();if(a.length>0&&a[0]==='"'&&a.endsWith('"')&&!a.slice(1,-1).includes('"'))return a.slice(1,-1);let l=a.toLowerCase();if(l.length<=9&&l in Le)return Le[l];if(!jr.test(a)){if(r)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(Cr).some(([u,i])=>{let c=i.test(a);return c&&s&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${u} pattern`),c})&&r)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(a,(u,i)=>{if(u==="__proto__"||u==="constructor"&&i&&typeof i=="object"&&"prototype"in i){s&&console.warn(`[better-json] Dropping "${u}" key to prevent prototype pollution`);return}if(n&&typeof i=="string"){let c=Mr(i);if(c)return c}return o?o(u,i):i})}catch(u){if(r)throw u;return e}}function kr(e,t={strict:!0}){return Hr(e,t)}var Br={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function Fr(e){let t=vt(!1);return{session:$r(t,"/get-session",e,{method:"GET"}),$sessionSignal:t}}var qr=(e,t)=>{let r="credentials"in Request.prototype,s=Sr(e?.baseURL,e?.basePath,void 0,t)??"/api/auth",o=e?.plugins?.flatMap(f=>f.fetchPlugins).filter(f=>f!==void 0)||[],n={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:a,onError:l,onRequest:u,onResponse:i,...c}=e?.fetchOptions||{},h=mr({baseURL:s,...r?{credentials:"include"}:{},method:"GET",jsonParser(f){return f?kr(f,{strict:!1}):null},customFetchImpl:fetch,...c,plugins:[n,...c.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Br],...o]}),{$sessionSignal:m,session:d}=Fr(h),y=e?.plugins||[],E={},g={$sessionSignal:m,session:d},v={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},S=[{signal:"$sessionSignal",matcher(f){return f==="/sign-out"||f==="/update-user"||f.startsWith("/sign-in")||f.startsWith("/sign-up")||f==="/delete-user"||f==="/verify-email"}}];for(let f of y)f.getAtoms&&Object.assign(g,f.getAtoms?.(h)),f.pathMethods&&Object.assign(v,f.pathMethods),f.atomListeners&&S.push(...f.atomListeners);let P={notify:f=>{g[f].set(!g[f].get())},listen:(f,j)=>{g[f].subscribe(j)},atoms:g};for(let f of y)f.getActions&&Object.assign(E,f.getActions?.(h,P,e));return{get baseURL(){return s},pluginsActions:E,pluginsAtoms:g,pluginPathMethods:v,atomListeners:S,$fetch:h,$store:P}};function Wr(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function Gr(e,t,r){let s=t[e],{fetchOptions:o,query:n,...a}=r||{};return s||(o?.method?o.method:a&&Object.keys(a).length>0?"POST":"GET")}function zr(e,t,r,s,o){function n(a=[]){return new Proxy(function(){},{get(l,u){if(typeof u!="string"||u==="then"||u==="catch"||u==="finally")return;let i=[...a,u],c=e;for(let h of i)if(c&&typeof c=="object"&&h in c)c=c[h];else{c=void 0;break}return typeof c=="function"||Wr(c)?c:n(i)},apply:async(l,u,i)=>{let c="/"+a.map(S=>S.replace(/[A-Z]/g,P=>`-${P.toLowerCase()}`)).join("/"),h=i[0]||{},m=i[1]||{},{query:d,fetchOptions:y,...E}=h,g={...m,...y},v=Gr(c,r,h);return await t(c,{...g,body:v==="GET"?void 0:{...E,...g?.body||{}},query:d||g?.query,method:v,async onSuccess(S){if(await g?.onSuccess?.(S),!o)return;let P=o.filter(f=>f.matcher(c));if(P.length)for(let f of P){let j=s[f.signal];if(!j)return;let b=j.get();setTimeout(()=>{j.set(!b)},10)}}})}})}return n()}p();function Vr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Yr(e){let{pluginPathMethods:t,pluginsActions:r,pluginsAtoms:s,$fetch:o,atomListeners:n,$store:a}=qr(e),l={};for(let[i,c]of Object.entries(s))l[`use${Vr(i)}`]=c;let u={...r,...l,$fetch:o,$store:a};return zr(u,o,t,s,n)}p();p();p();function Kr(e){return{authorize(t,r="AND"){let s=!1;for(let[o,n]of Object.entries(t)){let a=e[o];if(!a)return{success:!1,error:`You are not allowed to access resource: ${o}`};if(Array.isArray(n))s=n.every(l=>a.includes(l));else if(typeof n=="object"){let l=n;l.connector==="OR"?s=l.actions.some(u=>a.includes(u)):s=l.actions.every(u=>a.includes(u))}else throw new ve("Invalid access control request");if(s&&r==="OR")return{success:s};if(!s&&r==="AND")return{success:!1,error:`unauthorized to access resource "${o}"`}}return s?{success:s}:{success:!1,error:"Not authorized"}},statements:e}}function wt(e){return{newRole(t){return Kr(t)},statements:e}}var Jr={organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]},we=wt(Jr),Es=we.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),bs=we.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),_s=we.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]});p();p();p();p();p();p();p();p();p();p();p();var Xr=class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let t=new Error("Cancelling existing WebAuthn API call for new one");t.name="AbortError",this.controller.abort(t)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}},Os=new Xr;p();p();p();p();p();p();p();p();var Qr={user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]},Et=wt(Qr),Ts=Et.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),Ss=Et.newRole({user:[],session:[]});p();p();var Zr=()=>({id:"username",$InferServerPlugin:{}}),es=()=>({id:"phoneNumber",$InferServerPlugin:{},atomListeners:[{matcher(e){return e==="/phone-number/update"||e==="/phone-number/verify"},signal:"$sessionSignal"}]}),ts=()=>({id:"better-auth-client",$InferServerPlugin:{}}),rs="/auth",he="nvwa_login_token",se="nvwa_current_jwt",de="nvwa_user_profile",bt=class{constructor(e,t,r){this.storage=r;let s=Yr({baseURL:e,basePath:rs,plugins:[Zr(),es(),ts()],fetchOptions:{customFetchImpl:t,auth:{type:"Bearer",token:async()=>{let o=await this.storage.get(se);if(console.log("jwt",o),o)return o;let n=await this.storage.get(he);return console.log("loginToken",n),n}}}});this.authClient=s}async currentUser(){return await this.storage.get(de)}async getCurrentJwt(){return await this.storage.get(se)}async signUp(e){let t=await this.authClient.signUp.email({email:e.email??`${e.username}@nvwa.app`,name:e.name,username:e.username,displayUsername:e.displayUsername,password:e.password});this.handleLogin(t)}async sendPhoneNumberCode(e){await this.authClient.phoneNumber.sendOtp({phoneNumber:e})}async signInWithPhoneNumberCode(e,t){let r=await this.authClient.phoneNumber.verify({phoneNumber:e,code:t});this.handleLogin(r)}async signInWithPhoneNumber(e,t,r=!1){let s=await this.authClient.signIn.phoneNumber({phoneNumber:e,password:t,rememberMe:r});this.handleLogin(s)}async signInWithUsername(e,t){let r=await this.authClient.signIn.username({username:e,password:t});this.handleLogin(r)}async handleLogin(e){if(e.error)throw new Error(e.error.message);await this.storage.set(he,e.data?.token),await this.storage.set(de,e.data?.user);let{data:t,error:r}=await this.authClient.token();if(r)throw new Error(r.message);await this.storage.set(se,t.token)}async signOut(){await this.storage.remove(he),await this.storage.remove(de)}async updateUserPassword(e,t,r=!1){let s=await this.authClient.changePassword({currentPassword:e,newPassword:t,revokeOtherSessions:r});this.handleLogin(s)}};p();var _t=class{constructor(e){this.http=e}async invoke(e,t){return await(await this.http.fetch("/functions/"+e,{method:t.method||"POST",body:t.body,headers:t.headers})).json()}};p();p();p();var U=class Ot{constructor(t){if(this.headerMap=new Map,t){if(t instanceof Ot)t.forEach((r,s)=>this.set(s,r));else if(Array.isArray(t))for(let[r,s]of t)this.set(r,String(s));else if(typeof t=="object")for(let r of Object.keys(t))this.set(r,String(t[r]))}}append(t,r){let s=t.toLowerCase(),o=this.headerMap.get(s);this.headerMap.set(s,o?`${o}, ${r}`:r)}set(t,r){this.headerMap.set(t.toLowerCase(),String(r))}get(t){return this.headerMap.get(t.toLowerCase())??null}has(t){return this.headerMap.has(t.toLowerCase())}delete(t){this.headerMap.delete(t.toLowerCase())}forEach(t){for(let[r,s]of this.headerMap.entries())t(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}};p();p();var Tt=class{constructor(e,t){this.bodyData=e,this.status=t?.status??200,this.statusText=t?.statusText??"",this.headers=ss(t?.headers),this.ok=this.status>=200&&this.status<300}async text(){return typeof this.bodyData=="string"?this.bodyData:this.bodyData==null?"":typeof this.bodyData=="object"?JSON.stringify(this.bodyData):String(this.bodyData)}async json(){if(typeof this.bodyData=="string")try{return JSON.parse(this.bodyData)}catch{}return this.bodyData}async arrayBuffer(){let e=await this.text();return new TextEncoder().encode(e).buffer}};function ss(e){return e?new U(e):new U}p();p();var St=class{constructor(e,t,r){console.log("NvwaHttpClient constructor",e,t,r),this.storage=e,this.customFetch=t,this.handleUnauthorized=r}async fetch(e,t){return await this.customFetch(e,t)}async fetchWithAuth(e,t){let r=await this.storage.get(se),s=new U(t?.headers);r&&s.set("Authorization",`Bearer ${r}`);let o=t?.method||"GET";if((o==="POST"||o==="PUT"||o==="PATCH")&&t?.body){let a=s.get("Content-Type");(!a||a.includes("text/plain"))&&s.set("Content-Type","application/json")}let n=await this.customFetch(e,{...t,headers:s});if(n.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return n}};p();var ns="/storage",os=ns+"/generateUploadUrl",Pt=class{constructor(e,t){this.baseUrl=e,this.http=t}async uploadFile(e){let t=await this.http.fetch(this.baseUrl+os,{method:"POST",body:{fileName:e.name||e.fileName,fileSize:e.size||e.fileSize,fileType:e.type||e.fileType}}),{url:r}=await t.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:e,headers:new U({"Content-Type":e.type||e.fileType||"application/octet-stream"})}),{url:o}=await s.json();return{url:o.split("?")[0]}}};p();p();p();var Ne=Gt(Vt(),1),{PostgrestClient:as,PostgrestQueryBuilder:Ps,PostgrestFilterBuilder:Rs,PostgrestTransformBuilder:As,PostgrestBuilder:Is,PostgrestError:Ls}=Ne.default||Ne,is="/entities",Rt=(e,t)=>new as(e+is,{fetch:t.fetchWithAuth.bind(t)});p();var At=class{constructor(e,t){this.baseUrl=e,this.http=t}async execute(e,t){let r=`${this.baseUrl}/skill/${e}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:t?JSON.stringify(t):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};p();var It=class{constructor(){this.hoverOverlay=null,this.selectedOverlay=null,this.tooltip=null,this.hoverElement=null,this.selectedElement=null,this.hoverUpdateHandler=null,this.selectedUpdateHandler=null,this.createStyles()}createStyles(){if(document.getElementById("__nvwa-inspector-overlay-style"))return;let e=document.createElement("style");e.id="__nvwa-inspector-overlay-style",e.textContent=`
2
2
  .__nvwa-inspector-overlay {
3
3
  position: absolute;
4
4
  pointer-events: none;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var $t=Object.create,ie=Object.defineProperty,Ct=Object.getOwnPropertyDescriptor,jt=Object.getOwnPropertyNames,Ut=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty,Ne=(e,t)=>()=>(e&&(t=e(e=0)),t),D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Mt=(e,t)=>{for(var r in t)ie(e,r,{get:t[r],enumerable:!0})},xe=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of jt(t))!Dt.call(e,o)&&o!==r&&ie(e,o,{get:()=>t[o],enumerable:!(s=Ct(t,o))||s.enumerable});return e},Ht=(e,t,r)=>(r=e!=null?$t(Ut(e)):{},xe(t||!e||!e.__esModule?ie(r,"default",{value:e,enumerable:!0}):r,e)),q=e=>xe(ie({},"__esModule",{value:!0}),e),p=Ne(()=>{"use strict"}),M={};Mt(M,{__addDisposableResource:()=>st,__assign:()=>Y,__asyncDelegator:()=>Ke,__asyncGenerator:()=>Ye,__asyncValues:()=>Je,__await:()=>F,__awaiter:()=>Fe,__classPrivateFieldGet:()=>et,__classPrivateFieldIn:()=>rt,__classPrivateFieldSet:()=>tt,__createBinding:()=>K,__decorate:()=>je,__disposeResources:()=>nt,__esDecorate:()=>De,__exportStar:()=>We,__extends:()=>$e,__generator:()=>qe,__importDefault:()=>Ze,__importStar:()=>Qe,__makeTemplateObject:()=>Xe,__metadata:()=>Be,__param:()=>Ue,__propKey:()=>He,__read:()=>me,__rest:()=>Ce,__rewriteRelativeImportExtension:()=>ot,__runInitializers:()=>Me,__setFunctionName:()=>ke,__spread:()=>Ge,__spreadArray:()=>Ve,__spreadArrays:()=>ze,__values:()=>ne,default:()=>lt});function $e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Z(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Ce(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(r[s[o]]=e[s[o]]);return r}function je(e,t,r,s){var o=arguments.length,n=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,r):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,r,s);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(n=(o<3?a(n):o>3?a(t,r,n):a(t,r))||n);return o>3&&n&&Object.defineProperty(t,r,n),n}function Ue(e,t){return function(r,s){t(r,s,e)}}function De(e,t,r,s,o,n){function a(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var l=s.kind,u=l==="getter"?"get":l==="setter"?"set":"value",i=!t&&e?s.static?e:e.prototype:null,c=t||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),h,m=!1,d=r.length-1;d>=0;d--){var y={};for(var E in s)y[E]=E==="access"?{}:s[E];for(var E in s.access)y.access[E]=s.access[E];y.addInitializer=function(v){if(m)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(v||null))};var g=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[u],y);if(l==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(h=a(g.get))&&(c.get=h),(h=a(g.set))&&(c.set=h),(h=a(g.init))&&o.unshift(h)}else(h=a(g))&&(l==="field"?o.unshift(h):c[u]=h)}i&&Object.defineProperty(i,s.name,c),m=!0}function Me(e,t,r){for(var s=arguments.length>2,o=0;o<t.length;o++)r=s?t[o].call(e,r):t[o].call(e);return s?r:void 0}function He(e){return typeof e=="symbol"?e:"".concat(e)}function ke(e,t,r){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function Be(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function Fe(e,t,r,s){function o(n){return n instanceof r?n:new r(function(a){a(n)})}return new(r||(r=Promise))(function(n,a){function l(c){try{i(s.next(c))}catch(h){a(h)}}function u(c){try{i(s.throw(c))}catch(h){a(h)}}function i(c){c.done?n(c.value):o(c.value).then(l,u)}i((s=s.apply(e,t||[])).next())})}function qe(e,t){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,o,n,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(i){return function(c){return u([i,c])}}function u(i){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(r=0)),r;)try{if(s=1,o&&(n=i[0]&2?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[i[0]&2,n.value]),i[0]){case 0:case 1:n=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,o=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){r.label=i[1];break}if(i[0]===6&&r.label<n[1]){r.label=n[1],n=i;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(i);break}n[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}catch(c){i=[6,c],o=0}finally{s=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function We(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K(t,e,r)}function ne(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],s=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function me(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var s=r.call(e),o,n=[],a;try{for(;(t===void 0||t-- >0)&&!(o=s.next()).done;)n.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}return n}function Ge(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(me(arguments[t]));return e}function ze(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var s=Array(e),o=0,t=0;t<r;t++)for(var n=arguments[t],a=0,l=n.length;a<l;a++,o++)s[o]=n[a];return s}function Ve(e,t,r){if(r||arguments.length===2)for(var s=0,o=t.length,n;s<o;s++)(n||!(s in t))&&(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))}function F(e){return this instanceof F?(this.v=e,this):new F(e)}function Ye(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(e,t||[]),o,n=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(d){return function(y){return Promise.resolve(y).then(d,h)}}function l(d,y){s[d]&&(o[d]=function(E){return new Promise(function(g,v){n.push([d,E,g,v])>1||u(d,E)})},y&&(o[d]=y(o[d])))}function u(d,y){try{i(s[d](y))}catch(E){m(n[0][3],E)}}function i(d){d.value instanceof F?Promise.resolve(d.value.v).then(c,h):m(n[0][2],d)}function c(d){u("next",d)}function h(d){u("throw",d)}function m(d,y){d(y),n.shift(),n.length&&u(n[0][0],n[0][1])}}function Ke(e){var t,r;return t={},s("next"),s("throw",function(o){throw o}),s("return"),t[Symbol.iterator]=function(){return this},t;function s(o,n){t[o]=e[o]?function(a){return(r=!r)?{value:F(e[o](a)),done:!1}:n?n(a):a}:n}}function Je(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof ne=="function"?ne(e):e[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(n){r[n]=e[n]&&function(a){return new Promise(function(l,u){a=e[n](a),o(l,u,a.done,a.value)})}}function o(n,a,l,u){Promise.resolve(u).then(function(i){n({value:i,done:l})},a)}}function Xe(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Qe(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=ee(e),s=0;s<r.length;s++)r[s]!=="default"&&K(t,e,r[s]);return at(t,e),t}function Ze(e){return e&&e.__esModule?e:{default:e}}function et(e,t,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(e):s?s.value:t.get(e)}function tt(e,t,r,s,o){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r}function rt(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}function st(e,t,r){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var s,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=t[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=t[Symbol.dispose],r&&(o=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");o&&(s=function(){try{o.call(this)}catch(n){return Promise.reject(n)}}),e.stack.push({value:t,dispose:s,async:r})}else r&&e.stack.push({async:!0});return t}function nt(e){function t(n){e.error=e.hasError?new it(n,e.error,"An error was suppressed during disposal."):n,e.hasError=!0}var r,s=0;function o(){for(;r=e.stack.pop();)try{if(!r.async&&s===1)return s=0,e.stack.push(r),Promise.resolve().then(o);if(r.dispose){var n=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(n).then(o,function(a){return t(a),o()})}else s|=1}catch(a){t(a)}if(s===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return o()}function ot(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,o,n,a){return s?t?".jsx":".js":o&&(!n||!a)?r:o+n+"."+a.toLowerCase()+"js"}):e}var Z,Y,K,at,ee,it,lt,W=Ne(()=>{"use strict";p(),Z=function(e,t){return Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(r[o]=s[o])},Z(e,t)},Y=function(){return Y=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Y.apply(this,arguments)},K=Object.create?(function(e,t,r,s){s===void 0&&(s=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,o)}):(function(e,t,r,s){s===void 0&&(s=r),e[s]=t[r]}),at=Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t},ee=function(e){return ee=Object.getOwnPropertyNames||function(t){var r=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[r.length]=s);return r},ee(e)},it=typeof SuppressedError=="function"?SuppressedError:function(e,t,r){var s=new Error(r);return s.name="SuppressedError",s.error=e,s.suppressed=t,s},lt={__extends:$e,__assign:Y,__rest:Ce,__decorate:je,__param:Ue,__esDecorate:De,__runInitializers:Me,__propKey:He,__setFunctionName:ke,__metadata:Be,__awaiter:Fe,__generator:qe,__createBinding:K,__exportStar:We,__values:ne,__read:me,__spread:Ge,__spreadArrays:ze,__spreadArray:Ve,__await:F,__asyncGenerator:Ye,__asyncDelegator:Ke,__asyncValues:Je,__makeTemplateObject:Xe,__importStar:Qe,__importDefault:Ze,__classPrivateFieldGet:et,__classPrivateFieldSet:tt,__classPrivateFieldIn:rt,__addDisposableResource:st,__disposeResources:nt,__rewriteRelativeImportExtension:ot}}),ut=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};e.default=t}),ct=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ut()),s=class{constructor(o){var n,a;this.shouldThrowOnError=!1,this.method=o.method,this.url=o.url,this.headers=new Headers(o.headers),this.schema=o.schema,this.body=o.body,this.shouldThrowOnError=(n=o.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=o.signal,this.isMaybeSingle=(a=o.isMaybeSingle)!==null&&a!==void 0?a:!1,o.fetch?this.fetch=o.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,n){return this.headers=new Headers(this.headers),this.headers.set(o,n),this}then(o,n){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let a=this.fetch,l=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async u=>{var i,c,h,m;let d=null,y=null,E=null,g=u.status,v=u.statusText;if(u.ok){if(this.method!=="HEAD"){let f=await u.text();f===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text")?y=f:y=JSON.parse(f))}let S=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),P=(h=u.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");S&&P&&P.length>1&&(E=parseInt(P[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(y)&&(y.length>1?(d={code:"PGRST116",details:`Results contain ${y.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},y=null,E=null,g=406,v="Not Acceptable"):y.length===1?y=y[0]:y=null)}else{let S=await u.text();try{d=JSON.parse(S),Array.isArray(d)&&u.status===404&&(y=[],d=null,g=200,v="OK")}catch{u.status===404&&S===""?(g=204,v="No Content"):d={message:S}}if(d&&this.isMaybeSingle&&!((m=d?.details)===null||m===void 0)&&m.includes("0 rows")&&(d=null,g=200,v="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:y,count:E,status:g,statusText:v}});return this.shouldThrowOnError||(l=l.catch(u=>{var i,c,h;return{error:{message:`${(i=u?.name)!==null&&i!==void 0?i:"FetchError"}: ${u?.message}`,details:`${(c=u?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(h=u?.code)!==null&&h!==void 0?h:""}`},data:null,count:null,status:0,statusText:""}})),l.then(o,n)}returns(){return this}overrideTypes(){return this}};e.default=s}),ht=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ct()),s=class extends r.default{select(o){let n=!1,a=(o??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",a),this.headers.append("Prefer","return=representation"),this}order(o,{ascending:n=!0,nullsFirst:a,foreignTable:l,referencedTable:u=l}={}){let i=u?`${u}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${o}.${n?"asc":"desc"}${a===void 0?"":a?".nullsfirst":".nullslast"}`),this}limit(o,{foreignTable:n,referencedTable:a=n}={}){let l=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${o}`),this}range(o,n,{foreignTable:a,referencedTable:l=a}={}){let u=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(u,`${o}`),this.url.searchParams.set(i,`${n-o+1}`),this}abortSignal(o){return this.signal=o,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:o=!1,verbose:n=!1,settings:a=!1,buffers:l=!1,wal:u=!1,format:i="text"}={}){var c;let h=[o?"analyze":null,n?"verbose":null,a?"settings":null,l?"buffers":null,u?"wal":null].filter(Boolean).join("|"),m=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${m}"; options=${h};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(o){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${o}`),this}};e.default=s}),ye=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ht()),s=new RegExp("[,()]"),o=class extends r.default{eq(n,a){return this.url.searchParams.append(n,`eq.${a}`),this}neq(n,a){return this.url.searchParams.append(n,`neq.${a}`),this}gt(n,a){return this.url.searchParams.append(n,`gt.${a}`),this}gte(n,a){return this.url.searchParams.append(n,`gte.${a}`),this}lt(n,a){return this.url.searchParams.append(n,`lt.${a}`),this}lte(n,a){return this.url.searchParams.append(n,`lte.${a}`),this}like(n,a){return this.url.searchParams.append(n,`like.${a}`),this}likeAllOf(n,a){return this.url.searchParams.append(n,`like(all).{${a.join(",")}}`),this}likeAnyOf(n,a){return this.url.searchParams.append(n,`like(any).{${a.join(",")}}`),this}ilike(n,a){return this.url.searchParams.append(n,`ilike.${a}`),this}ilikeAllOf(n,a){return this.url.searchParams.append(n,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(n,a){return this.url.searchParams.append(n,`ilike(any).{${a.join(",")}}`),this}is(n,a){return this.url.searchParams.append(n,`is.${a}`),this}in(n,a){let l=Array.from(new Set(a)).map(u=>typeof u=="string"&&s.test(u)?`"${u}"`:`${u}`).join(",");return this.url.searchParams.append(n,`in.(${l})`),this}contains(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cs.{${a.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(a)}`),this}containedBy(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cd.{${a.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(a)}`),this}rangeGt(n,a){return this.url.searchParams.append(n,`sr.${a}`),this}rangeGte(n,a){return this.url.searchParams.append(n,`nxl.${a}`),this}rangeLt(n,a){return this.url.searchParams.append(n,`sl.${a}`),this}rangeLte(n,a){return this.url.searchParams.append(n,`nxr.${a}`),this}rangeAdjacent(n,a){return this.url.searchParams.append(n,`adj.${a}`),this}overlaps(n,a){return typeof a=="string"?this.url.searchParams.append(n,`ov.${a}`):this.url.searchParams.append(n,`ov.{${a.join(",")}}`),this}textSearch(n,a,{config:l,type:u}={}){let i="";u==="plain"?i="pl":u==="phrase"?i="ph":u==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(n,`${i}fts${c}.${a}`),this}match(n){return Object.entries(n).forEach(([a,l])=>{this.url.searchParams.append(a,`eq.${l}`)}),this}not(n,a,l){return this.url.searchParams.append(n,`not.${a}.${l}`),this}or(n,{foreignTable:a,referencedTable:l=a}={}){let u=l?`${l}.or`:"or";return this.url.searchParams.append(u,`(${n})`),this}filter(n,a,l){return this.url.searchParams.append(n,`${a}.${l}`),this}};e.default=o}),dt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ye()),s=class{constructor(o,{headers:n={},schema:a,fetch:l}){this.url=o,this.headers=new Headers(n),this.schema=a,this.fetch=l}select(o,n){let{head:a=!1,count:l}=n??{},u=a?"HEAD":"GET",i=!1,c=(o??"*").split("").map(h=>/\s/.test(h)&&!i?"":(h==='"'&&(i=!i),h)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:u,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(o,{count:n,defaultToNull:a=!0}={}){var l;let u="POST";if(n&&this.headers.append("Prefer",`count=${n}`),a||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let i=o.reduce((c,h)=>c.concat(Object.keys(h)),[]);if(i.length>0){let c=[...new Set(i)].map(h=>`"${h}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:u,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(o,{onConflict:n,ignoreDuplicates:a=!1,count:l,defaultToNull:u=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${a?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),l&&this.headers.append("Prefer",`count=${l}`),u||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let h=o.reduce((m,d)=>m.concat(Object.keys(d)),[]);if(h.length>0){let m=[...new Set(h)].map(d=>`"${d}"`);this.url.searchParams.set("columns",m.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(o,{count:n}={}){var a;let l="PATCH";return n&&this.headers.append("Prefer",`count=${n}`),new r.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}delete({count:o}={}){var n;let a="DELETE";return o&&this.headers.append("Prefer",`count=${o}`),new r.default({method:a,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};e.default=s}),kt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(dt()),s=t.__importDefault(ye()),o=class pt{constructor(a,{headers:l={},schema:u,fetch:i}={}){this.url=a,this.headers=new Headers(l),this.schemaName=u,this.fetch=i}from(a){let l=new URL(`${this.url}/${a}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new pt(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,l={},{head:u=!1,get:i=!1,count:c}={}){var h;let m,d=new URL(`${this.url}/rpc/${a}`),y;u||i?(m=u?"HEAD":"GET",Object.entries(l).filter(([g,v])=>v!==void 0).map(([g,v])=>[g,Array.isArray(v)?`{${v.join(",")}}`:`${v}`]).forEach(([g,v])=>{d.searchParams.append(g,v)})):(m="POST",y=l);let E=new Headers(this.headers);return c&&E.set("Prefer",`count=${c}`),new s.default({method:m,url:d,headers:E,schema:this.schemaName,body:y,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};e.default=o}),Bt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0}),e.PostgrestError=e.PostgrestBuilder=e.PostgrestTransformBuilder=e.PostgrestFilterBuilder=e.PostgrestQueryBuilder=e.PostgrestClient=void 0;var t=(W(),q(M)),r=t.__importDefault(kt());e.PostgrestClient=r.default;var s=t.__importDefault(dt());e.PostgrestQueryBuilder=s.default;var o=t.__importDefault(ye());e.PostgrestFilterBuilder=o.default;var n=t.__importDefault(ht());e.PostgrestTransformBuilder=n.default;var a=t.__importDefault(ct());e.PostgrestBuilder=a.default;var l=t.__importDefault(ut());e.PostgrestError=l.default,e.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:o.default,PostgrestTransformBuilder:n.default,PostgrestBuilder:a.default,PostgrestError:l.default}});p();p();p();p();p();p();var Ft=Object.defineProperty,qt=Object.defineProperties,Wt=Object.getOwnPropertyDescriptors,Oe=Object.getOwnPropertySymbols,Gt=Object.prototype.hasOwnProperty,zt=Object.prototype.propertyIsEnumerable,Te=(e,t,r)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,L=(e,t)=>{for(var r in t||(t={}))Gt.call(t,r)&&Te(e,r,t[r]);if(Oe)for(var r of Oe(t))zt.call(t,r)&&Te(e,r,t[r]);return e},N=(e,t)=>qt(e,Wt(t)),Vt=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r}},Yt=async(e,t)=>{var r,s,o,n,a,l;let u=t||{},i={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:u,hooks:i};for(let c of t?.plugins||[]){if(c.init){let h=await((r=c.init)==null?void 0:r.call(c,e.toString(),t));u=h.options||u,e=h.url}i.onRequest.push((s=c.hooks)==null?void 0:s.onRequest),i.onResponse.push((o=c.hooks)==null?void 0:o.onResponse),i.onSuccess.push((n=c.hooks)==null?void 0:n.onSuccess),i.onError.push((a=c.hooks)==null?void 0:a.onError),i.onRetry.push((l=c.hooks)==null?void 0:l.onRetry)}return{url:e,options:u,hooks:i}},Se=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},Kt=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function Jt(e){if(typeof e=="number")return new Se({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new Se(e);case"exponential":return new Kt(e);default:throw new Error("Invalid retry strategy")}}var Xt=async e=>{let t={},r=async s=>typeof s=="function"?await s():s;if(e?.auth){if(e.auth.type==="Bearer"){let s=await r(e.auth.token);if(!s)return t;t.authorization=`Bearer ${s}`}else if(e.auth.type==="Basic"){let s=r(e.auth.username),o=r(e.auth.password);if(!s||!o)return t;t.authorization=`Basic ${btoa(`${s}:${o}`)}`}else if(e.auth.type==="Custom"){let s=r(e.auth.value);if(!s)return t;t.authorization=`${r(e.auth.prefix)} ${s}`}}return t},Qt=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Zt(e){let t=e.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let s=t.split(";").shift()||"";return Qt.test(s)?"json":r.has(s)||s.startsWith("text/")?"text":"blob"}function er(e){try{return JSON.parse(e),!0}catch{return!1}}function ft(e){if(e===void 0)return!1;let t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function Pe(e){try{return JSON.parse(e)}catch{return e}}function Re(e){return typeof e=="function"}function tr(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&Re(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&Re(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function rr(e){let t=new Headers(e?.headers),r=await Xt(e);for(let[s,o]of Object.entries(r||{}))t.set(s,o);if(!t.has("content-type")){let s=sr(e?.body);s&&t.set("content-type",s)}return t}function sr(e){return ft(e)?"application/json":null}function nr(e){if(!e?.body)return null;let t=new Headers(e?.headers);if(ft(e.body)&&!t.has("content-type")){for(let[r,s]of Object.entries(e?.body))s instanceof Date&&(e.body[r]=s.toISOString());return JSON.stringify(e.body)}return e.body}function or(e,t){var r;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){let s=(r=e.split("@")[1])==null?void 0:r.split("/")[0];return yt.includes(s)?s.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function ar(e,t){let r;return!e?.signal&&e?.timeout&&(r=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}var ir=class mt extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,mt.prototype)}};async function te(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new ir(r.issues);return r.value}var yt=["get","post","put","patch","delete"],lr=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,r){var s,o,n,a;let l=((o=(s=e.plugins)==null?void 0:s.find(u=>{var i;return(i=u.schema)!=null&&i.config?t.startsWith(u.schema.config.baseURL||"")||t.startsWith(u.schema.config.prefix||""):!1}))==null?void 0:o.schema)||e.schema;if(l){let u=t;(n=l.config)!=null&&n.prefix&&u.startsWith(l.config.prefix)&&(u=u.replace(l.config.prefix,""),l.config.baseURL&&(t=t.replace(l.config.prefix,l.config.baseURL))),(a=l.config)!=null&&a.baseURL&&u.startsWith(l.config.baseURL)&&(u=u.replace(l.config.baseURL,""));let i=l.schema[u];if(i){let c=N(L({},r),{method:i.method,output:i.output});return r?.disableValidation||(c=N(L({},c),{body:i.input?await te(i.input,r?.body):r?.body,params:i.params?await te(i.params,r?.params):r?.params,query:i.query?await te(i.query,r?.query):r?.query})),{url:t,options:c}}}return{url:t,options:r}}}),ur=e=>{async function t(r,s){let o=N(L(L({},e),s),{plugins:[...e?.plugins||[],lr(e||{})]});if(e?.catchAllError)try{return await de(r,o)}catch(n){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:n}}}return await de(r,o)}return t};function cr(e,t){let{baseURL:r,params:s,query:o}=t||{query:{},params:{},baseURL:""},n=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let c=e.toString().split("@")[1].split("/")[0];yt.includes(c)&&(e=e.replace(`@${c}/`,"/"))}n.endsWith("/")||(n+="/");let[a,l]=e.replace(n,"").split("?"),u=new URLSearchParams(l);for(let[c,h]of Object.entries(o||{}))h!=null&&u.set(c,String(h));if(s)if(Array.isArray(s)){let c=a.split("/").filter(h=>h.startsWith(":"));for(let[h,m]of c.entries()){let d=s[h];a=a.replace(m,d)}}else for(let[c,h]of Object.entries(s))a=a.replace(`:${c}`,String(h));a=a.split("/").map(encodeURIComponent).join("/"),a.startsWith("/")&&(a=a.slice(1));let i=u.toString();return i=i.length>0?`?${i}`.replace(/\+/g,"%20"):"",n.startsWith("http")?new URL(`${a}${i}`,n):`${n}${a}${i}`}var de=async(e,t)=>{var r,s,o,n,a,l,u,i;let{hooks:c,url:h,options:m}=await Yt(e,t),d=tr(m),y=new AbortController,E=(r=m.signal)!=null?r:y.signal,g=cr(h,m),v=nr(m),S=await rr(m),P=or(h,m),f=N(L({},m),{url:g,headers:S,body:v,method:P,signal:E});for(let T of c.onRequest)if(T){let _=await T(f);_ instanceof Object&&(f=_)}("pipeTo"in f&&typeof f.pipeTo=="function"||typeof((s=t?.body)==null?void 0:s.pipe)=="function")&&("duplex"in f||(f.duplex="half"));let{clearTimeout:j}=ar(m,y),b=await d(f.url,f);j();let be={response:b,request:f};for(let T of c.onResponse)if(T){let _=await T(N(L({},be),{response:(o=t?.hookOptions)!=null&&o.cloneResponse?b.clone():b}));_ instanceof Response?b=_:_ instanceof Object&&(b=_.response)}if(b.ok){if(f.method==="HEAD")return{data:"",error:null};let T=Zt(b),_={data:"",response:b,request:f};if(T==="json"||T==="text"){let H=await b.text(),k=await((n=f.jsonParser)!=null?n:Pe)(H);_.data=k}else _.data=await b[T]();f?.output&&f.output&&!f.disableValidation&&(_.data=await te(f.output,_.data));for(let H of c.onSuccess)H&&await H(N(L({},_),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?b.clone():b}));return t?.throw?_.data:{data:_.data,error:null}}let Nt=(l=t?.jsonParser)!=null?l:Pe,J=await b.text(),_e=er(J),ue=_e?await Nt(J):null,xt={response:b,responseText:J,request:f,error:N(L({},ue),{status:b.status,statusText:b.statusText})};for(let T of c.onError)T&&await T(N(L({},xt),{response:(u=t?.hookOptions)!=null&&u.cloneResponse?b.clone():b}));if(t?.retry){let T=Jt(t.retry),_=(i=t.retryAttempt)!=null?i:0;if(await T.shouldAttemptRetry(_,b)){for(let k of c.onRetry)k&&await k(be);let H=T.getDelay(_);return await new Promise(k=>setTimeout(k,H)),await de(e,N(L({},t),{retryAttempt:_+1}))}}if(t?.throw)throw new Vt(b.status,b.statusText,_e?ue:J);return{data:null,error:N(L({},ue),{status:b.status,statusText:b.statusText})}};p();p();var re=Object.create(null),G=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?re:globalThis),A=new Proxy(re,{get(e,t){return G()[t]??re[t]},has(e,t){let r=G();return t in r||t in re},set(e,t,r){let s=G(!0);return s[t]=r,!0},deleteProperty(e,t){if(!t)return!1;let r=G(!0);return delete r[t],!0},ownKeys(){let e=G(!0);return Object.keys(e)}}),ns=typeof process<"u"&&process.env&&process.env.NODE_ENV||"";function w(e,t){return typeof process<"u"&&process.env?process.env[e]??t:typeof Deno<"u"?Deno.env.get(e)??t:typeof Bun<"u"?Bun.env[e]??t:t}var os=Object.freeze({get BETTER_AUTH_SECRET(){return w("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return w("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return w("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return w("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return w("NODE_ENV","development")},get PACKAGE_VERSION(){return w("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return w("BETTER_AUTH_TELEMETRY_ENDPOINT","https://telemetry.better-auth.com/v1/track")}}),z=1,O=4,x=8,R=24,Ae={eterm:O,cons25:O,console:O,cygwin:O,dtterm:O,gnome:O,hurd:O,jfbterm:O,konsole:O,kterm:O,mlterm:O,mosh:R,putty:O,st:O,"rxvt-unicode-24bit":R,terminator:R,"xterm-kitty":R},hr=new Map(Object.entries({APPVEYOR:x,BUILDKITE:x,CIRCLECI:R,DRONE:x,GITEA_ACTIONS:R,GITHUB_ACTIONS:R,GITLAB_CI:x,TRAVIS:x})),dr=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function pr(){if(w("FORCE_COLOR")!==void 0)switch(w("FORCE_COLOR")){case"":case"1":case"true":return O;case"2":return x;case"3":return R;default:return z}if(w("NODE_DISABLE_COLORS")!==void 0&&w("NODE_DISABLE_COLORS")!==""||w("NO_COLOR")!==void 0&&w("NO_COLOR")!==""||w("TERM")==="dumb")return z;if(w("TMUX"))return R;if("TF_BUILD"in A&&"AGENT_NAME"in A)return O;if("CI"in A){for(let{0:e,1:t}of hr)if(e in A)return t;return w("CI_NAME")==="codeship"?x:z}if("TEAMCITY_VERSION"in A)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(w("TEAMCITY_VERSION"))!==null?O:z;switch(w("TERM_PROGRAM")){case"iTerm.app":return!w("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(w("TERM_PROGRAM_VERSION"))!==null?x:R;case"HyperTerm":case"MacTerm":return R;case"Apple_Terminal":return x}if(w("COLORTERM")==="truecolor"||w("COLORTERM")==="24bit")return R;if(w("TERM")){if(/truecolor/.exec(w("TERM"))!==null)return R;if(/^xterm-256/.exec(w("TERM"))!==null)return x;let e=w("TERM").toLowerCase();if(Ae[e])return Ae[e];if(dr.some(t=>t.exec(e)!==null))return O}return w("COLORTERM")?O:z}var $={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",undim:"\x1B[22m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",fg:{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},bg:{black:"\x1B[40m",red:"\x1B[41m",green:"\x1B[42m",yellow:"\x1B[43m",blue:"\x1B[44m",magenta:"\x1B[45m",cyan:"\x1B[46m",white:"\x1B[47m"}},pe=["info","success","warn","error","debug"];function fr(e,t){return pe.indexOf(t)<=pe.indexOf(e)}var mr={info:$.fg.blue,success:$.fg.green,warn:$.fg.yellow,error:$.fg.red,debug:$.fg.magenta},yr=(e,t,r)=>{let s=new Date().toISOString();return r?`${$.dim}${s}${$.reset} ${mr[e]}${e.toUpperCase()}${$.reset} ${$.bright}[Better Auth]:${$.reset} ${t}`:`${s} ${e.toUpperCase()} [Better Auth]: ${t}`},gr=e=>{let t=e?.disabled!==!0,r=e?.level??"error",s=e?.disableColors!==void 0?!e.disableColors:pr()!==1,o=(n,a,l=[])=>{if(!t||!fr(r,n))return;let u=yr(n,a,s);if(!e||typeof e.log!="function"){n==="error"?console.error(u,...l):n==="warn"?console.warn(u,...l):console.log(u,...l);return}e.log(n==="success"?"info":n,a,...l)};return{...Object.fromEntries(pe.map(n=>[n,(...[a,...l])=>o(n,a,l)])),get level(){return r}}},as=gr();p();p();var ge=class extends Error{constructor(e,t){super(e),this.name="BetterAuthError",this.message=e,this.cause=t,this.stack=""}};function vr(e){try{return(new URL(e).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new ge(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function V(e,t="/api/auth"){if(vr(e))return e;let r=e.replace(/\/+$/,"");return!t||t==="/"?r:(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`)}function wr(e,t,r,s){if(e)return V(e,t);if(s!==!1){let a=A.BETTER_AUTH_URL||A.NEXT_PUBLIC_BETTER_AUTH_URL||A.PUBLIC_BETTER_AUTH_URL||A.NUXT_PUBLIC_BETTER_AUTH_URL||A.NUXT_PUBLIC_AUTH_URL||(A.BASE_URL!=="/"?A.BASE_URL:void 0);if(a)return V(a,t)}let o=r?.headers.get("x-forwarded-host"),n=r?.headers.get("x-forwarded-proto");if(o&&n)return V(`${n}://${o}`,t);if(r){let a=Er(r.url);if(!a)throw new ge("Could not get origin from request. Please provide a valid base URL.");return V(a,t)}if(typeof window<"u"&&window.location)return V(window.location.origin,t)}function Er(e){try{return new URL(e).origin}catch{return null}}p();p();p();var fe=Symbol("clean"),I=[],C=0,X=4,br=0,gt=e=>{let t=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},lc:0,listen(s){return r.lc=t.push(s),()=>{for(let n=C+X;n<I.length;)I[n]===s?I.splice(n,X):n+=X;let o=t.indexOf(s);~o&&(t.splice(o,1),--r.lc||r.off())}},notify(s,o){br++;let n=!I.length;for(let a of t)I.push(a,r.value,s,o);if(n){for(C=0;C<I.length;C+=X)I[C](I[C+1],I[C+2],I[C+3]);I.length=0}},off(){},set(s){let o=r.value;o!==s&&(r.value=s,r.notify(o))},subscribe(s){let o=r.listen(s);return s(r.value),o},value:e};return process.env.NODE_ENV!=="production"&&(r[fe]=()=>{t=[],r.lc=0,r.off()}),r};p();var _r=5,B=6,Q=10,Or=(e,t,r,s)=>(e.events=e.events||{},e.events[r+Q]||(e.events[r+Q]=s(o=>{e.events[r].reduceRight((n,a)=>(a(n),n),{shared:{},...o})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let o=e.events[r],n=o.indexOf(t);o.splice(n,1),o.length||(delete e.events[r],e.events[r+Q](),delete e.events[r+Q])}),Tr=1e3,Sr=(e,t)=>Or(e,r=>{let s=t(r);s&&e.events[B].push(s)},_r,r=>{let s=e.listen;e.listen=(...n)=>(!e.lc&&!e.active&&(e.active=!0,r()),s(...n));let o=e.off;if(e.events[B]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let n of e.events[B])n();e.events[B]=[]}},Tr)},process.env.NODE_ENV!=="production"){let n=e[fe];e[fe]=()=>{for(let a of e.events[B])a();e.events[B]=[],e.active=!1,n()}}return()=>{e.listen=s,e.off=o}});p();var Pr=typeof window>"u",Rr=(e,t,r,s)=>{let o=gt({data:null,error:null,isPending:!0,isRefetching:!1,refetch:l=>n(l)}),n=l=>{let u=typeof s=="function"?s({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):s;r(t,{...u,query:{...u?.query,...l?.query},async onSuccess(i){o.set({data:i.data,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await u?.onSuccess?.(i)},async onError(i){let{request:c}=i,h=typeof c.retry=="number"?c.retry:c.retry?.attempts,m=c.retryAttempt||0;h&&m<h||(o.set({error:i.error,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await u?.onError?.(i))},async onRequest(i){let c=o.get();o.set({isPending:c.data===null,data:c.data,error:null,isRefetching:!0,refetch:o.value.refetch}),await u?.onRequest?.(i)}}).catch(i=>{o.set({error:i,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch})})};e=Array.isArray(e)?e:[e];let a=!1;for(let l of e)l.subscribe(()=>{Pr||(a?n():Sr(o,()=>{let u=setTimeout(()=>{a||(n(),a=!0)},0);return()=>{o.off(),l.off(),clearTimeout(u)}}))});return o};p();var Ar={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},Ir=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,Ie={true:!0,false:!1,null:null,undefined:void 0,nan:Number.NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},Lr=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Nr(e){return e instanceof Date&&!isNaN(e.getTime())}function xr(e){let t=Lr.exec(e);if(!t)return null;let[,r,s,o,n,a,l,u,i,c,h]=t,m=new Date(Date.UTC(parseInt(r,10),parseInt(s,10)-1,parseInt(o,10),parseInt(n,10),parseInt(a,10),parseInt(l,10),u?parseInt(u.padEnd(3,"0"),10):0));if(i){let d=(parseInt(c,10)*60+parseInt(h,10))*(i==="+"?-1:1);m.setUTCMinutes(m.getUTCMinutes()+d)}return Nr(m)?m:null}function $r(e,t={}){let{strict:r=!1,warnings:s=!1,reviver:o,parseDates:n=!0}=t;if(typeof e!="string")return e;let a=e.trim();if(a.length>0&&a[0]==='"'&&a.endsWith('"')&&!a.slice(1,-1).includes('"'))return a.slice(1,-1);let l=a.toLowerCase();if(l.length<=9&&l in Ie)return Ie[l];if(!Ir.test(a)){if(r)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(Ar).some(([u,i])=>{let c=i.test(a);return c&&s&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${u} pattern`),c})&&r)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(a,(u,i)=>{if(u==="__proto__"||u==="constructor"&&i&&typeof i=="object"&&"prototype"in i){s&&console.warn(`[better-json] Dropping "${u}" key to prevent prototype pollution`);return}if(n&&typeof i=="string"){let c=xr(i);if(c)return c}return o?o(u,i):i})}catch(u){if(r)throw u;return e}}function Cr(e,t={strict:!0}){return $r(e,t)}var jr={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function Ur(e){let t=gt(!1);return{session:Rr(t,"/get-session",e,{method:"GET"}),$sessionSignal:t}}var Dr=(e,t)=>{let r="credentials"in Request.prototype,s=wr(e?.baseURL,e?.basePath,void 0,t)??"/api/auth",o=e?.plugins?.flatMap(f=>f.fetchPlugins).filter(f=>f!==void 0)||[],n={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:a,onError:l,onRequest:u,onResponse:i,...c}=e?.fetchOptions||{},h=ur({baseURL:s,...r?{credentials:"include"}:{},method:"GET",jsonParser(f){return f?Cr(f,{strict:!1}):null},customFetchImpl:fetch,...c,plugins:[n,...c.plugins||[],...e?.disableDefaultFetchPlugins?[]:[jr],...o]}),{$sessionSignal:m,session:d}=Ur(h),y=e?.plugins||[],E={},g={$sessionSignal:m,session:d},v={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},S=[{signal:"$sessionSignal",matcher(f){return f==="/sign-out"||f==="/update-user"||f.startsWith("/sign-in")||f.startsWith("/sign-up")||f==="/delete-user"||f==="/verify-email"}}];for(let f of y)f.getAtoms&&Object.assign(g,f.getAtoms?.(h)),f.pathMethods&&Object.assign(v,f.pathMethods),f.atomListeners&&S.push(...f.atomListeners);let P={notify:f=>{g[f].set(!g[f].get())},listen:(f,j)=>{g[f].subscribe(j)},atoms:g};for(let f of y)f.getActions&&Object.assign(E,f.getActions?.(h,P,e));return{get baseURL(){return s},pluginsActions:E,pluginsAtoms:g,pluginPathMethods:v,atomListeners:S,$fetch:h,$store:P}};function Mr(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function Hr(e,t,r){let s=t[e],{fetchOptions:o,query:n,...a}=r||{};return s||(o?.method?o.method:a&&Object.keys(a).length>0?"POST":"GET")}function kr(e,t,r,s,o){function n(a=[]){return new Proxy(function(){},{get(l,u){if(typeof u!="string"||u==="then"||u==="catch"||u==="finally")return;let i=[...a,u],c=e;for(let h of i)if(c&&typeof c=="object"&&h in c)c=c[h];else{c=void 0;break}return typeof c=="function"||Mr(c)?c:n(i)},apply:async(l,u,i)=>{let c="/"+a.map(S=>S.replace(/[A-Z]/g,P=>`-${P.toLowerCase()}`)).join("/"),h=i[0]||{},m=i[1]||{},{query:d,fetchOptions:y,...E}=h,g={...m,...y},v=Hr(c,r,h);return await t(c,{...g,body:v==="GET"?void 0:{...E,...g?.body||{}},query:d||g?.query,method:v,async onSuccess(S){if(await g?.onSuccess?.(S),!o)return;let P=o.filter(f=>f.matcher(c));if(P.length)for(let f of P){let j=s[f.signal];if(!j)return;let b=j.get();setTimeout(()=>{j.set(!b)},10)}}})}})}return n()}p();function Br(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fr(e){let{pluginPathMethods:t,pluginsActions:r,pluginsAtoms:s,$fetch:o,atomListeners:n,$store:a}=Dr(e),l={};for(let[i,c]of Object.entries(s))l[`use${Br(i)}`]=c;let u={...r,...l,$fetch:o,$store:a};return kr(u,o,t,s,n)}p();p();p();function qr(e){return{authorize(t,r="AND"){let s=!1;for(let[o,n]of Object.entries(t)){let a=e[o];if(!a)return{success:!1,error:`You are not allowed to access resource: ${o}`};if(Array.isArray(n))s=n.every(l=>a.includes(l));else if(typeof n=="object"){let l=n;l.connector==="OR"?s=l.actions.some(u=>a.includes(u)):s=l.actions.every(u=>a.includes(u))}else throw new ge("Invalid access control request");if(s&&r==="OR")return{success:s};if(!s&&r==="AND")return{success:!1,error:`unauthorized to access resource "${o}"`}}return s?{success:s}:{success:!1,error:"Not authorized"}},statements:e}}function vt(e){return{newRole(t){return qr(t)},statements:e}}var Wr={organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]},ve=vt(Wr),is=ve.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),ls=ve.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),us=ve.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]});p();p();p();p();p();p();p();p();p();p();p();var Gr=class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let t=new Error("Cancelling existing WebAuthn API call for new one");t.name="AbortError",this.controller.abort(t)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}},cs=new Gr;p();p();p();p();p();p();p();p();var zr={user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]},wt=vt(zr),hs=wt.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),ds=wt.newRole({user:[],session:[]});p();p();var Vr=()=>({id:"username",$InferServerPlugin:{}}),Yr=()=>({id:"phoneNumber",$InferServerPlugin:{},atomListeners:[{matcher(e){return e==="/phone-number/update"||e==="/phone-number/verify"},signal:"$sessionSignal"}]}),Kr=()=>({id:"better-auth-client",$InferServerPlugin:{}}),Jr="/auth",ce="nvwa_login_token",se="nvwa_current_jwt",he="nvwa_user_profile",Et=class{constructor(e,t,r){this.storage=r;let s=Fr({baseURL:e,basePath:Jr,plugins:[Vr(),Yr(),Kr()],fetchOptions:{customFetchImpl:t,auth:{type:"Bearer",token:async()=>{let o=await this.storage.get(se);if(console.log("jwt",o),o)return o;let n=await this.storage.get(ce);return console.log("loginToken",n),n}}}});this.authClient=s}async currentUser(){return await this.storage.get(he)}async getCurrentJwt(){return await this.storage.get(se)}async signUp(e){let t=await this.authClient.signUp.email({email:e.email??`${e.username}@nvwa.app`,name:e.name,username:e.username,displayUsername:e.displayUsername,password:e.password});this.handleLogin(t)}async sendPhoneNumberCode(e){await this.authClient.phoneNumber.sendOtp({phoneNumber:e})}async signInWithPhoneNumberCode(e,t){let r=await this.authClient.phoneNumber.verify({phoneNumber:e,code:t});this.handleLogin(r)}async signInWithPhoneNumber(e,t,r=!1){let s=await this.authClient.signIn.phoneNumber({phoneNumber:e,password:t,rememberMe:r});this.handleLogin(s)}async signInWithUsername(e,t){let r=await this.authClient.signIn.username({username:e,password:t});this.handleLogin(r)}async handleLogin(e){if(e.error)throw new Error(e.error.message);await this.storage.set(ce,e.data?.token),await this.storage.set(he,e.data?.user);let{data:t,error:r}=await this.authClient.token();if(r)throw new Error(r.message);await this.storage.set(se,t.token)}async signOut(){await this.storage.remove(ce),await this.storage.remove(he)}async updateUserPassword(e,t,r=!1){let s=await this.authClient.changePassword({currentPassword:e,newPassword:t,revokeOtherSessions:r});this.handleLogin(s)}};p();var bt=class{constructor(e){this.http=e}async invoke(e,t){return await(await this.http.fetch("/functions/"+e,{method:t.method||"POST",body:t.body,headers:t.headers})).json()}};p();p();p();var U=class _t{constructor(t){if(this.headerMap=new Map,t){if(t instanceof _t)t.forEach((r,s)=>this.set(s,r));else if(Array.isArray(t))for(let[r,s]of t)this.set(r,String(s));else if(typeof t=="object")for(let r of Object.keys(t))this.set(r,String(t[r]))}}append(t,r){let s=t.toLowerCase(),o=this.headerMap.get(s);this.headerMap.set(s,o?`${o}, ${r}`:r)}set(t,r){this.headerMap.set(t.toLowerCase(),String(r))}get(t){return this.headerMap.get(t.toLowerCase())??null}has(t){return this.headerMap.has(t.toLowerCase())}delete(t){this.headerMap.delete(t.toLowerCase())}forEach(t){for(let[r,s]of this.headerMap.entries())t(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}};p();p();var Ot=class{constructor(e,t){this.bodyData=e,this.status=t?.status??200,this.statusText=t?.statusText??"",this.headers=Xr(t?.headers),this.ok=this.status>=200&&this.status<300}async text(){return typeof this.bodyData=="string"?this.bodyData:this.bodyData==null?"":typeof this.bodyData=="object"?JSON.stringify(this.bodyData):String(this.bodyData)}async json(){if(typeof this.bodyData=="string")try{return JSON.parse(this.bodyData)}catch{}return this.bodyData}async arrayBuffer(){let e=await this.text();return new TextEncoder().encode(e).buffer}};function Xr(e){return e?new U(e):new U}p();p();var Tt=class{constructor(e,t,r){console.log("NvwaHttpClient constructor",e,t,r),this.storage=e,this.customFetch=t,this.handleUnauthorized=r}async fetch(e,t){return await this.customFetch(e,t)}async fetchWithAuth(e,t){let r=await this.storage.get(se),s=new U(t?.headers);r&&s.set("Authorization",`Bearer ${r}`);let o=await this.customFetch(e,{...t,headers:s});if(o.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return o}};p();var Qr="/storage",Zr=Qr+"/generateUploadUrl",St=class{constructor(e,t){this.baseUrl=e,this.http=t}async uploadFile(e){let t=await this.http.fetch(this.baseUrl+Zr,{method:"POST",body:{fileName:e.name||e.fileName,fileSize:e.size||e.fileSize,fileType:e.type||e.fileType}}),{url:r}=await t.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:e,headers:new U({"Content-Type":e.type||e.fileType||"application/octet-stream"})}),{url:o}=await s.json();return{url:o.split("?")[0]}}};p();p();p();var Le=Ht(Bt(),1),{PostgrestClient:es,PostgrestQueryBuilder:ps,PostgrestFilterBuilder:fs,PostgrestTransformBuilder:ms,PostgrestBuilder:ys,PostgrestError:gs}=Le.default||Le,ts="/entities",Pt=(e,t)=>new es(e+ts,{fetch:t.fetchWithAuth.bind(t)});p();var Rt=class{constructor(e,t){this.baseUrl=e,this.http=t}async execute(e,t){let r=`${this.baseUrl}/skill/${e}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:t?JSON.stringify(t):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};p();var At=class{constructor(){this.hoverOverlay=null,this.selectedOverlay=null,this.tooltip=null,this.hoverElement=null,this.selectedElement=null,this.hoverUpdateHandler=null,this.selectedUpdateHandler=null,this.createStyles()}createStyles(){if(document.getElementById("__nvwa-inspector-overlay-style"))return;let e=document.createElement("style");e.id="__nvwa-inspector-overlay-style",e.textContent=`
1
+ var $t=Object.create,ie=Object.defineProperty,Ct=Object.getOwnPropertyDescriptor,jt=Object.getOwnPropertyNames,Ut=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty,Ne=(e,t)=>()=>(e&&(t=e(e=0)),t),D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Mt=(e,t)=>{for(var r in t)ie(e,r,{get:t[r],enumerable:!0})},xe=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of jt(t))!Dt.call(e,o)&&o!==r&&ie(e,o,{get:()=>t[o],enumerable:!(s=Ct(t,o))||s.enumerable});return e},Ht=(e,t,r)=>(r=e!=null?$t(Ut(e)):{},xe(t||!e||!e.__esModule?ie(r,"default",{value:e,enumerable:!0}):r,e)),q=e=>xe(ie({},"__esModule",{value:!0}),e),p=Ne(()=>{"use strict"}),M={};Mt(M,{__addDisposableResource:()=>st,__assign:()=>Y,__asyncDelegator:()=>Ke,__asyncGenerator:()=>Ye,__asyncValues:()=>Je,__await:()=>F,__awaiter:()=>Fe,__classPrivateFieldGet:()=>et,__classPrivateFieldIn:()=>rt,__classPrivateFieldSet:()=>tt,__createBinding:()=>K,__decorate:()=>je,__disposeResources:()=>nt,__esDecorate:()=>De,__exportStar:()=>We,__extends:()=>$e,__generator:()=>qe,__importDefault:()=>Ze,__importStar:()=>Qe,__makeTemplateObject:()=>Xe,__metadata:()=>Be,__param:()=>Ue,__propKey:()=>He,__read:()=>me,__rest:()=>Ce,__rewriteRelativeImportExtension:()=>ot,__runInitializers:()=>Me,__setFunctionName:()=>ke,__spread:()=>Ge,__spreadArray:()=>Ve,__spreadArrays:()=>ze,__values:()=>ne,default:()=>lt});function $e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Z(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Ce(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(r[s[o]]=e[s[o]]);return r}function je(e,t,r,s){var o=arguments.length,n=o<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,r):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,t,r,s);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(n=(o<3?a(n):o>3?a(t,r,n):a(t,r))||n);return o>3&&n&&Object.defineProperty(t,r,n),n}function Ue(e,t){return function(r,s){t(r,s,e)}}function De(e,t,r,s,o,n){function a(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var l=s.kind,u=l==="getter"?"get":l==="setter"?"set":"value",i=!t&&e?s.static?e:e.prototype:null,c=t||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),h,m=!1,d=r.length-1;d>=0;d--){var y={};for(var E in s)y[E]=E==="access"?{}:s[E];for(var E in s.access)y.access[E]=s.access[E];y.addInitializer=function(v){if(m)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(v||null))};var g=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[u],y);if(l==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(h=a(g.get))&&(c.get=h),(h=a(g.set))&&(c.set=h),(h=a(g.init))&&o.unshift(h)}else(h=a(g))&&(l==="field"?o.unshift(h):c[u]=h)}i&&Object.defineProperty(i,s.name,c),m=!0}function Me(e,t,r){for(var s=arguments.length>2,o=0;o<t.length;o++)r=s?t[o].call(e,r):t[o].call(e);return s?r:void 0}function He(e){return typeof e=="symbol"?e:"".concat(e)}function ke(e,t,r){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function Be(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function Fe(e,t,r,s){function o(n){return n instanceof r?n:new r(function(a){a(n)})}return new(r||(r=Promise))(function(n,a){function l(c){try{i(s.next(c))}catch(h){a(h)}}function u(c){try{i(s.throw(c))}catch(h){a(h)}}function i(c){c.done?n(c.value):o(c.value).then(l,u)}i((s=s.apply(e,t||[])).next())})}function qe(e,t){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,o,n,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(i){return function(c){return u([i,c])}}function u(i){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(r=0)),r;)try{if(s=1,o&&(n=i[0]&2?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[i[0]&2,n.value]),i[0]){case 0:case 1:n=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,o=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){r.label=i[1];break}if(i[0]===6&&r.label<n[1]){r.label=n[1],n=i;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(i);break}n[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}catch(c){i=[6,c],o=0}finally{s=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function We(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&K(t,e,r)}function ne(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],s=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function me(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var s=r.call(e),o,n=[],a;try{for(;(t===void 0||t-- >0)&&!(o=s.next()).done;)n.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}return n}function Ge(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(me(arguments[t]));return e}function ze(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var s=Array(e),o=0,t=0;t<r;t++)for(var n=arguments[t],a=0,l=n.length;a<l;a++,o++)s[o]=n[a];return s}function Ve(e,t,r){if(r||arguments.length===2)for(var s=0,o=t.length,n;s<o;s++)(n||!(s in t))&&(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))}function F(e){return this instanceof F?(this.v=e,this):new F(e)}function Ye(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(e,t||[]),o,n=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(d){return function(y){return Promise.resolve(y).then(d,h)}}function l(d,y){s[d]&&(o[d]=function(E){return new Promise(function(g,v){n.push([d,E,g,v])>1||u(d,E)})},y&&(o[d]=y(o[d])))}function u(d,y){try{i(s[d](y))}catch(E){m(n[0][3],E)}}function i(d){d.value instanceof F?Promise.resolve(d.value.v).then(c,h):m(n[0][2],d)}function c(d){u("next",d)}function h(d){u("throw",d)}function m(d,y){d(y),n.shift(),n.length&&u(n[0][0],n[0][1])}}function Ke(e){var t,r;return t={},s("next"),s("throw",function(o){throw o}),s("return"),t[Symbol.iterator]=function(){return this},t;function s(o,n){t[o]=e[o]?function(a){return(r=!r)?{value:F(e[o](a)),done:!1}:n?n(a):a}:n}}function Je(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof ne=="function"?ne(e):e[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(n){r[n]=e[n]&&function(a){return new Promise(function(l,u){a=e[n](a),o(l,u,a.done,a.value)})}}function o(n,a,l,u){Promise.resolve(u).then(function(i){n({value:i,done:l})},a)}}function Xe(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Qe(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=ee(e),s=0;s<r.length;s++)r[s]!=="default"&&K(t,e,r[s]);return at(t,e),t}function Ze(e){return e&&e.__esModule?e:{default:e}}function et(e,t,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(e):s?s.value:t.get(e)}function tt(e,t,r,s,o){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r}function rt(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}function st(e,t,r){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var s,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=t[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=t[Symbol.dispose],r&&(o=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");o&&(s=function(){try{o.call(this)}catch(n){return Promise.reject(n)}}),e.stack.push({value:t,dispose:s,async:r})}else r&&e.stack.push({async:!0});return t}function nt(e){function t(n){e.error=e.hasError?new it(n,e.error,"An error was suppressed during disposal."):n,e.hasError=!0}var r,s=0;function o(){for(;r=e.stack.pop();)try{if(!r.async&&s===1)return s=0,e.stack.push(r),Promise.resolve().then(o);if(r.dispose){var n=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(n).then(o,function(a){return t(a),o()})}else s|=1}catch(a){t(a)}if(s===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return o()}function ot(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,o,n,a){return s?t?".jsx":".js":o&&(!n||!a)?r:o+n+"."+a.toLowerCase()+"js"}):e}var Z,Y,K,at,ee,it,lt,W=Ne(()=>{"use strict";p(),Z=function(e,t){return Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(r[o]=s[o])},Z(e,t)},Y=function(){return Y=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Y.apply(this,arguments)},K=Object.create?(function(e,t,r,s){s===void 0&&(s=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,o)}):(function(e,t,r,s){s===void 0&&(s=r),e[s]=t[r]}),at=Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t},ee=function(e){return ee=Object.getOwnPropertyNames||function(t){var r=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[r.length]=s);return r},ee(e)},it=typeof SuppressedError=="function"?SuppressedError:function(e,t,r){var s=new Error(r);return s.name="SuppressedError",s.error=e,s.suppressed=t,s},lt={__extends:$e,__assign:Y,__rest:Ce,__decorate:je,__param:Ue,__esDecorate:De,__runInitializers:Me,__propKey:He,__setFunctionName:ke,__metadata:Be,__awaiter:Fe,__generator:qe,__createBinding:K,__exportStar:We,__values:ne,__read:me,__spread:Ge,__spreadArrays:ze,__spreadArray:Ve,__await:F,__asyncGenerator:Ye,__asyncDelegator:Ke,__asyncValues:Je,__makeTemplateObject:Xe,__importStar:Qe,__importDefault:Ze,__classPrivateFieldGet:et,__classPrivateFieldSet:tt,__classPrivateFieldIn:rt,__addDisposableResource:st,__disposeResources:nt,__rewriteRelativeImportExtension:ot}}),ut=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};e.default=t}),ct=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ut()),s=class{constructor(o){var n,a;this.shouldThrowOnError=!1,this.method=o.method,this.url=o.url,this.headers=new Headers(o.headers),this.schema=o.schema,this.body=o.body,this.shouldThrowOnError=(n=o.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=o.signal,this.isMaybeSingle=(a=o.isMaybeSingle)!==null&&a!==void 0?a:!1,o.fetch?this.fetch=o.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,n){return this.headers=new Headers(this.headers),this.headers.set(o,n),this}then(o,n){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let a=this.fetch,l=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async u=>{var i,c,h,m;let d=null,y=null,E=null,g=u.status,v=u.statusText;if(u.ok){if(this.method!=="HEAD"){let f=await u.text();f===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text")?y=f:y=JSON.parse(f))}let S=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),P=(h=u.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");S&&P&&P.length>1&&(E=parseInt(P[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(y)&&(y.length>1?(d={code:"PGRST116",details:`Results contain ${y.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},y=null,E=null,g=406,v="Not Acceptable"):y.length===1?y=y[0]:y=null)}else{let S=await u.text();try{d=JSON.parse(S),Array.isArray(d)&&u.status===404&&(y=[],d=null,g=200,v="OK")}catch{u.status===404&&S===""?(g=204,v="No Content"):d={message:S}}if(d&&this.isMaybeSingle&&!((m=d?.details)===null||m===void 0)&&m.includes("0 rows")&&(d=null,g=200,v="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:y,count:E,status:g,statusText:v}});return this.shouldThrowOnError||(l=l.catch(u=>{var i,c,h;return{error:{message:`${(i=u?.name)!==null&&i!==void 0?i:"FetchError"}: ${u?.message}`,details:`${(c=u?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(h=u?.code)!==null&&h!==void 0?h:""}`},data:null,count:null,status:0,statusText:""}})),l.then(o,n)}returns(){return this}overrideTypes(){return this}};e.default=s}),ht=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ct()),s=class extends r.default{select(o){let n=!1,a=(o??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",a),this.headers.append("Prefer","return=representation"),this}order(o,{ascending:n=!0,nullsFirst:a,foreignTable:l,referencedTable:u=l}={}){let i=u?`${u}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${o}.${n?"asc":"desc"}${a===void 0?"":a?".nullsfirst":".nullslast"}`),this}limit(o,{foreignTable:n,referencedTable:a=n}={}){let l=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${o}`),this}range(o,n,{foreignTable:a,referencedTable:l=a}={}){let u=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(u,`${o}`),this.url.searchParams.set(i,`${n-o+1}`),this}abortSignal(o){return this.signal=o,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:o=!1,verbose:n=!1,settings:a=!1,buffers:l=!1,wal:u=!1,format:i="text"}={}){var c;let h=[o?"analyze":null,n?"verbose":null,a?"settings":null,l?"buffers":null,u?"wal":null].filter(Boolean).join("|"),m=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${m}"; options=${h};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(o){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${o}`),this}};e.default=s}),ye=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ht()),s=new RegExp("[,()]"),o=class extends r.default{eq(n,a){return this.url.searchParams.append(n,`eq.${a}`),this}neq(n,a){return this.url.searchParams.append(n,`neq.${a}`),this}gt(n,a){return this.url.searchParams.append(n,`gt.${a}`),this}gte(n,a){return this.url.searchParams.append(n,`gte.${a}`),this}lt(n,a){return this.url.searchParams.append(n,`lt.${a}`),this}lte(n,a){return this.url.searchParams.append(n,`lte.${a}`),this}like(n,a){return this.url.searchParams.append(n,`like.${a}`),this}likeAllOf(n,a){return this.url.searchParams.append(n,`like(all).{${a.join(",")}}`),this}likeAnyOf(n,a){return this.url.searchParams.append(n,`like(any).{${a.join(",")}}`),this}ilike(n,a){return this.url.searchParams.append(n,`ilike.${a}`),this}ilikeAllOf(n,a){return this.url.searchParams.append(n,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(n,a){return this.url.searchParams.append(n,`ilike(any).{${a.join(",")}}`),this}is(n,a){return this.url.searchParams.append(n,`is.${a}`),this}in(n,a){let l=Array.from(new Set(a)).map(u=>typeof u=="string"&&s.test(u)?`"${u}"`:`${u}`).join(",");return this.url.searchParams.append(n,`in.(${l})`),this}contains(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cs.{${a.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(a)}`),this}containedBy(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cd.{${a.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(a)}`),this}rangeGt(n,a){return this.url.searchParams.append(n,`sr.${a}`),this}rangeGte(n,a){return this.url.searchParams.append(n,`nxl.${a}`),this}rangeLt(n,a){return this.url.searchParams.append(n,`sl.${a}`),this}rangeLte(n,a){return this.url.searchParams.append(n,`nxr.${a}`),this}rangeAdjacent(n,a){return this.url.searchParams.append(n,`adj.${a}`),this}overlaps(n,a){return typeof a=="string"?this.url.searchParams.append(n,`ov.${a}`):this.url.searchParams.append(n,`ov.{${a.join(",")}}`),this}textSearch(n,a,{config:l,type:u}={}){let i="";u==="plain"?i="pl":u==="phrase"?i="ph":u==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(n,`${i}fts${c}.${a}`),this}match(n){return Object.entries(n).forEach(([a,l])=>{this.url.searchParams.append(a,`eq.${l}`)}),this}not(n,a,l){return this.url.searchParams.append(n,`not.${a}.${l}`),this}or(n,{foreignTable:a,referencedTable:l=a}={}){let u=l?`${l}.or`:"or";return this.url.searchParams.append(u,`(${n})`),this}filter(n,a,l){return this.url.searchParams.append(n,`${a}.${l}`),this}};e.default=o}),dt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(ye()),s=class{constructor(o,{headers:n={},schema:a,fetch:l}){this.url=o,this.headers=new Headers(n),this.schema=a,this.fetch=l}select(o,n){let{head:a=!1,count:l}=n??{},u=a?"HEAD":"GET",i=!1,c=(o??"*").split("").map(h=>/\s/.test(h)&&!i?"":(h==='"'&&(i=!i),h)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:u,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(o,{count:n,defaultToNull:a=!0}={}){var l;let u="POST";if(n&&this.headers.append("Prefer",`count=${n}`),a||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let i=o.reduce((c,h)=>c.concat(Object.keys(h)),[]);if(i.length>0){let c=[...new Set(i)].map(h=>`"${h}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:u,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(o,{onConflict:n,ignoreDuplicates:a=!1,count:l,defaultToNull:u=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${a?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),l&&this.headers.append("Prefer",`count=${l}`),u||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let h=o.reduce((m,d)=>m.concat(Object.keys(d)),[]);if(h.length>0){let m=[...new Set(h)].map(d=>`"${d}"`);this.url.searchParams.set("columns",m.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(o,{count:n}={}){var a;let l="PATCH";return n&&this.headers.append("Prefer",`count=${n}`),new r.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}delete({count:o}={}){var n;let a="DELETE";return o&&this.headers.append("Prefer",`count=${o}`),new r.default({method:a,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};e.default=s}),kt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0});var t=(W(),q(M)),r=t.__importDefault(dt()),s=t.__importDefault(ye()),o=class pt{constructor(a,{headers:l={},schema:u,fetch:i}={}){this.url=a,this.headers=new Headers(l),this.schemaName=u,this.fetch=i}from(a){let l=new URL(`${this.url}/${a}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new pt(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,l={},{head:u=!1,get:i=!1,count:c}={}){var h;let m,d=new URL(`${this.url}/rpc/${a}`),y;u||i?(m=u?"HEAD":"GET",Object.entries(l).filter(([g,v])=>v!==void 0).map(([g,v])=>[g,Array.isArray(v)?`{${v.join(",")}}`:`${v}`]).forEach(([g,v])=>{d.searchParams.append(g,v)})):(m="POST",y=l);let E=new Headers(this.headers);return c&&E.set("Prefer",`count=${c}`),new s.default({method:m,url:d,headers:E,schema:this.schemaName,body:y,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};e.default=o}),Bt=D(e=>{"use strict";p(),Object.defineProperty(e,"__esModule",{value:!0}),e.PostgrestError=e.PostgrestBuilder=e.PostgrestTransformBuilder=e.PostgrestFilterBuilder=e.PostgrestQueryBuilder=e.PostgrestClient=void 0;var t=(W(),q(M)),r=t.__importDefault(kt());e.PostgrestClient=r.default;var s=t.__importDefault(dt());e.PostgrestQueryBuilder=s.default;var o=t.__importDefault(ye());e.PostgrestFilterBuilder=o.default;var n=t.__importDefault(ht());e.PostgrestTransformBuilder=n.default;var a=t.__importDefault(ct());e.PostgrestBuilder=a.default;var l=t.__importDefault(ut());e.PostgrestError=l.default,e.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:o.default,PostgrestTransformBuilder:n.default,PostgrestBuilder:a.default,PostgrestError:l.default}});p();p();p();p();p();p();var Ft=Object.defineProperty,qt=Object.defineProperties,Wt=Object.getOwnPropertyDescriptors,Oe=Object.getOwnPropertySymbols,Gt=Object.prototype.hasOwnProperty,zt=Object.prototype.propertyIsEnumerable,Te=(e,t,r)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,L=(e,t)=>{for(var r in t||(t={}))Gt.call(t,r)&&Te(e,r,t[r]);if(Oe)for(var r of Oe(t))zt.call(t,r)&&Te(e,r,t[r]);return e},N=(e,t)=>qt(e,Wt(t)),Vt=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r}},Yt=async(e,t)=>{var r,s,o,n,a,l;let u=t||{},i={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:u,hooks:i};for(let c of t?.plugins||[]){if(c.init){let h=await((r=c.init)==null?void 0:r.call(c,e.toString(),t));u=h.options||u,e=h.url}i.onRequest.push((s=c.hooks)==null?void 0:s.onRequest),i.onResponse.push((o=c.hooks)==null?void 0:o.onResponse),i.onSuccess.push((n=c.hooks)==null?void 0:n.onSuccess),i.onError.push((a=c.hooks)==null?void 0:a.onError),i.onRetry.push((l=c.hooks)==null?void 0:l.onRetry)}return{url:e,options:u,hooks:i}},Se=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},Kt=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function Jt(e){if(typeof e=="number")return new Se({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new Se(e);case"exponential":return new Kt(e);default:throw new Error("Invalid retry strategy")}}var Xt=async e=>{let t={},r=async s=>typeof s=="function"?await s():s;if(e?.auth){if(e.auth.type==="Bearer"){let s=await r(e.auth.token);if(!s)return t;t.authorization=`Bearer ${s}`}else if(e.auth.type==="Basic"){let s=r(e.auth.username),o=r(e.auth.password);if(!s||!o)return t;t.authorization=`Basic ${btoa(`${s}:${o}`)}`}else if(e.auth.type==="Custom"){let s=r(e.auth.value);if(!s)return t;t.authorization=`${r(e.auth.prefix)} ${s}`}}return t},Qt=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Zt(e){let t=e.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let s=t.split(";").shift()||"";return Qt.test(s)?"json":r.has(s)||s.startsWith("text/")?"text":"blob"}function er(e){try{return JSON.parse(e),!0}catch{return!1}}function ft(e){if(e===void 0)return!1;let t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function Pe(e){try{return JSON.parse(e)}catch{return e}}function Re(e){return typeof e=="function"}function tr(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&Re(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&Re(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function rr(e){let t=new Headers(e?.headers),r=await Xt(e);for(let[s,o]of Object.entries(r||{}))t.set(s,o);if(!t.has("content-type")){let s=sr(e?.body);s&&t.set("content-type",s)}return t}function sr(e){return ft(e)?"application/json":null}function nr(e){if(!e?.body)return null;let t=new Headers(e?.headers);if(ft(e.body)&&!t.has("content-type")){for(let[r,s]of Object.entries(e?.body))s instanceof Date&&(e.body[r]=s.toISOString());return JSON.stringify(e.body)}return e.body}function or(e,t){var r;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){let s=(r=e.split("@")[1])==null?void 0:r.split("/")[0];return yt.includes(s)?s.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function ar(e,t){let r;return!e?.signal&&e?.timeout&&(r=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}var ir=class mt extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,mt.prototype)}};async function te(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new ir(r.issues);return r.value}var yt=["get","post","put","patch","delete"],lr=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,r){var s,o,n,a;let l=((o=(s=e.plugins)==null?void 0:s.find(u=>{var i;return(i=u.schema)!=null&&i.config?t.startsWith(u.schema.config.baseURL||"")||t.startsWith(u.schema.config.prefix||""):!1}))==null?void 0:o.schema)||e.schema;if(l){let u=t;(n=l.config)!=null&&n.prefix&&u.startsWith(l.config.prefix)&&(u=u.replace(l.config.prefix,""),l.config.baseURL&&(t=t.replace(l.config.prefix,l.config.baseURL))),(a=l.config)!=null&&a.baseURL&&u.startsWith(l.config.baseURL)&&(u=u.replace(l.config.baseURL,""));let i=l.schema[u];if(i){let c=N(L({},r),{method:i.method,output:i.output});return r?.disableValidation||(c=N(L({},c),{body:i.input?await te(i.input,r?.body):r?.body,params:i.params?await te(i.params,r?.params):r?.params,query:i.query?await te(i.query,r?.query):r?.query})),{url:t,options:c}}}return{url:t,options:r}}}),ur=e=>{async function t(r,s){let o=N(L(L({},e),s),{plugins:[...e?.plugins||[],lr(e||{})]});if(e?.catchAllError)try{return await de(r,o)}catch(n){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:n}}}return await de(r,o)}return t};function cr(e,t){let{baseURL:r,params:s,query:o}=t||{query:{},params:{},baseURL:""},n=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let c=e.toString().split("@")[1].split("/")[0];yt.includes(c)&&(e=e.replace(`@${c}/`,"/"))}n.endsWith("/")||(n+="/");let[a,l]=e.replace(n,"").split("?"),u=new URLSearchParams(l);for(let[c,h]of Object.entries(o||{}))h!=null&&u.set(c,String(h));if(s)if(Array.isArray(s)){let c=a.split("/").filter(h=>h.startsWith(":"));for(let[h,m]of c.entries()){let d=s[h];a=a.replace(m,d)}}else for(let[c,h]of Object.entries(s))a=a.replace(`:${c}`,String(h));a=a.split("/").map(encodeURIComponent).join("/"),a.startsWith("/")&&(a=a.slice(1));let i=u.toString();return i=i.length>0?`?${i}`.replace(/\+/g,"%20"):"",n.startsWith("http")?new URL(`${a}${i}`,n):`${n}${a}${i}`}var de=async(e,t)=>{var r,s,o,n,a,l,u,i;let{hooks:c,url:h,options:m}=await Yt(e,t),d=tr(m),y=new AbortController,E=(r=m.signal)!=null?r:y.signal,g=cr(h,m),v=nr(m),S=await rr(m),P=or(h,m),f=N(L({},m),{url:g,headers:S,body:v,method:P,signal:E});for(let T of c.onRequest)if(T){let _=await T(f);_ instanceof Object&&(f=_)}("pipeTo"in f&&typeof f.pipeTo=="function"||typeof((s=t?.body)==null?void 0:s.pipe)=="function")&&("duplex"in f||(f.duplex="half"));let{clearTimeout:j}=ar(m,y),b=await d(f.url,f);j();let be={response:b,request:f};for(let T of c.onResponse)if(T){let _=await T(N(L({},be),{response:(o=t?.hookOptions)!=null&&o.cloneResponse?b.clone():b}));_ instanceof Response?b=_:_ instanceof Object&&(b=_.response)}if(b.ok){if(f.method==="HEAD")return{data:"",error:null};let T=Zt(b),_={data:"",response:b,request:f};if(T==="json"||T==="text"){let H=await b.text(),k=await((n=f.jsonParser)!=null?n:Pe)(H);_.data=k}else _.data=await b[T]();f?.output&&f.output&&!f.disableValidation&&(_.data=await te(f.output,_.data));for(let H of c.onSuccess)H&&await H(N(L({},_),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?b.clone():b}));return t?.throw?_.data:{data:_.data,error:null}}let Nt=(l=t?.jsonParser)!=null?l:Pe,J=await b.text(),_e=er(J),ue=_e?await Nt(J):null,xt={response:b,responseText:J,request:f,error:N(L({},ue),{status:b.status,statusText:b.statusText})};for(let T of c.onError)T&&await T(N(L({},xt),{response:(u=t?.hookOptions)!=null&&u.cloneResponse?b.clone():b}));if(t?.retry){let T=Jt(t.retry),_=(i=t.retryAttempt)!=null?i:0;if(await T.shouldAttemptRetry(_,b)){for(let k of c.onRetry)k&&await k(be);let H=T.getDelay(_);return await new Promise(k=>setTimeout(k,H)),await de(e,N(L({},t),{retryAttempt:_+1}))}}if(t?.throw)throw new Vt(b.status,b.statusText,_e?ue:J);return{data:null,error:N(L({},ue),{status:b.status,statusText:b.statusText})}};p();p();var re=Object.create(null),G=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?re:globalThis),A=new Proxy(re,{get(e,t){return G()[t]??re[t]},has(e,t){let r=G();return t in r||t in re},set(e,t,r){let s=G(!0);return s[t]=r,!0},deleteProperty(e,t){if(!t)return!1;let r=G(!0);return delete r[t],!0},ownKeys(){let e=G(!0);return Object.keys(e)}}),ns=typeof process<"u"&&process.env&&process.env.NODE_ENV||"";function w(e,t){return typeof process<"u"&&process.env?process.env[e]??t:typeof Deno<"u"?Deno.env.get(e)??t:typeof Bun<"u"?Bun.env[e]??t:t}var os=Object.freeze({get BETTER_AUTH_SECRET(){return w("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return w("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return w("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return w("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return w("NODE_ENV","development")},get PACKAGE_VERSION(){return w("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return w("BETTER_AUTH_TELEMETRY_ENDPOINT","https://telemetry.better-auth.com/v1/track")}}),z=1,O=4,x=8,R=24,Ae={eterm:O,cons25:O,console:O,cygwin:O,dtterm:O,gnome:O,hurd:O,jfbterm:O,konsole:O,kterm:O,mlterm:O,mosh:R,putty:O,st:O,"rxvt-unicode-24bit":R,terminator:R,"xterm-kitty":R},hr=new Map(Object.entries({APPVEYOR:x,BUILDKITE:x,CIRCLECI:R,DRONE:x,GITEA_ACTIONS:R,GITHUB_ACTIONS:R,GITLAB_CI:x,TRAVIS:x})),dr=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function pr(){if(w("FORCE_COLOR")!==void 0)switch(w("FORCE_COLOR")){case"":case"1":case"true":return O;case"2":return x;case"3":return R;default:return z}if(w("NODE_DISABLE_COLORS")!==void 0&&w("NODE_DISABLE_COLORS")!==""||w("NO_COLOR")!==void 0&&w("NO_COLOR")!==""||w("TERM")==="dumb")return z;if(w("TMUX"))return R;if("TF_BUILD"in A&&"AGENT_NAME"in A)return O;if("CI"in A){for(let{0:e,1:t}of hr)if(e in A)return t;return w("CI_NAME")==="codeship"?x:z}if("TEAMCITY_VERSION"in A)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(w("TEAMCITY_VERSION"))!==null?O:z;switch(w("TERM_PROGRAM")){case"iTerm.app":return!w("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(w("TERM_PROGRAM_VERSION"))!==null?x:R;case"HyperTerm":case"MacTerm":return R;case"Apple_Terminal":return x}if(w("COLORTERM")==="truecolor"||w("COLORTERM")==="24bit")return R;if(w("TERM")){if(/truecolor/.exec(w("TERM"))!==null)return R;if(/^xterm-256/.exec(w("TERM"))!==null)return x;let e=w("TERM").toLowerCase();if(Ae[e])return Ae[e];if(dr.some(t=>t.exec(e)!==null))return O}return w("COLORTERM")?O:z}var $={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",undim:"\x1B[22m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",fg:{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},bg:{black:"\x1B[40m",red:"\x1B[41m",green:"\x1B[42m",yellow:"\x1B[43m",blue:"\x1B[44m",magenta:"\x1B[45m",cyan:"\x1B[46m",white:"\x1B[47m"}},pe=["info","success","warn","error","debug"];function fr(e,t){return pe.indexOf(t)<=pe.indexOf(e)}var mr={info:$.fg.blue,success:$.fg.green,warn:$.fg.yellow,error:$.fg.red,debug:$.fg.magenta},yr=(e,t,r)=>{let s=new Date().toISOString();return r?`${$.dim}${s}${$.reset} ${mr[e]}${e.toUpperCase()}${$.reset} ${$.bright}[Better Auth]:${$.reset} ${t}`:`${s} ${e.toUpperCase()} [Better Auth]: ${t}`},gr=e=>{let t=e?.disabled!==!0,r=e?.level??"error",s=e?.disableColors!==void 0?!e.disableColors:pr()!==1,o=(n,a,l=[])=>{if(!t||!fr(r,n))return;let u=yr(n,a,s);if(!e||typeof e.log!="function"){n==="error"?console.error(u,...l):n==="warn"?console.warn(u,...l):console.log(u,...l);return}e.log(n==="success"?"info":n,a,...l)};return{...Object.fromEntries(pe.map(n=>[n,(...[a,...l])=>o(n,a,l)])),get level(){return r}}},as=gr();p();p();var ge=class extends Error{constructor(e,t){super(e),this.name="BetterAuthError",this.message=e,this.cause=t,this.stack=""}};function vr(e){try{return(new URL(e).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new ge(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function V(e,t="/api/auth"){if(vr(e))return e;let r=e.replace(/\/+$/,"");return!t||t==="/"?r:(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`)}function wr(e,t,r,s){if(e)return V(e,t);if(s!==!1){let a=A.BETTER_AUTH_URL||A.NEXT_PUBLIC_BETTER_AUTH_URL||A.PUBLIC_BETTER_AUTH_URL||A.NUXT_PUBLIC_BETTER_AUTH_URL||A.NUXT_PUBLIC_AUTH_URL||(A.BASE_URL!=="/"?A.BASE_URL:void 0);if(a)return V(a,t)}let o=r?.headers.get("x-forwarded-host"),n=r?.headers.get("x-forwarded-proto");if(o&&n)return V(`${n}://${o}`,t);if(r){let a=Er(r.url);if(!a)throw new ge("Could not get origin from request. Please provide a valid base URL.");return V(a,t)}if(typeof window<"u"&&window.location)return V(window.location.origin,t)}function Er(e){try{return new URL(e).origin}catch{return null}}p();p();p();var fe=Symbol("clean"),I=[],C=0,X=4,br=0,gt=e=>{let t=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},lc:0,listen(s){return r.lc=t.push(s),()=>{for(let n=C+X;n<I.length;)I[n]===s?I.splice(n,X):n+=X;let o=t.indexOf(s);~o&&(t.splice(o,1),--r.lc||r.off())}},notify(s,o){br++;let n=!I.length;for(let a of t)I.push(a,r.value,s,o);if(n){for(C=0;C<I.length;C+=X)I[C](I[C+1],I[C+2],I[C+3]);I.length=0}},off(){},set(s){let o=r.value;o!==s&&(r.value=s,r.notify(o))},subscribe(s){let o=r.listen(s);return s(r.value),o},value:e};return process.env.NODE_ENV!=="production"&&(r[fe]=()=>{t=[],r.lc=0,r.off()}),r};p();var _r=5,B=6,Q=10,Or=(e,t,r,s)=>(e.events=e.events||{},e.events[r+Q]||(e.events[r+Q]=s(o=>{e.events[r].reduceRight((n,a)=>(a(n),n),{shared:{},...o})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let o=e.events[r],n=o.indexOf(t);o.splice(n,1),o.length||(delete e.events[r],e.events[r+Q](),delete e.events[r+Q])}),Tr=1e3,Sr=(e,t)=>Or(e,r=>{let s=t(r);s&&e.events[B].push(s)},_r,r=>{let s=e.listen;e.listen=(...n)=>(!e.lc&&!e.active&&(e.active=!0,r()),s(...n));let o=e.off;if(e.events[B]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let n of e.events[B])n();e.events[B]=[]}},Tr)},process.env.NODE_ENV!=="production"){let n=e[fe];e[fe]=()=>{for(let a of e.events[B])a();e.events[B]=[],e.active=!1,n()}}return()=>{e.listen=s,e.off=o}});p();var Pr=typeof window>"u",Rr=(e,t,r,s)=>{let o=gt({data:null,error:null,isPending:!0,isRefetching:!1,refetch:l=>n(l)}),n=l=>{let u=typeof s=="function"?s({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):s;r(t,{...u,query:{...u?.query,...l?.query},async onSuccess(i){o.set({data:i.data,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await u?.onSuccess?.(i)},async onError(i){let{request:c}=i,h=typeof c.retry=="number"?c.retry:c.retry?.attempts,m=c.retryAttempt||0;h&&m<h||(o.set({error:i.error,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await u?.onError?.(i))},async onRequest(i){let c=o.get();o.set({isPending:c.data===null,data:c.data,error:null,isRefetching:!0,refetch:o.value.refetch}),await u?.onRequest?.(i)}}).catch(i=>{o.set({error:i,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch})})};e=Array.isArray(e)?e:[e];let a=!1;for(let l of e)l.subscribe(()=>{Pr||(a?n():Sr(o,()=>{let u=setTimeout(()=>{a||(n(),a=!0)},0);return()=>{o.off(),l.off(),clearTimeout(u)}}))});return o};p();var Ar={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},Ir=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,Ie={true:!0,false:!1,null:null,undefined:void 0,nan:Number.NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},Lr=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Nr(e){return e instanceof Date&&!isNaN(e.getTime())}function xr(e){let t=Lr.exec(e);if(!t)return null;let[,r,s,o,n,a,l,u,i,c,h]=t,m=new Date(Date.UTC(parseInt(r,10),parseInt(s,10)-1,parseInt(o,10),parseInt(n,10),parseInt(a,10),parseInt(l,10),u?parseInt(u.padEnd(3,"0"),10):0));if(i){let d=(parseInt(c,10)*60+parseInt(h,10))*(i==="+"?-1:1);m.setUTCMinutes(m.getUTCMinutes()+d)}return Nr(m)?m:null}function $r(e,t={}){let{strict:r=!1,warnings:s=!1,reviver:o,parseDates:n=!0}=t;if(typeof e!="string")return e;let a=e.trim();if(a.length>0&&a[0]==='"'&&a.endsWith('"')&&!a.slice(1,-1).includes('"'))return a.slice(1,-1);let l=a.toLowerCase();if(l.length<=9&&l in Ie)return Ie[l];if(!Ir.test(a)){if(r)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(Ar).some(([u,i])=>{let c=i.test(a);return c&&s&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${u} pattern`),c})&&r)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(a,(u,i)=>{if(u==="__proto__"||u==="constructor"&&i&&typeof i=="object"&&"prototype"in i){s&&console.warn(`[better-json] Dropping "${u}" key to prevent prototype pollution`);return}if(n&&typeof i=="string"){let c=xr(i);if(c)return c}return o?o(u,i):i})}catch(u){if(r)throw u;return e}}function Cr(e,t={strict:!0}){return $r(e,t)}var jr={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function Ur(e){let t=gt(!1);return{session:Rr(t,"/get-session",e,{method:"GET"}),$sessionSignal:t}}var Dr=(e,t)=>{let r="credentials"in Request.prototype,s=wr(e?.baseURL,e?.basePath,void 0,t)??"/api/auth",o=e?.plugins?.flatMap(f=>f.fetchPlugins).filter(f=>f!==void 0)||[],n={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:a,onError:l,onRequest:u,onResponse:i,...c}=e?.fetchOptions||{},h=ur({baseURL:s,...r?{credentials:"include"}:{},method:"GET",jsonParser(f){return f?Cr(f,{strict:!1}):null},customFetchImpl:fetch,...c,plugins:[n,...c.plugins||[],...e?.disableDefaultFetchPlugins?[]:[jr],...o]}),{$sessionSignal:m,session:d}=Ur(h),y=e?.plugins||[],E={},g={$sessionSignal:m,session:d},v={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},S=[{signal:"$sessionSignal",matcher(f){return f==="/sign-out"||f==="/update-user"||f.startsWith("/sign-in")||f.startsWith("/sign-up")||f==="/delete-user"||f==="/verify-email"}}];for(let f of y)f.getAtoms&&Object.assign(g,f.getAtoms?.(h)),f.pathMethods&&Object.assign(v,f.pathMethods),f.atomListeners&&S.push(...f.atomListeners);let P={notify:f=>{g[f].set(!g[f].get())},listen:(f,j)=>{g[f].subscribe(j)},atoms:g};for(let f of y)f.getActions&&Object.assign(E,f.getActions?.(h,P,e));return{get baseURL(){return s},pluginsActions:E,pluginsAtoms:g,pluginPathMethods:v,atomListeners:S,$fetch:h,$store:P}};function Mr(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function Hr(e,t,r){let s=t[e],{fetchOptions:o,query:n,...a}=r||{};return s||(o?.method?o.method:a&&Object.keys(a).length>0?"POST":"GET")}function kr(e,t,r,s,o){function n(a=[]){return new Proxy(function(){},{get(l,u){if(typeof u!="string"||u==="then"||u==="catch"||u==="finally")return;let i=[...a,u],c=e;for(let h of i)if(c&&typeof c=="object"&&h in c)c=c[h];else{c=void 0;break}return typeof c=="function"||Mr(c)?c:n(i)},apply:async(l,u,i)=>{let c="/"+a.map(S=>S.replace(/[A-Z]/g,P=>`-${P.toLowerCase()}`)).join("/"),h=i[0]||{},m=i[1]||{},{query:d,fetchOptions:y,...E}=h,g={...m,...y},v=Hr(c,r,h);return await t(c,{...g,body:v==="GET"?void 0:{...E,...g?.body||{}},query:d||g?.query,method:v,async onSuccess(S){if(await g?.onSuccess?.(S),!o)return;let P=o.filter(f=>f.matcher(c));if(P.length)for(let f of P){let j=s[f.signal];if(!j)return;let b=j.get();setTimeout(()=>{j.set(!b)},10)}}})}})}return n()}p();function Br(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fr(e){let{pluginPathMethods:t,pluginsActions:r,pluginsAtoms:s,$fetch:o,atomListeners:n,$store:a}=Dr(e),l={};for(let[i,c]of Object.entries(s))l[`use${Br(i)}`]=c;let u={...r,...l,$fetch:o,$store:a};return kr(u,o,t,s,n)}p();p();p();function qr(e){return{authorize(t,r="AND"){let s=!1;for(let[o,n]of Object.entries(t)){let a=e[o];if(!a)return{success:!1,error:`You are not allowed to access resource: ${o}`};if(Array.isArray(n))s=n.every(l=>a.includes(l));else if(typeof n=="object"){let l=n;l.connector==="OR"?s=l.actions.some(u=>a.includes(u)):s=l.actions.every(u=>a.includes(u))}else throw new ge("Invalid access control request");if(s&&r==="OR")return{success:s};if(!s&&r==="AND")return{success:!1,error:`unauthorized to access resource "${o}"`}}return s?{success:s}:{success:!1,error:"Not authorized"}},statements:e}}function vt(e){return{newRole(t){return qr(t)},statements:e}}var Wr={organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]},ve=vt(Wr),is=ve.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),ls=ve.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),us=ve.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]});p();p();p();p();p();p();p();p();p();p();p();var Gr=class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let t=new Error("Cancelling existing WebAuthn API call for new one");t.name="AbortError",this.controller.abort(t)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}},cs=new Gr;p();p();p();p();p();p();p();p();var zr={user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]},wt=vt(zr),hs=wt.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),ds=wt.newRole({user:[],session:[]});p();p();var Vr=()=>({id:"username",$InferServerPlugin:{}}),Yr=()=>({id:"phoneNumber",$InferServerPlugin:{},atomListeners:[{matcher(e){return e==="/phone-number/update"||e==="/phone-number/verify"},signal:"$sessionSignal"}]}),Kr=()=>({id:"better-auth-client",$InferServerPlugin:{}}),Jr="/auth",ce="nvwa_login_token",se="nvwa_current_jwt",he="nvwa_user_profile",Et=class{constructor(e,t,r){this.storage=r;let s=Fr({baseURL:e,basePath:Jr,plugins:[Vr(),Yr(),Kr()],fetchOptions:{customFetchImpl:t,auth:{type:"Bearer",token:async()=>{let o=await this.storage.get(se);if(console.log("jwt",o),o)return o;let n=await this.storage.get(ce);return console.log("loginToken",n),n}}}});this.authClient=s}async currentUser(){return await this.storage.get(he)}async getCurrentJwt(){return await this.storage.get(se)}async signUp(e){let t=await this.authClient.signUp.email({email:e.email??`${e.username}@nvwa.app`,name:e.name,username:e.username,displayUsername:e.displayUsername,password:e.password});this.handleLogin(t)}async sendPhoneNumberCode(e){await this.authClient.phoneNumber.sendOtp({phoneNumber:e})}async signInWithPhoneNumberCode(e,t){let r=await this.authClient.phoneNumber.verify({phoneNumber:e,code:t});this.handleLogin(r)}async signInWithPhoneNumber(e,t,r=!1){let s=await this.authClient.signIn.phoneNumber({phoneNumber:e,password:t,rememberMe:r});this.handleLogin(s)}async signInWithUsername(e,t){let r=await this.authClient.signIn.username({username:e,password:t});this.handleLogin(r)}async handleLogin(e){if(e.error)throw new Error(e.error.message);await this.storage.set(ce,e.data?.token),await this.storage.set(he,e.data?.user);let{data:t,error:r}=await this.authClient.token();if(r)throw new Error(r.message);await this.storage.set(se,t.token)}async signOut(){await this.storage.remove(ce),await this.storage.remove(he)}async updateUserPassword(e,t,r=!1){let s=await this.authClient.changePassword({currentPassword:e,newPassword:t,revokeOtherSessions:r});this.handleLogin(s)}};p();var bt=class{constructor(e){this.http=e}async invoke(e,t){return await(await this.http.fetch("/functions/"+e,{method:t.method||"POST",body:t.body,headers:t.headers})).json()}};p();p();p();var U=class _t{constructor(t){if(this.headerMap=new Map,t){if(t instanceof _t)t.forEach((r,s)=>this.set(s,r));else if(Array.isArray(t))for(let[r,s]of t)this.set(r,String(s));else if(typeof t=="object")for(let r of Object.keys(t))this.set(r,String(t[r]))}}append(t,r){let s=t.toLowerCase(),o=this.headerMap.get(s);this.headerMap.set(s,o?`${o}, ${r}`:r)}set(t,r){this.headerMap.set(t.toLowerCase(),String(r))}get(t){return this.headerMap.get(t.toLowerCase())??null}has(t){return this.headerMap.has(t.toLowerCase())}delete(t){this.headerMap.delete(t.toLowerCase())}forEach(t){for(let[r,s]of this.headerMap.entries())t(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}};p();p();var Ot=class{constructor(e,t){this.bodyData=e,this.status=t?.status??200,this.statusText=t?.statusText??"",this.headers=Xr(t?.headers),this.ok=this.status>=200&&this.status<300}async text(){return typeof this.bodyData=="string"?this.bodyData:this.bodyData==null?"":typeof this.bodyData=="object"?JSON.stringify(this.bodyData):String(this.bodyData)}async json(){if(typeof this.bodyData=="string")try{return JSON.parse(this.bodyData)}catch{}return this.bodyData}async arrayBuffer(){let e=await this.text();return new TextEncoder().encode(e).buffer}};function Xr(e){return e?new U(e):new U}p();p();var Tt=class{constructor(e,t,r){console.log("NvwaHttpClient constructor",e,t,r),this.storage=e,this.customFetch=t,this.handleUnauthorized=r}async fetch(e,t){return await this.customFetch(e,t)}async fetchWithAuth(e,t){let r=await this.storage.get(se),s=new U(t?.headers);r&&s.set("Authorization",`Bearer ${r}`);let o=t?.method||"GET";if((o==="POST"||o==="PUT"||o==="PATCH")&&t?.body){let a=s.get("Content-Type");(!a||a.includes("text/plain"))&&s.set("Content-Type","application/json")}let n=await this.customFetch(e,{...t,headers:s});if(n.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return n}};p();var Qr="/storage",Zr=Qr+"/generateUploadUrl",St=class{constructor(e,t){this.baseUrl=e,this.http=t}async uploadFile(e){let t=await this.http.fetch(this.baseUrl+Zr,{method:"POST",body:{fileName:e.name||e.fileName,fileSize:e.size||e.fileSize,fileType:e.type||e.fileType}}),{url:r}=await t.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:e,headers:new U({"Content-Type":e.type||e.fileType||"application/octet-stream"})}),{url:o}=await s.json();return{url:o.split("?")[0]}}};p();p();p();var Le=Ht(Bt(),1),{PostgrestClient:es,PostgrestQueryBuilder:ps,PostgrestFilterBuilder:fs,PostgrestTransformBuilder:ms,PostgrestBuilder:ys,PostgrestError:gs}=Le.default||Le,ts="/entities",Pt=(e,t)=>new es(e+ts,{fetch:t.fetchWithAuth.bind(t)});p();var Rt=class{constructor(e,t){this.baseUrl=e,this.http=t}async execute(e,t){let r=`${this.baseUrl}/skill/${e}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:t?JSON.stringify(t):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};p();var At=class{constructor(){this.hoverOverlay=null,this.selectedOverlay=null,this.tooltip=null,this.hoverElement=null,this.selectedElement=null,this.hoverUpdateHandler=null,this.selectedUpdateHandler=null,this.createStyles()}createStyles(){if(document.getElementById("__nvwa-inspector-overlay-style"))return;let e=document.createElement("style");e.id="__nvwa-inspector-overlay-style",e.textContent=`
2
2
  .__nvwa-inspector-overlay {
3
3
  position: absolute;
4
4
  pointer-events: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nvwa-app/sdk-web",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "NVWA跨端通用工具类Web端实现",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",