customerio-gist-web 3.10.0 → 3.10.2

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.
@@ -41,8 +41,8 @@ jobs:
41
41
  # Update the package.json version. Skip the git tag, we'll do that later
42
42
  npm version ${{ steps.bump-semver.outputs.new_version }} --no-git-tag-version
43
43
 
44
- # Commit the changed package.json file to develop
45
- git add package.json
44
+ # Commit the changed package.json & package-lock.json files to develop
45
+ git add package.json package-lock.json
46
46
  git commit -m "Bump version to ${{ steps.bump-semver.outputs.new_version }}"
47
47
  git push origin develop
48
48
 
package/README.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Gist for Web
2
2
 
3
- Gist enables you to create embeddable experiences that range from simple welcome messages to complex multi-step flows.
3
+ ## Testing
4
4
 
5
- For installation guide, please follow our [documentation](https://docs.gist.build).
5
+ - Clone repo
6
+ - Run `npm start`
7
+ - Navigate to: `http://127.0.0.1:8081/examples/`
8
+
9
+ ## Build Locally
10
+
11
+ - `npm run build:prod`
12
+
13
+ ## Releases
14
+
15
+ ### Feature release process
16
+
17
+ - Merge PR into develop
18
+ - Head over to the repo's feature release [action page](https://github.com/customerio/gist-web/actions/workflows/release_version.yml).
19
+ - Select **Run Workflow**
20
+ - Choose between:
21
+ - *patch* - Bug/hot fixes
22
+ - *minor* - New features
23
+ - *major* - New / replaced APIs (usually breaking)
24
+
25
+ ### Hotfix release process
26
+
27
+ - Merge PR into master
28
+ - Head over to the repo's hotfix release [action page](https://github.com/customerio/gist-web/actions/workflows/release_hotfix.yml).
29
+ - Select **Run Workflow**
30
+
31
+ ### Update Cloudflare
32
+
33
+ The above processes push the changes to NPM and GitHub. However, customers using our Track SDK fetch the latest version automatically; we accomplish this by routing through Cloudflare page rules.
34
+
35
+ - Head over to [Cloudflare](https://dash.cloudflare.com/) Page Rules section for the `gist.build` domain.
36
+ - Update `https://code.gist.build/web/latest/gist.min.js` for latest version
37
+ - Update `https://code.gist.build/web/beta/gist.min.js` for beta testing
package/dist/gist.min.js CHANGED
@@ -1,10 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Gist=e():t.Gist=e()}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=19)}([function(t,e,n){"use strict";var r,i=n(7),o=Object.prototype.toString,s=(r=Object.create(null),function(t){var e=o.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())});function a(t){return t=t.toLowerCase(),function(e){return s(e)===t}}function u(t){return Array.isArray(t)}function c(t){return void 0===t}var f=a("ArrayBuffer");function l(t){return"number"==typeof t}function h(t){return null!==t&&"object"==typeof t}function p(t){if("object"!==s(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}var d=a("Date"),g=a("File"),m=a("Blob"),y=a("FileList");function v(t){return"[object Function]"===o.call(t)}var w=a("URLSearchParams");function b(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),u(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}var E,R=(E="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(t){return E&&t instanceof E});var x,T=a("HTMLFormElement"),A=(x=Object.prototype.hasOwnProperty,function(t,e){return x.call(t,e)});t.exports={isArray:u,isArrayBuffer:f,isBuffer:function(t){return null!==t&&!c(t)&&null!==t.constructor&&!c(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return t&&("function"==typeof FormData&&t instanceof FormData||"[object FormData]"===o.call(t)||v(t.toString)&&"[object FormData]"===t.toString())},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&f(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:l,isObject:h,isPlainObject:p,isEmptyObject:function(t){return t&&0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype},isUndefined:c,isDate:d,isFile:g,isBlob:m,isFunction:v,isStream:function(t){return h(t)&&v(t.pipe)},isURLSearchParams:w,isStandardBrowserEnv:function(){var t;return("undefined"==typeof navigator||"ReactNative"!==(t=navigator.product)&&"NativeScript"!==t&&"NS"!==t)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:b,merge:function t(){var e={};function n(n,r){p(e[r])&&p(n)?e[r]=t(e[r],n):p(n)?e[r]=t({},n):u(n)?e[r]=n.slice():e[r]=n}for(var r=0,i=arguments.length;r<i;r++)b(arguments[r],n);return e},extend:function(t,e,n){return b(e,(function(e,r){t[r]=n&&"function"==typeof e?i(e,n):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t},inherits:function(t,e,n,r){t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,n&&Object.assign(t.prototype,n)},toFlatObject:function(t,e,n,r){var i,o,s,a={};if(e=e||{},null==t)return e;do{for(o=(i=Object.getOwnPropertyNames(t)).length;o-- >0;)s=i[o],r&&!r(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==n&&Object.getPrototypeOf(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:s,kindOfTest:a,endsWith:function(t,e,n){t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;var r=t.indexOf(e,n);return-1!==r&&r===n},toArray:function(t){if(!t)return null;if(u(t))return t;var e=t.length;if(!l(e))return null;for(var n=new Array(e);e-- >0;)n[e]=t[e];return n},isTypedArray:R,isFileList:y,forEachEntry:function(t,e){for(var n,r=(t&&t[Symbol.iterator]).call(t);(n=r.next())&&!n.done;){var i=n.value;e.call(t,i[0],i[1])}},matchAll:function(t,e){for(var n,r=[];null!==(n=t.exec(e));)r.push(n);return r},isHTMLForm:T,hasOwnProperty:A}},function(t,e,n){"use strict";var r=n(0);function i(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}r.inherits(i,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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var o=i.prototype,s={};["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((function(t){s[t]={value:t}})),Object.defineProperties(i,s),Object.defineProperty(o,"isAxiosError",{value:!0}),i.from=function(t,e,n,s,a,u){var c=Object.create(o);return r.toFlatObject(t,c,(function(t){return t!==Error.prototype})),i.call(c,t.message,e,n,s,a),c.cause=t,c.name=t.name,u&&Object.assign(c,u),c},t.exports=i},function(t,e,n){"use strict";(function(e){var r=n(0),i=n(1),o=n(27);function s(t){return r.isPlainObject(t)||r.isArray(t)}function a(t){return r.endsWith(t,"[]")?t.slice(0,-2):t}function u(t,e,n){return t?t.concat(e).map((function(t,e){return t=a(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}var c=r.toFlatObject(r,{},null,(function(t){return/^is[A-Z]/.test(t)}));t.exports=function(t,n,f){if(!r.isObject(t))throw new TypeError("target must be an object");n=n||new(o||FormData);var l,h=(f=r.toFlatObject(f,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!r.isUndefined(e[t])}))).metaTokens,p=f.visitor||v,d=f.dots,g=f.indexes,m=(f.Blob||"undefined"!=typeof Blob&&Blob)&&((l=n)&&r.isFunction(l.append)&&"FormData"===l[Symbol.toStringTag]&&l[Symbol.iterator]);if(!r.isFunction(p))throw new TypeError("visitor must be a function");function y(t){if(null===t)return"";if(r.isDate(t))return t.toISOString();if(!m&&r.isBlob(t))throw new i("Blob is not supported. Use a Buffer instead.");return r.isArrayBuffer(t)||r.isTypedArray(t)?m&&"function"==typeof Blob?new Blob([t]):e.from(t):t}function v(t,e,i){var o=t;if(t&&!i&&"object"==typeof t)if(r.endsWith(e,"{}"))e=h?e:e.slice(0,-2),t=JSON.stringify(t);else if(r.isArray(t)&&function(t){return r.isArray(t)&&!t.some(s)}(t)||r.isFileList(t)||r.endsWith(e,"[]")&&(o=r.toArray(t)))return e=a(e),o.forEach((function(t,i){!r.isUndefined(t)&&n.append(!0===g?u([e],i,d):null===g?e:e+"[]",y(t))})),!1;return!!s(t)||(n.append(u(i,e,d),y(t)),!1)}var w=[],b=Object.assign(c,{defaultVisitor:v,convertValue:y,isVisitable:s});if(!r.isObject(t))throw new TypeError("data must be an object");return function t(e,i){if(!r.isUndefined(e)){if(-1!==w.indexOf(e))throw Error("Circular reference detected in "+i.join("."));w.push(e),r.forEach(e,(function(e,o){!0===(!r.isUndefined(e)&&p.call(n,e,r.isString(o)?o.trim():o,i,b))&&t(e,i?i.concat(o):[o])})),w.pop()}}(t),n}}).call(this,n(22).Buffer)},function(t,e,n){"use strict";var r=n(1);function i(t,e,n){r.call(this,null==t?"canceled":t,r.ERR_CANCELED,e,n),this.name="CanceledError"}n(0).inherits(i,r,{__CANCEL__:!0}),t.exports=i},function(t,e,n){"use strict";(function(e){var r=n(0),i=n(10),o=n(1),s=n(11),a=n(2),u=n(33),c=n(5),f=n(12),l={"Content-Type":"application/x-www-form-urlencoded"};function h(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var p,d={transitional:s,adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==e&&"[object process]"===Object.prototype.toString.call(e))&&(p=n(13)),p),transformRequest:[function(t,e){i(e,"Accept"),i(e,"Content-Type");var n,o=e&&e["Content-Type"]||"",s=o.indexOf("application/json")>-1,c=r.isObject(t);if(c&&r.isHTMLForm(t)&&(t=new FormData(t)),r.isFormData(t))return s?JSON.stringify(f(t)):t;if(r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t))return t;if(r.isArrayBufferView(t))return t.buffer;if(r.isURLSearchParams(t))return h(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();if(c){if(-1!==o.indexOf("application/x-www-form-urlencoded"))return u(t,this.formSerializer).toString();if((n=r.isFileList(t))||o.indexOf("multipart/form-data")>-1){var l=this.env&&this.env.FormData;return a(n?{"files[]":t}:t,l&&new l,this.formSerializer)}}return c||s?(h(e,"application/json"),function(t,e,n){if(r.isString(t))try{return(e||JSON.parse)(t),r.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||d.transitional,n=e&&e.forcedJSONParsing,i="json"===this.responseType;if(t&&r.isString(t)&&(n&&!this.responseType||i)){var s=!(e&&e.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw o.from(t,o.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:c.classes.FormData,Blob:c.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(t){d.headers[t]={}})),r.forEach(["post","put","patch"],(function(t){d.headers[t]=r.merge(l)})),t.exports=d}).call(this,n(32))},function(t,e,n){"use strict";t.exports=n(34)},,function(t,e,n){"use strict";t.exports=function(t,e){return function(){return t.apply(e,arguments)}}},function(t,e,n){"use strict";var r=n(0),i=n(9);function o(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var s=t.indexOf("#");-1!==s&&(t=t.slice(0,s));var a,u=n&&n.encode||o,c=n&&n.serialize;return(a=c?c(e,n):r.isURLSearchParams(e)?e.toString():new i(e,n).toString(u))&&(t+=(-1===t.indexOf("?")?"?":"&")+a),t}},function(t,e,n){"use strict";var r=n(2);function i(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'\(\)~]|%20|%00/g,(function(t){return e[t]}))}function o(t,e){this._pairs=[],t&&r(t,this,e)}var s=o.prototype;s.append=function(t,e){this._pairs.push([t,e])},s.toString=function(t){var e=t?function(e){return t.call(this,e,i)}:i;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")},t.exports=o},function(t,e,n){"use strict";var r=n(0);t.exports=function(t,e){r.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))}},function(t,e,n){"use strict";t.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},function(t,e,n){"use strict";var r=n(0);t.exports=function(t){function e(t,n,i,o){var s=t[o++],a=Number.isFinite(+s),u=o>=t.length;return s=!s&&r.isArray(i)?i.length:s,u?(r.hasOwnProperty(i,s)?i[s]=[i[s],n]:i[s]=n,!a):(i[s]&&r.isObject(i[s])||(i[s]=[]),e(t,n,i[s],o)&&r.isArray(i[s])&&(i[s]=function(t){var e,n,r={},i=Object.keys(t),o=i.length;for(e=0;e<o;e++)r[n=i[e]]=t[n];return r}(i[s])),!a)}if(r.isFormData(t)&&r.isFunction(t.entries)){var n={};return r.forEachEntry(t,(function(t,i){e(function(t){return r.matchAll(/\w+|\[(\w*)]/g,t).map((function(t){return"[]"===t[0]?"":t[1]||t[0]}))}(t),i,n,0)})),n}return null}},function(t,e,n){"use strict";var r=n(0),i=n(37),o=n(38),s=n(8),a=n(14),u=n(41),c=n(42),f=n(11),l=n(1),h=n(3),p=n(43),d=n(5);t.exports=function(t){return new Promise((function(e,n){var g,m=t.data,y=t.headers,v=t.responseType,w=t.withXSRFToken;function b(){t.cancelToken&&t.cancelToken.unsubscribe(g),t.signal&&t.signal.removeEventListener("abort",g)}r.isFormData(m)&&r.isStandardBrowserEnv()&&delete y["Content-Type"];var E=new XMLHttpRequest;if(t.auth){var R=t.auth.username||"",x=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";y.Authorization="Basic "+btoa(R+":"+x)}var T=a(t.baseURL,t.url);function A(){if(E){var r="getAllResponseHeaders"in E?u(E.getAllResponseHeaders()):null,o={data:v&&"text"!==v&&"json"!==v?E.response:E.responseText,status:E.status,statusText:E.statusText,headers:r,config:t,request:E};i((function(t){e(t),b()}),(function(t){n(t),b()}),o),E=null}}if(E.open(t.method.toUpperCase(),s(T,t.params,t.paramsSerializer),!0),E.timeout=t.timeout,"onloadend"in E?E.onloadend=A:E.onreadystatechange=function(){E&&4===E.readyState&&(0!==E.status||E.responseURL&&0===E.responseURL.indexOf("file:"))&&setTimeout(A)},E.onabort=function(){E&&(n(new l("Request aborted",l.ECONNABORTED,t,E)),E=null)},E.onerror=function(){n(new l("Network Error",l.ERR_NETWORK,t,E)),E=null},E.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",r=t.transitional||f;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(new l(e,r.clarifyTimeoutError?l.ETIMEDOUT:l.ECONNABORTED,t,E)),E=null},r.isStandardBrowserEnv()&&(w&&r.isFunction(w)&&(w=w(t)),w||!1!==w&&c(T))){var S=t.xsrfHeaderName&&t.xsrfCookieName&&o.read(t.xsrfCookieName);S&&(y[t.xsrfHeaderName]=S)}"setRequestHeader"in E&&r.forEach(y,(function(t,e){void 0===m&&"content-type"===e.toLowerCase()?delete y[e]:E.setRequestHeader(e,t)})),r.isUndefined(t.withCredentials)||(E.withCredentials=!!t.withCredentials),v&&"json"!==v&&(E.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&E.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&E.upload&&E.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(g=function(e){E&&(n(!e||e.type?new h(null,t,E):e),E.abort(),E=null)},t.cancelToken&&t.cancelToken.subscribe(g),t.signal&&(t.signal.aborted?g():t.signal.addEventListener("abort",g))),m||!1===m||0===m||""===m||(m=null);var O=p(T);O&&-1===d.protocols.indexOf(O)?n(new l("Unsupported protocol "+O+":",l.ERR_BAD_REQUEST,t)):E.send(m)}))}},function(t,e,n){"use strict";var r=n(39),i=n(40);t.exports=function(t,e){return t&&!r(e)?i(t,e):e}},function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,n){"use strict";var r=n(0);t.exports=function(t,e){e=e||{};var n={};function i(t,e){return r.isPlainObject(t)&&r.isPlainObject(e)?r.merge(t,e):r.isEmptyObject(e)?r.merge({},t):r.isPlainObject(e)?r.merge({},e):r.isArray(e)?e.slice():e}function o(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(t[n],e[n])}function s(t){if(!r.isUndefined(e[t]))return i(void 0,e[t])}function a(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(void 0,e[n])}function u(n){return n in e?i(t[n],e[n]):n in t?i(void 0,t[n]):void 0}var c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return r.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=c[t]||o,i=e(t);r.isUndefined(i)&&e!==u||(n[t]=i)})),n}},function(t,e){t.exports={version:"0.28.1"}},function(t,e,n){t.exports=n(20)},function(t,e,n){const r=n(48).default;t.exports=r},function(t,e,n){"use strict";var r=n(0),i=n(7),o=n(21),s=n(16),a=n(4),u=n(12);var c=function t(e){var n=new o(e),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return t(s(e,n))},a}(a);c.Axios=o,c.CanceledError=n(3),c.CancelToken=n(45),c.isCancel=n(15),c.VERSION=n(17).version,c.toFormData=n(2),c.AxiosError=n(1),c.Cancel=c.CanceledError,c.all=function(t){return Promise.all(t)},c.spread=n(46),c.isAxiosError=n(47),c.formToJSON=function(t){return u(r.isHTMLForm(t)?new FormData(t):t)},t.exports=c,t.exports.default=c},function(t,e,n){"use strict";var r=n(0),i=n(8),o=n(29),s=n(30),a=n(16),u=n(14),c=n(44),f=c.validators;function l(t){this.defaults=t,this.interceptors={request:new o,response:new o}}l.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=e.transitional;void 0!==n&&c.assertOptions(n,{silentJSONParsing:f.transitional(f.boolean),forcedJSONParsing:f.transitional(f.boolean),clarifyTimeoutError:f.transitional(f.boolean)},!1);var i=e.paramsSerializer;void 0!==i&&c.assertOptions(i,{encode:f.function,serialize:f.function},!0),r.isFunction(i)&&(e.paramsSerializer={serialize:i});var o=[],u=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(u=u&&t.synchronous,o.unshift(t.fulfilled,t.rejected))}));var l,h=[];if(this.interceptors.response.forEach((function(t){h.push(t.fulfilled,t.rejected)})),!u){var p=[s,void 0];for(Array.prototype.unshift.apply(p,o),p=p.concat(h),l=Promise.resolve(e);p.length;)l=l.then(p.shift(),p.shift());return l}for(var d=e;o.length;){var g=o.shift(),m=o.shift();try{d=g(d)}catch(t){m(t);break}}try{l=s(d)}catch(t){return Promise.reject(t)}for(;h.length;)l=l.then(h.shift(),h.shift());return l},l.prototype.getUri=function(t){t=a(this.defaults,t);var e=u(t.baseURL,t.url);return i(e,t.params,t.paramsSerializer)},r.forEach(["delete","get","head","options"],(function(t){l.prototype[t]=function(e,n){return this.request(a(n||{},{method:t,url:e,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(a(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}l.prototype[t]=e(),l.prototype[t+"Form"]=e(!0)})),t.exports=l},function(t,e,n){"use strict";(function(t){
2
- /*!
3
- * The buffer module from node.js, for the browser.
4
- *
5
- * @author Feross Aboukhadijeh <http://feross.org>
6
- * @license MIT
7
- */
8
- var r=n(24),i=n(25),o=n(26);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return c(this,t,e,n)}function c(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=h(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(e,n),i=(t=a(t,r)).write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(u.isBuffer(e)){var n=0|p(e.length);return 0===(t=a(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?a(t,0):h(t,e);if("Buffer"===e.type&&o(e.data))return h(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(f(e),t=a(t,e<0?0:0|p(e)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function h(t,e){var n=e.length<0?0:0|p(e.length);t=a(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function p(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(r)return F(t).length;e=(""+e).toLowerCase(),r=!0}}function g(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return _(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return O(this,e,n);case"latin1":case"binary":return I(this,e,n);case"base64":return A(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){var o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var f=-1;for(o=n;o<a;o++)if(c(t,o)===c(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var l=!0,h=0;h<u;h++)if(c(t,o+h)!==c(e,h)){l=!1;break}if(l)return o}return-1}function w(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function b(t,e,n,r){return Y(F(e,t.length-n),t,n,r)}function E(t,e,n,r){return Y(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function R(t,e,n,r){return E(t,e,n,r)}function x(t,e,n,r){return Y(q(e),t,n,r)}function T(t,e,n,r){return Y(function(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function A(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,u,c=t[i],f=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=n)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),i+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=4096));return n}(r)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,n){return c(null,t,e,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,n){return function(t,e,n,r){return f(e),e<=0?a(t,e):void 0!==n?"string"==typeof r?a(t,e).fill(n,r):a(t,e).fill(n):a(t,e)}(null,t,e,n)},u.allocUnsafe=function(t){return l(null,t)},u.allocUnsafeSlow=function(t){return l(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=u.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):g.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,n,r,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(r,i),f=t.slice(e,n),l=0;l<a;++l)if(c[l]!==f[l]){o=c[l],s=f[l];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return y(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return y(this,t,e,n,!1)},u.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return w(this,t,e,n);case"utf8":case"utf-8":return b(this,t,e,n);case"ascii":return E(this,t,e,n);case"latin1":case"binary":return R(this,t,e,n);case"base64":return x(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function I(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function _(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=M(t[o]);return i}function P(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function U(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function B(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function D(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function L(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(t,e,n,r,o){return o||L(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function k(t,e,n,r,o){return o||L(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;n=new u(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},u.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||U(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},u.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||U(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUInt8=function(t,e){return e||U(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||U(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||U(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||U(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||U(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||U(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){e||U(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||U(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||U(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||U(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||U(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||C(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},u.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||C(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):D(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);C(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);C(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):D(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,n){return N(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return N(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return k(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return k(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},u.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var s=u.isBuffer(t)?t:F(new u(t,r).toString()),a=s.length;for(o=0;o<n-e;++o)this[o+e]=s[o%a]}return this};var j=/[^+\/0-9A-Za-z-_]/g;function M(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(23))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=c(t),s=r[0],a=r[1],u=new o(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),f=0,l=a>0?s-4:s;for(n=0;n<l;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],u[f++]=e>>16&255,u[f++]=e>>8&255,u[f++]=255&e;2===a&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,u[f++]=255&e);1===a&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e);return u},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(f(t,s,s+16383>a?a:s+16383));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t,e,n){for(var i,o,s=[],a=e;a<n;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
9
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
10
- e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,f=-7,l=n?i-1:0,h=n?-1:1,p=t[e+l];for(l+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+t[e+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=256*s+t[e+l],l+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,f=(1<<c)-1,l=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[n+p]=255&s,p+=d,s/=256,c-=8);t[n+p-d]|=128*g}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){t.exports=n(28)},function(t,e){t.exports="object"==typeof self?self.FormData:window.FormData},function(t,e,n){"use strict";var r=n(0);function i(){this.handlers=[]}i.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.clear=function(){this.handlers&&(this.handlers=[])},i.prototype.forEach=function(t){r.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=i},function(t,e,n){"use strict";var r=n(0),i=n(31),o=n(15),s=n(4),a=n(3),u=n(10);function c(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new a}t.exports=function(t){return c(t),t.headers=t.headers||{},t.data=i.call(t,t.data,t.headers,null,t.transformRequest),u(t.headers,"Accept"),u(t.headers,"Content-Type"),t.headers=r.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||s.adapter)(t).then((function(e){return c(t),e.data=i.call(t,e.data,e.headers,e.status,t.transformResponse),e}),(function(e){return o(e)||(c(t),e&&e.response&&(e.response.data=i.call(t,e.response.data,e.response.headers,e.response.status,t.transformResponse))),Promise.reject(e)}))}},function(t,e,n){"use strict";var r=n(0),i=n(4);t.exports=function(t,e,n,o){var s=this||i;return r.forEach(o,(function(r){t=r.call(s,t,e,n)})),t}},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],f=!1,l=-1;function h(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&p())}function p(){if(!f){var t=a(h);f=!0;for(var e=c.length;e;){for(u=c,c=[];++l<e;)u&&u[l].run();l=-1,e=c.length}u=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new d(t,e)),1!==c.length||f||a(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";var r=n(0),i=n(2),o=n(5);t.exports=function(t,e){return i(t,new o.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,i){return o.isNode&&r.isBuffer(t)?(this.append(e,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}},function(t,e,n){"use strict";t.exports={isBrowser:!0,classes:{URLSearchParams:n(35),FormData:n(36),Blob:Blob},protocols:["http","https","file","blob","url","data"]}},function(t,e,n){"use strict";var r=n(9);t.exports="undefined"!=typeof URLSearchParams?URLSearchParams:r},function(t,e,n){"use strict";t.exports=FormData},function(t,e,n){"use strict";var r=n(1);t.exports=function(t,e,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(new r("Request failed with status code "+n.status,[r.ERR_BAD_REQUEST,r.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}},function(t,e,n){"use strict";var r=n(0);t.exports=r.isStandardBrowserEnv()?{write:function(t,e,n,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(t,e,n){"use strict";t.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}},function(t,e,n){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},function(t,e,n){"use strict";var r=n(0),i=["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"];t.exports=function(t){var e,n,o,s={};return t?(r.forEach(t.split("\n"),(function(t){if(o=t.indexOf(":"),e=r.trim(t.slice(0,o)).toLowerCase(),n=r.trim(t.slice(o+1)),e){if(s[e]&&i.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([n]):s[e]?s[e]+", "+n:n}})),s):s}},function(t,e,n){"use strict";var r=n(0);t.exports=r.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(e){var n=r.isString(e)?i(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},function(t,e,n){"use strict";t.exports=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}},function(t,e,n){"use strict";var r=n(17).version,i=n(1),o={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){o[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));var s={};o.transitional=function(t,e,n){function o(t,e){return"[Axios v"+r+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}return function(n,r,a){if(!1===t)throw new i(o(r," has been removed"+(e?" in "+e:"")),i.ERR_DEPRECATED);return e&&!s[r]&&(s[r]=!0,console.warn(o(r," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,r,a)}},t.exports={assertOptions:function(t,e,n){if("object"!=typeof t)throw new i("options must be an object",i.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(t),o=r.length;o-- >0;){var s=r[o],a=e[s];if(a){var u=t[s],c=void 0===u||a(u,s,t);if(!0!==c)throw new i("option "+s+" must be "+c,i.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new i("Unknown option "+s,i.ERR_BAD_OPTION)}},validators:o}},function(t,e,n){"use strict";var r=n(3);function i(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var n=this;this.promise.then((function(t){if(n._listeners){for(var e=n._listeners.length;e-- >0;)n._listeners[e](t);n._listeners=null}})),this.promise.then=function(t){var e,r=new Promise((function(t){n.subscribe(t),e=t})).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t((function(t,i,o){n.reason||(n.reason=new r(t,i,o),e(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},i.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},i.source=function(){var t;return{token:new i((function(e){t=e})),cancel:t}},t.exports=i},function(t,e,n){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,n){"use strict";var r=n(0);t.exports=function(t){return r.isObject(t)&&!0===t.isAxiosError}},function(t,e,n){"use strict";n.r(e);class r{on(t,e){var n=this[t];n?n.push(e):this[t]=[e]}dispatch(t,e){var n=this[t];n&&n.forEach(t=>t(e))}}function i(t){ot.config.logging&&console.log("Gist: "+t)}function o(t,e,n){const r={value:e,expiry:n};localStorage.setItem(t,JSON.stringify(r))}function s(t){const e=localStorage.getItem(t);if(!e)return null;const n=JSON.parse(e),r=new Date,i=new Date(n.expiry);return r.getTime()>i.getTime()?(localStorage.removeItem(t),null):n.value}function a(t){localStorage.removeItem(t)}var u,c=new Uint8Array(16);function f(){if(!u&&!(u="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return u(c)}var l=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var h=function(t){return"string"==typeof t&&l.test(t)},p=[],d=0;d<256;++d)p.push((d+256).toString(16).substr(1));var g=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(p[t[e+0]]+p[t[e+1]]+p[t[e+2]]+p[t[e+3]]+"-"+p[t[e+4]]+p[t[e+5]]+"-"+p[t[e+6]]+p[t[e+7]]+"-"+p[t[e+8]]+p[t[e+9]]+"-"+p[t[e+10]]+p[t[e+11]]+p[t[e+12]]+p[t[e+13]]+p[t[e+14]]+p[t[e+15]]).toLowerCase();if(!h(n))throw TypeError("Stringified UUID is invalid");return n};var m=function(t,e,n){var r=(t=t||{}).random||(t.rng||f)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return g(r)};function y(){return s("gist.web.userToken")}function v(){var t=new Date;if(t.setDate(t.getDate()+365),null===y()){var e=s("gist.web.guestUserToken");null==e&&(o("gist.web.guestUserToken",e=m(),t),i(`Set guest user token "${e}" with expiry date set to 1 year from today`)),o("gist.web.userToken",e,t),o("gist.web.usingGuestUserToken",!0,t)}}var w=n(18),b=n.n(w);const E={ENGINE_API_ENDPOINT:{prod:"https://engine.api.gist.build",dev:"https://engine.api.dev.gist.build",local:"http://engine.api.local.gist.build:82"},GIST_QUEUE_API_ENDPOINT:{prod:"https://gist-queue-consumer-api.cloud.gist.build",dev:"https://gist-queue-consumer-api.cloud.dev.gist.build",local:"http://api.local.gist.build:86"},GIST_VIEW_ENDPOINT:{prod:"https://renderer.gist.build/2.0",dev:"https://renderer.gist.build/2.0",local:"http://app.local.gist.build:8080/web"}};function R(){var t={"X-CIO-Site-Id":ot.config.siteId,"X-CIO-Datacenter":ot.config.dataCenter},e=y();return null!=e&&(t["X-Gist-Encoded-User-Token"]=btoa(e)),b.a.create({baseURL:E.GIST_QUEUE_API_ENDPOINT[ot.config.env],timeout:2e4,headers:t})}var x=600,T=!1;async function A(){var t;try{if(!T){var e=(new Date).getTime();T=!0,t=await R().post("/api/v1/users?timestamp="+e,{})}}catch(e){e.response?t=e.response:i("Error getting user queue: "+e)}finally{return T=!1,function(t){if(t&&t.headers){var e=t.headers["x-gist-queue-polling-interval"];e&&e>0&&(x=e)}var n=new Date((new Date).getTime()+1e3*x);o("gist.web.userQueueNextPullCheck",x,n)}(t),t}}function S(t){var e="",n="",r="",i=!1,o=!1,s=!1,a=!1,u=null,c=!1,f="#00000033",l=414,h=!1;return t.properties&&t.properties.gist&&(t.properties.gist.campaignId&&(u=t.properties.gist.campaignId),t.properties.gist.elementId&&(e=t.properties.gist.elementId,i=!0),t.properties.gist.routeRuleWeb&&(n=t.properties.gist.routeRuleWeb,o=!0),t.properties.gist.position&&(r=t.properties.gist.position,s=!0),t.properties.gist.scale&&(a=t.properties.gist.scale),t.properties.gist.overlayColor&&(f=t.properties.gist.overlayColor),t.properties.gist.messageWidth&&t.properties.gist.messageWidth>0&&(l=t.properties.gist.messageWidth,h=!0),t.properties.gist.persistent&&(c=!0)),{isEmbedded:i,elementId:e,hasRouteRule:o,routeRule:n,position:r,hasPosition:s,shouldScale:a,campaignId:u,messageWidth:l,overlayColor:f,persistent:c,hasCustomWidth:h}}var O=["x-gist-top","x-gist-floating-top","x-gist-bottom","x-gist-floating-bottom","x-gist-floating-bottom-left","x-gist-floating-bottom-right","x-gist-floating-top-left","x-gist-floating-top-right"];const I=t=>new Promise(e=>setTimeout(e,t)),_=["x-gist-top","x-gist-bottom","x-gist-floating-top","x-gist-floating-bottom"];function P(t,e,n){var r=N(t);if(r){var o=S(n),s=o.messageWidth+"px";_.includes(o.elementId)&&!o.hasCustomWidth&&(s="100%"),O.includes(o.elementId)&&(r.style.width=s),U(t)||(r.style.height="0px"),r.innerHTML=function(t,e,n){return function(t,e,n){var r=800;return e.messageWidth>r&&(r=e.messageWidth),`\n <div id="gist-embed">\n <style>\n #x-gist-floating-top, #x-gist-floating-top-left, #x-gist-floating-top-right {\n position: fixed;\n top: 0px;\n z-index: 1000000;\n }\n #x-gist-floating-bottom, #x-gist-floating-bottom-left, #x-gist-floating-bottom-right {\n position: fixed;\n bottom: 0px;\n z-index: 1000000;\n }\n #x-gist-bottom, #x-gist-top, #x-gist-floating-top, #x-gist-floating-bottom {\n left: 50%;\n transform: translate(-50%, 0%);\n }\n #x-gist-floating-top-right, #x-gist-floating-bottom-right {\n right: 0px;\n }\n #gist-embed {\n position: relative;\n height: 100%;\n width: 100%;\n }\n #gist-embed-container {\n position: relative;\n height: 100%;\n width: 100%;\n }\n #gist-embed-container .gist-frame {\n height: 100%;\n width: 100%;\n border: none;\n }\n @media (max-width: ${r}px) {\n #x-gist-top, #x-gist-bottom, #x-gist-floating-top, #x-gist-floating-bottom, #x-gist-floating-top-left, #x-gist-floating-top-right, #x-gist-floating-bottom-left, #x-gist-floating-bottom-right {\n width: 100% !important;\n }\n }\n </style>\n <div id="gist-embed-container">\n <iframe id="${t}" class="gist-frame" src="${n}"></iframe>\n </div>\n </div>`}(D(e.instanceId),n,t)}(e,n,o)}else i(`Message could not be embedded, elementId ${t} not found.`)}function U(t){var e=N(t);if(e)return e.style&&e.style.height&&"0px"!=e.style.height}function C(t,e){document.body.insertAdjacentHTML("afterbegin",function(t,e){var n=S(e);return function(t,e,n){var r=600;return e.messageWidth>r&&(r=e.messageWidth),`\n <div id="gist-embed-message">\n <style>\n #gist-overlay.background {\n position: fixed;\n z-index: 9999999998;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: ${e.overlayColor};\n visibility: hidden;\n }\n #gist-overlay.background.visible {\n visibility: visible;\n }\n #gist-overlay.background.is-blacked-out {\n display: block;\n }\n .gist-message {\n width: ${e.messageWidth}px;\n position: absolute;\n border: none;\n opacity: 0;\n transition: opacity 0.3s ease-in-out;\n z-index: 9999999999;\n left: 50%;\n transform: translateX(-50%);\n }\n .gist-message.visible {\n opacity: 1;\n pointer-events: auto;\n }\n .gist-message.center {\n transform: translate(-50%, -50%);\n top: 50%;\n }\n .gist-message.bottom {\n bottom: 0;\n }\n .gist-message.top {\n top: 0;\n }\n @media (max-width: ${r}px) {\n .gist-message {\n width: 100%;\n }\n }\n </style>\n <div id="gist-overlay" class="background">\n <iframe id="${t}" class="gist-message" src="${n}"></iframe>\n </div>\n </div>`}(D(e.instanceId),n,t)}(t,e))}function B(){var t=document.querySelector("#gist-embed-message");t&&t.parentNode.removeChild(t)}function D(t){return"gist-"+t}function L(){var t=document.querySelector(".gist-message");t&&t.classList.add("visible")}function N(t){try{var e=document.querySelector("#"+t);return e||null}catch{return null}}var k=[];async function j(t){if(ot.isDocumentVisible){if(ot.overlayInstanceId)return i(`Message ${ot.overlayInstanceId} already showing.`),null;var e=S(t);return t.instanceId=m(),t.overlay=!0,t.firstLoad=!0,t.shouldResizeHeight=!0,t.shouldScale=e.shouldScale,t.renderStartTime=(new Date).getTime(),ot.overlayInstanceId=t.instanceId,ot.currentMessages.push(t),z(t)}return i("Document hidden, not showing message now."),null}async function M(t,e){return ot.isDocumentVisible?(t.instanceId=m(),t.overlay=!1,t.firstLoad=!0,t.shouldScale=!1,t.elementId=e,t.shouldResizeHeight=!U(e),t.renderStartTime=(new Date).getTime(),ot.currentMessages.push(t),z(t,e)):(i("Document hidden, not showing message now."),null)}async function F(t){t?(ot.messageDismissed(t),t.overlay?await $(!0,t):Y(t)):i(`Message with instance id: ${instanceId} not found`)}async function q(t){var e=S(t);t?e.persistent&&(i("Persistent message dismissed, logging view"),await W(t)):i(`Message with instance id: ${instanceId} not found`)}function Y(t){var e,n;H(t.instanceId),e=t.elementId,(n=N(e))&&(n.classList.remove("gist-visible"),n.style.removeProperty("height"),n.innerHTML="")}async function $(t,e){H(e.instanceId),ot.overlayInstanceId=null,t?await async function(){var t=document.querySelector(".gist-message");t&&(t.classList.remove("visible"),await I(300)),B()}():B(),0==ot.currentMessages.length&&(window.removeEventListener("message",X),window.removeEventListener("touchstart",J))}function z(t,e=null){if(e&&function(t){var e=N(t);return!(!e||!e.classList.contains("gist-visible"))}(e))return i(`Message ${t.messageId} already showing in element ${e}.`),null;var n,r,o={endpoint:E.ENGINE_API_ENDPOINT[ot.config.env],siteId:ot.config.siteId,dataCenter:ot.config.dataCenter,messageId:t.messageId,instanceId:t.instanceId,livePreview:!1,properties:t.properties},s=`${E.GIST_VIEW_ENDPOINT[ot.config.env]}/index.html?options=${n=JSON.stringify(o),r=btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode("0x"+e)}))),encodeURIComponent(r)}`;return window.addEventListener("message",X),window.addEventListener("touchstart",J),e?(O.includes(e)&&function(t){const e=document.createElement("div");switch(e.id=t,t){case"x-gist-top":document.body.insertBefore(e,document.body.firstChild);break;default:document.body.insertAdjacentElement("beforeend",e)}i("Top & bottom elements injected into page")}(e),P(e,s,t)):C(s,t),t}async function W(t){i("Message shown, logging view for: "+t.messageId);var e={};null!=t.queueId?(!function(t){k.push(t);var e=it();null!=e&&e.length>0&&rt(e.filter(e=>e.queueId!==t.queueId))}(t),e=await async function(t){try{return await R().post("/api/v1/logs/queue/"+t)}catch(t){return t.response}}(t.queueId)):e=await async function(t){try{return await R().post("/api/v1/logs/message/"+t)}catch(t){return t.response}}(t.messageId),200===e.status?i("Message view logged"):i("Problem logging message: "+e.status)}function V(t){return ot.currentMessages.find(e=>e.instanceId===t)}function H(t){ot.currentMessages=ot.currentMessages.filter(e=>e.instanceId!==t)}function G(t,e){H(t),ot.currentMessages.push(e)}function J(t){}async function X(t){if(t.data.gist){var e=t.data.gist.instanceId,n=V(e);if(!n)return;var r=S(n);switch(t.data.gist.method){case"routeLoaded":var o=.001*((new Date).getTime()-n.renderStartTime);i(`Engine render for message: ${n.messageId} timer elapsed in ${o.toFixed(3)} seconds`),n.currentRoute=t.data.gist.parameters.route,n.firstLoad&&(n.overlay?function(t){var e=document.querySelector("#gist-overlay");if(e){e.classList.add("visible");var n=document.querySelector(".gist-message");t.position?n.classList.add(t.position):n.classList.add("center"),setTimeout(L,100)}else B()}(n):(l=n.elementId,(h=N(l))&&h.classList.add("gist-visible")),ot.messageShown(n),r.persistent?i("Persistent message shown, skipping logging view"):await W(n),n.firstLoad=!1),G(e,n);break;case"tap":var s=t.data.gist.parameters.action,a=t.data.gist.parameters.name;if(ot.messageAction(n,s,a),t.data.gist.parameters.system&&!r.persistent){await F(n);break}try{if((f=new URL(s))&&"gist:"===f.protocol)switch(f.href.replace("gist://","").split("?")[0]){case"close":await F(n),await q(n),await et();break;case"showMessage":var u=f.searchParams.get("messageId"),c=f.searchParams.get("properties");u&&(c&&(c=JSON.parse(atob(c))),await ot.showMessage({messageId:u,properties:c}));break;case"loadPage":var f;(f=f.href.substring(f.href.indexOf("?url=")+5))&&(f.startsWith("https://")||f.startsWith("http://")||f.startsWith("/")?window.location.href=f:window.location.href=window.location+f)}}catch(t){}break;case"routeChanged":n.currentRoute=t.data.gist.parameters.route,n.renderStartTime=(new Date).getTime(),G(e,n),i("Route changed to: "+n.currentRoute);break;case"sizeChanged":i(`Size Changed Width: ${t.data.gist.parameters.width} - Height: ${t.data.gist.parameters.height}`),n.elementId&&!n.shouldResizeHeight||function(t,e){var n=N(t.elementId?t.elementId:D(t.instanceId));if(n){var r=n.style;if(e.height>0)if(e.height>window.innerHeight){var i=1-(e.height/window.innerHeight-1);t.shouldScale&&i>=.4?(r.height=e.height+"px",r.transform=`translateX(-50%) translateY(-50%) scale(${i})`):r.height=window.innerHeight+"px"}else r.height=e.height+"px"}}(n,t.data.gist.parameters);break;case"titleChanged":i("Overlay title changed to: "+t.data.gist.parameters.title),function(t,e){var n=N(D(t));n&&(n.title=e)}(e,t.data.gist.parameters.title);break;case"eventDispatched":ot.events.dispatch("eventDispatched",{name:t.data.gist.parameters.name,payload:t.data.gist.parameters.payload});break;case"error":case"routeError":ot.messageError(n),ot.overlayInstanceId?$(!1,n):Y(n)}}var l,h}var Q=(t,e)=>t().then((t=>new Promise(e=>setTimeout(e,t)))(e).then(()=>Q(t,e))),K=!1,Z=[];async function tt(){K?await et():(!async function(){var t="G"+m().substring(0,8),e=document.createElement("div");e.setAttribute("id",t),e.style.display="none",document.body.appendChild(e),await I(5e3),M({messageId:""},t)}(),y()?(i("Queue watcher started"),K=!0,Q(()=>new Promise(()=>async function(){if(y())if(ot.isDocumentVisible)if(null===s("gist.web.userQueueNextPullCheck")){var t=await A(),e=[];t?(200===t.status||204===t.status?(i("200 response, updating local store."),rt(e=t.data)):304===t.status&&(i("304 response, using local store."),e=it()),e&&e.length>0?(i(`Message queue checked for user ${y()}, ${e.length} messages found.`),Z=e,await et()):(Z=[],i("No messages for user token."))):i("There was an error while checking message queue.")}else i("Next queue pull scheduled for later");else i("Document not visible, skipping queue check.");else i("User token reset, skipping queue check.")}()),1e3)):i("User token not setup, queue not started."))}async function et(){i("Messages in local queue: "+Z.length);var t=[],e=Z.sort((t,e)=>t.priority-e.priority);for(const o of e){if(!await nt(o)){var n=t.find(t=>t.queueId===o.queueId),r=ot.currentMessages.find(t=>t.queueId===o.queueId);n||r?i(`Message with queueId: ${o.queueId} already in queue, discarding.`):t.push(o)}}Z=t}async function nt(t){if(!function(t){return void 0!==k.find(e=>e.queueId===t.queueId)}(t)){var e=S(t);if(e.hasRouteRule){var n=ot.currentRoute;null==n&&(n=new URL(window.location.href).pathname);var r=e.routeRule;if(i("Verifying route against rule: "+r),!new RegExp(r).test(n))return i(`Route ${n} does not match rule.`),!1}return e.hasPosition&&(t.position=e.position),e.isEmbedded?await M(t,e.elementId):await j(t)}i(`Message with ${t.queueId} has been shown before, skipping.`)}function rt(t){o("gist.web.userQueue",t,new Date((new Date).getTime()+36e5))}function it(){return s("gist.web.userQueue")}var ot=e.default=class{static async setup(t){this.events=new r,this.config={useGuestSession:void 0!==t.useGuestSession&&t.useGuestSession,siteId:t.siteId,dataCenter:t.dataCenter,env:void 0===t.env?"prod":t.env,logging:void 0!==t.logging&&t.logging,experiments:void 0!==t.experiments&&t.experiments},this.currentMessages=[],this.overlayInstanceId=null,this.currentRoute=null,this.isDocumentVisible=!0,i(`Setup complete on ${this.config.env} environment.`),this.config.useGuestSession&&v(),await tt(),document.addEventListener("visibilitychange",async()=>{"hidden"===document.visibilityState?this.isDocumentVisible=!1:(this.isDocumentVisible=!0,await et())},!1)}static async setCurrentRoute(t){this.currentRoute=t,i("Current route set to: "+t),await et()}static async setUserToken(t,e){!function(t,e){void 0===e&&(e=new Date).setDate(e.getDate()+30),o("gist.web.userToken",t,e),a("gist.web.usingGuestUserToken"),i(`Set user token "${t}" with expiry date set to ${e}`)}(t,e),await tt()}static async clearUserToken(){a("gist.web.userToken"),i("Cleared user token"),this.config.useGuestSession&&v(),await tt()}static async dismissMessage(t){var e=V(t);await F(e),await q(e),await et()}static async embedMessage(t,e){var n=await M(t,e);return n?n.instanceId:null}static async showMessage(t){var e=await j(t);return e?e.instanceId:null}static messageShown(t){i("Message shown: "+t.messageId),this.events.dispatch("messageShown",t)}static messageDismissed(t){null!==t&&(i("Message dismissed: "+t.messageId),this.events.dispatch("messageDismissed",t))}static messageError(t){i("Message error: "+t.messageId),this.events.dispatch("messageError",t)}static messageAction(t,e,n){i(`Message action: ${t.currentRoute}, ${e} with name ${n} on ${t.instanceId}`),this.events.dispatch("messageAction",{message:t,action:e,name:n})}}}])}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Gist=t():e.Gist=t()}(this,(()=>(()=>{var e={505:(e,t,n)=>{e.exports=n(15)},592:(e,t,n)=>{"use strict";var r=n(516),s=n(522),i=n(948),o=n(106),a=n(615),u=n(631),c=n(202),l=n(896),d=n(845),f=n(563),p=n(656),h=n(721);e.exports=function(e){return new Promise((function(t,n){var g,m=e.data,v=e.headers,y=e.responseType,b=e.withXSRFToken;function w(){e.cancelToken&&e.cancelToken.unsubscribe(g),e.signal&&e.signal.removeEventListener("abort",g)}r.isFormData(m)&&r.isStandardBrowserEnv()&&delete v["Content-Type"];var x=new XMLHttpRequest;if(e.auth){var E=e.auth.username||"",R=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";v.Authorization="Basic "+btoa(E+":"+R)}var O=a(e.baseURL,e.url);function S(){if(x){var r="getAllResponseHeaders"in x?u(x.getAllResponseHeaders()):null,i={data:y&&"text"!==y&&"json"!==y?x.response:x.responseText,status:x.status,statusText:x.statusText,headers:r,config:e,request:x};s((function(e){t(e),w()}),(function(e){n(e),w()}),i),x=null}}if(x.open(e.method.toUpperCase(),o(O,e.params,e.paramsSerializer),!0),x.timeout=e.timeout,"onloadend"in x?x.onloadend=S:x.onreadystatechange=function(){x&&4===x.readyState&&(0!==x.status||x.responseURL&&0===x.responseURL.indexOf("file:"))&&setTimeout(S)},x.onabort=function(){x&&(n(new d("Request aborted",d.ECONNABORTED,e,x)),x=null)},x.onerror=function(){n(new d("Network Error",d.ERR_NETWORK,e,x)),x=null},x.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||l;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new d(t,r.clarifyTimeoutError?d.ETIMEDOUT:d.ECONNABORTED,e,x)),x=null},r.isStandardBrowserEnv()&&(b&&r.isFunction(b)&&(b=b(e)),b||!1!==b&&c(O))){var I=e.xsrfHeaderName&&e.xsrfCookieName&&i.read(e.xsrfCookieName);I&&(v[e.xsrfHeaderName]=I)}"setRequestHeader"in x&&r.forEach(v,(function(e,t){void 0===m&&"content-type"===t.toLowerCase()?delete v[t]:x.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(x.withCredentials=!!e.withCredentials),y&&"json"!==y&&(x.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&x.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&x.upload&&x.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(g=function(t){x&&(n(!t||t.type?new f(null,e,x):t),x.abort(),x=null)},e.cancelToken&&e.cancelToken.subscribe(g),e.signal&&(e.signal.aborted?g():e.signal.addEventListener("abort",g))),m||!1===m||0===m||""===m||(m=null);var T=p(O);T&&-1===h.protocols.indexOf(T)?n(new d("Unsupported protocol "+T+":",d.ERR_BAD_REQUEST,e)):x.send(m)}))}},15:(e,t,n)=>{"use strict";var r=n(516),s=n(12),i=n(155),o=n(343),a=n(412),u=n(298),c=function e(t){var n=new i(t),a=s(i.prototype.request,n);return r.extend(a,i.prototype,n),r.extend(a,n),a.create=function(n){return e(o(t,n))},a}(a);c.Axios=i,c.CanceledError=n(563),c.CancelToken=n(191),c.isCancel=n(864),c.VERSION=n(641).version,c.toFormData=n(440),c.AxiosError=n(845),c.Cancel=c.CanceledError,c.all=function(e){return Promise.all(e)},c.spread=n(980),c.isAxiosError=n(19),c.formToJSON=function(e){return u(r.isHTMLForm(e)?new FormData(e):e)},e.exports=c,e.exports.default=c},191:(e,t,n)=>{"use strict";var r=n(563);function s(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){for(var t=n._listeners.length;t-- >0;)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,s,i){n.reason||(n.reason=new r(e,s,i),t(n.reason))}))}s.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},s.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},s.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},s.source=function(){var e;return{token:new s((function(t){e=t})),cancel:e}},e.exports=s},563:(e,t,n)=>{"use strict";var r=n(845);function s(e,t,n){r.call(this,null==e?"canceled":e,r.ERR_CANCELED,t,n),this.name="CanceledError"}n(516).inherits(s,r,{__CANCEL__:!0}),e.exports=s},864:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},155:(e,t,n)=>{"use strict";var r=n(516),s=n(106),i=n(471),o=n(490),a=n(343),u=n(615),c=n(841),l=c.validators;function d(e){this.defaults=e,this.interceptors={request:new i,response:new i}}d.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&c.assertOptions(n,{silentJSONParsing:l.transitional(l.boolean),forcedJSONParsing:l.transitional(l.boolean),clarifyTimeoutError:l.transitional(l.boolean)},!1);var s=t.paramsSerializer;void 0!==s&&c.assertOptions(s,{encode:l.function,serialize:l.function},!0),r.isFunction(s)&&(t.paramsSerializer={serialize:s});var i=[],u=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(u=u&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));var d,f=[];if(this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)})),!u){var p=[o,void 0];for(Array.prototype.unshift.apply(p,i),p=p.concat(f),d=Promise.resolve(t);p.length;)d=d.then(p.shift(),p.shift());return d}for(var h=t;i.length;){var g=i.shift(),m=i.shift();try{h=g(h)}catch(e){m(e);break}}try{d=o(h)}catch(e){return Promise.reject(e)}for(;f.length;)d=d.then(f.shift(),f.shift());return d},d.prototype.getUri=function(e){e=a(this.defaults,e);var t=u(e.baseURL,e.url);return s(t,e.params,e.paramsSerializer)},r.forEach(["delete","get","head","options"],(function(e){d.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,s){return this.request(a(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}d.prototype[e]=t(),d.prototype[e+"Form"]=t(!0)})),e.exports=d},845:(e,t,n)=>{"use strict";var r=n(516);function s(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)}r.inherits(s,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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var i=s.prototype,o={};["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((function(e){o[e]={value:e}})),Object.defineProperties(s,o),Object.defineProperty(i,"isAxiosError",{value:!0}),s.from=function(e,t,n,o,a,u){var c=Object.create(i);return r.toFlatObject(e,c,(function(e){return e!==Error.prototype})),s.call(c,e.message,t,n,o,a),c.cause=e,c.name=e.name,u&&Object.assign(c,u),c},e.exports=s},471:(e,t,n)=>{"use strict";var r=n(516);function s(){this.handlers=[]}s.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},s.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},s.prototype.clear=function(){this.handlers&&(this.handlers=[])},s.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=s},615:(e,t,n)=>{"use strict";var r=n(137),s=n(680);e.exports=function(e,t){return e&&!r(t)?s(e,t):t}},490:(e,t,n)=>{"use strict";var r=n(516),s=n(881),i=n(864),o=n(412),a=n(563),u=n(18);function c(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a}e.exports=function(e){return c(e),e.headers=e.headers||{},e.data=s.call(e,e.data,e.headers,null,e.transformRequest),u(e.headers,"Accept"),u(e.headers,"Content-Type"),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||o.adapter)(e).then((function(t){return c(e),t.data=s.call(e,t.data,t.headers,t.status,e.transformResponse),t}),(function(t){return i(t)||(c(e),t&&t.response&&(t.response.data=s.call(e,t.response.data,t.response.headers,t.response.status,e.transformResponse))),Promise.reject(t)}))}},343:(e,t,n)=>{"use strict";var r=n(516);e.exports=function(e,t){t=t||{};var n={};function s(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isEmptyObject(t)?r.merge({},e):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function i(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:s(void 0,e[n]):s(e[n],t[n])}function o(e){if(!r.isUndefined(t[e]))return s(void 0,t[e])}function a(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:s(void 0,e[n]):s(void 0,t[n])}function u(n){return n in t?s(e[n],t[n]):n in e?s(void 0,e[n]):void 0}var c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return r.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||i,s=t(e);r.isUndefined(s)&&t!==u||(n[e]=s)})),n}},522:(e,t,n)=>{"use strict";var r=n(845);e.exports=function(e,t,n){var s=n.config.validateStatus;n.status&&s&&!s(n.status)?t(new r("Request failed with status code "+n.status,[r.ERR_BAD_REQUEST,r.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}},881:(e,t,n)=>{"use strict";var r=n(516),s=n(412);e.exports=function(e,t,n,i){var o=this||s;return r.forEach(i,(function(r){e=r.call(o,e,t,n)})),e}},412:(e,t,n)=>{"use strict";var r=n(516),s=n(18),i=n(845),o=n(896),a=n(440),u=n(69),c=n(721),l=n(298),d={"Content-Type":"application/x-www-form-urlencoded"};function f(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var p,h={transitional:o,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(p=n(592)),p),transformRequest:[function(e,t){s(t,"Accept"),s(t,"Content-Type");var n,i=t&&t["Content-Type"]||"",o=i.indexOf("application/json")>-1,c=r.isObject(e);if(c&&r.isHTMLForm(e)&&(e=new FormData(e)),r.isFormData(e))return o?JSON.stringify(l(e)):e;if(r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e))return e;if(r.isArrayBufferView(e))return e.buffer;if(r.isURLSearchParams(e))return f(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();if(c){if(-1!==i.indexOf("application/x-www-form-urlencoded"))return u(e,this.formSerializer).toString();if((n=r.isFileList(e))||i.indexOf("multipart/form-data")>-1){var d=this.env&&this.env.FormData;return a(n?{"files[]":e}:e,d&&new d,this.formSerializer)}}return c||o?(f(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(0,JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||h.transitional,n=t&&t.forcedJSONParsing,s="json"===this.responseType;if(e&&r.isString(e)&&(n&&!this.responseType||s)){var o=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw i.from(e,i.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:c.classes.FormData,Blob:c.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){h.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){h.headers[e]=r.merge(d)})),e.exports=h},896:e=>{"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},786:(e,t,n)=>{e.exports=n(894)},641:e=>{e.exports={version:"0.28.1"}},170:(e,t,n)=>{"use strict";var r=n(440);function s(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'\(\)~]|%20|%00/g,(function(e){return t[e]}))}function i(e,t){this._pairs=[],e&&r(e,this,t)}var o=i.prototype;o.append=function(e,t){this._pairs.push([e,t])},o.toString=function(e){var t=e?function(t){return e.call(this,t,s)}:s;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")},e.exports=i},12:e=>{"use strict";e.exports=function(e,t){return function(){return e.apply(t,arguments)}}},106:(e,t,n)=>{"use strict";var r=n(516),s=n(170);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o));var a,u=n&&n.encode||i,c=n&&n.serialize;return(a=c?c(t,n):r.isURLSearchParams(t)?t.toString():new s(t,n).toString(u))&&(e+=(-1===e.indexOf("?")?"?":"&")+a),e}},680:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},948:(e,t,n)=>{"use strict";var r=n(516);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,s,i,o){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(s)&&a.push("path="+s),r.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},298:(e,t,n)=>{"use strict";var r=n(516);e.exports=function(e){function t(e,n,s,i){var o=e[i++],a=Number.isFinite(+o),u=i>=e.length;return o=!o&&r.isArray(s)?s.length:o,u?(r.hasOwnProperty(s,o)?s[o]=[s[o],n]:s[o]=n,!a):(s[o]&&r.isObject(s[o])||(s[o]=[]),t(e,n,s[o],i)&&r.isArray(s[o])&&(s[o]=function(e){var t,n,r={},s=Object.keys(e),i=s.length;for(t=0;t<i;t++)r[n=s[t]]=e[n];return r}(s[o])),!a)}if(r.isFormData(e)&&r.isFunction(e.entries)){var n={};return r.forEachEntry(e,(function(e,s){t(function(e){return r.matchAll(/\w+|\[(\w*)]/g,e).map((function(e){return"[]"===e[0]?"":e[1]||e[0]}))}(e),s,n,0)})),n}return null}},137:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},19:(e,t,n)=>{"use strict";var r=n(516);e.exports=function(e){return r.isObject(e)&&!0===e.isAxiosError}},202:(e,t,n)=>{"use strict";var r=n(516);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function s(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=s(window.location.href),function(t){var n=r.isString(t)?s(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},18:(e,t,n)=>{"use strict";var r=n(516);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},631:(e,t,n)=>{"use strict";var r=n(516),s=["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"];e.exports=function(e){var t,n,i,o={};return e?(r.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=r.trim(e.slice(0,i)).toLowerCase(),n=r.trim(e.slice(i+1)),t){if(o[t]&&s.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}},656:e=>{"use strict";e.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}},980:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},440:(e,t,n)=>{"use strict";var r=n(516),s=n(845),i=n(786);function o(e){return r.isPlainObject(e)||r.isArray(e)}function a(e){return r.endsWith(e,"[]")?e.slice(0,-2):e}function u(e,t,n){return e?e.concat(t).map((function(e,t){return e=a(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}var c=r.toFlatObject(r,{},null,(function(e){return/^is[A-Z]/.test(e)}));e.exports=function(e,t,n){if(!r.isObject(e))throw new TypeError("target must be an object");t=t||new(i||FormData);var l,d=(n=r.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!r.isUndefined(t[e])}))).metaTokens,f=n.visitor||v,p=n.dots,h=n.indexes,g=(n.Blob||"undefined"!=typeof Blob&&Blob)&&(l=t)&&r.isFunction(l.append)&&"FormData"===l[Symbol.toStringTag]&&l[Symbol.iterator];if(!r.isFunction(f))throw new TypeError("visitor must be a function");function m(e){if(null===e)return"";if(r.isDate(e))return e.toISOString();if(!g&&r.isBlob(e))throw new s("Blob is not supported. Use a Buffer instead.");return r.isArrayBuffer(e)||r.isTypedArray(e)?g&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function v(e,n,s){var i=e;if(e&&!s&&"object"==typeof e)if(r.endsWith(n,"{}"))n=d?n:n.slice(0,-2),e=JSON.stringify(e);else if(r.isArray(e)&&function(e){return r.isArray(e)&&!e.some(o)}(e)||r.isFileList(e)||r.endsWith(n,"[]")&&(i=r.toArray(e)))return n=a(n),i.forEach((function(e,s){!r.isUndefined(e)&&t.append(!0===h?u([n],s,p):null===h?n:n+"[]",m(e))})),!1;return!!o(e)||(t.append(u(s,n,p),m(e)),!1)}var y=[],b=Object.assign(c,{defaultVisitor:v,convertValue:m,isVisitable:o});if(!r.isObject(e))throw new TypeError("data must be an object");return function e(n,s){if(!r.isUndefined(n)){if(-1!==y.indexOf(n))throw Error("Circular reference detected in "+s.join("."));y.push(n),r.forEach(n,(function(n,i){!0===(!r.isUndefined(n)&&f.call(t,n,r.isString(i)?i.trim():i,s,b))&&e(n,s?s.concat(i):[i])})),y.pop()}}(e),t}},69:(e,t,n)=>{"use strict";var r=n(516),s=n(440),i=n(721);e.exports=function(e,t){return s(e,new i.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,s){return i.isNode&&r.isBuffer(e)?(this.append(t,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}},841:(e,t,n)=>{"use strict";var r=n(641).version,s=n(845),i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={};i.transitional=function(e,t,n){function i(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,a){if(!1===e)throw new s(i(r," has been removed"+(t?" in "+t:"")),s.ERR_DEPRECATED);return t&&!o[r]&&(o[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,a)}},e.exports={assertOptions:function(e,t,n){if("object"!=typeof e)throw new s("options must be an object",s.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(e),i=r.length;i-- >0;){var o=r[i],a=t[o];if(a){var u=e[o],c=void 0===u||a(u,o,e);if(!0!==c)throw new s("option "+o+" must be "+c,s.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new s("Unknown option "+o,s.ERR_BAD_OPTION)}},validators:i}},243:e=>{"use strict";e.exports=FormData},2:(e,t,n)=>{"use strict";var r=n(170);e.exports="undefined"!=typeof URLSearchParams?URLSearchParams:r},109:(e,t,n)=>{"use strict";e.exports={isBrowser:!0,classes:{URLSearchParams:n(2),FormData:n(243),Blob},protocols:["http","https","file","blob","url","data"]}},721:(e,t,n)=>{"use strict";e.exports=n(109)},516:(e,t,n)=>{"use strict";var r,s=n(12),i=Object.prototype.toString,o=(r=Object.create(null),function(e){var t=i.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())});function a(e){return e=e.toLowerCase(),function(t){return o(t)===e}}function u(e){return Array.isArray(e)}function c(e){return void 0===e}var l=a("ArrayBuffer");function d(e){return"number"==typeof e}function f(e){return null!==e&&"object"==typeof e}function p(e){if("object"!==o(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var h=a("Date"),g=a("File"),m=a("Blob"),v=a("FileList");function y(e){return"[object Function]"===i.call(e)}var b=a("URLSearchParams");function w(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),u(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}var x,E,R=(x="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return x&&e instanceof x}),O=a("HTMLFormElement"),S=(E=Object.prototype.hasOwnProperty,function(e,t){return E.call(e,t)});e.exports={isArray:u,isArrayBuffer:l,isBuffer:function(e){return null!==e&&!c(e)&&null!==e.constructor&&!c(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){var t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||i.call(e)===t||y(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&l(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:d,isObject:f,isPlainObject:p,isEmptyObject:function(e){return e&&0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype},isUndefined:c,isDate:h,isFile:g,isBlob:m,isFunction:y,isStream:function(e){return f(e)&&y(e.pipe)},isURLSearchParams:b,isStandardBrowserEnv:function(){var e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:w,merge:function e(){var t={};function n(n,r){p(t[r])&&p(n)?t[r]=e(t[r],n):p(n)?t[r]=e({},n):u(n)?t[r]=n.slice():t[r]=n}for(var r=0,s=arguments.length;r<s;r++)w(arguments[r],n);return t},extend:function(e,t,n){return w(t,(function(t,r){e[r]=n&&"function"==typeof t?s(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,n,r){e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,n&&Object.assign(e.prototype,n)},toFlatObject:function(e,t,n,r){var s,i,o,a={};if(t=t||{},null==e)return t;do{for(i=(s=Object.getOwnPropertyNames(e)).length;i-- >0;)o=s[i],r&&!r(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==n&&Object.getPrototypeOf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:a,endsWith:function(e,t,n){e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;var r=e.indexOf(t,n);return-1!==r&&r===n},toArray:function(e){if(!e)return null;if(u(e))return e;var t=e.length;if(!d(t))return null;for(var n=new Array(t);t-- >0;)n[t]=e[t];return n},isTypedArray:R,isFileList:v,forEachEntry:function(e,t){for(var n,r=(e&&e[Symbol.iterator]).call(e);(n=r.next())&&!n.done;){var s=n.value;t.call(e,s[0],s[1])}},matchAll:function(e,t){for(var n,r=[];null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:O,hasOwnProperty:S}},894:e=>{e.exports="object"==typeof self?self.FormData:window.FormData},520:(e,t,n)=>{"use strict";n.d(t,{A:()=>ae});class r{on(e,t){var n=this[e];n?n.push(t):this[e]=[t]}dispatch(e,t){var n=this[e];n&&n.forEach((e=>e(t)))}}function s(e){ae.config.logging&&console.log(`Gist: ${e}`)}function i(e,t,n){const r={value:t,expiry:n};localStorage.setItem(e,JSON.stringify(r))}function o(e){const t=localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t),r=new Date,s=new Date(n.expiry);return r.getTime()>s.getTime()?(localStorage.removeItem(e),null):n.value}function a(e){localStorage.removeItem(e)}var u,c=new Uint8Array(16);function l(){if(!u&&!(u="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return u(c)}const d=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var f=[],p=0;p<256;++p)f.push((p+256).toString(16).substr(1));const h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(f[e[t+0]]+f[e[t+1]]+f[e[t+2]]+f[e[t+3]]+"-"+f[e[t+4]]+f[e[t+5]]+"-"+f[e[t+6]]+f[e[t+7]]+"-"+f[e[t+8]]+f[e[t+9]]+"-"+f[e[t+10]]+f[e[t+11]]+f[e[t+12]]+f[e[t+13]]+f[e[t+14]]+f[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&d.test(e)}(n))throw TypeError("Stringified UUID is invalid");return n},g=function(e,t,n){var r=(e=e||{}).random||(e.rng||l)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var s=0;s<16;++s)t[n+s]=r[s];return t}return h(r)},m="gist.web.userToken",v="gist.web.guestUserToken",y="gist.web.usingGuestUserToken";function b(){return o(m)}function w(){var e=new Date;if(e.setDate(e.getDate()+365),null===b()){var t=o(v);null==t&&(t=g(),i(v,t,e),s(`Set guest user token "${t}" with expiry date set to 1 year from today`)),i(m,t,e),i(y,!0,e)}}var x=n(505),E=n.n(x);const R={ENGINE_API_ENDPOINT:{prod:"https://engine.api.gist.build",dev:"https://engine.api.dev.gist.build",local:"http://engine.api.local.gist.build:82"},GIST_QUEUE_API_ENDPOINT:{prod:"https://gist-queue-consumer-api.cloud.gist.build",dev:"https://gist-queue-consumer-api.cloud.dev.gist.build",local:"http://api.local.gist.build:86"},GIST_VIEW_ENDPOINT:{prod:"https://renderer.gist.build/2.0",dev:"https://renderer.gist.build/2.0",local:"http://app.local.gist.build:8080/web"}};function O(){var e={"X-CIO-Site-Id":ae.config.siteId,"X-CIO-Datacenter":ae.config.dataCenter},t=b();return null!=t&&(e["X-Gist-Encoded-User-Token"]=btoa(t)),E().create({baseURL:R.GIST_QUEUE_API_ENDPOINT[ae.config.env],timeout:2e4,headers:e})}var S=600,I=!1;const T="gist.web.userQueueNextPullCheck";function A(e){var t="",n="",r="",s=!1,i=!1,o=!1,a=!1,u=null,c=!1,l="#00000033",d=414,f=!1;return e.properties&&e.properties.gist&&(e.properties.gist.campaignId&&(u=e.properties.gist.campaignId),e.properties.gist.elementId&&(t=e.properties.gist.elementId,s=!0),e.properties.gist.routeRuleWeb&&(n=e.properties.gist.routeRuleWeb,i=!0),e.properties.gist.position&&(r=e.properties.gist.position,o=!0),e.properties.gist.scale&&(a=e.properties.gist.scale),e.properties.gist.overlayColor&&(l=e.properties.gist.overlayColor),e.properties.gist.messageWidth&&e.properties.gist.messageWidth>0&&(d=e.properties.gist.messageWidth,f=!0),e.properties.gist.persistent&&(c=!0)),{isEmbedded:s,elementId:t,hasRouteRule:i,routeRule:n,position:r,hasPosition:o,shouldScale:a,campaignId:u,messageWidth:d,overlayColor:l,persistent:c,hasCustomWidth:f}}var D=["x-gist-top","x-gist-floating-top","x-gist-bottom","x-gist-floating-bottom","x-gist-floating-bottom-left","x-gist-floating-bottom-right","x-gist-floating-top-left","x-gist-floating-top-right"];const C=e=>new Promise((t=>setTimeout(t,e))),N=["x-gist-top","x-gist-bottom","x-gist-floating-top","x-gist-floating-bottom"];function P(e){var t=U(e);if(t)return t.style&&t.style.height&&"0px"!=t.style.height}function j(){var e=document.querySelector("#gist-embed-message");e&&e.parentNode.removeChild(e)}function _(e){return`gist-${e}`}function k(){var e=document.querySelector(".gist-message");e&&e.classList.add("visible")}function U(e){try{return document.querySelector(`#${e}`)||null}catch{return null}}var L=[];async function $(e){if(ae.isDocumentVisible){if(ae.overlayInstanceId)return s(`Message ${ae.overlayInstanceId} already showing.`),null;var t=A(e);return e.instanceId=g(),e.overlay=!0,e.firstLoad=!0,e.shouldResizeHeight=!0,e.shouldScale=t.shouldScale,e.renderStartTime=(new Date).getTime(),ae.overlayInstanceId=e.instanceId,ae.currentMessages.push(e),V(e)}return s("Document hidden, not showing message now."),null}async function B(e,t){return ae.isDocumentVisible?(e.instanceId=g(),e.overlay=!1,e.firstLoad=!0,e.shouldScale=!1,e.elementId=t,e.shouldResizeHeight=!P(t),e.renderStartTime=(new Date).getTime(),ae.currentMessages.push(e),V(e,t)):(s("Document hidden, not showing message now."),null)}async function F(e){e?(ae.messageDismissed(e),e.overlay?await W(!0,e):M(e)):s(`Message with instance id: ${instanceId} not found`)}async function q(e){var t=A(e);e?t.persistent&&(s("Persistent message dismissed, logging view"),await z(e)):s(`Message with instance id: ${instanceId} not found`)}function M(e){var t;G(e.instanceId),(t=U(e.elementId))&&(t.classList.remove("gist-visible"),t.style.removeProperty("height"),t.innerHTML="")}async function W(e,t){G(t.instanceId),ae.overlayInstanceId=null,e?await async function(){var e=document.querySelector(".gist-message");e&&(e.classList.remove("visible"),await C(300)),j()}():j(),0==ae.currentMessages.length&&(window.removeEventListener("message",Q),window.removeEventListener("touchstart",X))}function V(e,t=null){if(t&&function(e){var t=U(e);return!(!t||!t.classList.contains("gist-visible"))}(t))return s(`Message ${e.messageId} already showing in element ${t}.`),null;var n,r,i={endpoint:R.ENGINE_API_ENDPOINT[ae.config.env],siteId:ae.config.siteId,dataCenter:ae.config.dataCenter,messageId:e.messageId,instanceId:e.instanceId,livePreview:!1,properties:e.properties},o=`${R.GIST_VIEW_ENDPOINT[ae.config.env]}/index.html?options=${n=JSON.stringify(i),r=btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode("0x"+t)}))),encodeURIComponent(r)}`;return window.addEventListener("message",Q),window.addEventListener("touchstart",X),t?(D.includes(t)&&function(e){const t=document.createElement("div");t.id=e,"x-gist-top"===e?document.body.insertBefore(t,document.body.firstChild):document.body.insertAdjacentElement("beforeend",t),s("Top & bottom elements injected into page")}(t),function(e,t,n){var r=U(e);if(r){r.classList.add(_(n.instanceId));var i=A(n),o=i.messageWidth+"px";N.includes(e)&&!i.hasCustomWidth&&(o="100%"),D.includes(e)&&(r.style.width=o),P(e)||(r.style.height="0px"),r.innerHTML=function(e,t,n){var r=function(e,t,n){var r=800;return t.messageWidth>r&&(r=t.messageWidth),`\n <div id="gist-embed">\n <style>\n #x-gist-floating-top, #x-gist-floating-top-left, #x-gist-floating-top-right {\n position: fixed;\n top: 0px;\n z-index: 1000000;\n }\n #x-gist-floating-bottom, #x-gist-floating-bottom-left, #x-gist-floating-bottom-right {\n position: fixed;\n bottom: 0px;\n z-index: 1000000;\n }\n #x-gist-bottom, #x-gist-top, #x-gist-floating-top, #x-gist-floating-bottom {\n left: 50%;\n transform: translate(-50%, 0%);\n }\n #x-gist-floating-top-right, #x-gist-floating-bottom-right {\n right: 0px;\n }\n #gist-embed {\n position: relative;\n height: 100%;\n width: 100%;\n }\n #gist-embed-container {\n position: relative;\n height: 100%;\n width: 100%;\n }\n #gist-embed-container .gist-frame {\n height: 100%;\n width: 100%;\n border: none;\n }\n @media (max-width: ${r}px) {\n #x-gist-top.${e},\n #x-gist-bottom.${e},\n #x-gist-floating-top.${e},\n #x-gist-floating-bottom.${e},\n #x-gist-floating-top-left.${e},\n #x-gist-floating-top-right.${e},\n #x-gist-floating-bottom-left.${e},\n #x-gist-floating-bottom-right.${e} {\n width: 100% !important;\n }\n }\n </style>\n <div id="gist-embed-container">\n <iframe id="${e}" class="gist-frame" src="${n}"></iframe>\n </div>\n </div>`}(_(t.instanceId),n,e);return r}(t,n,i)}else s(`Message could not be embedded, elementId ${e} not found.`)}(t,o,e)):function(e,t){document.body.insertAdjacentHTML("afterbegin",function(e,t){var n=A(t),r=function(e,t,n){var r=600;return t.messageWidth>r&&(r=t.messageWidth),`\n <div id="gist-embed-message">\n <style>\n #gist-overlay.background {\n position: fixed;\n z-index: 9999999998;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: ${t.overlayColor};\n visibility: hidden;\n }\n #gist-overlay.background.visible {\n visibility: visible;\n }\n #gist-overlay.background.is-blacked-out {\n display: block;\n }\n .gist-message {\n width: ${t.messageWidth}px;\n position: absolute;\n border: none;\n opacity: 0;\n transition: opacity 0.3s ease-in-out;\n z-index: 9999999999;\n left: 50%;\n transform: translateX(-50%);\n }\n .gist-message.visible {\n opacity: 1;\n pointer-events: auto;\n }\n .gist-message.center {\n transform: translate(-50%, -50%);\n top: 50%;\n }\n .gist-message.bottom {\n bottom: 0;\n }\n .gist-message.top {\n top: 0;\n }\n @media (max-width: ${r}px) {\n .gist-message {\n width: 100%;\n }\n }\n </style>\n <div id="gist-overlay" class="background">\n <iframe id="${e}" class="gist-message" src="${n}"></iframe>\n </div>\n </div>`}(_(t.instanceId),n,e);return r}(e,t))}(o,e),e}async function z(e){s(`Message shown, logging view for: ${e.messageId}`);var t={};null!=e.queueId?(function(e){L.push(e);var t=oe();null!=t&&t.length>0&&ie(t.filter((t=>t.queueId!==e.queueId)))}(e),t=await async function(e){try{return await O().post(`/api/v1/logs/queue/${e}`)}catch(e){return e.response}}(e.queueId)):t=await async function(e){try{return await O().post(`/api/v1/logs/message/${e}`)}catch(e){return e.response}}(e.messageId),200===t.status?s("Message view logged"):s(`Problem logging message: ${t.status}`)}function H(e){return ae.currentMessages.find((t=>t.instanceId===e))}function G(e){ae.currentMessages=ae.currentMessages.filter((t=>t.instanceId!==e))}function J(e,t){G(e),ae.currentMessages.push(t)}function X(e){}async function Q(e){if(e.data.gist){var t=e.data.gist.instanceId,n=H(t);if(!n)return;var r=A(n);switch(e.data.gist.method){case"routeLoaded":var i=.001*((new Date).getTime()-n.renderStartTime);s(`Engine render for message: ${n.messageId} timer elapsed in ${i.toFixed(3)} seconds`),n.currentRoute=e.data.gist.parameters.route,n.firstLoad&&(n.overlay?function(e){var t=document.querySelector("#gist-overlay");if(t){t.classList.add("visible");var n=document.querySelector(".gist-message");e.position?n.classList.add(e.position):n.classList.add("center"),setTimeout(k,100)}else j()}(n):(d=U(n.elementId))&&d.classList.add("gist-visible"),ae.messageShown(n),r.persistent?s("Persistent message shown, skipping logging view"):await z(n),n.firstLoad=!1),J(t,n);break;case"tap":var o=e.data.gist.parameters.action,a=e.data.gist.parameters.name;if(ae.messageAction(n,o,a),e.data.gist.parameters.system&&!r.persistent){await F(n);break}try{if((l=new URL(o))&&"gist:"===l.protocol)switch(l.href.replace("gist://","").split("?")[0]){case"close":await F(n),await q(n),await re();break;case"showMessage":var u=l.searchParams.get("messageId"),c=l.searchParams.get("properties");u&&(c&&(c=JSON.parse(atob(c))),await ae.showMessage({messageId:u,properties:c}));break;case"loadPage":var l;(l=l.href.substring(l.href.indexOf("?url=")+5))&&(l.startsWith("https://")||l.startsWith("http://")||l.startsWith("/")?window.location.href=l:window.location.href=window.location+l)}}catch(e){}break;case"routeChanged":n.currentRoute=e.data.gist.parameters.route,n.renderStartTime=(new Date).getTime(),J(t,n),s(`Route changed to: ${n.currentRoute}`);break;case"sizeChanged":s(`Size Changed Width: ${e.data.gist.parameters.width} - Height: ${e.data.gist.parameters.height}`),n.elementId&&!n.shouldResizeHeight||function(e,t){var n=U(e.elementId?e.elementId:_(e.instanceId));if(n){var r=n.style;if(t.height>0)if(t.height>window.innerHeight){var s=1-(t.height/window.innerHeight-1);e.shouldScale&&s>=.4?(r.height=`${t.height}px`,r.transform=`translateX(-50%) translateY(-50%) scale(${s})`):r.height=`${window.innerHeight}px`}else r.height=`${t.height}px`}}(n,e.data.gist.parameters);break;case"titleChanged":s(`Overlay title changed to: ${e.data.gist.parameters.title}`),function(e,t){var n=U(_(e));n&&(n.title=t)}(t,e.data.gist.parameters.title);break;case"eventDispatched":ae.events.dispatch("eventDispatched",{name:e.data.gist.parameters.name,payload:e.data.gist.parameters.payload});break;case"error":case"routeError":ae.messageError(n),ae.overlayInstanceId?W(!1,n):M(n)}}var d}const K="gist.web.userQueue",Y=36e5;var Z=(e,t)=>e().then((e=>new Promise((t=>setTimeout(t,e))))(t).then((()=>Z(e,t)))),ee=!1,te=[];async function ne(){ee?await re():(async function(){var e=`G${g().substring(0,8)}`,t=document.createElement("div");t.setAttribute("id",e),t.style.display="none",document.body.appendChild(t),await C(5e3),B({messageId:""},e)}(),b()?(s("Queue watcher started"),ee=!0,Z((()=>new Promise((()=>async function(){if(b())if(ae.isDocumentVisible)if(null===o(T)){var e=await async function(){var e;try{if(!I){var t=(new Date).getTime();I=!0,e=await O().post(`/api/v1/users?timestamp=${t}`,{})}}catch(t){t.response?e=t.response:s(`Error getting user queue: ${t}`)}finally{return I=!1,function(e){if(e&&e.headers){var t=e.headers["x-gist-queue-polling-interval"];t&&t>0&&(S=t)}var n=new Date((new Date).getTime()+1e3*S);i(T,S,n)}(e),e}}(),t=[];e?(200===e.status||204===e.status?(s("200 response, updating local store."),ie(t=e.data)):304===e.status&&(s("304 response, using local store."),t=oe()),t&&t.length>0?(s(`Message queue checked for user ${b()}, ${t.length} messages found.`),te=t,await re()):(te=[],s("No messages for user token."))):s("There was an error while checking message queue.")}else s("Next queue pull scheduled for later");else s("Document not visible, skipping queue check.");else s("User token reset, skipping queue check.")}()))),1e3)):s("User token not setup, queue not started."))}async function re(){s(`Messages in local queue: ${te.length}`);var e=[],t=te.sort(((e,t)=>e.priority-t.priority));for(const i of t)if(!await se(i)){var n=e.find((e=>e.queueId===i.queueId)),r=ae.currentMessages.find((e=>e.queueId===i.queueId));n||r?s(`Message with queueId: ${i.queueId} already in queue, discarding.`):e.push(i)}te=e}async function se(e){if(!function(e){return void 0!==L.find((t=>t.queueId===e.queueId))}(e)){var t=A(e);if(t.hasRouteRule){var n=ae.currentRoute;null==n&&(n=new URL(window.location.href).pathname);var r=t.routeRule;if(s(`Verifying route against rule: ${r}`),!new RegExp(r).test(n))return s(`Route ${n} does not match rule.`),!1}return t.hasPosition&&(e.position=t.position),t.isEmbedded?await B(e,t.elementId):await $(e)}s(`Message with ${e.queueId} has been shown before, skipping.`)}function ie(e){var t=new Date((new Date).getTime()+Y);i(K,e,t)}function oe(){return o(K)}const ae=class{static async setup(e){this.events=new r,this.config={useGuestSession:void 0!==e.useGuestSession&&e.useGuestSession,siteId:e.siteId,dataCenter:e.dataCenter,env:void 0===e.env?"prod":e.env,logging:void 0!==e.logging&&e.logging,experiments:void 0!==e.experiments&&e.experiments},this.currentMessages=[],this.overlayInstanceId=null,this.currentRoute=null,this.isDocumentVisible=!0,s(`Setup complete on ${this.config.env} environment.`),this.config.useGuestSession&&w(),await ne(),document.addEventListener("visibilitychange",(async()=>{"hidden"===document.visibilityState?this.isDocumentVisible=!1:(this.isDocumentVisible=!0,await re())}),!1)}static async setCurrentRoute(e){this.currentRoute=e,s(`Current route set to: ${e}`),await re()}static async setUserToken(e,t){!function(e,t){void 0===t&&(t=new Date).setDate(t.getDate()+30),i(m,e,t),a(y),s(`Set user token "${e}" with expiry date set to ${t}`)}(e,t),await ne()}static async clearUserToken(){a(m),s("Cleared user token"),this.config.useGuestSession&&w(),await ne()}static async dismissMessage(e){var t=H(e);await F(t),await q(t),await re()}static async embedMessage(e,t){var n=await B(e,t);return n?n.instanceId:null}static async showMessage(e){var t=await $(e);return t?t.instanceId:null}static messageShown(e){s(`Message shown: ${e.messageId}`),this.events.dispatch("messageShown",e)}static messageDismissed(e){null!==e&&(s(`Message dismissed: ${e.messageId}`),this.events.dispatch("messageDismissed",e))}static messageError(e){s(`Message error: ${e.messageId}`),this.events.dispatch("messageError",e)}static messageAction(e,t,n){s(`Message action: ${e.currentRoute}, ${t} with name ${n} on ${e.instanceId}`),this.events.dispatch("messageAction",{message:e,action:t,name:n})}}},44:(e,t,n)=>{const r=n(520).A;e.exports=r}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(44)})()));
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "customerio-gist-web",
3
- "version": "3.10.0",
3
+ "version": "3.10.2",
4
4
  "description": "Build beautiful in-app flows with no code and deliver them instantly to your app. http://customer.io",
5
5
  "private": false,
6
6
  "scripts": {
7
7
  "start": "npm-run-all --parallel watch:server watch:build",
8
- "build:prod": "webpack -p --mode=production -o dist/gist.min.js",
8
+ "build:prod": "webpack --mode=production --output-filename gist.min.js",
9
9
  "watch:build": "webpack --watch --progress --mode=development",
10
10
  "watch:server": "http-server"
11
11
  },
@@ -17,10 +17,10 @@
17
17
  "author": "Customer.io (https://customer.io)",
18
18
  "license": "SEE LICENSE IN LICENSE",
19
19
  "devDependencies": {
20
- "http-server": "^0.12.3",
20
+ "http-server": "^14.1.1",
21
21
  "npm-run-all": "^4.1.5",
22
- "webpack": "^4.44.1",
23
- "webpack-cli": "^3.3.12"
22
+ "webpack": "^5.91.0",
23
+ "webpack-cli": "^5.1.4"
24
24
  },
25
25
  "dependencies": {
26
26
  "axios": "^0.28.1",
@@ -31,13 +31,14 @@ export async function preloadRenderer() {
31
31
  export function loadEmbedComponent(elementId, url, message) {
32
32
  var element = safelyFetchElement(elementId);
33
33
  if (element) {
34
+ element.classList.add(getMessageElementId(message.instanceId));
34
35
  var messageProperties = resolveMessageProperties(message);
35
36
  var messageWidth = messageProperties.messageWidth + "px";
36
- if (wideOverlayPositions.includes(messageProperties.elementId) && !messageProperties.hasCustomWidth) {
37
+ if (wideOverlayPositions.includes(elementId) && !messageProperties.hasCustomWidth) {
37
38
  messageWidth = "100%";
38
39
  }
39
40
  // Only set the width if it's a position offered by the SDK
40
- if (positions.includes(messageProperties.elementId)) {
41
+ if (positions.includes(elementId)) {
41
42
  element.style.width = messageWidth;
42
43
  }
43
44
  if (!elementHasHeight(elementId)) {
@@ -1,4 +1,4 @@
1
- export function embedHTMLTemplate(instanceId, messageProperties, url) {
1
+ export function embedHTMLTemplate(elementId, messageProperties, url) {
2
2
  var maxWidthBreakpoint = 800;
3
3
  if (messageProperties.messageWidth > maxWidthBreakpoint) {
4
4
  maxWidthBreakpoint = messageProperties.messageWidth;
@@ -39,13 +39,20 @@ export function embedHTMLTemplate(instanceId, messageProperties, url) {
39
39
  border: none;
40
40
  }
41
41
  @media (max-width: ${maxWidthBreakpoint}px) {
42
- #x-gist-top, #x-gist-bottom, #x-gist-floating-top, #x-gist-floating-bottom, #x-gist-floating-top-left, #x-gist-floating-top-right, #x-gist-floating-bottom-left, #x-gist-floating-bottom-right {
43
- width: 100% !important;
42
+ #x-gist-top.${elementId},
43
+ #x-gist-bottom.${elementId},
44
+ #x-gist-floating-top.${elementId},
45
+ #x-gist-floating-bottom.${elementId},
46
+ #x-gist-floating-top-left.${elementId},
47
+ #x-gist-floating-top-right.${elementId},
48
+ #x-gist-floating-bottom-left.${elementId},
49
+ #x-gist-floating-bottom-right.${elementId} {
50
+ width: 100% !important;
44
51
  }
45
52
  }
46
53
  </style>
47
54
  <div id="gist-embed-container">
48
- <iframe id="${instanceId}" class="gist-frame" src="${url}"></iframe>
55
+ <iframe id="${elementId}" class="gist-frame" src="${url}"></iframe>
49
56
  </div>
50
57
  </div>`;
51
58
  return template
@@ -1,4 +1,4 @@
1
- export function messageHTMLTemplate(instanceId, messageProperties, url) {
1
+ export function messageHTMLTemplate(elementId, messageProperties, url) {
2
2
  var maxWidthBreakpoint = 600;
3
3
  if (messageProperties.messageWidth > maxWidthBreakpoint) {
4
4
  maxWidthBreakpoint = messageProperties.messageWidth;
@@ -53,7 +53,7 @@ export function messageHTMLTemplate(instanceId, messageProperties, url) {
53
53
  }
54
54
  </style>
55
55
  <div id="gist-overlay" class="background">
56
- <iframe id="${instanceId}" class="gist-message" src="${url}"></iframe>
56
+ <iframe id="${elementId}" class="gist-message" src="${url}"></iframe>
57
57
  </div>
58
58
  </div>`;
59
59
  return template;