import"./chunk-7EYXEF6M.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(e,r){return a(()=>n(e,r))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=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(!(!t&&!i))return{initWixModules(e,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(e))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return a(()=>t.use(e))},fetchWithAuth:(e,r)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(e,r)},async graphql(e,r,s){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(e,r,s)}}}function a(n){let t=globalThis.__wix_context__,i={client:o.client,elevatedClient:o.elevatedClient},e;globalThis.__wix_context__=void 0,o.client=void 0,o.elevatedClient=void 0,typeof $wixContext<"u"&&(e={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return n()}finally{globalThis.__wix_context__=t,o.client=i.client,o.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=e.client,$wixContext.elevatedClient=e.elevatedClient)}}function u(n,t){return(...i)=>{let e=c();return e?e.initWixModules(n,t).apply(void 0,i):n.apply(void 0,i)}}function x(n,t=!1){return u(n,t)}var d=["wix.com","editorx.com"];var y=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:t,filename:i,method:e,args:r})=>{let l=await(await n.fetchWithAuth(`${t}/_webMethods/${i}/${e}.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