import"./chunk-KXCY2KWZ.js";import"./chunk-SBZEOPXX.js";import{wixContext as o}from"@wix/sdk-context";function c(){let n=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(n)return{initWixModules(t,r){return a(()=>n(t,r))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let e=typeof $wixContext<"u"?$wixContext.client:typeof o.client<"u"?o.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof o.elevatedClient<"u"?o.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!e&&!i))return{initWixModules(t,r){if(r){if(!i)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return a(()=>i.use(t))}if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return a(()=>e.use(t))},fetchWithAuth:(t,r)=>{if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.fetchWithAuth(t,r)},getAuth(){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.auth},async graphql(t,r,s){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.graphql(t,r,s)}}}function a(n){let e=globalThis.__wix_context__,i={client:o.client,elevatedClient:o.elevatedClient},t;globalThis.__wix_context__=void 0,o.client=void 0,o.elevatedClient=void 0,typeof $wixContext<"u"&&(t={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return n()}finally{globalThis.__wix_context__=e,o.client=i.client,o.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=t.client,$wixContext.elevatedClient=t.elevatedClient)}}function u(n,e){return(...i)=>{let t=c();return t?t.initWixModules(n,e).apply(void 0,i):n.apply(void 0,i)}}function x(n,e=!1){return u(n,e)}var d=["wix.com","editorx.com"];var E=new RegExp(`\\.(${d.join("|")})$`),f=["42.wixprod.net","uw2-edt-1.wixprod.net"],p="dev.wix-code.com";var C=new RegExp(`\\.(${f.join("|")})$`),M=new RegExp(`.*\\.${p}$`);var v=x(n=>async({baseURL:e,filename:i,method:t,args:r})=>{let l=await(await n.fetchWithAuth(`${e}/_webMethods/${i}/${t}.ajax`,{body:JSON.stringify(r),method:"POST"})).json();if(l.exception===!0)throw l.result;return l.result});export{v as callWebMethod};
//# sourceMappingURL=web-methods.js.map