seatable-html-page-sdk 0.0.4 → 0.0.5
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/README.md +6 -9
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/apis/html-page-api.js +10 -2
- package/es/apis/html-page-api.js.map +1 -1
- package/lib/apis/html-page-api.js +10 -2
- package/lib/apis/html-page-api.js.map +1 -1
- package/package.json +1 -1
package/dist/index.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLPageSDK=t()}(this,function(){"use strict";function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:r,toStringTag:s}=Symbol,o=(i=Object.create(null),e=>{const n=t.call(e);return i[n]||(i[n]=n.slice(8,-1).toLowerCase())});var i;const a=e=>(e=e.toLowerCase(),t=>o(t)===e),c=e=>t=>typeof t===e,{isArray:l}=Array,u=c("undefined");function d(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const f=a("ArrayBuffer");const p=c("string"),h=c("function"),m=c("number"),y=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==o(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||s in e||r in e)},b=a("Date"),w=a("File"),E=a("Blob"),v=a("FileList"),R=a("URLSearchParams"),[O,T,S,A]=["ReadableStream","Request","Response","Headers"].map(a);function _(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(d(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(r=0;r<o;r++)i=s[r],t.call(null,e[i],i,e)}}function P(e,t){if(d(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,x=e=>!u(e)&&e!==k;const U=(N="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>N&&e instanceof N);var N;const j=a("HTMLFormElement"),C=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),L=a("RegExp"),F=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};_(n,(n,s)=>{let o;!1!==(o=t(n,s,e))&&(r[s]=o||n)}),Object.defineProperties(e,r)};const q=a("AsyncFunction"),D=(B="function"==typeof setImmediate,I=h(k.postMessage),B?setImmediate:I?(M=`axios@${Math.random()}`,K=[],k.addEventListener("message",({source:e,data:t})=>{e===k&&t===M&&K.length&&K.shift()()},!1),e=>{K.push(e),k.postMessage(M,"*")}):e=>setTimeout(e));var B,I,M,K;const H="undefined"!=typeof queueMicrotask?queueMicrotask.bind(k):"undefined"!=typeof process&&process.nextTick||D;var z={isArray:l,isArrayBuffer:f,isBuffer:d,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=o(e))||"object"===t&&h(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:p,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:g,isEmptyObject:e=>{if(!y(e)||d(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:O,isRequest:T,isResponse:S,isHeaders:A,isUndefined:u,isDate:b,isFile:w,isBlob:E,isRegExp:L,isFunction:h,isStream:e=>y(e)&&h(e.pipe),isURLSearchParams:R,isTypedArray:U,isFileList:v,forEach:_,merge:function e(){const{caseless:t,skipUndefined:n}=x(this)&&this||{},r={},s=(s,o)=>{const i=t&&P(r,o)||o;g(r[i])&&g(s)?r[i]=e(r[i],s):g(s)?r[i]=e({},s):l(s)?r[i]=s.slice():n&&u(s)||(r[i]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&_(arguments[e],s);return r},extend:(t,n,r,{allOwnKeys:s}={})=>(_(n,(n,s)=>{r&&h(n)?t[s]=e(n,r):t[s]=n},{allOwnKeys:s}),t),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,r,s)=>{let o,i,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],s&&!s(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:a,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[r]).call(e);let s;for(;(s=n.next())&&!s.done;){const n=s.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:j,hasOwnProperty:C,hasOwnProp:C,reduceDescriptors:F,freezeMethods:e=>{F(e,(t,n)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];h(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:P,global:k,isContextDefined:x,isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[s]&&e[r])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(d(e))return e;if(!("toJSON"in e)){t[r]=e;const s=l(e)?[]:{};return _(e,(e,t)=>{const o=n(e,r+1);!u(o)&&(s[t]=o)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:q,isThenable:e=>e&&(y(e)||h(e))&&h(e.then)&&h(e.catch),setImmediate:D,asap:H,isIterable:e=>null!=e&&h(e[r])};function W(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}z.inherits(W,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:z.toJSONObject(this.config),code:this.code,status:this.status}}});const $=W.prototype,J={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{J[e]={value:e}}),Object.defineProperties(W,J),Object.defineProperty($,"isAxiosError",{value:!0}),W.from=(e,t,n,r,s,o)=>{const i=Object.create($);z.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return W.call(i,a,c,n,r,s),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};function V(e){return z.isPlainObject(e)||z.isArray(e)}function X(e){return z.endsWith(e,"[]")?e.slice(0,-2):e}function G(e,t,n){return e?e.concat(t).map(function(e,t){return e=X(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Y=z.toFlatObject(z,{},null,function(e){return/^is[A-Z]/.test(e)});function Q(e,t,n){if(!z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!z.isUndefined(t[e])})).metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&z.isSpecCompliantForm(t);if(!z.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(z.isDate(e))return e.toISOString();if(z.isBoolean(e))return e.toString();if(!a&&z.isBlob(e))throw new W("Blob is not supported. Use a Buffer instead.");return z.isArrayBuffer(e)||z.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(z.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(z.isArray(e)&&function(e){return z.isArray(e)&&!e.some(V)}(e)||(z.isFileList(e)||z.endsWith(n,"[]"))&&(a=z.toArray(e)))return n=X(n),a.forEach(function(e,r){!z.isUndefined(e)&&null!==e&&t.append(!0===i?G([n],r,o):null===i?n:n+"[]",c(e))}),!1;return!!V(e)||(t.append(G(s,n,o),c(e)),!1)}const u=[],d=Object.assign(Y,{defaultVisitor:l,convertValue:c,isVisitable:V});if(!z.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!z.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),z.forEach(n,function(n,o){!0===(!(z.isUndefined(n)||null===n)&&s.call(t,n,z.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])}),u.pop()}}(e),t}function Z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ee(e,t){this._pairs=[],e&&Q(e,this,t)}const te=ee.prototype;function ne(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function re(e,t,n){if(!t)return e;const r=n&&n.encode||ne;z.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(o=s?s(t,n):z.isURLSearchParams(t)?t.toString():new ee(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}te.append=function(e,t){this._pairs.push([e,t])},te.toString=function(e){const t=e?function(t){return e.call(this,t,Z)}:Z;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var se=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){z.forEach(this.handlers,function(t){null!==t&&e(t)})}},oe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ie={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ee,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ae="undefined"!=typeof window&&"undefined"!=typeof document,ce="object"==typeof navigator&&navigator||void 0,le=ae&&(!ce||["ReactNative","NativeScript","NS"].indexOf(ce.product)<0),ue="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,de=ae&&window.location.href||"http://localhost";var fe={...Object.freeze({__proto__:null,hasBrowserEnv:ae,hasStandardBrowserWebWorkerEnv:ue,hasStandardBrowserEnv:le,navigator:ce,origin:de}),...ie};function pe(e){function t(e,n,r,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;if(o=!o&&z.isArray(r)?r.length:o,a)return z.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i;r[o]&&z.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],s)&&z.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}(r[o])),!i}if(z.isFormData(e)&&z.isFunction(e.entries)){const n={};return z.forEachEntry(e,(e,r)=>{t(function(e){return z.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const he={transitional:oe,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=z.isObject(e);s&&z.isHTMLForm(e)&&(e=new FormData(e));if(z.isFormData(e))return r?JSON.stringify(pe(e)):e;if(z.isArrayBuffer(e)||z.isBuffer(e)||z.isStream(e)||z.isFile(e)||z.isBlob(e)||z.isReadableStream(e))return e;if(z.isArrayBufferView(e))return e.buffer;if(z.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Q(e,new fe.classes.URLSearchParams,{visitor:function(e,t,n,r){return fe.isNode&&z.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=z.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Q(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(z.isString(e))try{return(t||JSON.parse)(e),z.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||he.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(z.isResponse(e)||z.isReadableStream(e))return e;if(e&&z.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw W.from(e,W.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:fe.classes.FormData,Blob:fe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};z.forEach(["delete","get","head","post","put","patch"],e=>{he.headers[e]={}});var me=he;const ye=z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const ge=Symbol("internals");function be(e){return e&&String(e).trim().toLowerCase()}function we(e){return!1===e||null==e?e:z.isArray(e)?e.map(we):String(e)}function Ee(e,t,n,r,s){return z.isFunction(r)?r.call(this,t,n):(s&&(t=n),z.isString(t)?z.isString(r)?-1!==t.indexOf(r):z.isRegExp(r)?r.test(t):void 0:void 0)}class ve{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=be(t);if(!s)throw new Error("header name must be a non-empty string");const o=z.findKey(r,s);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=we(e))}const o=(e,t)=>z.forEach(e,(e,n)=>s(e,n,t));if(z.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(z.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&ye[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(z.isObject(e)&&z.isIterable(e)){let n,r,s={};for(const t of e){if(!z.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?z.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,n);return this}get(e,t){if(e=be(e)){const n=z.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(z.isFunction(t))return t.call(this,e,n);if(z.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=be(e)){const n=z.findKey(this,e);return!(!n||void 0===this[n]||t&&!Ee(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=be(e)){const s=z.findKey(n,e);!s||t&&!Ee(0,n[s],s,t)||(delete n[s],r=!0)}}return z.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const s=t[n];e&&!Ee(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return z.forEach(this,(r,s)=>{const o=z.findKey(n,s);if(o)return t[o]=we(r),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();i!==s&&delete t[s],t[i]=we(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return z.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&z.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ge]=this[ge]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=be(e);t[r]||(!function(e,t){const n=z.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})})}(n,e),t[r]=!0)}return z.isArray(e)?e.forEach(r):r(e),this}}ve.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),z.reduceDescriptors(ve.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),z.freezeMethods(ve);var Re=ve;function Oe(e,t){const n=this||me,r=t||n,s=Re.from(r.headers);let o=r.data;return z.forEach(e,function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Te(e){return!(!e||!e.__CANCEL__)}function Se(e,t,n){W.call(this,null==e?"canceled":e,W.ERR_CANCELED,t,n),this.name="CanceledError"}function Ae(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new W("Request failed with status code "+n.status,[W.ERR_BAD_REQUEST,W.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}z.inherits(Se,W,{__CANCEL__:!0});const _e=(e,t,n=3)=>{let r=0;const s=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[i];s||(s=c),n[o]=a,r[o]=c;let u=i,d=0;for(;u!==o;)d+=n[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const f=l&&c-l;return f?Math.round(1e3*d/f):void 0}}(50,250);return function(e,t){let n,r,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},o-a)))},()=>n&&i(n)]}(n=>{const o=n.loaded,i=n.lengthComputable?n.total:void 0,a=o-r,c=s(a);r=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},Pe=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ke=e=>(...t)=>z.asap(()=>e(...t));var xe=fe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,fe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(fe.origin),fe.navigator&&/(msie|trident)/i.test(fe.navigator.userAgent)):()=>!0,Ue=fe.hasStandardBrowserEnv?{write(e,t,n,r,s,o){const i=[e+"="+encodeURIComponent(t)];z.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),z.isString(r)&&i.push("path="+r),z.isString(s)&&i.push("domain="+s),!0===o&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ne(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const je=e=>e instanceof Re?{...e}:e;function Ce(e,t){t=t||{};const n={};function r(e,t,n,r){return z.isPlainObject(e)&&z.isPlainObject(t)?z.merge.call({caseless:r},e,t):z.isPlainObject(t)?z.merge({},t):z.isArray(t)?t.slice():t}function s(e,t,n,s){return z.isUndefined(t)?z.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function o(e,t){if(!z.isUndefined(t))return r(void 0,t)}function i(e,t){return z.isUndefined(t)?z.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,s,o){return o in t?r(n,s):o in e?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>s(je(e),je(t),0,!0)};return z.forEach(Object.keys({...e,...t}),function(r){const o=c[r]||s,i=o(e[r],t[r],r);z.isUndefined(i)&&o!==a||(n[r]=i)}),n}var Le=e=>{const t=Ce({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Re.from(i),t.url=re(Ne(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),z.isFormData(n))if(fe.hasStandardBrowserEnv||fe.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(z.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&i.set(e,n)})}if(fe.hasStandardBrowserEnv&&(r&&z.isFunction(r)&&(r=r(t)),r||!1!==r&&xe(t.url))){const e=s&&o&&Ue.read(o);e&&i.set(s,e)}return t};var Fe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Le(e);let s=r.data;const o=Re.from(r.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:f,onDownloadProgress:p}=r;function h(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=Re.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ae(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new W("Request aborted",W.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new W(t&&t.message?t.message:"Network Error",W.ERR_NETWORK,e,m);r.event=t||null,n(r),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||oe;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new W(t,s.clarifyTimeoutError?W.ETIMEDOUT:W.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&z.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),z.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,u]=_e(p,!0),m.addEventListener("progress",c)),f&&m.upload&&([a,l]=_e(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Se(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);g&&-1===fe.protocols.indexOf(g)?n(new W("Unsupported protocol "+g+":",W.ERR_BAD_REQUEST,e)):m.send(s||null)})};var qe=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const s=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof W?t:new Se(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new W(`timeout ${t} of ms exceeded`,W.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>z.asap(i),a}};const De=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,s=0;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},Be=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Ie=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of Be(e))yield*De(n,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=i+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),s.return())},{highWaterMark:2})},{isFunction:Me}=z,Ke=(({Request:e,Response:t})=>({Request:e,Response:t}))(z.global),{ReadableStream:He,TextEncoder:ze}=z.global,We=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},$e=e=>{e=z.merge.call({skipUndefined:!0},Ke,e);const{fetch:t,Request:n,Response:r}=e,s=t?Me(t):"function"==typeof fetch,o=Me(n),i=Me(r);if(!s)return!1;const a=s&&Me(He),c=s&&("function"==typeof ze?(l=new ze,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=o&&a&&We(()=>{let e=!1;const t=new n(fe.origin,{body:new He,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=i&&a&&We(()=>z.isReadableStream(new r("").body)),f={stream:d&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new W(`Response type '${e}' is not supported`,W.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=z.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e)){const t=new n(fe.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return z.isArrayBufferView(e)||z.isArrayBuffer(e)?e.byteLength:(z.isURLSearchParams(e)&&(e+=""),z.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:l,timeout:h,onDownloadProgress:m,onUploadProgress:y,responseType:g,headers:b,withCredentials:w="same-origin",fetchOptions:E}=Le(e),v=t||fetch;g=g?(g+"").toLowerCase():"text";let R=qe([c,l&&l.toAbortSignal()],h),O=null;const T=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let S;try{if(y&&u&&"get"!==i&&"head"!==i&&0!==(S=await p(b,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(z.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=Pe(S,_e(ke(y)));a=Ie(t.body,65536,e,n)}}z.isString(w)||(w=w?"include":"omit");const t=o&&"credentials"in n.prototype,c={...E,signal:R,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};O=o&&new n(s,c);let l=await(o?v(O,E):v(s,c));const h=d&&("stream"===g||"response"===g);if(d&&(m||h&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=z.toFiniteNumber(l.headers.get("content-length")),[n,s]=m&&Pe(t,_e(ke(m),!0))||[];l=new r(Ie(l.body,65536,n,()=>{s&&s(),T&&T()}),e)}g=g||"text";let A=await f[z.findKey(f,g)||"text"](l,e);return!h&&T&&T(),await new Promise((t,n)=>{Ae(t,n,{data:A,headers:Re.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:O})})}catch(t){if(T&&T(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new W("Network Error",W.ERR_NETWORK,e,O),{cause:t.cause||t});throw W.from(t,t&&t.code,e,O)}}},Je=new Map,Ve=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i,a,c=o.length,l=Je;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:$e(t)),l=a;return a};Ve();const Xe={http:null,xhr:Fe,fetch:{get:Ve}};z.forEach(Xe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Ge=e=>`- ${e}`,Ye=e=>z.isFunction(e)||null===e||!1===e;var Qe=(e,t)=>{e=z.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){let n;if(r=e[i],s=r,!Ye(r)&&(s=Xe[(n=String(r)).toLowerCase()],void 0===s))throw new W(`Unknown adapter '${n}'`);if(s&&(z.isFunction(s)||(s=s.get(t))))break;o[n||"#"+i]=s}if(!s){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new W("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(Ge).join("\n"):" "+Ge(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s};function Ze(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Se(null,e)}function et(e){Ze(e),e.headers=Re.from(e.headers),e.data=Oe.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Qe(e.adapter||me.adapter,e)(e).then(function(t){return Ze(e),t.data=Oe.call(e,e.transformResponse,t),t.headers=Re.from(t.headers),t},function(t){return Te(t)||(Ze(e),t&&t.response&&(t.response.data=Oe.call(e,e.transformResponse,t.response),t.response.headers=Re.from(t.response.headers))),Promise.reject(t)})}const tt="1.12.2",nt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{nt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const rt={};nt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+tt+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,o)=>{if(!1===e)throw new W(r(s," has been removed"+(t?" in "+t:"")),W.ERR_DEPRECATED);return t&&!rt[s]&&(rt[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,o)}},nt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var st={assertOptions:function(e,t,n){if("object"!=typeof e)throw new W("options must be an object",W.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const t=e[o],n=void 0===t||i(t,o,e);if(!0!==n)throw new W("option "+o+" must be "+n,W.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new W("Unknown option "+o,W.ERR_BAD_OPTION)}},validators:nt};const ot=st.validators;class it{constructor(e){this.defaults=e||{},this.interceptors={request:new se,response:new se}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ce(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&st.assertOptions(n,{silentJSONParsing:ot.transitional(ot.boolean),forcedJSONParsing:ot.transitional(ot.boolean),clarifyTimeoutError:ot.transitional(ot.boolean)},!1),null!=r&&(z.isFunction(r)?t.paramsSerializer={serialize:r}:st.assertOptions(r,{encode:ot.function,serialize:ot.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),st.assertOptions(t,{baseUrl:ot.spelling("baseURL"),withXsrfToken:ot.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&z.merge(s.common,s[t.method]);s&&z.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=Re.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[et.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let f=t;for(;d<u;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=et.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return re(Ne((e=Ce(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}z.forEach(["delete","get","head","options"],function(e){it.prototype[e]=function(t,n){return this.request(Ce(n||{},{method:e,url:t,data:(n||{}).data}))}}),z.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(Ce(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}it.prototype[e]=t(),it.prototype[e+"Form"]=t(!0)});var at=it;class ct{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,s){n.reason||(n.reason=new Se(e,r,s),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ct(function(t){e=t}),cancel:e}}}var lt=ct;const ut={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ut).forEach(([e,t])=>{ut[t]=e});var dt=ut;const ft=function t(n){const r=new at(n),s=e(at.prototype.request,r);return z.extend(s,at.prototype,r,{allOwnKeys:!0}),z.extend(s,r,null,{allOwnKeys:!0}),s.create=function(e){return t(Ce(n,e))},s}(me);ft.Axios=at,ft.CanceledError=Se,ft.CancelToken=lt,ft.isCancel=Te,ft.VERSION=tt,ft.toFormData=Q,ft.AxiosError=W,ft.Cancel=ft.CanceledError,ft.all=function(e){return Promise.all(e)},ft.spread=function(e){return function(t){return e.apply(null,t)}},ft.isAxiosError=function(e){return z.isObject(e)&&!0===e.isAxiosError},ft.mergeConfig=Ce,ft.AxiosHeaders=Re,ft.formToJSON=e=>pe(z.isHTMLForm(e)?new FormData(e):e),ft.getAdapter=Qe,ft.HttpStatusCode=dt,ft.default=ft;var pt=ft;class ht{async initWithAccountToken(e){let{server:t,accountToken:n,appUuid:r}=e;if(this.initServer(t),this.appUuid=r,this.server&&this.appUuid)try{const e=await pt.get(`${this.server}api/v2.1/universal-apps/${this.appUuid}/access-token/`,{headers:{Authorization:"Token "+n}});this.accessToken=e.data?.access_token||"",this.createReq()}catch(e){console.log("Authorization failed")}}init(e){let{server:t,accessToken:n,appUuid:r}=e;this.initServer(t),this.accessToken=n||"",this.appUuid=r,this.accessToken&&this.server&&this.appUuid&&this.createReq()}initServer(e){e&&(this.server=e.endsWith("/")?e:`${e}/`)}createReq(){this.req=pt.create({baseURL:this.server,headers:{Authorization:"Token "+this.accessToken}})}listRows(e,t,n,r){const s=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,o={page_id:e,table_name:t,start:n,limit:r};return this.req.get(s,{params:o})}addRow(e,t,n,r){const s=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,o={page_id:e,table_name:t,row_data:n,row_links_data:r};return this.req.post(s,o)}addRows(e,t,n,r){const s=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/batch/`,o={page_id:e,table_name:t,rows_data:n,rows_links_data:r};return this.req.post(s,o)}updateRows(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,s={page_id:e,table_name:t,rows_data:n};return this.req.put(r,s)}deleteRows(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,s={page_id:e,table_name:t,rows_ids:n};return this.req.delete(r,s)}}const mt="HTML_PAGE_REQUEST",yt="HTML_PAGE_RESPONSE",gt="HTML_PAGE_EVENT",bt="WINDOW_EVENT",wt="get_server",Et="get_access_token",vt="get_app_uuid",Rt="get_page_id",Ot="app",Tt="iframe",St=["click","dblclick","mousemove","mouseenter","mouseleave","mousedown","mouseup","contextmenu"],At=["keydown","keyup","keypress"],_t=["dragstart","dragover","drag","dragend","dragenter","dragleave","drop"],Pt=["mousemove","dragover"],kt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),xt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4,t="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789",n="";for(let r=0;r<e;r++)n+=t.charAt(Math.floor(72*Math.random()));return n},Ut=e=>{let{eventType:t,event:n}=e;return St.includes(t)?{type:t,x:n.x,y:n.y,button:n.button,buttons:n.buttons}:At.includes(t)?{type:t,key:n.key,code:n.code,keyCode:n.keyCode,ctrlKey:n.ctrlKey,shiftKey:n.shiftKey,altKey:n.altKey,metaKey:n.metaKey,repeat:n.repeat}:_t.includes(t)?{type:t,x:n.x,y:n.y}:null};class Nt{constructor(e){this.options=e||{},this.selfWindow=window.parent===window.self,this.targetOrigin=this.options.targetOrigin||"*",this.pendingRequests={},this.eventHandlers={},this.timeout=this.options.timeout||1e4,this.setupMessageListener()}generatorRequestId(){let e=xt();for(;kt(this.pendingRequests,e);)e=xt();return e}setupMessageListener(){this.selfWindow||(window.addEventListener("message",this.handleMessage.bind(this)),this.setEventsListener())}postWindowEvent(e){e&&window.parent.postMessage({type:bt,params:{event_data:{...e,source:Tt}}},this.targetOrigin)}setEventsListener(){let e=null,t=null;[...St,...At,..._t].forEach(n=>{window.addEventListener(n,r=>{if(r.source!==Ot)return Pt.includes(n)?(t=Ut({eventType:n,event:r}),void(null===e&&(e=requestAnimationFrame(()=>{t&&(this.postWindowEvent(t),t=null,e=null)})))):void this.postWindowEvent(Ut({eventType:n,event:r}))},!0)})}async request(e,t){if(this.selfWindow)return new Promise(e=>{e(null)});const n=this.generatorRequestId();return new Promise((r,s)=>{this.pendingRequests[n]={resolve:r,reject:s},window.parent.postMessage({type:mt,requestId:n,method:e,params:t},this.targetOrigin);const o=setTimeout(()=>{kt(this.pendingRequests,n)&&(delete this.pendingRequests[n],s(new Error(`Request timeout: ${e}`)))},this.timeout),i=this.pendingRequests[n];i&&(i.timeoutId=o)})}handleMessage(e){const{type:t,requestId:n,data:r,error:s,eventType:o,payload:i}=e.data;if(t===yt){const e=this.pendingRequests[n];e&&(clearTimeout(e.timeoutId),delete this.pendingRequests[n],s?e.reject(new Error(s)):e.resolve(r?JSON.parse(r):null))}else if(t===gt)this.emitEvent(o,i);else if(t===bt){const e=r.event_data;if(!e)return;let t,n;if(At.includes(e.type))t=new KeyboardEvent(e.type,{bubbles:!0,cancelable:!0,key:e.key,code:e.code,keyCode:e.keyCode,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,repeat:e.repeat,view:window}),n=document.activeElement||document.body;else if(St.includes(e.type)){t=new MouseEvent(e.type,{bubbles:!0,cancelable:!0,view:window,clientX:e.x,clientY:e.y,screenX:e.x,screenY:e.y,button:e.button,buttons:e.buttons});n=document.elementFromPoint(e.x,e.y)||document.body}else if(_t.includes(e.type)){t=new DragEvent(e.type,{bubbles:!0,cancelable:!0,view:window,clientX:e.x,clientY:e.y,screenX:e.x,screenY:e.y,button:e.button,buttons:e.buttons});n=document.elementFromPoint(e.x,e.y)||document.body}if(!n||!t)return;t.source=e.source,n.dispatchEvent(t)}}on(e,t){return kt(this.eventHandlers,e)||(this.eventHandlers[e]=[]),this.eventHandlers[e].push(t),()=>this.off(e,t)}off(e,t){const n=this.eventHandlers[e];if(n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}emitEvent(e,t){(this.eventHandlers[e]||[]).forEach(n=>{try{n(t)}catch(t){console.error(`Error in event handler for ${e}:`,t)}})}destroy(){this.pendingRequests.forEach(e=>{clearTimeout(e.timeoutId),e.reject(new Error("Adapter destroyed"))}),this.pendingRequests={},this.eventHandlers={}}}return class{constructor(e){this.options=e||{},this.iframeAdapter=new Nt(e)}async init(){if(this.options||(this.options={}),this.htmlPageAPI=new ht,this.options.server||(this.options.server=await this.iframeAdapter.request(wt)),this.options.appUuid||(this.options.appUuid=await this.iframeAdapter.request(vt)),this.options.pageId||(this.options.pageId=await this.iframeAdapter.request(Rt)),this.options.accountToken){const{server:e,accountToken:t,appUuid:n}=this.options;await this.htmlPageAPI.initWithAccountToken({server:e,accountToken:t,appUuid:n})}else{this.options.accessToken||(this.options.accessToken=await this.iframeAdapter.request(Et));const{server:e,accessToken:t,appUuid:n}=this.options;this.htmlPageAPI.init({server:e,accessToken:t,appUuid:n})}}listRows(e){let{tableName:t,start:n,limit:r}=e;return this.htmlPageAPI.listRows(this.options.pageId,t,n,r)}addRow(e){let{tableName:t,rowData:n,rowLinksData:r}=e;return this.htmlPageAPI.addRow(this.options.pageId,t,n,r)}updateRow(e){let{tableName:t,rowId:n,rowData:r}=e;const s=[{id:n,row:r}];this.batchUpdateRows({tableName:t,rowsData:s})}deleteRow(e){let{tableName:t,rowId:n}=e;const r=[n];return this.batchDeleteRows({tableName:t,rowsIds:r})}batchAddRows(e){let{tableName:t,rowsData:n,rowsLinksData:r}=e;return this.htmlPageAPI.addRows(this.options.pageId,t,n,r)}batchUpdateRows(e){let{tableName:t,rowsData:n}=e;return this.htmlPageAPI.updateRows(this.options.pageId,t,n)}batchDeleteRows(e){let{tableName:t,rowsIds:n}=e;return this.htmlPageAPI.deleteRows(this.options.pageId,t,n)}}});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLPageSDK=t()}(this,function(){"use strict";function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:r,toStringTag:s}=Symbol,o=(i=Object.create(null),e=>{const n=t.call(e);return i[n]||(i[n]=n.slice(8,-1).toLowerCase())});var i;const a=e=>(e=e.toLowerCase(),t=>o(t)===e),c=e=>t=>typeof t===e,{isArray:l}=Array,u=c("undefined");function d(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const f=a("ArrayBuffer");const p=c("string"),h=c("function"),m=c("number"),y=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==o(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||s in e||r in e)},b=a("Date"),w=a("File"),E=a("Blob"),v=a("FileList"),R=a("URLSearchParams"),[O,T,S,A]=["ReadableStream","Request","Response","Headers"].map(a);function _(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(d(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(r=0;r<o;r++)i=s[r],t.call(null,e[i],i,e)}}function P(e,t){if(d(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,x=e=>!u(e)&&e!==k;const U=(N="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>N&&e instanceof N);var N;const j=a("HTMLFormElement"),C=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),L=a("RegExp"),F=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};_(n,(n,s)=>{let o;!1!==(o=t(n,s,e))&&(r[s]=o||n)}),Object.defineProperties(e,r)};const q=a("AsyncFunction"),D=(B="function"==typeof setImmediate,I=h(k.postMessage),B?setImmediate:I?(M=`axios@${Math.random()}`,K=[],k.addEventListener("message",({source:e,data:t})=>{e===k&&t===M&&K.length&&K.shift()()},!1),e=>{K.push(e),k.postMessage(M,"*")}):e=>setTimeout(e));var B,I,M,K;const H="undefined"!=typeof queueMicrotask?queueMicrotask.bind(k):"undefined"!=typeof process&&process.nextTick||D;var z={isArray:l,isArrayBuffer:f,isBuffer:d,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=o(e))||"object"===t&&h(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:p,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:g,isEmptyObject:e=>{if(!y(e)||d(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:O,isRequest:T,isResponse:S,isHeaders:A,isUndefined:u,isDate:b,isFile:w,isBlob:E,isRegExp:L,isFunction:h,isStream:e=>y(e)&&h(e.pipe),isURLSearchParams:R,isTypedArray:U,isFileList:v,forEach:_,merge:function e(){const{caseless:t,skipUndefined:n}=x(this)&&this||{},r={},s=(s,o)=>{const i=t&&P(r,o)||o;g(r[i])&&g(s)?r[i]=e(r[i],s):g(s)?r[i]=e({},s):l(s)?r[i]=s.slice():n&&u(s)||(r[i]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&_(arguments[e],s);return r},extend:(t,n,r,{allOwnKeys:s}={})=>(_(n,(n,s)=>{r&&h(n)?t[s]=e(n,r):t[s]=n},{allOwnKeys:s}),t),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,r,s)=>{let o,i,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],s&&!s(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:a,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[r]).call(e);let s;for(;(s=n.next())&&!s.done;){const n=s.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:j,hasOwnProperty:C,hasOwnProp:C,reduceDescriptors:F,freezeMethods:e=>{F(e,(t,n)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];h(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:P,global:k,isContextDefined:x,isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[s]&&e[r])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(d(e))return e;if(!("toJSON"in e)){t[r]=e;const s=l(e)?[]:{};return _(e,(e,t)=>{const o=n(e,r+1);!u(o)&&(s[t]=o)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:q,isThenable:e=>e&&(y(e)||h(e))&&h(e.then)&&h(e.catch),setImmediate:D,asap:H,isIterable:e=>null!=e&&h(e[r])};function W(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}z.inherits(W,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:z.toJSONObject(this.config),code:this.code,status:this.status}}});const $=W.prototype,J={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{J[e]={value:e}}),Object.defineProperties(W,J),Object.defineProperty($,"isAxiosError",{value:!0}),W.from=(e,t,n,r,s,o)=>{const i=Object.create($);z.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return W.call(i,a,c,n,r,s),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};function V(e){return z.isPlainObject(e)||z.isArray(e)}function X(e){return z.endsWith(e,"[]")?e.slice(0,-2):e}function G(e,t,n){return e?e.concat(t).map(function(e,t){return e=X(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Y=z.toFlatObject(z,{},null,function(e){return/^is[A-Z]/.test(e)});function Q(e,t,n){if(!z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!z.isUndefined(t[e])})).metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&z.isSpecCompliantForm(t);if(!z.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(z.isDate(e))return e.toISOString();if(z.isBoolean(e))return e.toString();if(!a&&z.isBlob(e))throw new W("Blob is not supported. Use a Buffer instead.");return z.isArrayBuffer(e)||z.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(z.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(z.isArray(e)&&function(e){return z.isArray(e)&&!e.some(V)}(e)||(z.isFileList(e)||z.endsWith(n,"[]"))&&(a=z.toArray(e)))return n=X(n),a.forEach(function(e,r){!z.isUndefined(e)&&null!==e&&t.append(!0===i?G([n],r,o):null===i?n:n+"[]",c(e))}),!1;return!!V(e)||(t.append(G(s,n,o),c(e)),!1)}const u=[],d=Object.assign(Y,{defaultVisitor:l,convertValue:c,isVisitable:V});if(!z.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!z.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),z.forEach(n,function(n,o){!0===(!(z.isUndefined(n)||null===n)&&s.call(t,n,z.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])}),u.pop()}}(e),t}function Z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ee(e,t){this._pairs=[],e&&Q(e,this,t)}const te=ee.prototype;function ne(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function re(e,t,n){if(!t)return e;const r=n&&n.encode||ne;z.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(o=s?s(t,n):z.isURLSearchParams(t)?t.toString():new ee(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}te.append=function(e,t){this._pairs.push([e,t])},te.toString=function(e){const t=e?function(t){return e.call(this,t,Z)}:Z;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var se=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){z.forEach(this.handlers,function(t){null!==t&&e(t)})}},oe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ie={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ee,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ae="undefined"!=typeof window&&"undefined"!=typeof document,ce="object"==typeof navigator&&navigator||void 0,le=ae&&(!ce||["ReactNative","NativeScript","NS"].indexOf(ce.product)<0),ue="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,de=ae&&window.location.href||"http://localhost";var fe={...Object.freeze({__proto__:null,hasBrowserEnv:ae,hasStandardBrowserWebWorkerEnv:ue,hasStandardBrowserEnv:le,navigator:ce,origin:de}),...ie};function pe(e){function t(e,n,r,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;if(o=!o&&z.isArray(r)?r.length:o,a)return z.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i;r[o]&&z.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],s)&&z.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}(r[o])),!i}if(z.isFormData(e)&&z.isFunction(e.entries)){const n={};return z.forEachEntry(e,(e,r)=>{t(function(e){return z.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const he={transitional:oe,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=z.isObject(e);s&&z.isHTMLForm(e)&&(e=new FormData(e));if(z.isFormData(e))return r?JSON.stringify(pe(e)):e;if(z.isArrayBuffer(e)||z.isBuffer(e)||z.isStream(e)||z.isFile(e)||z.isBlob(e)||z.isReadableStream(e))return e;if(z.isArrayBufferView(e))return e.buffer;if(z.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Q(e,new fe.classes.URLSearchParams,{visitor:function(e,t,n,r){return fe.isNode&&z.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=z.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Q(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(z.isString(e))try{return(t||JSON.parse)(e),z.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||he.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(z.isResponse(e)||z.isReadableStream(e))return e;if(e&&z.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw W.from(e,W.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:fe.classes.FormData,Blob:fe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};z.forEach(["delete","get","head","post","put","patch"],e=>{he.headers[e]={}});var me=he;const ye=z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const ge=Symbol("internals");function be(e){return e&&String(e).trim().toLowerCase()}function we(e){return!1===e||null==e?e:z.isArray(e)?e.map(we):String(e)}function Ee(e,t,n,r,s){return z.isFunction(r)?r.call(this,t,n):(s&&(t=n),z.isString(t)?z.isString(r)?-1!==t.indexOf(r):z.isRegExp(r)?r.test(t):void 0:void 0)}class ve{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=be(t);if(!s)throw new Error("header name must be a non-empty string");const o=z.findKey(r,s);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=we(e))}const o=(e,t)=>z.forEach(e,(e,n)=>s(e,n,t));if(z.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(z.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&ye[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(z.isObject(e)&&z.isIterable(e)){let n,r,s={};for(const t of e){if(!z.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?z.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,n);return this}get(e,t){if(e=be(e)){const n=z.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(z.isFunction(t))return t.call(this,e,n);if(z.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=be(e)){const n=z.findKey(this,e);return!(!n||void 0===this[n]||t&&!Ee(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=be(e)){const s=z.findKey(n,e);!s||t&&!Ee(0,n[s],s,t)||(delete n[s],r=!0)}}return z.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const s=t[n];e&&!Ee(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return z.forEach(this,(r,s)=>{const o=z.findKey(n,s);if(o)return t[o]=we(r),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();i!==s&&delete t[s],t[i]=we(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return z.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&z.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ge]=this[ge]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=be(e);t[r]||(!function(e,t){const n=z.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})})}(n,e),t[r]=!0)}return z.isArray(e)?e.forEach(r):r(e),this}}ve.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),z.reduceDescriptors(ve.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),z.freezeMethods(ve);var Re=ve;function Oe(e,t){const n=this||me,r=t||n,s=Re.from(r.headers);let o=r.data;return z.forEach(e,function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Te(e){return!(!e||!e.__CANCEL__)}function Se(e,t,n){W.call(this,null==e?"canceled":e,W.ERR_CANCELED,t,n),this.name="CanceledError"}function Ae(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new W("Request failed with status code "+n.status,[W.ERR_BAD_REQUEST,W.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}z.inherits(Se,W,{__CANCEL__:!0});const _e=(e,t,n=3)=>{let r=0;const s=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[i];s||(s=c),n[o]=a,r[o]=c;let u=i,d=0;for(;u!==o;)d+=n[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const f=l&&c-l;return f?Math.round(1e3*d/f):void 0}}(50,250);return function(e,t){let n,r,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},o-a)))},()=>n&&i(n)]}(n=>{const o=n.loaded,i=n.lengthComputable?n.total:void 0,a=o-r,c=s(a);r=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},Pe=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ke=e=>(...t)=>z.asap(()=>e(...t));var xe=fe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,fe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(fe.origin),fe.navigator&&/(msie|trident)/i.test(fe.navigator.userAgent)):()=>!0,Ue=fe.hasStandardBrowserEnv?{write(e,t,n,r,s,o){const i=[e+"="+encodeURIComponent(t)];z.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),z.isString(r)&&i.push("path="+r),z.isString(s)&&i.push("domain="+s),!0===o&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ne(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const je=e=>e instanceof Re?{...e}:e;function Ce(e,t){t=t||{};const n={};function r(e,t,n,r){return z.isPlainObject(e)&&z.isPlainObject(t)?z.merge.call({caseless:r},e,t):z.isPlainObject(t)?z.merge({},t):z.isArray(t)?t.slice():t}function s(e,t,n,s){return z.isUndefined(t)?z.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function o(e,t){if(!z.isUndefined(t))return r(void 0,t)}function i(e,t){return z.isUndefined(t)?z.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,s,o){return o in t?r(n,s):o in e?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>s(je(e),je(t),0,!0)};return z.forEach(Object.keys({...e,...t}),function(r){const o=c[r]||s,i=o(e[r],t[r],r);z.isUndefined(i)&&o!==a||(n[r]=i)}),n}var Le=e=>{const t=Ce({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Re.from(i),t.url=re(Ne(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),z.isFormData(n))if(fe.hasStandardBrowserEnv||fe.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(z.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&i.set(e,n)})}if(fe.hasStandardBrowserEnv&&(r&&z.isFunction(r)&&(r=r(t)),r||!1!==r&&xe(t.url))){const e=s&&o&&Ue.read(o);e&&i.set(s,e)}return t};var Fe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Le(e);let s=r.data;const o=Re.from(r.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:f,onDownloadProgress:p}=r;function h(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=Re.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ae(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new W("Request aborted",W.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new W(t&&t.message?t.message:"Network Error",W.ERR_NETWORK,e,m);r.event=t||null,n(r),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||oe;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new W(t,s.clarifyTimeoutError?W.ETIMEDOUT:W.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&z.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),z.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,u]=_e(p,!0),m.addEventListener("progress",c)),f&&m.upload&&([a,l]=_e(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Se(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);g&&-1===fe.protocols.indexOf(g)?n(new W("Unsupported protocol "+g+":",W.ERR_BAD_REQUEST,e)):m.send(s||null)})};var qe=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const s=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof W?t:new Se(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new W(`timeout ${t} of ms exceeded`,W.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>z.asap(i),a}};const De=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,s=0;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},Be=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Ie=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of Be(e))yield*De(n,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=i+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),s.return())},{highWaterMark:2})},{isFunction:Me}=z,Ke=(({Request:e,Response:t})=>({Request:e,Response:t}))(z.global),{ReadableStream:He,TextEncoder:ze}=z.global,We=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},$e=e=>{e=z.merge.call({skipUndefined:!0},Ke,e);const{fetch:t,Request:n,Response:r}=e,s=t?Me(t):"function"==typeof fetch,o=Me(n),i=Me(r);if(!s)return!1;const a=s&&Me(He),c=s&&("function"==typeof ze?(l=new ze,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=o&&a&&We(()=>{let e=!1;const t=new n(fe.origin,{body:new He,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=i&&a&&We(()=>z.isReadableStream(new r("").body)),f={stream:d&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new W(`Response type '${e}' is not supported`,W.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=z.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e)){const t=new n(fe.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return z.isArrayBufferView(e)||z.isArrayBuffer(e)?e.byteLength:(z.isURLSearchParams(e)&&(e+=""),z.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:l,timeout:h,onDownloadProgress:m,onUploadProgress:y,responseType:g,headers:b,withCredentials:w="same-origin",fetchOptions:E}=Le(e),v=t||fetch;g=g?(g+"").toLowerCase():"text";let R=qe([c,l&&l.toAbortSignal()],h),O=null;const T=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let S;try{if(y&&u&&"get"!==i&&"head"!==i&&0!==(S=await p(b,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(z.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=Pe(S,_e(ke(y)));a=Ie(t.body,65536,e,n)}}z.isString(w)||(w=w?"include":"omit");const t=o&&"credentials"in n.prototype,c={...E,signal:R,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};O=o&&new n(s,c);let l=await(o?v(O,E):v(s,c));const h=d&&("stream"===g||"response"===g);if(d&&(m||h&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=z.toFiniteNumber(l.headers.get("content-length")),[n,s]=m&&Pe(t,_e(ke(m),!0))||[];l=new r(Ie(l.body,65536,n,()=>{s&&s(),T&&T()}),e)}g=g||"text";let A=await f[z.findKey(f,g)||"text"](l,e);return!h&&T&&T(),await new Promise((t,n)=>{Ae(t,n,{data:A,headers:Re.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:O})})}catch(t){if(T&&T(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new W("Network Error",W.ERR_NETWORK,e,O),{cause:t.cause||t});throw W.from(t,t&&t.code,e,O)}}},Je=new Map,Ve=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i,a,c=o.length,l=Je;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:$e(t)),l=a;return a};Ve();const Xe={http:null,xhr:Fe,fetch:{get:Ve}};z.forEach(Xe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Ge=e=>`- ${e}`,Ye=e=>z.isFunction(e)||null===e||!1===e;var Qe=(e,t)=>{e=z.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){let n;if(r=e[i],s=r,!Ye(r)&&(s=Xe[(n=String(r)).toLowerCase()],void 0===s))throw new W(`Unknown adapter '${n}'`);if(s&&(z.isFunction(s)||(s=s.get(t))))break;o[n||"#"+i]=s}if(!s){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new W("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(Ge).join("\n"):" "+Ge(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s};function Ze(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Se(null,e)}function et(e){Ze(e),e.headers=Re.from(e.headers),e.data=Oe.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Qe(e.adapter||me.adapter,e)(e).then(function(t){return Ze(e),t.data=Oe.call(e,e.transformResponse,t),t.headers=Re.from(t.headers),t},function(t){return Te(t)||(Ze(e),t&&t.response&&(t.response.data=Oe.call(e,e.transformResponse,t.response),t.response.headers=Re.from(t.response.headers))),Promise.reject(t)})}const tt="1.12.2",nt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{nt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const rt={};nt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+tt+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,o)=>{if(!1===e)throw new W(r(s," has been removed"+(t?" in "+t:"")),W.ERR_DEPRECATED);return t&&!rt[s]&&(rt[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,o)}},nt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var st={assertOptions:function(e,t,n){if("object"!=typeof e)throw new W("options must be an object",W.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const t=e[o],n=void 0===t||i(t,o,e);if(!0!==n)throw new W("option "+o+" must be "+n,W.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new W("Unknown option "+o,W.ERR_BAD_OPTION)}},validators:nt};const ot=st.validators;class it{constructor(e){this.defaults=e||{},this.interceptors={request:new se,response:new se}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ce(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&st.assertOptions(n,{silentJSONParsing:ot.transitional(ot.boolean),forcedJSONParsing:ot.transitional(ot.boolean),clarifyTimeoutError:ot.transitional(ot.boolean)},!1),null!=r&&(z.isFunction(r)?t.paramsSerializer={serialize:r}:st.assertOptions(r,{encode:ot.function,serialize:ot.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),st.assertOptions(t,{baseUrl:ot.spelling("baseURL"),withXsrfToken:ot.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&z.merge(s.common,s[t.method]);s&&z.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=Re.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[et.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let f=t;for(;d<u;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=et.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return re(Ne((e=Ce(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}z.forEach(["delete","get","head","options"],function(e){it.prototype[e]=function(t,n){return this.request(Ce(n||{},{method:e,url:t,data:(n||{}).data}))}}),z.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(Ce(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}it.prototype[e]=t(),it.prototype[e+"Form"]=t(!0)});var at=it;class ct{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,s){n.reason||(n.reason=new Se(e,r,s),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ct(function(t){e=t}),cancel:e}}}var lt=ct;const ut={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ut).forEach(([e,t])=>{ut[t]=e});var dt=ut;const ft=function t(n){const r=new at(n),s=e(at.prototype.request,r);return z.extend(s,at.prototype,r,{allOwnKeys:!0}),z.extend(s,r,null,{allOwnKeys:!0}),s.create=function(e){return t(Ce(n,e))},s}(me);ft.Axios=at,ft.CanceledError=Se,ft.CancelToken=lt,ft.isCancel=Te,ft.VERSION=tt,ft.toFormData=Q,ft.AxiosError=W,ft.Cancel=ft.CanceledError,ft.all=function(e){return Promise.all(e)},ft.spread=function(e){return function(t){return e.apply(null,t)}},ft.isAxiosError=function(e){return z.isObject(e)&&!0===e.isAxiosError},ft.mergeConfig=Ce,ft.AxiosHeaders=Re,ft.formToJSON=e=>pe(z.isHTMLForm(e)?new FormData(e):e),ft.getAdapter=Qe,ft.HttpStatusCode=dt,ft.default=ft;var pt=ft;class ht{async initWithAccountToken(e){let{server:t,accountToken:n,appUuid:r}=e;if(this.initServer(t),this.appUuid=r,this.server&&this.appUuid)try{const e=await pt.get(`${this.server}api/v2.1/universal-apps/${this.appUuid}/access-token/`,{headers:{Authorization:"Token "+n}});this.accessToken=e.data?.access_token||"",this.createReq()}catch(e){console.log("Authorization failed")}}init(e){let{server:t,accessToken:n,appUuid:r}=e;this.initServer(t),this.accessToken=n||"",this.appUuid=r,this.accessToken&&this.server&&this.appUuid&&this.createReq()}initServer(e){e&&(this.server=e.endsWith("/")?e:`${e}/`)}createReq(){this.req=pt.create({baseURL:this.server,headers:{Authorization:"Token "+this.accessToken}})}listRows(e,t,n,r){const s=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,o={page_id:e,table_name:t,start:n,limit:r};return this.req.get(s,{params:o})}addRow(e,t,n,r){const s=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,o={page_id:e,table_name:t,row_data:n,row_links_data:r};return this.req.post(s,o)}addRows(e,t,n,r){const s=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/batch/`,o={page_id:e,table_name:t,rows_data:n,rows_links_data:r};return this.req.post(s,o)}updateRows(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,s={page_id:e,table_name:t,rows_data:n};return this.req.put(r,s,{headers:{"Content-Type":"application/json"}})}deleteRows(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,s={page_id:e,table_name:t,rows_ids:n};return this.req.delete(r,s,{headers:{"Content-Type":"application/json"}})}}const mt="HTML_PAGE_REQUEST",yt="HTML_PAGE_RESPONSE",gt="HTML_PAGE_EVENT",bt="WINDOW_EVENT",wt="get_server",Et="get_access_token",vt="get_app_uuid",Rt="get_page_id",Ot="app",Tt="iframe",St=["click","dblclick","mousemove","mouseenter","mouseleave","mousedown","mouseup","contextmenu"],At=["keydown","keyup","keypress"],_t=["dragstart","dragover","drag","dragend","dragenter","dragleave","drop"],Pt=["mousemove","dragover"],kt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),xt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4,t="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789",n="";for(let r=0;r<e;r++)n+=t.charAt(Math.floor(72*Math.random()));return n},Ut=e=>{let{eventType:t,event:n}=e;return St.includes(t)?{type:t,x:n.x,y:n.y,button:n.button,buttons:n.buttons}:At.includes(t)?{type:t,key:n.key,code:n.code,keyCode:n.keyCode,ctrlKey:n.ctrlKey,shiftKey:n.shiftKey,altKey:n.altKey,metaKey:n.metaKey,repeat:n.repeat}:_t.includes(t)?{type:t,x:n.x,y:n.y}:null};class Nt{constructor(e){this.options=e||{},this.selfWindow=window.parent===window.self,this.targetOrigin=this.options.targetOrigin||"*",this.pendingRequests={},this.eventHandlers={},this.timeout=this.options.timeout||1e4,this.setupMessageListener()}generatorRequestId(){let e=xt();for(;kt(this.pendingRequests,e);)e=xt();return e}setupMessageListener(){this.selfWindow||(window.addEventListener("message",this.handleMessage.bind(this)),this.setEventsListener())}postWindowEvent(e){e&&window.parent.postMessage({type:bt,params:{event_data:{...e,source:Tt}}},this.targetOrigin)}setEventsListener(){let e=null,t=null;[...St,...At,..._t].forEach(n=>{window.addEventListener(n,r=>{if(r.source!==Ot)return Pt.includes(n)?(t=Ut({eventType:n,event:r}),void(null===e&&(e=requestAnimationFrame(()=>{t&&(this.postWindowEvent(t),t=null,e=null)})))):void this.postWindowEvent(Ut({eventType:n,event:r}))},!0)})}async request(e,t){if(this.selfWindow)return new Promise(e=>{e(null)});const n=this.generatorRequestId();return new Promise((r,s)=>{this.pendingRequests[n]={resolve:r,reject:s},window.parent.postMessage({type:mt,requestId:n,method:e,params:t},this.targetOrigin);const o=setTimeout(()=>{kt(this.pendingRequests,n)&&(delete this.pendingRequests[n],s(new Error(`Request timeout: ${e}`)))},this.timeout),i=this.pendingRequests[n];i&&(i.timeoutId=o)})}handleMessage(e){const{type:t,requestId:n,data:r,error:s,eventType:o,payload:i}=e.data;if(t===yt){const e=this.pendingRequests[n];e&&(clearTimeout(e.timeoutId),delete this.pendingRequests[n],s?e.reject(new Error(s)):e.resolve(r?JSON.parse(r):null))}else if(t===gt)this.emitEvent(o,i);else if(t===bt){const e=r.event_data;if(!e)return;let t,n;if(At.includes(e.type))t=new KeyboardEvent(e.type,{bubbles:!0,cancelable:!0,key:e.key,code:e.code,keyCode:e.keyCode,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,repeat:e.repeat,view:window}),n=document.activeElement||document.body;else if(St.includes(e.type)){t=new MouseEvent(e.type,{bubbles:!0,cancelable:!0,view:window,clientX:e.x,clientY:e.y,screenX:e.x,screenY:e.y,button:e.button,buttons:e.buttons});n=document.elementFromPoint(e.x,e.y)||document.body}else if(_t.includes(e.type)){t=new DragEvent(e.type,{bubbles:!0,cancelable:!0,view:window,clientX:e.x,clientY:e.y,screenX:e.x,screenY:e.y,button:e.button,buttons:e.buttons});n=document.elementFromPoint(e.x,e.y)||document.body}if(!n||!t)return;t.source=e.source,n.dispatchEvent(t)}}on(e,t){return kt(this.eventHandlers,e)||(this.eventHandlers[e]=[]),this.eventHandlers[e].push(t),()=>this.off(e,t)}off(e,t){const n=this.eventHandlers[e];if(n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}emitEvent(e,t){(this.eventHandlers[e]||[]).forEach(n=>{try{n(t)}catch(t){console.error(`Error in event handler for ${e}:`,t)}})}destroy(){this.pendingRequests.forEach(e=>{clearTimeout(e.timeoutId),e.reject(new Error("Adapter destroyed"))}),this.pendingRequests={},this.eventHandlers={}}}return class{constructor(e){this.options=e||{},this.iframeAdapter=new Nt(e)}async init(){if(this.options||(this.options={}),this.htmlPageAPI=new ht,this.options.server||(this.options.server=await this.iframeAdapter.request(wt)),this.options.appUuid||(this.options.appUuid=await this.iframeAdapter.request(vt)),this.options.pageId||(this.options.pageId=await this.iframeAdapter.request(Rt)),this.options.accountToken){const{server:e,accountToken:t,appUuid:n}=this.options;await this.htmlPageAPI.initWithAccountToken({server:e,accountToken:t,appUuid:n})}else{this.options.accessToken||(this.options.accessToken=await this.iframeAdapter.request(Et));const{server:e,accessToken:t,appUuid:n}=this.options;this.htmlPageAPI.init({server:e,accessToken:t,appUuid:n})}}listRows(e){let{tableName:t,start:n,limit:r}=e;return this.htmlPageAPI.listRows(this.options.pageId,t,n,r)}addRow(e){let{tableName:t,rowData:n,rowLinksData:r}=e;return this.htmlPageAPI.addRow(this.options.pageId,t,n,r)}updateRow(e){let{tableName:t,rowId:n,rowData:r}=e;const s=[{id:n,row:r}];this.batchUpdateRows({tableName:t,rowsData:s})}deleteRow(e){let{tableName:t,rowId:n}=e;const r=[n];return this.batchDeleteRows({tableName:t,rowsIds:r})}batchAddRows(e){let{tableName:t,rowsData:n,rowsLinksData:r}=e;return this.htmlPageAPI.addRows(this.options.pageId,t,n,r)}batchUpdateRows(e){let{tableName:t,rowsData:n}=e;return this.htmlPageAPI.updateRows(this.options.pageId,t,n)}batchDeleteRows(e){let{tableName:t,rowsIds:n}=e;return this.htmlPageAPI.deleteRows(this.options.pageId,t,n)}}});
|
|
2
2
|
//# sourceMappingURL=index.min.js.map
|