@nvwa-app/sdk-uniapp 6.0.33 → 6.0.36

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.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { NvwaLocalStorage, NvwaFetch, INvwa, NvwaFileStorage, createPostgrestClient, NvwaEdgeFunctions, NvwaHttpClient, NvwaSkill, NvwaCapability, AuthClient } from '@nvwa-app/sdk-core';
1
+ import { NvwaLocalStorage, NvwaFetch, INvwa, NvwaFileStorage, createPostgrestClient, NvwaEdgeFunctions, NvwaHttpClient, NvwaSkill, NvwaCapability, AuthClient, IPaymentLauncher } from '@nvwa-app/sdk-core';
2
2
  export { polyfill } from '@nvwa-app/sdk-core';
3
3
 
4
4
  declare class UniAppLocalStorage implements NvwaLocalStorage {
@@ -43,6 +43,8 @@ declare class Nvwa implements INvwa {
43
43
  skill: NvwaSkill;
44
44
  capability: NvwaCapability;
45
45
  auth: AuthClient;
46
+ payment: IPaymentLauncher;
47
+ endpointType: string;
46
48
  constructor(baseUrl: string, handleUnauthorized: () => void);
47
49
  }
48
50
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { NvwaLocalStorage, NvwaFetch, INvwa, NvwaFileStorage, createPostgrestClient, NvwaEdgeFunctions, NvwaHttpClient, NvwaSkill, NvwaCapability, AuthClient } from '@nvwa-app/sdk-core';
1
+ import { NvwaLocalStorage, NvwaFetch, INvwa, NvwaFileStorage, createPostgrestClient, NvwaEdgeFunctions, NvwaHttpClient, NvwaSkill, NvwaCapability, AuthClient, IPaymentLauncher } from '@nvwa-app/sdk-core';
2
2
  export { polyfill } from '@nvwa-app/sdk-core';
3
3
 
4
4
  declare class UniAppLocalStorage implements NvwaLocalStorage {
@@ -43,6 +43,8 @@ declare class Nvwa implements INvwa {
43
43
  skill: NvwaSkill;
44
44
  capability: NvwaCapability;
45
45
  auth: AuthClient;
46
+ payment: IPaymentLauncher;
47
+ endpointType: string;
46
48
  constructor(baseUrl: string, handleUnauthorized: () => void);
47
49
  }
48
50
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var F=Object.defineProperty;var Je=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var Ke=Object.prototype.hasOwnProperty;var Ve=(t,e)=>{for(var r in e)F(t,r,{get:e[r],enumerable:!0})},Ye=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of We(e))!Ke.call(t,a)&&a!==r&&F(t,a,{get:()=>e[a],enumerable:!(s=Je(e,a))||s.enumerable});return t};var Qe=t=>Ye(F({},"__esModule",{value:!0}),t);var Ot={};Ve(Ot,{default:()=>U,disableIframeHoverInspector:()=>wt,enableIframeHoverInspector:()=>vt,getIframeSourceLocation:()=>bt,localStorage:()=>J,polyfill:()=>Me,setupIframeHoverInspector:()=>gt,setupIframeSourceLocationListener:()=>Et,uniappFetch:()=>L});module.exports=Qe(Ot);var Xe=Object.create,H=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyNames,tt=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty,K=(t,e)=>()=>(t&&(e=t(t=0)),e),P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),st=(t,e)=>{for(var r in e)H(t,r,{get:e[r],enumerable:!0})},V=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of et(e))!rt.call(t,a)&&a!==r&&H(t,a,{get:()=>e[a],enumerable:!(s=Ze(e,a))||s.enumerable});return t},at=(t,e,r)=>(r=t!=null?Xe(tt(t)):{},V(e||!t||!t.__esModule?H(r,"default",{value:t,enumerable:!0}):r,t)),$=t=>V(H({},"__esModule",{value:!0}),t),g=K(()=>{"use strict"}),S={};st(S,{__addDisposableResource:()=>be,__assign:()=>j,__asyncDelegator:()=>de,__asyncGenerator:()=>ue,__asyncValues:()=>pe,__await:()=>T,__awaiter:()=>ne,__classPrivateFieldGet:()=>ge,__classPrivateFieldIn:()=>we,__classPrivateFieldSet:()=>ve,__createBinding:()=>A,__decorate:()=>X,__disposeResources:()=>Ee,__esDecorate:()=>ee,__exportStar:()=>ie,__extends:()=>Y,__generator:()=>oe,__importDefault:()=>ye,__importStar:()=>me,__makeTemplateObject:()=>fe,__metadata:()=>ae,__param:()=>Z,__propKey:()=>re,__read:()=>z,__rest:()=>Q,__rewriteRelativeImportExtension:()=>_e,__runInitializers:()=>te,__setFunctionName:()=>se,__spread:()=>le,__spreadArray:()=>he,__spreadArrays:()=>ce,__values:()=>R,default:()=>Se});function Y(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");I(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Q(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(t);a<s.length;a++)e.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(t,s[a])&&(r[s[a]]=t[s[a]]);return r}function X(t,e,r,s){var a=arguments.length,n=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,r,s);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(n=(a<3?o(n):a>3?o(e,r,n):o(e,r))||n);return a>3&&n&&Object.defineProperty(e,r,n),n}function Z(t,e){return function(r,s){e(r,s,t)}}function ee(t,e,r,s,a,n){function o(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var l=s.kind,h=l==="getter"?"get":l==="setter"?"set":"value",i=!e&&t?s.static?t:t.prototype:null,c=e||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),u,f=!1,d=r.length-1;d>=0;d--){var p={};for(var m in s)p[m]=m==="access"?{}:s[m];for(var m in s.access)p.access[m]=s.access[m];p.addInitializer=function(v){if(f)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(v||null))};var y=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[h],p);if(l==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(u=o(y.get))&&(c.get=u),(u=o(y.set))&&(c.set=u),(u=o(y.init))&&a.unshift(u)}else(u=o(y))&&(l==="field"?a.unshift(u):c[h]=u)}i&&Object.defineProperty(i,s.name,c),f=!0}function te(t,e,r){for(var s=arguments.length>2,a=0;a<e.length;a++)r=s?e[a].call(t,r):e[a].call(t);return s?r:void 0}function re(t){return typeof t=="symbol"?t:"".concat(t)}function se(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function ae(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ne(t,e,r,s){function a(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function l(c){try{i(s.next(c))}catch(u){o(u)}}function h(c){try{i(s.throw(c))}catch(u){o(u)}}function i(c){c.done?n(c.value):a(c.value).then(l,h)}i((s=s.apply(t,e||[])).next())})}function oe(t,e){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,a,n,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(i){return function(c){return h([i,c])}}function h(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(s=1,a&&(n=i[0]&2?a.return:i[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,i[1])).done)return n;switch(a=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++,a=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=e.call(t,r)}catch(c){i=[6,c],a=0}finally{s=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function ie(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&A(e,t,r)}function R(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function z(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),a,n=[],o;try{for(;(e===void 0||e-- >0)&&!(a=s.next()).done;)n.push(a.value)}catch(l){o={error:l}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return n}function le(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(z(arguments[e]));return t}function ce(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var s=Array(t),a=0,e=0;e<r;e++)for(var n=arguments[e],o=0,l=n.length;o<l;o++,a++)s[a]=n[o];return s}function he(t,e,r){if(r||arguments.length===2)for(var s=0,a=e.length,n;s<a;s++)(n||!(s in e))&&(n||(n=Array.prototype.slice.call(e,0,s)),n[s]=e[s]);return t.concat(n||Array.prototype.slice.call(e))}function T(t){return this instanceof T?(this.v=t,this):new T(t)}function ue(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(t,e||[]),a,n=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),a[Symbol.asyncIterator]=function(){return this},a;function o(d){return function(p){return Promise.resolve(p).then(d,u)}}function l(d,p){s[d]&&(a[d]=function(m){return new Promise(function(y,v){n.push([d,m,y,v])>1||h(d,m)})},p&&(a[d]=p(a[d])))}function h(d,p){try{i(s[d](p))}catch(m){f(n[0][3],m)}}function i(d){d.value instanceof T?Promise.resolve(d.value.v).then(c,u):f(n[0][2],d)}function c(d){h("next",d)}function u(d){h("throw",d)}function f(d,p){d(p),n.shift(),n.length&&h(n[0][0],n[0][1])}}function de(t){var e,r;return e={},s("next"),s("throw",function(a){throw a}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(a,n){e[a]=t[a]?function(o){return(r=!r)?{value:T(t[a](o)),done:!1}:n?n(o):o}:n}}function pe(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof R=="function"?R(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(n){r[n]=t[n]&&function(o){return new Promise(function(l,h){o=t[n](o),a(l,h,o.done,o.value)})}}function a(n,o,l,h){Promise.resolve(h).then(function(i){n({value:i,done:l})},o)}}function fe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function me(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=N(t),s=0;s<r.length;s++)r[s]!=="default"&&A(e,t,r[s]);return Oe(e,t),e}function ye(t){return t&&t.__esModule?t:{default:t}}function ge(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}function ve(t,e,r,s,a){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?a.call(t,r):a?a.value=r:e.set(t,r),r}function we(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function be(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var s,a;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=e[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=e[Symbol.dispose],r&&(a=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");a&&(s=function(){try{a.call(this)}catch(n){return Promise.reject(n)}}),t.stack.push({value:e,dispose:s,async:r})}else r&&t.stack.push({async:!0});return e}function Ee(t){function e(n){t.error=t.hasError?new Pe(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}var r,s=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&s===1)return s=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var n=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(n).then(a,function(o){return e(o),a()})}else s|=1}catch(o){e(o)}if(s===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}function _e(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,a,n,o){return s?e?".jsx":".js":a&&(!n||!o)?r:a+n+"."+o.toLowerCase()+"js"}):t}var I,j,A,Oe,N,Pe,Se,x=K(()=>{"use strict";g(),I=function(t,e){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(r[a]=s[a])},I(t,e)},j=function(){return j=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},j.apply(this,arguments)},A=Object.create?(function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),Oe=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},N=function(t){return N=Object.getOwnPropertyNames||function(e){var r=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[r.length]=s);return r},N(t)},Pe=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var s=new Error(r);return s.name="SuppressedError",s.error=t,s.suppressed=e,s},Se={__extends:Y,__assign:j,__rest:Q,__decorate:X,__param:Z,__esDecorate:ee,__runInitializers:te,__propKey:re,__setFunctionName:se,__metadata:ae,__awaiter:ne,__generator:oe,__createBinding:A,__exportStar:ie,__values:R,__read:z,__spread:le,__spreadArrays:ce,__spreadArray:he,__await:T,__asyncGenerator:ue,__asyncDelegator:de,__asyncValues:pe,__makeTemplateObject:fe,__importStar:me,__importDefault:ye,__classPrivateFieldGet:ge,__classPrivateFieldSet:ve,__classPrivateFieldIn:we,__addDisposableResource:be,__disposeResources:Ee,__rewriteRelativeImportExtension:_e}}),Te=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};t.default=e}),$e=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(x(),$(S)),r=e.__importDefault(Te()),s=class{constructor(a){var n,o;this.shouldThrowOnError=!1,this.method=a.method,this.url=a.url,this.headers=new Headers(a.headers),this.schema=a.schema,this.body=a.body,this.shouldThrowOnError=(n=a.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=a.signal,this.isMaybeSingle=(o=a.isMaybeSingle)!==null&&o!==void 0?o:!1,a.fetch?this.fetch=a.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(a,n){return this.headers=new Headers(this.headers),this.headers.set(a,n),this}then(a,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 o=this.fetch,l=o(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async h=>{var i,c,u,f;let d=null,p=null,m=null,y=h.status,v=h.statusText;if(h.ok){if(this.method!=="HEAD"){let D=await h.text();D===""||(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")?p=D:p=JSON.parse(D))}let b=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),_=(u=h.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");b&&_&&_.length>1&&(m=parseInt(_[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(p)&&(p.length>1?(d={code:"PGRST116",details:`Results contain ${p.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},p=null,m=null,y=406,v="Not Acceptable"):p.length===1?p=p[0]:p=null)}else{let b=await h.text();try{d=JSON.parse(b),Array.isArray(d)&&h.status===404&&(p=[],d=null,y=200,v="OK")}catch{h.status===404&&b===""?(y=204,v="No Content"):d={message:b}}if(d&&this.isMaybeSingle&&!((f=d?.details)===null||f===void 0)&&f.includes("0 rows")&&(d=null,y=200,v="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:p,count:m,status:y,statusText:v}});return this.shouldThrowOnError||(l=l.catch(h=>{var i,c,u;return{error:{message:`${(i=h?.name)!==null&&i!==void 0?i:"FetchError"}: ${h?.message}`,details:`${(c=h?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(u=h?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),l.then(a,n)}returns(){return this}overrideTypes(){return this}};t.default=s}),xe=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(x(),$(S)),r=e.__importDefault($e()),s=class extends r.default{select(a){let n=!1,o=(a??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",o),this.headers.append("Prefer","return=representation"),this}order(a,{ascending:n=!0,nullsFirst:o,foreignTable:l,referencedTable:h=l}={}){let i=h?`${h}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${a}.${n?"asc":"desc"}${o===void 0?"":o?".nullsfirst":".nullslast"}`),this}limit(a,{foreignTable:n,referencedTable:o=n}={}){let l=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(l,`${a}`),this}range(a,n,{foreignTable:o,referencedTable:l=o}={}){let h=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(h,`${a}`),this.url.searchParams.set(i,`${n-a+1}`),this}abortSignal(a){return this.signal=a,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:a=!1,verbose:n=!1,settings:o=!1,buffers:l=!1,wal:h=!1,format:i="text"}={}){var c;let u=[a?"analyze":null,n?"verbose":null,o?"settings":null,l?"buffers":null,h?"wal":null].filter(Boolean).join("|"),f=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${f}"; options=${u};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(a){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${a}`),this}};t.default=s}),q=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(x(),$(S)),r=e.__importDefault(xe()),s=new RegExp("[,()]"),a=class extends r.default{eq(n,o){return this.url.searchParams.append(n,`eq.${o}`),this}neq(n,o){return this.url.searchParams.append(n,`neq.${o}`),this}gt(n,o){return this.url.searchParams.append(n,`gt.${o}`),this}gte(n,o){return this.url.searchParams.append(n,`gte.${o}`),this}lt(n,o){return this.url.searchParams.append(n,`lt.${o}`),this}lte(n,o){return this.url.searchParams.append(n,`lte.${o}`),this}like(n,o){return this.url.searchParams.append(n,`like.${o}`),this}likeAllOf(n,o){return this.url.searchParams.append(n,`like(all).{${o.join(",")}}`),this}likeAnyOf(n,o){return this.url.searchParams.append(n,`like(any).{${o.join(",")}}`),this}ilike(n,o){return this.url.searchParams.append(n,`ilike.${o}`),this}ilikeAllOf(n,o){return this.url.searchParams.append(n,`ilike(all).{${o.join(",")}}`),this}ilikeAnyOf(n,o){return this.url.searchParams.append(n,`ilike(any).{${o.join(",")}}`),this}is(n,o){return this.url.searchParams.append(n,`is.${o}`),this}in(n,o){let l=Array.from(new Set(o)).map(h=>typeof h=="string"&&s.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(n,`in.(${l})`),this}contains(n,o){return typeof o=="string"?this.url.searchParams.append(n,`cs.${o}`):Array.isArray(o)?this.url.searchParams.append(n,`cs.{${o.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(o)}`),this}containedBy(n,o){return typeof o=="string"?this.url.searchParams.append(n,`cd.${o}`):Array.isArray(o)?this.url.searchParams.append(n,`cd.{${o.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(o)}`),this}rangeGt(n,o){return this.url.searchParams.append(n,`sr.${o}`),this}rangeGte(n,o){return this.url.searchParams.append(n,`nxl.${o}`),this}rangeLt(n,o){return this.url.searchParams.append(n,`sl.${o}`),this}rangeLte(n,o){return this.url.searchParams.append(n,`nxr.${o}`),this}rangeAdjacent(n,o){return this.url.searchParams.append(n,`adj.${o}`),this}overlaps(n,o){return typeof o=="string"?this.url.searchParams.append(n,`ov.${o}`):this.url.searchParams.append(n,`ov.{${o.join(",")}}`),this}textSearch(n,o,{config:l,type:h}={}){let i="";h==="plain"?i="pl":h==="phrase"?i="ph":h==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(n,`${i}fts${c}.${o}`),this}match(n){return Object.entries(n).forEach(([o,l])=>{this.url.searchParams.append(o,`eq.${l}`)}),this}not(n,o,l){return this.url.searchParams.append(n,`not.${o}.${l}`),this}or(n,{foreignTable:o,referencedTable:l=o}={}){let h=l?`${l}.or`:"or";return this.url.searchParams.append(h,`(${n})`),this}filter(n,o,l){return this.url.searchParams.append(n,`${o}.${l}`),this}};t.default=a}),Le=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(x(),$(S)),r=e.__importDefault(q()),s=class{constructor(a,{headers:n={},schema:o,fetch:l}){this.url=a,this.headers=new Headers(n),this.schema=o,this.fetch=l}select(a,n){let{head:o=!1,count:l}=n??{},h=o?"HEAD":"GET",i=!1,c=(a??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(a,{count:n,defaultToNull:o=!0}={}){var l;let h="POST";if(n&&this.headers.append("Prefer",`count=${n}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(a)){let i=a.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(i.length>0){let c=[...new Set(i)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(a,{onConflict:n,ignoreDuplicates:o=!1,count:l,defaultToNull:h=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${o?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),l&&this.headers.append("Prefer",`count=${l}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(a)){let u=a.reduce((f,d)=>f.concat(Object.keys(d)),[]);if(u.length>0){let f=[...new Set(u)].map(d=>`"${d}"`);this.url.searchParams.set("columns",f.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(a,{count:n}={}){var o;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:a,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}delete({count:a}={}){var n;let o="DELETE";return a&&this.headers.append("Prefer",`count=${a}`),new r.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};t.default=s}),nt=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(x(),$(S)),r=e.__importDefault(Le()),s=e.__importDefault(q()),a=class je{constructor(o,{headers:l={},schema:h,fetch:i}={}){this.url=o,this.headers=new Headers(l),this.schemaName=h,this.fetch=i}from(o){let l=new URL(`${this.url}/${o}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new je(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,l={},{head:h=!1,get:i=!1,count:c}={}){var u;let f,d=new URL(`${this.url}/rpc/${o}`),p;h||i?(f=h?"HEAD":"GET",Object.entries(l).filter(([y,v])=>v!==void 0).map(([y,v])=>[y,Array.isArray(v)?`{${v.join(",")}}`:`${v}`]).forEach(([y,v])=>{d.searchParams.append(y,v)})):(f="POST",p=l);let m=new Headers(this.headers);return c&&m.set("Prefer",`count=${c}`),new s.default({method:f,url:d,headers:m,schema:this.schemaName,body:p,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};t.default=a}),ot=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestError=t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;var e=(x(),$(S)),r=e.__importDefault(nt());t.PostgrestClient=r.default;var s=e.__importDefault(Le());t.PostgrestQueryBuilder=s.default;var a=e.__importDefault(q());t.PostgrestFilterBuilder=a.default;var n=e.__importDefault(xe());t.PostgrestTransformBuilder=n.default;var o=e.__importDefault($e());t.PostgrestBuilder=o.default;var l=e.__importDefault(Te());t.PostgrestError=l.default,t.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:a.default,PostgrestTransformBuilder:n.default,PostgrestBuilder:o.default,PostgrestError:l.default}});g();g();var Ae=class{constructor(t,e=""){this.http=t,this.baseUrl=e.replace(/\/$/,"")}async invoke(t,e){let r=this.baseUrl?`${this.baseUrl}/functions/${t}`:`/functions/${t}`;return await(await this.http.fetch(r,{method:e.method||"POST",body:e.body,headers:e.headers})).json()}};g();g();var E="nvwa_current_jwt",O="nvwa_login_token",C="nvwa_user_profile",it="set-auth-token",lt=typeof fetch<"u"?(t,e)=>fetch(t,e):()=>{throw new Error("AuthClient requires fetch")},Ce=class{constructor(t,e={}){this.baseUrl=t.replace(/\/$/,""),this.authPath=(e.authPath??"/auth").replace(/^\//,""),this.fetchImpl=e.fetchImpl??lt,this.storage=e.storage??null,this.credentials=e.credentials??"omit"}async currentUser(){if(this.storage){let r=await this.storage.get(C);if(r!=null)return r}let{data:t}=await this.getSession(),e=t?.user??null;return e&&this.storage&&await this.storage.set(C,e),e}async getCurrentJwt(){if(this.storage){let e=await this.storage.get(E);if(e!=null)return e;let r=await this.storage.get(O),{data:s}=await this.getToken(r??void 0);return s?.token?(await this.storage.set(E,s.token),s.token):null}let{data:t}=await this.getToken();return t?.token??null}async persistLogin(t,e){if(!this.storage)return;let r=e?.headers.get(it)?.trim()||t.token||t.session?.token;r&&await this.storage.set(O,r),t.user&&await this.storage.set(C,t.user);let s=r??await this.storage.get(O),{data:a}=await this.getToken(s??void 0);a?.token&&await this.storage.set(E,a.token)}async clearLogin(){this.storage&&(await this.storage.remove(O),await this.storage.remove(C),await this.storage.remove(E))}url(t){let e=`${`${this.baseUrl.replace(/\/+$/,"")}/${this.authPath.replace(/^\/+/,"")}`}/${t.replace(/^\/+/,"")}`;return typeof console<"u"&&console.debug&&console.debug("[NvwaAuth] request URL:",e),e}async getSession(){try{let t={};if(this.storage){let r=await this.storage.get(O)??await this.storage.get(E);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("session"),{method:"GET",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return e.ok?{data:await e.json()}:{data:null,error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{data:null,error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signInWithEmail(t,e){try{let r=await this.fetchImpl(this.url("sign-in/email"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify({email:t,password:e})}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return a&&await this.persistLogin({user:a.user,session:a.session},r),{data:a}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async signOut(){try{let t={};if(this.storage){let r=await this.storage.get(O)??await this.storage.get(E);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("sign-out"),{method:"POST",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return await this.clearLogin(),e.ok?{}:{error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signUp(t){let e=await this.postJson("sign-up/email",t);return e.data&&await this.persistLogin(e.data,e.response),e}async getToken(t){try{let e={};if(t)e.Authorization=`Bearer ${t}`;else if(this.storage){let n=await this.storage.get(O)??await this.storage.get(E);n!=null&&(e.Authorization=`Bearer ${n}`)}let r=await this.fetchImpl(this.url("token"),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return{data:a?.token!=null?{token:a.token}:void 0}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async signInWithUsername(t,e){let r=await this.postJson("sign-in/username",{username:t,password:e});return r.data&&await this.persistLogin(r.data,r.response),r}async signInWithPhoneNumber(t,e,r){let s=await this.postJson("sign-in/phone-number",{phoneNumber:t,password:e,rememberMe:r});return s.data&&await this.persistLogin(s.data,s.response),s}async sendPhoneNumberOtp(t){let e=await this.postJson("phone-number/send-otp",{phoneNumber:t});return e.error?{error:e.error}:{}}async verifyPhoneNumber(t,e){let r=await this.postJson("phone-number/verify",{phoneNumber:t,code:e});return r.data&&await this.persistLogin(r.data,r.response),r}async postJson(t,e){try{let r=await this.fetchImpl(this.url(t),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify(e)}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return{data:a?.data??a??void 0,response:r}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}};g();g();var w=class Ie{constructor(e){if(this.headerMap=new Map,e){if(e instanceof Ie)e.forEach((r,s)=>this.set(s,r));else if(Array.isArray(e))for(let[r,s]of e)this.set(r,String(s));else if(typeof e=="object")for(let r of Object.keys(e))this.set(r,String(e[r]))}}append(e,r){let s=e.toLowerCase(),a=this.headerMap.get(s);this.headerMap.set(s,a?`${a}, ${r}`:r)}set(e,r){this.headerMap.set(e.toLowerCase(),String(r))}get(e){return this.headerMap.get(e.toLowerCase())??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[r,s]of this.headerMap.entries())e(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},Ne=class Re{constructor(e){if(this.params=new Map,e){if(typeof e=="string")this.parseString(e);else if(e instanceof Re)this.params=new Map(e.params);else if(Array.isArray(e))for(let[r,s]of e)this.append(r,s);else if(e&&typeof e=="object")for(let[r,s]of Object.entries(e))this.set(r,s)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let r=e.split("&");for(let s of r)if(s){let[a,n]=s.split("=");a&&this.append(decodeURIComponent(a),n?decodeURIComponent(n):"")}}append(e,r){let s=this.params.get(e)||[];s.push(r),this.params.set(e,s)}delete(e){this.params.delete(e)}get(e){let r=this.params.get(e);return r?r[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,r){this.params.set(e,[r])}sort(){let e=Array.from(this.params.entries()).sort(([r],[s])=>r.localeCompare(s));this.params=new Map(e)}toString(){let e=[];for(let[r,s]of this.params.entries())for(let a of s)e.push(`${encodeURIComponent(r)}=${encodeURIComponent(a)}`);return e.join("&")}forEach(e){for(let[r,s]of this.params.entries())for(let a of s)e(a,r,this)}keys(){return this.params.keys()}values(){let e=[];for(let r of this.params.values())e.push(...r);return e[Symbol.iterator]()}entries(){let e=[];for(let[r,s]of this.params.entries())for(let a of s)e.push([r,a]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},ct=class B{constructor(e,r){let s;if(e instanceof B)s=e.href;else if(r){let n=r instanceof B?r.href:r;s=this.resolve(n,e)}else s=e;let a=this.parseUrl(s);this.href=s,this.origin=`${a.protocol}//${a.host}`,this.protocol=a.protocol,this.username=a.username,this.password=a.password,this.host=a.host,this.hostname=a.hostname,this.port=a.port,this.pathname=a.pathname,this.search=a.search,this.searchParams=new Ne(a.search),this.hash=a.hash}resolve(e,r){if(r.startsWith("http://")||r.startsWith("https://"))return r;if(r.startsWith("//"))return`${this.parseUrl(e).protocol}${r}`;if(r.startsWith("/")){let n=this.parseUrl(e);return`${n.protocol}//${n.host}${r}`}let s=this.parseUrl(e),a=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return`${s.protocol}//${s.host}${a}${r}`}parseUrl(e){let r=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!r)throw new TypeError("Invalid URL");let s=r[2]||"",a=r[4]||"",n=r[5]||"/",o=r[7]?`?${r[7]}`:"",l=r[9]?`#${r[9]}`:"";if(!s&&!a&&!n.startsWith("/")&&!n.includes("/")&&!n.includes("."))throw new TypeError("Invalid URL");let h=a.match(/^([^@]*)@(.+)$/),i="",c="",u=a;if(h){let m=h[1];u=h[2];let y=m.match(/^([^:]*):?(.*)$/);y&&(i=y[1]||"",c=y[2]||"")}let f=u.match(/^([^:]+):?(\d*)$/),d=f?f[1]:u,p=f&&f[2]?f[2]:"";return{protocol:s?`${s}:`:"",username:i,password:c,host:u,hostname:d,port:p,pathname:n,search:o,hash:l}}toString(){let e=this.searchParams.toString(),r=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${r}${this.hash}`}toJSON(){return this.toString()}};g();var ht=class ke{constructor(e,r){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(r?.method||"GET").toUpperCase(),this.headers=r?.headers instanceof w?r.headers:new w(r?.headers),this.body=r?.body,this.timeout=r?.timeout,this.signal=r?.signal||void 0}clone(){return new ke(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};g();var G=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=ut(e?.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 t=await this.text();return new TextEncoder().encode(t).buffer}};function ut(t){return t?new w(t):new w}g();var He=class{constructor(){this._aborted=!1,this.listeners=new Set,this.onabort=null}get aborted(){return this._aborted}_trigger(){if(!this._aborted){if(this._aborted=!0,typeof this.onabort=="function")try{this.onabort()}catch{}for(let t of Array.from(this.listeners))try{t()}catch{}this.listeners.clear()}}addEventListener(t,e){if(this._aborted){try{e()}catch{}return}this.listeners.add(e)}removeEventListener(t,e){this.listeners.delete(e)}toString(){return"[object AbortSignal]"}},dt=class{constructor(){this._signal=new He}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};g();function Me(t){t.URL=ct,t.URLSearchParams=Ne,t.Headers=w,t.Request=ht,t.Response=G,t.AbortController=dt,t.AbortSignal=He}var Ue=class{constructor(t,e,r){this.storage=t,this.customFetch=e,this.handleUnauthorized=r}async fetch(t,e){return await this.customFetch(t,e)}async fetchWithAuth(t,e){let r=await this.storage.get(E),s=new w(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let a=e?.method||"GET";if((a==="POST"||a==="PUT"||a==="PATCH")&&e?.body){let o=s.get("Content-Type");(!o||o.includes("text/plain"))&&s.set("Content-Type","application/json")}let n=await this.customFetch(t,{...e,headers:s});if(n.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return n}};g();var pt="/storage",ft=pt+"/generateUploadUrl",De=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+ft,{method:"POST",body:{fileName:t.name||t.fileName,fileSize:t.size||t.fileSize,fileType:t.type||t.fileType}}),{url:r}=await e.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:t,headers:new w({"Content-Type":t.type||t.fileType||"application/octet-stream"})}),{url:a}=await s.json();return{url:a.split("?")[0]}}};g();g();g();var W=at(ot(),1),{PostgrestClient:mt,PostgrestQueryBuilder:St,PostgrestFilterBuilder:Tt,PostgrestTransformBuilder:$t,PostgrestBuilder:xt,PostgrestError:Lt}=W.default||W,yt="/entities",Fe=(t,e)=>new mt(t+yt,{fetch:e.fetchWithAuth.bind(e)});g();var Be=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};g();var ze=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e!=null?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};g();var qe=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 t=document.createElement("style");t.id="__nvwa-inspector-overlay-style",t.textContent=`
1
+ "use strict";var B=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var Ye=Object.prototype.hasOwnProperty;var Qe=(t,e)=>{for(var r in e)B(t,r,{get:e[r],enumerable:!0})},Xe=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ve(e))!Ye.call(t,a)&&a!==r&&B(t,a,{get:()=>e[a],enumerable:!(s=Ke(e,a))||s.enumerable});return t};var Ze=t=>Xe(B({},"__esModule",{value:!0}),t);var St={};Qe(St,{default:()=>D,disableIframeHoverInspector:()=>Et,enableIframeHoverInspector:()=>bt,getIframeSourceLocation:()=>_t,localStorage:()=>W,polyfill:()=>He,setupIframeHoverInspector:()=>wt,setupIframeSourceLocationListener:()=>Pt,uniappFetch:()=>j});module.exports=Ze(St);var et=Object.create,U=Object.defineProperty,tt=Object.getOwnPropertyDescriptor,rt=Object.getOwnPropertyNames,st=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty,V=(t,e)=>()=>(t&&(e=t(t=0)),e),S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),nt=(t,e)=>{for(var r in e)U(t,r,{get:e[r],enumerable:!0})},Y=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of rt(e))!at.call(t,a)&&a!==r&&U(t,a,{get:()=>e[a],enumerable:!(s=tt(e,a))||s.enumerable});return t},ot=(t,e,r)=>(r=t!=null?et(st(t)):{},Y(e||!t||!t.__esModule?U(r,"default",{value:t,enumerable:!0}):r,t)),x=t=>Y(U({},"__esModule",{value:!0}),t),g=V(()=>{"use strict"}),T={};nt(T,{__addDisposableResource:()=>Ee,__assign:()=>C,__asyncDelegator:()=>pe,__asyncGenerator:()=>de,__asyncValues:()=>fe,__await:()=>$,__awaiter:()=>oe,__classPrivateFieldGet:()=>ve,__classPrivateFieldIn:()=>be,__classPrivateFieldSet:()=>we,__createBinding:()=>I,__decorate:()=>Z,__disposeResources:()=>_e,__esDecorate:()=>te,__exportStar:()=>le,__extends:()=>Q,__generator:()=>ie,__importDefault:()=>ge,__importStar:()=>ye,__makeTemplateObject:()=>me,__metadata:()=>ne,__param:()=>ee,__propKey:()=>se,__read:()=>z,__rest:()=>X,__rewriteRelativeImportExtension:()=>Pe,__runInitializers:()=>re,__setFunctionName:()=>ae,__spread:()=>ce,__spreadArray:()=>ue,__spreadArrays:()=>he,__values:()=>M,default:()=>Te});function Q(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");R(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function X(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(t);a<s.length;a++)e.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(t,s[a])&&(r[s[a]]=t[s[a]]);return r}function Z(t,e,r,s){var a=arguments.length,n=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,r,s);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(n=(a<3?o(n):a>3?o(e,r,n):o(e,r))||n);return a>3&&n&&Object.defineProperty(e,r,n),n}function ee(t,e){return function(r,s){e(r,s,t)}}function te(t,e,r,s,a,n){function o(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var l=s.kind,h=l==="getter"?"get":l==="setter"?"set":"value",i=!e&&t?s.static?t:t.prototype:null,c=e||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),u,f=!1,d=r.length-1;d>=0;d--){var p={};for(var m in s)p[m]=m==="access"?{}:s[m];for(var m in s.access)p.access[m]=s.access[m];p.addInitializer=function(v){if(f)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(v||null))};var y=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[h],p);if(l==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(u=o(y.get))&&(c.get=u),(u=o(y.set))&&(c.set=u),(u=o(y.init))&&a.unshift(u)}else(u=o(y))&&(l==="field"?a.unshift(u):c[h]=u)}i&&Object.defineProperty(i,s.name,c),f=!0}function re(t,e,r){for(var s=arguments.length>2,a=0;a<e.length;a++)r=s?e[a].call(t,r):e[a].call(t);return s?r:void 0}function se(t){return typeof t=="symbol"?t:"".concat(t)}function ae(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function ne(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function oe(t,e,r,s){function a(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function l(c){try{i(s.next(c))}catch(u){o(u)}}function h(c){try{i(s.throw(c))}catch(u){o(u)}}function i(c){c.done?n(c.value):a(c.value).then(l,h)}i((s=s.apply(t,e||[])).next())})}function ie(t,e){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,a,n,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(i){return function(c){return h([i,c])}}function h(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(s=1,a&&(n=i[0]&2?a.return:i[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,i[1])).done)return n;switch(a=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++,a=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=e.call(t,r)}catch(c){i=[6,c],a=0}finally{s=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function le(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&I(e,t,r)}function M(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function z(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),a,n=[],o;try{for(;(e===void 0||e-- >0)&&!(a=s.next()).done;)n.push(a.value)}catch(l){o={error:l}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return n}function ce(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(z(arguments[e]));return t}function he(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var s=Array(t),a=0,e=0;e<r;e++)for(var n=arguments[e],o=0,l=n.length;o<l;o++,a++)s[a]=n[o];return s}function ue(t,e,r){if(r||arguments.length===2)for(var s=0,a=e.length,n;s<a;s++)(n||!(s in e))&&(n||(n=Array.prototype.slice.call(e,0,s)),n[s]=e[s]);return t.concat(n||Array.prototype.slice.call(e))}function $(t){return this instanceof $?(this.v=t,this):new $(t)}function de(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(t,e||[]),a,n=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),a[Symbol.asyncIterator]=function(){return this},a;function o(d){return function(p){return Promise.resolve(p).then(d,u)}}function l(d,p){s[d]&&(a[d]=function(m){return new Promise(function(y,v){n.push([d,m,y,v])>1||h(d,m)})},p&&(a[d]=p(a[d])))}function h(d,p){try{i(s[d](p))}catch(m){f(n[0][3],m)}}function i(d){d.value instanceof $?Promise.resolve(d.value.v).then(c,u):f(n[0][2],d)}function c(d){h("next",d)}function u(d){h("throw",d)}function f(d,p){d(p),n.shift(),n.length&&h(n[0][0],n[0][1])}}function pe(t){var e,r;return e={},s("next"),s("throw",function(a){throw a}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(a,n){e[a]=t[a]?function(o){return(r=!r)?{value:$(t[a](o)),done:!1}:n?n(o):o}:n}}function fe(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof M=="function"?M(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(n){r[n]=t[n]&&function(o){return new Promise(function(l,h){o=t[n](o),a(l,h,o.done,o.value)})}}function a(n,o,l,h){Promise.resolve(h).then(function(i){n({value:i,done:l})},o)}}function me(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ye(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=k(t),s=0;s<r.length;s++)r[s]!=="default"&&I(e,t,r[s]);return Oe(e,t),e}function ge(t){return t&&t.__esModule?t:{default:t}}function ve(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}function we(t,e,r,s,a){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?a.call(t,r):a?a.value=r:e.set(t,r),r}function be(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function Ee(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var s,a;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=e[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=e[Symbol.dispose],r&&(a=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");a&&(s=function(){try{a.call(this)}catch(n){return Promise.reject(n)}}),t.stack.push({value:e,dispose:s,async:r})}else r&&t.stack.push({async:!0});return e}function _e(t){function e(n){t.error=t.hasError?new Se(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}var r,s=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&s===1)return s=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var n=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(n).then(a,function(o){return e(o),a()})}else s|=1}catch(o){e(o)}if(s===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}function Pe(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,a,n,o){return s?e?".jsx":".js":a&&(!n||!o)?r:a+n+"."+o.toLowerCase()+"js"}):t}var R,C,I,Oe,k,Se,Te,A=V(()=>{"use strict";g(),R=function(t,e){return R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(r[a]=s[a])},R(t,e)},C=function(){return C=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},C.apply(this,arguments)},I=Object.create?(function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),Oe=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},k=function(t){return k=Object.getOwnPropertyNames||function(e){var r=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[r.length]=s);return r},k(t)},Se=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var s=new Error(r);return s.name="SuppressedError",s.error=t,s.suppressed=e,s},Te={__extends:Q,__assign:C,__rest:X,__decorate:Z,__param:ee,__esDecorate:te,__runInitializers:re,__propKey:se,__setFunctionName:ae,__metadata:ne,__awaiter:oe,__generator:ie,__createBinding:I,__exportStar:le,__values:M,__read:z,__spread:ce,__spreadArrays:he,__spreadArray:ue,__await:$,__asyncGenerator:de,__asyncDelegator:pe,__asyncValues:fe,__makeTemplateObject:me,__importStar:ye,__importDefault:ge,__classPrivateFieldGet:ve,__classPrivateFieldSet:we,__classPrivateFieldIn:be,__addDisposableResource:Ee,__disposeResources:_e,__rewriteRelativeImportExtension:Pe}}),$e=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};t.default=e}),Le=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(A(),x(T)),r=e.__importDefault($e()),s=class{constructor(a){var n,o;this.shouldThrowOnError=!1,this.method=a.method,this.url=a.url,this.headers=new Headers(a.headers),this.schema=a.schema,this.body=a.body,this.shouldThrowOnError=(n=a.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=a.signal,this.isMaybeSingle=(o=a.isMaybeSingle)!==null&&o!==void 0?o:!1,a.fetch?this.fetch=a.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(a,n){return this.headers=new Headers(this.headers),this.headers.set(a,n),this}then(a,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 o=this.fetch,l=o(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async h=>{var i,c,u,f;let d=null,p=null,m=null,y=h.status,v=h.statusText;if(h.ok){if(this.method!=="HEAD"){let F=await h.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")?p=F:p=JSON.parse(F))}let b=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),P=(u=h.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");b&&P&&P.length>1&&(m=parseInt(P[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(p)&&(p.length>1?(d={code:"PGRST116",details:`Results contain ${p.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},p=null,m=null,y=406,v="Not Acceptable"):p.length===1?p=p[0]:p=null)}else{let b=await h.text();try{d=JSON.parse(b),Array.isArray(d)&&h.status===404&&(p=[],d=null,y=200,v="OK")}catch{h.status===404&&b===""?(y=204,v="No Content"):d={message:b}}if(d&&this.isMaybeSingle&&!((f=d?.details)===null||f===void 0)&&f.includes("0 rows")&&(d=null,y=200,v="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:p,count:m,status:y,statusText:v}});return this.shouldThrowOnError||(l=l.catch(h=>{var i,c,u;return{error:{message:`${(i=h?.name)!==null&&i!==void 0?i:"FetchError"}: ${h?.message}`,details:`${(c=h?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(u=h?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),l.then(a,n)}returns(){return this}overrideTypes(){return this}};t.default=s}),xe=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(A(),x(T)),r=e.__importDefault(Le()),s=class extends r.default{select(a){let n=!1,o=(a??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",o),this.headers.append("Prefer","return=representation"),this}order(a,{ascending:n=!0,nullsFirst:o,foreignTable:l,referencedTable:h=l}={}){let i=h?`${h}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${a}.${n?"asc":"desc"}${o===void 0?"":o?".nullsfirst":".nullslast"}`),this}limit(a,{foreignTable:n,referencedTable:o=n}={}){let l=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(l,`${a}`),this}range(a,n,{foreignTable:o,referencedTable:l=o}={}){let h=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(h,`${a}`),this.url.searchParams.set(i,`${n-a+1}`),this}abortSignal(a){return this.signal=a,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:a=!1,verbose:n=!1,settings:o=!1,buffers:l=!1,wal:h=!1,format:i="text"}={}){var c;let u=[a?"analyze":null,n?"verbose":null,o?"settings":null,l?"buffers":null,h?"wal":null].filter(Boolean).join("|"),f=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${f}"; options=${u};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(a){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${a}`),this}};t.default=s}),G=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(A(),x(T)),r=e.__importDefault(xe()),s=new RegExp("[,()]"),a=class extends r.default{eq(n,o){return this.url.searchParams.append(n,`eq.${o}`),this}neq(n,o){return this.url.searchParams.append(n,`neq.${o}`),this}gt(n,o){return this.url.searchParams.append(n,`gt.${o}`),this}gte(n,o){return this.url.searchParams.append(n,`gte.${o}`),this}lt(n,o){return this.url.searchParams.append(n,`lt.${o}`),this}lte(n,o){return this.url.searchParams.append(n,`lte.${o}`),this}like(n,o){return this.url.searchParams.append(n,`like.${o}`),this}likeAllOf(n,o){return this.url.searchParams.append(n,`like(all).{${o.join(",")}}`),this}likeAnyOf(n,o){return this.url.searchParams.append(n,`like(any).{${o.join(",")}}`),this}ilike(n,o){return this.url.searchParams.append(n,`ilike.${o}`),this}ilikeAllOf(n,o){return this.url.searchParams.append(n,`ilike(all).{${o.join(",")}}`),this}ilikeAnyOf(n,o){return this.url.searchParams.append(n,`ilike(any).{${o.join(",")}}`),this}is(n,o){return this.url.searchParams.append(n,`is.${o}`),this}in(n,o){let l=Array.from(new Set(o)).map(h=>typeof h=="string"&&s.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(n,`in.(${l})`),this}contains(n,o){return typeof o=="string"?this.url.searchParams.append(n,`cs.${o}`):Array.isArray(o)?this.url.searchParams.append(n,`cs.{${o.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(o)}`),this}containedBy(n,o){return typeof o=="string"?this.url.searchParams.append(n,`cd.${o}`):Array.isArray(o)?this.url.searchParams.append(n,`cd.{${o.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(o)}`),this}rangeGt(n,o){return this.url.searchParams.append(n,`sr.${o}`),this}rangeGte(n,o){return this.url.searchParams.append(n,`nxl.${o}`),this}rangeLt(n,o){return this.url.searchParams.append(n,`sl.${o}`),this}rangeLte(n,o){return this.url.searchParams.append(n,`nxr.${o}`),this}rangeAdjacent(n,o){return this.url.searchParams.append(n,`adj.${o}`),this}overlaps(n,o){return typeof o=="string"?this.url.searchParams.append(n,`ov.${o}`):this.url.searchParams.append(n,`ov.{${o.join(",")}}`),this}textSearch(n,o,{config:l,type:h}={}){let i="";h==="plain"?i="pl":h==="phrase"?i="ph":h==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(n,`${i}fts${c}.${o}`),this}match(n){return Object.entries(n).forEach(([o,l])=>{this.url.searchParams.append(o,`eq.${l}`)}),this}not(n,o,l){return this.url.searchParams.append(n,`not.${o}.${l}`),this}or(n,{foreignTable:o,referencedTable:l=o}={}){let h=l?`${l}.or`:"or";return this.url.searchParams.append(h,`(${n})`),this}filter(n,o,l){return this.url.searchParams.append(n,`${o}.${l}`),this}};t.default=a}),Ae=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(A(),x(T)),r=e.__importDefault(G()),s=class{constructor(a,{headers:n={},schema:o,fetch:l}){this.url=a,this.headers=new Headers(n),this.schema=o,this.fetch=l}select(a,n){let{head:o=!1,count:l}=n??{},h=o?"HEAD":"GET",i=!1,c=(a??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(a,{count:n,defaultToNull:o=!0}={}){var l;let h="POST";if(n&&this.headers.append("Prefer",`count=${n}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(a)){let i=a.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(i.length>0){let c=[...new Set(i)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(a,{onConflict:n,ignoreDuplicates:o=!1,count:l,defaultToNull:h=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${o?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),l&&this.headers.append("Prefer",`count=${l}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(a)){let u=a.reduce((f,d)=>f.concat(Object.keys(d)),[]);if(u.length>0){let f=[...new Set(u)].map(d=>`"${d}"`);this.url.searchParams.set("columns",f.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(a,{count:n}={}){var o;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:a,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}delete({count:a}={}){var n;let o="DELETE";return a&&this.headers.append("Prefer",`count=${a}`),new r.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};t.default=s}),it=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(A(),x(T)),r=e.__importDefault(Ae()),s=e.__importDefault(G()),a=class je{constructor(o,{headers:l={},schema:h,fetch:i}={}){this.url=o,this.headers=new Headers(l),this.schemaName=h,this.fetch=i}from(o){let l=new URL(`${this.url}/${o}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new je(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,l={},{head:h=!1,get:i=!1,count:c}={}){var u;let f,d=new URL(`${this.url}/rpc/${o}`),p;h||i?(f=h?"HEAD":"GET",Object.entries(l).filter(([y,v])=>v!==void 0).map(([y,v])=>[y,Array.isArray(v)?`{${v.join(",")}}`:`${v}`]).forEach(([y,v])=>{d.searchParams.append(y,v)})):(f="POST",p=l);let m=new Headers(this.headers);return c&&m.set("Prefer",`count=${c}`),new s.default({method:f,url:d,headers:m,schema:this.schemaName,body:p,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};t.default=a}),lt=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestError=t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;var e=(A(),x(T)),r=e.__importDefault(it());t.PostgrestClient=r.default;var s=e.__importDefault(Ae());t.PostgrestQueryBuilder=s.default;var a=e.__importDefault(G());t.PostgrestFilterBuilder=a.default;var n=e.__importDefault(xe());t.PostgrestTransformBuilder=n.default;var o=e.__importDefault(Le());t.PostgrestBuilder=o.default;var l=e.__importDefault($e());t.PostgrestError=l.default,t.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:a.default,PostgrestTransformBuilder:n.default,PostgrestBuilder:o.default,PostgrestError:l.default}});g();g();var Ce=class{constructor(t,e=""){this.http=t,this.baseUrl=e.replace(/\/$/,"")}async invoke(t,e){let r=this.baseUrl?`${this.baseUrl}/functions/${t}`:`/functions/${t}`;return await(await this.http.fetch(r,{method:e.method||"POST",body:e.body,headers:e.headers})).json()}};g();g();var E="nvwa_current_jwt",O="nvwa_login_token",N="nvwa_user_profile",ct="set-auth-token",ht=typeof fetch<"u"?(t,e)=>fetch(t,e):()=>{throw new Error("AuthClient requires fetch")},Ie=class{constructor(t,e={}){this.baseUrl=t.replace(/\/$/,""),this.authPath=(e.authPath??"/auth").replace(/^\//,""),this.fetchImpl=e.fetchImpl??ht,this.storage=e.storage??null,this.credentials=e.credentials??"omit"}async currentUser(){if(this.storage){let r=await this.storage.get(N);if(r!=null)return r}let{data:t}=await this.getSession(),e=t?.user??null;return e&&this.storage&&await this.storage.set(N,e),e}async getCurrentJwt(){if(this.storage){let e=await this.storage.get(E);if(e!=null)return e;let r=await this.storage.get(O),{data:s}=await this.getToken(r??void 0);return s?.token?(await this.storage.set(E,s.token),s.token):null}let{data:t}=await this.getToken();return t?.token??null}async persistLogin(t,e){if(!this.storage)return;let r=e?.headers.get(ct)?.trim()||t.token||t.session?.token;r&&await this.storage.set(O,r),t.user&&await this.storage.set(N,t.user);let s=r??await this.storage.get(O),{data:a}=await this.getToken(s??void 0);a?.token&&await this.storage.set(E,a.token)}async clearLogin(){this.storage&&(await this.storage.remove(O),await this.storage.remove(N),await this.storage.remove(E))}url(t){let e=`${`${this.baseUrl.replace(/\/+$/,"")}/${this.authPath.replace(/^\/+/,"")}`}/${t.replace(/^\/+/,"")}`;return typeof console<"u"&&console.debug&&console.debug("[NvwaAuth] request URL:",e),e}async getSession(){try{let t={};if(this.storage){let r=await this.storage.get(O)??await this.storage.get(E);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("session"),{method:"GET",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return e.ok?{data:await e.json()}:{data:null,error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{data:null,error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signInWithEmail(t,e){try{let r=await this.fetchImpl(this.url("sign-in/email"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify({email:t,password:e})}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return a&&await this.persistLogin({user:a.user,session:a.session},r),{data:a}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async signOut(){try{let t={};if(this.storage){let r=await this.storage.get(O)??await this.storage.get(E);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("sign-out"),{method:"POST",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return await this.clearLogin(),e.ok?{}:{error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signUp(t){let e=await this.postJson("sign-up/email",t);return e.data&&await this.persistLogin(e.data,e.response),e}async getToken(t){try{let e={};if(t)e.Authorization=`Bearer ${t}`;else if(this.storage){let n=await this.storage.get(O)??await this.storage.get(E);n!=null&&(e.Authorization=`Bearer ${n}`)}let r=await this.fetchImpl(this.url("token"),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return{data:a?.token!=null?{token:a.token}:void 0}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async signInWithUsername(t,e){let r=await this.postJson("sign-in/username",{username:t,password:e});return r.data&&await this.persistLogin(r.data,r.response),r}async signInWithPhoneNumber(t,e,r){let s=await this.postJson("sign-in/phone-number",{phoneNumber:t,password:e,rememberMe:r});return s.data&&await this.persistLogin(s.data,s.response),s}async sendPhoneNumberOtp(t){let e=await this.postJson("phone-number/send-otp",{phoneNumber:t});return e.error?{error:e.error}:{}}async verifyPhoneNumber(t,e){let r=await this.postJson("phone-number/verify",{phoneNumber:t,code:e});return r.data&&await this.persistLogin(r.data,r.response),r}async postJson(t,e){try{let r=await this.fetchImpl(this.url(t),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify(e)}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return{data:a?.data??a??void 0,response:r}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}};g();g();var w=class Ne{constructor(e){if(this.headerMap=new Map,e){if(e instanceof Ne)e.forEach((r,s)=>this.set(s,r));else if(Array.isArray(e))for(let[r,s]of e)this.set(r,String(s));else if(typeof e=="object")for(let r of Object.keys(e))this.set(r,String(e[r]))}}append(e,r){let s=e.toLowerCase(),a=this.headerMap.get(s);this.headerMap.set(s,a?`${a}, ${r}`:r)}set(e,r){this.headerMap.set(e.toLowerCase(),String(r))}get(e){return this.headerMap.get(e.toLowerCase())??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[r,s]of this.headerMap.entries())e(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},Re=class ke{constructor(e){if(this.params=new Map,e){if(typeof e=="string")this.parseString(e);else if(e instanceof ke)this.params=new Map(e.params);else if(Array.isArray(e))for(let[r,s]of e)this.append(r,s);else if(e&&typeof e=="object")for(let[r,s]of Object.entries(e))this.set(r,s)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let r=e.split("&");for(let s of r)if(s){let[a,n]=s.split("=");a&&this.append(decodeURIComponent(a),n?decodeURIComponent(n):"")}}append(e,r){let s=this.params.get(e)||[];s.push(r),this.params.set(e,s)}delete(e){this.params.delete(e)}get(e){let r=this.params.get(e);return r?r[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,r){this.params.set(e,[r])}sort(){let e=Array.from(this.params.entries()).sort(([r],[s])=>r.localeCompare(s));this.params=new Map(e)}toString(){let e=[];for(let[r,s]of this.params.entries())for(let a of s)e.push(`${encodeURIComponent(r)}=${encodeURIComponent(a)}`);return e.join("&")}forEach(e){for(let[r,s]of this.params.entries())for(let a of s)e(a,r,this)}keys(){return this.params.keys()}values(){let e=[];for(let r of this.params.values())e.push(...r);return e[Symbol.iterator]()}entries(){let e=[];for(let[r,s]of this.params.entries())for(let a of s)e.push([r,a]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},ut=class q{constructor(e,r){let s;if(e instanceof q)s=e.href;else if(r){let n=r instanceof q?r.href:r;s=this.resolve(n,e)}else s=e;let a=this.parseUrl(s);this.href=s,this.origin=`${a.protocol}//${a.host}`,this.protocol=a.protocol,this.username=a.username,this.password=a.password,this.host=a.host,this.hostname=a.hostname,this.port=a.port,this.pathname=a.pathname,this.search=a.search,this.searchParams=new Re(a.search),this.hash=a.hash}resolve(e,r){if(r.startsWith("http://")||r.startsWith("https://"))return r;if(r.startsWith("//"))return`${this.parseUrl(e).protocol}${r}`;if(r.startsWith("/")){let n=this.parseUrl(e);return`${n.protocol}//${n.host}${r}`}let s=this.parseUrl(e),a=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return`${s.protocol}//${s.host}${a}${r}`}parseUrl(e){let r=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!r)throw new TypeError("Invalid URL");let s=r[2]||"",a=r[4]||"",n=r[5]||"/",o=r[7]?`?${r[7]}`:"",l=r[9]?`#${r[9]}`:"";if(!s&&!a&&!n.startsWith("/")&&!n.includes("/")&&!n.includes("."))throw new TypeError("Invalid URL");let h=a.match(/^([^@]*)@(.+)$/),i="",c="",u=a;if(h){let m=h[1];u=h[2];let y=m.match(/^([^:]*):?(.*)$/);y&&(i=y[1]||"",c=y[2]||"")}let f=u.match(/^([^:]+):?(\d*)$/),d=f?f[1]:u,p=f&&f[2]?f[2]:"";return{protocol:s?`${s}:`:"",username:i,password:c,host:u,hostname:d,port:p,pathname:n,search:o,hash:l}}toString(){let e=this.searchParams.toString(),r=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${r}${this.hash}`}toJSON(){return this.toString()}};g();var dt=class Me{constructor(e,r){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(r?.method||"GET").toUpperCase(),this.headers=r?.headers instanceof w?r.headers:new w(r?.headers),this.body=r?.body,this.timeout=r?.timeout,this.signal=r?.signal||void 0}clone(){return new Me(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};g();var J=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=pt(e?.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 t=await this.text();return new TextEncoder().encode(t).buffer}};function pt(t){return t?new w(t):new w}g();var Ue=class{constructor(){this._aborted=!1,this.listeners=new Set,this.onabort=null}get aborted(){return this._aborted}_trigger(){if(!this._aborted){if(this._aborted=!0,typeof this.onabort=="function")try{this.onabort()}catch{}for(let t of Array.from(this.listeners))try{t()}catch{}this.listeners.clear()}}addEventListener(t,e){if(this._aborted){try{e()}catch{}return}this.listeners.add(e)}removeEventListener(t,e){this.listeners.delete(e)}toString(){return"[object AbortSignal]"}},ft=class{constructor(){this._signal=new Ue}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};g();function He(t){t.URL=ut,t.URLSearchParams=Re,t.Headers=w,t.Request=dt,t.Response=J,t.AbortController=ft,t.AbortSignal=Ue}var De=class{constructor(t,e,r){this.storage=t,this.customFetch=e,this.handleUnauthorized=r}async fetch(t,e){return await this.customFetch(t,e)}async fetchWithAuth(t,e){let r=await this.storage.get(E),s=new w(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let a=e?.method||"GET";if((a==="POST"||a==="PUT"||a==="PATCH")&&e?.body){let o=s.get("Content-Type");(!o||o.includes("text/plain"))&&s.set("Content-Type","application/json")}let n=await this.customFetch(t,{...e,headers:s});if(n.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return n}};g();var mt="/storage",yt=mt+"/generateUploadUrl",Fe=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+yt,{method:"POST",body:{fileName:t.name||t.fileName,fileSize:t.size||t.fileSize,fileType:t.type||t.fileType}}),{url:r}=await e.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:t,headers:new w({"Content-Type":t.type||t.fileType||"application/octet-stream"})}),{url:a}=await s.json();return{url:a.split("?")[0]}}};g();g();g();var K=ot(lt(),1),{PostgrestClient:gt,PostgrestQueryBuilder:$t,PostgrestFilterBuilder:Lt,PostgrestTransformBuilder:xt,PostgrestBuilder:At,PostgrestError:jt}=K.default||K,vt="/entities",Be=(t,e)=>new gt(t+vt,{fetch:e.fetchWithAuth.bind(e)});g();var qe=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};g();var ze=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e!=null?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};g();var Ge=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 t=document.createElement("style");t.id="__nvwa-inspector-overlay-style",t.textContent=`
2
2
  .__nvwa-inspector-overlay {
3
3
  position: absolute;
4
4
  pointer-events: none;
@@ -30,4 +30,4 @@
30
30
  max-width: 400px;
31
31
  word-break: break-all;
32
32
  }
33
- `,document.head.appendChild(t)}createTooltip(){return this.tooltip?this.tooltip:(this.tooltip=document.createElement("div"),this.tooltip.id="__nvwa-inspector-tooltip",document.body.appendChild(this.tooltip),this.tooltip)}createOverlay(t){let e=document.createElement("div");return e.className=`__nvwa-inspector-overlay __nvwa-inspector-overlay-${t}`,document.body.appendChild(e),e}updateOverlayPosition(t,e){if(!e.isConnected)return;let r=e.getBoundingClientRect(),s=window.scrollX||window.pageXOffset,a=window.scrollY||window.pageYOffset;r.width>0&&r.height>0?(t.style.left=`${r.left+s}px`,t.style.top=`${r.top+a}px`,t.style.width=`${r.width}px`,t.style.height=`${r.height}px`,t.style.display="block"):t.style.display="none"}removeOverlay(t){t&&t.parentNode&&t.parentNode.removeChild(t)}highlightElement(t,e){if(!t.isConnected)return;if(this.hoverElement===t&&this.hoverOverlay){this.updateOverlayPosition(this.hoverOverlay,t);let o=this.createTooltip();e?o.textContent=e:o.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,o.style.display="block";let l=t.getBoundingClientRect();o.style.left=`${l.left+window.scrollX}px`,o.style.top=`${l.top+window.scrollY-o.offsetHeight-8}px`,l.top<o.offsetHeight+8&&(o.style.top=`${l.bottom+window.scrollY+8}px`);return}this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null);let r=this.createOverlay("hover");this.updateOverlayPosition(r,t),this.hoverOverlay=r,this.hoverElement=t;let s=()=>{this.hoverOverlay&&this.hoverElement&&this.hoverElement.isConnected&&this.updateOverlayPosition(this.hoverOverlay,this.hoverElement)};this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler)),this.hoverUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s);let a=this.createTooltip();e?a.textContent=e:a.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,a.style.display="block";let n=t.getBoundingClientRect();a.style.left=`${n.left+window.scrollX}px`,a.style.top=`${n.top+window.scrollY-a.offsetHeight-8}px`,n.top<a.offsetHeight+8&&(a.style.top=`${n.bottom+window.scrollY+8}px`)}selectElement(t,e){if(!t.isConnected)return;if(this.selectedElement===t&&this.selectedOverlay){this.updateOverlayPosition(this.selectedOverlay,t);return}this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null);let r=this.createOverlay("selected");this.updateOverlayPosition(r,t),this.selectedOverlay=r,this.selectedElement=t;let s=()=>{this.selectedOverlay&&this.selectedElement&&this.selectedElement.isConnected&&this.updateOverlayPosition(this.selectedOverlay,this.selectedElement)};this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler)),this.selectedUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s)}removeHighlight(){this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null),this.hoverElement&&(this.hoverElement=null),this.tooltip&&(this.tooltip.style.display="none"),this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler),this.hoverUpdateHandler=null)}clearSelection(){this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null),this.selectedElement&&(this.selectedElement=null),this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler),this.selectedUpdateHandler=null)}cleanup(){this.removeHighlight(),this.clearSelection(),this.tooltip&&this.tooltip.parentNode&&(this.tooltip.parentNode.removeChild(this.tooltip),this.tooltip=null);let t=document.getElementById("__nvwa-inspector-overlay-style");t&&t.parentNode&&t.parentNode.removeChild(t)}};function Ge(t="root"){if(typeof document>"u")return null;let e=document.getElementById(t)||document.body;if(!e)return null;let r=e.querySelector("[data-source-location]");if(r){let s=r.getAttribute("data-source-location");if(s)return s}if(e.firstElementChild){let s=e.firstElementChild.getAttribute("data-source-location");if(s)return s}return null}g();var jt=typeof fetch<"u"?(t,e)=>fetch(t,e):(()=>{throw new Error("payment client requires fetch")})();var M=class{constructor(){this.prefix="nvwa_"}getKey(e){return`${this.prefix}${e}`}async get(e){try{let r=this.getKey(e),s=uni.getStorageSync(r);return s?s.expires&&Date.now()>s.expires?(await this.remove(e),null):s.value:null}catch(r){return console.error("UniAppStorageService get error:",r),null}}async set(e,r,s){try{let a=this.getKey(e),n={value:r,expires:s?Date.now()+s*1e3:null,timestamp:Date.now()};uni.setStorageSync(a,n)}catch(a){throw console.error("UniAppStorageService set error:",a),a}}async remove(e){try{let r=this.getKey(e);uni.removeStorageSync(r)}catch(r){throw console.error("UniAppStorageService remove error:",r),r}}async clear(){try{uni.clearStorageSync()}catch(e){throw console.error("UniAppStorageService clear error:",e),e}}};var L=(t,e)=>{let r;if(typeof t=="string")r=t;else if(t&&typeof t.toString=="function")r=t.toString();else if(t?.url)r=t.url;else throw new Error("Invalid input for uniappFetch");let s=(e?.method||"GET").toUpperCase(),a={};if(e?.headers){let l=e.headers;if(typeof l?.forEach=="function")l.forEach((h,i)=>{a[i]=h});else if(Array.isArray(l))for(let[h,i]of l)a[h]=i;else Object.assign(a,l)}let n;if(e?.body!==void 0){let l=e.body;if(typeof l=="string")n=l;else if(l&&typeof l=="object"&&typeof l.forEach=="function"){let h={};l.forEach((i,c)=>{h[c]=i}),n=h}else n=l}let o=e?.timeout||3e4;return new Promise((l,h)=>{let i=e?.signal;if(i?.aborted){let d=new Error("The operation was aborted");d.name="AbortError",h(d);return}let c=!1,u=[],f=uni.request({url:r,method:s,data:n,header:a,timeout:o,success:d=>{if(c)return;c=!0;let p=d.statusCode,m="",y=new w,v=d.header||d.headers||{};Object.keys(v).forEach(b=>{let _=v[b];y.set(b,typeof _=="string"?_:String(_))}),l(new G(d.data,{status:p,statusText:m,headers:y}))},fail:d=>{if(c)return;c=!0;let p=d?.errMsg||d?.message||"Network Error",m=new Error(p);/(abort|aborted|canceled|cancelled)/i.test(String(p))&&(m.name="AbortError"),h(m)}});if(i&&typeof i.addEventListener=="function"){let d=()=>{if(c)return;try{f?.abort?.()}catch{}let p=new Error("The operation was aborted");p.name="AbortError",c=!0,h(p)};i.addEventListener("abort",d),u.push(()=>{try{i.removeEventListener?.("abort",d)}catch{}})}})};typeof globalThis.fetch!="function"&&(globalThis.fetch=L);function gt(){if(typeof window>"u"||window===window.parent)return;let t=!1,e=new qe;function r(i){if(!i)return!1;let c=i.toLowerCase();return c.includes("/components/")||c.includes("\\components\\")}function s(i){let c=i,u=null;for(;c;){let f=c.getAttribute("data-source-location");if(f)if(r(f)){u||(u=f),c=c.parentElement;continue}else return f;c=c.parentElement}return u}let a=null;function n(i){t&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{let c=i.target;if(!c||c===document.body||c===document.documentElement){e.removeHighlight();return}if(c.tagName.toLowerCase()==="img"){let p=s(c);e.highlightElement(c,p);let m={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:p,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(m,"*");return}let u=c,f=s(c);if(!f){let p=c.parentElement;for(;p&&p!==document.body&&p!==document.documentElement;){let m=s(p);if(m){u=p,f=m;break}p=p.parentElement}}e.highlightElement(u,f);let d={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:f,elementInfo:{tagName:u.tagName.toLowerCase(),className:u.className||"",id:u.id||""}};window.parent.postMessage(d,"*")}))}function o(){if(!t)return;e.removeHighlight();let i={type:"HOVER_INSPECTOR_ELEMENT_LEAVE"};window.parent.postMessage(i,"*")}function l(i){if(!t)return;i.preventDefault(),i.stopPropagation();let c=i.target;if(!c||c===document.body||c===document.documentElement)return;let u=s(c);e.selectElement(c,u);let f={type:"HOVER_INSPECTOR_ELEMENT_SELECT",sourceLocation:u,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(f,"*")}function h(i){i.data?.type==="HOVER_INSPECTOR_ENABLE"?(t=!0,document.addEventListener("mousemove",n),document.addEventListener("mouseleave",o),document.addEventListener("click",l,!0)):i.data?.type==="HOVER_INSPECTOR_DISABLE"&&(t=!1,document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",o),document.removeEventListener("click",l,!0),e.removeHighlight(),e.clearSelection())}return window.addEventListener("message",h),()=>{window.removeEventListener("message",h),document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",o),document.removeEventListener("click",l,!0),e.cleanup()}}function vt(t,e){if(!t||!t.contentWindow)throw new Error("Invalid iframe element");let r={type:"HOVER_INSPECTOR_ENABLE"};t.contentWindow.postMessage(r,e)}function wt(t,e){if(!t||!t.contentWindow)return;let r={type:"HOVER_INSPECTOR_DISABLE"};t.contentWindow.postMessage(r,e)}function bt(t,e,r=5e3){return new Promise((s,a)=>{if(!t||!t.contentWindow){a(new Error("Invalid iframe element"));return}let n=`source-location-${Date.now()}-${Math.random()}`,o=setTimeout(()=>{window.removeEventListener("message",l),a(new Error("Request timeout"))},r),l=i=>{i.origin===e&&i.data?.type==="GET_SOURCE_LOCATION_RESPONSE"&&i.data?.requestId===n&&(clearTimeout(o),window.removeEventListener("message",l),i.data.error?a(new Error(i.data.error)):s(i.data.sourceLocation||null))};window.addEventListener("message",l);let h={type:"GET_SOURCE_LOCATION_REQUEST",requestId:n};try{t.contentWindow.postMessage(h,e)}catch(i){clearTimeout(o),window.removeEventListener("message",l),a(i)}})}function Et(){if(typeof window>"u"||window===window.parent)return;let t=e=>{if(e.data?.type==="GET_SOURCE_LOCATION_REQUEST")try{let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:_t(),requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}catch(r){let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:null,error:r instanceof Error?r.message:"Unknown error",requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}function _t(){return Ge("app")}var J=new M,U=class{constructor(e,r){this.auth=new Ce(e,{fetchImpl:L,storage:J}),this.httpClient=new Ue(J,L,r),this.fileStorage=new De(e,this.httpClient),this.entities=Fe(e,this.httpClient),this.functions=new Ae(this.httpClient,e),this.skill=new Be(e,this.httpClient),this.capability=new ze(e,this.httpClient)}};0&&(module.exports={disableIframeHoverInspector,enableIframeHoverInspector,getIframeSourceLocation,localStorage,polyfill,setupIframeHoverInspector,setupIframeSourceLocationListener,uniappFetch});
33
+ `,document.head.appendChild(t)}createTooltip(){return this.tooltip?this.tooltip:(this.tooltip=document.createElement("div"),this.tooltip.id="__nvwa-inspector-tooltip",document.body.appendChild(this.tooltip),this.tooltip)}createOverlay(t){let e=document.createElement("div");return e.className=`__nvwa-inspector-overlay __nvwa-inspector-overlay-${t}`,document.body.appendChild(e),e}updateOverlayPosition(t,e){if(!e.isConnected)return;let r=e.getBoundingClientRect(),s=window.scrollX||window.pageXOffset,a=window.scrollY||window.pageYOffset;r.width>0&&r.height>0?(t.style.left=`${r.left+s}px`,t.style.top=`${r.top+a}px`,t.style.width=`${r.width}px`,t.style.height=`${r.height}px`,t.style.display="block"):t.style.display="none"}removeOverlay(t){t&&t.parentNode&&t.parentNode.removeChild(t)}highlightElement(t,e){if(!t.isConnected)return;if(this.hoverElement===t&&this.hoverOverlay){this.updateOverlayPosition(this.hoverOverlay,t);let o=this.createTooltip();e?o.textContent=e:o.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,o.style.display="block";let l=t.getBoundingClientRect();o.style.left=`${l.left+window.scrollX}px`,o.style.top=`${l.top+window.scrollY-o.offsetHeight-8}px`,l.top<o.offsetHeight+8&&(o.style.top=`${l.bottom+window.scrollY+8}px`);return}this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null);let r=this.createOverlay("hover");this.updateOverlayPosition(r,t),this.hoverOverlay=r,this.hoverElement=t;let s=()=>{this.hoverOverlay&&this.hoverElement&&this.hoverElement.isConnected&&this.updateOverlayPosition(this.hoverOverlay,this.hoverElement)};this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler)),this.hoverUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s);let a=this.createTooltip();e?a.textContent=e:a.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,a.style.display="block";let n=t.getBoundingClientRect();a.style.left=`${n.left+window.scrollX}px`,a.style.top=`${n.top+window.scrollY-a.offsetHeight-8}px`,n.top<a.offsetHeight+8&&(a.style.top=`${n.bottom+window.scrollY+8}px`)}selectElement(t,e){if(!t.isConnected)return;if(this.selectedElement===t&&this.selectedOverlay){this.updateOverlayPosition(this.selectedOverlay,t);return}this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null);let r=this.createOverlay("selected");this.updateOverlayPosition(r,t),this.selectedOverlay=r,this.selectedElement=t;let s=()=>{this.selectedOverlay&&this.selectedElement&&this.selectedElement.isConnected&&this.updateOverlayPosition(this.selectedOverlay,this.selectedElement)};this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler)),this.selectedUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s)}removeHighlight(){this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null),this.hoverElement&&(this.hoverElement=null),this.tooltip&&(this.tooltip.style.display="none"),this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler),this.hoverUpdateHandler=null)}clearSelection(){this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null),this.selectedElement&&(this.selectedElement=null),this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler),this.selectedUpdateHandler=null)}cleanup(){this.removeHighlight(),this.clearSelection(),this.tooltip&&this.tooltip.parentNode&&(this.tooltip.parentNode.removeChild(this.tooltip),this.tooltip=null);let t=document.getElementById("__nvwa-inspector-overlay-style");t&&t.parentNode&&t.parentNode.removeChild(t)}};function Je(t="root"){if(typeof document>"u")return null;let e=document.getElementById(t)||document.body;if(!e)return null;let r=e.querySelector("[data-source-location]");if(r){let s=r.getAttribute("data-source-location");if(s)return s}if(e.firstElementChild){let s=e.firstElementChild.getAttribute("data-source-location");if(s)return s}return null}g();var H=class{constructor(){this.prefix="nvwa_"}getKey(e){return`${this.prefix}${e}`}async get(e){try{let r=this.getKey(e),s=uni.getStorageSync(r);return s?s.expires&&Date.now()>s.expires?(await this.remove(e),null):s.value:null}catch(r){return console.error("UniAppStorageService get error:",r),null}}async set(e,r,s){try{let a=this.getKey(e),n={value:r,expires:s?Date.now()+s*1e3:null,timestamp:Date.now()};uni.setStorageSync(a,n)}catch(a){throw console.error("UniAppStorageService set error:",a),a}}async remove(e){try{let r=this.getKey(e);uni.removeStorageSync(r)}catch(r){throw console.error("UniAppStorageService remove error:",r),r}}async clear(){try{uni.clearStorageSync()}catch(e){throw console.error("UniAppStorageService clear error:",e),e}}};var j=(t,e)=>{let r;if(typeof t=="string")r=t;else if(t&&typeof t.toString=="function")r=t.toString();else if(t?.url)r=t.url;else throw new Error("Invalid input for uniappFetch");let s=(e?.method||"GET").toUpperCase(),a={};if(e?.headers){let l=e.headers;if(typeof l?.forEach=="function")l.forEach((h,i)=>{a[i]=h});else if(Array.isArray(l))for(let[h,i]of l)a[h]=i;else Object.assign(a,l)}let n;if(e?.body!==void 0){let l=e.body;if(typeof l=="string")n=l;else if(l&&typeof l=="object"&&typeof l.forEach=="function"){let h={};l.forEach((i,c)=>{h[c]=i}),n=h}else n=l}let o=e?.timeout||3e4;return new Promise((l,h)=>{let i=e?.signal;if(i?.aborted){let d=new Error("The operation was aborted");d.name="AbortError",h(d);return}let c=!1,u=[],f=uni.request({url:r,method:s,data:n,header:a,timeout:o,success:d=>{if(c)return;c=!0;let p=d.statusCode,m="",y=new w,v=d.header||d.headers||{};Object.keys(v).forEach(b=>{let P=v[b];y.set(b,typeof P=="string"?P:String(P))}),l(new J(d.data,{status:p,statusText:m,headers:y}))},fail:d=>{if(c)return;c=!0;let p=d?.errMsg||d?.message||"Network Error",m=new Error(p);/(abort|aborted|canceled|cancelled)/i.test(String(p))&&(m.name="AbortError"),h(m)}});if(i&&typeof i.addEventListener=="function"){let d=()=>{if(c)return;try{f?.abort?.()}catch{}let p=new Error("The operation was aborted");p.name="AbortError",c=!0,h(p)};i.addEventListener("abort",d),u.push(()=>{try{i.removeEventListener?.("abort",d)}catch{}})}})};typeof globalThis.fetch!="function"&&(globalThis.fetch=j);var _="Mobile-web";_="MP-Wechat";_="MP-Alipay";_=typeof navigator<"u"&&/MicroMessenger/i.test(navigator.userAgent)?"Wechat-H5":"Mobile-web";_="Android";_="IOS";_="Harmony";var We={async requestPayment(t){let e=t,r=e.jsapiPayParams??e;if(typeof r.timeStamp=="string"&&typeof r.nonceStr=="string"&&typeof r.package=="string"&&typeof r.paySign=="string"){await new Promise((a,n)=>{uni.requestPayment({provider:"wxpay",timeStamp:r.timeStamp,nonceStr:r.nonceStr,package:r.package,signType:r.signType??"RSA",paySign:r.paySign,success:()=>a(),fail:o=>n(o)})});return}if(typeof e.redirectUrl=="string"){typeof window<"u"?window.location.href=e.redirectUrl:globalThis.plus?.runtime?.openURL?.(e.redirectUrl);return}if(typeof e.codeUrl=="string"){let a=`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(e.codeUrl)}`;typeof window<"u"?window.open(a,"_blank"):globalThis.plus?.runtime?.openURL?.(a);return}throw new Error("requestPayment: unsupported payParams for current endpoint")}};function wt(){if(typeof window>"u"||window===window.parent)return;let t=!1,e=new Ge;function r(i){if(!i)return!1;let c=i.toLowerCase();return c.includes("/components/")||c.includes("\\components\\")}function s(i){let c=i,u=null;for(;c;){let f=c.getAttribute("data-source-location");if(f)if(r(f)){u||(u=f),c=c.parentElement;continue}else return f;c=c.parentElement}return u}let a=null;function n(i){t&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{let c=i.target;if(!c||c===document.body||c===document.documentElement){e.removeHighlight();return}if(c.tagName.toLowerCase()==="img"){let p=s(c);e.highlightElement(c,p);let m={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:p,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(m,"*");return}let u=c,f=s(c);if(!f){let p=c.parentElement;for(;p&&p!==document.body&&p!==document.documentElement;){let m=s(p);if(m){u=p,f=m;break}p=p.parentElement}}e.highlightElement(u,f);let d={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:f,elementInfo:{tagName:u.tagName.toLowerCase(),className:u.className||"",id:u.id||""}};window.parent.postMessage(d,"*")}))}function o(){if(!t)return;e.removeHighlight();let i={type:"HOVER_INSPECTOR_ELEMENT_LEAVE"};window.parent.postMessage(i,"*")}function l(i){if(!t)return;i.preventDefault(),i.stopPropagation();let c=i.target;if(!c||c===document.body||c===document.documentElement)return;let u=s(c);e.selectElement(c,u);let f={type:"HOVER_INSPECTOR_ELEMENT_SELECT",sourceLocation:u,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(f,"*")}function h(i){i.data?.type==="HOVER_INSPECTOR_ENABLE"?(t=!0,document.addEventListener("mousemove",n),document.addEventListener("mouseleave",o),document.addEventListener("click",l,!0)):i.data?.type==="HOVER_INSPECTOR_DISABLE"&&(t=!1,document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",o),document.removeEventListener("click",l,!0),e.removeHighlight(),e.clearSelection())}return window.addEventListener("message",h),()=>{window.removeEventListener("message",h),document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",o),document.removeEventListener("click",l,!0),e.cleanup()}}function bt(t,e){if(!t||!t.contentWindow)throw new Error("Invalid iframe element");let r={type:"HOVER_INSPECTOR_ENABLE"};t.contentWindow.postMessage(r,e)}function Et(t,e){if(!t||!t.contentWindow)return;let r={type:"HOVER_INSPECTOR_DISABLE"};t.contentWindow.postMessage(r,e)}function _t(t,e,r=5e3){return new Promise((s,a)=>{if(!t||!t.contentWindow){a(new Error("Invalid iframe element"));return}let n=`source-location-${Date.now()}-${Math.random()}`,o=setTimeout(()=>{window.removeEventListener("message",l),a(new Error("Request timeout"))},r),l=i=>{i.origin===e&&i.data?.type==="GET_SOURCE_LOCATION_RESPONSE"&&i.data?.requestId===n&&(clearTimeout(o),window.removeEventListener("message",l),i.data.error?a(new Error(i.data.error)):s(i.data.sourceLocation||null))};window.addEventListener("message",l);let h={type:"GET_SOURCE_LOCATION_REQUEST",requestId:n};try{t.contentWindow.postMessage(h,e)}catch(i){clearTimeout(o),window.removeEventListener("message",l),a(i)}})}function Pt(){if(typeof window>"u"||window===window.parent)return;let t=e=>{if(e.data?.type==="GET_SOURCE_LOCATION_REQUEST")try{let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:Ot(),requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}catch(r){let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:null,error:r instanceof Error?r.message:"Unknown error",requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}function Ot(){return Je("app")}var W=new H,D=class{constructor(e,r){this.payment=We;this.endpointType=_;this.auth=new Ie(e,{fetchImpl:j,storage:W}),this.httpClient=new De(W,j,r),this.fileStorage=new Fe(e,this.httpClient),this.entities=Be(e,this.httpClient),this.functions=new Ce(this.httpClient,e),this.skill=new qe(e,this.httpClient),this.capability=new ze(e,this.httpClient)}};0&&(module.exports={disableIframeHoverInspector,enableIframeHoverInspector,getIframeSourceLocation,localStorage,polyfill,setupIframeHoverInspector,setupIframeSourceLocationListener,uniappFetch});
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var Ge=Object.create,M=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,We=Object.getOwnPropertyNames,Ke=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty,W=(t,e)=>()=>(t&&(e=t(t=0)),e),P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ye=(t,e)=>{for(var r in e)M(t,r,{get:e[r],enumerable:!0})},K=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of We(e))!Ve.call(t,a)&&a!==r&&M(t,a,{get:()=>e[a],enumerable:!(s=Je(e,a))||s.enumerable});return t},Qe=(t,e,r)=>(r=t!=null?Ge(Ke(t)):{},K(e||!t||!t.__esModule?M(r,"default",{value:t,enumerable:!0}):r,t)),$=t=>K(M({},"__esModule",{value:!0}),t),g=W(()=>{"use strict"}),S={};Ye(S,{__addDisposableResource:()=>we,__assign:()=>L,__asyncDelegator:()=>ue,__asyncGenerator:()=>he,__asyncValues:()=>de,__await:()=>T,__awaiter:()=>ae,__classPrivateFieldGet:()=>ye,__classPrivateFieldIn:()=>ve,__classPrivateFieldSet:()=>ge,__createBinding:()=>j,__decorate:()=>Q,__disposeResources:()=>be,__esDecorate:()=>Z,__exportStar:()=>oe,__extends:()=>V,__generator:()=>ne,__importDefault:()=>me,__importStar:()=>fe,__makeTemplateObject:()=>pe,__metadata:()=>se,__param:()=>X,__propKey:()=>te,__read:()=>B,__rest:()=>Y,__rewriteRelativeImportExtension:()=>Ee,__runInitializers:()=>ee,__setFunctionName:()=>re,__spread:()=>ie,__spreadArray:()=>ce,__spreadArrays:()=>le,__values:()=>R,default:()=>Pe});function V(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");I(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Y(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(t);a<s.length;a++)e.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(t,s[a])&&(r[s[a]]=t[s[a]]);return r}function Q(t,e,r,s){var a=arguments.length,n=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,r,s);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(n=(a<3?o(n):a>3?o(e,r,n):o(e,r))||n);return a>3&&n&&Object.defineProperty(e,r,n),n}function X(t,e){return function(r,s){e(r,s,t)}}function Z(t,e,r,s,a,n){function o(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var l=s.kind,h=l==="getter"?"get":l==="setter"?"set":"value",i=!e&&t?s.static?t:t.prototype:null,c=e||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),u,f=!1,d=r.length-1;d>=0;d--){var p={};for(var m in s)p[m]=m==="access"?{}:s[m];for(var m in s.access)p.access[m]=s.access[m];p.addInitializer=function(v){if(f)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(v||null))};var y=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[h],p);if(l==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(u=o(y.get))&&(c.get=u),(u=o(y.set))&&(c.set=u),(u=o(y.init))&&a.unshift(u)}else(u=o(y))&&(l==="field"?a.unshift(u):c[h]=u)}i&&Object.defineProperty(i,s.name,c),f=!0}function ee(t,e,r){for(var s=arguments.length>2,a=0;a<e.length;a++)r=s?e[a].call(t,r):e[a].call(t);return s?r:void 0}function te(t){return typeof t=="symbol"?t:"".concat(t)}function re(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function se(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ae(t,e,r,s){function a(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function l(c){try{i(s.next(c))}catch(u){o(u)}}function h(c){try{i(s.throw(c))}catch(u){o(u)}}function i(c){c.done?n(c.value):a(c.value).then(l,h)}i((s=s.apply(t,e||[])).next())})}function ne(t,e){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,a,n,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(i){return function(c){return h([i,c])}}function h(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(s=1,a&&(n=i[0]&2?a.return:i[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,i[1])).done)return n;switch(a=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++,a=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=e.call(t,r)}catch(c){i=[6,c],a=0}finally{s=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function oe(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&j(e,t,r)}function R(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function B(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),a,n=[],o;try{for(;(e===void 0||e-- >0)&&!(a=s.next()).done;)n.push(a.value)}catch(l){o={error:l}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return n}function ie(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(B(arguments[e]));return t}function le(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var s=Array(t),a=0,e=0;e<r;e++)for(var n=arguments[e],o=0,l=n.length;o<l;o++,a++)s[a]=n[o];return s}function ce(t,e,r){if(r||arguments.length===2)for(var s=0,a=e.length,n;s<a;s++)(n||!(s in e))&&(n||(n=Array.prototype.slice.call(e,0,s)),n[s]=e[s]);return t.concat(n||Array.prototype.slice.call(e))}function T(t){return this instanceof T?(this.v=t,this):new T(t)}function he(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(t,e||[]),a,n=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),a[Symbol.asyncIterator]=function(){return this},a;function o(d){return function(p){return Promise.resolve(p).then(d,u)}}function l(d,p){s[d]&&(a[d]=function(m){return new Promise(function(y,v){n.push([d,m,y,v])>1||h(d,m)})},p&&(a[d]=p(a[d])))}function h(d,p){try{i(s[d](p))}catch(m){f(n[0][3],m)}}function i(d){d.value instanceof T?Promise.resolve(d.value.v).then(c,u):f(n[0][2],d)}function c(d){h("next",d)}function u(d){h("throw",d)}function f(d,p){d(p),n.shift(),n.length&&h(n[0][0],n[0][1])}}function ue(t){var e,r;return e={},s("next"),s("throw",function(a){throw a}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(a,n){e[a]=t[a]?function(o){return(r=!r)?{value:T(t[a](o)),done:!1}:n?n(o):o}:n}}function de(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof R=="function"?R(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(n){r[n]=t[n]&&function(o){return new Promise(function(l,h){o=t[n](o),a(l,h,o.done,o.value)})}}function a(n,o,l,h){Promise.resolve(h).then(function(i){n({value:i,done:l})},o)}}function pe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function fe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=N(t),s=0;s<r.length;s++)r[s]!=="default"&&j(e,t,r[s]);return _e(e,t),e}function me(t){return t&&t.__esModule?t:{default:t}}function ye(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}function ge(t,e,r,s,a){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?a.call(t,r):a?a.value=r:e.set(t,r),r}function ve(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function we(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var s,a;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=e[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=e[Symbol.dispose],r&&(a=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");a&&(s=function(){try{a.call(this)}catch(n){return Promise.reject(n)}}),t.stack.push({value:e,dispose:s,async:r})}else r&&t.stack.push({async:!0});return e}function be(t){function e(n){t.error=t.hasError?new Oe(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}var r,s=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&s===1)return s=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var n=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(n).then(a,function(o){return e(o),a()})}else s|=1}catch(o){e(o)}if(s===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}function Ee(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,a,n,o){return s?e?".jsx":".js":a&&(!n||!o)?r:a+n+"."+o.toLowerCase()+"js"}):t}var I,L,j,_e,N,Oe,Pe,x=W(()=>{"use strict";g(),I=function(t,e){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(r[a]=s[a])},I(t,e)},L=function(){return L=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},L.apply(this,arguments)},j=Object.create?(function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),_e=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},N=function(t){return N=Object.getOwnPropertyNames||function(e){var r=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[r.length]=s);return r},N(t)},Oe=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var s=new Error(r);return s.name="SuppressedError",s.error=t,s.suppressed=e,s},Pe={__extends:V,__assign:L,__rest:Y,__decorate:Q,__param:X,__esDecorate:Z,__runInitializers:ee,__propKey:te,__setFunctionName:re,__metadata:se,__awaiter:ae,__generator:ne,__createBinding:j,__exportStar:oe,__values:R,__read:B,__spread:ie,__spreadArrays:le,__spreadArray:ce,__await:T,__asyncGenerator:he,__asyncDelegator:ue,__asyncValues:de,__makeTemplateObject:pe,__importStar:fe,__importDefault:me,__classPrivateFieldGet:ye,__classPrivateFieldSet:ge,__classPrivateFieldIn:ve,__addDisposableResource:we,__disposeResources:be,__rewriteRelativeImportExtension:Ee}}),Se=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};t.default=e}),Te=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(x(),$(S)),r=e.__importDefault(Se()),s=class{constructor(a){var n,o;this.shouldThrowOnError=!1,this.method=a.method,this.url=a.url,this.headers=new Headers(a.headers),this.schema=a.schema,this.body=a.body,this.shouldThrowOnError=(n=a.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=a.signal,this.isMaybeSingle=(o=a.isMaybeSingle)!==null&&o!==void 0?o:!1,a.fetch?this.fetch=a.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(a,n){return this.headers=new Headers(this.headers),this.headers.set(a,n),this}then(a,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 o=this.fetch,l=o(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async h=>{var i,c,u,f;let d=null,p=null,m=null,y=h.status,v=h.statusText;if(h.ok){if(this.method!=="HEAD"){let D=await h.text();D===""||(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")?p=D:p=JSON.parse(D))}let b=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),_=(u=h.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");b&&_&&_.length>1&&(m=parseInt(_[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(p)&&(p.length>1?(d={code:"PGRST116",details:`Results contain ${p.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},p=null,m=null,y=406,v="Not Acceptable"):p.length===1?p=p[0]:p=null)}else{let b=await h.text();try{d=JSON.parse(b),Array.isArray(d)&&h.status===404&&(p=[],d=null,y=200,v="OK")}catch{h.status===404&&b===""?(y=204,v="No Content"):d={message:b}}if(d&&this.isMaybeSingle&&!((f=d?.details)===null||f===void 0)&&f.includes("0 rows")&&(d=null,y=200,v="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:p,count:m,status:y,statusText:v}});return this.shouldThrowOnError||(l=l.catch(h=>{var i,c,u;return{error:{message:`${(i=h?.name)!==null&&i!==void 0?i:"FetchError"}: ${h?.message}`,details:`${(c=h?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(u=h?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),l.then(a,n)}returns(){return this}overrideTypes(){return this}};t.default=s}),$e=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(x(),$(S)),r=e.__importDefault(Te()),s=class extends r.default{select(a){let n=!1,o=(a??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",o),this.headers.append("Prefer","return=representation"),this}order(a,{ascending:n=!0,nullsFirst:o,foreignTable:l,referencedTable:h=l}={}){let i=h?`${h}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${a}.${n?"asc":"desc"}${o===void 0?"":o?".nullsfirst":".nullslast"}`),this}limit(a,{foreignTable:n,referencedTable:o=n}={}){let l=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(l,`${a}`),this}range(a,n,{foreignTable:o,referencedTable:l=o}={}){let h=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(h,`${a}`),this.url.searchParams.set(i,`${n-a+1}`),this}abortSignal(a){return this.signal=a,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:a=!1,verbose:n=!1,settings:o=!1,buffers:l=!1,wal:h=!1,format:i="text"}={}){var c;let u=[a?"analyze":null,n?"verbose":null,o?"settings":null,l?"buffers":null,h?"wal":null].filter(Boolean).join("|"),f=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${f}"; options=${u};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(a){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${a}`),this}};t.default=s}),z=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(x(),$(S)),r=e.__importDefault($e()),s=new RegExp("[,()]"),a=class extends r.default{eq(n,o){return this.url.searchParams.append(n,`eq.${o}`),this}neq(n,o){return this.url.searchParams.append(n,`neq.${o}`),this}gt(n,o){return this.url.searchParams.append(n,`gt.${o}`),this}gte(n,o){return this.url.searchParams.append(n,`gte.${o}`),this}lt(n,o){return this.url.searchParams.append(n,`lt.${o}`),this}lte(n,o){return this.url.searchParams.append(n,`lte.${o}`),this}like(n,o){return this.url.searchParams.append(n,`like.${o}`),this}likeAllOf(n,o){return this.url.searchParams.append(n,`like(all).{${o.join(",")}}`),this}likeAnyOf(n,o){return this.url.searchParams.append(n,`like(any).{${o.join(",")}}`),this}ilike(n,o){return this.url.searchParams.append(n,`ilike.${o}`),this}ilikeAllOf(n,o){return this.url.searchParams.append(n,`ilike(all).{${o.join(",")}}`),this}ilikeAnyOf(n,o){return this.url.searchParams.append(n,`ilike(any).{${o.join(",")}}`),this}is(n,o){return this.url.searchParams.append(n,`is.${o}`),this}in(n,o){let l=Array.from(new Set(o)).map(h=>typeof h=="string"&&s.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(n,`in.(${l})`),this}contains(n,o){return typeof o=="string"?this.url.searchParams.append(n,`cs.${o}`):Array.isArray(o)?this.url.searchParams.append(n,`cs.{${o.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(o)}`),this}containedBy(n,o){return typeof o=="string"?this.url.searchParams.append(n,`cd.${o}`):Array.isArray(o)?this.url.searchParams.append(n,`cd.{${o.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(o)}`),this}rangeGt(n,o){return this.url.searchParams.append(n,`sr.${o}`),this}rangeGte(n,o){return this.url.searchParams.append(n,`nxl.${o}`),this}rangeLt(n,o){return this.url.searchParams.append(n,`sl.${o}`),this}rangeLte(n,o){return this.url.searchParams.append(n,`nxr.${o}`),this}rangeAdjacent(n,o){return this.url.searchParams.append(n,`adj.${o}`),this}overlaps(n,o){return typeof o=="string"?this.url.searchParams.append(n,`ov.${o}`):this.url.searchParams.append(n,`ov.{${o.join(",")}}`),this}textSearch(n,o,{config:l,type:h}={}){let i="";h==="plain"?i="pl":h==="phrase"?i="ph":h==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(n,`${i}fts${c}.${o}`),this}match(n){return Object.entries(n).forEach(([o,l])=>{this.url.searchParams.append(o,`eq.${l}`)}),this}not(n,o,l){return this.url.searchParams.append(n,`not.${o}.${l}`),this}or(n,{foreignTable:o,referencedTable:l=o}={}){let h=l?`${l}.or`:"or";return this.url.searchParams.append(h,`(${n})`),this}filter(n,o,l){return this.url.searchParams.append(n,`${o}.${l}`),this}};t.default=a}),xe=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(x(),$(S)),r=e.__importDefault(z()),s=class{constructor(a,{headers:n={},schema:o,fetch:l}){this.url=a,this.headers=new Headers(n),this.schema=o,this.fetch=l}select(a,n){let{head:o=!1,count:l}=n??{},h=o?"HEAD":"GET",i=!1,c=(a??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(a,{count:n,defaultToNull:o=!0}={}){var l;let h="POST";if(n&&this.headers.append("Prefer",`count=${n}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(a)){let i=a.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(i.length>0){let c=[...new Set(i)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(a,{onConflict:n,ignoreDuplicates:o=!1,count:l,defaultToNull:h=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${o?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),l&&this.headers.append("Prefer",`count=${l}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(a)){let u=a.reduce((f,d)=>f.concat(Object.keys(d)),[]);if(u.length>0){let f=[...new Set(u)].map(d=>`"${d}"`);this.url.searchParams.set("columns",f.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(a,{count:n}={}){var o;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:a,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}delete({count:a}={}){var n;let o="DELETE";return a&&this.headers.append("Prefer",`count=${a}`),new r.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};t.default=s}),Xe=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(x(),$(S)),r=e.__importDefault(xe()),s=e.__importDefault(z()),a=class Le{constructor(o,{headers:l={},schema:h,fetch:i}={}){this.url=o,this.headers=new Headers(l),this.schemaName=h,this.fetch=i}from(o){let l=new URL(`${this.url}/${o}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new Le(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,l={},{head:h=!1,get:i=!1,count:c}={}){var u;let f,d=new URL(`${this.url}/rpc/${o}`),p;h||i?(f=h?"HEAD":"GET",Object.entries(l).filter(([y,v])=>v!==void 0).map(([y,v])=>[y,Array.isArray(v)?`{${v.join(",")}}`:`${v}`]).forEach(([y,v])=>{d.searchParams.append(y,v)})):(f="POST",p=l);let m=new Headers(this.headers);return c&&m.set("Prefer",`count=${c}`),new s.default({method:f,url:d,headers:m,schema:this.schemaName,body:p,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};t.default=a}),Ze=P(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestError=t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;var e=(x(),$(S)),r=e.__importDefault(Xe());t.PostgrestClient=r.default;var s=e.__importDefault(xe());t.PostgrestQueryBuilder=s.default;var a=e.__importDefault(z());t.PostgrestFilterBuilder=a.default;var n=e.__importDefault($e());t.PostgrestTransformBuilder=n.default;var o=e.__importDefault(Te());t.PostgrestBuilder=o.default;var l=e.__importDefault(Se());t.PostgrestError=l.default,t.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:a.default,PostgrestTransformBuilder:n.default,PostgrestBuilder:o.default,PostgrestError:l.default}});g();g();var je=class{constructor(t,e=""){this.http=t,this.baseUrl=e.replace(/\/$/,"")}async invoke(t,e){let r=this.baseUrl?`${this.baseUrl}/functions/${t}`:`/functions/${t}`;return await(await this.http.fetch(r,{method:e.method||"POST",body:e.body,headers:e.headers})).json()}};g();g();var E="nvwa_current_jwt",O="nvwa_login_token",C="nvwa_user_profile",et="set-auth-token",tt=typeof fetch<"u"?(t,e)=>fetch(t,e):()=>{throw new Error("AuthClient requires fetch")},Ae=class{constructor(t,e={}){this.baseUrl=t.replace(/\/$/,""),this.authPath=(e.authPath??"/auth").replace(/^\//,""),this.fetchImpl=e.fetchImpl??tt,this.storage=e.storage??null,this.credentials=e.credentials??"omit"}async currentUser(){if(this.storage){let r=await this.storage.get(C);if(r!=null)return r}let{data:t}=await this.getSession(),e=t?.user??null;return e&&this.storage&&await this.storage.set(C,e),e}async getCurrentJwt(){if(this.storage){let e=await this.storage.get(E);if(e!=null)return e;let r=await this.storage.get(O),{data:s}=await this.getToken(r??void 0);return s?.token?(await this.storage.set(E,s.token),s.token):null}let{data:t}=await this.getToken();return t?.token??null}async persistLogin(t,e){if(!this.storage)return;let r=e?.headers.get(et)?.trim()||t.token||t.session?.token;r&&await this.storage.set(O,r),t.user&&await this.storage.set(C,t.user);let s=r??await this.storage.get(O),{data:a}=await this.getToken(s??void 0);a?.token&&await this.storage.set(E,a.token)}async clearLogin(){this.storage&&(await this.storage.remove(O),await this.storage.remove(C),await this.storage.remove(E))}url(t){let e=`${`${this.baseUrl.replace(/\/+$/,"")}/${this.authPath.replace(/^\/+/,"")}`}/${t.replace(/^\/+/,"")}`;return typeof console<"u"&&console.debug&&console.debug("[NvwaAuth] request URL:",e),e}async getSession(){try{let t={};if(this.storage){let r=await this.storage.get(O)??await this.storage.get(E);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("session"),{method:"GET",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return e.ok?{data:await e.json()}:{data:null,error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{data:null,error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signInWithEmail(t,e){try{let r=await this.fetchImpl(this.url("sign-in/email"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify({email:t,password:e})}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return a&&await this.persistLogin({user:a.user,session:a.session},r),{data:a}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async signOut(){try{let t={};if(this.storage){let r=await this.storage.get(O)??await this.storage.get(E);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("sign-out"),{method:"POST",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return await this.clearLogin(),e.ok?{}:{error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signUp(t){let e=await this.postJson("sign-up/email",t);return e.data&&await this.persistLogin(e.data,e.response),e}async getToken(t){try{let e={};if(t)e.Authorization=`Bearer ${t}`;else if(this.storage){let n=await this.storage.get(O)??await this.storage.get(E);n!=null&&(e.Authorization=`Bearer ${n}`)}let r=await this.fetchImpl(this.url("token"),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return{data:a?.token!=null?{token:a.token}:void 0}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async signInWithUsername(t,e){let r=await this.postJson("sign-in/username",{username:t,password:e});return r.data&&await this.persistLogin(r.data,r.response),r}async signInWithPhoneNumber(t,e,r){let s=await this.postJson("sign-in/phone-number",{phoneNumber:t,password:e,rememberMe:r});return s.data&&await this.persistLogin(s.data,s.response),s}async sendPhoneNumberOtp(t){let e=await this.postJson("phone-number/send-otp",{phoneNumber:t});return e.error?{error:e.error}:{}}async verifyPhoneNumber(t,e){let r=await this.postJson("phone-number/verify",{phoneNumber:t,code:e});return r.data&&await this.persistLogin(r.data,r.response),r}async postJson(t,e){try{let r=await this.fetchImpl(this.url(t),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify(e)}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return{data:a?.data??a??void 0,response:r}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}};g();g();var w=class Ce{constructor(e){if(this.headerMap=new Map,e){if(e instanceof Ce)e.forEach((r,s)=>this.set(s,r));else if(Array.isArray(e))for(let[r,s]of e)this.set(r,String(s));else if(typeof e=="object")for(let r of Object.keys(e))this.set(r,String(e[r]))}}append(e,r){let s=e.toLowerCase(),a=this.headerMap.get(s);this.headerMap.set(s,a?`${a}, ${r}`:r)}set(e,r){this.headerMap.set(e.toLowerCase(),String(r))}get(e){return this.headerMap.get(e.toLowerCase())??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[r,s]of this.headerMap.entries())e(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},Ie=class Ne{constructor(e){if(this.params=new Map,e){if(typeof e=="string")this.parseString(e);else if(e instanceof Ne)this.params=new Map(e.params);else if(Array.isArray(e))for(let[r,s]of e)this.append(r,s);else if(e&&typeof e=="object")for(let[r,s]of Object.entries(e))this.set(r,s)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let r=e.split("&");for(let s of r)if(s){let[a,n]=s.split("=");a&&this.append(decodeURIComponent(a),n?decodeURIComponent(n):"")}}append(e,r){let s=this.params.get(e)||[];s.push(r),this.params.set(e,s)}delete(e){this.params.delete(e)}get(e){let r=this.params.get(e);return r?r[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,r){this.params.set(e,[r])}sort(){let e=Array.from(this.params.entries()).sort(([r],[s])=>r.localeCompare(s));this.params=new Map(e)}toString(){let e=[];for(let[r,s]of this.params.entries())for(let a of s)e.push(`${encodeURIComponent(r)}=${encodeURIComponent(a)}`);return e.join("&")}forEach(e){for(let[r,s]of this.params.entries())for(let a of s)e(a,r,this)}keys(){return this.params.keys()}values(){let e=[];for(let r of this.params.values())e.push(...r);return e[Symbol.iterator]()}entries(){let e=[];for(let[r,s]of this.params.entries())for(let a of s)e.push([r,a]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},rt=class F{constructor(e,r){let s;if(e instanceof F)s=e.href;else if(r){let n=r instanceof F?r.href:r;s=this.resolve(n,e)}else s=e;let a=this.parseUrl(s);this.href=s,this.origin=`${a.protocol}//${a.host}`,this.protocol=a.protocol,this.username=a.username,this.password=a.password,this.host=a.host,this.hostname=a.hostname,this.port=a.port,this.pathname=a.pathname,this.search=a.search,this.searchParams=new Ie(a.search),this.hash=a.hash}resolve(e,r){if(r.startsWith("http://")||r.startsWith("https://"))return r;if(r.startsWith("//"))return`${this.parseUrl(e).protocol}${r}`;if(r.startsWith("/")){let n=this.parseUrl(e);return`${n.protocol}//${n.host}${r}`}let s=this.parseUrl(e),a=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return`${s.protocol}//${s.host}${a}${r}`}parseUrl(e){let r=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!r)throw new TypeError("Invalid URL");let s=r[2]||"",a=r[4]||"",n=r[5]||"/",o=r[7]?`?${r[7]}`:"",l=r[9]?`#${r[9]}`:"";if(!s&&!a&&!n.startsWith("/")&&!n.includes("/")&&!n.includes("."))throw new TypeError("Invalid URL");let h=a.match(/^([^@]*)@(.+)$/),i="",c="",u=a;if(h){let m=h[1];u=h[2];let y=m.match(/^([^:]*):?(.*)$/);y&&(i=y[1]||"",c=y[2]||"")}let f=u.match(/^([^:]+):?(\d*)$/),d=f?f[1]:u,p=f&&f[2]?f[2]:"";return{protocol:s?`${s}:`:"",username:i,password:c,host:u,hostname:d,port:p,pathname:n,search:o,hash:l}}toString(){let e=this.searchParams.toString(),r=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${r}${this.hash}`}toJSON(){return this.toString()}};g();var st=class Re{constructor(e,r){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(r?.method||"GET").toUpperCase(),this.headers=r?.headers instanceof w?r.headers:new w(r?.headers),this.body=r?.body,this.timeout=r?.timeout,this.signal=r?.signal||void 0}clone(){return new Re(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};g();var q=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=at(e?.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 t=await this.text();return new TextEncoder().encode(t).buffer}};function at(t){return t?new w(t):new w}g();var ke=class{constructor(){this._aborted=!1,this.listeners=new Set,this.onabort=null}get aborted(){return this._aborted}_trigger(){if(!this._aborted){if(this._aborted=!0,typeof this.onabort=="function")try{this.onabort()}catch{}for(let t of Array.from(this.listeners))try{t()}catch{}this.listeners.clear()}}addEventListener(t,e){if(this._aborted){try{e()}catch{}return}this.listeners.add(e)}removeEventListener(t,e){this.listeners.delete(e)}toString(){return"[object AbortSignal]"}},nt=class{constructor(){this._signal=new ke}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};g();function ot(t){t.URL=rt,t.URLSearchParams=Ie,t.Headers=w,t.Request=st,t.Response=q,t.AbortController=nt,t.AbortSignal=ke}var He=class{constructor(t,e,r){this.storage=t,this.customFetch=e,this.handleUnauthorized=r}async fetch(t,e){return await this.customFetch(t,e)}async fetchWithAuth(t,e){let r=await this.storage.get(E),s=new w(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let a=e?.method||"GET";if((a==="POST"||a==="PUT"||a==="PATCH")&&e?.body){let o=s.get("Content-Type");(!o||o.includes("text/plain"))&&s.set("Content-Type","application/json")}let n=await this.customFetch(t,{...e,headers:s});if(n.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return n}};g();var it="/storage",lt=it+"/generateUploadUrl",Me=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+lt,{method:"POST",body:{fileName:t.name||t.fileName,fileSize:t.size||t.fileSize,fileType:t.type||t.fileType}}),{url:r}=await e.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:t,headers:new w({"Content-Type":t.type||t.fileType||"application/octet-stream"})}),{url:a}=await s.json();return{url:a.split("?")[0]}}};g();g();g();var J=Qe(Ze(),1),{PostgrestClient:ct,PostgrestQueryBuilder:dt,PostgrestFilterBuilder:pt,PostgrestTransformBuilder:ft,PostgrestBuilder:mt,PostgrestError:yt}=J.default||J,ht="/entities",Ue=(t,e)=>new ct(t+ht,{fetch:e.fetchWithAuth.bind(e)});g();var De=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};g();var Fe=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e!=null?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};g();var Be=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 t=document.createElement("style");t.id="__nvwa-inspector-overlay-style",t.textContent=`
1
+ var We=Object.create,H=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Ve=Object.getOwnPropertyNames,Ye=Object.getPrototypeOf,Qe=Object.prototype.hasOwnProperty,K=(t,e)=>()=>(t&&(e=t(t=0)),e),S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xe=(t,e)=>{for(var r in e)H(t,r,{get:e[r],enumerable:!0})},V=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ve(e))!Qe.call(t,a)&&a!==r&&H(t,a,{get:()=>e[a],enumerable:!(s=Ke(e,a))||s.enumerable});return t},Ze=(t,e,r)=>(r=t!=null?We(Ye(t)):{},V(e||!t||!t.__esModule?H(r,"default",{value:t,enumerable:!0}):r,t)),A=t=>V(H({},"__esModule",{value:!0}),t),g=K(()=>{"use strict"}),T={};Xe(T,{__addDisposableResource:()=>be,__assign:()=>C,__asyncDelegator:()=>de,__asyncGenerator:()=>ue,__asyncValues:()=>pe,__await:()=>$,__awaiter:()=>ne,__classPrivateFieldGet:()=>ge,__classPrivateFieldIn:()=>we,__classPrivateFieldSet:()=>ve,__createBinding:()=>I,__decorate:()=>X,__disposeResources:()=>Ee,__esDecorate:()=>ee,__exportStar:()=>ie,__extends:()=>Y,__generator:()=>oe,__importDefault:()=>ye,__importStar:()=>me,__makeTemplateObject:()=>fe,__metadata:()=>ae,__param:()=>Z,__propKey:()=>re,__read:()=>q,__rest:()=>Q,__rewriteRelativeImportExtension:()=>_e,__runInitializers:()=>te,__setFunctionName:()=>se,__spread:()=>le,__spreadArray:()=>he,__spreadArrays:()=>ce,__values:()=>U,default:()=>Se});function Y(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");k(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Q(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(t);a<s.length;a++)e.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(t,s[a])&&(r[s[a]]=t[s[a]]);return r}function X(t,e,r,s){var a=arguments.length,n=a<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,r,s);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(n=(a<3?o(n):a>3?o(e,r,n):o(e,r))||n);return a>3&&n&&Object.defineProperty(e,r,n),n}function Z(t,e){return function(r,s){e(r,s,t)}}function ee(t,e,r,s,a,n){function o(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var l=s.kind,h=l==="getter"?"get":l==="setter"?"set":"value",i=!e&&t?s.static?t:t.prototype:null,c=e||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),u,f=!1,d=r.length-1;d>=0;d--){var p={};for(var m in s)p[m]=m==="access"?{}:s[m];for(var m in s.access)p.access[m]=s.access[m];p.addInitializer=function(v){if(f)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(v||null))};var y=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[h],p);if(l==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(u=o(y.get))&&(c.get=u),(u=o(y.set))&&(c.set=u),(u=o(y.init))&&a.unshift(u)}else(u=o(y))&&(l==="field"?a.unshift(u):c[h]=u)}i&&Object.defineProperty(i,s.name,c),f=!0}function te(t,e,r){for(var s=arguments.length>2,a=0;a<e.length;a++)r=s?e[a].call(t,r):e[a].call(t);return s?r:void 0}function re(t){return typeof t=="symbol"?t:"".concat(t)}function se(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function ae(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ne(t,e,r,s){function a(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function l(c){try{i(s.next(c))}catch(u){o(u)}}function h(c){try{i(s.throw(c))}catch(u){o(u)}}function i(c){c.done?n(c.value):a(c.value).then(l,h)}i((s=s.apply(t,e||[])).next())})}function oe(t,e){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,a,n,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(i){return function(c){return h([i,c])}}function h(i){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(s=1,a&&(n=i[0]&2?a.return:i[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,i[1])).done)return n;switch(a=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++,a=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=e.call(t,r)}catch(c){i=[6,c],a=0}finally{s=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function ie(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&I(e,t,r)}function U(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function q(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),a,n=[],o;try{for(;(e===void 0||e-- >0)&&!(a=s.next()).done;)n.push(a.value)}catch(l){o={error:l}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return n}function le(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(q(arguments[e]));return t}function ce(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var s=Array(t),a=0,e=0;e<r;e++)for(var n=arguments[e],o=0,l=n.length;o<l;o++,a++)s[a]=n[o];return s}function he(t,e,r){if(r||arguments.length===2)for(var s=0,a=e.length,n;s<a;s++)(n||!(s in e))&&(n||(n=Array.prototype.slice.call(e,0,s)),n[s]=e[s]);return t.concat(n||Array.prototype.slice.call(e))}function $(t){return this instanceof $?(this.v=t,this):new $(t)}function ue(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(t,e||[]),a,n=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),a[Symbol.asyncIterator]=function(){return this},a;function o(d){return function(p){return Promise.resolve(p).then(d,u)}}function l(d,p){s[d]&&(a[d]=function(m){return new Promise(function(y,v){n.push([d,m,y,v])>1||h(d,m)})},p&&(a[d]=p(a[d])))}function h(d,p){try{i(s[d](p))}catch(m){f(n[0][3],m)}}function i(d){d.value instanceof $?Promise.resolve(d.value.v).then(c,u):f(n[0][2],d)}function c(d){h("next",d)}function u(d){h("throw",d)}function f(d,p){d(p),n.shift(),n.length&&h(n[0][0],n[0][1])}}function de(t){var e,r;return e={},s("next"),s("throw",function(a){throw a}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(a,n){e[a]=t[a]?function(o){return(r=!r)?{value:$(t[a](o)),done:!1}:n?n(o):o}:n}}function pe(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof U=="function"?U(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(n){r[n]=t[n]&&function(o){return new Promise(function(l,h){o=t[n](o),a(l,h,o.done,o.value)})}}function a(n,o,l,h){Promise.resolve(h).then(function(i){n({value:i,done:l})},o)}}function fe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function me(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=M(t),s=0;s<r.length;s++)r[s]!=="default"&&I(e,t,r[s]);return Pe(e,t),e}function ye(t){return t&&t.__esModule?t:{default:t}}function ge(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}function ve(t,e,r,s,a){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?a.call(t,r):a?a.value=r:e.set(t,r),r}function we(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function be(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var s,a;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=e[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=e[Symbol.dispose],r&&(a=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");a&&(s=function(){try{a.call(this)}catch(n){return Promise.reject(n)}}),t.stack.push({value:e,dispose:s,async:r})}else r&&t.stack.push({async:!0});return e}function Ee(t){function e(n){t.error=t.hasError?new Oe(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}var r,s=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&s===1)return s=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var n=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(n).then(a,function(o){return e(o),a()})}else s|=1}catch(o){e(o)}if(s===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}function _e(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,a,n,o){return s?e?".jsx":".js":a&&(!n||!o)?r:a+n+"."+o.toLowerCase()+"js"}):t}var k,C,I,Pe,M,Oe,Se,j=K(()=>{"use strict";g(),k=function(t,e){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(r[a]=s[a])},k(t,e)},C=function(){return C=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},C.apply(this,arguments)},I=Object.create?(function(t,e,r,s){s===void 0&&(s=r);var a=Object.getOwnPropertyDescriptor(e,r);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,a)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),Pe=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},M=function(t){return M=Object.getOwnPropertyNames||function(e){var r=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[r.length]=s);return r},M(t)},Oe=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var s=new Error(r);return s.name="SuppressedError",s.error=t,s.suppressed=e,s},Se={__extends:Y,__assign:C,__rest:Q,__decorate:X,__param:Z,__esDecorate:ee,__runInitializers:te,__propKey:re,__setFunctionName:se,__metadata:ae,__awaiter:ne,__generator:oe,__createBinding:I,__exportStar:ie,__values:U,__read:q,__spread:le,__spreadArrays:ce,__spreadArray:he,__await:$,__asyncGenerator:ue,__asyncDelegator:de,__asyncValues:pe,__makeTemplateObject:fe,__importStar:me,__importDefault:ye,__classPrivateFieldGet:ge,__classPrivateFieldSet:ve,__classPrivateFieldIn:we,__addDisposableResource:be,__disposeResources:Ee,__rewriteRelativeImportExtension:_e}}),Te=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};t.default=e}),$e=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(j(),A(T)),r=e.__importDefault(Te()),s=class{constructor(a){var n,o;this.shouldThrowOnError=!1,this.method=a.method,this.url=a.url,this.headers=new Headers(a.headers),this.schema=a.schema,this.body=a.body,this.shouldThrowOnError=(n=a.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=a.signal,this.isMaybeSingle=(o=a.isMaybeSingle)!==null&&o!==void 0?o:!1,a.fetch?this.fetch=a.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(a,n){return this.headers=new Headers(this.headers),this.headers.set(a,n),this}then(a,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 o=this.fetch,l=o(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async h=>{var i,c,u,f;let d=null,p=null,m=null,y=h.status,v=h.statusText;if(h.ok){if(this.method!=="HEAD"){let F=await h.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")?p=F:p=JSON.parse(F))}let b=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),P=(u=h.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");b&&P&&P.length>1&&(m=parseInt(P[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(p)&&(p.length>1?(d={code:"PGRST116",details:`Results contain ${p.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},p=null,m=null,y=406,v="Not Acceptable"):p.length===1?p=p[0]:p=null)}else{let b=await h.text();try{d=JSON.parse(b),Array.isArray(d)&&h.status===404&&(p=[],d=null,y=200,v="OK")}catch{h.status===404&&b===""?(y=204,v="No Content"):d={message:b}}if(d&&this.isMaybeSingle&&!((f=d?.details)===null||f===void 0)&&f.includes("0 rows")&&(d=null,y=200,v="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:p,count:m,status:y,statusText:v}});return this.shouldThrowOnError||(l=l.catch(h=>{var i,c,u;return{error:{message:`${(i=h?.name)!==null&&i!==void 0?i:"FetchError"}: ${h?.message}`,details:`${(c=h?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(u=h?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),l.then(a,n)}returns(){return this}overrideTypes(){return this}};t.default=s}),Le=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(j(),A(T)),r=e.__importDefault($e()),s=class extends r.default{select(a){let n=!1,o=(a??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",o),this.headers.append("Prefer","return=representation"),this}order(a,{ascending:n=!0,nullsFirst:o,foreignTable:l,referencedTable:h=l}={}){let i=h?`${h}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${a}.${n?"asc":"desc"}${o===void 0?"":o?".nullsfirst":".nullslast"}`),this}limit(a,{foreignTable:n,referencedTable:o=n}={}){let l=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(l,`${a}`),this}range(a,n,{foreignTable:o,referencedTable:l=o}={}){let h=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(h,`${a}`),this.url.searchParams.set(i,`${n-a+1}`),this}abortSignal(a){return this.signal=a,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:a=!1,verbose:n=!1,settings:o=!1,buffers:l=!1,wal:h=!1,format:i="text"}={}){var c;let u=[a?"analyze":null,n?"verbose":null,o?"settings":null,l?"buffers":null,h?"wal":null].filter(Boolean).join("|"),f=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${f}"; options=${u};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(a){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${a}`),this}};t.default=s}),z=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(j(),A(T)),r=e.__importDefault(Le()),s=new RegExp("[,()]"),a=class extends r.default{eq(n,o){return this.url.searchParams.append(n,`eq.${o}`),this}neq(n,o){return this.url.searchParams.append(n,`neq.${o}`),this}gt(n,o){return this.url.searchParams.append(n,`gt.${o}`),this}gte(n,o){return this.url.searchParams.append(n,`gte.${o}`),this}lt(n,o){return this.url.searchParams.append(n,`lt.${o}`),this}lte(n,o){return this.url.searchParams.append(n,`lte.${o}`),this}like(n,o){return this.url.searchParams.append(n,`like.${o}`),this}likeAllOf(n,o){return this.url.searchParams.append(n,`like(all).{${o.join(",")}}`),this}likeAnyOf(n,o){return this.url.searchParams.append(n,`like(any).{${o.join(",")}}`),this}ilike(n,o){return this.url.searchParams.append(n,`ilike.${o}`),this}ilikeAllOf(n,o){return this.url.searchParams.append(n,`ilike(all).{${o.join(",")}}`),this}ilikeAnyOf(n,o){return this.url.searchParams.append(n,`ilike(any).{${o.join(",")}}`),this}is(n,o){return this.url.searchParams.append(n,`is.${o}`),this}in(n,o){let l=Array.from(new Set(o)).map(h=>typeof h=="string"&&s.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(n,`in.(${l})`),this}contains(n,o){return typeof o=="string"?this.url.searchParams.append(n,`cs.${o}`):Array.isArray(o)?this.url.searchParams.append(n,`cs.{${o.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(o)}`),this}containedBy(n,o){return typeof o=="string"?this.url.searchParams.append(n,`cd.${o}`):Array.isArray(o)?this.url.searchParams.append(n,`cd.{${o.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(o)}`),this}rangeGt(n,o){return this.url.searchParams.append(n,`sr.${o}`),this}rangeGte(n,o){return this.url.searchParams.append(n,`nxl.${o}`),this}rangeLt(n,o){return this.url.searchParams.append(n,`sl.${o}`),this}rangeLte(n,o){return this.url.searchParams.append(n,`nxr.${o}`),this}rangeAdjacent(n,o){return this.url.searchParams.append(n,`adj.${o}`),this}overlaps(n,o){return typeof o=="string"?this.url.searchParams.append(n,`ov.${o}`):this.url.searchParams.append(n,`ov.{${o.join(",")}}`),this}textSearch(n,o,{config:l,type:h}={}){let i="";h==="plain"?i="pl":h==="phrase"?i="ph":h==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(n,`${i}fts${c}.${o}`),this}match(n){return Object.entries(n).forEach(([o,l])=>{this.url.searchParams.append(o,`eq.${l}`)}),this}not(n,o,l){return this.url.searchParams.append(n,`not.${o}.${l}`),this}or(n,{foreignTable:o,referencedTable:l=o}={}){let h=l?`${l}.or`:"or";return this.url.searchParams.append(h,`(${n})`),this}filter(n,o,l){return this.url.searchParams.append(n,`${o}.${l}`),this}};t.default=a}),xe=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(j(),A(T)),r=e.__importDefault(z()),s=class{constructor(a,{headers:n={},schema:o,fetch:l}){this.url=a,this.headers=new Headers(n),this.schema=o,this.fetch=l}select(a,n){let{head:o=!1,count:l}=n??{},h=o?"HEAD":"GET",i=!1,c=(a??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(a,{count:n,defaultToNull:o=!0}={}){var l;let h="POST";if(n&&this.headers.append("Prefer",`count=${n}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(a)){let i=a.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(i.length>0){let c=[...new Set(i)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(a,{onConflict:n,ignoreDuplicates:o=!1,count:l,defaultToNull:h=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${o?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),l&&this.headers.append("Prefer",`count=${l}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(a)){let u=a.reduce((f,d)=>f.concat(Object.keys(d)),[]);if(u.length>0){let f=[...new Set(u)].map(d=>`"${d}"`);this.url.searchParams.set("columns",f.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(a,{count:n}={}){var o;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:a,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}delete({count:a}={}){var n;let o="DELETE";return a&&this.headers.append("Prefer",`count=${a}`),new r.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};t.default=s}),et=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0});var e=(j(),A(T)),r=e.__importDefault(xe()),s=e.__importDefault(z()),a=class Ae{constructor(o,{headers:l={},schema:h,fetch:i}={}){this.url=o,this.headers=new Headers(l),this.schemaName=h,this.fetch=i}from(o){let l=new URL(`${this.url}/${o}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new Ae(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,l={},{head:h=!1,get:i=!1,count:c}={}){var u;let f,d=new URL(`${this.url}/rpc/${o}`),p;h||i?(f=h?"HEAD":"GET",Object.entries(l).filter(([y,v])=>v!==void 0).map(([y,v])=>[y,Array.isArray(v)?`{${v.join(",")}}`:`${v}`]).forEach(([y,v])=>{d.searchParams.append(y,v)})):(f="POST",p=l);let m=new Headers(this.headers);return c&&m.set("Prefer",`count=${c}`),new s.default({method:f,url:d,headers:m,schema:this.schemaName,body:p,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};t.default=a}),tt=S(t=>{"use strict";g(),Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestError=t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;var e=(j(),A(T)),r=e.__importDefault(et());t.PostgrestClient=r.default;var s=e.__importDefault(xe());t.PostgrestQueryBuilder=s.default;var a=e.__importDefault(z());t.PostgrestFilterBuilder=a.default;var n=e.__importDefault(Le());t.PostgrestTransformBuilder=n.default;var o=e.__importDefault($e());t.PostgrestBuilder=o.default;var l=e.__importDefault(Te());t.PostgrestError=l.default,t.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:a.default,PostgrestTransformBuilder:n.default,PostgrestBuilder:o.default,PostgrestError:l.default}});g();g();var je=class{constructor(t,e=""){this.http=t,this.baseUrl=e.replace(/\/$/,"")}async invoke(t,e){let r=this.baseUrl?`${this.baseUrl}/functions/${t}`:`/functions/${t}`;return await(await this.http.fetch(r,{method:e.method||"POST",body:e.body,headers:e.headers})).json()}};g();g();var E="nvwa_current_jwt",O="nvwa_login_token",R="nvwa_user_profile",rt="set-auth-token",st=typeof fetch<"u"?(t,e)=>fetch(t,e):()=>{throw new Error("AuthClient requires fetch")},Ce=class{constructor(t,e={}){this.baseUrl=t.replace(/\/$/,""),this.authPath=(e.authPath??"/auth").replace(/^\//,""),this.fetchImpl=e.fetchImpl??st,this.storage=e.storage??null,this.credentials=e.credentials??"omit"}async currentUser(){if(this.storage){let r=await this.storage.get(R);if(r!=null)return r}let{data:t}=await this.getSession(),e=t?.user??null;return e&&this.storage&&await this.storage.set(R,e),e}async getCurrentJwt(){if(this.storage){let e=await this.storage.get(E);if(e!=null)return e;let r=await this.storage.get(O),{data:s}=await this.getToken(r??void 0);return s?.token?(await this.storage.set(E,s.token),s.token):null}let{data:t}=await this.getToken();return t?.token??null}async persistLogin(t,e){if(!this.storage)return;let r=e?.headers.get(rt)?.trim()||t.token||t.session?.token;r&&await this.storage.set(O,r),t.user&&await this.storage.set(R,t.user);let s=r??await this.storage.get(O),{data:a}=await this.getToken(s??void 0);a?.token&&await this.storage.set(E,a.token)}async clearLogin(){this.storage&&(await this.storage.remove(O),await this.storage.remove(R),await this.storage.remove(E))}url(t){let e=`${`${this.baseUrl.replace(/\/+$/,"")}/${this.authPath.replace(/^\/+/,"")}`}/${t.replace(/^\/+/,"")}`;return typeof console<"u"&&console.debug&&console.debug("[NvwaAuth] request URL:",e),e}async getSession(){try{let t={};if(this.storage){let r=await this.storage.get(O)??await this.storage.get(E);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("session"),{method:"GET",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return e.ok?{data:await e.json()}:{data:null,error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{data:null,error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signInWithEmail(t,e){try{let r=await this.fetchImpl(this.url("sign-in/email"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify({email:t,password:e})}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return a&&await this.persistLogin({user:a.user,session:a.session},r),{data:a}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async signOut(){try{let t={};if(this.storage){let r=await this.storage.get(O)??await this.storage.get(E);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("sign-out"),{method:"POST",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return await this.clearLogin(),e.ok?{}:{error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signUp(t){let e=await this.postJson("sign-up/email",t);return e.data&&await this.persistLogin(e.data,e.response),e}async getToken(t){try{let e={};if(t)e.Authorization=`Bearer ${t}`;else if(this.storage){let n=await this.storage.get(O)??await this.storage.get(E);n!=null&&(e.Authorization=`Bearer ${n}`)}let r=await this.fetchImpl(this.url("token"),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return{data:a?.token!=null?{token:a.token}:void 0}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async signInWithUsername(t,e){let r=await this.postJson("sign-in/username",{username:t,password:e});return r.data&&await this.persistLogin(r.data,r.response),r}async signInWithPhoneNumber(t,e,r){let s=await this.postJson("sign-in/phone-number",{phoneNumber:t,password:e,rememberMe:r});return s.data&&await this.persistLogin(s.data,s.response),s}async sendPhoneNumberOtp(t){let e=await this.postJson("phone-number/send-otp",{phoneNumber:t});return e.error?{error:e.error}:{}}async verifyPhoneNumber(t,e){let r=await this.postJson("phone-number/verify",{phoneNumber:t,code:e});return r.data&&await this.persistLogin(r.data,r.response),r}async postJson(t,e){try{let r=await this.fetchImpl(this.url(t),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify(e)}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let a=s?JSON.parse(s):void 0;return{data:a?.data??a??void 0,response:r}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}};g();g();var w=class Ie{constructor(e){if(this.headerMap=new Map,e){if(e instanceof Ie)e.forEach((r,s)=>this.set(s,r));else if(Array.isArray(e))for(let[r,s]of e)this.set(r,String(s));else if(typeof e=="object")for(let r of Object.keys(e))this.set(r,String(e[r]))}}append(e,r){let s=e.toLowerCase(),a=this.headerMap.get(s);this.headerMap.set(s,a?`${a}, ${r}`:r)}set(e,r){this.headerMap.set(e.toLowerCase(),String(r))}get(e){return this.headerMap.get(e.toLowerCase())??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[r,s]of this.headerMap.entries())e(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},Ne=class Re{constructor(e){if(this.params=new Map,e){if(typeof e=="string")this.parseString(e);else if(e instanceof Re)this.params=new Map(e.params);else if(Array.isArray(e))for(let[r,s]of e)this.append(r,s);else if(e&&typeof e=="object")for(let[r,s]of Object.entries(e))this.set(r,s)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let r=e.split("&");for(let s of r)if(s){let[a,n]=s.split("=");a&&this.append(decodeURIComponent(a),n?decodeURIComponent(n):"")}}append(e,r){let s=this.params.get(e)||[];s.push(r),this.params.set(e,s)}delete(e){this.params.delete(e)}get(e){let r=this.params.get(e);return r?r[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,r){this.params.set(e,[r])}sort(){let e=Array.from(this.params.entries()).sort(([r],[s])=>r.localeCompare(s));this.params=new Map(e)}toString(){let e=[];for(let[r,s]of this.params.entries())for(let a of s)e.push(`${encodeURIComponent(r)}=${encodeURIComponent(a)}`);return e.join("&")}forEach(e){for(let[r,s]of this.params.entries())for(let a of s)e(a,r,this)}keys(){return this.params.keys()}values(){let e=[];for(let r of this.params.values())e.push(...r);return e[Symbol.iterator]()}entries(){let e=[];for(let[r,s]of this.params.entries())for(let a of s)e.push([r,a]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},at=class B{constructor(e,r){let s;if(e instanceof B)s=e.href;else if(r){let n=r instanceof B?r.href:r;s=this.resolve(n,e)}else s=e;let a=this.parseUrl(s);this.href=s,this.origin=`${a.protocol}//${a.host}`,this.protocol=a.protocol,this.username=a.username,this.password=a.password,this.host=a.host,this.hostname=a.hostname,this.port=a.port,this.pathname=a.pathname,this.search=a.search,this.searchParams=new Ne(a.search),this.hash=a.hash}resolve(e,r){if(r.startsWith("http://")||r.startsWith("https://"))return r;if(r.startsWith("//"))return`${this.parseUrl(e).protocol}${r}`;if(r.startsWith("/")){let n=this.parseUrl(e);return`${n.protocol}//${n.host}${r}`}let s=this.parseUrl(e),a=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return`${s.protocol}//${s.host}${a}${r}`}parseUrl(e){let r=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!r)throw new TypeError("Invalid URL");let s=r[2]||"",a=r[4]||"",n=r[5]||"/",o=r[7]?`?${r[7]}`:"",l=r[9]?`#${r[9]}`:"";if(!s&&!a&&!n.startsWith("/")&&!n.includes("/")&&!n.includes("."))throw new TypeError("Invalid URL");let h=a.match(/^([^@]*)@(.+)$/),i="",c="",u=a;if(h){let m=h[1];u=h[2];let y=m.match(/^([^:]*):?(.*)$/);y&&(i=y[1]||"",c=y[2]||"")}let f=u.match(/^([^:]+):?(\d*)$/),d=f?f[1]:u,p=f&&f[2]?f[2]:"";return{protocol:s?`${s}:`:"",username:i,password:c,host:u,hostname:d,port:p,pathname:n,search:o,hash:l}}toString(){let e=this.searchParams.toString(),r=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${r}${this.hash}`}toJSON(){return this.toString()}};g();var nt=class ke{constructor(e,r){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(r?.method||"GET").toUpperCase(),this.headers=r?.headers instanceof w?r.headers:new w(r?.headers),this.body=r?.body,this.timeout=r?.timeout,this.signal=r?.signal||void 0}clone(){return new ke(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};g();var G=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=ot(e?.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 t=await this.text();return new TextEncoder().encode(t).buffer}};function ot(t){return t?new w(t):new w}g();var Me=class{constructor(){this._aborted=!1,this.listeners=new Set,this.onabort=null}get aborted(){return this._aborted}_trigger(){if(!this._aborted){if(this._aborted=!0,typeof this.onabort=="function")try{this.onabort()}catch{}for(let t of Array.from(this.listeners))try{t()}catch{}this.listeners.clear()}}addEventListener(t,e){if(this._aborted){try{e()}catch{}return}this.listeners.add(e)}removeEventListener(t,e){this.listeners.delete(e)}toString(){return"[object AbortSignal]"}},it=class{constructor(){this._signal=new Me}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};g();function lt(t){t.URL=at,t.URLSearchParams=Ne,t.Headers=w,t.Request=nt,t.Response=G,t.AbortController=it,t.AbortSignal=Me}var Ue=class{constructor(t,e,r){this.storage=t,this.customFetch=e,this.handleUnauthorized=r}async fetch(t,e){return await this.customFetch(t,e)}async fetchWithAuth(t,e){let r=await this.storage.get(E),s=new w(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let a=e?.method||"GET";if((a==="POST"||a==="PUT"||a==="PATCH")&&e?.body){let o=s.get("Content-Type");(!o||o.includes("text/plain"))&&s.set("Content-Type","application/json")}let n=await this.customFetch(t,{...e,headers:s});if(n.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return n}};g();var ct="/storage",ht=ct+"/generateUploadUrl",He=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+ht,{method:"POST",body:{fileName:t.name||t.fileName,fileSize:t.size||t.fileSize,fileType:t.type||t.fileType}}),{url:r}=await e.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:t,headers:new w({"Content-Type":t.type||t.fileType||"application/octet-stream"})}),{url:a}=await s.json();return{url:a.split("?")[0]}}};g();g();g();var W=Ze(tt(),1),{PostgrestClient:ut,PostgrestQueryBuilder:ft,PostgrestFilterBuilder:mt,PostgrestTransformBuilder:yt,PostgrestBuilder:gt,PostgrestError:vt}=W.default||W,dt="/entities",De=(t,e)=>new ut(t+dt,{fetch:e.fetchWithAuth.bind(e)});g();var Fe=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};g();var Be=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e!=null?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};g();var qe=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 t=document.createElement("style");t.id="__nvwa-inspector-overlay-style",t.textContent=`
2
2
  .__nvwa-inspector-overlay {
3
3
  position: absolute;
4
4
  pointer-events: none;
@@ -30,4 +30,4 @@ var Ge=Object.create,M=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,
30
30
  max-width: 400px;
31
31
  word-break: break-all;
32
32
  }
33
- `,document.head.appendChild(t)}createTooltip(){return this.tooltip?this.tooltip:(this.tooltip=document.createElement("div"),this.tooltip.id="__nvwa-inspector-tooltip",document.body.appendChild(this.tooltip),this.tooltip)}createOverlay(t){let e=document.createElement("div");return e.className=`__nvwa-inspector-overlay __nvwa-inspector-overlay-${t}`,document.body.appendChild(e),e}updateOverlayPosition(t,e){if(!e.isConnected)return;let r=e.getBoundingClientRect(),s=window.scrollX||window.pageXOffset,a=window.scrollY||window.pageYOffset;r.width>0&&r.height>0?(t.style.left=`${r.left+s}px`,t.style.top=`${r.top+a}px`,t.style.width=`${r.width}px`,t.style.height=`${r.height}px`,t.style.display="block"):t.style.display="none"}removeOverlay(t){t&&t.parentNode&&t.parentNode.removeChild(t)}highlightElement(t,e){if(!t.isConnected)return;if(this.hoverElement===t&&this.hoverOverlay){this.updateOverlayPosition(this.hoverOverlay,t);let o=this.createTooltip();e?o.textContent=e:o.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,o.style.display="block";let l=t.getBoundingClientRect();o.style.left=`${l.left+window.scrollX}px`,o.style.top=`${l.top+window.scrollY-o.offsetHeight-8}px`,l.top<o.offsetHeight+8&&(o.style.top=`${l.bottom+window.scrollY+8}px`);return}this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null);let r=this.createOverlay("hover");this.updateOverlayPosition(r,t),this.hoverOverlay=r,this.hoverElement=t;let s=()=>{this.hoverOverlay&&this.hoverElement&&this.hoverElement.isConnected&&this.updateOverlayPosition(this.hoverOverlay,this.hoverElement)};this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler)),this.hoverUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s);let a=this.createTooltip();e?a.textContent=e:a.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,a.style.display="block";let n=t.getBoundingClientRect();a.style.left=`${n.left+window.scrollX}px`,a.style.top=`${n.top+window.scrollY-a.offsetHeight-8}px`,n.top<a.offsetHeight+8&&(a.style.top=`${n.bottom+window.scrollY+8}px`)}selectElement(t,e){if(!t.isConnected)return;if(this.selectedElement===t&&this.selectedOverlay){this.updateOverlayPosition(this.selectedOverlay,t);return}this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null);let r=this.createOverlay("selected");this.updateOverlayPosition(r,t),this.selectedOverlay=r,this.selectedElement=t;let s=()=>{this.selectedOverlay&&this.selectedElement&&this.selectedElement.isConnected&&this.updateOverlayPosition(this.selectedOverlay,this.selectedElement)};this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler)),this.selectedUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s)}removeHighlight(){this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null),this.hoverElement&&(this.hoverElement=null),this.tooltip&&(this.tooltip.style.display="none"),this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler),this.hoverUpdateHandler=null)}clearSelection(){this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null),this.selectedElement&&(this.selectedElement=null),this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler),this.selectedUpdateHandler=null)}cleanup(){this.removeHighlight(),this.clearSelection(),this.tooltip&&this.tooltip.parentNode&&(this.tooltip.parentNode.removeChild(this.tooltip),this.tooltip=null);let t=document.getElementById("__nvwa-inspector-overlay-style");t&&t.parentNode&&t.parentNode.removeChild(t)}};function ze(t="root"){if(typeof document>"u")return null;let e=document.getElementById(t)||document.body;if(!e)return null;let r=e.querySelector("[data-source-location]");if(r){let s=r.getAttribute("data-source-location");if(s)return s}if(e.firstElementChild){let s=e.firstElementChild.getAttribute("data-source-location");if(s)return s}return null}g();var gt=typeof fetch<"u"?(t,e)=>fetch(t,e):(()=>{throw new Error("payment client requires fetch")})();var U=class{constructor(){this.prefix="nvwa_"}getKey(e){return`${this.prefix}${e}`}async get(e){try{let r=this.getKey(e),s=uni.getStorageSync(r);return s?s.expires&&Date.now()>s.expires?(await this.remove(e),null):s.value:null}catch(r){return console.error("UniAppStorageService get error:",r),null}}async set(e,r,s){try{let a=this.getKey(e),n={value:r,expires:s?Date.now()+s*1e3:null,timestamp:Date.now()};uni.setStorageSync(a,n)}catch(a){throw console.error("UniAppStorageService set error:",a),a}}async remove(e){try{let r=this.getKey(e);uni.removeStorageSync(r)}catch(r){throw console.error("UniAppStorageService remove error:",r),r}}async clear(){try{uni.clearStorageSync()}catch(e){throw console.error("UniAppStorageService clear error:",e),e}}};var A=(t,e)=>{let r;if(typeof t=="string")r=t;else if(t&&typeof t.toString=="function")r=t.toString();else if(t?.url)r=t.url;else throw new Error("Invalid input for uniappFetch");let s=(e?.method||"GET").toUpperCase(),a={};if(e?.headers){let l=e.headers;if(typeof l?.forEach=="function")l.forEach((h,i)=>{a[i]=h});else if(Array.isArray(l))for(let[h,i]of l)a[h]=i;else Object.assign(a,l)}let n;if(e?.body!==void 0){let l=e.body;if(typeof l=="string")n=l;else if(l&&typeof l=="object"&&typeof l.forEach=="function"){let h={};l.forEach((i,c)=>{h[c]=i}),n=h}else n=l}let o=e?.timeout||3e4;return new Promise((l,h)=>{let i=e?.signal;if(i?.aborted){let d=new Error("The operation was aborted");d.name="AbortError",h(d);return}let c=!1,u=[],f=uni.request({url:r,method:s,data:n,header:a,timeout:o,success:d=>{if(c)return;c=!0;let p=d.statusCode,m="",y=new w,v=d.header||d.headers||{};Object.keys(v).forEach(b=>{let _=v[b];y.set(b,typeof _=="string"?_:String(_))}),l(new q(d.data,{status:p,statusText:m,headers:y}))},fail:d=>{if(c)return;c=!0;let p=d?.errMsg||d?.message||"Network Error",m=new Error(p);/(abort|aborted|canceled|cancelled)/i.test(String(p))&&(m.name="AbortError"),h(m)}});if(i&&typeof i.addEventListener=="function"){let d=()=>{if(c)return;try{f?.abort?.()}catch{}let p=new Error("The operation was aborted");p.name="AbortError",c=!0,h(p)};i.addEventListener("abort",d),u.push(()=>{try{i.removeEventListener?.("abort",d)}catch{}})}})};typeof globalThis.fetch!="function"&&(globalThis.fetch=A);function Jt(){if(typeof window>"u"||window===window.parent)return;let t=!1,e=new Be;function r(i){if(!i)return!1;let c=i.toLowerCase();return c.includes("/components/")||c.includes("\\components\\")}function s(i){let c=i,u=null;for(;c;){let f=c.getAttribute("data-source-location");if(f)if(r(f)){u||(u=f),c=c.parentElement;continue}else return f;c=c.parentElement}return u}let a=null;function n(i){t&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{let c=i.target;if(!c||c===document.body||c===document.documentElement){e.removeHighlight();return}if(c.tagName.toLowerCase()==="img"){let p=s(c);e.highlightElement(c,p);let m={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:p,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(m,"*");return}let u=c,f=s(c);if(!f){let p=c.parentElement;for(;p&&p!==document.body&&p!==document.documentElement;){let m=s(p);if(m){u=p,f=m;break}p=p.parentElement}}e.highlightElement(u,f);let d={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:f,elementInfo:{tagName:u.tagName.toLowerCase(),className:u.className||"",id:u.id||""}};window.parent.postMessage(d,"*")}))}function o(){if(!t)return;e.removeHighlight();let i={type:"HOVER_INSPECTOR_ELEMENT_LEAVE"};window.parent.postMessage(i,"*")}function l(i){if(!t)return;i.preventDefault(),i.stopPropagation();let c=i.target;if(!c||c===document.body||c===document.documentElement)return;let u=s(c);e.selectElement(c,u);let f={type:"HOVER_INSPECTOR_ELEMENT_SELECT",sourceLocation:u,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(f,"*")}function h(i){i.data?.type==="HOVER_INSPECTOR_ENABLE"?(t=!0,document.addEventListener("mousemove",n),document.addEventListener("mouseleave",o),document.addEventListener("click",l,!0)):i.data?.type==="HOVER_INSPECTOR_DISABLE"&&(t=!1,document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",o),document.removeEventListener("click",l,!0),e.removeHighlight(),e.clearSelection())}return window.addEventListener("message",h),()=>{window.removeEventListener("message",h),document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",o),document.removeEventListener("click",l,!0),e.cleanup()}}function Wt(t,e){if(!t||!t.contentWindow)throw new Error("Invalid iframe element");let r={type:"HOVER_INSPECTOR_ENABLE"};t.contentWindow.postMessage(r,e)}function Kt(t,e){if(!t||!t.contentWindow)return;let r={type:"HOVER_INSPECTOR_DISABLE"};t.contentWindow.postMessage(r,e)}function Vt(t,e,r=5e3){return new Promise((s,a)=>{if(!t||!t.contentWindow){a(new Error("Invalid iframe element"));return}let n=`source-location-${Date.now()}-${Math.random()}`,o=setTimeout(()=>{window.removeEventListener("message",l),a(new Error("Request timeout"))},r),l=i=>{i.origin===e&&i.data?.type==="GET_SOURCE_LOCATION_RESPONSE"&&i.data?.requestId===n&&(clearTimeout(o),window.removeEventListener("message",l),i.data.error?a(new Error(i.data.error)):s(i.data.sourceLocation||null))};window.addEventListener("message",l);let h={type:"GET_SOURCE_LOCATION_REQUEST",requestId:n};try{t.contentWindow.postMessage(h,e)}catch(i){clearTimeout(o),window.removeEventListener("message",l),a(i)}})}function Yt(){if(typeof window>"u"||window===window.parent)return;let t=e=>{if(e.data?.type==="GET_SOURCE_LOCATION_REQUEST")try{let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:ut(),requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}catch(r){let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:null,error:r instanceof Error?r.message:"Unknown error",requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}function ut(){return ze("app")}var qe=new U,G=class{constructor(e,r){this.auth=new Ae(e,{fetchImpl:A,storage:qe}),this.httpClient=new He(qe,A,r),this.fileStorage=new Me(e,this.httpClient),this.entities=Ue(e,this.httpClient),this.functions=new je(this.httpClient,e),this.skill=new De(e,this.httpClient),this.capability=new Fe(e,this.httpClient)}};export{G as default,Kt as disableIframeHoverInspector,Wt as enableIframeHoverInspector,Vt as getIframeSourceLocation,qe as localStorage,ot as polyfill,Jt as setupIframeHoverInspector,Yt as setupIframeSourceLocationListener,A as uniappFetch};
33
+ `,document.head.appendChild(t)}createTooltip(){return this.tooltip?this.tooltip:(this.tooltip=document.createElement("div"),this.tooltip.id="__nvwa-inspector-tooltip",document.body.appendChild(this.tooltip),this.tooltip)}createOverlay(t){let e=document.createElement("div");return e.className=`__nvwa-inspector-overlay __nvwa-inspector-overlay-${t}`,document.body.appendChild(e),e}updateOverlayPosition(t,e){if(!e.isConnected)return;let r=e.getBoundingClientRect(),s=window.scrollX||window.pageXOffset,a=window.scrollY||window.pageYOffset;r.width>0&&r.height>0?(t.style.left=`${r.left+s}px`,t.style.top=`${r.top+a}px`,t.style.width=`${r.width}px`,t.style.height=`${r.height}px`,t.style.display="block"):t.style.display="none"}removeOverlay(t){t&&t.parentNode&&t.parentNode.removeChild(t)}highlightElement(t,e){if(!t.isConnected)return;if(this.hoverElement===t&&this.hoverOverlay){this.updateOverlayPosition(this.hoverOverlay,t);let o=this.createTooltip();e?o.textContent=e:o.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,o.style.display="block";let l=t.getBoundingClientRect();o.style.left=`${l.left+window.scrollX}px`,o.style.top=`${l.top+window.scrollY-o.offsetHeight-8}px`,l.top<o.offsetHeight+8&&(o.style.top=`${l.bottom+window.scrollY+8}px`);return}this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null);let r=this.createOverlay("hover");this.updateOverlayPosition(r,t),this.hoverOverlay=r,this.hoverElement=t;let s=()=>{this.hoverOverlay&&this.hoverElement&&this.hoverElement.isConnected&&this.updateOverlayPosition(this.hoverOverlay,this.hoverElement)};this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler)),this.hoverUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s);let a=this.createTooltip();e?a.textContent=e:a.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,a.style.display="block";let n=t.getBoundingClientRect();a.style.left=`${n.left+window.scrollX}px`,a.style.top=`${n.top+window.scrollY-a.offsetHeight-8}px`,n.top<a.offsetHeight+8&&(a.style.top=`${n.bottom+window.scrollY+8}px`)}selectElement(t,e){if(!t.isConnected)return;if(this.selectedElement===t&&this.selectedOverlay){this.updateOverlayPosition(this.selectedOverlay,t);return}this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null);let r=this.createOverlay("selected");this.updateOverlayPosition(r,t),this.selectedOverlay=r,this.selectedElement=t;let s=()=>{this.selectedOverlay&&this.selectedElement&&this.selectedElement.isConnected&&this.updateOverlayPosition(this.selectedOverlay,this.selectedElement)};this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler)),this.selectedUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s)}removeHighlight(){this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null),this.hoverElement&&(this.hoverElement=null),this.tooltip&&(this.tooltip.style.display="none"),this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler),this.hoverUpdateHandler=null)}clearSelection(){this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null),this.selectedElement&&(this.selectedElement=null),this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler),this.selectedUpdateHandler=null)}cleanup(){this.removeHighlight(),this.clearSelection(),this.tooltip&&this.tooltip.parentNode&&(this.tooltip.parentNode.removeChild(this.tooltip),this.tooltip=null);let t=document.getElementById("__nvwa-inspector-overlay-style");t&&t.parentNode&&t.parentNode.removeChild(t)}};function ze(t="root"){if(typeof document>"u")return null;let e=document.getElementById(t)||document.body;if(!e)return null;let r=e.querySelector("[data-source-location]");if(r){let s=r.getAttribute("data-source-location");if(s)return s}if(e.firstElementChild){let s=e.firstElementChild.getAttribute("data-source-location");if(s)return s}return null}g();var D=class{constructor(){this.prefix="nvwa_"}getKey(e){return`${this.prefix}${e}`}async get(e){try{let r=this.getKey(e),s=uni.getStorageSync(r);return s?s.expires&&Date.now()>s.expires?(await this.remove(e),null):s.value:null}catch(r){return console.error("UniAppStorageService get error:",r),null}}async set(e,r,s){try{let a=this.getKey(e),n={value:r,expires:s?Date.now()+s*1e3:null,timestamp:Date.now()};uni.setStorageSync(a,n)}catch(a){throw console.error("UniAppStorageService set error:",a),a}}async remove(e){try{let r=this.getKey(e);uni.removeStorageSync(r)}catch(r){throw console.error("UniAppStorageService remove error:",r),r}}async clear(){try{uni.clearStorageSync()}catch(e){throw console.error("UniAppStorageService clear error:",e),e}}};var N=(t,e)=>{let r;if(typeof t=="string")r=t;else if(t&&typeof t.toString=="function")r=t.toString();else if(t?.url)r=t.url;else throw new Error("Invalid input for uniappFetch");let s=(e?.method||"GET").toUpperCase(),a={};if(e?.headers){let l=e.headers;if(typeof l?.forEach=="function")l.forEach((h,i)=>{a[i]=h});else if(Array.isArray(l))for(let[h,i]of l)a[h]=i;else Object.assign(a,l)}let n;if(e?.body!==void 0){let l=e.body;if(typeof l=="string")n=l;else if(l&&typeof l=="object"&&typeof l.forEach=="function"){let h={};l.forEach((i,c)=>{h[c]=i}),n=h}else n=l}let o=e?.timeout||3e4;return new Promise((l,h)=>{let i=e?.signal;if(i?.aborted){let d=new Error("The operation was aborted");d.name="AbortError",h(d);return}let c=!1,u=[],f=uni.request({url:r,method:s,data:n,header:a,timeout:o,success:d=>{if(c)return;c=!0;let p=d.statusCode,m="",y=new w,v=d.header||d.headers||{};Object.keys(v).forEach(b=>{let P=v[b];y.set(b,typeof P=="string"?P:String(P))}),l(new G(d.data,{status:p,statusText:m,headers:y}))},fail:d=>{if(c)return;c=!0;let p=d?.errMsg||d?.message||"Network Error",m=new Error(p);/(abort|aborted|canceled|cancelled)/i.test(String(p))&&(m.name="AbortError"),h(m)}});if(i&&typeof i.addEventListener=="function"){let d=()=>{if(c)return;try{f?.abort?.()}catch{}let p=new Error("The operation was aborted");p.name="AbortError",c=!0,h(p)};i.addEventListener("abort",d),u.push(()=>{try{i.removeEventListener?.("abort",d)}catch{}})}})};typeof globalThis.fetch!="function"&&(globalThis.fetch=N);var _="Mobile-web";_="MP-Wechat";_="MP-Alipay";_=typeof navigator<"u"&&/MicroMessenger/i.test(navigator.userAgent)?"Wechat-H5":"Mobile-web";_="Android";_="IOS";_="Harmony";var Ge={async requestPayment(t){let e=t,r=e.jsapiPayParams??e;if(typeof r.timeStamp=="string"&&typeof r.nonceStr=="string"&&typeof r.package=="string"&&typeof r.paySign=="string"){await new Promise((a,n)=>{uni.requestPayment({provider:"wxpay",timeStamp:r.timeStamp,nonceStr:r.nonceStr,package:r.package,signType:r.signType??"RSA",paySign:r.paySign,success:()=>a(),fail:o=>n(o)})});return}if(typeof e.redirectUrl=="string"){typeof window<"u"?window.location.href=e.redirectUrl:globalThis.plus?.runtime?.openURL?.(e.redirectUrl);return}if(typeof e.codeUrl=="string"){let a=`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(e.codeUrl)}`;typeof window<"u"?window.open(a,"_blank"):globalThis.plus?.runtime?.openURL?.(a);return}throw new Error("requestPayment: unsupported payParams for current endpoint")}};function Qt(){if(typeof window>"u"||window===window.parent)return;let t=!1,e=new qe;function r(i){if(!i)return!1;let c=i.toLowerCase();return c.includes("/components/")||c.includes("\\components\\")}function s(i){let c=i,u=null;for(;c;){let f=c.getAttribute("data-source-location");if(f)if(r(f)){u||(u=f),c=c.parentElement;continue}else return f;c=c.parentElement}return u}let a=null;function n(i){t&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{let c=i.target;if(!c||c===document.body||c===document.documentElement){e.removeHighlight();return}if(c.tagName.toLowerCase()==="img"){let p=s(c);e.highlightElement(c,p);let m={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:p,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(m,"*");return}let u=c,f=s(c);if(!f){let p=c.parentElement;for(;p&&p!==document.body&&p!==document.documentElement;){let m=s(p);if(m){u=p,f=m;break}p=p.parentElement}}e.highlightElement(u,f);let d={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:f,elementInfo:{tagName:u.tagName.toLowerCase(),className:u.className||"",id:u.id||""}};window.parent.postMessage(d,"*")}))}function o(){if(!t)return;e.removeHighlight();let i={type:"HOVER_INSPECTOR_ELEMENT_LEAVE"};window.parent.postMessage(i,"*")}function l(i){if(!t)return;i.preventDefault(),i.stopPropagation();let c=i.target;if(!c||c===document.body||c===document.documentElement)return;let u=s(c);e.selectElement(c,u);let f={type:"HOVER_INSPECTOR_ELEMENT_SELECT",sourceLocation:u,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(f,"*")}function h(i){i.data?.type==="HOVER_INSPECTOR_ENABLE"?(t=!0,document.addEventListener("mousemove",n),document.addEventListener("mouseleave",o),document.addEventListener("click",l,!0)):i.data?.type==="HOVER_INSPECTOR_DISABLE"&&(t=!1,document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",o),document.removeEventListener("click",l,!0),e.removeHighlight(),e.clearSelection())}return window.addEventListener("message",h),()=>{window.removeEventListener("message",h),document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",o),document.removeEventListener("click",l,!0),e.cleanup()}}function Xt(t,e){if(!t||!t.contentWindow)throw new Error("Invalid iframe element");let r={type:"HOVER_INSPECTOR_ENABLE"};t.contentWindow.postMessage(r,e)}function Zt(t,e){if(!t||!t.contentWindow)return;let r={type:"HOVER_INSPECTOR_DISABLE"};t.contentWindow.postMessage(r,e)}function er(t,e,r=5e3){return new Promise((s,a)=>{if(!t||!t.contentWindow){a(new Error("Invalid iframe element"));return}let n=`source-location-${Date.now()}-${Math.random()}`,o=setTimeout(()=>{window.removeEventListener("message",l),a(new Error("Request timeout"))},r),l=i=>{i.origin===e&&i.data?.type==="GET_SOURCE_LOCATION_RESPONSE"&&i.data?.requestId===n&&(clearTimeout(o),window.removeEventListener("message",l),i.data.error?a(new Error(i.data.error)):s(i.data.sourceLocation||null))};window.addEventListener("message",l);let h={type:"GET_SOURCE_LOCATION_REQUEST",requestId:n};try{t.contentWindow.postMessage(h,e)}catch(i){clearTimeout(o),window.removeEventListener("message",l),a(i)}})}function tr(){if(typeof window>"u"||window===window.parent)return;let t=e=>{if(e.data?.type==="GET_SOURCE_LOCATION_REQUEST")try{let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:pt(),requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}catch(r){let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:null,error:r instanceof Error?r.message:"Unknown error",requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}function pt(){return ze("app")}var Je=new D,J=class{constructor(e,r){this.payment=Ge;this.endpointType=_;this.auth=new Ce(e,{fetchImpl:N,storage:Je}),this.httpClient=new Ue(Je,N,r),this.fileStorage=new He(e,this.httpClient),this.entities=De(e,this.httpClient),this.functions=new je(this.httpClient,e),this.skill=new Fe(e,this.httpClient),this.capability=new Be(e,this.httpClient)}};export{J as default,Zt as disableIframeHoverInspector,Xt as enableIframeHoverInspector,er as getIframeSourceLocation,Je as localStorage,lt as polyfill,Qt as setupIframeHoverInspector,tr as setupIframeSourceLocationListener,N as uniappFetch};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nvwa-app/sdk-uniapp",
3
- "version": "6.0.33",
3
+ "version": "6.0.36",
4
4
  "description": "NVWA跨端通用工具类UniApp端实现",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",