diff --git a/README.md b/README.md index 434277ec..6a7ad9db 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ The plugin provides a few hooks for you to control the default endpoint data and **`altis.analytics.consent_enabled `** -This defaults to if the WP Consent API plugin or a derivative is installed and active by checking if the constant `WP_CONSENT_API_URL` is defined. +This defaults to true if the WP Consent API plugin or a derivative is installed and active by checking if the constant `WP_CONSENT_API_URL` is defined. **`altis.analytics.data.endpoint `** @@ -162,6 +162,12 @@ Insights and aggregated analytics data can be calculated, updated and stored in Filter the maximum number of days to keep backup data for. The default number of days is 90, in accordance with AWS Pinpoint, after which time data is removed. This is important for streamlining your users' privacy. There is no upper limit on this value, however you should make sure any long term data storage is explained to users when opting in to tracking. +**`altis.analytics.exclude_bots `** + +This defaults to true but can switched off to allow tracking bots that can run JavaScript, note this will affect your data. + +You can check if a recorded event was created by a bot by checking if the `attributes.isBot` value exists. + ### Functions **`Altis\Analytics\Utils\query( array $query, array $params = [] ) : array`** @@ -346,16 +352,25 @@ use function Altis\Analytics\Audiences\register_field; add_action( 'init', function () { register_field( - 'endpoint.Location.City', // The Elasticsearch field to query. - __( 'City' ), // A label for the field. - __( 'The closest metropolitan area.' ) // Optional description for the field. + 'endpoint.Location.Country', // The Elasticsearch field to query. + __( 'Country' ), // A label for the field. + __( 'The visitor country.' ) // Optional description for the field. + [ // Optional field arguments + 'options' => '\\Altis\\Analytics\\Utils\\get_countries', // A callback to provide prepopulated list of options. + 'disable_free_text' => false, // Whether to allow free text to be used or to restrict to available options. + ] ); } ); ``` -In the above example the 1st parameter `endpoint.Location.City` represents the field in the event record to query against. Other examples include `attributes.qv_utm_campaign` or `endpoint.User.UserAttibrutes.custom` for example. +In the above example the 1st parameter `endpoint.Location.Country` represents the field in the event record to query against. Other examples include `attributes.qv_utm_campaign` or `endpoint.User.UserAttibrutes.custom` for example. + +The 2nd parameter is a human readable label for the audience field, and the 3rd is the human readable description that goes below the field UI. + +The 4th parameter is an optional arguments array, which can include: -The 2nd parameter is a human readable label for the audience field. +- `options` which is a callback that returns a list of valid options, that will complement existing data for that field. +- `disable_free_text` is a boolean to allow/restrict the user to set custom strings rather than choose from the list. ## Required Infrastructure diff --git a/build.json b/build.json index 4c862b8a..80ffdb5d 100644 --- a/build.json +++ b/build.json @@ -1 +1 @@ -{"owner":"humanmade","repo":"aws-analytics","sha":"b33947f5312d7f4077a064e1ed30e8d4caced0ae","ref":"refs/tags/4.0.12","tagName":"4.0.12","branch":"gh-actions","tags":["4.0.12"],"updated_at":"2022-05-09T11:11:25.717Z"} \ No newline at end of file +{"owner":"humanmade","repo":"aws-analytics","sha":"46b5abc7c20f434d90a13be0252f2ab2a13ba4ec","ref":"refs/tags/4.3.6","tagName":"4.3.6","branch":"gh-actions","tags":["4.3.6"],"updated_at":"2022-05-09T11:12:17.104Z"} \ No newline at end of file diff --git a/build/analytics.4dc415e8.js b/build/analytics.4dc415e8.js new file mode 100644 index 00000000..47309784 --- /dev/null +++ b/build/analytics.4dc415e8.js @@ -0,0 +1,24 @@ +!function(e,t){for(var r in t)e[r]=t[r]}(this,function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=106)}([,function(e,t,r){e.exports=r(25)},,,function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){"use strict";r.d(t,"i",(function(){return s})),r.d(t,"d",(function(){return c})),r.d(t,"f",(function(){return d})),r.d(t,"g",(function(){return h})),r.d(t,"h",(function(){return y})),r.d(t,"a",(function(){return v})),r.d(t,"e",(function(){return m})),r.d(t,"c",(function(){return b})),r.d(t,"b",(function(){return g}));var n=r(1),i=r.n(n),o=r(10),a=r.n(o),s=function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},u=function(e){return e.replace(/[^\0-~]/g,(function(e){return"\\u"+("000"+e.charCodeAt().toString(16)).slice(-4)}))},c=function(){return(navigator.language||navigator.browserLanguage||(navigator.languages||["en_US"])[0]).toLowerCase().replace("-","_")},d=function(e,t){return t},l=function(){var e=a()(i.a.mark((function e(t,r){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t){e.next=4;break}return e.next=3,t();case 3:t=e.sent;case 4:return e.abrupt("return",r(t));case 5:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),f=function(e){return Array.isArray(e)?e.map((function(e){return u(e.toString())})):u(e.toString())},p=function(e){return parseFloat(Number(Array.isArray(e)?e[0]:e))},h=function(){var e=a()(i.a.mark((function e(t){var r,n,o,a,s=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=s.length>1&&void 0!==s[1]&&s[1],n={},e.t0=i.a.keys(t);case 3:if((e.t1=e.t0()).done){e.next=17;break}if(o=e.t1.value,a=Array.isArray(t[o])?t[o]:[t[o]],!r){e.next=12;break}return e.next=9,l(a,f);case 9:n[o]=e.sent,e.next=15;break;case 12:return e.next=14,l(a[0],f);case 14:n[o]=e.sent;case 15:e.next=3;break;case 17:return e.abrupt("return",n);case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=a()(i.a.mark((function e(t){var r,n;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r={},e.t0=i.a.keys(t);case 2:if((e.t1=e.t0()).done){e.next=9;break}return n=e.t1.value,e.next=6,l(t[n],p);case 6:r[n]=e.sent,e.next=2;break;case 9:return e.abrupt("return",r);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),v=function(e){if(isNaN(e))return 0;if(!isFinite(e))return e>=0?"∞%":"-∞%";var t="",r=e;return e>=1e3&&(t="k",r=e/1e3),e>=1e6&&(t="M",r=e/1e6),r=r<10&&r>0?r.toFixed(1):Math.round(r),Number.isInteger(e)||(t="%"),"".concat(r).concat(t)},m=function(e,t){return(e-t)/e*100},b=function(e){return(new Intl.NumberFormat).format(e)},g=function(e){return new RegExp([/bot/,/spider/,/crawl/,/APIs-Google/,/AdsBot/,/Googlebot/,/mediapartners/,/Google Favicon/,/FeedFetcher/,/Google-Read-Aloud/,/DuplexWeb-Google/,/googleweblight/,/bing/,/yandex/,/baidu/,/duckduck/,/yahoo/,/ecosia/,/ia_archiver/,/facebook/,/instagram/,/pinterest/,/reddit/,/slack/,/twitter/,/whatsapp/,/youtube/,/semrush/].map((function(e){return e.source})).join("|"),"i").test(e)}},,function(e,t,r){"use strict";r.r(t),r.d(t,"__extends",(function(){return i})),r.d(t,"__assign",(function(){return o})),r.d(t,"__rest",(function(){return a})),r.d(t,"__decorate",(function(){return s})),r.d(t,"__param",(function(){return u})),r.d(t,"__metadata",(function(){return c})),r.d(t,"__awaiter",(function(){return d})),r.d(t,"__generator",(function(){return l})),r.d(t,"__exportStar",(function(){return f})),r.d(t,"__values",(function(){return p})),r.d(t,"__read",(function(){return h})),r.d(t,"__spread",(function(){return y})),r.d(t,"__spreadArrays",(function(){return v})),r.d(t,"__await",(function(){return m})),r.d(t,"__asyncGenerator",(function(){return b})),r.d(t,"__asyncDelegator",(function(){return g})),r.d(t,"__asyncValues",(function(){return _})),r.d(t,"__makeTemplateObject",(function(){return w})),r.d(t,"__importStar",(function(){return E})),r.d(t,"__importDefault",(function(){return A})); +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function i(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function u(e,t){return function(r,n){t(r,n,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function d(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}u((n=n.apply(e,t||[])).next())}))}function l(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function y(){for(var e=[],t=0;t1||s(e,t)}))})}function s(e,t){try{(r=i[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,c):d(o[0][2],r)}catch(e){d(o[0][3],e)}var r}function u(e){s("next",e)}function c(e){s("throw",e)}function d(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function g(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:"return"===n}:i?i(t):t}:i}}function _(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=p(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,i,(t=e[r](t)).done,t.value)}))}}}function w(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function A(e){return e&&e.__esModule?e:{default:e}}},,,function(e,t){function r(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,u,"next",e)}function u(e){r(a,i,o,s,u,"throw",e)}s(void 0)}))}}},,,,,,,,,,,,,,,function(e,t,r){var n=function(e){"use strict";var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r,n){var i=t&&t.prototype instanceof d?t:d,o=Object.create(i.prototype),a=new E(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return S()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=g(a,r);if(s){if(s===c)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var d=u(e,t,r);if("normal"===d.type){if(n=r.done?"completed":"suspendedYield",d.arg===c)continue;return{value:d.arg,done:r.done}}"throw"===d.type&&(n="completed",r.method="throw",r.arg=d.arg)}}}(e,r,a),o}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var c={};function d(){}function l(){}function f(){}var p={};p[i]=function(){return this};var h=Object.getPrototypeOf,y=h&&h(h(A([])));y&&y!==t&&r.call(y,i)&&(p=y);var v=f.prototype=d.prototype=Object.create(p);function m(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function b(e){var t;this._invoke=function(n,i){function o(){return new Promise((function(t,o){!function t(n,i,o,a){var s=u(e[n],e,i);if("throw"!==s.type){var c=s.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?Promise.resolve(d.__await).then((function(e){t("next",e,o,a)}),(function(e){t("throw",e,o,a)})):Promise.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return t("throw",e,o,a)}))}a(s.arg)}(n,i,t,o)}))}return t=t?t.then(o,o):o()}}function g(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,g(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,c;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function A(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},,,,,,,,,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm",t.CREDENTIAL_QUERY_PARAM="X-Amz-Credential",t.AMZ_DATE_QUERY_PARAM="X-Amz-Date",t.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders",t.EXPIRES_QUERY_PARAM="X-Amz-Expires",t.SIGNATURE_QUERY_PARAM="X-Amz-Signature",t.TOKEN_QUERY_PARAM="X-Amz-Security-Token",t.AUTH_HEADER="authorization",t.AMZ_DATE_HEADER=t.AMZ_DATE_QUERY_PARAM.toLowerCase(),t.DATE_HEADER="date",t.GENERATED_HEADERS=[t.AUTH_HEADER,t.AMZ_DATE_HEADER,t.DATE_HEADER],t.SIGNATURE_HEADER=t.SIGNATURE_QUERY_PARAM.toLowerCase(),t.SHA256_HEADER="x-amz-content-sha256",t.TOKEN_HEADER=t.TOKEN_QUERY_PARAM.toLowerCase(),t.HOST_HEADER="host",t.ALWAYS_UNSIGNABLE_HEADERS={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},t.PROXY_HEADER_PATTERN=/^proxy-/,t.SEC_HEADER_PATTERN=/^sec-/,t.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i],t.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256",t.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD",t.MAX_CACHE_SIZE=50,t.KEY_TYPE_IDENTIFIER="aws4_request",t.MAX_PRESIGNED_TTL=604800},,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.entries=[],this.sorted=!0}return e.prototype.add=function(e,t){void 0===t&&(t={});var r=t.step,n=void 0===r?"initialize":r,i=t.priority,o=void 0===i?0:i,a=t.tags;this.sorted=!1,this.entries.push({middleware:e,priority:o,step:n,tags:a})},e.prototype.clone=function(){var t,r=new e;return(t=r.entries).push.apply(t,this.entries),r.sorted=this.sorted,r},e.prototype.concat=function(t){var r,n=new e;return(r=n.entries).push.apply(r,this.entries.concat(t.entries)),n.sorted=!1,n},e.prototype.remove=function(e){var t=this.entries.length;return"string"==typeof e?this.removeByTag(e):this.removeByIdentity(e),this.entries.length=0;t--)this.entries[t].middleware===e&&this.entries.splice(t,1)},e.prototype.removeByTag=function(e){for(var t=this.entries.length-1;t>=0;t--){var r=this.entries[t].tags;r&&e in r&&this.entries.splice(t,1)}},e.prototype.sort=function(){this.entries.sort((function(e,t){return i[e.step]-i[t.step]||e.priority-t.priority})),this.sorted=!0},e}();t.MiddlewareStack=n;var i={initialize:4,serialize:3,build:2,finalize:1}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(111),i=r(112);t.fromUtf8=function(e){return"function"==typeof TextEncoder?i.fromUtf8(e):n.fromUtf8(e)},t.toUtf8=function(e){return"function"==typeof TextDecoder?i.toUtf8(e):n.toUtf8(e)}},function(e,t,r){"use strict";var n=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===i}(e)}(e)};var i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?d((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function a(e,t,r){return e.concat(t).map((function(e){return o(e,r)}))}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function u(e,t){try{return t in e}catch(e){return!1}}function c(e,t,r){var n={};return r.isMergeableObject(e)&&s(e).forEach((function(t){n[t]=o(e[t],r)})),s(t).forEach((function(i){(function(e,t){return u(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(u(e,i)&&r.isMergeableObject(t[i])?n[i]=function(e,t){if(!t.customMerge)return d;var r=t.customMerge(e);return"function"==typeof r?r:d}(i,r)(e[i],t[i],r):n[i]=o(t[i],r))})),n}function d(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||a,r.isMergeableObject=r.isMergeableObject||n,r.cloneUnlessOtherwiseSpecified=o;var i=Array.isArray(t);return i===Array.isArray(e)?i?r.arrayMerge(e,t,r):c(e,t,r):o(t,r)}d.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return d(e,r,t)}),{})};var l=d;e.exports=l},,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayBuffer=function(e){return"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_RETRY_DELAY_BASE=100,t.MAXIMUM_RETRY_DELAY=2e4,t.RETRYABLE_STATUS_CODES=new Set,[429,500,502,503,504,509].forEach((function(e){return t.RETRYABLE_STATUS_CODES.add(e)})),t.THROTTLING_RETRY_DELAY_BASE=500},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r={};t.locateWindow=function(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:r}},function(e,t,r){"use strict";function n(e){return"number"==typeof e?new Date(1e3*e):"string"==typeof e?new Date(e):e}Object.defineProperty(t,"__esModule",{value:!0}),t.iso8601=function(e){return n(e).toISOString().replace(/\.\d{3}Z$/,"Z")},t.rfc822=function(e){return n(e).toUTCString()},t.epoch=function(e){return Math.floor(n(e).valueOf()/1e3)},t.toDate=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceMetadata={apiVersion:"2014-06-30",endpointPrefix:"cognito-identity",jsonVersion:"1.1",protocol:"json",serviceFullName:"Amazon Cognito Identity",signatureVersion:"v4",targetPrefix:"AWSCognitoIdentityService",uid:"cognito-identity-2014-06-30"},t.clientVersion="0.1.0-preview.2"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.parseQueryString=function(e){var t,r,i={};if(e=e.replace(/^\?/,""))try{for(var o=n.__values(e.split("&")),a=o.next();!a.done;a=o.next()){var s=a.value,u=n.__read(s.split("="),2),c=u[0],d=u[1],l=void 0===d?null:d;c=decodeURIComponent(c),l&&(l=decodeURIComponent(l)),c in i?Array.isArray(i[c])?i[c].push(l):i[c]=[i[c],l]:i[c]=l}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return i}},,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.resolveConfiguration=function(e,t,r){var i,o,a={},s=[];try{for(var u=n.__values(Object.getOwnPropertyNames(t)),c=u.next();!c.done;c=u.next()){var d=c.value,l=t[d],f=l.required,p=l.defaultValue,h=l.defaultProvider,y=l.normalize,v=l.apply,m=e[d];if(void 0===m){if(void 0!==p)m=p;else if(h)m=h(a);else if(f)throw new Error("No input provided for required configuration parameter: "+d)}else y&&(m=y(m,a));a[d]=m,v&&s.push(v)}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}return s.forEach((function(e){return e(a,r)})),a}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.contentLengthMiddleware=function(e){var t=this;return function(r){return function(i){return n.__awaiter(t,void 0,void 0,(function(){var t,o,a,s;return n.__generator(this,(function(u){return t=n.__assign({},i.request),o=t.body,a=t.headers,o&&-1===Object.keys(a).map((function(e){return e.toLowerCase()})).indexOf("content-length")&&void 0!==(s=e(o))&&(t.headers=n.__assign({},t.headers,{"Content-Length":String(s)})),[2,r(n.__assign({},i,{request:t}))]}))}))}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.headerDefault=function(e){return function(t){return function(r){var i,o,a=n.__assign({},r.request.headers);try{for(var s=n.__values(Object.keys(e)),u=s.next();!u.done;u=s.next()){var c=u.value;c in a||(a[c]=e[c])}}catch(e){i={error:e}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return t(n.__assign({},r,{request:n.__assign({},r.request,{headers:a})}))}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.serializerMiddleware=function(e){var t=this;return function(r,i){var o=i.model;return function(i){return n.__awaiter(t,void 0,void 0,(function(){var t,a;return n.__generator(this,(function(s){switch(s.label){case 0:return[4,e()];case 1:return t=s.sent(),(a=t.serialize(o,i.input)).body&&["GET","HEAD"].indexOf(a.method)>=0&&delete a.body,[2,r(n.__assign({},i,{request:a}))]}}))}))}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);n.__exportStar(r(59),t),n.__exportStar(r(60),t),n.__exportStar(r(108),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(46);t.defaultDelayDecider=function(e,t){return Math.floor(Math.min(n.MAXIMUM_RETRY_DELAY,Math.random()*Math.pow(2,t)*e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(46),i=r(61);t.defaultRetryDecider=function(e){return void 0===e&&(e=!1),function(t){return!!t&&(!!t.connectionError||(!!(function(e){return e&&e.$metadata}(t)&&t.$metadata.httpStatusCode&&n.RETRYABLE_STATUS_CODES.has(t.$metadata.httpStatusCode))||(i.isStillProcessingError(t)||i.isThrottlingError(t)||e&&i.isClockSkewError(t))))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(107);t.isClockSkewError=function(e){return e.name in n.CLOCK_SKEW_ERROR_CODES},t.isStillProcessingError=function(e){return e.name in n.STILL_PROCESSING_ERROR_CODES},t.isThrottlingError=function(e){return e.name in n.THROTTLING_ERROR_CODES}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.signingMiddleware=function(e){var t=this;return function(r){return function(i){return n.__awaiter(t,void 0,void 0,(function(){var t,o,a;return n.__generator(this,(function(s){switch(s.label){case 0:return t=r,o=[{},i],a={},[4,e.sign(i.request)];case 1:return[2,t.apply(void 0,[n.__assign.apply(void 0,o.concat([(a.request=s.sent(),a)]))])]}}))}))}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultUserAgent=function(e,t){return"aws-sdk-js-v3-"+e+"/"+t+" "+("undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:"")},t.appendToUserAgent=function(e,t){e.headers["X-Amz-User-Agent"]+=" "+t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(7).__exportStar(r(110),t);var n=r(65);t.Ie11Sha256=n.Sha256;var i=r(68);t.WebCryptoSha256=i.Sha256},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(66),i=r(67),o=r(40),a=r(47),s=function(){function e(e){e?(this.operation=function(e){return new Promise((function(t,r){var n=a.locateWindow().msCrypto.subtle.importKey("raw",u(e),i.SHA_256_HMAC_ALGO,!1,["sign"]);n.oncomplete=function(){n.result&&t(n.result),r("ImportKey completed without importing key.")},n.onerror=function(){r("ImportKey failed to import key.")}}))}(e).then((function(e){return a.locateWindow().msCrypto.subtle.sign(i.SHA_256_HMAC_ALGO,e)})),this.operation.catch((function(){}))):this.operation=Promise.resolve(a.locateWindow().msCrypto.subtle.digest("SHA-256"))}return e.prototype.update=function(e){var t=this;n.isEmptyData(e)||(this.operation=this.operation.then((function(r){return r.onerror=function(){t.operation=Promise.reject(new Error("Error encountered updating hash"))},r.process(u(e)),r})),this.operation.catch((function(){})))},e.prototype.digest=function(){return this.operation.then((function(e){return new Promise((function(t,r){e.onerror=function(){r("Error encountered finalizing hash")},e.oncomplete=function(){e.result&&t(new Uint8Array(e.result)),r("Error encountered finalizing hash")},e.finish()}))}))},e}();function u(e){return"string"==typeof e?o.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA_256_HASH={name:"SHA-256"},t.SHA_256_HMAC_ALGO={name:"HMAC",hash:t.SHA_256_HASH},t.EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(40),i=r(66),o=r(67),a=r(47),s=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise((function(t,r){a.locateWindow().crypto.subtle.importKey("raw",u(e),o.SHA_256_HMAC_ALGO,!1,["sign"]).then(t,r)})),this.key.catch((function(){})))}return e.prototype.update=function(e){if(!i.isEmptyData(e)){var t=u(e),r=new Uint8Array(this.toHash.byteLength+t.byteLength);r.set(this.toHash,0),r.set(t,this.toHash.byteLength),this.toHash=r}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return a.locateWindow().crypto.subtle.sign(o.SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):i.isEmptyData(this.toHash)?Promise.resolve(o.EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return a.locateWindow().crypto.subtle.digest(o.SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e}();function u(e){return"string"==typeof e?n.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.coreHandler=function(e,t){return function(r){var n=r.model;return function(r){var i=r.request,o=r.input.$abortSignal;return e.handle(i,{abortSignal:o}).then((function(e){return t.parse(n,e)}))}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(7).__exportStar(r(120),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);n.__exportStar(r(73),t),n.__exportStar(r(123),t)},function(e,t,r){"use strict";function n(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}Object.defineProperty(t,"__esModule",{value:!0}),t.escapeUri=function(e){var t=encodeURIComponent(e);return t=t.replace(/[!'()*]/g,n)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(45),o=r(48),a=r(75),s=function(){function e(e,t){this.base64Encoder=e,this.utf8Decoder=t}return e.prototype.build=function(e){var t=e.operation,r=e.member,n=void 0===r?t.input:r,i=e.input,o=n.shape;return JSON.stringify(this.format(o,i))},e.prototype.format=function(e,t){var r,s,u,c,d,l,f,p,h=typeof t;if("structure"===e.type){if("object"!==h||null===t)throw new Error("Unable to serialize value of type "+typeof t+" as a structure");var y={};try{for(var v=n.__values(Object.keys(t)),m=v.next();!m.done;m=v.next()){if(void 0!==t[R=m.value]&&null!==t[R]&&R in e.members){var b=e.members[R],g=b.location,_=b.locationName,w=void 0===_?R:_,E=b.shape;g||(y[w]=this.format(E,t[R]))}}}catch(e){r={error:e}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(r)throw r.error}}return y}if("list"===e.type){if(Array.isArray(t)||a.isIterable(t)){y=[];try{for(var A=n.__values(t),S=A.next();!S.done;S=A.next()){var x=S.value;y.push(this.format(e.member.shape,x))}}catch(e){u={error:e}}finally{try{S&&!S.done&&(c=A.return)&&c.call(A)}finally{if(u)throw u.error}}return y}throw new Error("Unable to serialize value that is neither an array nor an iterable as a list")}if("map"===e.type){y={};if(a.isIterable(t)){try{for(var O=n.__values(t),P=O.next();!P.done;P=O.next()){var M=n.__read(P.value,2),R=M[0],j=M[1];y[R]=this.format(e.value.shape,j)}}catch(e){d={error:e}}finally{try{P&&!P.done&&(l=O.return)&&l.call(O)}finally{if(d)throw d.error}}return y}if("object"!==h||null===t)throw new Error("Unable to serialize value that is neither a [key, value] iterable nor an object as a map");try{for(var I=n.__values(Object.keys(t)),T=I.next();!T.done;T=I.next()){y[R=T.value]=this.format(e.value.shape,t[R])}}catch(e){f={error:e}}finally{try{T&&!T.done&&(p=I.return)&&p.call(I)}finally{if(f)throw f.error}}return y}if("blob"===e.type){if("string"==typeof t)t=this.utf8Decoder(t);else if(ArrayBuffer.isView(t))t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);else{if(!i.isArrayBuffer(t))throw new Error("Unable to serialize value that is neither a string nor an ArrayBuffer nor an ArrayBufferView as a blob");t=new Uint8Array(t)}return this.base64Encoder(t)}if("timestamp"===e.type){if(["number","string"].indexOf(typeof t)>-1||"[object Date]"===Object.prototype.toString.call(t))return o.epoch(t);throw new Error("Unable to serialize value that is neither a string nor a number nor a Date object as a timestamp")}return t},e}();t.JsonBuilder=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isIterable=function(e){return Boolean(e)&&"undefined"!=typeof Symbol&&"function"==typeof e[Symbol.iterator]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(77),o=r(124);function a(e,t){var r,i;if(e){var o=JSON.parse(e);try{for(var a=n.__values(t),s=a.next();!s.done;s=a.next()){var u=s.value;if(o[u])return o[u].split("#").pop()}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}}t.jsonErrorUnmarshaller=function(e,t,r){var s,u,c,d,l=t.body,f=e.errors,p=e.name,h=(c=t.headers,("string"==typeof(d=c["x-amzn-errortype"])?d.split(":")[0]:void 0)||a(l,["__type","code"])||void 0);if(!h)return o.initServiceException(new Error,{$metadata:i.extractMetadata(t),operationName:p});var y=function(e,t){return a(e,t)}(l,["message","Message","errorMessage"])||"";try{for(var v=n.__values(f),m=v.next();!m.done;m=v.next()){var b=m.value,g=b.shape;if(g.exceptionCode===h||!g.exceptionCode&&g.exceptionType===h){var _=g.members?r.parse(b,l):{};return o.initServiceException(new Error,{$metadata:i.extractMetadata(t),message:y,name:h,rawException:_,operationName:p})}}}catch(e){s={error:e}}finally{try{m&&!m.done&&(u=v.return)&&u.call(v)}finally{if(s)throw s.error}}var w={$metadata:i.extractMetadata(t),name:h,message:y};return o.initServiceException(new Error,w)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.extractMetadata=function(e){var t=Object.keys(e.headers).reduce((function(t,r){return t[r.toLowerCase()]=e.headers[r],t}),{});return{httpHeaders:t,httpStatusCode:e.statusCode,requestId:t["x-amz-request-id"]||t["x-amzn-requestid"],extendedRequestId:t["x-amz-id-2"],cfId:t["x-amz-cf-id"]}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(48),i=function(){function e(e){this.base64Decoder=e}return e.prototype.parse=function(e,t){return this.unmarshall(e.shape,JSON.parse(t))},e.prototype.unmarshall=function(e,t){var r=this;if("structure"===e.type){if("object"!=typeof t||null===t)return;return Object.keys(e.members).reduce((function(n,i){var o=e.members[i],a=o.locationName,s=void 0===a?i:a,u=o.shape,c=t[s];return void 0!==c&&(n[i]=r.unmarshall(u,c)),n}),{})}if("list"===e.type){if(!Array.isArray(t))return;var i=e.member.shape;return t.map((function(e){return r.unmarshall(i,e)}))}if("map"===e.type){if("object"!=typeof t||null===t)return;var o=e.value.shape;return Object.keys(t).reduce((function(e,n){return e[n]=r.unmarshall(o,t[n]),e}),{})}if("timestamp"===e.type){if("number"!=typeof t)return;return n.toDate(t)}if("blob"===e.type){if("string"!=typeof t)return;return this.base64Decoder(t)}return t},e}();t.JsonParser=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);n.__exportStar(r(80),t),n.__exportStar(r(128),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(36),i={},o=[];t.createScope=function(e,t,r){return e+"/"+t+"/"+r+"/"+n.KEY_TYPE_IDENTIFIER},t.getSigningKey=function(e,t,r,a,s){var u=r+":"+a+":"+s+":"+t.accessKeyId+":"+t.sessionToken;if(u in i)return i[u];for(o.push(u);o.length>n.MAX_CACHE_SIZE;)delete i[o.shift()];return i[u]=new Promise((function(o,c){for(var d=Promise.resolve("AWS4"+t.secretAccessKey),l=function(t){(d=d.then((function(r){return n=t,(i=new e(r)).update(n),i.digest();var n,i}))).catch((function(){}))},f=0,p=[r,a,s,n.KEY_TYPE_IDENTIFIER];f>=6;var d=o/4*3;a>>=s%8;for(var l=Math.floor(s/8),f=0;f>p)}}return new Uint8Array(r)},t.toBase64=function(e){for(var t="",r=0;r>d]}t+="==".slice(0,4-u)}return t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calculateBodyLength=function(e){return"string"==typeof e?e.length:"number"==typeof e.byteLength?e.byteLength:"number"==typeof e.size?e.size:void 0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._LoginsMap={type:"map",key:{shape:{type:"string",min:1}},value:{shape:{type:"string",min:1}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidParameterException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"InvalidParameterException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceNotFoundException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"ResourceNotFoundException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotAuthorizedException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"NotAuthorizedException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceConflictException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"ResourceConflictException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TooManyRequestsException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"TooManyRequestsException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InternalErrorException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"InternalErrorException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExternalServiceException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"ExternalServiceException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(150);t._MapOfListOf__string={type:"map",key:{shape:{type:"string"}},value:{shape:n._ListOf__string}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._MapOf__double={type:"map",key:{shape:{type:"string"}},value:{shape:{type:"float"}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceMetadata={apiVersion:"2016-12-01",endpointPrefix:"pinpoint",jsonVersion:"1.1",protocol:"rest-json",serviceFullName:"Amazon Pinpoint",serviceId:"Pinpoint",signatureVersion:"v4",signingName:"mobiletargeting",uid:"pinpoint-2016-12-01"},t.clientVersion="0.1.0-preview.1"},function(e,t,r){"use strict";function n(e){return a(e).toISOString().replace(/\.\d{3}Z$/,"Z")}function i(e){return a(e).toUTCString()}function o(e){return Math.floor(a(e).valueOf()/1e3)}function a(e){return"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e}Object.defineProperty(t,"__esModule",{value:!0}),t.iso8601=n,t.rfc822=i,t.epoch=o,t.toDate=a,t.formatTimestamp=function(e,t){switch(t){case"iso8601":return n(e);case"rfc822":return i(e);case"unixTimestamp":return o(e);default:throw new Error("Invalid TimestampFormat: "+t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(54),i=r(55),o=r(56),a=r(57),s=r(39),u=r(58),c=r(62),d=r(63),l=r(109),f=r(49),p=function(){function e(e){this.middlewareStack=new s.MiddlewareStack,this.config=n.resolveConfiguration(e,l.configurationProperties,this.middlewareStack),this.middlewareStack.add(a.serializerMiddleware(this.config.serializer),{step:"serialize",priority:90,tags:{SERIALIZER:!0}}),this.middlewareStack.add(i.contentLengthMiddleware(this.config.bodyLengthChecker),{step:"build",priority:-80,tags:{SET_CONTENT_LENGTH:!0}}),this.config.maxRetries>0&&this.middlewareStack.add(u.retryMiddleware(this.config.maxRetries,this.config.retryDecider,this.config.delayDecider),{step:"finalize",priority:1/0,tags:{RETRY:!0}}),this.middlewareStack.add(c.signingMiddleware(this.config.signer),{step:"finalize",priority:0,tags:{SIGNATURE:!0}}),this.middlewareStack.add(o.headerDefault({"X-Amz-User-Agent":d.defaultUserAgent(f.ServiceMetadata.serviceId||f.ServiceMetadata.endpointPrefix,f.clientVersion)}),{step:"build",priority:0,tags:{SET_USER_AGENT:!0}})}return e.prototype.destroy=function(){this.config._user_injected_http_handler||this.config.httpHandler.destroy()},e.prototype.send=function(e,t){var r=e.resolveMiddleware(this.middlewareStack,this.config);if(!t)return r(e);r(e).then((function(e){return t(null,e)}),(function(e){return t(e)})).catch((function(){}))},e}();t.CognitoIdentityClient=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(39),i=r(135),o=function(){function e(e){this.input=e,this.middlewareStack=new n.MiddlewareStack}return e.prototype.resolveMiddleware=function(e,t){var r=t.handler,n=e.concat(this.middlewareStack),o={logger:{},model:i.GetCredentialsForIdentity};return n.resolve(r(o),o)},e}();t.GetCredentialsForIdentityCommand=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(39),i=r(140),o=function(){function e(e){this.input=e,this.middlewareStack=new n.MiddlewareStack}return e.prototype.resolveMiddleware=function(e,t){var r=t.handler,n=e.concat(this.middlewareStack),o={logger:{},model:i.GetId};return n.resolve(r(o),o)},e}();t.GetIdCommand=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(39),i=r(144),o=function(){function e(e){this.input=e,this.middlewareStack=new n.MiddlewareStack}return e.prototype.resolveMiddleware=function(e,t){var r=t.handler,n=e.concat(this.middlewareStack),o={logger:{},model:i.PutEvents};return n.resolve(r(o),o)},e}();t.PutEventsCommand=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(54),i=r(55),o=r(56),a=r(57),s=r(39),u=r(58),c=r(62),d=r(63),l=r(171),f=r(97),p=function(){function e(e){this.middlewareStack=new s.MiddlewareStack,this.config=n.resolveConfiguration(e,l.configurationProperties,this.middlewareStack),this.middlewareStack.add(a.serializerMiddleware(this.config.serializer),{step:"serialize",priority:90,tags:{SERIALIZER:!0}}),this.middlewareStack.add(i.contentLengthMiddleware(this.config.bodyLengthChecker),{step:"build",priority:-80,tags:{SET_CONTENT_LENGTH:!0}}),this.config.maxRetries>0&&this.middlewareStack.add(u.retryMiddleware(this.config.maxRetries,this.config.retryDecider,this.config.delayDecider),{step:"finalize",priority:1/0,tags:{RETRY:!0}}),this.middlewareStack.add(c.signingMiddleware(this.config.signer),{step:"finalize",priority:0,tags:{SIGNATURE:!0}}),this.middlewareStack.add(o.headerDefault({"X-Amz-User-Agent":d.defaultUserAgent(f.ServiceMetadata.serviceId||f.ServiceMetadata.endpointPrefix,f.clientVersion)}),{step:"build",priority:0,tags:{SET_USER_AGENT:!0}})}return e.prototype.destroy=function(){this.config._user_injected_http_handler||this.config.httpHandler.destroy()},e.prototype.send=function(e,t){var r=e.resolveMiddleware(this.middlewareStack,this.config);if(!t)return r(e);r(e).then((function(e){return t(null,e)}),(function(e){return t(e)})).catch((function(){}))},e}();t.PinpointClient=p},function(e,t,r){var n; +/*! + * UAParser.js v0.7.21 + * Lightweight JavaScript-based User-Agent string parser + * https://github.com/faisalman/ua-parser-js + * + * Copyright © 2012-2019 Faisal Salman + * Licensed under MIT License + */!function(i,o){"use strict";var a="model",s="name",u="type",c="vendor",d="version",l="mobile",f="tablet",p="smarttv",h={extend:function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"==typeof e?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},y={rgx:function(e,t){for(var r,n,i,o,a,s,u=0;u0?2==o.length?"function"==typeof o[1]?this[o[0]]=o[1].call(this,s):this[o[0]]=o[1]:3==o.length?"function"!=typeof o[1]||o[1].exec&&o[1].test?this[o[0]]=s?s.replace(o[1],o[2]):void 0:this[o[0]]=s?o[1].call(this,s,o[2]):void 0:4==o.length&&(this[o[0]]=s?o[3].call(this,s.replace(o[1],o[2])):void 0):this[o]=s||void 0;u+=2}},str:function(e,t){for(var r in t)if("object"==typeof t[r]&&t[r].length>0){for(var n=0;nU?e:U,H=e}));var q=Object(h.parseQueryString)(window.location.search),B={};for(var z in q)B["qv_".concat(z)]=q[z]||"";var G,V,F,Y,K,Q,Z,W=function(){if(void 0===window.sessionStorage)return null;var e=window.sessionStorage.getItem("_hm_uuid");if(e)return e;var t=Object(g.i)();return window.sessionStorage.setItem("_hm_uuid",t),t},X=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return w({date:(new Date).toISOString(),session:W(),pageSession:C,url:window.location.origin+window.location.pathname,host:window.location.hostname,queryString:window.location.search,hash:window.location.hash,referer:document.referrer},B,{},x.Attributes||{},{},e,{},I||{})},$=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return w({elapsed:N+(Date.now()-L),scrollDepthMax:U,scrollDepthNow:H,hour:(new Date).getHours(),day:(new Date).getDay()+1,month:(new Date).getMonth()+1,year:(new Date).getFullYear()},e,{},T||{})},J={keys:{UserId:"aws.cognito.identity-id.".concat(A.CognitoId),UserCredentials:"aws.cognito.identity-credentials.".concat(A.CognitoId)},getUserId:function(){return localStorage.getItem(J.keys.UserId)},getUserCredentials:function(){try{var e=JSON.parse(localStorage.getItem(J.keys.UserCredentials));return new Date(e.Credentials.Expiration).getTime()>Date.now()&&e}catch(e){return!1}},setUserId:function(e){return localStorage.setItem(J.keys.UserId,e)},setUserCredentials:function(e){return localStorage.setItem(J.keys.UserCredentials,JSON.stringify(e))},authenticate:(Z=a()(i.a.mark((function e(){var t,r,n,o,a,s,u,f;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=J.getUserId(),!(r=J.getUserCredentials())||!r.Credentials){e.next=4;break}return e.abrupt("return",r.Credentials);case 4:if(n={region:A.CognitoRegion,credentials:{}},A.CognitoEndpoint&&(n.endpoint=A.CognitoEndpoint),o=new c.CognitoIdentityClient(n),t){e.next=20;break}return e.prev=8,a=new l.GetIdCommand({IdentityPoolId:A.CognitoId}),e.next=12,o.send(a);case 12:s=e.sent,t=s.IdentityId,J.setUserId(t),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(8),console.error(e.t0);case 20:return e.prev=20,u=new d.GetCredentialsForIdentityCommand({IdentityId:t}),e.next=24,o.send(u);case 24:return f=e.sent,r=f,J.setUserCredentials(r),e.abrupt("return",r.Credentials);case 30:e.prev=30,e.t1=e.catch(20),console.error(e.t1);case 33:return e.abrupt("return",!1);case 34:case"end":return e.stop()}}),e,null,[[8,17],[20,30]])}))),function(){return Z.apply(this,arguments)}),getClient:(Q=a()(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!M||!A.ExcludeBots){e.next=2;break}return e.abrupt("return",null);case 2:if(!J.client){e.next=6;break}return e.next=5,J.client;case 5:return e.abrupt("return",e.sent);case 6:return J.client=a()(i.a.mark((function e(){var t,r,n;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,J.authenticate();case 2:if(t=e.sent){e.next=6;break}return console.error("Credentials not found."),e.abrupt("return");case 6:return r={region:A.PinpointRegion,credentials:{accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretKey,expiration:t.Expiration,sessionToken:t.SessionToken}},A.PinpointEndpoint&&(r.endpoint=A.PinpointEndpoint),n=new p.PinpointClient(r),J.client=n,e.abrupt("return",n);case 11:case"end":return e.stop()}}),e)})))(),e.next=9,J.client;case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e)}))),function(){return Q.apply(this,arguments)}),audiences:[],updateAudiences:(K=a()(i.a.mark((function e(){var t,r,n,o,a,s,u,c,d,l,f,p,h,y,v,m,b,_,w,E,A,S,x,O,M;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=J.audiences.slice().sort(),e.next=3,Object(g.g)(X());case 3:return r=e.sent,e.next=6,Object(g.h)($());case 6:n=e.sent,o=J.getEndpoint(),a={attributes:r,metrics:n,endpoint:o},s={},u=[],e.t0=i.a.keys(P);case 12:if((e.t1=e.t0()).done){e.next=71;break}c=e.t1.value,d=P[c],l=d.id,f=d.config,p="all"===f.include,e.t2=i.a.keys(f.groups);case 17:if((e.t3=e.t2()).done){e.next=68;break}h=e.t3.value,y=f.groups[h],v="all"===y.include,e.t4=i.a.keys(y.rules);case 22:if((e.t5=e.t4()).done){e.next=60;break}if(m=e.t5.value,b=y.rules[m],_=b.field,w=b.operator,E=b.value,""!==_){e.next=27;break}return e.abrupt("continue",22);case 27:A=!1,S=s[_]||_.split(".").reduce((function(e,t){var r;return null!==(r=e[t])&&void 0!==r?r:null}),a),Array.isArray(S)||(S=[S]),s[_]=S,e.t6=i.a.keys(S);case 32:if((e.t7=e.t6()).done){e.next=52;break}if(x=e.t7.value,O=S[x],"="===w&&(A=O===E),"!="===w&&(A=O!==E),null!==O){e.next=39;break}return e.abrupt("break",52);case 39:if("*="===w&&(A=O.indexOf(E)>-1),"!*"===w&&(A=-1===O.indexOf(E)),"^="===w&&(A=0===O.indexOf(E)),null!==E){e.next=44;break}return e.abrupt("break",52);case 44:if("gte"===w&&(A=Number(O)>=Number(E)),"lte"===w&&(A=Number(O)<=Number(E)),"gt"===w&&(A=Number(O)>Number(E)),"lt"===w&&(A=Number(O)0&&void 0!==r[0]?r[0]:{},e.next=3,J.flushEvents(t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)}))),function(){return Y.apply(this,arguments)}),getEndpoint:function(){try{return JSON.parse(localStorage.getItem("aws.pinpoint.endpoint"))||{}}catch(e){return{}}},setEndpoint:function(e){localStorage.setItem("aws.pinpoint.endpoint",JSON.stringify(e))},on:function(e,t){return window.addEventListener("altis.analytics.".concat(e),(function(e){return t(e.detail)}))},off:function(e){window.removeEventListener(e)},mergeEndpointData:(F=a()(i.a.mark((function e(){var t,r,n,o,a,s,u,c=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=c.length>0&&void 0!==c[0]?c[0]:{},r=J.getEndpoint(),n=b()(navigator.userAgent),o={Attributes:{},Demographic:{AppVersion:x.AppVersion||"",Locale:Object(g.d)()},Location:{},Metrics:{}},n.device&&n.device.vendor&&(o.Attributes.DeviceMake=[n.device.vendor]),n.device&&n.device.model&&(o.Attributes.DeviceModel=[n.device.model]),n.device&&n.device.type&&(o.Attributes.DeviceType=[n.device.type]),n.engine&&n.engine.name&&(o.Demographic.Make=n.engine.name),n.browser&&n.browser.name&&(o.Demographic.Model=n.browser.name),n.browser&&n.browser.version&&(o.Demographic.ModelVersion=n.browser.version),n.os&&n.os.name&&(o.Demographic.Platform=n.os.name),n.os&&n.os.version&&(o.Demographic.PlatformVersion=n.os.version),!(t=v.a.all([o,r,t],{arrayMerge:g.f})).User||!t.User.UserAttributes){e.next=17;break}return e.next=16,Object(g.g)(t.User.UserAttributes,!0);case 16:t.User.UserAttributes=e.sent;case 17:return e.next=19,Object(g.g)(t.Attributes,!0);case 19:return t.Attributes=e.sent,e.next=22,Object(g.h)(t.Metrics);case 22:t.Metrics=e.sent,t.Attributes.lastSession?(t.Attributes.lastSession[0]!==W()&&(t.Attributes.lastSession=[W()],t.Metrics.sessions+=1),t.Attributes.lastPageSession[0]!==C&&(t.Attributes.lastPageSession=[C],t.Metrics.pageViews+=1)):(t.Attributes.lastSession=[W()],t.Attributes.lastPageSession=[C],t.Metrics.sessions=1,t.Metrics.pageViews=1),document.referer&&-1===document.referrer.indexOf(window.location.hostname)&&(t.Attributes.initialReferer||(t.Attributes.initialReferer=[document.referer]),t.Attributes.referer?-1===t.Attributes.referer.indexOf(document.referer)&&t.Attributes.referer.push(document.referer):t.Attributes.referer=[document.referer]),e.t0=i.a.keys(q);case 26:if((e.t1=e.t0()).done){e.next=35;break}if(a=e.t1.value,(s=a.toLowerCase()).match(/^utm_/)){e.next=31;break}return e.abrupt("continue",26);case 31:t.Attributes["initial_".concat(s)]||(t.Attributes["initial_".concat(s)]=[q[s]]),t.Attributes[s]?-1===t.Attributes[s].indexOf(q[s])&&t.Attributes[s].push(q[s]):t.Attributes[s]=[q[s]],e.next=26;break;case 35:return j||delete t.User,J.setEndpoint(t),u=new CustomEvent("altis.analytics.updateEndpoint",{detail:t}),window.dispatchEvent(u),e.next=41,J.updateAudiences();case 41:return e.abrupt("return",t);case 42:case"end":return e.stop()}}),e)}))),function(){return F.apply(this,arguments)}),events:[],record:(V=a()(i.a.mark((function e(t){var r,n,o,a,s,c,d,l,f,p=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=p.length>1&&void 0!==p[1]?p[1]:{},n=p.length>2&&void 0!==p[2]?p[2]:{},o=!(p.length>3&&void 0!==p[3])||p[3],"boolean"==typeof r&&(o=r,r={}),"boolean"==typeof n&&(o=n,n={}),!Object.entries(n).length){e.next=8;break}return e.next=8,J.mergeEndpointData(n);case 8:return a=X(r.attributes||{}),s=$(r.metrics||{}),e.next=12,Object(g.g)(a);case 12:return e.t0=e.sent,e.next=15,Object(g.h)(s);case 15:if(e.t1=e.sent,c={attributes:e.t0,metrics:e.t1},M&&(c.attributes.isBot="true"),d=Object(g.i)(),l=u()({},d,{EventType:t,Timestamp:(new Date).toISOString(),AppPackageName:x.AppPackageName||"",AppTitle:x.SiteName||"",AppVersionCode:x.AppVersion||"",Attributes:c.attributes,Metrics:c.metrics,Session:{Id:k,StartTimestamp:new Date(D).toISOString()}}),"_session.stop"===t&&(l[d].Session.Duration=Date.now()-D,l[d].Session.StopTimestamp=(new Date).toISOString()),J.events.push(l),f=new CustomEvent("altis.analytics.record",{detail:l[d]}),window.dispatchEvent(f),o){e.next=27;break}return J.flushEvents(),e.abrupt("return");case 27:J.timer&&clearTimeout(J.timer),J.timer=setTimeout(J.flushEvents,5e3);case 29:case"end":return e.stop()}}),e)}))),function(e){return V.apply(this,arguments)}),flushEvents:(G=a()(i.a.mark((function e(){var t,r,n,o,a,s,c,d,l,p=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=p.length>0&&void 0!==p[0]?p[0]:{},J.timer&&clearTimeout(J.timer),Altis.Analytics.Ready){e.next=5;break}return J.timer=setTimeout(J.flushEvents,5e3),e.abrupt("return");case 5:return r=J.events,J.events=[],e.next=9,J.getClient();case 9:if(n=e.sent){e.next=13;break}return M||console.error("Could not create Analytics Client."),e.abrupt("return");case 13:if(o=J.getUserId()){e.next=17;break}return console.error("No User ID found. Make sure to call Analytics.authenticate() first."),e.abrupt("return");case 17:if(!Object.entries(t).length){e.next=20;break}return e.next=20,J.mergeEndpointData(t);case 20:if((a=J.getEndpoint()).RequestId=Object(g.i)(),s=r.reduce((function(e,t){return w({},t,{},e)}),{}),c=o.replace("".concat(A.CognitoRegion,":"),""),d={BatchItem:u()({},c,{Endpoint:a,Events:s})},e.prev=25,l=new f.PutEventsCommand({ApplicationId:A.PinpointId,EventsRequest:d}),O){e.next=30;break}return e.next=30,n.send(l);case 30:e.next=35;break;case 32:e.prev=32,e.t0=e.catch(25),console.error(e.t0);case 35:case"end":return e.stop()}}),e,null,[[25,32]])}))),function(){return G.apply(this,arguments)})};function ee(){if(!Altis.Analytics.Ready){J.mergeEndpointData(x.Endpoint||{}),Altis.Analytics.Ready=!0;var e=new CustomEvent("altis.analytics.ready");window.dispatchEvent(e),document.addEventListener("visibilitychange",(function(){document.hidden?(N+=Date.now()-L,J.record("_session.stop")):(L=Date.now(),k=Object(g.i)(),D=Date.now(),J.record("_session.start"))}));var t=function(){J.record("_session.start"),J.record("pageView",!1)};"interactive"===document.readyState||"complete"===document.readyState||"loaded"===document.readyState?t():window.addEventListener("DOMContentLoaded",t),window.addEventListener("beforeunload",(function(){J.record("_session.stop",!1)}))}}if(Altis.Analytics.updateEndpoint=J.updateEndpoint,Altis.Analytics.getEndpoint=J.getEndpoint,Altis.Analytics.getAudiences=J.getAudiences,Altis.Analytics.overrideAudiences=J.overrideAudiences,Altis.Analytics.on=J.on,Altis.Analytics.off=J.off,Altis.Analytics.record=J.record,Altis.Analytics.registerAttribute=function(e,t){I[e]=t,J.updateAudiences()},Altis.Analytics.registerMetric=function(e,t){T[e]=t,J.updateAudiences()},S.Enabled)if(R||j)ee();else var te=document.addEventListener("wp_listen_for_consent_change",(function(e){e.detail["statistics-anonymous"]&&"allow"===e.detail["statistics-anonymous"]&&(R=!0),e.detail.statistics&&"allow"===e.detail.statistics&&(j=!0),(R||j)&&(document.removeEventListener("wp_listen_for_consent_change",te),ee())}));else ee()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CLOCK_SKEW_ERROR_CODES={AuthFailure:!0,InvalidSignatureException:!0,RequestExpired:!0,RequestInTheFuture:!0,RequestTimeTooSkewed:!0,SignatureDoesNotMatch:!0},t.STILL_PROCESSING_ERROR_CODES={PriorRequestNotComplete:!0},t.THROTTLING_ERROR_CODES={BandwidthLimitExceeded:!0,ProvisionedThroughputExceededException:!0,RequestLimitExceeded:!0,RequestThrottled:!0,RequestThrottledException:!0,SlowDown:!0,ThrottledException:!0,Throttling:!0,ThrottlingException:!0,TooManyRequestsException:!0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(46),o=r(59),a=r(60),s=r(61);t.retryMiddleware=function(e,t,r){return void 0===t&&(t=a.defaultRetryDecider()),void 0===r&&(r=o.defaultDelayDecider),function(o){return function(a){return n.__awaiter(this,void 0,void 0,(function(){var u,c,d,l;return n.__generator(this,(function(f){switch(f.label){case 0:u=0,c=0,d=function(){var d,l,f;return n.__generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,5]),[4,o(a)];case 1:return(d=n.sent()).$metadata.retries=u,d.$metadata.totalRetryDelay=c,[2,{value:d}];case 2:return l=n.sent(),u>6|192,63&i|128);else if(r+1>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)},t.toUtf8=function(e){for(var t="",r=0,n=e.length;ri.BLOCK_SIZE){var r=new o.RawSha256;r.update(t),t=r.digest()}var n=new Uint8Array(i.BLOCK_SIZE);return n.set(t),n}(e),r=new Uint8Array(i.BLOCK_SIZE);r.set(t);for(var n=0;nn.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,this.bufferLength===n.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(t.setUint8(this.bufferLength++,128),r%n.BLOCK_SIZE>=n.BLOCK_SIZE-8){for(var i=this.bufferLength;i>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],c=t[6],d=t[7],l=0;l>>17|f<<15)^(f>>>19|f<<13)^f>>>10,h=((f=this.temp[l-15])>>>7|f<<25)^(f>>>18|f<<14)^f>>>3;this.temp[l]=(p+this.temp[l-7]|0)+(h+this.temp[l-16]|0)}var y=(((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&u^~s&c)|0)+(d+(n.KEY[l]+this.temp[l]|0)|0)|0,v=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&o^i&o)|0;d=c,c=u,u=s,s=a+y|0,a=o,o=i,i=r,r=y+v|0}t[0]+=r,t[1]+=i,t[2]+=o,t[3]+=a,t[4]+=s,t[5]+=u,t[6]+=c,t[7]+=d},e}();t.RawSha256=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(7).__exportStar(r(117),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function o(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function a(e){return e&&i.every((function(t){return"function"==typeof e[t]}))}t.supportsWebCrypto=function(e){return!(!o(e)||"object"!=typeof e.crypto.subtle)&&a(e.crypto.subtle)},t.supportsSecureRandom=o,t.supportsSubtleCrypto=a,t.supportsZeroByteGCM=function(e){return n.__awaiter(this,void 0,void 0,(function(){var t;return n.__generator(this,(function(r){switch(r.label){case 0:if(!a(e))return[2,!1];r.label=1;case 1:return r.trys.push([1,4,,5]),[4,e.generateKey({name:"AES-GCM",length:128},!1,["encrypt"])];case 2:return t=r.sent(),[4,e.encrypt({name:"AES-GCM",iv:new Uint8Array(Array(12)),additionalData:new Uint8Array(Array(16)),tagLength:128},t,new Uint8Array(0))];case 3:return[2,16===r.sent().byteLength];case 4:return r.sent(),[2,!1];case 5:return[2]}}))}))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(7).__exportStar(r(119),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];t.isMsWindow=function(e){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(e)&&void 0!==e.msCrypto.subtle){var t=e.msCrypto,r=t.getRandomValues,i=t.subtle;return n.map((function(e){return i[e]})).concat(r).every((function(e){return"function"==typeof e}))}return!1}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(121),o=r(122),a=function(){function e(e){void 0===e&&(e={}),this.httpOptions=e}return e.prototype.destroy=function(){},e.prototype.handle=function(e,t){var r=t&&t.abortSignal,a=this.httpOptions.requestTimeout;if(r&&r.aborted){var s=new Error("Request aborted");return s.name="AbortError",Promise.reject(s)}var u=e.path;if(e.query){var c=o.buildQueryString(e.query);c&&(u+="?"+c)}var d=e.port,l=e.protocol+"//"+e.hostname+(d?":"+d:"")+u,f={body:e.body,headers:new Headers(e.headers),method:e.method,mode:"cors"};"undefined"!=typeof AbortController&&(f.signal=r);var p=new Request(l,f),h=[fetch(p).then((function(e){var t,r,i=e.headers,o={};try{for(var a=n.__values(i.entries()),s=a.next();!s.done;s=a.next()){var u=s.value;o[u[0]]=u[1]}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return e.blob().then((function(t){return{headers:o,statusCode:e.status,body:t}}))})),i.requestTimeout(a)];return r&&h.push(new Promise((function(e,t){r.onabort=function(){var e=new Error("Request aborted");e.name="AbortError",t(e)}}))),Promise.race(h)},e}();t.FetchHttpHandler=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.requestTimeout=function(e){return void 0===e&&(e=0),new Promise((function(t,r){e&&setTimeout((function(){var t=new Error("Request did not complete within "+e+" ms");t.name="TimeoutError",r(t)}),e)}))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(72);t.buildQueryString=function(e){var t,r,o=[];try{for(var a=n.__values(Object.keys(e).sort()),s=a.next();!s.done;s=a.next()){var u=s.value,c=e[u];if(u=i.escapeUri(u),Array.isArray(c))for(var d=0,l=c.length;d299)throw this.parseServiceException(e,n.__assign({},t,{body:r}),this.bodyParser);return(o=this.bodyParser.parse(e.output,r)).$metadata=i.extractMetadata(t),[2,o]}}))}))},e.prototype.resolveBodyString=function(e){var t=this,r=e.body,n=void 0===r?"":r;return"string"==typeof n?Promise.resolve(n):(ArrayBuffer.isView(n)?Promise.resolve(new Uint8Array(n.buffer,n.byteLength,n.byteOffset)):o.isArrayBuffer(n)?Promise.resolve(new Uint8Array(n,0,n.byteLength)):this.bodyCollector(n)).then((function(e){return t.utf8Encoder(e)}))},e}();t.JsonRpcParser=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=function(){function e(e,t){this.endpoint=e,this.bodySerializer=t}return e.prototype.serialize=function(e,t){var r=e.http,i=e.metadata,o=i.jsonVersion,a=i.targetPrefix,s=e.name;return n.__assign({},this.endpoint,{headers:{"X-Amz-Target":a+"."+s,"Content-Type":"application/x-amz-json-"+o},body:this.bodySerializer.build({operation:e,input:t}),path:r.requestUri,method:r.method})},e}();t.JsonRpcSerializer=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(80),o=r(129),a=r(130),s=r(131),u=r(132),c=r(133),d=r(36),l=r(48),f=r(81),p=r(134),h=function(){function e(e){var t=e.applyChecksum,r=e.credentials,n=e.region,i=e.service,o=e.sha256,a=e.uriEscapePath,s=void 0===a||a;if(this.service=i,this.sha256=o,this.uriEscapePath=s,this.applyChecksum="boolean"!=typeof t||t,"string"==typeof n){var u=Promise.resolve(n);this.regionProvider=function(){return u}}else this.regionProvider=n;if("object"==typeof r){var c=Promise.resolve(r);this.credentialProvider=function(){return c}}else this.credentialProvider=r}return e.prototype.presignRequest=function(e,t,r){return void 0===r&&(r={}),n.__awaiter(this,void 0,void 0,(function(){var a,f,p,h,m,b,g,_,w,E,A,S,x,O,P,M,R,j,I;return n.__generator(this,(function(n){switch(n.label){case 0:return[4,Promise.all([this.regionProvider(),this.credentialProvider()])];case 1:return a=n.sent(),f=a[0],p=a[1],h=r.signingDate,m=void 0===h?new Date:h,b=r.unsignableHeaders,g=y(m),_=g.longDate,w=g.shortDate,(E=function(e,t){return Math.floor((l.toDate(t).valueOf()-l.toDate(e).valueOf())/1e3)}(m,t))>d.MAX_PRESIGNED_TTL?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(A=i.createScope(w,f,this.service),S=c.moveHeadersToQuery(u.prepareRequest(e)),p.sessionToken&&(S.query[d.TOKEN_QUERY_PARAM]=p.sessionToken),S.query[d.ALGORITHM_QUERY_PARAM]=d.ALGORITHM_IDENTIFIER,S.query[d.CREDENTIAL_QUERY_PARAM]=p.accessKeyId+"/"+A,S.query[d.AMZ_DATE_QUERY_PARAM]=_,S.query[d.EXPIRES_QUERY_PARAM]=E.toString(10),x=o.getCanonicalHeaders(S,b),S.query[d.SIGNED_HEADERS_QUERY_PARAM]=v(x),O=S.query,P=d.SIGNATURE_QUERY_PARAM,M=this.getSignature,R=[_,A,this.getSigningKey(p,f,w)],j=this.createCanonicalRequest,I=[S,x],[4,s.getPayloadHash(e,this.sha256)]);case 2:return[4,M.apply(this,R.concat([j.apply(this,I.concat([n.sent()]))]))];case 3:return O[P]=n.sent(),[2,S]}}))}))},e.prototype.sign=function(e,t){void 0===t&&(t={});var r=t.signingDate,i=void 0===r?new Date:r,o=n.__rest(t,["signingDate"]);return n.__awaiter(this,void 0,void 0,(function(){var t,r,a,s;return n.__generator(this,(function(n){switch(n.label){case 0:return[4,Promise.all([this.regionProvider(),this.credentialProvider()])];case 1:return t=n.sent(),r=t[0],a=t[1],"string"==typeof e?[2,this.signString(e,i,r,a)]:(s=o.unsignableHeaders,[2,this.signRequest(e,i,r,a,s)])}}))}))},e.prototype.signString=function(e,t,r,i){return n.__awaiter(this,void 0,void 0,(function(){var o,a,s,u,c;return n.__generator(this,(function(n){switch(n.label){case 0:return o=y(t).shortDate,u=(s=this.sha256).bind,[4,this.getSigningKey(i,r,o)];case 1:return(a=new(u.apply(s,[void 0,n.sent()]))).update(e),c=f.toHex,[4,a.digest()];case 2:return[2,c.apply(void 0,[n.sent()])]}}))}))},e.prototype.signRequest=function(e,t,r,a,c){return n.__awaiter(this,void 0,void 0,(function(){var l,f,h,m,b,g,_,w;return n.__generator(this,(function(n){switch(n.label){case 0:return l=u.prepareRequest(e),f=y(t),h=f.longDate,m=f.shortDate,b=i.createScope(m,r,this.service),l.headers[d.AMZ_DATE_HEADER]=h,a.sessionToken&&(l.headers[d.TOKEN_HEADER]=a.sessionToken),[4,s.getPayloadHash(l,this.sha256)];case 1:return g=n.sent(),!p.hasHeader(d.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[d.SHA256_HEADER]=g),_=o.getCanonicalHeaders(l,c),[4,this.getSignature(h,b,this.getSigningKey(a,r,m),this.createCanonicalRequest(l,_,g))];case 2:return w=n.sent(),l.headers[d.AUTH_HEADER]=d.ALGORITHM_IDENTIFIER+" Credential="+a.accessKeyId+"/"+b+", SignedHeaders="+v(_)+", Signature="+w,[2,l]}}))}))},e.prototype.createCanonicalRequest=function(e,t,r){var n=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+a.getCanonicalQuery(e)+"\n"+n.map((function(e){return e+":"+t[e]})).join("\n")+"\n\n"+n.join(";")+"\n"+r},e.prototype.createStringToSign=function(e,t,r){return n.__awaiter(this,void 0,void 0,(function(){var i,o;return n.__generator(this,(function(n){switch(n.label){case 0:return(i=new this.sha256).update(r),[4,i.digest()];case 1:return o=n.sent(),[2,d.ALGORITHM_IDENTIFIER+"\n"+e+"\n"+t+"\n"+f.toHex(o)]}}))}))},e.prototype.getCanonicalPath=function(e){var t=e.path;return this.uriEscapePath?"/"+encodeURIComponent(t.replace(/^\//,"")).replace(/%2F/g,"/"):t},e.prototype.getSignature=function(e,t,r,i){return n.__awaiter(this,void 0,void 0,(function(){var o,a,s,u,c;return n.__generator(this,(function(n){switch(n.label){case 0:return[4,this.createStringToSign(e,t,i)];case 1:return o=n.sent(),u=(s=this.sha256).bind,[4,r];case 2:return(a=new(u.apply(s,[void 0,n.sent()]))).update(o),c=f.toHex,[4,a.digest()];case 3:return[2,c.apply(void 0,[n.sent()])]}}))}))},e.prototype.getSigningKey=function(e,t,r){return i.getSigningKey(this.sha256,e,r,t,this.service)},e}();function y(e){var t=l.iso8601(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}}function v(e){return Object.keys(e).sort().join(";")}t.SignatureV4=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(36);t.getCanonicalHeaders=function(e,t){for(var r=e.headers,i={},o=0,a=Object.keys(r).sort();o-1&&delete e.headers[o]}return i.HOST_HEADER in e.headers||(e.headers[i.HOST_HEADER]=e.hostname),e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(82);t.moveHeadersToQuery=function(e){for(var t=i.cloneRequest(e),r=t.headers,o=t.query,a=void 0===o?{}:o,s=0,u=Object.keys(r);s0){var s=i.bodyParser.parse(t,r);try{for(var u=n.__values(Object.keys(s)),c=u.next();!c.done;c=u.next()){var d=c.value;e[d]=s[d]}}catch(e){o={error:e}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(o)throw o.error}}}return Promise.resolve(e)}))},e.prototype.parseHeaders=function(e,t,r){var i,o,a,s,u,c;if("structure"===r.shape.type){var d={};try{for(var l=n.__values(Object.keys(t)),f=l.next();!f.done;f=l.next()){d[(O=f.value).toLowerCase()]=t[O]}}catch(e){i={error:e}}finally{try{f&&!f.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}var p=r.shape.members;try{for(var h=n.__values(Object.keys(p)),y=h.next();!y.done;y=h.next()){var v=y.value,m=p[v],b=m.location,g=m.locationName,_=void 0===g?v:g,w=m.shape;Boolean(m.locationName);if("header"===b||"headers"===b){var E=d[_.toLowerCase()];if("map"===w.type){e[v]={};var A=new RegExp("^"+_+"(.+)","i");try{for(var S=n.__values(Object.keys(t)),x=S.next();!x.done;x=S.next()){var O,P=(O=x.value).match(A);P&&(e[v][P[1]]=t[O])}}catch(e){u={error:e}}finally{try{x&&!x.done&&(c=S.return)&&c.call(S)}finally{if(u)throw u.error}}}else void 0!==E&&(e[v]=this.parseScalarHeader(w,E))}}}catch(e){a={error:e}}finally{try{y&&!y.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}}},e.prototype.parseScalarBody=function(e,t){switch(e.type){case"timestamp":return o.toDate(t);case"string":return"string"==typeof t?t:this.utf8Encoder(t);case"boolean":return"boolean"==typeof t?t:"true"===t;case"integer":return parseInt(t,10);case"float":return parseFloat(t)}},e.prototype.parseScalarHeader=function(e,t){switch(e.type){case"timestamp":return o.toDate(t);case"string":return e.jsonValue?JSON.parse(this.utf8Encoder(this.base64Decoder(t))):t;case"boolean":return"true"===t;case"integer":return parseInt(t,10);case"float":return parseFloat(t);case"blob":return this.base64Decoder(t)}},e.prototype.parseStatusCode=function(e,t,r){var i,o;if(t){var a=r.shape.members;try{for(var s=n.__values(Object.keys(a)),u=s.next();!u.done;u=s.next()){var c=u.value,d=a[c];if("statusCode"===d.location)return void(e[d.locationName||c]=t)}}catch(e){i={error:e}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}},e.prototype.resolveBody=function(e){return void 0===e&&(e=""),"string"==typeof e?Promise.resolve(e):ArrayBuffer.isView(e)?Promise.resolve(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):i.isArrayBuffer(e)?Promise.resolve(new Uint8Array(e,0,e.byteLength)):this.bodyCollector(e)},e.prototype.resolveBodyString=function(e){var t=this;return void 0===e&&(e=""),this.resolveBody(e).then((function(e){return"string"==typeof e?e:t.utf8Encoder(e)}))},e.prototype.responseIsSuccessful=function(e){return e<300},e}();t.RestParser=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.extractMetadata=function(e){var t=Object.keys(e.headers).reduce((function(t,r){return t[r.toLowerCase()]=e.headers[r],t}),{});return{httpHeaders:t,httpStatusCode:e.statusCode,requestId:t["x-amz-request-id"]||t["x-amzn-requestid"],extendedRequestId:t["x-amz-id-2"],cfId:t["x-amz-cf-id"]}}},function(e,t){!function(){if("function"==typeof window.CustomEvent)return!1;window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r}}(),window.console=window.console||{log:function(){},warn:function(){},error:function(){}}}])); \ No newline at end of file diff --git a/build/analytics.b82af12b.js b/build/analytics.b82af12b.js deleted file mode 100644 index 78cc4657..00000000 --- a/build/analytics.b82af12b.js +++ /dev/null @@ -1,24 +0,0 @@ -!function(e,t){for(var r in t)e[r]=t[r]}(this,function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=105)}([,function(e,t,r){e.exports=r(25)},,,function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){"use strict";r.d(t,"h",(function(){return s})),r.d(t,"c",(function(){return c})),r.d(t,"e",(function(){return d})),r.d(t,"f",(function(){return h})),r.d(t,"g",(function(){return y})),r.d(t,"a",(function(){return v})),r.d(t,"d",(function(){return m})),r.d(t,"b",(function(){return b}));var n=r(1),i=r.n(n),o=r(10),a=r.n(o),s=function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},u=function(e){return e.replace(/[^\0-~]/g,(function(e){return"\\u"+("000"+e.charCodeAt().toString(16)).slice(-4)}))},c=function(){return(navigator.language||navigator.browserLanguage||(navigator.languages||["en_US"])[0]).toLowerCase().replace("-","_")},d=function(e,t){return t},l=function(){var e=a()(i.a.mark((function e(t,r){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t){e.next=4;break}return e.next=3,t();case 3:t=e.sent;case 4:return e.abrupt("return",r(t));case 5:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),f=function(e){return Array.isArray(e)?e.map((function(e){return u(e.toString())})):u(e.toString())},p=function(e){return parseFloat(Number(Array.isArray(e)?e[0]:e))},h=function(){var e=a()(i.a.mark((function e(t){var r,n,o,a,s=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=s.length>1&&void 0!==s[1]&&s[1],n={},e.t0=i.a.keys(t);case 3:if((e.t1=e.t0()).done){e.next=17;break}if(o=e.t1.value,a=Array.isArray(t[o])?t[o]:[t[o]],!r){e.next=12;break}return e.next=9,l(a,f);case 9:n[o]=e.sent,e.next=15;break;case 12:return e.next=14,l(a[0],f);case 14:n[o]=e.sent;case 15:e.next=3;break;case 17:return e.abrupt("return",n);case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=a()(i.a.mark((function e(t){var r,n;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r={},e.t0=i.a.keys(t);case 2:if((e.t1=e.t0()).done){e.next=9;break}return n=e.t1.value,e.next=6,l(t[n],p);case 6:r[n]=e.sent,e.next=2;break;case 9:return e.abrupt("return",r);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),v=function(e){if(isNaN(e))return 0;if(!isFinite(e))return e>=0?"∞%":"-∞%";var t="",r=e;return e>=1e3&&(t="k",r=e/1e3),e>=1e6&&(t="M",r=e/1e6),r=r<10&&r>0?r.toFixed(1):Math.round(r),Number.isInteger(e)||(t="%"),"".concat(r).concat(t)},m=function(e,t){return(e-t)/e*100},b=function(e){return(new Intl.NumberFormat).format(e)}},,function(e,t,r){"use strict";r.r(t),r.d(t,"__extends",(function(){return i})),r.d(t,"__assign",(function(){return o})),r.d(t,"__rest",(function(){return a})),r.d(t,"__decorate",(function(){return s})),r.d(t,"__param",(function(){return u})),r.d(t,"__metadata",(function(){return c})),r.d(t,"__awaiter",(function(){return d})),r.d(t,"__generator",(function(){return l})),r.d(t,"__exportStar",(function(){return f})),r.d(t,"__values",(function(){return p})),r.d(t,"__read",(function(){return h})),r.d(t,"__spread",(function(){return y})),r.d(t,"__spreadArrays",(function(){return v})),r.d(t,"__await",(function(){return m})),r.d(t,"__asyncGenerator",(function(){return b})),r.d(t,"__asyncDelegator",(function(){return g})),r.d(t,"__asyncValues",(function(){return _})),r.d(t,"__makeTemplateObject",(function(){return w})),r.d(t,"__importStar",(function(){return E})),r.d(t,"__importDefault",(function(){return A})); -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function i(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function u(e,t){return function(r,n){t(r,n,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function d(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}u((n=n.apply(e,t||[])).next())}))}function l(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function y(){for(var e=[],t=0;t1||s(e,t)}))})}function s(e,t){try{(r=i[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,c):d(o[0][2],r)}catch(e){d(o[0][3],e)}var r}function u(e){s("next",e)}function c(e){s("throw",e)}function d(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function g(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:"return"===n}:i?i(t):t}:i}}function _(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=p(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,i,(t=e[r](t)).done,t.value)}))}}}function w(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function A(e){return e&&e.__esModule?e:{default:e}}},,,function(e,t){function r(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,u,"next",e)}function u(e){r(a,i,o,s,u,"throw",e)}s(void 0)}))}}},,,,,,,,,,,,,,,function(e,t,r){var n=function(e){"use strict";var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r,n){var i=t&&t.prototype instanceof d?t:d,o=Object.create(i.prototype),a=new E(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return S()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=g(a,r);if(s){if(s===c)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var d=u(e,t,r);if("normal"===d.type){if(n=r.done?"completed":"suspendedYield",d.arg===c)continue;return{value:d.arg,done:r.done}}"throw"===d.type&&(n="completed",r.method="throw",r.arg=d.arg)}}}(e,r,a),o}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var c={};function d(){}function l(){}function f(){}var p={};p[i]=function(){return this};var h=Object.getPrototypeOf,y=h&&h(h(A([])));y&&y!==t&&r.call(y,i)&&(p=y);var v=f.prototype=d.prototype=Object.create(p);function m(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function b(e){var t;this._invoke=function(n,i){function o(){return new Promise((function(t,o){!function t(n,i,o,a){var s=u(e[n],e,i);if("throw"!==s.type){var c=s.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?Promise.resolve(d.__await).then((function(e){t("next",e,o,a)}),(function(e){t("throw",e,o,a)})):Promise.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return t("throw",e,o,a)}))}a(s.arg)}(n,i,t,o)}))}return t=t?t.then(o,o):o()}}function g(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,g(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,c;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function A(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},,,,,,,,,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm",t.CREDENTIAL_QUERY_PARAM="X-Amz-Credential",t.AMZ_DATE_QUERY_PARAM="X-Amz-Date",t.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders",t.EXPIRES_QUERY_PARAM="X-Amz-Expires",t.SIGNATURE_QUERY_PARAM="X-Amz-Signature",t.TOKEN_QUERY_PARAM="X-Amz-Security-Token",t.AUTH_HEADER="authorization",t.AMZ_DATE_HEADER=t.AMZ_DATE_QUERY_PARAM.toLowerCase(),t.DATE_HEADER="date",t.GENERATED_HEADERS=[t.AUTH_HEADER,t.AMZ_DATE_HEADER,t.DATE_HEADER],t.SIGNATURE_HEADER=t.SIGNATURE_QUERY_PARAM.toLowerCase(),t.SHA256_HEADER="x-amz-content-sha256",t.TOKEN_HEADER=t.TOKEN_QUERY_PARAM.toLowerCase(),t.HOST_HEADER="host",t.ALWAYS_UNSIGNABLE_HEADERS={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},t.PROXY_HEADER_PATTERN=/^proxy-/,t.SEC_HEADER_PATTERN=/^sec-/,t.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i],t.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256",t.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD",t.MAX_CACHE_SIZE=50,t.KEY_TYPE_IDENTIFIER="aws4_request",t.MAX_PRESIGNED_TTL=604800},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.entries=[],this.sorted=!0}return e.prototype.add=function(e,t){void 0===t&&(t={});var r=t.step,n=void 0===r?"initialize":r,i=t.priority,o=void 0===i?0:i,a=t.tags;this.sorted=!1,this.entries.push({middleware:e,priority:o,step:n,tags:a})},e.prototype.clone=function(){var t,r=new e;return(t=r.entries).push.apply(t,this.entries),r.sorted=this.sorted,r},e.prototype.concat=function(t){var r,n=new e;return(r=n.entries).push.apply(r,this.entries.concat(t.entries)),n.sorted=!1,n},e.prototype.remove=function(e){var t=this.entries.length;return"string"==typeof e?this.removeByTag(e):this.removeByIdentity(e),this.entries.length=0;t--)this.entries[t].middleware===e&&this.entries.splice(t,1)},e.prototype.removeByTag=function(e){for(var t=this.entries.length-1;t>=0;t--){var r=this.entries[t].tags;r&&e in r&&this.entries.splice(t,1)}},e.prototype.sort=function(){this.entries.sort((function(e,t){return i[e.step]-i[t.step]||e.priority-t.priority})),this.sorted=!0},e}();t.MiddlewareStack=n;var i={initialize:4,serialize:3,build:2,finalize:1}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(110),i=r(111);t.fromUtf8=function(e){return"function"==typeof TextEncoder?i.fromUtf8(e):n.fromUtf8(e)},t.toUtf8=function(e){return"function"==typeof TextDecoder?i.toUtf8(e):n.toUtf8(e)}},function(e,t,r){"use strict";var n=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===i}(e)}(e)};var i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?d((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function a(e,t,r){return e.concat(t).map((function(e){return o(e,r)}))}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function u(e,t){try{return t in e}catch(e){return!1}}function c(e,t,r){var n={};return r.isMergeableObject(e)&&s(e).forEach((function(t){n[t]=o(e[t],r)})),s(t).forEach((function(i){(function(e,t){return u(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(u(e,i)&&r.isMergeableObject(t[i])?n[i]=function(e,t){if(!t.customMerge)return d;var r=t.customMerge(e);return"function"==typeof r?r:d}(i,r)(e[i],t[i],r):n[i]=o(t[i],r))})),n}function d(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||a,r.isMergeableObject=r.isMergeableObject||n,r.cloneUnlessOtherwiseSpecified=o;var i=Array.isArray(t);return i===Array.isArray(e)?i?r.arrayMerge(e,t,r):c(e,t,r):o(t,r)}d.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return d(e,r,t)}),{})};var l=d;e.exports=l},,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayBuffer=function(e){return"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_RETRY_DELAY_BASE=100,t.MAXIMUM_RETRY_DELAY=2e4,t.RETRYABLE_STATUS_CODES=new Set,[429,500,502,503,504,509].forEach((function(e){return t.RETRYABLE_STATUS_CODES.add(e)})),t.THROTTLING_RETRY_DELAY_BASE=500},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r={};t.locateWindow=function(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:r}},function(e,t,r){"use strict";function n(e){return"number"==typeof e?new Date(1e3*e):"string"==typeof e?new Date(e):e}Object.defineProperty(t,"__esModule",{value:!0}),t.iso8601=function(e){return n(e).toISOString().replace(/\.\d{3}Z$/,"Z")},t.rfc822=function(e){return n(e).toUTCString()},t.epoch=function(e){return Math.floor(n(e).valueOf()/1e3)},t.toDate=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceMetadata={apiVersion:"2014-06-30",endpointPrefix:"cognito-identity",jsonVersion:"1.1",protocol:"json",serviceFullName:"Amazon Cognito Identity",signatureVersion:"v4",targetPrefix:"AWSCognitoIdentityService",uid:"cognito-identity-2014-06-30"},t.clientVersion="0.1.0-preview.2"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.parseQueryString=function(e){var t,r,i={};if(e=e.replace(/^\?/,""))try{for(var o=n.__values(e.split("&")),a=o.next();!a.done;a=o.next()){var s=a.value,u=n.__read(s.split("="),2),c=u[0],d=u[1],l=void 0===d?null:d;c=decodeURIComponent(c),l&&(l=decodeURIComponent(l)),c in i?Array.isArray(i[c])?i[c].push(l):i[c]=[i[c],l]:i[c]=l}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return i}},,,,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.resolveConfiguration=function(e,t,r){var i,o,a={},s=[];try{for(var u=n.__values(Object.getOwnPropertyNames(t)),c=u.next();!c.done;c=u.next()){var d=c.value,l=t[d],f=l.required,p=l.defaultValue,h=l.defaultProvider,y=l.normalize,v=l.apply,m=e[d];if(void 0===m){if(void 0!==p)m=p;else if(h)m=h(a);else if(f)throw new Error("No input provided for required configuration parameter: "+d)}else y&&(m=y(m,a));a[d]=m,v&&s.push(v)}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}return s.forEach((function(e){return e(a,r)})),a}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.contentLengthMiddleware=function(e){var t=this;return function(r){return function(i){return n.__awaiter(t,void 0,void 0,(function(){var t,o,a,s;return n.__generator(this,(function(u){return t=n.__assign({},i.request),o=t.body,a=t.headers,o&&-1===Object.keys(a).map((function(e){return e.toLowerCase()})).indexOf("content-length")&&void 0!==(s=e(o))&&(t.headers=n.__assign({},t.headers,{"Content-Length":String(s)})),[2,r(n.__assign({},i,{request:t}))]}))}))}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.headerDefault=function(e){return function(t){return function(r){var i,o,a=n.__assign({},r.request.headers);try{for(var s=n.__values(Object.keys(e)),u=s.next();!u.done;u=s.next()){var c=u.value;c in a||(a[c]=e[c])}}catch(e){i={error:e}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return t(n.__assign({},r,{request:n.__assign({},r.request,{headers:a})}))}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.serializerMiddleware=function(e){var t=this;return function(r,i){var o=i.model;return function(i){return n.__awaiter(t,void 0,void 0,(function(){var t,a;return n.__generator(this,(function(s){switch(s.label){case 0:return[4,e()];case 1:return t=s.sent(),(a=t.serialize(o,i.input)).body&&["GET","HEAD"].indexOf(a.method)>=0&&delete a.body,[2,r(n.__assign({},i,{request:a}))]}}))}))}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);n.__exportStar(r(58),t),n.__exportStar(r(59),t),n.__exportStar(r(107),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(44);t.defaultDelayDecider=function(e,t){return Math.floor(Math.min(n.MAXIMUM_RETRY_DELAY,Math.random()*Math.pow(2,t)*e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(44),i=r(60);t.defaultRetryDecider=function(e){return void 0===e&&(e=!1),function(t){return!!t&&(!!t.connectionError||(!!(function(e){return e&&e.$metadata}(t)&&t.$metadata.httpStatusCode&&n.RETRYABLE_STATUS_CODES.has(t.$metadata.httpStatusCode))||(i.isStillProcessingError(t)||i.isThrottlingError(t)||e&&i.isClockSkewError(t))))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(106);t.isClockSkewError=function(e){return e.name in n.CLOCK_SKEW_ERROR_CODES},t.isStillProcessingError=function(e){return e.name in n.STILL_PROCESSING_ERROR_CODES},t.isThrottlingError=function(e){return e.name in n.THROTTLING_ERROR_CODES}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.signingMiddleware=function(e){var t=this;return function(r){return function(i){return n.__awaiter(t,void 0,void 0,(function(){var t,o,a;return n.__generator(this,(function(s){switch(s.label){case 0:return t=r,o=[{},i],a={},[4,e.sign(i.request)];case 1:return[2,t.apply(void 0,[n.__assign.apply(void 0,o.concat([(a.request=s.sent(),a)]))])]}}))}))}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultUserAgent=function(e,t){return"aws-sdk-js-v3-"+e+"/"+t+" "+("undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:"")},t.appendToUserAgent=function(e,t){e.headers["X-Amz-User-Agent"]+=" "+t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(7).__exportStar(r(109),t);var n=r(64);t.Ie11Sha256=n.Sha256;var i=r(67);t.WebCryptoSha256=i.Sha256},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(65),i=r(66),o=r(38),a=r(45),s=function(){function e(e){e?(this.operation=function(e){return new Promise((function(t,r){var n=a.locateWindow().msCrypto.subtle.importKey("raw",u(e),i.SHA_256_HMAC_ALGO,!1,["sign"]);n.oncomplete=function(){n.result&&t(n.result),r("ImportKey completed without importing key.")},n.onerror=function(){r("ImportKey failed to import key.")}}))}(e).then((function(e){return a.locateWindow().msCrypto.subtle.sign(i.SHA_256_HMAC_ALGO,e)})),this.operation.catch((function(){}))):this.operation=Promise.resolve(a.locateWindow().msCrypto.subtle.digest("SHA-256"))}return e.prototype.update=function(e){var t=this;n.isEmptyData(e)||(this.operation=this.operation.then((function(r){return r.onerror=function(){t.operation=Promise.reject(new Error("Error encountered updating hash"))},r.process(u(e)),r})),this.operation.catch((function(){})))},e.prototype.digest=function(){return this.operation.then((function(e){return new Promise((function(t,r){e.onerror=function(){r("Error encountered finalizing hash")},e.oncomplete=function(){e.result&&t(new Uint8Array(e.result)),r("Error encountered finalizing hash")},e.finish()}))}))},e}();function u(e){return"string"==typeof e?o.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA_256_HASH={name:"SHA-256"},t.SHA_256_HMAC_ALGO={name:"HMAC",hash:t.SHA_256_HASH},t.EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(38),i=r(65),o=r(66),a=r(45),s=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise((function(t,r){a.locateWindow().crypto.subtle.importKey("raw",u(e),o.SHA_256_HMAC_ALGO,!1,["sign"]).then(t,r)})),this.key.catch((function(){})))}return e.prototype.update=function(e){if(!i.isEmptyData(e)){var t=u(e),r=new Uint8Array(this.toHash.byteLength+t.byteLength);r.set(this.toHash,0),r.set(t,this.toHash.byteLength),this.toHash=r}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return a.locateWindow().crypto.subtle.sign(o.SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):i.isEmptyData(this.toHash)?Promise.resolve(o.EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return a.locateWindow().crypto.subtle.digest(o.SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e}();function u(e){return"string"==typeof e?n.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.coreHandler=function(e,t){return function(r){var n=r.model;return function(r){var i=r.request,o=r.input.$abortSignal;return e.handle(i,{abortSignal:o}).then((function(e){return t.parse(n,e)}))}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(7).__exportStar(r(119),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);n.__exportStar(r(72),t),n.__exportStar(r(122),t)},function(e,t,r){"use strict";function n(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}Object.defineProperty(t,"__esModule",{value:!0}),t.escapeUri=function(e){var t=encodeURIComponent(e);return t=t.replace(/[!'()*]/g,n)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(43),o=r(46),a=r(74),s=function(){function e(e,t){this.base64Encoder=e,this.utf8Decoder=t}return e.prototype.build=function(e){var t=e.operation,r=e.member,n=void 0===r?t.input:r,i=e.input,o=n.shape;return JSON.stringify(this.format(o,i))},e.prototype.format=function(e,t){var r,s,u,c,d,l,f,p,h=typeof t;if("structure"===e.type){if("object"!==h||null===t)throw new Error("Unable to serialize value of type "+typeof t+" as a structure");var y={};try{for(var v=n.__values(Object.keys(t)),m=v.next();!m.done;m=v.next()){if(void 0!==t[R=m.value]&&null!==t[R]&&R in e.members){var b=e.members[R],g=b.location,_=b.locationName,w=void 0===_?R:_,E=b.shape;g||(y[w]=this.format(E,t[R]))}}}catch(e){r={error:e}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(r)throw r.error}}return y}if("list"===e.type){if(Array.isArray(t)||a.isIterable(t)){y=[];try{for(var A=n.__values(t),S=A.next();!S.done;S=A.next()){var x=S.value;y.push(this.format(e.member.shape,x))}}catch(e){u={error:e}}finally{try{S&&!S.done&&(c=A.return)&&c.call(A)}finally{if(u)throw u.error}}return y}throw new Error("Unable to serialize value that is neither an array nor an iterable as a list")}if("map"===e.type){y={};if(a.isIterable(t)){try{for(var O=n.__values(t),P=O.next();!P.done;P=O.next()){var M=n.__read(P.value,2),R=M[0],I=M[1];y[R]=this.format(e.value.shape,I)}}catch(e){d={error:e}}finally{try{P&&!P.done&&(l=O.return)&&l.call(O)}finally{if(d)throw d.error}}return y}if("object"!==h||null===t)throw new Error("Unable to serialize value that is neither a [key, value] iterable nor an object as a map");try{for(var j=n.__values(Object.keys(t)),T=j.next();!T.done;T=j.next()){y[R=T.value]=this.format(e.value.shape,t[R])}}catch(e){f={error:e}}finally{try{T&&!T.done&&(p=j.return)&&p.call(j)}finally{if(f)throw f.error}}return y}if("blob"===e.type){if("string"==typeof t)t=this.utf8Decoder(t);else if(ArrayBuffer.isView(t))t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);else{if(!i.isArrayBuffer(t))throw new Error("Unable to serialize value that is neither a string nor an ArrayBuffer nor an ArrayBufferView as a blob");t=new Uint8Array(t)}return this.base64Encoder(t)}if("timestamp"===e.type){if(["number","string"].indexOf(typeof t)>-1||"[object Date]"===Object.prototype.toString.call(t))return o.epoch(t);throw new Error("Unable to serialize value that is neither a string nor a number nor a Date object as a timestamp")}return t},e}();t.JsonBuilder=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isIterable=function(e){return Boolean(e)&&"undefined"!=typeof Symbol&&"function"==typeof e[Symbol.iterator]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(76),o=r(123);function a(e,t){var r,i;if(e){var o=JSON.parse(e);try{for(var a=n.__values(t),s=a.next();!s.done;s=a.next()){var u=s.value;if(o[u])return o[u].split("#").pop()}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}}t.jsonErrorUnmarshaller=function(e,t,r){var s,u,c,d,l=t.body,f=e.errors,p=e.name,h=(c=t.headers,("string"==typeof(d=c["x-amzn-errortype"])?d.split(":")[0]:void 0)||a(l,["__type","code"])||void 0);if(!h)return o.initServiceException(new Error,{$metadata:i.extractMetadata(t),operationName:p});var y=function(e,t){return a(e,t)}(l,["message","Message","errorMessage"])||"";try{for(var v=n.__values(f),m=v.next();!m.done;m=v.next()){var b=m.value,g=b.shape;if(g.exceptionCode===h||!g.exceptionCode&&g.exceptionType===h){var _=g.members?r.parse(b,l):{};return o.initServiceException(new Error,{$metadata:i.extractMetadata(t),message:y,name:h,rawException:_,operationName:p})}}}catch(e){s={error:e}}finally{try{m&&!m.done&&(u=v.return)&&u.call(v)}finally{if(s)throw s.error}}var w={$metadata:i.extractMetadata(t),name:h,message:y};return o.initServiceException(new Error,w)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.extractMetadata=function(e){var t=Object.keys(e.headers).reduce((function(t,r){return t[r.toLowerCase()]=e.headers[r],t}),{});return{httpHeaders:t,httpStatusCode:e.statusCode,requestId:t["x-amz-request-id"]||t["x-amzn-requestid"],extendedRequestId:t["x-amz-id-2"],cfId:t["x-amz-cf-id"]}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(46),i=function(){function e(e){this.base64Decoder=e}return e.prototype.parse=function(e,t){return this.unmarshall(e.shape,JSON.parse(t))},e.prototype.unmarshall=function(e,t){var r=this;if("structure"===e.type){if("object"!=typeof t||null===t)return;return Object.keys(e.members).reduce((function(n,i){var o=e.members[i],a=o.locationName,s=void 0===a?i:a,u=o.shape,c=t[s];return void 0!==c&&(n[i]=r.unmarshall(u,c)),n}),{})}if("list"===e.type){if(!Array.isArray(t))return;var i=e.member.shape;return t.map((function(e){return r.unmarshall(i,e)}))}if("map"===e.type){if("object"!=typeof t||null===t)return;var o=e.value.shape;return Object.keys(t).reduce((function(e,n){return e[n]=r.unmarshall(o,t[n]),e}),{})}if("timestamp"===e.type){if("number"!=typeof t)return;return n.toDate(t)}if("blob"===e.type){if("string"!=typeof t)return;return this.base64Decoder(t)}return t},e}();t.JsonParser=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);n.__exportStar(r(79),t),n.__exportStar(r(127),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(36),i={},o=[];t.createScope=function(e,t,r){return e+"/"+t+"/"+r+"/"+n.KEY_TYPE_IDENTIFIER},t.getSigningKey=function(e,t,r,a,s){var u=r+":"+a+":"+s+":"+t.accessKeyId+":"+t.sessionToken;if(u in i)return i[u];for(o.push(u);o.length>n.MAX_CACHE_SIZE;)delete i[o.shift()];return i[u]=new Promise((function(o,c){for(var d=Promise.resolve("AWS4"+t.secretAccessKey),l=function(t){(d=d.then((function(r){return n=t,(i=new e(r)).update(n),i.digest();var n,i}))).catch((function(){}))},f=0,p=[r,a,s,n.KEY_TYPE_IDENTIFIER];f>=6;var d=o/4*3;a>>=s%8;for(var l=Math.floor(s/8),f=0;f>p)}}return new Uint8Array(r)},t.toBase64=function(e){for(var t="",r=0;r>d]}t+="==".slice(0,4-u)}return t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calculateBodyLength=function(e){return"string"==typeof e?e.length:"number"==typeof e.byteLength?e.byteLength:"number"==typeof e.size?e.size:void 0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._LoginsMap={type:"map",key:{shape:{type:"string",min:1}},value:{shape:{type:"string",min:1}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidParameterException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"InvalidParameterException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceNotFoundException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"ResourceNotFoundException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotAuthorizedException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"NotAuthorizedException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceConflictException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"ResourceConflictException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TooManyRequestsException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"TooManyRequestsException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InternalErrorException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"InternalErrorException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExternalServiceException={type:"structure",required:[],members:{message:{shape:{type:"string"}}},exceptionType:"ExternalServiceException"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(149);t._MapOfListOf__string={type:"map",key:{shape:{type:"string"}},value:{shape:n._ListOf__string}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._MapOf__double={type:"map",key:{shape:{type:"string"}},value:{shape:{type:"float"}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceMetadata={apiVersion:"2016-12-01",endpointPrefix:"pinpoint",jsonVersion:"1.1",protocol:"rest-json",serviceFullName:"Amazon Pinpoint",serviceId:"Pinpoint",signatureVersion:"v4",signingName:"mobiletargeting",uid:"pinpoint-2016-12-01"},t.clientVersion="0.1.0-preview.1"},function(e,t,r){"use strict";function n(e){return a(e).toISOString().replace(/\.\d{3}Z$/,"Z")}function i(e){return a(e).toUTCString()}function o(e){return Math.floor(a(e).valueOf()/1e3)}function a(e){return"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e}Object.defineProperty(t,"__esModule",{value:!0}),t.iso8601=n,t.rfc822=i,t.epoch=o,t.toDate=a,t.formatTimestamp=function(e,t){switch(t){case"iso8601":return n(e);case"rfc822":return i(e);case"unixTimestamp":return o(e);default:throw new Error("Invalid TimestampFormat: "+t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(53),i=r(54),o=r(55),a=r(56),s=r(37),u=r(57),c=r(61),d=r(62),l=r(108),f=r(47),p=function(){function e(e){this.middlewareStack=new s.MiddlewareStack,this.config=n.resolveConfiguration(e,l.configurationProperties,this.middlewareStack),this.middlewareStack.add(a.serializerMiddleware(this.config.serializer),{step:"serialize",priority:90,tags:{SERIALIZER:!0}}),this.middlewareStack.add(i.contentLengthMiddleware(this.config.bodyLengthChecker),{step:"build",priority:-80,tags:{SET_CONTENT_LENGTH:!0}}),this.config.maxRetries>0&&this.middlewareStack.add(u.retryMiddleware(this.config.maxRetries,this.config.retryDecider,this.config.delayDecider),{step:"finalize",priority:1/0,tags:{RETRY:!0}}),this.middlewareStack.add(c.signingMiddleware(this.config.signer),{step:"finalize",priority:0,tags:{SIGNATURE:!0}}),this.middlewareStack.add(o.headerDefault({"X-Amz-User-Agent":d.defaultUserAgent(f.ServiceMetadata.serviceId||f.ServiceMetadata.endpointPrefix,f.clientVersion)}),{step:"build",priority:0,tags:{SET_USER_AGENT:!0}})}return e.prototype.destroy=function(){this.config._user_injected_http_handler||this.config.httpHandler.destroy()},e.prototype.send=function(e,t){var r=e.resolveMiddleware(this.middlewareStack,this.config);if(!t)return r(e);r(e).then((function(e){return t(null,e)}),(function(e){return t(e)})).catch((function(){}))},e}();t.CognitoIdentityClient=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(37),i=r(134),o=function(){function e(e){this.input=e,this.middlewareStack=new n.MiddlewareStack}return e.prototype.resolveMiddleware=function(e,t){var r=t.handler,n=e.concat(this.middlewareStack),o={logger:{},model:i.GetCredentialsForIdentity};return n.resolve(r(o),o)},e}();t.GetCredentialsForIdentityCommand=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(37),i=r(139),o=function(){function e(e){this.input=e,this.middlewareStack=new n.MiddlewareStack}return e.prototype.resolveMiddleware=function(e,t){var r=t.handler,n=e.concat(this.middlewareStack),o={logger:{},model:i.GetId};return n.resolve(r(o),o)},e}();t.GetIdCommand=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(37),i=r(143),o=function(){function e(e){this.input=e,this.middlewareStack=new n.MiddlewareStack}return e.prototype.resolveMiddleware=function(e,t){var r=t.handler,n=e.concat(this.middlewareStack),o={logger:{},model:i.PutEvents};return n.resolve(r(o),o)},e}();t.PutEventsCommand=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(53),i=r(54),o=r(55),a=r(56),s=r(37),u=r(57),c=r(61),d=r(62),l=r(170),f=r(96),p=function(){function e(e){this.middlewareStack=new s.MiddlewareStack,this.config=n.resolveConfiguration(e,l.configurationProperties,this.middlewareStack),this.middlewareStack.add(a.serializerMiddleware(this.config.serializer),{step:"serialize",priority:90,tags:{SERIALIZER:!0}}),this.middlewareStack.add(i.contentLengthMiddleware(this.config.bodyLengthChecker),{step:"build",priority:-80,tags:{SET_CONTENT_LENGTH:!0}}),this.config.maxRetries>0&&this.middlewareStack.add(u.retryMiddleware(this.config.maxRetries,this.config.retryDecider,this.config.delayDecider),{step:"finalize",priority:1/0,tags:{RETRY:!0}}),this.middlewareStack.add(c.signingMiddleware(this.config.signer),{step:"finalize",priority:0,tags:{SIGNATURE:!0}}),this.middlewareStack.add(o.headerDefault({"X-Amz-User-Agent":d.defaultUserAgent(f.ServiceMetadata.serviceId||f.ServiceMetadata.endpointPrefix,f.clientVersion)}),{step:"build",priority:0,tags:{SET_USER_AGENT:!0}})}return e.prototype.destroy=function(){this.config._user_injected_http_handler||this.config.httpHandler.destroy()},e.prototype.send=function(e,t){var r=e.resolveMiddleware(this.middlewareStack,this.config);if(!t)return r(e);r(e).then((function(e){return t(null,e)}),(function(e){return t(e)})).catch((function(){}))},e}();t.PinpointClient=p},function(e,t,r){var n; -/*! - * UAParser.js v0.7.24 - * Lightweight JavaScript-based User-Agent string parser - * https://github.com/faisalman/ua-parser-js - * - * Copyright © 2012-2021 Faisal Salman - * Licensed under MIT License - */!function(i,o){"use strict";var a="model",s="name",u="type",c="vendor",d="version",l="mobile",f="tablet",p="smarttv",h={extend:function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"==typeof e?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},y={rgx:function(e,t){for(var r,n,i,o,a,s,u=0;u0?2==o.length?"function"==typeof o[1]?this[o[0]]=o[1].call(this,s):this[o[0]]=o[1]:3==o.length?"function"!=typeof o[1]||o[1].exec&&o[1].test?this[o[0]]=s?s.replace(o[1],o[2]):void 0:this[o[0]]=s?o[1].call(this,s,o[2]):void 0:4==o.length&&(this[o[0]]=s?o[3].call(this,s.replace(o[1],o[2])):void 0):this[o]=s||void 0;u+=2}},str:function(e,t){for(var r in t)if("object"==typeof t[r]&&t[r].length>0){for(var n=0;nN?e:N,U=e}));var H=Object(h.parseQueryString)(window.location.search),q={};for(var B in H)q["qv_".concat(B)]=H[B]||"";var z,G,V,F,Y,K,Q,Z=function(){if(void 0===window.sessionStorage)return null;var e=window.sessionStorage.getItem("_hm_uuid");if(e)return e;var t=Object(g.h)();return window.sessionStorage.setItem("_hm_uuid",t),t},W=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return w({date:(new Date).toISOString(),session:Z(),pageSession:T,url:window.location.origin+window.location.pathname,host:window.location.hostname,search:window.location.search,hash:window.location.hash,referer:document.referrer},q,{},x.Attributes||{},{},e,{},I||{})},X=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return w({elapsed:L+(Date.now()-D),scrollDepthMax:N,scrollDepthNow:U,hour:(new Date).getHours(),day:(new Date).getDay()+1,month:(new Date).getMonth()+1,year:(new Date).getFullYear()},e,{},j||{})},$={keys:{UserId:"aws.cognito.identity-id.".concat(A.CognitoId),UserCredentials:"aws.cognito.identity-credentials.".concat(A.CognitoId)},getUserId:function(){return localStorage.getItem($.keys.UserId)},getUserCredentials:function(){try{var e=JSON.parse(localStorage.getItem($.keys.UserCredentials));return new Date(e.Credentials.Expiration).getTime()>Date.now()&&e}catch(e){return!1}},setUserId:function(e){return localStorage.setItem($.keys.UserId,e)},setUserCredentials:function(e){return localStorage.setItem($.keys.UserCredentials,JSON.stringify(e))},authenticate:(Q=a()(i.a.mark((function e(){var t,r,n,o,a,s,u,f;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=$.getUserId(),!(r=$.getUserCredentials())||!r.Credentials){e.next=4;break}return e.abrupt("return",r.Credentials);case 4:if(n={region:A.CognitoRegion,credentials:{}},A.CognitoEndpoint&&(n.endpoint=A.CognitoEndpoint),o=new c.CognitoIdentityClient(n),t){e.next=20;break}return e.prev=8,a=new l.GetIdCommand({IdentityPoolId:A.CognitoId}),e.next=12,o.send(a);case 12:s=e.sent,t=s.IdentityId,$.setUserId(t),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(8),console.error(e.t0);case 20:return e.prev=20,u=new d.GetCredentialsForIdentityCommand({IdentityId:t}),e.next=24,o.send(u);case 24:return f=e.sent,r=f,$.setUserCredentials(r),e.abrupt("return",r.Credentials);case 30:e.prev=30,e.t1=e.catch(20),console.error(e.t1);case 33:return e.abrupt("return",!1);case 34:case"end":return e.stop()}}),e,null,[[8,17],[20,30]])}))),function(){return Q.apply(this,arguments)}),getClient:(K=a()(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!$.client){e.next=4;break}return e.next=3,$.client;case 3:return e.abrupt("return",e.sent);case 4:return $.client=a()(i.a.mark((function e(){var t,r,n;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$.authenticate();case 2:if(t=e.sent){e.next=6;break}return console.error("Credentials not found."),e.abrupt("return");case 6:return r={region:A.PinpointRegion,credentials:{accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretKey,expiration:t.Expiration,sessionToken:t.SessionToken}},A.PinpointEndpoint&&(r.endpoint=A.PinpointEndpoint),n=new p.PinpointClient(r),$.client=n,e.abrupt("return",n);case 11:case"end":return e.stop()}}),e)})))(),e.next=7,$.client;case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)}))),function(){return K.apply(this,arguments)}),audiences:[],updateAudiences:(Y=a()(i.a.mark((function e(){var t,r,n,o,a,s,u,c,d,l,f,p,h,y,v,m,b,_,w,E,A,S,x,O,M;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=$.audiences.slice().sort(),e.next=3,Object(g.f)(W());case 3:return r=e.sent,e.next=6,Object(g.g)(X());case 6:n=e.sent,o=$.getEndpoint(),a={attributes:r,metrics:n,endpoint:o},s={},u=[],e.t0=i.a.keys(P);case 12:if((e.t1=e.t0()).done){e.next=71;break}c=e.t1.value,d=P[c],l=d.id,f=d.config,p="all"===f.include,e.t2=i.a.keys(f.groups);case 17:if((e.t3=e.t2()).done){e.next=68;break}h=e.t3.value,y=f.groups[h],v="all"===y.include,e.t4=i.a.keys(y.rules);case 22:if((e.t5=e.t4()).done){e.next=60;break}if(m=e.t5.value,b=y.rules[m],_=b.field,w=b.operator,E=b.value,""!==_){e.next=27;break}return e.abrupt("continue",22);case 27:A=!1,S=s[_]||_.split(".").reduce((function(e,t){var r;return null!==(r=e[t])&&void 0!==r?r:null}),a),Array.isArray(S)||(S=[S]),s[_]=S,e.t6=i.a.keys(S);case 32:if((e.t7=e.t6()).done){e.next=52;break}if(x=e.t7.value,O=S[x],"="===w&&(A=O===E),"!="===w&&(A=O!==E),null!==O){e.next=39;break}return e.abrupt("break",52);case 39:if("*="===w&&(A=O.indexOf(E)>-1),"!*"===w&&(A=-1===O.indexOf(E)),"^="===w&&(A=0===O.indexOf(E)),null!==E){e.next=44;break}return e.abrupt("break",52);case 44:if("gte"===w&&(A=Number(O)>=Number(E)),"lte"===w&&(A=Number(O)<=Number(E)),"gt"===w&&(A=Number(O)>Number(E)),"lt"===w&&(A=Number(O)0&&void 0!==r[0]?r[0]:{},e.next=3,$.flushEvents(t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)}))),function(){return F.apply(this,arguments)}),getEndpoint:function(){try{return JSON.parse(localStorage.getItem("aws.pinpoint.endpoint"))||{}}catch(e){return{}}},setEndpoint:function(e){localStorage.setItem("aws.pinpoint.endpoint",JSON.stringify(e))},on:function(e,t){return window.addEventListener("altis.analytics.".concat(e),(function(e){return t(e.detail)}))},off:function(e){window.removeEventListener(e)},mergeEndpointData:(V=a()(i.a.mark((function e(){var t,r,n,o,a,s,u,c=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=c.length>0&&void 0!==c[0]?c[0]:{},r=$.getEndpoint(),n=b()(navigator.userAgent),o={Attributes:{},Demographic:{AppVersion:x.AppVersion||"",Locale:Object(g.c)()},Location:{},Metrics:{}},n.device&&n.device.vendor&&(o.Attributes.DeviceMake=[n.device.vendor]),n.device&&n.device.model&&(o.Attributes.DeviceModel=[n.device.model]),n.device&&n.device.type&&(o.Attributes.DeviceType=[n.device.type]),n.engine&&n.engine.name&&(o.Demographic.Make=n.engine.name),n.browser&&n.browser.name&&(o.Demographic.Model=n.browser.name),n.browser&&n.browser.version&&(o.Demographic.ModelVersion=n.browser.version),n.os&&n.os.name&&(o.Demographic.Platform=n.os.name),n.os&&n.os.version&&(o.Demographic.PlatformVersion=n.os.version),!(t=v.a.all([o,r,t],{arrayMerge:g.e})).User||!t.User.UserAttributes){e.next=17;break}return e.next=16,Object(g.f)(t.User.UserAttributes,!0);case 16:t.User.UserAttributes=e.sent;case 17:return e.next=19,Object(g.f)(t.Attributes,!0);case 19:return t.Attributes=e.sent,e.next=22,Object(g.g)(t.Metrics);case 22:t.Metrics=e.sent,t.Attributes.lastSession?(t.Attributes.lastSession[0]!==Z()&&(t.Attributes.lastSession=[Z()],t.Metrics.sessions+=1),t.Attributes.lastPageSession[0]!==T&&(t.Attributes.lastPageSession=[T],t.Metrics.pageViews+=1)):(t.Attributes.lastSession=[Z()],t.Attributes.lastPageSession=[T],t.Metrics.sessions=1,t.Metrics.pageViews=1),document.referer&&-1===document.referrer.indexOf(window.location.hostname)&&(t.Attributes.initialReferer||(t.Attributes.initialReferer=[document.referer]),t.Attributes.referer?-1===t.Attributes.referer.indexOf(document.referer)&&t.Attributes.referer.push(document.referer):t.Attributes.referer=[document.referer]),e.t0=i.a.keys(H);case 26:if((e.t1=e.t0()).done){e.next=35;break}if(a=e.t1.value,(s=a.toLowerCase()).match(/^utm_/)){e.next=31;break}return e.abrupt("continue",26);case 31:t.Attributes["initial_".concat(s)]||(t.Attributes["initial_".concat(s)]=[H[s]]),t.Attributes[s]?-1===t.Attributes[s].indexOf(H[s])&&t.Attributes[s].push(H[s]):t.Attributes[s]=[H[s]],e.next=26;break;case 35:return R||delete t.User,$.setEndpoint(t),u=new CustomEvent("altis.analytics.updateEndpoint",{detail:t}),window.dispatchEvent(u),e.next=41,$.updateAudiences();case 41:return e.abrupt("return",t);case 42:case"end":return e.stop()}}),e)}))),function(){return V.apply(this,arguments)}),events:[],record:(G=a()(i.a.mark((function e(t){var r,n,o,a,s,c,d,l,f,p=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=p.length>1&&void 0!==p[1]?p[1]:{},n=p.length>2&&void 0!==p[2]?p[2]:{},o=!(p.length>3&&void 0!==p[3])||p[3],"boolean"==typeof r&&(o=r,r={}),"boolean"==typeof n&&(o=n,n={}),!Object.entries(n).length){e.next=8;break}return e.next=8,$.mergeEndpointData(n);case 8:return a=W(r.attributes||{}),s=X(r.metrics||{}),e.next=12,Object(g.f)(a);case 12:return e.t0=e.sent,e.next=15,Object(g.g)(s);case 15:if(e.t1=e.sent,c={attributes:e.t0,metrics:e.t1},d=Object(g.h)(),l=u()({},d,{EventType:t,Timestamp:(new Date).toISOString(),AppPackageName:x.AppPackageName||"",AppTitle:x.SiteName||"",AppVersionCode:x.AppVersion||"",Attributes:c.attributes,Metrics:c.metrics,Session:{Id:C,StartTimestamp:new Date(k).toISOString()}}),"_session.stop"===t&&(l[d].Session.Duration=Date.now()-k,l[d].Session.StopTimestamp=(new Date).toISOString()),$.events.push(l),f=new CustomEvent("altis.analytics.record",{detail:l[d]}),window.dispatchEvent(f),o){e.next=26;break}return $.flushEvents(),e.abrupt("return");case 26:$.timer&&clearTimeout($.timer),$.timer=setTimeout($.flushEvents,5e3);case 28:case"end":return e.stop()}}),e)}))),function(e){return G.apply(this,arguments)}),flushEvents:(z=a()(i.a.mark((function e(){var t,r,n,o,a,s,c,d,l,p=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=p.length>0&&void 0!==p[0]?p[0]:{},$.timer&&clearTimeout($.timer),Altis.Analytics.Ready){e.next=5;break}return $.timer=setTimeout($.flushEvents,5e3),e.abrupt("return");case 5:return r=$.events,$.events=[],e.next=9,$.getClient();case 9:if(n=e.sent,o=$.getUserId()){e.next=14;break}return console.error("No User ID found. Make sure to call Analytics.authenticate() first."),e.abrupt("return");case 14:if(!Object.entries(t).length){e.next=17;break}return e.next=17,$.mergeEndpointData(t);case 17:if((a=$.getEndpoint()).RequestId=Object(g.h)(),s=r.reduce((function(e,t){return w({},t,{},e)}),{}),c=o.replace("".concat(A.CognitoRegion,":"),""),d={BatchItem:u()({},c,{Endpoint:a,Events:s})},e.prev=22,l=new f.PutEventsCommand({ApplicationId:A.PinpointId,EventsRequest:d}),O){e.next=27;break}return e.next=27,n.send(l);case 27:e.next=32;break;case 29:e.prev=29,e.t0=e.catch(22),console.error(e.t0);case 32:case"end":return e.stop()}}),e,null,[[22,29]])}))),function(){return z.apply(this,arguments)})};function J(){if(!Altis.Analytics.Ready){$.mergeEndpointData(x.Endpoint||{}),Altis.Analytics.Ready=!0;var e=new CustomEvent("altis.analytics.ready");window.dispatchEvent(e),document.addEventListener("visibilitychange",(function(){document.hidden?(L+=Date.now()-D,$.record("_session.stop")):(D=Date.now(),C=Object(g.h)(),k=Date.now(),$.record("_session.start"))}));var t=function(){$.record("_session.start"),$.record("pageView",!1)};"interactive"===document.readyState||"complete"===document.readyState||"loaded"===document.readyState?t():window.addEventListener("DOMContentLoaded",t),window.addEventListener("beforeunload",(function(){$.record("_session.stop",!1)}))}}if(Altis.Analytics.updateEndpoint=$.updateEndpoint,Altis.Analytics.getEndpoint=$.getEndpoint,Altis.Analytics.getAudiences=$.getAudiences,Altis.Analytics.overrideAudiences=$.overrideAudiences,Altis.Analytics.on=$.on,Altis.Analytics.off=$.off,Altis.Analytics.record=$.record,Altis.Analytics.registerAttribute=function(e,t){I[e]=t,$.updateAudiences()},Altis.Analytics.registerMetric=function(e,t){j[e]=t,$.updateAudiences()},S.Enabled)if(M||R)J();else var ee=document.addEventListener("wp_listen_for_consent_change",(function(e){e.detail["statistics-anonymous"]&&"allow"===e.detail["statistics-anonymous"]&&(M=!0),e.detail.statistics&&"allow"===e.detail.statistics&&(R=!0),(M||R)&&(document.removeEventListener("wp_listen_for_consent_change",ee),J())}));else J()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CLOCK_SKEW_ERROR_CODES={AuthFailure:!0,InvalidSignatureException:!0,RequestExpired:!0,RequestInTheFuture:!0,RequestTimeTooSkewed:!0,SignatureDoesNotMatch:!0},t.STILL_PROCESSING_ERROR_CODES={PriorRequestNotComplete:!0},t.THROTTLING_ERROR_CODES={BandwidthLimitExceeded:!0,ProvisionedThroughputExceededException:!0,RequestLimitExceeded:!0,RequestThrottled:!0,RequestThrottledException:!0,SlowDown:!0,ThrottledException:!0,Throttling:!0,ThrottlingException:!0,TooManyRequestsException:!0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(44),o=r(58),a=r(59),s=r(60);t.retryMiddleware=function(e,t,r){return void 0===t&&(t=a.defaultRetryDecider()),void 0===r&&(r=o.defaultDelayDecider),function(o){return function(a){return n.__awaiter(this,void 0,void 0,(function(){var u,c,d,l;return n.__generator(this,(function(f){switch(f.label){case 0:u=0,c=0,d=function(){var d,l,f;return n.__generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,5]),[4,o(a)];case 1:return(d=n.sent()).$metadata.retries=u,d.$metadata.totalRetryDelay=c,[2,{value:d}];case 2:return l=n.sent(),u>6|192,63&i|128);else if(r+1>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)},t.toUtf8=function(e){for(var t="",r=0,n=e.length;ri.BLOCK_SIZE){var r=new o.RawSha256;r.update(t),t=r.digest()}var n=new Uint8Array(i.BLOCK_SIZE);return n.set(t),n}(e),r=new Uint8Array(i.BLOCK_SIZE);r.set(t);for(var n=0;nn.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,this.bufferLength===n.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(t.setUint8(this.bufferLength++,128),r%n.BLOCK_SIZE>=n.BLOCK_SIZE-8){for(var i=this.bufferLength;i>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],c=t[6],d=t[7],l=0;l>>17|f<<15)^(f>>>19|f<<13)^f>>>10,h=((f=this.temp[l-15])>>>7|f<<25)^(f>>>18|f<<14)^f>>>3;this.temp[l]=(p+this.temp[l-7]|0)+(h+this.temp[l-16]|0)}var y=(((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&u^~s&c)|0)+(d+(n.KEY[l]+this.temp[l]|0)|0)|0,v=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&o^i&o)|0;d=c,c=u,u=s,s=a+y|0,a=o,o=i,i=r,r=y+v|0}t[0]+=r,t[1]+=i,t[2]+=o,t[3]+=a,t[4]+=s,t[5]+=u,t[6]+=c,t[7]+=d},e}();t.RawSha256=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(7).__exportStar(r(116),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function o(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function a(e){return e&&i.every((function(t){return"function"==typeof e[t]}))}t.supportsWebCrypto=function(e){return!(!o(e)||"object"!=typeof e.crypto.subtle)&&a(e.crypto.subtle)},t.supportsSecureRandom=o,t.supportsSubtleCrypto=a,t.supportsZeroByteGCM=function(e){return n.__awaiter(this,void 0,void 0,(function(){var t;return n.__generator(this,(function(r){switch(r.label){case 0:if(!a(e))return[2,!1];r.label=1;case 1:return r.trys.push([1,4,,5]),[4,e.generateKey({name:"AES-GCM",length:128},!1,["encrypt"])];case 2:return t=r.sent(),[4,e.encrypt({name:"AES-GCM",iv:new Uint8Array(Array(12)),additionalData:new Uint8Array(Array(16)),tagLength:128},t,new Uint8Array(0))];case 3:return[2,16===r.sent().byteLength];case 4:return r.sent(),[2,!1];case 5:return[2]}}))}))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(7).__exportStar(r(118),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];t.isMsWindow=function(e){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(e)&&void 0!==e.msCrypto.subtle){var t=e.msCrypto,r=t.getRandomValues,i=t.subtle;return n.map((function(e){return i[e]})).concat(r).every((function(e){return"function"==typeof e}))}return!1}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(120),o=r(121),a=function(){function e(e){void 0===e&&(e={}),this.httpOptions=e}return e.prototype.destroy=function(){},e.prototype.handle=function(e,t){var r=t&&t.abortSignal,a=this.httpOptions.requestTimeout;if(r&&r.aborted){var s=new Error("Request aborted");return s.name="AbortError",Promise.reject(s)}var u=e.path;if(e.query){var c=o.buildQueryString(e.query);c&&(u+="?"+c)}var d=e.port,l=e.protocol+"//"+e.hostname+(d?":"+d:"")+u,f={body:e.body,headers:new Headers(e.headers),method:e.method,mode:"cors"};"undefined"!=typeof AbortController&&(f.signal=r);var p=new Request(l,f),h=[fetch(p).then((function(e){var t,r,i=e.headers,o={};try{for(var a=n.__values(i.entries()),s=a.next();!s.done;s=a.next()){var u=s.value;o[u[0]]=u[1]}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return e.blob().then((function(t){return{headers:o,statusCode:e.status,body:t}}))})),i.requestTimeout(a)];return r&&h.push(new Promise((function(e,t){r.onabort=function(){var e=new Error("Request aborted");e.name="AbortError",t(e)}}))),Promise.race(h)},e}();t.FetchHttpHandler=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.requestTimeout=function(e){return void 0===e&&(e=0),new Promise((function(t,r){e&&setTimeout((function(){var t=new Error("Request did not complete within "+e+" ms");t.name="TimeoutError",r(t)}),e)}))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(71);t.buildQueryString=function(e){var t,r,o=[];try{for(var a=n.__values(Object.keys(e).sort()),s=a.next();!s.done;s=a.next()){var u=s.value,c=e[u];if(u=i.escapeUri(u),Array.isArray(c))for(var d=0,l=c.length;d299)throw this.parseServiceException(e,n.__assign({},t,{body:r}),this.bodyParser);return(o=this.bodyParser.parse(e.output,r)).$metadata=i.extractMetadata(t),[2,o]}}))}))},e.prototype.resolveBodyString=function(e){var t=this,r=e.body,n=void 0===r?"":r;return"string"==typeof n?Promise.resolve(n):(ArrayBuffer.isView(n)?Promise.resolve(new Uint8Array(n.buffer,n.byteLength,n.byteOffset)):o.isArrayBuffer(n)?Promise.resolve(new Uint8Array(n,0,n.byteLength)):this.bodyCollector(n)).then((function(e){return t.utf8Encoder(e)}))},e}();t.JsonRpcParser=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=function(){function e(e,t){this.endpoint=e,this.bodySerializer=t}return e.prototype.serialize=function(e,t){var r=e.http,i=e.metadata,o=i.jsonVersion,a=i.targetPrefix,s=e.name;return n.__assign({},this.endpoint,{headers:{"X-Amz-Target":a+"."+s,"Content-Type":"application/x-amz-json-"+o},body:this.bodySerializer.build({operation:e,input:t}),path:r.requestUri,method:r.method})},e}();t.JsonRpcSerializer=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(79),o=r(128),a=r(129),s=r(130),u=r(131),c=r(132),d=r(36),l=r(46),f=r(80),p=r(133),h=function(){function e(e){var t=e.applyChecksum,r=e.credentials,n=e.region,i=e.service,o=e.sha256,a=e.uriEscapePath,s=void 0===a||a;if(this.service=i,this.sha256=o,this.uriEscapePath=s,this.applyChecksum="boolean"!=typeof t||t,"string"==typeof n){var u=Promise.resolve(n);this.regionProvider=function(){return u}}else this.regionProvider=n;if("object"==typeof r){var c=Promise.resolve(r);this.credentialProvider=function(){return c}}else this.credentialProvider=r}return e.prototype.presignRequest=function(e,t,r){return void 0===r&&(r={}),n.__awaiter(this,void 0,void 0,(function(){var a,f,p,h,m,b,g,_,w,E,A,S,x,O,P,M,R,I,j;return n.__generator(this,(function(n){switch(n.label){case 0:return[4,Promise.all([this.regionProvider(),this.credentialProvider()])];case 1:return a=n.sent(),f=a[0],p=a[1],h=r.signingDate,m=void 0===h?new Date:h,b=r.unsignableHeaders,g=y(m),_=g.longDate,w=g.shortDate,(E=function(e,t){return Math.floor((l.toDate(t).valueOf()-l.toDate(e).valueOf())/1e3)}(m,t))>d.MAX_PRESIGNED_TTL?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(A=i.createScope(w,f,this.service),S=c.moveHeadersToQuery(u.prepareRequest(e)),p.sessionToken&&(S.query[d.TOKEN_QUERY_PARAM]=p.sessionToken),S.query[d.ALGORITHM_QUERY_PARAM]=d.ALGORITHM_IDENTIFIER,S.query[d.CREDENTIAL_QUERY_PARAM]=p.accessKeyId+"/"+A,S.query[d.AMZ_DATE_QUERY_PARAM]=_,S.query[d.EXPIRES_QUERY_PARAM]=E.toString(10),x=o.getCanonicalHeaders(S,b),S.query[d.SIGNED_HEADERS_QUERY_PARAM]=v(x),O=S.query,P=d.SIGNATURE_QUERY_PARAM,M=this.getSignature,R=[_,A,this.getSigningKey(p,f,w)],I=this.createCanonicalRequest,j=[S,x],[4,s.getPayloadHash(e,this.sha256)]);case 2:return[4,M.apply(this,R.concat([I.apply(this,j.concat([n.sent()]))]))];case 3:return O[P]=n.sent(),[2,S]}}))}))},e.prototype.sign=function(e,t){void 0===t&&(t={});var r=t.signingDate,i=void 0===r?new Date:r,o=n.__rest(t,["signingDate"]);return n.__awaiter(this,void 0,void 0,(function(){var t,r,a,s;return n.__generator(this,(function(n){switch(n.label){case 0:return[4,Promise.all([this.regionProvider(),this.credentialProvider()])];case 1:return t=n.sent(),r=t[0],a=t[1],"string"==typeof e?[2,this.signString(e,i,r,a)]:(s=o.unsignableHeaders,[2,this.signRequest(e,i,r,a,s)])}}))}))},e.prototype.signString=function(e,t,r,i){return n.__awaiter(this,void 0,void 0,(function(){var o,a,s,u,c;return n.__generator(this,(function(n){switch(n.label){case 0:return o=y(t).shortDate,u=(s=this.sha256).bind,[4,this.getSigningKey(i,r,o)];case 1:return(a=new(u.apply(s,[void 0,n.sent()]))).update(e),c=f.toHex,[4,a.digest()];case 2:return[2,c.apply(void 0,[n.sent()])]}}))}))},e.prototype.signRequest=function(e,t,r,a,c){return n.__awaiter(this,void 0,void 0,(function(){var l,f,h,m,b,g,_,w;return n.__generator(this,(function(n){switch(n.label){case 0:return l=u.prepareRequest(e),f=y(t),h=f.longDate,m=f.shortDate,b=i.createScope(m,r,this.service),l.headers[d.AMZ_DATE_HEADER]=h,a.sessionToken&&(l.headers[d.TOKEN_HEADER]=a.sessionToken),[4,s.getPayloadHash(l,this.sha256)];case 1:return g=n.sent(),!p.hasHeader(d.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[d.SHA256_HEADER]=g),_=o.getCanonicalHeaders(l,c),[4,this.getSignature(h,b,this.getSigningKey(a,r,m),this.createCanonicalRequest(l,_,g))];case 2:return w=n.sent(),l.headers[d.AUTH_HEADER]=d.ALGORITHM_IDENTIFIER+" Credential="+a.accessKeyId+"/"+b+", SignedHeaders="+v(_)+", Signature="+w,[2,l]}}))}))},e.prototype.createCanonicalRequest=function(e,t,r){var n=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+a.getCanonicalQuery(e)+"\n"+n.map((function(e){return e+":"+t[e]})).join("\n")+"\n\n"+n.join(";")+"\n"+r},e.prototype.createStringToSign=function(e,t,r){return n.__awaiter(this,void 0,void 0,(function(){var i,o;return n.__generator(this,(function(n){switch(n.label){case 0:return(i=new this.sha256).update(r),[4,i.digest()];case 1:return o=n.sent(),[2,d.ALGORITHM_IDENTIFIER+"\n"+e+"\n"+t+"\n"+f.toHex(o)]}}))}))},e.prototype.getCanonicalPath=function(e){var t=e.path;return this.uriEscapePath?"/"+encodeURIComponent(t.replace(/^\//,"")).replace(/%2F/g,"/"):t},e.prototype.getSignature=function(e,t,r,i){return n.__awaiter(this,void 0,void 0,(function(){var o,a,s,u,c;return n.__generator(this,(function(n){switch(n.label){case 0:return[4,this.createStringToSign(e,t,i)];case 1:return o=n.sent(),u=(s=this.sha256).bind,[4,r];case 2:return(a=new(u.apply(s,[void 0,n.sent()]))).update(o),c=f.toHex,[4,a.digest()];case 3:return[2,c.apply(void 0,[n.sent()])]}}))}))},e.prototype.getSigningKey=function(e,t,r){return i.getSigningKey(this.sha256,e,r,t,this.service)},e}();function y(e){var t=l.iso8601(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}}function v(e){return Object.keys(e).sort().join(";")}t.SignatureV4=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(36);t.getCanonicalHeaders=function(e,t){for(var r=e.headers,i={},o=0,a=Object.keys(r).sort();o-1&&delete e.headers[o]}return i.HOST_HEADER in e.headers||(e.headers[i.HOST_HEADER]=e.hostname),e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),i=r(81);t.moveHeadersToQuery=function(e){for(var t=i.cloneRequest(e),r=t.headers,o=t.query,a=void 0===o?{}:o,s=0,u=Object.keys(r);s0){var s=i.bodyParser.parse(t,r);try{for(var u=n.__values(Object.keys(s)),c=u.next();!c.done;c=u.next()){var d=c.value;e[d]=s[d]}}catch(e){o={error:e}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(o)throw o.error}}}return Promise.resolve(e)}))},e.prototype.parseHeaders=function(e,t,r){var i,o,a,s,u,c;if("structure"===r.shape.type){var d={};try{for(var l=n.__values(Object.keys(t)),f=l.next();!f.done;f=l.next()){d[(O=f.value).toLowerCase()]=t[O]}}catch(e){i={error:e}}finally{try{f&&!f.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}var p=r.shape.members;try{for(var h=n.__values(Object.keys(p)),y=h.next();!y.done;y=h.next()){var v=y.value,m=p[v],b=m.location,g=m.locationName,_=void 0===g?v:g,w=m.shape;Boolean(m.locationName);if("header"===b||"headers"===b){var E=d[_.toLowerCase()];if("map"===w.type){e[v]={};var A=new RegExp("^"+_+"(.+)","i");try{for(var S=n.__values(Object.keys(t)),x=S.next();!x.done;x=S.next()){var O,P=(O=x.value).match(A);P&&(e[v][P[1]]=t[O])}}catch(e){u={error:e}}finally{try{x&&!x.done&&(c=S.return)&&c.call(S)}finally{if(u)throw u.error}}}else void 0!==E&&(e[v]=this.parseScalarHeader(w,E))}}}catch(e){a={error:e}}finally{try{y&&!y.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}}},e.prototype.parseScalarBody=function(e,t){switch(e.type){case"timestamp":return o.toDate(t);case"string":return"string"==typeof t?t:this.utf8Encoder(t);case"boolean":return"boolean"==typeof t?t:"true"===t;case"integer":return parseInt(t,10);case"float":return parseFloat(t)}},e.prototype.parseScalarHeader=function(e,t){switch(e.type){case"timestamp":return o.toDate(t);case"string":return e.jsonValue?JSON.parse(this.utf8Encoder(this.base64Decoder(t))):t;case"boolean":return"true"===t;case"integer":return parseInt(t,10);case"float":return parseFloat(t);case"blob":return this.base64Decoder(t)}},e.prototype.parseStatusCode=function(e,t,r){var i,o;if(t){var a=r.shape.members;try{for(var s=n.__values(Object.keys(a)),u=s.next();!u.done;u=s.next()){var c=u.value,d=a[c];if("statusCode"===d.location)return void(e[d.locationName||c]=t)}}catch(e){i={error:e}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}},e.prototype.resolveBody=function(e){return void 0===e&&(e=""),"string"==typeof e?Promise.resolve(e):ArrayBuffer.isView(e)?Promise.resolve(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):i.isArrayBuffer(e)?Promise.resolve(new Uint8Array(e,0,e.byteLength)):this.bodyCollector(e)},e.prototype.resolveBodyString=function(e){var t=this;return void 0===e&&(e=""),this.resolveBody(e).then((function(e){return"string"==typeof e?e:t.utf8Encoder(e)}))},e.prototype.responseIsSuccessful=function(e){return e<300},e}();t.RestParser=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.extractMetadata=function(e){var t=Object.keys(e.headers).reduce((function(t,r){return t[r.toLowerCase()]=e.headers[r],t}),{});return{httpHeaders:t,httpStatusCode:e.statusCode,requestId:t["x-amz-request-id"]||t["x-amzn-requestid"],extendedRequestId:t["x-amz-id-2"],cfId:t["x-amz-cf-id"]}}},function(e,t){!function(){if("function"==typeof window.CustomEvent)return!1;window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r}}(),window.console=window.console||{log:function(){},warn:function(){},error:function(){}}}])); \ No newline at end of file diff --git a/build/audiences/data.b82af12b.js b/build/audiences/data.4dc415e8.js similarity index 98% rename from build/audiences/data.b82af12b.js rename to build/audiences/data.4dc415e8.js index baae02b3..2e7caac6 100644 --- a/build/audiences/data.b82af12b.js +++ b/build/audiences/data.4dc415e8.js @@ -1 +1 @@ -!function(t,e){for(var r in e)t[r]=e[r]}(this,function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=186)}({1:function(t,e,r){t.exports=r(25)},17:function(t,e,r){"use strict";r.d(e,"d",(function(){return n})),r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a})),r.d(e,"c",(function(){return i}));var n={field:"",operator:"=",value:"",type:"string"},o={include:"any",rules:[n]},a={include:"all",groups:[o]},i={title:{rendered:"",raw:""},audience:a,status:"draft"}},186:function(t,e,r){"use strict";r.r(e);var n=r(4),o=r.n(n),a=r(1),i=r.n(a),s=r(17),u=r(40);function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;ee.menu_order?1:t.title.renderede.title.rendered?1:0};function d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}r.d(e,"store",(function(){return x}));var l=wp.apiFetch,h=wp.data.registerStore,g=wp.url.addQueryArgs,y={estimates:{},fields:[],pagination:{},post:s.c,posts:[],isLoading:!1,isUpdating:!1,isDeleting:!1};l.use((function(t,e){return t.path&&(t.path=t.path.replace("wp/v2/audiences","analytics/v1/audiences")),e(t)}));var v={FETCH_FROM_API:function(t){return l(t.options)},RESPONSE_TO_JSON:function(t){return t.response.json()}},m={setFields:function(t){return{type:"SET_FIELDS",fields:t}},addPosts:function(t){return{type:"ADD_POSTS",posts:t}},addEstimate:function(t,e){return{type:"ADD_ESTIMATE",audience:t,estimate:e}},removePost:function(t){return{type:"REMOVE_POST",id:t}},setCurrentPost:function(t){return{type:"SET_CURRENT_POST",post:t}},updateCurrentPost:function(t){return{type:"UPDATE_CURRENT_POST",post:t}},setIsLoading:function(t){return{type:"SET_IS_LOADING",isLoading:t}},setIsUpdating:function(t){return{type:"SET_IS_UPDATING",isUpdating:t}},setIsDeleting:function(t){return{type:"SET_IS_DELETING",isDeleting:t}},setPagination:function(t,e){return{type:"SET_PAGINATION",total:t,pages:e}},fetch:function(t){return{type:"FETCH_FROM_API",options:t}},json:function(t){return{type:"RESPONSE_TO_JSON",response:t}}},w={createPost:i.a.mark((function t(e){var r;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.setIsUpdating(!0);case 2:return t.next=4,m.fetch({path:"analytics/v1/audiences",method:"POST",data:e});case 4:return r=t.sent,t.next=7,m.addPosts([r]);case 7:return t.next=9,m.updateCurrentPost(r);case 9:return t.abrupt("return",m.setIsUpdating(!1));case 10:case"end":return t.stop()}}),t)})),updatePost:i.a.mark((function t(e){var r;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.id){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,m.setIsUpdating(!0);case 4:return e.title&&!e.title.raw&&(e.title.raw=e.title.rendered),t.next=7,m.fetch({path:"analytics/v1/audiences/".concat(e.id),method:"PATCH",data:e});case 7:return r=t.sent,t.next=10,m.updateCurrentPost(r);case 10:return t.abrupt("return",m.setIsUpdating(!1));case 11:case"end":return t.stop()}}),t)})),deletePost:i.a.mark((function t(e){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.setIsDeleting(!0);case 2:return t.next=4,m.fetch({path:"analytics/v1/audiences/".concat(e),method:"DELETE"});case 4:return t.next=6,m.removePost(e);case 6:return t.abrupt("return",m.setIsDeleting(!1));case 7:case"end":return t.stop()}}),t)}))},b={getFields:function(t){return t.fields},getEstimate:function(t,e){var r=JSON.stringify(e);return t.estimates[r]||{count:0,isLoading:!1,total:0,histogram:new Array(28).fill({count:1})}},getPost:function(t,e){return t.posts.find((function(t){return t.id===e}))},getCurrentPost:function(t){return t.post},getPosts:function(t){return t.posts},getPagination:function(t){return t.pagination},getIsLoading:function(t){return t.isLoading},getIsUpdating:function(t){return t.isUpdating},getIsDeleting:function(t){return t.isDeleting}},O={getFields:i.a.mark((function t(){var e;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.fetch({path:"analytics/v1/audiences/fields"});case 2:return e=t.sent,t.abrupt("return",m.setFields(e));case 4:case"end":return t.stop()}}),t)})),getEstimate:i.a.mark((function t(e){var r,n;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.addEstimate(e,{count:0,isLoading:!0,total:0,histogram:new Array(28).fill({count:1})});case 2:return r=encodeURIComponent(JSON.stringify(e)),t.next=5,m.fetch({path:"analytics/v1/audiences/estimate?audience=".concat(r)});case 5:return(n=t.sent).histogram=n.histogram||new Array(28).fill({count:1}),n.isLoading=!1,t.abrupt("return",m.addEstimate(e,n));case 9:case"end":return t.stop()}}),t)})),getPost:i.a.mark((function t(e){var r,n,o=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=o.length>1&&void 0!==o[1]?o[1]:{},e){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,m.setIsLoading(!0);case 5:return r=Object.assign({context:"view"},r),t.prev=6,t.next=9,m.fetch({path:g("analytics/v1/audiences/".concat(e),r)});case 9:return"auto-draft"===(n=t.sent).status&&(n.title.rendered=""),n.audience||(n.audience=s.a),t.next=14,m.addPosts([n]);case 14:t.next=20;break;case 16:return t.prev=16,t.t0=t.catch(6),t.next=20,m.addPosts([{id:e,error:t.t0}]);case 20:return t.abrupt("return",m.setIsLoading(!1));case 21:case"end":return t.stop()}}),t,null,[[6,16]])})),getCurrentPost:i.a.mark((function t(e){var r,n,o=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=o.length>1&&void 0!==o[1]?o[1]:{},e){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,m.setIsLoading(!0);case 5:return r=Object.assign({context:"view"},r),t.next=8,m.fetch({path:g("analytics/v1/audiences/".concat(e),r)});case 8:return"auto-draft"===(n=t.sent).status&&(n.title.rendered=""),n.audience||(n.audience=s.a),t.next=13,m.addPosts([n]);case 13:return t.next=15,m.setCurrentPost(n);case 15:return t.abrupt("return",m.setIsLoading(!1));case 16:case"end":return t.stop()}}),t)})),getPosts:i.a.mark((function t(){var e,r,n,o=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=o.length>0&&void 0!==o[0]?o[0]:{},t.next=3,m.setIsLoading(!0);case 3:return e=Object.assign({context:"edit",per_page:20,page:1,search:"",status:"publish,draft"},e),t.next=6,m.fetch({path:g("analytics/v1/audiences",e),headers:{"Access-Control-Expose-Headers":"X-WP-Total, X-WP-TotalPages"},parse:!1});case 6:return r=t.sent,t.next=9,m.json(r);case 9:return n=t.sent,t.next=12,m.addPosts(n);case 12:return t.next=14,m.setPagination(r.headers.get("x-wp-total"),r.headers.get("x-wp-totalpages"));case 14:return t.abrupt("return",m.setIsLoading(!1));case 15:case"end":return t.stop()}}),t)}))},x=h("audience",{actions:function(t){for(var e=1;e=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},4:function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},40:function(t,e){!function(){t.exports=this.lodash}()}})); \ No newline at end of file +!function(t,e){for(var r in e)t[r]=e[r]}(this,function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=187)}({1:function(t,e,r){t.exports=r(25)},17:function(t,e,r){"use strict";r.d(e,"d",(function(){return n})),r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a})),r.d(e,"c",(function(){return i}));var n={field:"",operator:"=",value:"",type:"string"},o={include:"any",rules:[n]},a={include:"all",groups:[o]},i={title:{rendered:"",raw:""},audience:a,status:"draft"}},187:function(t,e,r){"use strict";r.r(e);var n=r(4),o=r.n(n),a=r(1),i=r.n(a),s=r(17),u=r(42);function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;ee.menu_order?1:t.title.renderede.title.rendered?1:0};function d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}r.d(e,"store",(function(){return x}));var l=wp.apiFetch,h=wp.data.registerStore,g=wp.url.addQueryArgs,y={estimates:{},fields:[],pagination:{},post:s.c,posts:[],isLoading:!1,isUpdating:!1,isDeleting:!1};l.use((function(t,e){return t.path&&(t.path=t.path.replace("wp/v2/audiences","analytics/v1/audiences")),e(t)}));var v={FETCH_FROM_API:function(t){return l(t.options)},RESPONSE_TO_JSON:function(t){return t.response.json()}},m={setFields:function(t){return{type:"SET_FIELDS",fields:t}},addPosts:function(t){return{type:"ADD_POSTS",posts:t}},addEstimate:function(t,e){return{type:"ADD_ESTIMATE",audience:t,estimate:e}},removePost:function(t){return{type:"REMOVE_POST",id:t}},setCurrentPost:function(t){return{type:"SET_CURRENT_POST",post:t}},updateCurrentPost:function(t){return{type:"UPDATE_CURRENT_POST",post:t}},setIsLoading:function(t){return{type:"SET_IS_LOADING",isLoading:t}},setIsUpdating:function(t){return{type:"SET_IS_UPDATING",isUpdating:t}},setIsDeleting:function(t){return{type:"SET_IS_DELETING",isDeleting:t}},setPagination:function(t,e){return{type:"SET_PAGINATION",total:t,pages:e}},fetch:function(t){return{type:"FETCH_FROM_API",options:t}},json:function(t){return{type:"RESPONSE_TO_JSON",response:t}}},w={createPost:i.a.mark((function t(e){var r;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.setIsUpdating(!0);case 2:return t.next=4,m.fetch({path:"analytics/v1/audiences",method:"POST",data:e});case 4:return r=t.sent,t.next=7,m.addPosts([r]);case 7:return t.next=9,m.updateCurrentPost(r);case 9:return t.abrupt("return",m.setIsUpdating(!1));case 10:case"end":return t.stop()}}),t)})),updatePost:i.a.mark((function t(e){var r;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.id){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,m.setIsUpdating(!0);case 4:return e.title&&!e.title.raw&&(e.title.raw=e.title.rendered),t.next=7,m.fetch({path:"analytics/v1/audiences/".concat(e.id),method:"PATCH",data:e});case 7:return r=t.sent,t.next=10,m.updateCurrentPost(r);case 10:return t.abrupt("return",m.setIsUpdating(!1));case 11:case"end":return t.stop()}}),t)})),deletePost:i.a.mark((function t(e){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.setIsDeleting(!0);case 2:return t.next=4,m.fetch({path:"analytics/v1/audiences/".concat(e),method:"DELETE"});case 4:return t.next=6,m.removePost(e);case 6:return t.abrupt("return",m.setIsDeleting(!1));case 7:case"end":return t.stop()}}),t)}))},b={getFields:function(t){return t.fields},getEstimate:function(t,e){var r=JSON.stringify(e);return t.estimates[r]||{count:0,isLoading:!1,total:0,histogram:new Array(28).fill({count:1})}},getPost:function(t,e){return t.posts.find((function(t){return t.id===e}))},getCurrentPost:function(t){return t.post},getPosts:function(t){return t.posts},getPagination:function(t){return t.pagination},getIsLoading:function(t){return t.isLoading},getIsUpdating:function(t){return t.isUpdating},getIsDeleting:function(t){return t.isDeleting}},O={getFields:i.a.mark((function t(){var e;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.fetch({path:"analytics/v1/audiences/fields"});case 2:return e=t.sent,t.abrupt("return",m.setFields(e));case 4:case"end":return t.stop()}}),t)})),getEstimate:i.a.mark((function t(e){var r,n;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.addEstimate(e,{count:0,isLoading:!0,total:0,histogram:new Array(28).fill({count:1})});case 2:return r=encodeURIComponent(JSON.stringify(e)),t.next=5,m.fetch({path:"analytics/v1/audiences/estimate?audience=".concat(r)});case 5:return(n=t.sent).histogram=n.histogram||new Array(28).fill({count:1}),n.isLoading=!1,t.abrupt("return",m.addEstimate(e,n));case 9:case"end":return t.stop()}}),t)})),getPost:i.a.mark((function t(e){var r,n,o=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=o.length>1&&void 0!==o[1]?o[1]:{},e){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,m.setIsLoading(!0);case 5:return r=Object.assign({context:"view"},r),t.prev=6,t.next=9,m.fetch({path:g("analytics/v1/audiences/".concat(e),r)});case 9:return"auto-draft"===(n=t.sent).status&&(n.title.rendered=""),n.audience||(n.audience=s.a),t.next=14,m.addPosts([n]);case 14:t.next=20;break;case 16:return t.prev=16,t.t0=t.catch(6),t.next=20,m.addPosts([{id:e,error:t.t0}]);case 20:return t.abrupt("return",m.setIsLoading(!1));case 21:case"end":return t.stop()}}),t,null,[[6,16]])})),getCurrentPost:i.a.mark((function t(e){var r,n,o=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=o.length>1&&void 0!==o[1]?o[1]:{},e){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,m.setIsLoading(!0);case 5:return r=Object.assign({context:"view"},r),t.next=8,m.fetch({path:g("analytics/v1/audiences/".concat(e),r)});case 8:return"auto-draft"===(n=t.sent).status&&(n.title.rendered=""),n.audience||(n.audience=s.a),t.next=13,m.addPosts([n]);case 13:return t.next=15,m.setCurrentPost(n);case 15:return t.abrupt("return",m.setIsLoading(!1));case 16:case"end":return t.stop()}}),t)})),getPosts:i.a.mark((function t(){var e,r,n,o=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=o.length>0&&void 0!==o[0]?o[0]:{},t.next=3,m.setIsLoading(!0);case 3:return e=Object.assign({context:"edit",per_page:20,page:1,search:"",status:"publish,draft"},e),t.next=6,m.fetch({path:g("analytics/v1/audiences",e),headers:{"Access-Control-Expose-Headers":"X-WP-Total, X-WP-TotalPages"},parse:!1});case 6:return r=t.sent,t.next=9,m.json(r);case 9:return n=t.sent,t.next=12,m.addPosts(n);case 12:return t.next=14,m.setPagination(r.headers.get("x-wp-total"),r.headers.get("x-wp-totalpages"));case 14:return t.abrupt("return",m.setIsLoading(!1));case 15:case"end":return t.stop()}}),t)}))},x=h("audience",{actions:function(t){for(var e=1;e=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},4:function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},42:function(t,e){!function(){t.exports=this.lodash}()}})); \ No newline at end of file diff --git a/build/audiences/preview.b82af12b.js b/build/audiences/preview.4dc415e8.js similarity index 98% rename from build/audiences/preview.b82af12b.js rename to build/audiences/preview.4dc415e8.js index ee7fe1fc..0879f8ee 100644 --- a/build/audiences/preview.b82af12b.js +++ b/build/audiences/preview.4dc415e8.js @@ -1 +1 @@ -!function(e,t){for(var n in t)e[n]=t[n]}(this,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=187)}({0:function(e,t){!function(){e.exports=this.React}()},187:function(e,t,n){"use strict";n.r(t);var r=n(0),i=n.n(r),a=n(23),o=n.n(a),c=n(9),u=n.n(c),l=n(8),f=n.n(l);function s(){var e=Object(r.useState)(Altis.Analytics.getAudiences()),t=f()(e,2),n=t[0],a=t[1],o=window.AltisExperimentsPreview,c=o.audiences,l=o.editLabel,s=o.editUrl,d=o.label;Object(r.useEffect)((function(){a(Altis.Analytics.getAudiences());var e=Altis.Analytics.on("updateAudiences",(function(){a(Altis.Analytics.getAudiences())}));return function(){Altis.Analytics.off(e)}}),[]);return i.a.createElement(i.a.Fragment,null,i.a.createElement("a",{className:"ab-item",href:"#audience-preview",onClick:function(e){return function(e){e.preventDefault()}(e)}},d),i.a.createElement("div",{className:"ab-sub-wrapper"},i.a.createElement("ul",{className:"ab-submenu"},c.map((function(e){return i.a.createElement("li",{key:e.id,className:"aa-preview-item"},i.a.createElement("a",{className:"ab-item ".concat((t=e.id,n.indexOf(t)>=0?"altis-analytics-preview-selected":"")),href:"#",role:"button",onClick:function(t){return function(e,t){if(e.preventDefault(),n.indexOf(t)>=0){var r=n.filter((function(e){return e!==t}));a(r),Altis.Analytics.overrideAudiences(r)}else{var i=[].concat(u()(n),[t]);a(i),Altis.Analytics.overrideAudiences(i)}}(t,e.id)}},e.title));var t})),0===c.length&&i.a.createElement("li",null,i.a.createElement("a",{className:"ab-item",href:s},l)))))}Altis.Analytics.onReady((function(){var e=document.getElementById("wp-admin-bar-altis-analytics-preview");if(e){for(;e.firstChild;)e.removeChild(e.firstChild);o.a.render(i.a.createElement(s,null),e)}}))},20:function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},21:function(e,t){e.exports=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}}},22:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},23:function(e,t){!function(){e.exports=this.ReactDOM}()},30:function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t=0?"altis-analytics-preview-selected":"")),href:"#",role:"button",onClick:function(t){return function(e,t){if(e.preventDefault(),n.indexOf(t)>=0){var r=n.filter((function(e){return e!==t}));a(r),Altis.Analytics.overrideAudiences(r)}else{var i=[].concat(u()(n),[t]);a(i),Altis.Analytics.overrideAudiences(i)}}(t,e.id)}},e.title));var t})),0===c.length&&i.a.createElement("li",null,i.a.createElement("a",{className:"ab-item",href:s},l)))))}Altis.Analytics.onReady((function(){var e=document.getElementById("wp-admin-bar-altis-analytics-preview");if(e){for(;e.firstChild;)e.removeChild(e.firstChild);o.a.render(i.a.createElement(s,null),e)}}))},20:function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},21:function(e,t){e.exports=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return n}}},22:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},23:function(e,t){!function(){e.exports=this.ReactDOM}()},30:function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t * + * {\n\t\tmargin-left: 5px;\n\t}\n\n\t.audience-editor__rule-operator,\n\tbutton {\n\t\tflex: none;\n\t}\n\n\tp.description {\n\t\twidth: 100%;\n\t\tmargin: 8px 0 0;\n\t}\n"]);return L=function(){return e},e}var $=wp.components.Button,D=wp.data.useSelect,F=wp.i18n,z=F.sprintf,U=F.__,B=k.b.div(L()),G=k.b.div(I()),W=function(e){var t,n=e.disabled,i=e.currentField,o=e.name,s=e.operator,c=e.value,l=e.onChange,u=i.data&&i.data.map((function(e){return{value:e.value,label:(e.label?"".concat(e.label," (").concat(e.value,")"):e.value)+String(e.percent?" ~".concat(e.percent,"%"):""),count:Number(null==e?void 0:e.count)||0,percent:Number(null==e?void 0:e.percent)||0}}))||[],f=u.filter((function(e){return e.percent})).slice(0,10);f.sort((function(e,t){return t.percent-e.percent}));var d=!(null==i||null===(t=i.options)||void 0===t?void 0:t.disable_free_text),p=Object(r.useRef)(null),h=Object(r.useRef)(null),m=""===c||!!u.find((function(e){return e.value===c})),y=Object(r.useState)(m),g=P()(y,2),v=g[0],b=g[1];Object(r.useEffect)((function(){v?h&&h.current&&h.current.focus():p&&p.current&&p.current.focus()}),[v]);var w=Object(r.useState)(null),x=P()(w,2),E=x[0],k=x[1];switch(i.name!==E&&(b(m),k(i.name)),i.type){case"number":return a.a.createElement("input",{className:"regular-text",disabled:n,name:o,placeholder:"".concat(z(U("Avg: %d, Lowest: %d, Highest: %d","altis-analytics"),Number(i.stats.avg).toFixed(2),Number(i.stats.min).toFixed(2),Number(i.stats.max).toFixed(2))),type:"number",value:c,onChange:l});case"string":default:switch(s){case"=":case"!=":case"*=":case"!*":case"^=":return a.a.createElement(r.Fragment,null,!v&&a.a.createElement(G,null,a.a.createElement("input",{ref:p,className:"regular-text",disabled:n,list:"audience-editor__rule__data_".concat(o),name:o,type:"text",value:c,onBlur:function(){b(m)},onChange:l}),a.a.createElement($,{isDestructive:!0,isLink:!0,label:U("Clear selection","altis-anlaytics"),onClick:function(){l({target:{value:""}}),b(!0)}},"×")),v&&a.a.createElement("select",{ref:h,className:"audience-editor__rule-value",disabled:n,id:"audience-editor__rule__data_".concat(o),name:o,value:c,onChange:function(e){"___"===e.target.value?b(!1):l(e)}},a.a.createElement("option",{value:""},U("Empty","altis-analytics")),f.length>0&&a.a.createElement("optgroup",{label:U("Top hits","altis-analytics")},f.map((function(e){return""!==e.value&&a.a.createElement("option",{key:e.value,value:e.value},e.label)}))),u.map((function(e){return""!==e.value&&a.a.createElement("option",{key:e.value,value:e.value},e.label)})),d&&a.a.createElement("option",{value:"___"},U("Other, please specify...","altis-analytics"))));default:return null}}};function q(e){var t=e.canRemove,n=e.field,r=e.namePrefix,i=e.operator,o=e.value,s=e.onChange,c=e.onRemove,l=D((function(e){return e("audience").getFields()}),[]),u=l.find((function(e){return e.name===n}))||{},f=l.filter((function(e){return e.name.match(/^endpoint\./)})),d=l.filter((function(e){return!e.name.match(/^endpoint\./)}));return a.a.createElement(B,{className:"audience-editor__rule"},a.a.createElement("select",{className:"audience-editor__rule-field",disabled:0===l.length,name:"".concat(r,"[field]"),value:n,onChange:function(e){return s({field:e.target.value,value:""})}},a.a.createElement("option",{className:"placeholder",value:""},U("Select a field","altis-analytics")),a.a.createElement("optgroup",{label:U("Persistent Data","altis-analytics")},f.map((function(e){return a.a.createElement("option",{key:e.name,value:e.name},e.label)}))),a.a.createElement("optgroup",{label:U("Point-in-time Data","altis-analytics")},d.map((function(e){return a.a.createElement("option",{key:e.name,value:e.name},e.label)})))),a.a.createElement(T,{className:"audience-editor__rule-operator",disabled:0===l.length,name:"".concat(r,"[operator]"),type:u.type||"string",value:i,onChange:function(e){return s({operator:e.target.value})}}),a.a.createElement(W,{currentField:u,disabled:0===l.length,name:"".concat(r,"[value]"),operator:i,value:o,onChange:function(e){return s({value:e.target.value})}}),t&&a.a.createElement($,{className:"audience-editor__rule-remove",isDestructive:!0,isLink:!0,onClick:c},U("Remove","altis-analytics")),u.description&&a.a.createElement("p",{className:"description"},u.description))}function H(){var e=E()(["\n\tvertical-align: middle;\n"]);return H=function(){return e},e}var V=wp.i18n.__,Y=k.b.select(H());function X(e){return a.a.createElement(Y,e,a.a.createElement("option",{value:"any"},V("Match any of the following","altis-analytics")," ",e.label),a.a.createElement("option",{value:"all"},V("Match all of the following","altis-analytics")," ",e.label))}function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function J(e){for(var t=1;t1,fields:i,namePrefix:"".concat(o,"[rules][").concat(n,"]"),onChange:function(t){return e.updateRule(n,t)},onRemove:function(){return e.onRemoveRule(n)}},t))})),a.a.createElement("div",{className:"audience-editor__group-footer"},a.a.createElement(ee,{className:"audience-editor__group-rule-add",isSecondary:!0,onClick:this.onAddRule},Q("Add a rule","altis-analytics")),n&&a.a.createElement(ee,{className:"audience-editor__group-remove",isDestructive:!0,isLink:!0,onClick:l},Q("Remove group","altis-analytics"))))}}]),t}(r.Component);function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ae(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},r=n.props.audience;n.props.onChange(ae({},r,{groups:[].concat(j()(r.groups.slice(0,e)),[ae({},r.groups[e],{},t)],j()(r.groups.slice(e+1)))}))})),w()(y()(n),"onRemoveGroup",(function(e){var t=n.props.audience;n.props.onChange(ae({},t,{groups:[].concat(j()(t.groups.slice(0,e)),j()(t.groups.slice(e+1)))}))})),n}return v()(t,e),u()(t,[{key:"render",value:function(){var e=this,t=this.props.audience;return a.a.createElement(ce,{className:"audience-editor"},a.a.createElement("div",{className:"audience-editor__include"},a.a.createElement(X,{label:oe("groups","altis-analytics"),name:"audience[include]",value:t.include,onChange:this.onChangeInclude})),t.groups.map((function(n,r){return a.a.createElement(ne,S()({key:r,canRemove:t.groups.length>1,namePrefix:"audience[groups][".concat(r,"]"),title:"".concat(oe("Group")," ").concat(r+1),onChange:function(t){return e.onUpdateGroup(r,t)},onRemove:function(){return e.onRemoveGroup(r)}},n))})),a.a.createElement(se,{className:"audience-editor__group-add",isSecondary:!0,onClick:this.onAddGroup},oe("Add a group","altis-analytics")))}}]),t}(r.Component);le.defaultProps={audience:_.a,fields:[],onChange:function(){}};var ue=n(51);function fe(){var e=E()(["\n\tcircle {\n\t\tfill: transparent;\n\t\tstroke: ",";\n\t\tstroke-linecap: round;\n\t\tstroke-opacity: 0.2;\n\t\tstroke-dasharray: 101 100;\n\t\tstroke-dashoffset: 0;\n\t\tstroke-width: 3;\n\t\ttransform: rotate(-90deg);\n\t\ttransform-origin: center;\n\t\ttransition: stroke-dasharray 0.3s ease-in-out;\n\t}\n\tcircle[data-percent] {\n\t\tstroke-dasharray: "," 100;\n\t\tstroke-opacity: 1;\n\t}\n\ttext {\n\t\tstroke-width: 0;\n\t\tfont-size: 9px;\n\t}\n"]);return fe=function(){return e},e}var de=k.b.svg(fe(),(function(e){return e.stroke||"rgb(0, 124, 186)"}),(function(e){return 100===e.percent?101:e.percent}));function pe(e){var t=e.isLoading,n=e.percent;return a.a.createElement(de,S()({viewBox:"0 0 36 36"},e),a.a.createElement("circle",{cx:"18",cy:"18",r:"16"}),a.a.createElement("circle",{cx:"18",cy:"18","data-percent":!0,r:"16"}),a.a.createElement("text",{textAnchor:"middle",x:"18",y:"21"},t?"…":"".concat(n,"%")))}function he(){var e=E()(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin: 0;\n\n\t.audience-estimate__title {\n\t\tflex: 0 0 100%;\n\t\tmargin: 0 0 20px;\n\t}\n\n\t.audience-estimate__percentage {\n\t\tflex: 0 1 100px;\n\t\tmargin-right: 20px;\n\t\tmax-width: 5.5rem;\n\t}\n\n\t.audience-estimate__sparkline,\n\t.audience-estimate__percentage {\n\t\topacity: ",";\n\t\ttransition: opacity ease-in-out .3s;\n\t}\n\n\t.audience-estimate__totals {\n\t\tflex: 2;\n\t}\n\n\t.audience-estimate__totals svg {\n\t\tmax-width: 220px;\n\t\tmargin-top: 5px;\n\t\tmargin-bottom: 10px;\n\t}\n\n\t.audience-estimate__totals p {\n\t\tmargin: 0;\n\t}\n\n\t.audience-estimate__totals strong {\n\t\tmargin-right: 2px;\n\t}\n"]);return he=function(){return e},e}pe.defaultProps={isLoading:!1,percent:0};var me=wp.data.useSelect,ye=wp.i18n.__,ge=k.b.div(he(),(function(e){return e.isLoading?.7:1}));function ve(e){var t=e.estimate,n=e.showTotals,r=e.sparkline,i=e.title;if(!t)return null;var o=t.total?Math.round(t.count/t.total*100):0;return a.a.createElement(ge,S()({className:"audience-estimate"},e,{isLoading:t.isLoading}),i&&a.a.createElement("h3",{className:"audience-estimate__title"},i),a.a.createElement(pe,{className:"audience-estimate__percentage",isLoading:t.isLoading,percent:t.isLoading?0:o}),a.a.createElement("div",{className:"audience-estimate__totals"},r&&a.a.createElement(ue.Sparklines,{className:"audience-estimate__sparkline",data:t.histogram.map((function(e){return e.count})),preserveAspectRatio:"xMidYMid meet"},a.a.createElement(ue.SparklinesLine,{color:"rgb(0, 124, 186)",style:{strokeWidth:5}})),n&&a.a.createElement("p",{className:"audience-estimate__count"},t.isLoading&&a.a.createElement("span",null,ye("Loading estimate","altis-analytics"),"…"),!t.isLoading&&a.a.createElement(a.a.Fragment,null,a.a.createElement("strong",null,t.count)," ",a.a.createElement("span",null,ye("uniques in the last 7 days","altis-analytics"))))))}function be(e){var t=e.audience,n=me((function(e){return e("audience").getEstimate(t)}),[t]);return t?a.a.createElement(ve,S()({},e,{estimate:n})):null}ve.defaultProps={audience:null,estimate:null,showTotals:!0,sparkline:!1,title:""};var we=wp.components.ToggleControl,xe=wp.i18n.__,Ee=function(e){var t=e.disabled,n=e.status,r=e.onChange,i=xe("publish"===n?"Audience is active":"Audience is inactive","altis-analytics");return a.a.createElement(we,{checked:"publish"===n,disabled:t,help:i,label:xe("Active","altis-analytics"),onChange:r})};function ke(){var e=E()(["\n\tmargin: 20px 0;\n\n\t.components-notice {\n\t\tmargin: 0 0 20px;\n\t}\n\n\t.audience-settings {\n\t\tdisplay: flex;\n\t}\n\n\t.audience-settings > * {\n\t\tflex: 1;\n\t}\n\n\t.audience-options {\n\t\tflex: 0 1 320px;\n\t\tmargin: 20px 0 20px 40px;\n\t}\n\n\t.audience-estimate {\n\t\tmargin-bottom: 40px;\n\t}\n"]);return ke=function(){return e},e}var _e=wp.compose.compose,Oe=wp.data,Se=Oe.withSelect,Ce=Oe.withDispatch,je=wp.htmlEntities.decodeEntities,Ae=wp.i18n.__,Pe=wp.components,Me=Pe.Button,Ne=Pe.Notice,Re=Pe.Spinner,Te=k.b.div(ke()),Ie=function(e){function t(){var e,n;c()(this,t);for(var r=arguments.length,a=new Array(r),i=0;i{let n,r=1;if(Fe(e))n=e;else{if(!Ge.call(e,"name"))throw new Error(`Missing ${"name"} property in key`);if(n=e.name,Ge.call(e,"weight")&&(r=e.weight,r<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(n))}this._keyNames.push(n),this._keys[n]={weight:r},t+=r}),this._keyNames.forEach(e=>{this._keys[e].weight/=t})}get(e,t){return this._keys[e]&&this._keys[e][t]}keys(){return this._keyNames}toJSON(){return JSON.stringify(this._keys)}}var qe={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx{if(t){const i=t.indexOf(".");let o=t,s=null;-1!==i&&(o=t.slice(0,i),s=t.slice(i+1));const c=e[o];if(!Ue(c))return;if(s||!Fe(c)&&!ze(c))if(De(c)){r=!0;for(let e=0,t=c.length;e{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){const t=this.size();Fe(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t{let a=this.getFn(e,t);if(Ue(a))if(De(a)){let e=[];const t=[{nestedArrIndex:-1,value:a}];for(;t.length;){const{nestedArrIndex:n,value:r}=t.pop();if(Ue(r))if(Fe(r)&&!Be(r)){let t={v:r,i:n,n:this.norm.get(r)};e.push(t)}else De(r)&&r.forEach((e,n)=>{t.push({nestedArrIndex:n,value:e})})}n.$[r]=e}else if(!Be(a)){let e={v:a,n:this.norm.get(a)};n.$[r]=e}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Ye(e,t,{getFn:n=qe.getFn}={}){let r=new Ve({getFn:n});return r.setKeys(e),r.setCollection(t),r.create(),r}function Xe(e,t){const n=e.matches;t.matches=[],Ue(n)&&n.forEach(e=>{if(!Ue(e.indices)||!e.indices.length)return;const{indices:n,value:r}=e;let a={indices:n,value:r};e.key&&(a.key=e.key),e.idx>-1&&(a.refIndex=e.idx),t.matches.push(a)})}function Ke(e,t){t.score=e.score}function Je(e,{errors:t=0,currentLocation:n=0,expectedLocation:r=0,distance:a=qe.distance}={}){const i=t/e.length,o=Math.abs(r-n);return a?i+o/a:o?1:i}function Ze(e,t,n,{location:r=qe.location,distance:a=qe.distance,threshold:i=qe.threshold,findAllMatches:o=qe.findAllMatches,minMatchCharLength:s=qe.minMatchCharLength,includeMatches:c=qe.includeMatches}={}){if(t.length>32)throw new Error(`Pattern length exceeds max of ${32}.`);const l=t.length,u=e.length,f=Math.max(0,Math.min(r,u));let d=i,p=f;const h=[];if(c)for(let e=0;e-1;){let e=Je(t,{currentLocation:m,expectedLocation:f,distance:a});if(d=Math.min(e,d),p=m+l,c){let e=0;for(;e=m;i-=1){let o=i-1,s=n[e.charAt(o)];if(s&&c&&(h[o]=1),x[i]=(x[i+1]<<1|1)&s,0!==r&&(x[i]|=(y[i+1]|y[i])<<1|1|y[i+1]),x[i]&b&&(g=Je(t,{errors:r,currentLocation:o,expectedLocation:f,distance:a}),g<=d)){if(d=g,p=o,p<=f)break;m=Math.max(1,2*f-p)}}if(Je(t,{errors:r+1,currentLocation:f,expectedLocation:f,distance:a})>d)break;y=x}let w={isMatch:p>=0,score:Math.max(.001,g)};return c&&(w.indices=function(e=[],t=qe.minMatchCharLength){let n=[],r=-1,a=-1,i=0;for(let o=e.length;i=t&&n.push([r,a]),r=-1)}return e[i-1]&&i-r>=t&&n.push([r,i-1]),n}(h,s)),w}function Qe(e){let t={},n=e.length;for(let r=0;r{const{isMatch:p,score:h,indices:m}=Ze(e,t,f,{location:r+32*d,distance:a,threshold:i,findAllMatches:o,minMatchCharLength:s,includeMatches:n});p&&(u=!0),l+=h,p&&m&&(c=[...c,...m])});let f={isMatch:u,score:u?l/this.chunks.length:1};return u&&n&&(f.indices=c),f}}class tt{constructor(e){this.pattern=e}static isMultiMatch(e){return nt(e,this.multiRegex)}static isSingleMatch(e){return nt(e,this.singleRegex)}search(){}}function nt(e,t){const n=e.match(t);return n?n[1]:null}class rt extends tt{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,n=0;const r=[],a=this.pattern.length;for(;(t=e.indexOf(this.pattern,n))>-1;)n=t+a,r.push([t,n-1]);const i=!!r.length;return{isMatch:i,score:i?1:0,indices:r}}}class at extends tt{constructor(e,{location:t=qe.location,threshold:n=qe.threshold,distance:r=qe.distance,includeMatches:a=qe.includeMatches,findAllMatches:i=qe.findAllMatches,minMatchCharLength:o=qe.minMatchCharLength,isCaseSensitive:s=qe.isCaseSensitive}={}){super(e),this._bitapSearch=new et(e,{location:t,threshold:n,distance:r,includeMatches:a,findAllMatches:i,minMatchCharLength:o,isCaseSensitive:s})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}const it=[rt,class extends tt{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends tt{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends tt{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends tt{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends tt{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},at],ot=it.length,st=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;const ct=new Set([at.type,rt.type]);class lt{constructor(e,{isCaseSensitive:t=qe.isCaseSensitive,includeMatches:n=qe.includeMatches,minMatchCharLength:r=qe.minMatchCharLength,findAllMatches:a=qe.findAllMatches,location:i=qe.location,threshold:o=qe.threshold,distance:s=qe.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:n,minMatchCharLength:r,findAllMatches:a,location:i,threshold:o,distance:s},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map(e=>{let n=e.trim().split(st).filter(e=>e&&!!e.trim()),r=[];for(let e=0,a=n.length;e!(!e[dt]&&!e[pt]),mt=e=>({[dt]:Object.keys(e).map(t=>({[t]:e[t]}))});function yt(e,t,{auto:n=!0}={}){const r=e=>{let a=Object.keys(e);if(a.length>1&&!ht(e))return r(mt(e));let i=a[0];if((e=>!De(e)&&"object"==typeof e&&!ht(e))(e)){const r=e[i];if(!Fe(r))throw new Error((e=>"Invalid value for key "+e)(i));const a={key:i,pattern:r};return n&&(a.searcher=ft(r,t)),a}let o={children:[],operator:i};return a.forEach(t=>{const n=e[t];De(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return ht(e)||(e=mt(e)),r(e)}class gt{constructor(e,t={},n){this.options={...qe,...t},this.options.useExtendedSearch,this._keyStore=new We(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Ve))throw new Error("Incorrect 'index' type");this._myIndex=t||Ye(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}add(e){Ue(e)&&(this._docs.push(e),this._myIndex.add(e))}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:a,sortFn:i}=this.options;let o=Fe(e)?Fe(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,t){e.forEach(e=>{let n=1;e.matches.forEach(({key:e,norm:r,score:a})=>{const i=t.get(e,"weight");n*=Math.pow(0===a&&i?Number.EPSILON:a,(i||1)*r)}),e.score=n})}(o,this._keyStore),a&&o.sort(i),ze(t)&&t>-1&&(o=o.slice(0,t)),function(e,t,{includeMatches:n=qe.includeMatches,includeScore:r=qe.includeScore}={}){const a=[];n&&a.push(Xe);r&&a.push(Ke);return e.map(e=>{const{idx:n}=e,r={item:t[n],refIndex:n};return a.length&&a.forEach(t=>{t(e,r)}),r})}(o,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){const t=ft(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:e,i:n,n:a})=>{if(!Ue(e))return;const{isMatch:i,score:o,indices:s}=t.searchIn(e);i&&r.push({item:e,idx:n,matches:[{score:o,value:e,norm:a,indices:s}]})}),r}_searchLogical(e){const t=yt(e,this.options),{keys:n,records:r}=this._myIndex,a={},i=[],o=(e,t,r)=>{if(!e.children){const{key:r,searcher:a}=e,i=t[n.indexOf(r)];return this._findMatches({key:r,value:i,searcher:a})}{const n=e.operator;let s=[];for(let a=0;a{a[r].matches.push(...e)}))}};return r.forEach(({$:e,i:n})=>{Ue(e)&&o(t,e,n)}),i}_searchObjectList(e){const t=ft(e,this.options),{keys:n,records:r}=this._myIndex,a=[];return r.forEach(({$:e,i:r})=>{if(!Ue(e))return;let i=[];n.forEach((n,r)=>{i.push(...this._findMatches({key:n,value:e[r],searcher:t}))}),i.length&&a.push({idx:r,item:e,matches:i})}),a}_findMatches({key:e,value:t,searcher:n}){if(!Ue(t))return[];let r=[];if(De(t))t.forEach(({v:t,i:a,n:i})=>{if(!Ue(t))return;const{isMatch:o,score:s,indices:c}=n.searchIn(t);o&&r.push({score:s,key:e,value:t,idx:a,norm:i,indices:c})});else{const{v:a,n:i}=t,{isMatch:o,score:s,indices:c}=n.searchIn(a);o&&r.push({score:s,key:e,value:a,norm:i,indices:c})}return r}}gt.version="6.0.0",gt.createIndex=Ye,gt.parseIndex=function(e,{getFn:t=qe.getFn}={}){const{keys:n,records:r}=e;let a=new Ve({getFn:t});return a.setKeys(n),a.setRecords(r),a},gt.config=qe,gt.parseQuery=yt,function(...e){ut.push(...e)}(lt);var vt=gt,bt=n(42),wt=wp.data,xt=wt.useSelect,Et=wt.useDispatch,kt=wp.components.Button,_t=wp.i18n.sprintf,Ot=function(e){var t=e.children,n=void 0===t?null:t,r=e.className,i=void 0===r?"":r,o=e.label,s=e.post,c=e.onClick;return a.a.createElement(kt,{"aria-label":_t(o,s.title.rendered),className:i,isLink:!0,onClick:function(e){e.preventDefault(),c(s)}},n||s.title.rendered)};function St(){var e=E()(["\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: center;\n\n\t.audience-sort-order {\n\t\t&__number {\n\t\t\tfont-weight: bold;\n\t\t\tflex: 1;\n\t\t}\n\t\t&__controls {\n\t\t\tflex: 1;\n\t\t\tbutton {\n\t\t\t\tpadding: 3px;\n\t\t\t}\n\t\t}\n\t\t&__up {\n\t\t\tmargin-bottom: 2px;\n\t\t}\n\t}\n"]);return St=function(){return e},e}var Ct=wp.components.IconButton,jt=wp.i18n.__,At=k.b.span(St()),Pt=function(e){var t=e.canMoveDown,n=e.canMoveUp,r=e.index,i=e.onMoveDown,o=e.onMoveUp;return a.a.createElement(At,{className:"audience-sort-order"},a.a.createElement("span",{className:"audience-sort-order__number"},r+1),a.a.createElement("span",{className:"audience-sort-order__controls"},a.a.createElement(Ct,{className:"audience-sort-order__up",disabled:!n,icon:"arrow-up-alt2",label:jt("Move up","altis-analytics"),onClick:o}),a.a.createElement(Ct,{className:"audience-sort-order__down",disabled:!t,icon:"arrow-down-alt2",label:jt("Move down","altis-analytics"),onClick:i})))},Mt=wp.components.Button,Nt=wp.htmlEntities.decodeEntities,Rt=wp.i18n.__,Tt=function(e){var t,n=e.canMoveDown,i=e.canMoveUp,o=e.index,s=e.post,c=e.onMoveDown,l=e.onMoveUp,u=e.onClick,f=e.onEdit,d=e.onSelect,p=!!d,h="publish"===s.status,m=(t=s.id,xt((function(e){return e("core").canUser("update","audiences",t)}),[t])),y=function(e){return xt((function(t){return t("core").canUser("delete","audiences",e)}),[e])}(s.id),g=Et("audience").deletePost,v=Et("audience").updatePost,b=function(){window.confirm(Rt("Are you sure you want to delete this audience?","altis-anlaytics"))&&g(s.id)},w=function(e){return a.a.createElement(Ot,S()({label:Rt("Edit “%s”"),post:s,onClick:f},e))},x=Nt(s.title.rendered||Rt("(no title)","altis-analytics"));return a.a.createElement("tr",{className:"audience-row audience-row--".concat(h?"active":"inactive"),onClick:u},a.a.createElement("td",null,a.a.createElement(Pt,{canMoveDown:n,canMoveUp:i,index:o,onMoveDown:c,onMoveUp:l})),a.a.createElement("td",null,!m&&a.a.createElement("span",{className:"row-title"},a.a.createElement("strong",null,x)),m&&a.a.createElement(w,{className:"row-title"},a.a.createElement("strong",null,x)),a.a.createElement("div",{className:"row-actions"},m&&a.a.createElement("span",{className:"edit"},a.a.createElement(w,null,Rt("Edit"))),y&&a.a.createElement(r.Fragment,null," | ",a.a.createElement("span",{className:"trash"},a.a.createElement((function(e){return a.a.createElement(Ot,S()({className:"is-destructive",label:Rt("Move “%s” to the Trash"),post:s,onClick:b},e))}),null,Rt("Trash")))))),a.a.createElement("td",null,m&&a.a.createElement(Ee,{status:s.status,onChange:function(){return v({id:s.id,status:"publish"===s.status?"draft":"publish"})}}),!m&&a.a.createElement("span",{className:"active"},"publish"===s.status?Rt("Active","altis-analytics"):Rt("Inactive","altis-analytics"))),a.a.createElement("td",null,a.a.createElement(ve,{estimate:s.estimate})),p&&a.a.createElement("td",null,h&&a.a.createElement(Mt,{className:"button",onClick:function(){return d(s)}},Rt("Select","altis-analytics"))))};Tt.defaultProps={onClick:function(){}};var It=Tt,Lt=wp.i18n.__,$t=function(e){return a.a.createElement("tr",null,a.a.createElement("th",{className:"manage-column column-order",scope:"col"},Lt("Priority","altis-analytics")),a.a.createElement("th",{className:"manage-column column-title column-primary",scope:"col"},Lt("Title","altis-analytics")),a.a.createElement("th",{className:"manage-column column-active",scope:"col"},Lt("Status","altis-analytics")),a.a.createElement("th",{className:"manage-column column-estimate",scope:"col"},Lt("Size","altis-analytics")),e.isSelectMode&&a.a.createElement("th",{className:"manage-column column-select",scope:"col"}," "))},Dt=function(){return(Dt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0)return;r=r.parentNode}while(a++<4);e.stopPropagation(),n.props.onSelect&&n.props.onSelect(t)}})),w()(y()(n),"onMove",(function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up",a=e[t],i="up"===r?-1:1;n.props.onUpdatePost({id:a.id,menu_order:a.menu_order+i}),n.props.onUpdatePost({id:e[t+i].id,menu_order:a.menu_order})})),w()(y()(n),"onNextPage",(function(){var e=n.state,t=e.page,r=e.search;n.props.onGetPosts({page:t+1,search:r,context:n.props.canCreate?"edit":"view",status:n.props.canCreate?"publish,draft":"publish"}),n.setState({page:t+1})})),n}return v()(t,e),u()(t,[{key:"componentDidCatch",value:function(e,t){console.error(e,t)}},{key:"render",value:function(){var e=this,t=this.props,n=t.canCreate,i=t.loading,o=t.pagination,s=t.posts,c=t.onEdit,l=t.onSelect,u=this.state,f=u.error,d=u.search,p=s.filter((function(e){return!e.error&&"trash"!==e.status})),h=en(p),m=d?h.search(d).map((function(e){return e.item})):p,y=m&&m.length>0&&l;return a.a.createElement(nn,{className:"audience-listing",selectMode:y},f&&a.a.createElement(Qt,{isDismissable:!0,status:"error",onRemove:function(){return e.setState({error:null})}},f.toString()),a.a.createElement("div",{className:"audience-list__search-box"},a.a.createElement("label",{className:"screen-reader-text",htmlFor:"audience-search-input"},Kt("Search Audiences","altis-analytics")),a.a.createElement("input",{id:"audience-search-input",name:"s",placeholder:Kt("Search Audiences","altis-analytics"),type:"search",value:d,onChange:this.onSearch})),a.a.createElement("table",{className:"wp-list-table widefat fixed striped posts"},a.a.createElement("thead",null,a.a.createElement($t,{isSelectMode:y})),a.a.createElement("tbody",null,!i&&0===m.length&&a.a.createElement("tr",{className:"audience-row audience-row--no-results"},a.a.createElement("td",{colSpan:y?5:4},Kt("No audiences were found","altis-analytics"),d.length>0&&" ".concat(Kt("for that search term","altis-analytics")),". ",n&&a.a.createElement(Zt,{isLink:!0,onClick:function(){return c()}},Kt("Create a new audience.")))),m.length>0&&m.map((function(t,r){return a.a.createElement(It,{key:t.id,canMoveDown:n&&m[r+1],canMoveUp:n&&m[r-1],index:r,post:t,onClick:function(n){return e.onSelectRow(n,t)},onEdit:c,onMoveDown:function(){return e.onMove(m,r,"down")},onMoveUp:function(){return e.onMove(m,r,"up")},onSelect:l})})),!i&&o.total>m.length&&a.a.createElement("tr",{className:"audience-row audience-row--load-more"},a.a.createElement("td",{colSpan:y?5:4},a.a.createElement(Zt,{className:"button",onClick:this.onNextPage},Kt("Load more audiences","altis-analytics")))),i&&a.a.createElement(r.Fragment,null,a.a.createElement(Gt,null),a.a.createElement(Gt,null),a.a.createElement(Gt,null))),a.a.createElement("tfoot",null,a.a.createElement($t,{isSelectMode:y}))))}}],[{key:"getDerivedStateFromError",value:function(e){return{error:e}}}]),t}(r.Component);rn.defaultProps={canCreate:!1,loading:!1,pagination:{total:0,pages:0},posts:[],onGetPosts:function(){},onUpdatePost:function(){}};var an=Ht(Yt((function(e){var t=e("audience"),n=t.getPosts,r=t.getIsLoading,a=t.getPagination,i=e("core").canUser("create","audiences");return{canCreate:i,loading:r(),pagination:a(),posts:n({context:i?"edit":"view",status:i?"publish,draft":"publish"}),onGetPosts:n}})),Xt((function(e){return{onUpdatePost:e("audience").updatePost}})))(rn);function on(){var e=E()(["\n\tmargin-right: 20px;\n\n\t.wp-heading-inline {\n\t\tdisplay: inline-block;\n\t\tvertical-align: middle;\n\t}\n\t&& .page-title-action {\n\t\tmargin-left: 10px;\n\t}\n\t.wp-header-end {\n\t\tmargin-bottom: 14px;\n\t}\n"]);return on=function(){return e},e}var sn=wp.data,cn=sn.withSelect,ln=sn.withDispatch,un=wp.components.Button,fn=wp.compose.compose,dn=wp.i18n.__,pn=k.b.div(on()),hn=function(e){function t(e){var n;return c()(this,t),(n=d()(this,h()(t).call(this,e))).state={view:"list"},n.actionRef=Object(r.createRef)(),n}return v()(t,e),u()(t,[{key:"render",value:function(){var e=this,t=this.props,n=t.canCreate,r=t.onSelect,i=t.onSetCurrentPost,o=this.state.view,s={list:{title:dn("Audiences","altis-analytics"),action:{permission:n,label:dn("Add New","altis-analytics"),onClick:function(){i(_.c),e.setState({view:"edit"})}},body:function(){return a.a.createElement(an,{onEdit:function(t){i(t||_.c),e.setState({view:"edit"})},onSelect:r})}},edit:{title:dn("Edit Audience","altis-analytics"),action:{permission:!0,label:dn("Back to Audiences","altis-analytics"),onClick:function(){return e.setState({view:"list"})}},body:function(){return a.a.createElement($e,{onSelect:r})}}}[o],c=s.body;return a.a.createElement(pn,{className:"altis-audience-manager"},a.a.createElement("header",{className:"altis-audience-manager__header"},a.a.createElement("h1",{className:"wp-heading-inline"},s.title),s.action.permission&&a.a.createElement(un,{ref:this.actionRef,className:"page-title-action",isPrimary:!0,onClick:function(){s.action.onClick(),e.actionRef.current.blur()}},s.action.label),a.a.createElement("hr",{className:"wp-header-end"})),a.a.createElement(c,null))}}]),t}(r.Component);hn.defaultProps={canCreate:!1,onSelect:null};var mn=fn(cn((function(e){return{canCreate:(0,e("core").canUser)("create","audiences")}})),ln((function(e){return{onSetCurrentPost:e("audience").setCurrentPost}})))(hn),yn=n(43);function gn(){var e=E()(["\n\t.audience-select__label {\n\t\tdisplay: block;\n\t\tmargin-bottom: 4px;\n\t}\n\t.audience-select__controls {\n\t\tmargin-left: -3px;\n\t\tdisplay: flex;\n\n\t\tbutton {\n\t\t\tpadding-left: 0;\n\t\t\tpadding-right: 0;\n\t\t\ttext-align: left;\n\n\t\t\t&:not(:disabled):not([aria-disabled=true]):not(.is-secondary):not(.is-primary):not(.is-tertiary):not(.is-link):hover,\n\t\t\t&:not(:disabled):not([aria-disabled=true]):not(.is-secondary):not(.is-primary):not(.is-tertiary):not(.is-link):focus {\n\t\t\t\tbox-shadow: none;\n\t\t\t}\n\n\t\t\tstrong {\n\t\t\t\t&:hover, &:focus {\n\t\t\t\t\ttext-decoration: underline;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t.dashicon {\n\t\t\tmargin-right: 3px;\n\t\t}\n\t}\n\t.audience-select__clear {\n\t\tmargin-left: -2px;\n\t\tmargin-right: 5px;\n\t\tmin-width: 0;\n\n\t\t&:hover, &:focus {\n\t\t\tcolor: #d94f4f;\n\t\t}\n\n\t\t&:hover svg, &:focus svg {\n\t\t\tfill: #d94f4f;\n\t\t}\n\t}\n"]);return gn=function(){return e},e}function vn(){var e=E()(["\n\t.altis-audience-manager {\n\t\tmargin: 20px;\n\n\t\t&__header {\n\t\t\tposition: fixed;\n\t\t\tleft: 50px;\n\t\t\ttop: 30px;\n\t\t\tz-index: 10;\n\n\t\t\t@media only screen and (max-width: 640px), screen and (max-height: 400px) {\n\t\t\t\tleft: 20px;\n\t\t\t\ttop: 0;\n\t\t\t}\n\n\t\t\th1 {\n\t\t\t\tvertical-align: middle;\n\t\t\t}\n\t\t}\n\t}\n\t.altis-audience-manager table {\n\t\twidth: 100%;\n\t}\n"]);return vn=function(){return e},e}var bn=wp.components,wn=bn.IconButton,xn=bn.Spinner,En=wp.compose.compose,kn=wp.data.withSelect,_n=wp.htmlEntities.decodeEntities,On=wp.i18n.__,Sn=Object(k.b)(yn.a)(vn()),Cn=k.b.div(gn()),jn=function(e){function t(){var e,n;c()(this,t);for(var r=arguments.length,a=new Array(r),i=0;ir&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(m,"$1"+e.trim());case 58:return e.trim()+t.replace(m,"$1"+e.trim());default:if(0<1*n&&0c.charCodeAt(8))break;case 115:o=o.replace(c,"-webkit-"+c)+";"+o;break;case 207:case 102:o=o.replace(c,"-webkit-"+(102s.charCodeAt(0)&&(s=s.trim()),s=[s],0p)&&(F=(B=B.replace(" ",":")).length),01?t-1:0),r=1;r0?" Additional arguments: "+n.join(", "):""))}var _=function(e){var t=document.head,n=e||t,r=document.createElement("style"),a=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(b))return r}}(n),i=void 0!==a?a.nextSibling:null;r.setAttribute(b,"active"),r.setAttribute("data-styled-version","5.0.1");var o=E();return o&&r.setAttribute("nonce",o),n.insertBefore(r,i),r},O=function(){function e(e){var t=this.element=_(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,a=r;e>=a;)(a<<=1)<0&&k(16,""+e);this.groupSizes=new Uint32Array(a),this.groupSizes.set(n),this.length=a;for(var i=r;i=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),a=r+n,i=r;i=M&&(M=t+1),A.set(e,t),P.set(t,e)},I="style["+b+'][data-styled-version="5.0.1"]',L=/(?:\s*)?(.*?){((?:{[^}]*}|(?!{).*?)*)}/g,$=new RegExp("^"+b+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\]'),D=function(e,t,n){for(var r,a=n.split(","),i=0,o=a.length;i0&&(l+=e+",")})),r+=""+s+c+'{content:"'+l+'"}\n'}}}return r}(this)},e}(),G=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},W=function(e){return G(5381,e)};var q=/^\s*\/\/.*$/gm;function H(e){var t,n,r,a=void 0===e?m:e,i=a.options,s=void 0===i?m:i,c=a.plugins,l=void 0===c?h:c,u=new o.a(s),f=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,a,i,o,s,c,l,u,f){switch(n){case 1:if(0===u&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(a[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),p=function(e,r,a){return r>0&&-1!==a.slice(0,r).indexOf(n)&&a.slice(r-n.length,r)!==n?"."+t:e};function y(e,a,i,o){void 0===o&&(o="&");var s=e.replace(q,""),c=a&&i?i+" "+a+" { "+s+" }":s;return t=o,n=a,r=new RegExp("\\"+n+"\\b","g"),u(i||!a?"":a,c)}return u.use([].concat(l,[function(e,t,a){2===e&&a.length&&a[0].lastIndexOf(n)>0&&(a[0]=a[0].replace(r,p))},d,function(e){if(-2===e){var t=f;return f=[],t}}])),y.hash=l.length?l.reduce((function(e,t){return t.name||k(15),G(e,t.name)}),5381).toString():"",y}var V=i.a.createContext(),Y=(V.Consumer,i.a.createContext()),X=(Y.Consumer,new B),K=H();function J(){return Object(a.useContext)(V)||X}function Z(){return Object(a.useContext)(Y)||K}var Q=function(){function e(e,t){var n=this;this.inject=function(e){e.hasNameForId(n.id,n.name)||e.insertRules(n.id,n.name,K.apply(void 0,n.stringifyArgs))},this.toString=function(){return k(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.stringifyArgs=t}return e.prototype.getName=function(){return this.name},e}(),ee=/([A-Z])/g,te=/^ms-/;function ne(e){return e.replace(ee,"-$1").toLowerCase().replace(te,"-ms-")}var re=function(e){return null==e||!1===e||""===e},ae=function e(t,n){var r=[];return Object.keys(t).forEach((function(n){if(!re(t[n])){if(p(t[n]))return r.push.apply(r,e(t[n],n)),r;if(y(t[n]))return r.push(ne(n)+":",t[n],";"),r;r.push(ne(n)+": "+(a=n,(null==(i=t[n])||"boolean"==typeof i||""===i?"":"number"!=typeof i||0===i||a in s.a?String(i).trim():i+"px")+";"))}var a,i;return r})),n?[n+" {"].concat(r,["}"]):r};function ie(e,t,n){if(Array.isArray(e)){for(var r,a=[],i=0,o=e.length;i1?t-1:0),r=1;r1?t-1:0),r=1;r25?39:97))};function pe(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=de(t%52)+n;return(de(t%52)+n).replace(fe,"$1-$2")}function he(e){for(var t=0;t>>0);if(!t.hasNameForId(r,i)){var o=n(a,"."+i,void 0,r);t.insertRules(r,i,o)}return this.staticRulesId=i,i}for(var s=this.rules.length,c=G(this.baseHash,n.hash),l="",u=0;u>>0);if(!t.hasNameForId(r,h)){var m=n(l,"."+h,void 0,r);t.insertRules(r,h,m)}return h},e}(),ye=(new Set,function(e,t,n){return void 0===n&&(n=m),e.theme!==n.theme&&e.theme||t||n.theme}),ge=/[[\].#*$><+~=|^:(),"'`-]+/g,ve=/(^-|-$)/g;function be(e){return e.replace(ge,"-").replace(ve,"")}function we(e){return"string"==typeof e&&!0}var xe=function(e){return pe(W(e)>>>0)};var Ee=i.a.createContext();Ee.Consumer;var ke={};function _e(e,t,n){var r=e.attrs,i=e.componentStyle,o=e.defaultProps,s=e.foldedComponentIds,l=e.styledComponentId,u=e.target;Object(a.useDebugValue)(l);var d=function(e,t,n){void 0===e&&(e=m);var r=f({},t,{theme:e}),a={};return n.forEach((function(e){var t,n,i,o=e;for(t in y(o)&&(o=o(r)),o)r[t]=a[t]="className"===t?(n=a[t],i=o[t],n&&i?n+" "+i:n||i):o[t]})),[r,a]}(ye(t,Object(a.useContext)(Ee),o)||m,t,r),p=d[0],h=d[1],g=function(e,t,n,r){var i=J(),o=Z(),s=e.isStatic&&!t?e.generateAndInjectStyles(m,i,o):e.generateAndInjectStyles(n,i,o);return Object(a.useDebugValue)(s),s}(i,r.length>0,p),v=n,b=h.as||t.as||u,w=we(b),x=h!==t?f({},t,{},h):t,E=w||"as"in x||"forwardedAs"in x,k=E?{}:f({},x);if(E)for(var _ in x)"forwardedAs"===_?k.as=x[_]:"as"===_||"forwardedAs"===_||w&&!Object(c.a)(_)||(k[_]=x[_]);return t.style&&h.style!==t.style&&(k.style=f({},t.style,{},h.style)),k.className=Array.prototype.concat(s,l,g!==l?g:null,t.className,h.className).filter(Boolean).join(" "),k.ref=v,Object(a.createElement)(b,k)}function Oe(e,t,n){var r,a=v(e),o=!we(e),s=t.displayName,c=void 0===s?function(e){return we(e)?"styled."+e:"Styled("+g(e)+")"}(e):s,l=t.componentId,d=void 0===l?function(e,t){var n="string"!=typeof e?"sc":be(e);ke[n]=(ke[n]||0)+1;var r=n+"-"+xe(n+ke[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):l,p=t.attrs,m=void 0===p?h:p,y=t.displayName&&t.componentId?be(t.displayName)+"-"+t.componentId:t.componentId||d,b=a&&e.attrs?Array.prototype.concat(e.attrs,m).filter(Boolean):m,w=new me(a?e.componentStyle.rules.concat(n):n,y),x=function(e,t){return _e(r,e,t)};return x.displayName=c,(r=i.a.forwardRef(x)).attrs=b,r.componentStyle=w,r.displayName=c,r.foldedComponentIds=a?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):h,r.styledComponentId=y,r.target=a?e.target:e,r.withComponent=function(e){var r=t.componentId,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r=0||(a[n]=e[n]);return a}(t,["componentId"]),i=r&&r+"-"+(we(e)?e:be(g(e)));return Oe(e,f({},a,{attrs:b,componentId:i}),n)},Object.defineProperty(r,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=a?ue({},e.defaultProps,t):t}}),r.toString=function(){return"."+r.styledComponentId},o&&u()(r,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,self:!0,styledComponentId:!0,target:!0,withComponent:!0}),r}var Se=function(e){return function e(t,n,a){if(void 0===a&&(a=m),!Object(r.isValidElementType)(n))return k(1,String(n));var i=function(){return t(n,a,oe.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,f({},a,{},r))},i.attrs=function(r){return e(t,n,f({},a,{attrs:Array.prototype.concat(a.attrs,r).filter(Boolean)}))},i}(Oe,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Se[e]=Se(e)}));t.b=Se}).call(this,n(34))},30:function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1)for(var n=1;n1)for(var n=1;n1?t-1:0),r=1;r2?n-2:0),i=2;i0&&(m.width=i),s>0&&(m.height=s),o.default.createElement("svg",m,o.default.Children.map(this.props.children,(function(e){return o.default.cloneElement(e,{data:t,points:p,width:r,height:a,margin:l})})))}}]),t}(i.PureComponent);y.propTypes={data:a.default.array,limit:a.default.number,width:a.default.number,height:a.default.number,svgWidth:a.default.number,svgHeight:a.default.number,preserveAspectRatio:a.default.string,margin:a.default.number,style:a.default.object,min:a.default.number,max:a.default.number,onMouseMove:a.default.func},y.defaultProps={data:[],width:240,height:60,preserveAspectRatio:"none",margin:2},t.Sparklines=y,t.SparklinesLine=c.default,t.SparklinesCurve=l.default,t.SparklinesBars=u.default,t.SparklinesSpots=f.default,t.SparklinesReferenceLine=d.default,t.SparklinesNormalBand=p.default,t.SparklinesText=s.default},function(e,t,n){"use strict";(function(t){var r=n(4),a=n(5),i=n(8),o=n(6),s=n(15);e.exports=function(e,n){var c="function"==typeof Symbol&&Symbol.iterator,l={array:d("array"),bool:d("boolean"),func:d("function"),number:d("number"),object:d("object"),string:d("string"),symbol:d("symbol"),any:f(r.thatReturnsNull),arrayOf:function(e){return f((function(t,n,r,a,i){if("function"!=typeof e)return new u("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new u("Invalid "+a+" `"+i+"` of type `"+h(s)+"` supplied to `"+r+"`, expected an array.");for(var c=0;c>";return new u("Invalid "+a+" `"+i+"` of type `"+(((s=t[n]).constructor&&s.constructor.name?s.constructor.name:"<>")+"` supplied to `")+r+"`, expected instance of `"+o+"`.")}var s;return null}))},node:f((function(e,t,n,r,a){return p(e[t])?null:new u("Invalid "+r+" `"+a+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return f((function(t,n,r,a,i){if("function"!=typeof e)return new u("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[n],c=h(s);if("object"!==c)return new u("Invalid "+a+" `"+i+"` of type `"+c+"` supplied to `"+r+"`, expected an object.");for(var l in s)if(s.hasOwnProperty(l)){var f=e(s,l,r,a,i+"."+l,o);if(f instanceof Error)return f}return null}))},oneOf:function(e){return Array.isArray(e)?f((function(t,n,r,a,i){for(var o=t[n],s=0;s>",h=h||f,m!==o)if(n)a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var y=d+":"+f;!r[y]&&s<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",h,d),r[y]=!0,s++)}return null==l[f]?c?null===l[f]?new u("The "+p+" `"+h+"` is marked as required in `"+d+"`, but its value is `null`."):new u("The "+p+" `"+h+"` is marked as required in `"+d+"`, but its value is `undefined`."):null:e(l,f,d,p,h)}var l=c.bind(null,!1);return l.isRequired=c.bind(null,!0),l}function d(e){return f((function(t,n,r,a,i,o){var s=t[n];return h(s)!==e?new u("Invalid "+a+" `"+i+"` of type `"+m(s)+"` supplied to `"+r+"`, expected `"+e+"`."):null}))}function p(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(p);if(null===t||e(t))return!0;var n=function(e){var t=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!n)return!1;var r,a=n.call(t);if(n!==t.entries){for(;!(r=a.next()).done;)if(!p(r.value))return!1}else for(;!(r=a.next()).done;){var i=r.value;if(i&&!p(i[1]))return!1}return!0;default:return!1}}function h(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||"Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol}(t,e)?"symbol":t}function m(e){if(null==e)return""+e;var t=h(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function y(e){var t=m(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return u.prototype=Error.prototype,l.checkPropTypes=s,l.PropTypes=l,l}}).call(t,n(2))},function(e,t,n){"use strict";(function(t){if("production"!==t.env.NODE_ENV)var r=n(5),a=n(8),i=n(6),o={};e.exports=function(e,n,s,c,l){if("production"!==t.env.NODE_ENV)for(var u in e)if(e.hasOwnProperty(u)){var f;try{r("function"==typeof e[u],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",c||"React class",s,u),f=e[u](n,u,c,s,null,i)}catch(e){f=e}if(a(!f||f instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",c||"React class",s,u,typeof f),f instanceof Error&&!(f.message in o)){o[f.message]=!0;var d=l?l():"";a(!1,"Failed %s type: %s%s",s,f.message,null!=d?d:"")}}}}).call(t,n(2))},function(e,t,n){"use strict";var r=n(4),a=n(5),i=n(6);e.exports=function(){function e(e,t,n,r,o,s){s!==i&&a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n=2?Math.max(0,n[1].x-n[0].x-l-u):0);return i.default.createElement("g",{transform:"scale(1,-1)"},n.map((function(t,n){return i.default.createElement("rect",{key:n,x:t.x-(f+l)/2,y:-r,width:f,height:Math.max(0,r-t.y),style:a,onMouseMove:c&&c.bind(e,t)})})))}}]),t}(i.default.Component);l.propTypes={points:a.default.arrayOf(a.default.object),height:a.default.number,style:a.default.object,barWidth:a.default.number,margin:a.default.number,onMouseMove:a.default.func},l.defaultProps={style:{fill:"slategray"}},t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0?1:-1},e.length<2?0:Math.sign(e[e.length-2].y-e[e.length-1].y)}},{key:"render",value:function(){var e=this.props,t=e.points,n=(e.width,e.height,e.size),r=e.style,a=e.spotColors,o=i.default.createElement("circle",{cx:t[0].x,cy:t[0].y,r:n,style:r}),s=i.default.createElement("circle",{cx:t[t.length-1].x,cy:t[t.length-1].y,r:n,style:r||{fill:a[this.lastDirection(t)]}});return i.default.createElement("g",null,r&&o,s)}}]),t}(i.default.Component);l.propTypes={size:a.default.number,style:a.default.object,spotColors:a.default.object},l.defaultProps={size:2,spotColors:{"-1":"red",0:"black",1:"green"}},t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n1?1:0));return t.map((function(e,t){return{x:t*g+u,y:(d===h?1:d-e)*y+u}}))}}])},e.exports=r(n(0))},6:function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},8:function(e,t,n){var r=n(20),a=n(21),i=n(22);e.exports=function(e,t){return r(e)||a(e,t)||i()}},9:function(e,t,n){var r=n(30),a=n(31),i=n(32);e.exports=function(e){return r(e)||a(e)||i()}}})); \ No newline at end of file diff --git a/build/audiences/ui.b82af12b.js b/build/audiences/ui.b82af12b.js deleted file mode 100644 index e2c2a8b7..00000000 --- a/build/audiences/ui.b82af12b.js +++ /dev/null @@ -1,9 +0,0 @@ -!function(e,t){for(var n in t)e[n]=t[n]}(this,function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=window.Altis.Analytics.BuildURL,n(n.s=182)}({0:function(e,t){!function(){e.exports=this.React}()},11:function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},12:function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},13:function(e,t){function n(e,t){for(var n=0;n * + * {\n\t\tmargin-left: 5px;\n\t}\n\n\t.audience-editor__rule-operator,\n\tbutton {\n\t\tflex: none;\n\t}\n\n\tp.description {\n\t\twidth: 100%;\n\t\tmargin: 8px 0 0;\n\t}\n"]);return L=function(){return e},e}var $=wp.components.Button,D=wp.data.useSelect,F=wp.i18n,z=F.sprintf,U=F.__,B=k.b.div(L()),G=k.b.div(I()),W=function(e){var t=e.disabled,n=e.currentField,i=e.name,o=e.operator,s=e.value,c=e.onChange,l=n.data&&n.data.map((function(e){return e.value}))||[],u=Object(r.useRef)(null),f=Object(r.useRef)(null),d=""===s||l.indexOf(s)>=0,p=Object(r.useState)(d),h=P()(p,2),m=h[0],y=h[1];Object(r.useEffect)((function(){m?f&&f.current&&f.current.focus():u&&u.current&&u.current.focus()}),[m]);var g=Object(r.useState)(null),v=P()(g,2),b=v[0],w=v[1];switch(n.name!==b&&(y(d),w(n.name)),n.type){case"number":return a.a.createElement("input",{className:"regular-text",disabled:t,name:i,placeholder:"".concat(z(U("Avg: %d, Lowest: %d, Highest: %d","altis-analytics"),Number(n.stats.avg).toFixed(2),Number(n.stats.min).toFixed(2),Number(n.stats.max).toFixed(2))),type:"number",value:s,onChange:c});case"string":default:switch(o){case"=":case"!=":case"*=":case"!*":case"^=":return a.a.createElement(r.Fragment,null,!m&&a.a.createElement(G,null,a.a.createElement("input",{ref:u,className:"regular-text",disabled:t,list:"audience-editor__rule__data_".concat(i),name:i,type:"text",value:s,onBlur:function(){y(d)},onChange:c}),a.a.createElement($,{isDestructive:!0,isLink:!0,label:U("Clear selection","altis-anlaytics"),onClick:function(){c({target:{value:""}}),y(!0)}},"×")),m&&a.a.createElement("select",{ref:f,className:"audience-editor__rule-value",disabled:t,id:"audience-editor__rule__data_".concat(i),name:i,value:s,onChange:function(e){"___"===e.target.value?y(!1):c(e)}},a.a.createElement("option",{value:""},U("Empty","altis-analytics")),l.map((function(e){return""!==e&&a.a.createElement("option",{key:e,value:e},e)})),a.a.createElement("option",{value:"___"},U("Other, please specify...","altis-analytics"))));default:return null}}};function q(e){var t=e.canRemove,n=e.field,r=e.namePrefix,i=e.operator,o=e.value,s=e.onChange,c=e.onRemove,l=D((function(e){return e("audience").getFields()}),[]),u=l.find((function(e){return e.name===n}))||{},f=l.filter((function(e){return e.name.match(/^endpoint\./)})),d=l.filter((function(e){return!e.name.match(/^endpoint\./)}));return a.a.createElement(B,{className:"audience-editor__rule"},a.a.createElement("select",{className:"audience-editor__rule-field",disabled:0===l.length,name:"".concat(r,"[field]"),value:n,onChange:function(e){return s({field:e.target.value,value:""})}},a.a.createElement("option",{className:"placeholder",value:""},U("Select a field","altis-analytics")),a.a.createElement("optgroup",{label:U("Persistent Data","altis-analytics")},f.map((function(e){return a.a.createElement("option",{key:e.name,value:e.name},e.label)}))),a.a.createElement("optgroup",{label:U("Point-in-time Data","altis-analytics")},d.map((function(e){return a.a.createElement("option",{key:e.name,value:e.name},e.label)})))),a.a.createElement(T,{className:"audience-editor__rule-operator",disabled:0===l.length,name:"".concat(r,"[operator]"),type:u.type||"string",value:i,onChange:function(e){return s({operator:e.target.value})}}),a.a.createElement(W,{currentField:u,disabled:0===l.length,name:"".concat(r,"[value]"),operator:i,value:o,onChange:function(e){return s({value:e.target.value})}}),t&&a.a.createElement($,{className:"audience-editor__rule-remove",isDestructive:!0,isLink:!0,onClick:c},U("Remove","altis-analytics")),u.description&&a.a.createElement("p",{className:"description"},u.description))}function H(){var e=E()(["\n\tvertical-align: middle;\n"]);return H=function(){return e},e}var V=wp.i18n.__,Y=k.b.select(H());function X(e){return a.a.createElement(Y,e,a.a.createElement("option",{value:"any"},V("Match any of the following","altis-analytics")," ",e.label),a.a.createElement("option",{value:"all"},V("Match all of the following","altis-analytics")," ",e.label))}function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function J(e){for(var t=1;t1,fields:i,namePrefix:"".concat(o,"[rules][").concat(n,"]"),onChange:function(t){return e.updateRule(n,t)},onRemove:function(){return e.onRemoveRule(n)}},t))})),a.a.createElement("div",{className:"audience-editor__group-footer"},a.a.createElement(ee,{className:"audience-editor__group-rule-add",isSecondary:!0,onClick:this.onAddRule},Q("Add a rule","altis-analytics")),n&&a.a.createElement(ee,{className:"audience-editor__group-remove",isDestructive:!0,isLink:!0,onClick:l},Q("Remove group","altis-analytics"))))}}]),t}(r.Component);function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ae(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},r=n.props.audience;n.props.onChange(ae({},r,{groups:[].concat(j()(r.groups.slice(0,e)),[ae({},r.groups[e],{},t)],j()(r.groups.slice(e+1)))}))})),w()(y()(n),"onRemoveGroup",(function(e){var t=n.props.audience;n.props.onChange(ae({},t,{groups:[].concat(j()(t.groups.slice(0,e)),j()(t.groups.slice(e+1)))}))})),n}return v()(t,e),u()(t,[{key:"render",value:function(){var e=this,t=this.props.audience;return a.a.createElement(ce,{className:"audience-editor"},a.a.createElement("div",{className:"audience-editor__include"},a.a.createElement(X,{label:oe("groups","altis-analytics"),name:"audience[include]",value:t.include,onChange:this.onChangeInclude})),t.groups.map((function(n,r){return a.a.createElement(ne,S()({key:r,canRemove:t.groups.length>1,namePrefix:"audience[groups][".concat(r,"]"),title:"".concat(oe("Group")," ").concat(r+1),onChange:function(t){return e.onUpdateGroup(r,t)},onRemove:function(){return e.onRemoveGroup(r)}},n))})),a.a.createElement(se,{className:"audience-editor__group-add",isSecondary:!0,onClick:this.onAddGroup},oe("Add a group","altis-analytics")))}}]),t}(r.Component);le.defaultProps={audience:_.a,fields:[],onChange:function(){}};var ue=n(49);function fe(){var e=E()(["\n\tcircle {\n\t\tfill: transparent;\n\t\tstroke: ",";\n\t\tstroke-linecap: round;\n\t\tstroke-opacity: 0.2;\n\t\tstroke-dasharray: 101 100;\n\t\tstroke-dashoffset: 0;\n\t\tstroke-width: 3;\n\t\ttransform: rotate(-90deg);\n\t\ttransform-origin: center;\n\t\ttransition: stroke-dasharray 0.3s ease-in-out;\n\t}\n\tcircle[data-percent] {\n\t\tstroke-dasharray: "," 100;\n\t\tstroke-opacity: 1;\n\t}\n\ttext {\n\t\tstroke-width: 0;\n\t\tfont-size: 9px;\n\t}\n"]);return fe=function(){return e},e}var de=k.b.svg(fe(),(function(e){return e.stroke||"rgb(0, 124, 186)"}),(function(e){return 100===e.percent?101:e.percent}));function pe(e){var t=e.isLoading,n=e.percent;return a.a.createElement(de,S()({viewBox:"0 0 36 36"},e),a.a.createElement("circle",{cx:"18",cy:"18",r:"16"}),a.a.createElement("circle",{cx:"18",cy:"18","data-percent":!0,r:"16"}),a.a.createElement("text",{textAnchor:"middle",x:"18",y:"21"},t?"…":"".concat(n,"%")))}function he(){var e=E()(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin: 0;\n\n\t.audience-estimate__title {\n\t\tflex: 0 0 100%;\n\t\tmargin: 0 0 20px;\n\t}\n\n\t.audience-estimate__percentage {\n\t\tflex: 0 1 100px;\n\t\tmargin-right: 20px;\n\t\tmax-width: 5.5rem;\n\t}\n\n\t.audience-estimate__sparkline,\n\t.audience-estimate__percentage {\n\t\topacity: ",";\n\t\ttransition: opacity ease-in-out .3s;\n\t}\n\n\t.audience-estimate__totals {\n\t\tflex: 2;\n\t}\n\n\t.audience-estimate__totals svg {\n\t\tmax-width: 220px;\n\t\tmargin-top: 5px;\n\t\tmargin-bottom: 10px;\n\t}\n\n\t.audience-estimate__totals p {\n\t\tmargin: 0;\n\t}\n\n\t.audience-estimate__totals strong {\n\t\tmargin-right: 2px;\n\t}\n"]);return he=function(){return e},e}pe.defaultProps={isLoading:!1,percent:0};var me=wp.data.useSelect,ye=wp.i18n.__,ge=k.b.div(he(),(function(e){return e.isLoading?.7:1}));function ve(e){var t=e.estimate,n=e.showTotals,r=e.sparkline,i=e.title;if(!t)return null;var o=t.total?Math.round(t.count/t.total*100):0;return a.a.createElement(ge,S()({className:"audience-estimate"},e,{isLoading:t.isLoading}),i&&a.a.createElement("h3",{className:"audience-estimate__title"},i),a.a.createElement(pe,{className:"audience-estimate__percentage",isLoading:t.isLoading,percent:t.isLoading?0:o}),a.a.createElement("div",{className:"audience-estimate__totals"},r&&a.a.createElement(ue.Sparklines,{className:"audience-estimate__sparkline",data:t.histogram.map((function(e){return e.count})),preserveAspectRatio:"xMidYMid meet"},a.a.createElement(ue.SparklinesLine,{color:"rgb(0, 124, 186)",style:{strokeWidth:5}})),n&&a.a.createElement("p",{className:"audience-estimate__count"},t.isLoading&&a.a.createElement("span",null,ye("Loading estimate","altis-analytics"),"…"),!t.isLoading&&a.a.createElement(a.a.Fragment,null,a.a.createElement("strong",null,t.count)," ",a.a.createElement("span",null,ye("uniques in the last 7 days","altis-analytics"))))))}function be(e){var t=e.audience,n=me((function(e){return e("audience").getEstimate(t)}),[t]);return t?a.a.createElement(ve,S()({},e,{estimate:n})):null}ve.defaultProps={audience:null,estimate:null,showTotals:!0,sparkline:!1,title:""};var we=wp.components.ToggleControl,xe=wp.i18n.__,Ee=function(e){var t=e.disabled,n=e.status,r=e.onChange,i=xe("publish"===n?"Audience is active":"Audience is inactive","altis-analytics");return a.a.createElement(we,{checked:"publish"===n,disabled:t,help:i,label:xe("Active","altis-analytics"),onChange:r})};function ke(){var e=E()(["\n\tmargin: 20px 0;\n\n\t.components-notice {\n\t\tmargin: 0 0 20px;\n\t}\n\n\t.audience-settings {\n\t\tdisplay: flex;\n\t}\n\n\t.audience-settings > * {\n\t\tflex: 1;\n\t}\n\n\t.audience-options {\n\t\tflex: 0 1 320px;\n\t\tmargin: 20px 0 20px 40px;\n\t}\n\n\t.audience-estimate {\n\t\tmargin-bottom: 40px;\n\t}\n"]);return ke=function(){return e},e}var _e=wp.compose.compose,Oe=wp.data,Se=Oe.withSelect,Ce=Oe.withDispatch,je=wp.htmlEntities.decodeEntities,Ae=wp.i18n.__,Pe=wp.components,Me=Pe.Button,Ne=Pe.Notice,Re=Pe.Spinner,Te=k.b.div(ke()),Ie=function(e){function t(){var e,n;c()(this,t);for(var r=arguments.length,a=new Array(r),i=0;i{let n,r=1;if(Fe(e))n=e;else{if(!Ge.call(e,"name"))throw new Error(`Missing ${"name"} property in key`);if(n=e.name,Ge.call(e,"weight")&&(r=e.weight,r<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(n))}this._keyNames.push(n),this._keys[n]={weight:r},t+=r}),this._keyNames.forEach(e=>{this._keys[e].weight/=t})}get(e,t){return this._keys[e]&&this._keys[e][t]}keys(){return this._keyNames}toJSON(){return JSON.stringify(this._keys)}}var qe={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx{if(t){const i=t.indexOf(".");let o=t,s=null;-1!==i&&(o=t.slice(0,i),s=t.slice(i+1));const c=e[o];if(!Ue(c))return;if(s||!Fe(c)&&!ze(c))if(De(c)){r=!0;for(let e=0,t=c.length;e{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){const t=this.size();Fe(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t{let a=this.getFn(e,t);if(Ue(a))if(De(a)){let e=[];const t=[{nestedArrIndex:-1,value:a}];for(;t.length;){const{nestedArrIndex:n,value:r}=t.pop();if(Ue(r))if(Fe(r)&&!Be(r)){let t={v:r,i:n,n:this.norm.get(r)};e.push(t)}else De(r)&&r.forEach((e,n)=>{t.push({nestedArrIndex:n,value:e})})}n.$[r]=e}else if(!Be(a)){let e={v:a,n:this.norm.get(a)};n.$[r]=e}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Ye(e,t,{getFn:n=qe.getFn}={}){let r=new Ve({getFn:n});return r.setKeys(e),r.setCollection(t),r.create(),r}function Xe(e,t){const n=e.matches;t.matches=[],Ue(n)&&n.forEach(e=>{if(!Ue(e.indices)||!e.indices.length)return;const{indices:n,value:r}=e;let a={indices:n,value:r};e.key&&(a.key=e.key),e.idx>-1&&(a.refIndex=e.idx),t.matches.push(a)})}function Ke(e,t){t.score=e.score}function Je(e,{errors:t=0,currentLocation:n=0,expectedLocation:r=0,distance:a=qe.distance}={}){const i=t/e.length,o=Math.abs(r-n);return a?i+o/a:o?1:i}function Ze(e,t,n,{location:r=qe.location,distance:a=qe.distance,threshold:i=qe.threshold,findAllMatches:o=qe.findAllMatches,minMatchCharLength:s=qe.minMatchCharLength,includeMatches:c=qe.includeMatches}={}){if(t.length>32)throw new Error(`Pattern length exceeds max of ${32}.`);const l=t.length,u=e.length,f=Math.max(0,Math.min(r,u));let d=i,p=f;const h=[];if(c)for(let e=0;e-1;){let e=Je(t,{currentLocation:m,expectedLocation:f,distance:a});if(d=Math.min(e,d),p=m+l,c){let e=0;for(;e=m;i-=1){let o=i-1,s=n[e.charAt(o)];if(s&&c&&(h[o]=1),x[i]=(x[i+1]<<1|1)&s,0!==r&&(x[i]|=(y[i+1]|y[i])<<1|1|y[i+1]),x[i]&b&&(g=Je(t,{errors:r,currentLocation:o,expectedLocation:f,distance:a}),g<=d)){if(d=g,p=o,p<=f)break;m=Math.max(1,2*f-p)}}if(Je(t,{errors:r+1,currentLocation:f,expectedLocation:f,distance:a})>d)break;y=x}let w={isMatch:p>=0,score:Math.max(.001,g)};return c&&(w.indices=function(e=[],t=qe.minMatchCharLength){let n=[],r=-1,a=-1,i=0;for(let o=e.length;i=t&&n.push([r,a]),r=-1)}return e[i-1]&&i-r>=t&&n.push([r,i-1]),n}(h,s)),w}function Qe(e){let t={},n=e.length;for(let r=0;r{const{isMatch:p,score:h,indices:m}=Ze(e,t,f,{location:r+32*d,distance:a,threshold:i,findAllMatches:o,minMatchCharLength:s,includeMatches:n});p&&(u=!0),l+=h,p&&m&&(c=[...c,...m])});let f={isMatch:u,score:u?l/this.chunks.length:1};return u&&n&&(f.indices=c),f}}class tt{constructor(e){this.pattern=e}static isMultiMatch(e){return nt(e,this.multiRegex)}static isSingleMatch(e){return nt(e,this.singleRegex)}search(){}}function nt(e,t){const n=e.match(t);return n?n[1]:null}class rt extends tt{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,n=0;const r=[],a=this.pattern.length;for(;(t=e.indexOf(this.pattern,n))>-1;)n=t+a,r.push([t,n-1]);const i=!!r.length;return{isMatch:i,score:i?1:0,indices:r}}}class at extends tt{constructor(e,{location:t=qe.location,threshold:n=qe.threshold,distance:r=qe.distance,includeMatches:a=qe.includeMatches,findAllMatches:i=qe.findAllMatches,minMatchCharLength:o=qe.minMatchCharLength,isCaseSensitive:s=qe.isCaseSensitive}={}){super(e),this._bitapSearch=new et(e,{location:t,threshold:n,distance:r,includeMatches:a,findAllMatches:i,minMatchCharLength:o,isCaseSensitive:s})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}const it=[rt,class extends tt{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends tt{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends tt{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends tt{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends tt{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},at],ot=it.length,st=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;const ct=new Set([at.type,rt.type]);class lt{constructor(e,{isCaseSensitive:t=qe.isCaseSensitive,includeMatches:n=qe.includeMatches,minMatchCharLength:r=qe.minMatchCharLength,findAllMatches:a=qe.findAllMatches,location:i=qe.location,threshold:o=qe.threshold,distance:s=qe.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:n,minMatchCharLength:r,findAllMatches:a,location:i,threshold:o,distance:s},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map(e=>{let n=e.trim().split(st).filter(e=>e&&!!e.trim()),r=[];for(let e=0,a=n.length;e!(!e[dt]&&!e[pt]),mt=e=>({[dt]:Object.keys(e).map(t=>({[t]:e[t]}))});function yt(e,t,{auto:n=!0}={}){const r=e=>{let a=Object.keys(e);if(a.length>1&&!ht(e))return r(mt(e));let i=a[0];if((e=>!De(e)&&"object"==typeof e&&!ht(e))(e)){const r=e[i];if(!Fe(r))throw new Error((e=>"Invalid value for key "+e)(i));const a={key:i,pattern:r};return n&&(a.searcher=ft(r,t)),a}let o={children:[],operator:i};return a.forEach(t=>{const n=e[t];De(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return ht(e)||(e=mt(e)),r(e)}class gt{constructor(e,t={},n){this.options={...qe,...t},this.options.useExtendedSearch,this._keyStore=new We(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Ve))throw new Error("Incorrect 'index' type");this._myIndex=t||Ye(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}add(e){Ue(e)&&(this._docs.push(e),this._myIndex.add(e))}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:n,includeScore:r,shouldSort:a,sortFn:i}=this.options;let o=Fe(e)?Fe(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,t){e.forEach(e=>{let n=1;e.matches.forEach(({key:e,norm:r,score:a})=>{const i=t.get(e,"weight");n*=Math.pow(0===a&&i?Number.EPSILON:a,(i||1)*r)}),e.score=n})}(o,this._keyStore),a&&o.sort(i),ze(t)&&t>-1&&(o=o.slice(0,t)),function(e,t,{includeMatches:n=qe.includeMatches,includeScore:r=qe.includeScore}={}){const a=[];n&&a.push(Xe);r&&a.push(Ke);return e.map(e=>{const{idx:n}=e,r={item:t[n],refIndex:n};return a.length&&a.forEach(t=>{t(e,r)}),r})}(o,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){const t=ft(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:e,i:n,n:a})=>{if(!Ue(e))return;const{isMatch:i,score:o,indices:s}=t.searchIn(e);i&&r.push({item:e,idx:n,matches:[{score:o,value:e,norm:a,indices:s}]})}),r}_searchLogical(e){const t=yt(e,this.options),{keys:n,records:r}=this._myIndex,a={},i=[],o=(e,t,r)=>{if(!e.children){const{key:r,searcher:a}=e,i=t[n.indexOf(r)];return this._findMatches({key:r,value:i,searcher:a})}{const n=e.operator;let s=[];for(let a=0;a{a[r].matches.push(...e)}))}};return r.forEach(({$:e,i:n})=>{Ue(e)&&o(t,e,n)}),i}_searchObjectList(e){const t=ft(e,this.options),{keys:n,records:r}=this._myIndex,a=[];return r.forEach(({$:e,i:r})=>{if(!Ue(e))return;let i=[];n.forEach((n,r)=>{i.push(...this._findMatches({key:n,value:e[r],searcher:t}))}),i.length&&a.push({idx:r,item:e,matches:i})}),a}_findMatches({key:e,value:t,searcher:n}){if(!Ue(t))return[];let r=[];if(De(t))t.forEach(({v:t,i:a,n:i})=>{if(!Ue(t))return;const{isMatch:o,score:s,indices:c}=n.searchIn(t);o&&r.push({score:s,key:e,value:t,idx:a,norm:i,indices:c})});else{const{v:a,n:i}=t,{isMatch:o,score:s,indices:c}=n.searchIn(a);o&&r.push({score:s,key:e,value:a,norm:i,indices:c})}return r}}gt.version="6.0.0",gt.createIndex=Ye,gt.parseIndex=function(e,{getFn:t=qe.getFn}={}){const{keys:n,records:r}=e;let a=new Ve({getFn:t});return a.setKeys(n),a.setRecords(r),a},gt.config=qe,gt.parseQuery=yt,function(...e){ut.push(...e)}(lt);var vt=gt,bt=n(40),wt=wp.data,xt=wt.useSelect,Et=wt.useDispatch,kt=wp.components.Button,_t=wp.i18n.sprintf,Ot=function(e){var t=e.children,n=void 0===t?null:t,r=e.className,i=void 0===r?"":r,o=e.label,s=e.post,c=e.onClick;return a.a.createElement(kt,{"aria-label":_t(o,s.title.rendered),className:i,isLink:!0,onClick:function(e){e.preventDefault(),c(s)}},n||s.title.rendered)};function St(){var e=E()(["\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: center;\n\n\t.audience-sort-order {\n\t\t&__number {\n\t\t\tfont-weight: bold;\n\t\t\tflex: 1;\n\t\t}\n\t\t&__controls {\n\t\t\tflex: 1;\n\t\t\tbutton {\n\t\t\t\tpadding: 3px;\n\t\t\t}\n\t\t}\n\t\t&__up {\n\t\t\tmargin-bottom: 2px;\n\t\t}\n\t}\n"]);return St=function(){return e},e}var Ct=wp.components.IconButton,jt=wp.i18n.__,At=k.b.span(St()),Pt=function(e){var t=e.canMoveDown,n=e.canMoveUp,r=e.index,i=e.onMoveDown,o=e.onMoveUp;return a.a.createElement(At,{className:"audience-sort-order"},a.a.createElement("span",{className:"audience-sort-order__number"},r+1),a.a.createElement("span",{className:"audience-sort-order__controls"},a.a.createElement(Ct,{className:"audience-sort-order__up",disabled:!n,icon:"arrow-up-alt2",label:jt("Move up","altis-analytics"),onClick:o}),a.a.createElement(Ct,{className:"audience-sort-order__down",disabled:!t,icon:"arrow-down-alt2",label:jt("Move down","altis-analytics"),onClick:i})))},Mt=wp.components.Button,Nt=wp.htmlEntities.decodeEntities,Rt=wp.i18n.__,Tt=function(e){var t,n=e.canMoveDown,i=e.canMoveUp,o=e.index,s=e.post,c=e.onMoveDown,l=e.onMoveUp,u=e.onClick,f=e.onEdit,d=e.onSelect,p=!!d,h="publish"===s.status,m=(t=s.id,xt((function(e){return e("core").canUser("update","audiences",t)}),[t])),y=function(e){return xt((function(t){return t("core").canUser("delete","audiences",e)}),[e])}(s.id),g=Et("audience").deletePost,v=Et("audience").updatePost,b=function(){window.confirm(Rt("Are you sure you want to delete this audience?","altis-anlaytics"))&&g(s.id)},w=function(e){return a.a.createElement(Ot,S()({label:Rt("Edit “%s”"),post:s,onClick:f},e))},x=Nt(s.title.rendered||Rt("(no title)","altis-analytics"));return a.a.createElement("tr",{className:"audience-row audience-row--".concat(h?"active":"inactive"),onClick:u},a.a.createElement("td",null,a.a.createElement(Pt,{canMoveDown:n,canMoveUp:i,index:o,onMoveDown:c,onMoveUp:l})),a.a.createElement("td",null,!m&&a.a.createElement("span",{className:"row-title"},a.a.createElement("strong",null,x)),m&&a.a.createElement(w,{className:"row-title"},a.a.createElement("strong",null,x)),a.a.createElement("div",{className:"row-actions"},m&&a.a.createElement("span",{className:"edit"},a.a.createElement(w,null,Rt("Edit"))),y&&a.a.createElement(r.Fragment,null," | ",a.a.createElement("span",{className:"trash"},a.a.createElement((function(e){return a.a.createElement(Ot,S()({className:"is-destructive",label:Rt("Move “%s” to the Trash"),post:s,onClick:b},e))}),null,Rt("Trash")))))),a.a.createElement("td",null,m&&a.a.createElement(Ee,{status:s.status,onChange:function(){return v({id:s.id,status:"publish"===s.status?"draft":"publish"})}}),!m&&a.a.createElement("span",{className:"active"},"publish"===s.status?Rt("Active","altis-analytics"):Rt("Inactive","altis-analytics"))),a.a.createElement("td",null,a.a.createElement(ve,{estimate:s.estimate})),p&&a.a.createElement("td",null,h&&a.a.createElement(Mt,{className:"button",onClick:function(){return d(s)}},Rt("Select","altis-analytics"))))};Tt.defaultProps={onClick:function(){}};var It=Tt,Lt=wp.i18n.__,$t=function(e){return a.a.createElement("tr",null,a.a.createElement("th",{className:"manage-column column-order",scope:"col"},Lt("Priority","altis-analytics")),a.a.createElement("th",{className:"manage-column column-title column-primary",scope:"col"},Lt("Title","altis-analytics")),a.a.createElement("th",{className:"manage-column column-active",scope:"col"},Lt("Status","altis-analytics")),a.a.createElement("th",{className:"manage-column column-estimate",scope:"col"},Lt("Size","altis-analytics")),e.isSelectMode&&a.a.createElement("th",{className:"manage-column column-select",scope:"col"}," "))},Dt=function(){return(Dt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0)return;r=r.parentNode}while(a++<4);e.stopPropagation(),n.props.onSelect&&n.props.onSelect(t)}})),w()(y()(n),"onMove",(function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up",a=e[t],i="up"===r?-1:1;n.props.onUpdatePost({id:a.id,menu_order:a.menu_order+i}),n.props.onUpdatePost({id:e[t+i].id,menu_order:a.menu_order})})),w()(y()(n),"onNextPage",(function(){var e=n.state,t=e.page,r=e.search;n.props.onGetPosts({page:t+1,search:r,context:n.props.canCreate?"edit":"view",status:n.props.canCreate?"publish,draft":"publish"}),n.setState({page:t+1})})),n}return v()(t,e),u()(t,[{key:"componentDidCatch",value:function(e,t){console.error(e,t)}},{key:"render",value:function(){var e=this,t=this.props,n=t.canCreate,i=t.loading,o=t.pagination,s=t.posts,c=t.onEdit,l=t.onSelect,u=this.state,f=u.error,d=u.search,p=s.filter((function(e){return!e.error&&"trash"!==e.status})),h=en(p),m=d?h.search(d).map((function(e){return e.item})):p,y=m&&m.length>0&&l;return a.a.createElement(nn,{className:"audience-listing",selectMode:y},f&&a.a.createElement(Qt,{isDismissable:!0,status:"error",onRemove:function(){return e.setState({error:null})}},f.toString()),a.a.createElement("div",{className:"audience-list__search-box"},a.a.createElement("label",{className:"screen-reader-text",htmlFor:"audience-search-input"},Kt("Search Audiences","altis-analytics")),a.a.createElement("input",{id:"audience-search-input",name:"s",placeholder:Kt("Search Audiences","altis-analytics"),type:"search",value:d,onChange:this.onSearch})),a.a.createElement("table",{className:"wp-list-table widefat fixed striped posts"},a.a.createElement("thead",null,a.a.createElement($t,{isSelectMode:y})),a.a.createElement("tbody",null,!i&&0===m.length&&a.a.createElement("tr",{className:"audience-row audience-row--no-results"},a.a.createElement("td",{colSpan:y?5:4},Kt("No audiences were found","altis-analytics"),d.length>0&&" ".concat(Kt("for that search term","altis-analytics")),". ",n&&a.a.createElement(Zt,{isLink:!0,onClick:function(){return c()}},Kt("Create a new audience.")))),m.length>0&&m.map((function(t,r){return a.a.createElement(It,{key:t.id,canMoveDown:n&&m[r+1],canMoveUp:n&&m[r-1],index:r,post:t,onClick:function(n){return e.onSelectRow(n,t)},onEdit:c,onMoveDown:function(){return e.onMove(m,r,"down")},onMoveUp:function(){return e.onMove(m,r,"up")},onSelect:l})})),!i&&o.total>m.length&&a.a.createElement("tr",{className:"audience-row audience-row--load-more"},a.a.createElement("td",{colSpan:y?5:4},a.a.createElement(Zt,{className:"button",onClick:this.onNextPage},Kt("Load more audiences","altis-analytics")))),i&&a.a.createElement(r.Fragment,null,a.a.createElement(Gt,null),a.a.createElement(Gt,null),a.a.createElement(Gt,null))),a.a.createElement("tfoot",null,a.a.createElement($t,{isSelectMode:y}))))}}],[{key:"getDerivedStateFromError",value:function(e){return{error:e}}}]),t}(r.Component);rn.defaultProps={canCreate:!1,loading:!1,pagination:{total:0,pages:0},posts:[],onGetPosts:function(){},onUpdatePost:function(){}};var an=Ht(Yt((function(e){var t=e("audience"),n=t.getPosts,r=t.getIsLoading,a=t.getPagination,i=e("core").canUser("create","audiences");return{canCreate:i,loading:r(),pagination:a(),posts:n({context:i?"edit":"view",status:i?"publish,draft":"publish"}),onGetPosts:n}})),Xt((function(e){return{onUpdatePost:e("audience").updatePost}})))(rn);function on(){var e=E()(["\n\tmargin-right: 20px;\n\n\t.wp-heading-inline {\n\t\tdisplay: inline-block;\n\t\tvertical-align: middle;\n\t}\n\t&& .page-title-action {\n\t\tmargin-left: 10px;\n\t}\n\t.wp-header-end {\n\t\tmargin-bottom: 14px;\n\t}\n"]);return on=function(){return e},e}var sn=wp.data,cn=sn.withSelect,ln=sn.withDispatch,un=wp.components.Button,fn=wp.compose.compose,dn=wp.i18n.__,pn=k.b.div(on()),hn=function(e){function t(e){var n;return c()(this,t),(n=d()(this,h()(t).call(this,e))).state={view:"list"},n.actionRef=Object(r.createRef)(),n}return v()(t,e),u()(t,[{key:"render",value:function(){var e=this,t=this.props,n=t.canCreate,r=t.onSelect,i=t.onSetCurrentPost,o=this.state.view,s={list:{title:dn("Audiences","altis-analytics"),action:{permission:n,label:dn("Add New","altis-analytics"),onClick:function(){i(_.c),e.setState({view:"edit"})}},body:function(){return a.a.createElement(an,{onEdit:function(t){i(t||_.c),e.setState({view:"edit"})},onSelect:r})}},edit:{title:dn("Edit Audience","altis-analytics"),action:{permission:!0,label:dn("Back to Audiences","altis-analytics"),onClick:function(){return e.setState({view:"list"})}},body:function(){return a.a.createElement($e,{onSelect:r})}}}[o],c=s.body;return a.a.createElement(pn,{className:"altis-audience-manager"},a.a.createElement("header",{className:"altis-audience-manager__header"},a.a.createElement("h1",{className:"wp-heading-inline"},s.title),s.action.permission&&a.a.createElement(un,{ref:this.actionRef,className:"page-title-action",isPrimary:!0,onClick:function(){s.action.onClick(),e.actionRef.current.blur()}},s.action.label),a.a.createElement("hr",{className:"wp-header-end"})),a.a.createElement(c,null))}}]),t}(r.Component);hn.defaultProps={canCreate:!1,onSelect:null};var mn=fn(cn((function(e){return{canCreate:(0,e("core").canUser)("create","audiences")}})),ln((function(e){return{onSetCurrentPost:e("audience").setCurrentPost}})))(hn),yn=n(41);function gn(){var e=E()(["\n\t.audience-select__label {\n\t\tdisplay: block;\n\t\tmargin-bottom: 4px;\n\t}\n\t.audience-select__controls {\n\t\tmargin-left: -3px;\n\t\tdisplay: flex;\n\n\t\tbutton {\n\t\t\tpadding-left: 0;\n\t\t\tpadding-right: 0;\n\t\t\ttext-align: left;\n\n\t\t\t&:not(:disabled):not([aria-disabled=true]):not(.is-secondary):not(.is-primary):not(.is-tertiary):not(.is-link):hover,\n\t\t\t&:not(:disabled):not([aria-disabled=true]):not(.is-secondary):not(.is-primary):not(.is-tertiary):not(.is-link):focus {\n\t\t\t\tbox-shadow: none;\n\t\t\t}\n\n\t\t\tstrong {\n\t\t\t\t&:hover, &:focus {\n\t\t\t\t\ttext-decoration: underline;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t.dashicon {\n\t\t\tmargin-right: 3px;\n\t\t}\n\t}\n\t.audience-select__clear {\n\t\tmargin-left: -2px;\n\t\tmargin-right: 5px;\n\t\tmin-width: 0;\n\n\t\t&:hover, &:focus {\n\t\t\tcolor: #d94f4f;\n\t\t}\n\n\t\t&:hover svg, &:focus svg {\n\t\t\tfill: #d94f4f;\n\t\t}\n\t}\n"]);return gn=function(){return e},e}function vn(){var e=E()(["\n\t.altis-audience-manager {\n\t\tmargin: 20px;\n\n\t\t&__header {\n\t\t\tposition: fixed;\n\t\t\tleft: 50px;\n\t\t\ttop: 30px;\n\t\t\tz-index: 10;\n\n\t\t\t@media only screen and (max-width: 640px), screen and (max-height: 400px) {\n\t\t\t\tleft: 20px;\n\t\t\t\ttop: 0;\n\t\t\t}\n\n\t\t\th1 {\n\t\t\t\tvertical-align: middle;\n\t\t\t}\n\t\t}\n\t}\n\t.altis-audience-manager table {\n\t\twidth: 100%;\n\t}\n"]);return vn=function(){return e},e}var bn=wp.components,wn=bn.IconButton,xn=bn.Spinner,En=wp.compose.compose,kn=wp.data.withSelect,_n=wp.htmlEntities.decodeEntities,On=wp.i18n.__,Sn=Object(k.b)(yn.a)(vn()),Cn=k.b.div(gn()),jn=function(e){function t(){var e,n;c()(this,t);for(var r=arguments.length,a=new Array(r),i=0;ir&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(m,"$1"+e.trim());case 58:return e.trim()+t.replace(m,"$1"+e.trim());default:if(0<1*n&&0c.charCodeAt(8))break;case 115:o=o.replace(c,"-webkit-"+c)+";"+o;break;case 207:case 102:o=o.replace(c,"-webkit-"+(102s.charCodeAt(0)&&(s=s.trim()),s=[s],0p)&&(F=(B=B.replace(" ",":")).length),01?t-1:0),r=1;r0?" Additional arguments: "+n.join(", "):""))}var _=function(e){var t=document.head,n=e||t,r=document.createElement("style"),a=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(b))return r}}(n),i=void 0!==a?a.nextSibling:null;r.setAttribute(b,"active"),r.setAttribute("data-styled-version","5.0.1");var o=E();return o&&r.setAttribute("nonce",o),n.insertBefore(r,i),r},O=function(){function e(e){var t=this.element=_(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,a=r;e>=a;)(a<<=1)<0&&k(16,""+e);this.groupSizes=new Uint32Array(a),this.groupSizes.set(n),this.length=a;for(var i=r;i=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),a=r+n,i=r;i=M&&(M=t+1),A.set(e,t),P.set(t,e)},I="style["+b+'][data-styled-version="5.0.1"]',L=/(?:\s*)?(.*?){((?:{[^}]*}|(?!{).*?)*)}/g,$=new RegExp("^"+b+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\]'),D=function(e,t,n){for(var r,a=n.split(","),i=0,o=a.length;i0&&(l+=e+",")})),r+=""+s+c+'{content:"'+l+'"}\n'}}}return r}(this)},e}(),G=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},W=function(e){return G(5381,e)};var q=/^\s*\/\/.*$/gm;function H(e){var t,n,r,a=void 0===e?m:e,i=a.options,s=void 0===i?m:i,c=a.plugins,l=void 0===c?h:c,u=new o.a(s),f=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,a,i,o,s,c,l,u,f){switch(n){case 1:if(0===u&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(a[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),p=function(e,r,a){return r>0&&-1!==a.slice(0,r).indexOf(n)&&a.slice(r-n.length,r)!==n?"."+t:e};function y(e,a,i,o){void 0===o&&(o="&");var s=e.replace(q,""),c=a&&i?i+" "+a+" { "+s+" }":s;return t=o,n=a,r=new RegExp("\\"+n+"\\b","g"),u(i||!a?"":a,c)}return u.use([].concat(l,[function(e,t,a){2===e&&a.length&&a[0].lastIndexOf(n)>0&&(a[0]=a[0].replace(r,p))},d,function(e){if(-2===e){var t=f;return f=[],t}}])),y.hash=l.length?l.reduce((function(e,t){return t.name||k(15),G(e,t.name)}),5381).toString():"",y}var V=i.a.createContext(),Y=(V.Consumer,i.a.createContext()),X=(Y.Consumer,new B),K=H();function J(){return Object(a.useContext)(V)||X}function Z(){return Object(a.useContext)(Y)||K}var Q=function(){function e(e,t){var n=this;this.inject=function(e){e.hasNameForId(n.id,n.name)||e.insertRules(n.id,n.name,K.apply(void 0,n.stringifyArgs))},this.toString=function(){return k(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.stringifyArgs=t}return e.prototype.getName=function(){return this.name},e}(),ee=/([A-Z])/g,te=/^ms-/;function ne(e){return e.replace(ee,"-$1").toLowerCase().replace(te,"-ms-")}var re=function(e){return null==e||!1===e||""===e},ae=function e(t,n){var r=[];return Object.keys(t).forEach((function(n){if(!re(t[n])){if(p(t[n]))return r.push.apply(r,e(t[n],n)),r;if(y(t[n]))return r.push(ne(n)+":",t[n],";"),r;r.push(ne(n)+": "+(a=n,(null==(i=t[n])||"boolean"==typeof i||""===i?"":"number"!=typeof i||0===i||a in s.a?String(i).trim():i+"px")+";"))}var a,i;return r})),n?[n+" {"].concat(r,["}"]):r};function ie(e,t,n){if(Array.isArray(e)){for(var r,a=[],i=0,o=e.length;i1?t-1:0),r=1;r1?t-1:0),r=1;r25?39:97))};function pe(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=de(t%52)+n;return(de(t%52)+n).replace(fe,"$1-$2")}function he(e){for(var t=0;t>>0);if(!t.hasNameForId(r,i)){var o=n(a,"."+i,void 0,r);t.insertRules(r,i,o)}return this.staticRulesId=i,i}for(var s=this.rules.length,c=G(this.baseHash,n.hash),l="",u=0;u>>0);if(!t.hasNameForId(r,h)){var m=n(l,"."+h,void 0,r);t.insertRules(r,h,m)}return h},e}(),ye=(new Set,function(e,t,n){return void 0===n&&(n=m),e.theme!==n.theme&&e.theme||t||n.theme}),ge=/[[\].#*$><+~=|^:(),"'`-]+/g,ve=/(^-|-$)/g;function be(e){return e.replace(ge,"-").replace(ve,"")}function we(e){return"string"==typeof e&&!0}var xe=function(e){return pe(W(e)>>>0)};var Ee=i.a.createContext();Ee.Consumer;var ke={};function _e(e,t,n){var r=e.attrs,i=e.componentStyle,o=e.defaultProps,s=e.foldedComponentIds,l=e.styledComponentId,u=e.target;Object(a.useDebugValue)(l);var d=function(e,t,n){void 0===e&&(e=m);var r=f({},t,{theme:e}),a={};return n.forEach((function(e){var t,n,i,o=e;for(t in y(o)&&(o=o(r)),o)r[t]=a[t]="className"===t?(n=a[t],i=o[t],n&&i?n+" "+i:n||i):o[t]})),[r,a]}(ye(t,Object(a.useContext)(Ee),o)||m,t,r),p=d[0],h=d[1],g=function(e,t,n,r){var i=J(),o=Z(),s=e.isStatic&&!t?e.generateAndInjectStyles(m,i,o):e.generateAndInjectStyles(n,i,o);return Object(a.useDebugValue)(s),s}(i,r.length>0,p),v=n,b=h.as||t.as||u,w=we(b),x=h!==t?f({},t,{},h):t,E=w||"as"in x||"forwardedAs"in x,k=E?{}:f({},x);if(E)for(var _ in x)"forwardedAs"===_?k.as=x[_]:"as"===_||"forwardedAs"===_||w&&!Object(c.a)(_)||(k[_]=x[_]);return t.style&&h.style!==t.style&&(k.style=f({},t.style,{},h.style)),k.className=Array.prototype.concat(s,l,g!==l?g:null,t.className,h.className).filter(Boolean).join(" "),k.ref=v,Object(a.createElement)(b,k)}function Oe(e,t,n){var r,a=v(e),o=!we(e),s=t.displayName,c=void 0===s?function(e){return we(e)?"styled."+e:"Styled("+g(e)+")"}(e):s,l=t.componentId,d=void 0===l?function(e,t){var n="string"!=typeof e?"sc":be(e);ke[n]=(ke[n]||0)+1;var r=n+"-"+xe(n+ke[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):l,p=t.attrs,m=void 0===p?h:p,y=t.displayName&&t.componentId?be(t.displayName)+"-"+t.componentId:t.componentId||d,b=a&&e.attrs?Array.prototype.concat(e.attrs,m).filter(Boolean):m,w=new me(a?e.componentStyle.rules.concat(n):n,y),x=function(e,t){return _e(r,e,t)};return x.displayName=c,(r=i.a.forwardRef(x)).attrs=b,r.componentStyle=w,r.displayName=c,r.foldedComponentIds=a?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):h,r.styledComponentId=y,r.target=a?e.target:e,r.withComponent=function(e){var r=t.componentId,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r=0||(a[n]=e[n]);return a}(t,["componentId"]),i=r&&r+"-"+(we(e)?e:be(g(e)));return Oe(e,f({},a,{attrs:b,componentId:i}),n)},Object.defineProperty(r,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=a?ue({},e.defaultProps,t):t}}),r.toString=function(){return"."+r.styledComponentId},o&&u()(r,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,self:!0,styledComponentId:!0,target:!0,withComponent:!0}),r}var Se=function(e){return function e(t,n,a){if(void 0===a&&(a=m),!Object(r.isValidElementType)(n))return k(1,String(n));var i=function(){return t(n,a,oe.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,f({},a,{},r))},i.attrs=function(r){return e(t,n,f({},a,{attrs:Array.prototype.concat(a.attrs,r).filter(Boolean)}))},i}(Oe,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Se[e]=Se(e)}));t.b=Se}).call(this,n(34))},30:function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1)for(var n=1;n1)for(var n=1;n1?t-1:0),r=1;r2?n-2:0),i=2;i0&&(m.width=i),s>0&&(m.height=s),o.default.createElement("svg",m,o.default.Children.map(this.props.children,(function(e){return o.default.cloneElement(e,{data:t,points:p,width:r,height:a,margin:l})})))}}]),t}(i.PureComponent);y.propTypes={data:a.default.array,limit:a.default.number,width:a.default.number,height:a.default.number,svgWidth:a.default.number,svgHeight:a.default.number,preserveAspectRatio:a.default.string,margin:a.default.number,style:a.default.object,min:a.default.number,max:a.default.number,onMouseMove:a.default.func},y.defaultProps={data:[],width:240,height:60,preserveAspectRatio:"none",margin:2},t.Sparklines=y,t.SparklinesLine=c.default,t.SparklinesCurve=l.default,t.SparklinesBars=u.default,t.SparklinesSpots=f.default,t.SparklinesReferenceLine=d.default,t.SparklinesNormalBand=p.default,t.SparklinesText=s.default},function(e,t,n){"use strict";(function(t){var r=n(4),a=n(5),i=n(8),o=n(6),s=n(15);e.exports=function(e,n){var c="function"==typeof Symbol&&Symbol.iterator,l={array:d("array"),bool:d("boolean"),func:d("function"),number:d("number"),object:d("object"),string:d("string"),symbol:d("symbol"),any:f(r.thatReturnsNull),arrayOf:function(e){return f((function(t,n,r,a,i){if("function"!=typeof e)return new u("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new u("Invalid "+a+" `"+i+"` of type `"+h(s)+"` supplied to `"+r+"`, expected an array.");for(var c=0;c>";return new u("Invalid "+a+" `"+i+"` of type `"+(((s=t[n]).constructor&&s.constructor.name?s.constructor.name:"<>")+"` supplied to `")+r+"`, expected instance of `"+o+"`.")}var s;return null}))},node:f((function(e,t,n,r,a){return p(e[t])?null:new u("Invalid "+r+" `"+a+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return f((function(t,n,r,a,i){if("function"!=typeof e)return new u("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[n],c=h(s);if("object"!==c)return new u("Invalid "+a+" `"+i+"` of type `"+c+"` supplied to `"+r+"`, expected an object.");for(var l in s)if(s.hasOwnProperty(l)){var f=e(s,l,r,a,i+"."+l,o);if(f instanceof Error)return f}return null}))},oneOf:function(e){return Array.isArray(e)?f((function(t,n,r,a,i){for(var o=t[n],s=0;s>",h=h||f,m!==o)if(n)a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var y=d+":"+f;!r[y]&&s<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",h,d),r[y]=!0,s++)}return null==l[f]?c?null===l[f]?new u("The "+p+" `"+h+"` is marked as required in `"+d+"`, but its value is `null`."):new u("The "+p+" `"+h+"` is marked as required in `"+d+"`, but its value is `undefined`."):null:e(l,f,d,p,h)}var l=c.bind(null,!1);return l.isRequired=c.bind(null,!0),l}function d(e){return f((function(t,n,r,a,i,o){var s=t[n];return h(s)!==e?new u("Invalid "+a+" `"+i+"` of type `"+m(s)+"` supplied to `"+r+"`, expected `"+e+"`."):null}))}function p(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(p);if(null===t||e(t))return!0;var n=function(e){var t=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!n)return!1;var r,a=n.call(t);if(n!==t.entries){for(;!(r=a.next()).done;)if(!p(r.value))return!1}else for(;!(r=a.next()).done;){var i=r.value;if(i&&!p(i[1]))return!1}return!0;default:return!1}}function h(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||"Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol}(t,e)?"symbol":t}function m(e){if(null==e)return""+e;var t=h(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function y(e){var t=m(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return u.prototype=Error.prototype,l.checkPropTypes=s,l.PropTypes=l,l}}).call(t,n(2))},function(e,t,n){"use strict";(function(t){if("production"!==t.env.NODE_ENV)var r=n(5),a=n(8),i=n(6),o={};e.exports=function(e,n,s,c,l){if("production"!==t.env.NODE_ENV)for(var u in e)if(e.hasOwnProperty(u)){var f;try{r("function"==typeof e[u],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",c||"React class",s,u),f=e[u](n,u,c,s,null,i)}catch(e){f=e}if(a(!f||f instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",c||"React class",s,u,typeof f),f instanceof Error&&!(f.message in o)){o[f.message]=!0;var d=l?l():"";a(!1,"Failed %s type: %s%s",s,f.message,null!=d?d:"")}}}}).call(t,n(2))},function(e,t,n){"use strict";var r=n(4),a=n(5),i=n(6);e.exports=function(){function e(e,t,n,r,o,s){s!==i&&a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n=2?Math.max(0,n[1].x-n[0].x-l-u):0);return i.default.createElement("g",{transform:"scale(1,-1)"},n.map((function(t,n){return i.default.createElement("rect",{key:n,x:t.x-(f+l)/2,y:-r,width:f,height:Math.max(0,r-t.y),style:a,onMouseMove:c&&c.bind(e,t)})})))}}]),t}(i.default.Component);l.propTypes={points:a.default.arrayOf(a.default.object),height:a.default.number,style:a.default.object,barWidth:a.default.number,margin:a.default.number,onMouseMove:a.default.func},l.defaultProps={style:{fill:"slategray"}},t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0?1:-1},e.length<2?0:Math.sign(e[e.length-2].y-e[e.length-1].y)}},{key:"render",value:function(){var e=this.props,t=e.points,n=(e.width,e.height,e.size),r=e.style,a=e.spotColors,o=i.default.createElement("circle",{cx:t[0].x,cy:t[0].y,r:n,style:r}),s=i.default.createElement("circle",{cx:t[t.length-1].x,cy:t[t.length-1].y,r:n,style:r||{fill:a[this.lastDirection(t)]}});return i.default.createElement("g",null,r&&o,s)}}]),t}(i.default.Component);l.propTypes={size:a.default.number,style:a.default.object,spotColors:a.default.object},l.defaultProps={size:2,spotColors:{"-1":"red",0:"black",1:"green"}},t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n1?1:0));return t.map((function(e,t){return{x:t*g+u,y:(d===h?1:d-e)*y+u}}))}}])},e.exports=r(n(0))},6:function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},8:function(e,t,n){var r=n(20),a=n(21),i=n(22);e.exports=function(e,t){return r(e)||a(e,t)||i()}},9:function(e,t,n){var r=n(30),a=n(31),i=n(32);e.exports=function(e){return r(e)||a(e)||i()}}})); \ No newline at end of file diff --git a/build/blocks/data.b82af12b.js b/build/blocks/data.4dc415e8.js similarity index 97% rename from build/blocks/data.b82af12b.js rename to build/blocks/data.4dc415e8.js index 1182e224..f273ccd4 100644 --- a/build/blocks/data.b82af12b.js +++ b/build/blocks/data.4dc415e8.js @@ -1 +1 @@ -!function(t,r){for(var e in r)t[e]=r[e]}(this,function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="/",e(e.s=176)}({1:function(t,r,e){t.exports=e(25)},104:function(t,r,e){var n=e(177);t.exports=function(t,r){if(null==t)return{};var e,o,i=n(t,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(i[e]=t[e])}return i}},176:function(t,r,e){"use strict";e.r(r),e.d(r,"store",(function(){return S}));var n=e(24),o=e.n(n),i=e(1),a=e.n(i),c=e(9),u=e.n(c),s=e(104),f=e.n(s),l=e(4),p=e.n(l);function h(t){var r=function(t,r){if("object"!==o()(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!==o()(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"===o()(r)?r:String(r)}function y(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function v(t){for(var r=1;r2&&void 0!==arguments[2]?arguments[2]:null;return t.views["".concat(r,":").concat(btoa(JSON.stringify(e)))]||!1},getIsLoading:function(t){return t.isLoading},getPost:function(t,r){return t.posts.find((function(t){return t.slug===r}))||null}},x={getViews:a.a.mark((function t(r){var e,n,o,i=arguments;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.length>1&&void 0!==i[1]?i[1]:null,t.next=3,w.setIsLoading(!0);case 3:return n="analytics/v1/xbs/".concat(r,"/views"),e&&(n=m(n,e)),t.next=7,w.fetch({path:n});case 7:return o=t.sent,t.next=10,w.addViews(r,e,o);case 10:return t.abrupt("return",w.setIsLoading(!1));case 11:case"end":return t.stop()}}),t)})),getPost:a.a.mark((function t(r){var e;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w.setIsLoading(!0);case 2:return t.prev=2,t.next=5,w.fetch({path:"analytics/v1/xbs/".concat(r)});case 5:return e=t.sent,t.next=8,w.addPost(e);case 8:t.next=14;break;case 10:return t.prev=10,t.t0=t.catch(2),t.next=14,w.addPost({slug:r,error:t.t0});case 14:return t.abrupt("return",w.setIsLoading(!1));case 15:case"end":return t.stop()}}),t,null,[[2,10]])}))},S=g("analytics/xbs",{actions:w,controls:b,initialState:{posts:[],views:{},isLoading:!1},reducer:function(t,r){switch(r.type){case"ADD_VIEWS":var e="".concat(r.clientId,":").concat(btoa(JSON.stringify(r.args)));return v({},t,{views:v({},t.views,p()({},e,r.views))});case"REMOVE_VIEWS":var n="".concat(r.clientId,":").concat(btoa(JSON.stringify(r.args)));t[n];return f()(t,[n].map(h));case"SET_IS_LOADING":return v({},t,{isLoading:r.isLoading});case"ADD_POST":return v({},t,{posts:[].concat(u()(t.posts),[r.post])});default:return t}},resolvers:x,selectors:O})},177:function(t,r){t.exports=function(t,r){if(null==t)return{};var e,n,o={},i=Object.keys(t);for(n=0;n=0||(o[e]=t[e]);return o}},24:function(t,r){function e(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=e=function(t){return typeof t}:t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(r)}t.exports=e},25:function(t,r,e){var n=function(t){"use strict";var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,r,e,n){var o=r&&r.prototype instanceof f?r:f,i=Object.create(o.prototype),a=new x(n||[]);return i._invoke=function(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return E()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=b(a,e);if(c){if(c===s)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var f=u(t,r,e);if("normal"===f.type){if(n=e.done?"completed":"suspendedYield",f.arg===s)continue;return{value:f.arg,done:e.done}}"throw"===f.type&&(n="completed",e.method="throw",e.arg=f.arg)}}}(t,e,a),i}function u(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var s={};function f(){}function l(){}function p(){}var h={};h[o]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(S([])));v&&v!==r&&e.call(v,o)&&(h=v);var d=p.prototype=f.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(r){t[r]=function(t){return this._invoke(r,t)}}))}function m(t){var r;this._invoke=function(n,o){function i(){return new Promise((function(r,i){!function r(n,o,i,a){var c=u(t[n],t,o);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&e.call(f,"__await")?Promise.resolve(f.__await).then((function(t){r("next",t,i,a)}),(function(t){r("throw",t,i,a)})):Promise.resolve(f).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,a)}))}a(c.arg)}(n,o,r,i)}))}return r=r?r.then(i,i):i()}}function b(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,b(t,r),"throw"===r.method))return s;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=u(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,s;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,s):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,s)}function w(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function O(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function S(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),u=e.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),s}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:S(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),s}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},30:function(t,r){t.exports=function(t){if(Array.isArray(t)){for(var r=0,e=new Array(t.length);r=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(i[e]=t[e])}return i}},177:function(t,r,e){"use strict";e.r(r),e.d(r,"store",(function(){return S}));var n=e(24),o=e.n(n),i=e(1),a=e.n(i),c=e(9),u=e.n(c),s=e(105),f=e.n(s),l=e(4),p=e.n(l);function h(t){var r=function(t,r){if("object"!==o()(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!==o()(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"===o()(r)?r:String(r)}function y(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function v(t){for(var r=1;r2&&void 0!==arguments[2]?arguments[2]:null;return t.views["".concat(r,":").concat(btoa(JSON.stringify(e)))]||!1},getIsLoading:function(t){return t.isLoading},getPost:function(t,r){return t.posts.find((function(t){return t.slug===r}))||null}},x={getViews:a.a.mark((function t(r){var e,n,o,i=arguments;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.length>1&&void 0!==i[1]?i[1]:null,t.next=3,w.setIsLoading(!0);case 3:return n="analytics/v1/xbs/".concat(r,"/views"),e&&(n=m(n,e)),t.next=7,w.fetch({path:n});case 7:return o=t.sent,t.next=10,w.addViews(r,e,o);case 10:return t.abrupt("return",w.setIsLoading(!1));case 11:case"end":return t.stop()}}),t)})),getPost:a.a.mark((function t(r){var e;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w.setIsLoading(!0);case 2:return t.prev=2,t.next=5,w.fetch({path:"analytics/v1/xbs/".concat(r)});case 5:return e=t.sent,t.next=8,w.addPost(e);case 8:t.next=14;break;case 10:return t.prev=10,t.t0=t.catch(2),t.next=14,w.addPost({slug:r,error:t.t0});case 14:return t.abrupt("return",w.setIsLoading(!1));case 15:case"end":return t.stop()}}),t,null,[[2,10]])}))},S=g("analytics/xbs",{actions:w,controls:b,initialState:{posts:[],views:{},isLoading:!1},reducer:function(t,r){switch(r.type){case"ADD_VIEWS":var e="".concat(r.clientId,":").concat(btoa(JSON.stringify(r.args)));return v({},t,{views:v({},t.views,p()({},e,r.views))});case"REMOVE_VIEWS":var n="".concat(r.clientId,":").concat(btoa(JSON.stringify(r.args)));t[n];return f()(t,[n].map(h));case"SET_IS_LOADING":return v({},t,{isLoading:r.isLoading});case"ADD_POST":return v({},t,{posts:[].concat(u()(t.posts),[r.post])});default:return t}},resolvers:x,selectors:O})},178:function(t,r){t.exports=function(t,r){if(null==t)return{};var e,n,o={},i=Object.keys(t);for(n=0;n=0||(o[e]=t[e]);return o}},24:function(t,r){function e(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=e=function(t){return typeof t}:t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(r)}t.exports=e},25:function(t,r,e){var n=function(t){"use strict";var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,r,e,n){var o=r&&r.prototype instanceof f?r:f,i=Object.create(o.prototype),a=new x(n||[]);return i._invoke=function(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return E()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=b(a,e);if(c){if(c===s)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var f=u(t,r,e);if("normal"===f.type){if(n=e.done?"completed":"suspendedYield",f.arg===s)continue;return{value:f.arg,done:e.done}}"throw"===f.type&&(n="completed",e.method="throw",e.arg=f.arg)}}}(t,e,a),i}function u(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var s={};function f(){}function l(){}function p(){}var h={};h[o]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(S([])));v&&v!==r&&e.call(v,o)&&(h=v);var d=p.prototype=f.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(r){t[r]=function(t){return this._invoke(r,t)}}))}function m(t){var r;this._invoke=function(n,o){function i(){return new Promise((function(r,i){!function r(n,o,i,a){var c=u(t[n],t,o);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&e.call(f,"__await")?Promise.resolve(f.__await).then((function(t){r("next",t,i,a)}),(function(t){r("throw",t,i,a)})):Promise.resolve(f).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,a)}))}a(c.arg)}(n,o,r,i)}))}return r=r?r.then(i,i):i()}}function b(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,b(t,r),"throw"===r.method))return s;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=u(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,s;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,s):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,s)}function w(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function O(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function S(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),u=e.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),O(e),s}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;O(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:S(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),s}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},30:function(t,r){t.exports=function(t){if(Array.isArray(t)){for(var r=0,e=new Array(t.length);r0}})),x((function(e,t,n){var r=t.clientId,o=n.select("core/block-editor").getBlockRootClientId,i=e("core/block-editor").selectBlock,a=o(r);return{onSelect:function(){return i(a)}}})))((function(e){var t=e.attributes,n=e.blocks,r=e.clientId,o=e.hasChildBlocks,i=e.isSelected,c=e.onSelect;Object(a.useEffect)((function(){i&&c()}),[i,c]);var s={};return o||(s.renderAppender=function(){return l.a.createElement(j.DefaultBlockAppender,null)}),l.a.createElement("div",{"data-block":r,"data-type":"altis/personalization-variant"},l.a.createElement(w,{blocks:n,clientId:r,goal:t.goal}),l.a.createElement(j,s))})),B=wp.blockEditor.InnerBlocks,A=function(){return l.a.createElement(B.Content,null)};function I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var D=wp.blocks.registerBlockType,C=wp.i18n.__,N=function(e){for(var t=1;t0}})),x((function(e,t,n){var r=t.clientId,o=n.select("core/block-editor").getBlockRootClientId,i=e("core/block-editor").selectBlock,a=o(r);return{onSelect:function(){return i(a)}}})))((function(e){var t=e.attributes,n=e.blocks,r=e.clientId,o=e.hasChildBlocks,i=e.isSelected,c=e.onSelect;Object(a.useEffect)((function(){i&&c()}),[i,c]);var s={};return o||(s.renderAppender=function(){return l.a.createElement(j.DefaultBlockAppender,null)}),l.a.createElement("div",{"data-block":r,"data-type":"altis/personalization-variant"},l.a.createElement(w,{blocks:n,clientId:r,goal:t.goal}),l.a.createElement(j,s))})),B=wp.blockEditor.InnerBlocks,A=function(){return l.a.createElement(B.Content,null)};function I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var D=wp.blocks.registerBlockType,C=wp.i18n.__,N=function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:0,n=(E[e[t+0]]+E[e[t+1]]+E[e[t+2]]+E[e[t+3]]+"-"+E[e[t+4]]+E[e[t+5]]+"-"+E[e[t+6]]+E[e[t+7]]+"-"+E[e[t+8]]+E[e[t+9]]+"-"+E[e[t+10]]+E[e[t+11]]+E[e[t+12]]+E[e[t+13]]+E[e[t+14]]+E[e[t+15]]).toLowerCase();if(!x(n))throw TypeError("Stringified UUID is invalid");return n};var O=function(e,t,n){var r=(e=e||{}).random||(e.rng||w)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=r[a];return t}return S(r)},A=n(2),I=n.n(A),j=n(3),_=n(43),N=n(44);function P(){var e=I()(["\n\tmargin: 10px 0 20px;\n"]);return P=function(){return e},e}function R(){var e=I()(["\n\tmargin: 0 auto;\n\tmax-width: 70rem;\n\n\t&& .media-frame-content {\n\t\ttop: 0;\n\t\tborder: 0;\n\t}\n\n\t.altis-analytics-block {\n\t\tmargin-left: 0;\n\t}\n"]);return R=function(){return e},e}var T=wp.components.Button,L=wp.data.useSelect,z=wp.i18n.__,B=Object(j.b)(_.a)(R()),F=j.b.div(P());var $=function(e){var t=e.clientId,n=Object(u.useState)(!1),r=l()(n,2),a=r[0],i=r[1],o=L((function(e){return e("analytics/xbs").getPost(t)}),[t]);return!o||o.error?null:f.a.createElement(F,{className:"audience-select"},f.a.createElement("div",{className:"audience-select__info"},f.a.createElement(T,{isPrimary:!0,onClick:function(){return i(!0)}},z("View experience insights","altis-analytics"))),a&&f.a.createElement(B,{portalId:"altis-analytics-xb-block-modal",onClose:function(){return i(!1)}},f.a.createElement(N.a,{clientId:t,showPosts:!1})))},M=n(9),D=n.n(M),q=wp.components.SelectControl,G=wp.i18n.__,V=window.Altis.Analytics.Experiments.Goals||{},U=function(e){var t=e.goal,n=e.onChange,r=Object.entries(V);if(r.length<1)return null;var a=[{label:G("Impressions","altis-analytics"),value:""}].concat(D()(r.map((function(e){var t=l()(e,2),n=t[0];return{label:t[1].label||n,value:n}}))));return f.a.createElement(q,{label:G("Choose a conversion goal","altis-analytics"),options:a,value:t,onChange:n})},H=n(24),W=n.n(H),Y=wp.data.useSelect,X=wp.i18n.__,J=function(e){var t=e.variant,n=e.placeholder,r=void 0===n?null:n,a=!0;t&&"object"===W()(t)||(t={attributes:{}},a=!1);var i=Y((function(e){return e("audience").getPost(t.attributes.audience)}),[t.attributes.audience]),o=Y((function(e){return e("audience").getIsLoading()}),[]);if(!a)return"";if(t.attributes.fallback)return X("Fallback","altis-analytics");if(!t.attributes.audience)return r||X("Select audience","altis-analytics");var c=i&&i.status||"draft",s=i&&i.title&&i.title.rendered;return"trash"!==c&&s?i.title.rendered:"trash"===c?X("(deleted)","altis-analytics"):i&&i.error&&i.error.message?i.error.message:o?X("Loading...","altis-analytics"):""},Z=Altis.Analytics.components.AudiencePicker,K=wp.components.PanelBody,Q=wp.data.useDispatch,ee=wp.i18n.__,te=function(e){var t=e.variant,n=e.placeholder,r=void 0===n?null:n,a=Q("core/block-editor").updateBlockAttributes;return t.attributes.fallback?f.a.createElement(K,{title:ee("Fallback","altis-analytics")},f.a.createElement("p",{className:"description"},ee("This variant will be shown as a fallback if no audiences are matched.","altis-analytics")," ",ee("Add fallback content to compare its performance against personalized content.","altis-analytics")),f.a.createElement(U,{goal:t.attributes.goal,onChange:function(e){return a(t.clientId,{goal:e})}})):f.a.createElement(K,{title:f.a.createElement(J,{placeholder:r,variant:t})},f.a.createElement(Z,{audience:t.attributes.audience,onClearSelection:function(){return a(t.clientId,{audience:null})},onSelect:function(e){return a(t.clientId,{audience:e})}}),!t.attributes.audience&&f.a.createElement("p",{className:"description"},ee("You must select an audience for this variant.","altis-analytics")),f.a.createElement(U,{goal:t.attributes.goal,onChange:function(e){return a(t.clientId,{goal:e})}}))},ne=wp.components.IconButton,re=wp.i18n.__,ae=function(e){var t=e.canRemove,n=e.isFallback,r=e.onCopy,a=e.onRemove;return f.a.createElement("div",{className:"altis-experience-block-header__toolbar"},f.a.createElement(ne,{icon:"migrate",title:re("Copy variant","altis-analytics"),onClick:r},re("Copy","altis-analytics")),!n&&f.a.createElement(ne,{disabled:!t,icon:"trash",title:re("Remove variant","altis-analytics"),onClick:a}))};function ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function oe(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},a=t.clientId,i=e("core/block-editor"),o=i.replaceInnerBlocks,c=i.selectBlock,s=n.select("core/block-editor"),l=s.getBlocks,u=se("altis/personalization-variant",oe({audience:null,fallback:!1,goal:""},r),[]),f=[u].concat(D()(l(a)));return o(a,f),c(a),u.clientId},onCopyVariant:function(t){var r=e("core/block-editor").replaceInnerBlocks,a=n.select("core/block-editor"),i=a.getBlock,o=a.getBlocks,c=a.getBlockRootClientId,s=i(t),l=le(s,{audience:null,fallback:!1}),u=c(t),f=o(u),d=f.findIndex((function(e){return e.clientId===t})),p=s.attributes.fallback?d:d+1;return r(u,[].concat(D()(f.slice(0,p)),[l],D()(f.slice(p)))),l.clientId},onRemoveVariant:function(r){var a=t.clientId,i=t.attributes,o=e("core/block-editor").replaceInnerBlocks,c=n.select("core/block-editor").getBlocks;i.fallback||o(a,c(a).filter((function(e){return e.clientId!==r})))},onSelect:function(){var n=t.clientId;(0,e("core/block-editor").selectBlock)(n)}}})))(e)},he=wp.blockEditor,ge=he.BlockControls,ve=he.InnerBlocks,ye=he.InspectorControls,be=wp.components,we=be.Button,ke=be.Icon,xe=be.PanelBody,Ee=be.TextControl,Ce=be.Toolbar,Se=wp.htmlEntities.decodeEntities,Oe=wp.i18n,Ae=Oe.__,Ie=Oe.sprintf,je=["altis/personalization-variant"],_e=function e(t){var n=t.attributes,r=t.className,a=t.clientId,i=t.currentPost,o=t.isSelected,c=t.onAddVariant,s=t.onCopyVariant,d=t.onRemoveVariant,p=t.onSelect,m=t.setAttributes,h=t.variants;Object(u.useEffect)((function(){n.clientId||m({clientId:O()})}),[n.clientId,m]),Object(u.useEffect)((function(){"xb"===i.type&&m({title:i.title})}),[i.title,i.type,m]);var g=Object(u.useRef)(null);Object(u.useEffect)((function(){g.current||(g.current=++e.instanceNumber)}),[o]);var v=h.length>0&&h[0].clientId||null,y=Object(u.useState)(v),b=l()(y,2),w=b[0],k=b[1];Object(u.useEffect)((function(){var e=window.addEventListener("altis-xb-set-variant",(function(e){e.detail.clientId===n.clientId&&(p(),Object.prototype.hasOwnProperty.call(e.detail,"variantIndex")&&h[e.detail.variantIndex]&&k(h[e.detail.variantIndex].clientId),Object.prototype.hasOwnProperty.call(e.detail,"variantClientId")&&k(e.detail.variantClientId))}));return function(){window.removeEventListener("altis-xb-set-variant",e)}}),[n.clientId,p,k,h]);var x=Object(u.useState)(),E=l()(x,2),C=E[0],S=E[1];Object(u.useEffect)((function(){0===h.length&&k(c({fallback:!0}))}),[h.length,c]);var A=h.findIndex((function(e){return e.clientId===w})),I=[{icon:"plus",title:Ae("Add a variant","altis-analytics"),className:"altis-add-variant-button",onClick:function(){return k(c())}}];return f.a.createElement(u.Fragment,null,f.a.createElement(ge,null,f.a.createElement(Ce,{className:"altis-variants-toolbar",controls:I},f.a.createElement("div",{className:"altis-variants-toolbar__tabs"},h.map((function(e,t){return f.a.createElement(we,{key:"variant-select-".concat(e.clientId),className:"altis-variant-button components-icon-button has-text ".concat(w===e.clientId&&"is-active"),title:Ae("Select variant","altis-analytics"),onClick:function(){return k(e.clientId)}},f.a.createElement(J,{placeholder:Ie(Ae("Variant %d","altis-analytics"),t+1),variant:e}))}))))),f.a.createElement(ye,null,f.a.createElement("div",{className:"components-panel__body is-opened"},"xb"!==i.type&&f.a.createElement(Ee,{label:f.a.createElement("strong",null,Ae("Block Title","altis-analytics")),placeholder:Ie(Ae("%s (XB %d)","atlis-analytics"),i.title,g.current),value:Se(n.title||""),onChange:function(e){return m({title:Se(e)})}}),f.a.createElement($,{clientId:n.clientId}),f.a.createElement(we,{isSecondary:!0,onClick:function(){return k(c())}},Ae("Add a variant","altis-analytics"))),h.map((function(e,t){return f.a.createElement(te,{key:"variant-settings-".concat(e.clientId),className:"variant-settings-".concat(e.clientId),placeholder:Ie(Ae("Variant %d","altis-analytics"),t+1),variant:e,onMouseDown:function(){return k(e.clientId)}})})),f.a.createElement(xe,{title:Ae("Reset Analytics Data","altis-analytics")},f.a.createElement("p",null,f.a.createElement("em",null,Ae("Editing an experience block may make the existing analytics data meaningless, for example when changing conversion goals or making significant changes to the content."))),f.a.createElement("p",null,Ae("You can reset the tracking data for this block to ensure it is relevant by clicking the button below.")),f.a.createElement(we,{isDestructive:!0,onClick:function(){S(n.clientId),m({clientId:O()})}},Ae("Reset","altis-analytics"))," ",C&&f.a.createElement(we,{isLink:!0,isTertiary:!0,onClick:function(){S(null),m({clientId:C})}},Ae("Undo","altis-analytics")))),f.a.createElement("style",{dangerouslySetInnerHTML:{__html:'\n\t\t\t\t\t[data-block="'.concat(a,'"] [data-type="altis/personalization-variant"] {\n\t\t\t\t\t\tdisplay: none;\n\t\t\t\t\t}\n\t\t\t\t\t[data-block="').concat(a,'"] [data-type="altis/personalization-variant"][data-block="').concat(w,'"] {\n\t\t\t\t\t\tdisplay: block;\n\t\t\t\t\t}\n\t\t\t\t')}}),f.a.createElement("div",{className:r},f.a.createElement("div",{className:"wp-core-ui altis-experience-block-header"},f.a.createElement("span",{className:"altis-experience-block-header__title"},f.a.createElement(ke,{icon:"groups"}),!n.title&&Ae("Personalized Content","altis-analytics"),Se(n.title)," ・ ",h.length>0&&f.a.createElement(J,{placeholder:Ie(Ae("Variant %d","altis-analytics"),A+1),variant:h[A]})),o&&f.a.createElement(ae,{canRemove:h.length>1,isFallback:w&&h[A].attributes.fallback,onCopy:function(){return k(s(w))},onRemove:function(){k(0===A?h[A+1].clientId:h[A-1].clientId),d(w)}})),f.a.createElement(ve,{allowedBlocks:je,renderAppender:!1})))};_e.instanceNumber=0;var Ne=me(_e),Pe=wp.blockEditor.InnerBlocks,Re=function(){return f.a.createElement(Pe.Content,null)},Te=n(37),Le=wp.blocks.createBlock,ze=wp.data.select;function Be(){var e=ze("core/block-editor"),t=e.getSelectedBlockCount,n=e.getSelectedBlock,r=e.getMultiSelectedBlocks;return t()>1?r():[n()]}var Fe={from:[{type:"block",isMultiBlock:!0,blocks:["*"],transform:function(){return Le(c.name,{},[Le(Te.name,{fallback:!0,audience:null},Be().map((function(e){return Le(e.name,e.attributes,e.innerBlocks)})))])},isMatch:function(){return!Be().filter((function(e){var t;return e.name===c.name||(null===(t=wp.blocks.getBlockType(e.name).parent)||void 0===t?void 0:t.length)})).length}}]};function $e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Me(e){for(var t=1;t=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}},26:function(e,t){e.exports=function(e,t,n,r){var a=n?n.call(r,e,t):void 0;if(void 0!==a)return!!a;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(t),s=0;sr&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(h,"$1"+e.trim());case 58:return e.trim()+t.replace(h,"$1"+e.trim());default:if(0<1*n&&0s.charCodeAt(8))break;case 115:o=o.replace(s,"-webkit-"+s)+";"+o;break;case 207:case 102:o=o.replace(s,"-webkit-"+(102c.charCodeAt(0)&&(c=c.trim()),c=[c],0p)&&($=(q=q.replace(" ",":")).length),01?t-1:0),r=1;r0?" Additional arguments: "+n.join(", "):""))}var C=function(e){var t=document.head,n=e||t,r=document.createElement("style"),a=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(b))return r}}(n),i=void 0!==a?a.nextSibling:null;r.setAttribute(b,"active"),r.setAttribute("data-styled-version","5.0.1");var o=x();return o&&r.setAttribute("nonce",o),n.insertBefore(r,i),r},S=function(){function e(e){var t=this.element=C(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,a=r;e>=a;)(a<<=1)<0&&E(16,""+e);this.groupSizes=new Uint32Array(a),this.groupSizes.set(n),this.length=a;for(var i=r;i=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),a=r+n,i=r;i=N&&(N=t+1),j.set(e,t),_.set(t,e)},L="style["+b+'][data-styled-version="5.0.1"]',z=/(?:\s*)?(.*?){((?:{[^}]*}|(?!{).*?)*)}/g,B=new RegExp("^"+b+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\]'),F=function(e,t,n){for(var r,a=n.split(","),i=0,o=a.length;i0&&(l+=e+",")})),r+=""+c+s+'{content:"'+l+'"}\n'}}}return r}(this)},e}(),G=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},V=function(e){return G(5381,e)};var U=/^\s*\/\/.*$/gm;function H(e){var t,n,r,a=void 0===e?h:e,i=a.options,c=void 0===i?h:i,s=a.plugins,l=void 0===s?m:s,u=new o.a(c),f=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,a,i,o,c,s,l,u,f){switch(n){case 1:if(0===u&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(a[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),p=function(e,r,a){return r>0&&-1!==a.slice(0,r).indexOf(n)&&a.slice(r-n.length,r)!==n?"."+t:e};function g(e,a,i,o){void 0===o&&(o="&");var c=e.replace(U,""),s=a&&i?i+" "+a+" { "+c+" }":c;return t=o,n=a,r=new RegExp("\\"+n+"\\b","g"),u(i||!a?"":a,s)}return u.use([].concat(l,[function(e,t,a){2===e&&a.length&&a[0].lastIndexOf(n)>0&&(a[0]=a[0].replace(r,p))},d,function(e){if(-2===e){var t=f;return f=[],t}}])),g.hash=l.length?l.reduce((function(e,t){return t.name||E(15),G(e,t.name)}),5381).toString():"",g}var W=i.a.createContext(),Y=(W.Consumer,i.a.createContext()),X=(Y.Consumer,new q),J=H();function Z(){return Object(a.useContext)(W)||X}function K(){return Object(a.useContext)(Y)||J}var Q=function(){function e(e,t){var n=this;this.inject=function(e){e.hasNameForId(n.id,n.name)||e.insertRules(n.id,n.name,J.apply(void 0,n.stringifyArgs))},this.toString=function(){return E(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.stringifyArgs=t}return e.prototype.getName=function(){return this.name},e}(),ee=/([A-Z])/g,te=/^ms-/;function ne(e){return e.replace(ee,"-$1").toLowerCase().replace(te,"-ms-")}var re=function(e){return null==e||!1===e||""===e},ae=function e(t,n){var r=[];return Object.keys(t).forEach((function(n){if(!re(t[n])){if(p(t[n]))return r.push.apply(r,e(t[n],n)),r;if(g(t[n]))return r.push(ne(n)+":",t[n],";"),r;r.push(ne(n)+": "+(a=n,(null==(i=t[n])||"boolean"==typeof i||""===i?"":"number"!=typeof i||0===i||a in c.a?String(i).trim():i+"px")+";"))}var a,i;return r})),n?[n+" {"].concat(r,["}"]):r};function ie(e,t,n){if(Array.isArray(e)){for(var r,a=[],i=0,o=e.length;i1?t-1:0),r=1;r1?t-1:0),r=1;r25?39:97))};function pe(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=de(t%52)+n;return(de(t%52)+n).replace(fe,"$1-$2")}function me(e){for(var t=0;t>>0);if(!t.hasNameForId(r,i)){var o=n(a,"."+i,void 0,r);t.insertRules(r,i,o)}return this.staticRulesId=i,i}for(var c=this.rules.length,s=G(this.baseHash,n.hash),l="",u=0;u>>0);if(!t.hasNameForId(r,m)){var h=n(l,"."+m,void 0,r);t.insertRules(r,m,h)}return m},e}(),ge=(new Set,function(e,t,n){return void 0===n&&(n=h),e.theme!==n.theme&&e.theme||t||n.theme}),ve=/[[\].#*$><+~=|^:(),"'`-]+/g,ye=/(^-|-$)/g;function be(e){return e.replace(ve,"-").replace(ye,"")}function we(e){return"string"==typeof e&&!0}var ke=function(e){return pe(V(e)>>>0)};var xe=i.a.createContext();xe.Consumer;var Ee={};function Ce(e,t,n){var r=e.attrs,i=e.componentStyle,o=e.defaultProps,c=e.foldedComponentIds,l=e.styledComponentId,u=e.target;Object(a.useDebugValue)(l);var d=function(e,t,n){void 0===e&&(e=h);var r=f({},t,{theme:e}),a={};return n.forEach((function(e){var t,n,i,o=e;for(t in g(o)&&(o=o(r)),o)r[t]=a[t]="className"===t?(n=a[t],i=o[t],n&&i?n+" "+i:n||i):o[t]})),[r,a]}(ge(t,Object(a.useContext)(xe),o)||h,t,r),p=d[0],m=d[1],v=function(e,t,n,r){var i=Z(),o=K(),c=e.isStatic&&!t?e.generateAndInjectStyles(h,i,o):e.generateAndInjectStyles(n,i,o);return Object(a.useDebugValue)(c),c}(i,r.length>0,p),y=n,b=m.as||t.as||u,w=we(b),k=m!==t?f({},t,{},m):t,x=w||"as"in k||"forwardedAs"in k,E=x?{}:f({},k);if(x)for(var C in k)"forwardedAs"===C?E.as=k[C]:"as"===C||"forwardedAs"===C||w&&!Object(s.a)(C)||(E[C]=k[C]);return t.style&&m.style!==t.style&&(E.style=f({},t.style,{},m.style)),E.className=Array.prototype.concat(c,l,v!==l?v:null,t.className,m.className).filter(Boolean).join(" "),E.ref=y,Object(a.createElement)(b,E)}function Se(e,t,n){var r,a=y(e),o=!we(e),c=t.displayName,s=void 0===c?function(e){return we(e)?"styled."+e:"Styled("+v(e)+")"}(e):c,l=t.componentId,d=void 0===l?function(e,t){var n="string"!=typeof e?"sc":be(e);Ee[n]=(Ee[n]||0)+1;var r=n+"-"+ke(n+Ee[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):l,p=t.attrs,h=void 0===p?m:p,g=t.displayName&&t.componentId?be(t.displayName)+"-"+t.componentId:t.componentId||d,b=a&&e.attrs?Array.prototype.concat(e.attrs,h).filter(Boolean):h,w=new he(a?e.componentStyle.rules.concat(n):n,g),k=function(e,t){return Ce(r,e,t)};return k.displayName=s,(r=i.a.forwardRef(k)).attrs=b,r.componentStyle=w,r.displayName=s,r.foldedComponentIds=a?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):m,r.styledComponentId=g,r.target=a?e.target:e,r.withComponent=function(e){var r=t.componentId,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r=0||(a[n]=e[n]);return a}(t,["componentId"]),i=r&&r+"-"+(we(e)?e:be(v(e)));return Se(e,f({},a,{attrs:b,componentId:i}),n)},Object.defineProperty(r,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=a?ue({},e.defaultProps,t):t}}),r.toString=function(){return"."+r.styledComponentId},o&&u()(r,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,self:!0,styledComponentId:!0,target:!0,withComponent:!0}),r}var Oe=function(e){return function e(t,n,a){if(void 0===a&&(a=h),!Object(r.isValidElementType)(n))return E(1,String(n));var i=function(){return t(n,a,oe.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,f({},a,{},r))},i.attrs=function(r){return e(t,n,f({},a,{attrs:Array.prototype.concat(a.attrs,r).filter(Boolean)}))},i}(Se,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Oe[e]=Oe(e)}));t.b=Oe}).call(this,n(34))},30:function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1)for(var n=1;n=0?"#29A36A":"#E85984"}));function g(e){var t=e.current,n=void 0===t?0:t,r=e.previous,a=void 0===r?0:r,i=e.className,o=void 0===i?"altis-analytics-lift":i,c=Object(p.e)(n,a);return s.a.createElement(h,{className:o,lift:c},s.a.createElement("span",null,c>=0||isNaN(c)?"⬆":"⬇"),Object(p.a)(c))}function v(){var e=o()(["\n\tflex: 1;\n\tmargin: 20px;\n\tpadding: 20px;\n\tbackground: #fff;\n\tbox-shadow: 0 3px 6px rgba( 0, 0, 0, .3 );\n\tborder-radius: 2px;\n\n\th3, p {\n\t\tmargin: 0;\n\t\tflex: none;\n\t\twidth: 100%;\n\t}\n\th3 {\n\t\tmargin-bottom: 10px;\n\t}\n\n\t.dashicon {\n\t\tmargin-top: -6px;\n\t\tmargin-right: 4px;\n\t\tborder-radius: 100px;\n\t\tpadding: 5px;\n\t\ttext-align: center;\n\t}\n\n\t.altis-analytics-card__metrics {\n\t\tdisplay: flex;\n\t\talign-items: baseline;\n\t}\n\n\t.altis-analytics-card__metric {\n\t\tmargin: 20px 0;\n\t\tfont-size: 38px;\n\t\tline-height: 38px;\n\t\tfont-weight: bold;\n\t\tflex: 2;\n\t}\n\n\t.altis-analytics-card__lift {\n\t\tmargin: 20px 0 0;\n\t\tfont-size: 24px;\n\t\tline-height: 38px;\n\t\tfont-weight: bold;\n\t\tflex: 1;\n\t\ttext-align: right;\n\t}\n\n\t&.yellow .dashicon {\n\t\tcolor: #EFBD0B;\n\t\tbackground: rgba(248, 218, 109, .2);\n\t}\n\t&.green .dashicon {\n\t\tcolor: #3FCF8E;\n\t\tbackground: rgba(63, 207, 142, .2);\n\t}\n\t&.blue .dashicon {\n\t\tcolor: #4767df;\n\t\tbackground: rgba(67, 108, 255, .2);\n\t}\n\t&.blue .altis-analytics-card__metric {\n\t\tcolor: #4767df;\n\t}\n"]);return v=function(){return e},e}function y(){var e=o()(["\n\tdisplay: flex;\n\tmargin: 0 -20px;\n"]);return y=function(){return e},e}var b=wp.components.Icon,w=l.b.div(y()),k=l.b.div(v());function x(e){var t=e.cards,n=void 0===t?[]:t;return 0===n.length?null:s.a.createElement(w,{className:"altis-analytics-cards"},n.map((function(e){return s.a.createElement(k,{className:["altis-analytics-card",e.color].join(" ")},s.a.createElement("h3",null,e.icon&&s.a.createElement(b,{icon:e.icon})," ",e.title),s.a.createElement("div",{className:"altis-analytics-card__metrics"},s.a.createElement("div",{className:"altis-analytics-card__metric"},null!==e.metric?Object(p.a)(e.metric):"…"),e.lift&&s.a.createElement(g,d()({className:"altis-analytics-card__lift"},e.lift))),s.a.createElement("p",{className:"description"},e.description))})))}x.defaultProps={title:"",color:"",icon:null,metric:null,lift:null,description:""};var E=x;function C(){var e=o()(["\n\tlabel {\n\t\tcursor: pointer;\n\t\tborder: 1px solid transparent;\n\t\tborder-radius: 100px;\n\t\tpadding: 1px 8px;\n\t\tmargin-right: 2px;\n\t}\n\n\tinput {\n\t\tvisibility: hidden;\n\t\tposition: absolute;\n\t}\n\n\tinput:checked + label {\n\t\tborder-color: rgba(0,0,0,.3);\n\t\tfont-weight: bold;\n\t}\n"]);return C=function(){return e},e}var S=wp.i18n,O=S.__,A=S.sprintf,I=l.b.form(C());function j(e){var t=e.value,n=e.ranges,r=e.onSetRange;return s.a.createElement(I,{className:"altis-analytics-date-range"},n.map((function(e){return s.a.createElement(s.a.Fragment,null,s.a.createElement("input",{checked:t===e,id:"altis-analytics-date-range-".concat(e),name:"altis-analytics-date-range",type:"radio",value:e,onChange:function(t){t.target.checked&&r(e)}}),s.a.createElement("label",{htmlFor:"altis-analytics-date-range-".concat(e)},A(O("%d days","altis-analytics"),e)))})))}function _(){var e=o()(["\n\tpadding-bottom: 30px;\n\n\t& h2 {\n\t\tcolor: #4767df;\n\t}\n\n\t.altis-analytics-block-variant {\n\t\tmargin: 30px 0 40px;\n\n\t\t&--fallback {\n\t\t\tmargin-bottom: 20px;\n\t\t\tborder-bottom: 1px solid rgba( 0, 0, 0, .2 );\n\t\t\tpadding-bottom: 20px;\n\t\t}\n\t}\n\n\tul {\n\t\tlist-style: none;\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tmargin: 10px 0 0;\n\t\tpadding: 0;\n\t}\n\n\tli {\n\t\tmargin-right: 40px;\n\t\tmargin-top: 10px;\n\t\tdisplay: flex;\n\t\tflex-direction: column-reverse;\n\t}\n\n\th3, p {\n\t\tmargin: 0;\n\t}\n\n\th3 {\n\t\tmargin-right: 40px;\n\t}\n\n\tli .description {\n\t\ttext-transform: uppercase;\n\t}\n\n\t.altis-analytics-block-variant__metric {\n\t\tfont-size: 24px;\n\t\tfont-weight: bold;\n\t\tmargin-bottom: 5px;\n\t}\n\n\t.audience-estimate svg {\n\t\tmax-height: 30px;\n\t}\n\n\t.blue {\n\t\tcolor: #4767df;\n\t}\n"]);return _=function(){return e},e}var N=wp.htmlEntities.decodeEntities,P=wp.i18n.__,R=l.b.div(_());function T(e){var t=e.analytics,n=e.variants;if(!n)return null;var r=n&&n.find((function(e){return e.fallback}))||{},a=t?t.audiences.find((function(e){return 0===e.id}))||u:null;return s.a.createElement(R,null,s.a.createElement("h2",null,P("Block Variants","altis-analytics")),n.map((function(e){var n=t&&t.audiences.find((function(t){return t.id===(e.audience&&e.audience.id)||0}))||u;return s.a.createElement("div",{className:"altis-analytics-block-variant ".concat(e.fallback?"altis-analytics-block-variant--fallback":"")},s.a.createElement("div",{className:"altis-analytics-block-variant__header"},s.a.createElement("h3",null,e.fallback?P("Fallback","altis-analytics"):N(e.audience.title)),e.goal&&s.a.createElement("p",{className:"description"},P("Goal","altis-analytics"),": ",s.a.createElement("strong",null,window.Altis.Analytics.Experiments.Goals[e.goal].label))),s.a.createElement("ul",null,s.a.createElement("li",null,s.a.createElement("p",{className:"description"},P("Total views","altis-analytics")),s.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.c)(n.views):"…")),s.a.createElement("li",null,s.a.createElement("p",{className:"description"},P("Unique views","altis-analytics")),s.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.c)(n.unique.views):"…")),e.goal&&s.a.createElement(s.a.Fragment,null,s.a.createElement("li",null,s.a.createElement("p",{className:"description"},P("Conversion rate","altis-analytics")),s.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.a)(n.unique.conversions/n.unique.views*100):"…")),!e.fallback&&r.goal&&a&&s.a.createElement("li",null,s.a.createElement("p",{className:"description"},P("Lift vs. fallback","altis-analytics")),s.a.createElement(g,{className:"altis-analytics-block-variant__metric",current:n.unique.conversions/n.unique.views,previous:a.unique.conversions/a.unique.views}))),!e.fallback&&s.a.createElement("li",null,s.a.createElement("p",{className:"description"},P("Audience coverage","altis-analytics")),s.a.createElement("div",{className:"altis-analytics-block-variant__metric blue"},t&&n?Object(p.a)(n.unique.views/t.unique.views*100):"…"))))})))}T.defaultProps={analytics:null,variants:[]};var L=T;function z(){var e=o()(["\n\tpadding: 40px 60px;\n\tmargin-left: -20px;\n\n\t& h1,\n\t& h2 {\n\t\tfont-size: 24px;\n\t\tmargin: 10px 0;\n\t\tline-height: 1;\n\t}\n\t& h1 + h2 {\n\t\tcolor: #4767df;\n\t}\n\n\t& h2 a {\n\t\ttext-decoration: none;\n\t\tborder-radius: 3px;\n\t\tmargin-left: 4px;\n\t\tmargin-top: -4px;\n\t\tborder: 1px solid rgba(67, 108, 255, .4);\n\t\twidth: 20px;\n\t\theight: 20px;\n\t\tdisplay: inline-block;\n\t\tvertical-align: middle;\n\t\tpadding: 0;\n\t}\n\n\t.altis-analytics-block-metrics {\n\t\tmargin: 40px -60px;\n\t\tbackground-color: rgba(67, 108, 255, .05);\n\t\tpadding: 20px 60px;\n\t}\n\n\t.altis-analytics-date-range {\n\t\tmargin: 0 0 20px;\n\t}\n"]);return z=function(){return e},e}var B=wp.components.Icon,F=wp.data.useSelect,$=wp.htmlEntities.decodeEntities,M=wp.i18n.__,D=l.b.div(z());t.a=function(e){var t=e.clientId,n=Object(c.useState)(7),r=a()(n,2),i=r[0],o=r[1],l=F((function(e){return e("analytics/xbs").getPost(t)}),[t]),f=F((function(e){return e("analytics/xbs").getViews(t,{days:i})}),[t,i]),d=F((function(e){return{current:e("analytics/xbs").getViews(t,{days:7}),previous:e("analytics/xbs").getViews(t,{days:7,offset:7})}}),[t]);if(!t)return s.a.createElement("div",{className:"message error"},s.a.createElement("p",null,M("Experience Block not found.")));if(l&&l.error)return s.a.createElement("div",{className:"message error"},s.a.createElement("p",null,l.error.message));var p=null;f&&(p=100-(f.audiences.find((function(e){return 0===e.id}))||u).unique.views/f.unique.views*100);return s.a.createElement(D,{className:"altis-analytics-block"},s.a.createElement("h1",null,M("Experience Insights","altis-analytics")),s.a.createElement("h2",null,l&&$(l.title.rendered)||M("Loading…","altis-analytics"),l&&Number(l.parent)>0&&s.a.createElement(s.a.Fragment,null," ",s.a.createElement("a",{href:"post.php?post=".concat(l.parent,"&action=edit")},s.a.createElement(B,{icon:"edit"}),s.a.createElement("span",{className:"screen-reader-text"},M("Edit block","altis-analytics"))))),s.a.createElement("div",{className:"altis-analytics-block-metrics"},s.a.createElement(j,{ranges:[7,30,90],value:i,onSetRange:o}),s.a.createElement(E,{cards:[{color:"yellow",icon:"visibility",title:M("Block Views","altis-analytics"),metric:f?f.unique.views:null,lift:{current:d.current&&d.current.unique.views,previous:d.previous&&d.previous.unique.views},description:M("Total number of times this block has been viewed by unique visitors to the website.","altis-analytics")},{color:"green",icon:"thumbs-up",title:M("Conversion Rate","altis-analytics"),metric:f?f.unique.conversions/f.unique.views*100:null,lift:{current:d.current&&d.current.unique.conversions/d.current.unique.views,previous:d.previous&&d.previous.unique.conversions/d.previous.unique.views},description:f&&0===f.unique.conversions?M("There are no conversions recorded yet, you may need to choose a conversion goal other than impressions for your variants."):M("Average conversion of the block as a percentage of total unique views of the block.","altis-analytics")},{color:"blue",icon:"groups",title:M("Personalization Coverage","altis-analytics"),metric:p,description:M("The percentage of visitors who are seeing personalised content.","altis-analytics")}]})),s.a.createElement(L,{analytics:f,variants:l&&l.variants||null}))}},5:function(e,t,n){"use strict";n.d(t,"i",(function(){return c})),n.d(t,"d",(function(){return l})),n.d(t,"f",(function(){return u})),n.d(t,"g",(function(){return m})),n.d(t,"h",(function(){return h})),n.d(t,"a",(function(){return g})),n.d(t,"e",(function(){return v})),n.d(t,"c",(function(){return y})),n.d(t,"b",(function(){return b}));var r=n(1),a=n.n(r),i=n(10),o=n.n(i),c=function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},s=function(e){return e.replace(/[^\0-~]/g,(function(e){return"\\u"+("000"+e.charCodeAt().toString(16)).slice(-4)}))},l=function(){return(navigator.language||navigator.browserLanguage||(navigator.languages||["en_US"])[0]).toLowerCase().replace("-","_")},u=function(e,t){return t},f=function(){var e=o()(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t){e.next=4;break}return e.next=3,t();case 3:t=e.sent;case 4:return e.abrupt("return",n(t));case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),d=function(e){return Array.isArray(e)?e.map((function(e){return s(e.toString())})):s(e.toString())},p=function(e){return parseFloat(Number(Array.isArray(e)?e[0]:e))},m=function(){var e=o()(a.a.mark((function e(t){var n,r,i,o,c=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=c.length>1&&void 0!==c[1]&&c[1],r={},e.t0=a.a.keys(t);case 3:if((e.t1=e.t0()).done){e.next=17;break}if(i=e.t1.value,o=Array.isArray(t[i])?t[i]:[t[i]],!n){e.next=12;break}return e.next=9,f(o,d);case 9:r[i]=e.sent,e.next=15;break;case 12:return e.next=14,f(o[0],d);case 14:r[i]=e.sent;case 15:e.next=3;break;case 17:return e.abrupt("return",r);case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),h=function(){var e=o()(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n={},e.t0=a.a.keys(t);case 2:if((e.t1=e.t0()).done){e.next=9;break}return r=e.t1.value,e.next=6,f(t[r],p);case 6:n[r]=e.sent,e.next=2;break;case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),g=function(e){if(isNaN(e))return 0;if(!isFinite(e))return e>=0?"∞%":"-∞%";var t="",n=e;return e>=1e3&&(t="k",n=e/1e3),e>=1e6&&(t="M",n=e/1e6),n=n<10&&n>0?n.toFixed(1):Math.round(n),Number.isInteger(e)||(t="%"),"".concat(n).concat(t)},v=function(e,t){return(e-t)/e*100},y=function(e){return(new Intl.NumberFormat).format(e)},b=function(e){return new RegExp([/bot/,/spider/,/crawl/,/APIs-Google/,/AdsBot/,/Googlebot/,/mediapartners/,/Google Favicon/,/FeedFetcher/,/Google-Read-Aloud/,/DuplexWeb-Google/,/googleweblight/,/bing/,/yandex/,/baidu/,/duckduck/,/yahoo/,/ecosia/,/ia_archiver/,/facebook/,/instagram/,/pinterest/,/reddit/,/slack/,/twitter/,/whatsapp/,/youtube/,/semrush/].map((function(e){return e.source})).join("|"),"i").test(e)}},52:function(e){e.exports=JSON.parse('{"name":"altis/shim","settings":{"category":"altis-experience-blocks","supports":{"inserter":false},"attributes":{"content":{"type":"string"}}}}')},6:function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},8:function(e,t,n){var r=n(20),a=n(21),i=n(22);e.exports=function(e,t){return r(e)||a(e,t)||i()}},9:function(e,t,n){var r=n(30),a=n(31),i=n(32);e.exports=function(e){return r(e)||a(e)||i()}}})); \ No newline at end of file diff --git a/build/blocks/personalization.b82af12b.js b/build/blocks/personalization.b82af12b.js deleted file mode 100644 index 9a1dcaf0..00000000 --- a/build/blocks/personalization.b82af12b.js +++ /dev/null @@ -1,9 +0,0 @@ -!function(e,t){for(var n in t)e[n]=t[n]}(this,function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=183)}({0:function(e,t){!function(){e.exports=this.React}()},1:function(e,t,n){e.exports=n(25)},10:function(e,t){function n(e,t,n,r,a,i,o){try{var c=e[i](o),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,a)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(a,i){var o=e.apply(t,r);function c(e){n(o,a,i,c,s,"next",e)}function s(e){n(o,a,i,c,s,"throw",e)}c(void 0)}))}}},11:function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},12:function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},13:function(e,t){function n(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:0,n=(x[e[t+0]]+x[e[t+1]]+x[e[t+2]]+x[e[t+3]]+"-"+x[e[t+4]]+x[e[t+5]]+"-"+x[e[t+6]]+x[e[t+7]]+"-"+x[e[t+8]]+x[e[t+9]]+"-"+x[e[t+10]]+x[e[t+11]]+x[e[t+12]]+x[e[t+13]]+x[e[t+14]]+x[e[t+15]]).toLowerCase();if(!k(n))throw TypeError("Stringified UUID is invalid");return n};var S=function(e,t,n){var r=(e=e||{}).random||(e.rng||b)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=r[a];return t}return C(r)},O=n(2),A=n.n(O),I=n(3),j=n(41),_=n(42);function N(){var e=A()(["\n\tmargin: 10px 0 20px;\n"]);return N=function(){return e},e}function P(){var e=A()(["\n\tmargin: 0 auto;\n\tmax-width: 70rem;\n\n\t&& .media-frame-content {\n\t\ttop: 0;\n\t\tborder: 0;\n\t}\n\n\t.altis-analytics-block {\n\t\tmargin-left: 0;\n\t}\n"]);return P=function(){return e},e}var R=wp.components.Button,T=wp.data.useSelect,L=wp.i18n.__,z=Object(I.b)(j.a)(P()),$=I.b.div(N());var B=function(e){var t=e.clientId,n=Object(l.useState)(!1),r=s()(n,2),a=r[0],i=r[1],o=T((function(e){return e("analytics/xbs").getPost(t)}),[t]);return!o||o.error?null:u.a.createElement($,{className:"audience-select"},u.a.createElement("div",{className:"audience-select__info"},u.a.createElement(R,{isPrimary:!0,onClick:function(){return i(!0)}},L("View experience insights","altis-analytics"))),a&&u.a.createElement(z,{portalId:"altis-analytics-xb-block-modal",onClose:function(){return i(!1)}},u.a.createElement(_.a,{clientId:t,showPosts:!1})))},F=n(9),M=n.n(F),D=wp.components.SelectControl,q=wp.i18n.__,G=window.Altis.Analytics.Experiments.Goals||{},V=function(e){var t=e.goal,n=e.onChange,r=Object.entries(G);if(r.length<1)return null;var a=[{label:q("Impressions","altis-analytics"),value:""}].concat(M()(r.map((function(e){var t=s()(e,2),n=t[0];return{label:t[1].label||n,value:n}}))));return u.a.createElement(D,{label:q("Choose a conversion goal","altis-analytics"),options:a,value:t,onChange:n})},U=n(24),H=n.n(U),W=wp.data.useSelect,Y=wp.i18n.__,X=function(e){var t=e.variant,n=e.placeholder,r=void 0===n?null:n,a=!0;t&&"object"===H()(t)||(t={attributes:{}},a=!1);var i=W((function(e){return e("audience").getPost(t.attributes.audience)}),[t.attributes.audience]),o=W((function(e){return e("audience").getIsLoading()}),[]);if(!a)return"";if(t.attributes.fallback)return Y("Fallback","altis-analytics");if(!t.attributes.audience)return r||Y("Select audience","altis-analytics");var c=i&&i.status||"draft",s=i&&i.title&&i.title.rendered;return"trash"!==c&&s?i.title.rendered:"trash"===c?Y("(deleted)","altis-analytics"):i&&i.error&&i.error.message?i.error.message:o?Y("Loading...","altis-analytics"):""},Z=Altis.Analytics.components.AudiencePicker,J=wp.components.PanelBody,K=wp.data.useDispatch,Q=wp.i18n.__,ee=function(e){var t=e.variant,n=e.placeholder,r=void 0===n?null:n,a=K("core/block-editor").updateBlockAttributes;return t.attributes.fallback?u.a.createElement(J,{title:Q("Fallback","altis-analytics")},u.a.createElement("p",{className:"description"},Q("This variant will be shown as a fallback if no audiences are matched.","altis-analytics")," ",Q("Add fallback content to compare its performance against personalized content.","altis-analytics")),u.a.createElement(V,{goal:t.attributes.goal,onChange:function(e){return a(t.clientId,{goal:e})}})):u.a.createElement(J,{title:u.a.createElement(X,{placeholder:r,variant:t})},u.a.createElement(Z,{audience:t.attributes.audience,onClearSelection:function(){return a(t.clientId,{audience:null})},onSelect:function(e){return a(t.clientId,{audience:e})}}),!t.attributes.audience&&u.a.createElement("p",{className:"description"},Q("You must select an audience for this variant.","altis-analytics")),u.a.createElement(V,{goal:t.attributes.goal,onChange:function(e){return a(t.clientId,{goal:e})}}))},te=wp.components.IconButton,ne=wp.i18n.__,re=function(e){var t=e.canRemove,n=e.isFallback,r=e.onCopy,a=e.onRemove;return u.a.createElement("div",{className:"altis-experience-block-header__toolbar"},u.a.createElement(te,{icon:"migrate",title:ne("Copy variant","altis-analytics"),onClick:r},ne("Copy","altis-analytics")),!n&&u.a.createElement(te,{disabled:!t,icon:"trash",title:ne("Remove variant","altis-analytics"),onClick:a}))};function ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ie(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},a=t.clientId,i=e("core/block-editor"),o=i.replaceInnerBlocks,c=i.selectBlock,s=n.select("core/block-editor"),l=s.getBlocks,u=ce("altis/personalization-variant",ie({audience:null,fallback:!1,goal:""},r),[]),f=[u].concat(M()(l(a)));return o(a,f),c(a),u.clientId},onCopyVariant:function(t){var r=e("core/block-editor").replaceInnerBlocks,a=n.select("core/block-editor"),i=a.getBlock,o=a.getBlocks,c=a.getBlockRootClientId,s=i(t),l=se(s,{audience:null,fallback:!1}),u=c(t),f=o(u),d=f.findIndex((function(e){return e.clientId===t})),p=s.attributes.fallback?d:d+1;return r(u,[].concat(M()(f.slice(0,p)),[l],M()(f.slice(p)))),l.clientId},onRemoveVariant:function(r){var a=t.clientId,i=t.attributes,o=e("core/block-editor").replaceInnerBlocks,c=n.select("core/block-editor").getBlocks;i.fallback||o(a,c(a).filter((function(e){return e.clientId!==r})))},onSelect:function(){var n=t.clientId;(0,e("core/block-editor").selectBlock)(n)}}})))(e)},me=wp.blockEditor,he=me.BlockControls,ge=me.InnerBlocks,ve=me.InspectorControls,ye=wp.components,be=ye.Button,we=ye.Icon,ke=ye.PanelBody,xe=ye.TextControl,Ee=ye.Toolbar,Ce=wp.htmlEntities.decodeEntities,Se=wp.i18n,Oe=Se.__,Ae=Se.sprintf,Ie=["altis/personalization-variant"],je=function e(t){var n=t.attributes,r=t.className,a=t.clientId,i=t.currentPost,o=t.isSelected,c=t.onAddVariant,f=t.onCopyVariant,d=t.onRemoveVariant,p=t.onSelect,m=t.setAttributes,h=t.variants;Object(l.useEffect)((function(){n.clientId||m({clientId:S()})}),[n.clientId,m]),Object(l.useEffect)((function(){"xb"===i.type&&m({title:i.title})}),[i.title,i.type,m]);var g=Object(l.useRef)(null);Object(l.useEffect)((function(){g.current||(g.current=++e.instanceNumber)}),[o]);var v=h.length>0&&h[0].clientId||null,y=Object(l.useState)(v),b=s()(y,2),w=b[0],k=b[1];Object(l.useEffect)((function(){var e=window.addEventListener("altis-xb-set-variant",(function(e){e.detail.clientId===n.clientId&&(p(),Object.prototype.hasOwnProperty.call(e.detail,"variantIndex")&&h[e.detail.variantIndex]&&k(h[e.detail.variantIndex].clientId),Object.prototype.hasOwnProperty.call(e.detail,"variantClientId")&&k(e.detail.variantClientId))}));return function(){window.removeEventListener("altis-xb-set-variant",e)}}),[n.clientId,p,k,h]);var x=Object(l.useState)(),E=s()(x,2),C=E[0],O=E[1];Object(l.useEffect)((function(){0===h.length&&k(c({fallback:!0}))}),[h.length,c]);var A=h.findIndex((function(e){return e.clientId===w})),I=[{icon:"plus",title:Oe("Add a variant","altis-analytics"),className:"altis-add-variant-button",onClick:function(){return k(c())}}];return u.a.createElement(l.Fragment,null,u.a.createElement(he,null,u.a.createElement(Ee,{className:"altis-variants-toolbar",controls:I},u.a.createElement("div",{className:"altis-variants-toolbar__tabs"},h.map((function(e,t){return u.a.createElement(be,{key:"variant-select-".concat(e.clientId),className:"altis-variant-button components-icon-button has-text ".concat(w===e.clientId&&"is-active"),title:Oe("Select variant","altis-analytics"),onClick:function(){return k(e.clientId)}},u.a.createElement(X,{placeholder:Ae(Oe("Variant %d","altis-analytics"),t+1),variant:e}))}))))),u.a.createElement(ve,null,u.a.createElement("div",{className:"components-panel__body is-opened"},"xb"!==i.type&&u.a.createElement(xe,{label:u.a.createElement("strong",null,Oe("Block Title","altis-analytics")),placeholder:Ae(Oe("%s (XB %d)","atlis-analytics"),i.title,g.current),value:Ce(n.title||""),onChange:function(e){return m({title:Ce(e)})}}),u.a.createElement(B,{clientId:n.clientId}),u.a.createElement(be,{isSecondary:!0,onClick:function(){return k(c())}},Oe("Add a variant","altis-analytics"))),h.map((function(e,t){return u.a.createElement(ee,{key:"variant-settings-".concat(e.clientId),className:"variant-settings-".concat(e.clientId),placeholder:Ae(Oe("Variant %d","altis-analytics"),t+1),variant:e,onMouseDown:function(){return k(e.clientId)}})})),u.a.createElement(ke,{title:Oe("Reset Analytics Data","altis-analytics")},u.a.createElement("p",null,u.a.createElement("em",null,Oe("Editing an experience block may make the existing analytics data meaningless, for example when changing conversion goals or making significant changes to the content."))),u.a.createElement("p",null,Oe("You can reset the tracking data for this block to ensure it is relevant by clicking the button below.")),u.a.createElement(be,{isDestructive:!0,onClick:function(){O(n.clientId),m({clientId:S()})}},Oe("Reset","altis-analytics"))," ",C&&u.a.createElement(be,{isLink:!0,isTertiary:!0,onClick:function(){O(null),m({clientId:C})}},Oe("Undo","altis-analytics")))),u.a.createElement("style",{dangerouslySetInnerHTML:{__html:'\n\t\t\t\t\t[data-block="'.concat(a,'"] [data-type="altis/personalization-variant"] {\n\t\t\t\t\t\tdisplay: none;\n\t\t\t\t\t}\n\t\t\t\t\t[data-block="').concat(a,'"] [data-type="altis/personalization-variant"][data-block="').concat(w,'"] {\n\t\t\t\t\t\tdisplay: block;\n\t\t\t\t\t}\n\t\t\t\t')}}),u.a.createElement("div",{className:r},u.a.createElement("div",{className:"wp-core-ui altis-experience-block-header"},u.a.createElement("span",{className:"altis-experience-block-header__title"},u.a.createElement(we,{icon:"groups"}),!n.title&&Oe("Personalized Content","altis-analytics"),Ce(n.title)," ・ ",h.length>0&&u.a.createElement(X,{placeholder:Ae(Oe("Variant %d","altis-analytics"),A+1),variant:h[A]})),o&&u.a.createElement(re,{canRemove:h.length>1,isFallback:w&&h[A].attributes.fallback,onCopy:function(){return k(f(w))},onRemove:function(){k(0===A?h[A+1].clientId:h[A-1].clientId),d(w)}})),u.a.createElement(ge,{allowedBlocks:Ie,renderAppender:!1})))};je.instanceNumber=0;var _e=pe(je),Ne=wp.blockEditor.InnerBlocks,Pe=function(){return u.a.createElement(Ne.Content,null)};function Re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Te=wp.blocks.registerBlockType,Le=wp.hooks.addFilter,ze=wp.i18n.__,$e=function(e){for(var t=1;t=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}},26:function(e,t){e.exports=function(e,t,n,r){var a=n?n.call(r,e,t):void 0;if(void 0!==a)return!!a;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(t),s=0;sr&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(h,"$1"+e.trim());case 58:return e.trim()+t.replace(h,"$1"+e.trim());default:if(0<1*n&&0s.charCodeAt(8))break;case 115:o=o.replace(s,"-webkit-"+s)+";"+o;break;case 207:case 102:o=o.replace(s,"-webkit-"+(102c.charCodeAt(0)&&(c=c.trim()),c=[c],0p)&&(F=(q=q.replace(" ",":")).length),01?t-1:0),r=1;r0?" Additional arguments: "+n.join(", "):""))}var C=function(e){var t=document.head,n=e||t,r=document.createElement("style"),a=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(b))return r}}(n),i=void 0!==a?a.nextSibling:null;r.setAttribute(b,"active"),r.setAttribute("data-styled-version","5.0.1");var o=x();return o&&r.setAttribute("nonce",o),n.insertBefore(r,i),r},S=function(){function e(e){var t=this.element=C(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,a=r;e>=a;)(a<<=1)<0&&E(16,""+e);this.groupSizes=new Uint32Array(a),this.groupSizes.set(n),this.length=a;for(var i=r;i=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),a=r+n,i=r;i=N&&(N=t+1),j.set(e,t),_.set(t,e)},L="style["+b+'][data-styled-version="5.0.1"]',z=/(?:\s*)?(.*?){((?:{[^}]*}|(?!{).*?)*)}/g,$=new RegExp("^"+b+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\]'),B=function(e,t,n){for(var r,a=n.split(","),i=0,o=a.length;i0&&(l+=e+",")})),r+=""+c+s+'{content:"'+l+'"}\n'}}}return r}(this)},e}(),G=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},V=function(e){return G(5381,e)};var U=/^\s*\/\/.*$/gm;function H(e){var t,n,r,a=void 0===e?h:e,i=a.options,c=void 0===i?h:i,s=a.plugins,l=void 0===s?m:s,u=new o.a(c),f=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,a,i,o,c,s,l,u,f){switch(n){case 1:if(0===u&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(a[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),p=function(e,r,a){return r>0&&-1!==a.slice(0,r).indexOf(n)&&a.slice(r-n.length,r)!==n?"."+t:e};function g(e,a,i,o){void 0===o&&(o="&");var c=e.replace(U,""),s=a&&i?i+" "+a+" { "+c+" }":c;return t=o,n=a,r=new RegExp("\\"+n+"\\b","g"),u(i||!a?"":a,s)}return u.use([].concat(l,[function(e,t,a){2===e&&a.length&&a[0].lastIndexOf(n)>0&&(a[0]=a[0].replace(r,p))},d,function(e){if(-2===e){var t=f;return f=[],t}}])),g.hash=l.length?l.reduce((function(e,t){return t.name||E(15),G(e,t.name)}),5381).toString():"",g}var W=i.a.createContext(),Y=(W.Consumer,i.a.createContext()),X=(Y.Consumer,new q),Z=H();function J(){return Object(a.useContext)(W)||X}function K(){return Object(a.useContext)(Y)||Z}var Q=function(){function e(e,t){var n=this;this.inject=function(e){e.hasNameForId(n.id,n.name)||e.insertRules(n.id,n.name,Z.apply(void 0,n.stringifyArgs))},this.toString=function(){return E(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.stringifyArgs=t}return e.prototype.getName=function(){return this.name},e}(),ee=/([A-Z])/g,te=/^ms-/;function ne(e){return e.replace(ee,"-$1").toLowerCase().replace(te,"-ms-")}var re=function(e){return null==e||!1===e||""===e},ae=function e(t,n){var r=[];return Object.keys(t).forEach((function(n){if(!re(t[n])){if(p(t[n]))return r.push.apply(r,e(t[n],n)),r;if(g(t[n]))return r.push(ne(n)+":",t[n],";"),r;r.push(ne(n)+": "+(a=n,(null==(i=t[n])||"boolean"==typeof i||""===i?"":"number"!=typeof i||0===i||a in c.a?String(i).trim():i+"px")+";"))}var a,i;return r})),n?[n+" {"].concat(r,["}"]):r};function ie(e,t,n){if(Array.isArray(e)){for(var r,a=[],i=0,o=e.length;i1?t-1:0),r=1;r1?t-1:0),r=1;r25?39:97))};function pe(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=de(t%52)+n;return(de(t%52)+n).replace(fe,"$1-$2")}function me(e){for(var t=0;t>>0);if(!t.hasNameForId(r,i)){var o=n(a,"."+i,void 0,r);t.insertRules(r,i,o)}return this.staticRulesId=i,i}for(var c=this.rules.length,s=G(this.baseHash,n.hash),l="",u=0;u>>0);if(!t.hasNameForId(r,m)){var h=n(l,"."+m,void 0,r);t.insertRules(r,m,h)}return m},e}(),ge=(new Set,function(e,t,n){return void 0===n&&(n=h),e.theme!==n.theme&&e.theme||t||n.theme}),ve=/[[\].#*$><+~=|^:(),"'`-]+/g,ye=/(^-|-$)/g;function be(e){return e.replace(ve,"-").replace(ye,"")}function we(e){return"string"==typeof e&&!0}var ke=function(e){return pe(V(e)>>>0)};var xe=i.a.createContext();xe.Consumer;var Ee={};function Ce(e,t,n){var r=e.attrs,i=e.componentStyle,o=e.defaultProps,c=e.foldedComponentIds,l=e.styledComponentId,u=e.target;Object(a.useDebugValue)(l);var d=function(e,t,n){void 0===e&&(e=h);var r=f({},t,{theme:e}),a={};return n.forEach((function(e){var t,n,i,o=e;for(t in g(o)&&(o=o(r)),o)r[t]=a[t]="className"===t?(n=a[t],i=o[t],n&&i?n+" "+i:n||i):o[t]})),[r,a]}(ge(t,Object(a.useContext)(xe),o)||h,t,r),p=d[0],m=d[1],v=function(e,t,n,r){var i=J(),o=K(),c=e.isStatic&&!t?e.generateAndInjectStyles(h,i,o):e.generateAndInjectStyles(n,i,o);return Object(a.useDebugValue)(c),c}(i,r.length>0,p),y=n,b=m.as||t.as||u,w=we(b),k=m!==t?f({},t,{},m):t,x=w||"as"in k||"forwardedAs"in k,E=x?{}:f({},k);if(x)for(var C in k)"forwardedAs"===C?E.as=k[C]:"as"===C||"forwardedAs"===C||w&&!Object(s.a)(C)||(E[C]=k[C]);return t.style&&m.style!==t.style&&(E.style=f({},t.style,{},m.style)),E.className=Array.prototype.concat(c,l,v!==l?v:null,t.className,m.className).filter(Boolean).join(" "),E.ref=y,Object(a.createElement)(b,E)}function Se(e,t,n){var r,a=y(e),o=!we(e),c=t.displayName,s=void 0===c?function(e){return we(e)?"styled."+e:"Styled("+v(e)+")"}(e):c,l=t.componentId,d=void 0===l?function(e,t){var n="string"!=typeof e?"sc":be(e);Ee[n]=(Ee[n]||0)+1;var r=n+"-"+ke(n+Ee[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):l,p=t.attrs,h=void 0===p?m:p,g=t.displayName&&t.componentId?be(t.displayName)+"-"+t.componentId:t.componentId||d,b=a&&e.attrs?Array.prototype.concat(e.attrs,h).filter(Boolean):h,w=new he(a?e.componentStyle.rules.concat(n):n,g),k=function(e,t){return Ce(r,e,t)};return k.displayName=s,(r=i.a.forwardRef(k)).attrs=b,r.componentStyle=w,r.displayName=s,r.foldedComponentIds=a?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):m,r.styledComponentId=g,r.target=a?e.target:e,r.withComponent=function(e){var r=t.componentId,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r=0||(a[n]=e[n]);return a}(t,["componentId"]),i=r&&r+"-"+(we(e)?e:be(v(e)));return Se(e,f({},a,{attrs:b,componentId:i}),n)},Object.defineProperty(r,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=a?ue({},e.defaultProps,t):t}}),r.toString=function(){return"."+r.styledComponentId},o&&u()(r,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,self:!0,styledComponentId:!0,target:!0,withComponent:!0}),r}var Oe=function(e){return function e(t,n,a){if(void 0===a&&(a=h),!Object(r.isValidElementType)(n))return E(1,String(n));var i=function(){return t(n,a,oe.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,f({},a,{},r))},i.attrs=function(r){return e(t,n,f({},a,{attrs:Array.prototype.concat(a.attrs,r).filter(Boolean)}))},i}(Se,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Oe[e]=Oe(e)}));t.b=Oe}).call(this,n(34))},30:function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1)for(var n=1;n=0?"#29A36A":"#E85984"}));function g(e){var t=e.current,n=void 0===t?0:t,r=e.previous,a=void 0===r?0:r,i=e.className,o=void 0===i?"altis-analytics-lift":i,c=Object(p.d)(n,a);return s.a.createElement(h,{className:o,lift:c},s.a.createElement("span",null,c>=0||isNaN(c)?"⬆":"⬇"),Object(p.a)(c))}function v(){var e=o()(["\n\tflex: 1;\n\tmargin: 20px;\n\tpadding: 20px;\n\tbackground: #fff;\n\tbox-shadow: 0 3px 6px rgba( 0, 0, 0, .3 );\n\tborder-radius: 2px;\n\n\th3, p {\n\t\tmargin: 0;\n\t\tflex: none;\n\t\twidth: 100%;\n\t}\n\th3 {\n\t\tmargin-bottom: 10px;\n\t}\n\n\t.dashicon {\n\t\tmargin-top: -6px;\n\t\tmargin-right: 4px;\n\t\tborder-radius: 100px;\n\t\tpadding: 5px;\n\t\ttext-align: center;\n\t}\n\n\t.altis-analytics-card__metrics {\n\t\tdisplay: flex;\n\t\talign-items: baseline;\n\t}\n\n\t.altis-analytics-card__metric {\n\t\tmargin: 20px 0;\n\t\tfont-size: 38px;\n\t\tline-height: 38px;\n\t\tfont-weight: bold;\n\t\tflex: 2;\n\t}\n\n\t.altis-analytics-card__lift {\n\t\tmargin: 20px 0 0;\n\t\tfont-size: 24px;\n\t\tline-height: 38px;\n\t\tfont-weight: bold;\n\t\tflex: 1;\n\t\ttext-align: right;\n\t}\n\n\t&.yellow .dashicon {\n\t\tcolor: #EFBD0B;\n\t\tbackground: rgba(248, 218, 109, .2);\n\t}\n\t&.green .dashicon {\n\t\tcolor: #3FCF8E;\n\t\tbackground: rgba(63, 207, 142, .2);\n\t}\n\t&.blue .dashicon {\n\t\tcolor: #4767df;\n\t\tbackground: rgba(67, 108, 255, .2);\n\t}\n\t&.blue .altis-analytics-card__metric {\n\t\tcolor: #4767df;\n\t}\n"]);return v=function(){return e},e}function y(){var e=o()(["\n\tdisplay: flex;\n\tmargin: 0 -20px;\n"]);return y=function(){return e},e}var b=wp.components.Icon,w=l.b.div(y()),k=l.b.div(v());function x(e){var t=e.cards,n=void 0===t?[]:t;return 0===n.length?null:s.a.createElement(w,{className:"altis-analytics-cards"},n.map((function(e){return s.a.createElement(k,{className:["altis-analytics-card",e.color].join(" ")},s.a.createElement("h3",null,e.icon&&s.a.createElement(b,{icon:e.icon})," ",e.title),s.a.createElement("div",{className:"altis-analytics-card__metrics"},s.a.createElement("div",{className:"altis-analytics-card__metric"},null!==e.metric?Object(p.a)(e.metric):"…"),e.lift&&s.a.createElement(g,d()({className:"altis-analytics-card__lift"},e.lift))),s.a.createElement("p",{className:"description"},e.description))})))}x.defaultProps={title:"",color:"",icon:null,metric:null,lift:null,description:""};var E=x;function C(){var e=o()(["\n\tlabel {\n\t\tcursor: pointer;\n\t\tborder: 1px solid transparent;\n\t\tborder-radius: 100px;\n\t\tpadding: 1px 8px;\n\t\tmargin-right: 2px;\n\t}\n\n\tinput {\n\t\tvisibility: hidden;\n\t\tposition: absolute;\n\t}\n\n\tinput:checked + label {\n\t\tborder-color: rgba(0,0,0,.3);\n\t\tfont-weight: bold;\n\t}\n"]);return C=function(){return e},e}var S=wp.i18n,O=S.__,A=S.sprintf,I=l.b.form(C());function j(e){var t=e.value,n=e.ranges,r=e.onSetRange;return s.a.createElement(I,{className:"altis-analytics-date-range"},n.map((function(e){return s.a.createElement(s.a.Fragment,null,s.a.createElement("input",{checked:t===e,id:"altis-analytics-date-range-".concat(e),name:"altis-analytics-date-range",type:"radio",value:e,onChange:function(t){t.target.checked&&r(e)}}),s.a.createElement("label",{htmlFor:"altis-analytics-date-range-".concat(e)},A(O("%d days","altis-analytics"),e)))})))}function _(){var e=o()(["\n\tpadding-bottom: 30px;\n\n\t& h2 {\n\t\tcolor: #4767df;\n\t}\n\n\t.altis-analytics-block-variant {\n\t\tmargin: 30px 0 40px;\n\n\t\t&--fallback {\n\t\t\tmargin-bottom: 20px;\n\t\t\tborder-bottom: 1px solid rgba( 0, 0, 0, .2 );\n\t\t\tpadding-bottom: 20px;\n\t\t}\n\t}\n\n\tul {\n\t\tlist-style: none;\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tmargin: 10px 0 0;\n\t\tpadding: 0;\n\t}\n\n\tli {\n\t\tmargin-right: 40px;\n\t\tmargin-top: 10px;\n\t\tdisplay: flex;\n\t\tflex-direction: column-reverse;\n\t}\n\n\th3, p {\n\t\tmargin: 0;\n\t}\n\n\th3 {\n\t\tmargin-right: 40px;\n\t}\n\n\tli .description {\n\t\ttext-transform: uppercase;\n\t}\n\n\t.altis-analytics-block-variant__metric {\n\t\tfont-size: 24px;\n\t\tfont-weight: bold;\n\t\tmargin-bottom: 5px;\n\t}\n\n\t.audience-estimate svg {\n\t\tmax-height: 30px;\n\t}\n\n\t.blue {\n\t\tcolor: #4767df;\n\t}\n"]);return _=function(){return e},e}var N=wp.htmlEntities.decodeEntities,P=wp.i18n.__,R=l.b.div(_());function T(e){var t=e.analytics,n=e.variants;if(!n)return null;var r=n&&n.find((function(e){return e.fallback}))||{},a=t?t.audiences.find((function(e){return 0===e.id}))||u:null;return s.a.createElement(R,null,s.a.createElement("h2",null,P("Block Variants","altis-analytics")),n.map((function(e){var n=t&&t.audiences.find((function(t){return t.id===(e.audience&&e.audience.id)||0}))||u;return s.a.createElement("div",{className:"altis-analytics-block-variant ".concat(e.fallback?"altis-analytics-block-variant--fallback":"")},s.a.createElement("div",{className:"altis-analytics-block-variant__header"},s.a.createElement("h3",null,e.fallback?P("Fallback","altis-analytics"):N(e.audience.title)),e.goal&&s.a.createElement("p",{className:"description"},P("Goal","altis-analytics"),": ",s.a.createElement("strong",null,window.Altis.Analytics.Experiments.Goals[e.goal].label))),s.a.createElement("ul",null,s.a.createElement("li",null,s.a.createElement("p",{className:"description"},P("Total views","altis-analytics")),s.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.b)(n.views):"…")),s.a.createElement("li",null,s.a.createElement("p",{className:"description"},P("Unique views","altis-analytics")),s.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.b)(n.unique.views):"…")),e.goal&&s.a.createElement(s.a.Fragment,null,s.a.createElement("li",null,s.a.createElement("p",{className:"description"},P("Conversion rate","altis-analytics")),s.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.a)(n.unique.conversions/n.unique.views*100):"…")),!e.fallback&&r.goal&&a&&s.a.createElement("li",null,s.a.createElement("p",{className:"description"},P("Lift vs. fallback","altis-analytics")),s.a.createElement(g,{className:"altis-analytics-block-variant__metric",current:n.unique.conversions/n.unique.views,previous:a.unique.conversions/a.unique.views}))),!e.fallback&&s.a.createElement("li",null,s.a.createElement("p",{className:"description"},P("Audience coverage","altis-analytics")),s.a.createElement("div",{className:"altis-analytics-block-variant__metric blue"},t&&n?Object(p.a)(n.unique.views/t.unique.views*100):"…"))))})))}T.defaultProps={analytics:null,variants:[]};var L=T;function z(){var e=o()(["\n\tpadding: 40px 60px;\n\tmargin-left: -20px;\n\n\t& h1,\n\t& h2 {\n\t\tfont-size: 24px;\n\t\tmargin: 10px 0;\n\t\tline-height: 1;\n\t}\n\t& h1 + h2 {\n\t\tcolor: #4767df;\n\t}\n\n\t& h2 a {\n\t\ttext-decoration: none;\n\t\tborder-radius: 3px;\n\t\tmargin-left: 4px;\n\t\tmargin-top: -4px;\n\t\tborder: 1px solid rgba(67, 108, 255, .4);\n\t\twidth: 20px;\n\t\theight: 20px;\n\t\tdisplay: inline-block;\n\t\tvertical-align: middle;\n\t\tpadding: 0;\n\t}\n\n\t.altis-analytics-block-metrics {\n\t\tmargin: 40px -60px;\n\t\tbackground-color: rgba(67, 108, 255, .05);\n\t\tpadding: 20px 60px;\n\t}\n\n\t.altis-analytics-date-range {\n\t\tmargin: 0 0 20px;\n\t}\n"]);return z=function(){return e},e}var $=wp.components.Icon,B=wp.data.useSelect,F=wp.htmlEntities.decodeEntities,M=wp.i18n.__,D=l.b.div(z());t.a=function(e){var t=e.clientId,n=Object(c.useState)(7),r=a()(n,2),i=r[0],o=r[1],l=B((function(e){return e("analytics/xbs").getPost(t)}),[t]),f=B((function(e){return e("analytics/xbs").getViews(t,{days:i})}),[t,i]),d=B((function(e){return{current:e("analytics/xbs").getViews(t,{days:7}),previous:e("analytics/xbs").getViews(t,{days:7,offset:7})}}),[t]);if(!t)return s.a.createElement("div",{className:"message error"},s.a.createElement("p",null,M("Experience Block not found.")));if(l&&l.error)return s.a.createElement("div",{className:"message error"},s.a.createElement("p",null,l.error.message));var p=null;f&&(p=100-(f.audiences.find((function(e){return 0===e.id}))||u).unique.views/f.unique.views*100);return s.a.createElement(D,{className:"altis-analytics-block"},s.a.createElement("h1",null,M("Experience Insights","altis-analytics")),s.a.createElement("h2",null,l&&F(l.title.rendered)||M("Loading…","altis-analytics"),l&&Number(l.parent)>0&&s.a.createElement(s.a.Fragment,null," ",s.a.createElement("a",{href:"post.php?post=".concat(l.parent,"&action=edit")},s.a.createElement($,{icon:"edit"}),s.a.createElement("span",{className:"screen-reader-text"},M("Edit block","altis-analytics"))))),s.a.createElement("div",{className:"altis-analytics-block-metrics"},s.a.createElement(j,{ranges:[7,30,90],value:i,onSetRange:o}),s.a.createElement(E,{cards:[{color:"yellow",icon:"visibility",title:M("Block Views","altis-analytics"),metric:f?f.unique.views:null,lift:{current:d.current&&d.current.unique.views,previous:d.previous&&d.previous.unique.views},description:M("Total number of times this block has been viewed by unique visitors to the website.","altis-analytics")},{color:"green",icon:"thumbs-up",title:M("Conversion Rate","altis-analytics"),metric:f?f.unique.conversions/f.unique.views*100:null,lift:{current:d.current&&d.current.unique.conversions/d.current.unique.views,previous:d.previous&&d.previous.unique.conversions/d.previous.unique.views},description:f&&0===f.unique.conversions?M("There are no conversions recorded yet, you may need to choose a conversion goal other than impressions for your variants."):M("Average conversion of the block as a percentage of total unique views of the block.","altis-analytics")},{color:"blue",icon:"groups",title:M("Personalization Coverage","altis-analytics"),metric:p,description:M("The percentage of visitors who are seeing personalised content.","altis-analytics")}]})),s.a.createElement(L,{analytics:f,variants:l&&l.variants||null}))}},5:function(e,t,n){"use strict";n.d(t,"h",(function(){return c})),n.d(t,"c",(function(){return l})),n.d(t,"e",(function(){return u})),n.d(t,"f",(function(){return m})),n.d(t,"g",(function(){return h})),n.d(t,"a",(function(){return g})),n.d(t,"d",(function(){return v})),n.d(t,"b",(function(){return y}));var r=n(1),a=n.n(r),i=n(10),o=n.n(i),c=function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},s=function(e){return e.replace(/[^\0-~]/g,(function(e){return"\\u"+("000"+e.charCodeAt().toString(16)).slice(-4)}))},l=function(){return(navigator.language||navigator.browserLanguage||(navigator.languages||["en_US"])[0]).toLowerCase().replace("-","_")},u=function(e,t){return t},f=function(){var e=o()(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t){e.next=4;break}return e.next=3,t();case 3:t=e.sent;case 4:return e.abrupt("return",n(t));case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),d=function(e){return Array.isArray(e)?e.map((function(e){return s(e.toString())})):s(e.toString())},p=function(e){return parseFloat(Number(Array.isArray(e)?e[0]:e))},m=function(){var e=o()(a.a.mark((function e(t){var n,r,i,o,c=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=c.length>1&&void 0!==c[1]&&c[1],r={},e.t0=a.a.keys(t);case 3:if((e.t1=e.t0()).done){e.next=17;break}if(i=e.t1.value,o=Array.isArray(t[i])?t[i]:[t[i]],!n){e.next=12;break}return e.next=9,f(o,d);case 9:r[i]=e.sent,e.next=15;break;case 12:return e.next=14,f(o[0],d);case 14:r[i]=e.sent;case 15:e.next=3;break;case 17:return e.abrupt("return",r);case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),h=function(){var e=o()(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n={},e.t0=a.a.keys(t);case 2:if((e.t1=e.t0()).done){e.next=9;break}return r=e.t1.value,e.next=6,f(t[r],p);case 6:n[r]=e.sent,e.next=2;break;case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),g=function(e){if(isNaN(e))return 0;if(!isFinite(e))return e>=0?"∞%":"-∞%";var t="",n=e;return e>=1e3&&(t="k",n=e/1e3),e>=1e6&&(t="M",n=e/1e6),n=n<10&&n>0?n.toFixed(1):Math.round(n),Number.isInteger(e)||(t="%"),"".concat(n).concat(t)},v=function(e,t){return(e-t)/e*100},y=function(e){return(new Intl.NumberFormat).format(e)}},50:function(e){e.exports=JSON.parse('{"name":"altis/personalization","settings":{"category":"altis-experience-blocks","icon":"groups","supports":{"alignWide":true,"html":false,"align":true},"attributes":{"clientId":{"type":"string","required":true},"title":{"type":"string"}}}}')},6:function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},8:function(e,t,n){var r=n(20),a=n(21),i=n(22);e.exports=function(e,t){return r(e)||a(e,t)||i()}},9:function(e,t,n){var r=n(30),a=n(31),i=n(32);e.exports=function(e){return r(e)||a(e)||i()}}})); \ No newline at end of file diff --git a/build/blocks/ui.b82af12b.js b/build/blocks/ui.4dc415e8.js similarity index 89% rename from build/blocks/ui.b82af12b.js rename to build/blocks/ui.4dc415e8.js index ecbe45bc..c7854bd8 100644 --- a/build/blocks/ui.b82af12b.js +++ b/build/blocks/ui.4dc415e8.js @@ -1,4 +1,4 @@ -!function(e,t){for(var n in t)e[n]=t[n]}(this,function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=178)}({0:function(e,t){!function(){e.exports=this.React}()},1:function(e,t,n){e.exports=n(25)},10:function(e,t){function n(e,t,n,r,a,i,o){try{var s=e[i](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(a,i){var o=e.apply(t,r);function s(e){n(o,a,i,s,c,"next",e)}function c(e){n(o,a,i,s,c,"throw",e)}s(void 0)}))}}},16:function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;x(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}},26:function(e,t){e.exports=function(e,t,n,r){var a=n?n.call(r,e,t):void 0;if(void 0!==a)return!!a;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),c=0;cr&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(m,"$1"+e.trim());case 58:return e.trim()+t.replace(m,"$1"+e.trim());default:if(0<1*n&&0c.charCodeAt(8))break;case 115:o=o.replace(c,"-webkit-"+c)+";"+o;break;case 207:case 102:o=o.replace(c,"-webkit-"+(102s.charCodeAt(0)&&(s=s.trim()),s=[s],0p)&&(F=(D=D.replace(" ",":")).length),01?t-1:0),r=1;r0?" Additional arguments: "+n.join(", "):""))}var A=function(e){var t=document.head,n=e||t,r=document.createElement("style"),a=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(b))return r}}(n),i=void 0!==a?a.nextSibling:null;r.setAttribute(b,"active"),r.setAttribute("data-styled-version","5.0.1");var o=k();return o&&r.setAttribute("nonce",o),n.insertBefore(r,i),r},C=function(){function e(e){var t=this.element=A(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,a=r;e>=a;)(a<<=1)<0&&S(16,""+e);this.groupSizes=new Uint32Array(a),this.groupSizes.set(n),this.length=a;for(var i=r;i=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),a=r+n,i=r;i=T&&(T=t+1),N.set(e,t),_.set(t,e)},L="style["+b+'][data-styled-version="5.0.1"]',$=/(?:\s*)?(.*?){((?:{[^}]*}|(?!{).*?)*)}/g,z=new RegExp("^"+b+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\]'),M=function(e,t,n){for(var r,a=n.split(","),i=0,o=a.length;i0&&(l+=e+",")})),r+=""+s+c+'{content:"'+l+'"}\n'}}}return r}(this)},e}(),B=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},H=function(e){return B(5381,e)};var U=/^\s*\/\/.*$/gm;function V(e){var t,n,r,a=void 0===e?m:e,i=a.options,s=void 0===i?m:i,c=a.plugins,l=void 0===c?h:c,u=new o.a(s),f=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,a,i,o,s,c,l,u,f){switch(n){case 1:if(0===u&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(a[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),p=function(e,r,a){return r>0&&-1!==a.slice(0,r).indexOf(n)&&a.slice(r-n.length,r)!==n?"."+t:e};function g(e,a,i,o){void 0===o&&(o="&");var s=e.replace(U,""),c=a&&i?i+" "+a+" { "+s+" }":s;return t=o,n=a,r=new RegExp("\\"+n+"\\b","g"),u(i||!a?"":a,c)}return u.use([].concat(l,[function(e,t,a){2===e&&a.length&&a[0].lastIndexOf(n)>0&&(a[0]=a[0].replace(r,p))},d,function(e){if(-2===e){var t=f;return f=[],t}}])),g.hash=l.length?l.reduce((function(e,t){return t.name||S(15),B(e,t.name)}),5381).toString():"",g}var W=i.a.createContext(),Y=(W.Consumer,i.a.createContext()),X=(Y.Consumer,new D),Z=V();function K(){return Object(a.useContext)(W)||X}function J(){return Object(a.useContext)(Y)||Z}var Q=function(){function e(e,t){var n=this;this.inject=function(e){e.hasNameForId(n.id,n.name)||e.insertRules(n.id,n.name,Z.apply(void 0,n.stringifyArgs))},this.toString=function(){return S(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.stringifyArgs=t}return e.prototype.getName=function(){return this.name},e}(),ee=/([A-Z])/g,te=/^ms-/;function ne(e){return e.replace(ee,"-$1").toLowerCase().replace(te,"-ms-")}var re=function(e){return null==e||!1===e||""===e},ae=function e(t,n){var r=[];return Object.keys(t).forEach((function(n){if(!re(t[n])){if(p(t[n]))return r.push.apply(r,e(t[n],n)),r;if(g(t[n]))return r.push(ne(n)+":",t[n],";"),r;r.push(ne(n)+": "+(a=n,(null==(i=t[n])||"boolean"==typeof i||""===i?"":"number"!=typeof i||0===i||a in s.a?String(i).trim():i+"px")+";"))}var a,i;return r})),n?[n+" {"].concat(r,["}"]):r};function ie(e,t,n){if(Array.isArray(e)){for(var r,a=[],i=0,o=e.length;i1?t-1:0),r=1;r1?t-1:0),r=1;r25?39:97))};function pe(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=de(t%52)+n;return(de(t%52)+n).replace(fe,"$1-$2")}function he(e){for(var t=0;t>>0);if(!t.hasNameForId(r,i)){var o=n(a,"."+i,void 0,r);t.insertRules(r,i,o)}return this.staticRulesId=i,i}for(var s=this.rules.length,c=B(this.baseHash,n.hash),l="",u=0;u>>0);if(!t.hasNameForId(r,h)){var m=n(l,"."+h,void 0,r);t.insertRules(r,h,m)}return h},e}(),ge=(new Set,function(e,t,n){return void 0===n&&(n=m),e.theme!==n.theme&&e.theme||t||n.theme}),ve=/[[\].#*$><+~=|^:(),"'`-]+/g,ye=/(^-|-$)/g;function be(e){return e.replace(ve,"-").replace(ye,"")}function we(e){return"string"==typeof e&&!0}var xe=function(e){return pe(H(e)>>>0)};var ke=i.a.createContext();ke.Consumer;var Se={};function Ae(e,t,n){var r=e.attrs,i=e.componentStyle,o=e.defaultProps,s=e.foldedComponentIds,l=e.styledComponentId,u=e.target;Object(a.useDebugValue)(l);var d=function(e,t,n){void 0===e&&(e=m);var r=f({},t,{theme:e}),a={};return n.forEach((function(e){var t,n,i,o=e;for(t in g(o)&&(o=o(r)),o)r[t]=a[t]="className"===t?(n=a[t],i=o[t],n&&i?n+" "+i:n||i):o[t]})),[r,a]}(ge(t,Object(a.useContext)(ke),o)||m,t,r),p=d[0],h=d[1],v=function(e,t,n,r){var i=K(),o=J(),s=e.isStatic&&!t?e.generateAndInjectStyles(m,i,o):e.generateAndInjectStyles(n,i,o);return Object(a.useDebugValue)(s),s}(i,r.length>0,p),y=n,b=h.as||t.as||u,w=we(b),x=h!==t?f({},t,{},h):t,k=w||"as"in x||"forwardedAs"in x,S=k?{}:f({},x);if(k)for(var A in x)"forwardedAs"===A?S.as=x[A]:"as"===A||"forwardedAs"===A||w&&!Object(c.a)(A)||(S[A]=x[A]);return t.style&&h.style!==t.style&&(S.style=f({},t.style,{},h.style)),S.className=Array.prototype.concat(s,l,v!==l?v:null,t.className,h.className).filter(Boolean).join(" "),S.ref=y,Object(a.createElement)(b,S)}function Ce(e,t,n){var r,a=y(e),o=!we(e),s=t.displayName,c=void 0===s?function(e){return we(e)?"styled."+e:"Styled("+v(e)+")"}(e):s,l=t.componentId,d=void 0===l?function(e,t){var n="string"!=typeof e?"sc":be(e);Se[n]=(Se[n]||0)+1;var r=n+"-"+xe(n+Se[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):l,p=t.attrs,m=void 0===p?h:p,g=t.displayName&&t.componentId?be(t.displayName)+"-"+t.componentId:t.componentId||d,b=a&&e.attrs?Array.prototype.concat(e.attrs,m).filter(Boolean):m,w=new me(a?e.componentStyle.rules.concat(n):n,g),x=function(e,t){return Ae(r,e,t)};return x.displayName=c,(r=i.a.forwardRef(x)).attrs=b,r.componentStyle=w,r.displayName=c,r.foldedComponentIds=a?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):h,r.styledComponentId=g,r.target=a?e.target:e,r.withComponent=function(e){var r=t.componentId,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r=0||(a[n]=e[n]);return a}(t,["componentId"]),i=r&&r+"-"+(we(e)?e:be(v(e)));return Ce(e,f({},a,{attrs:b,componentId:i}),n)},Object.defineProperty(r,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=a?ue({},e.defaultProps,t):t}}),r.toString=function(){return"."+r.styledComponentId},o&&u()(r,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,self:!0,styledComponentId:!0,target:!0,withComponent:!0}),r}var Ee=function(e){return function e(t,n,a){if(void 0===a&&(a=m),!Object(r.isValidElementType)(n))return S(1,String(n));var i=function(){return t(n,a,oe.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,f({},a,{},r))},i.attrs=function(r){return e(t,n,f({},a,{attrs:Array.prototype.concat(a.attrs,r).filter(Boolean)}))},i}(Ce,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Ee[e]=Ee(e)}));t.b=Ee}).call(this,n(34))},34:function(e,t){var n,r,a=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,l=[],u=!1,f=-1;function d(){u&&c&&(u=!1,c.length?l=c.concat(l):f=-1,l.length&&p())}function p(){if(!u){var e=s(d);u=!0;for(var t=l.length;t;){for(c=l,l=[];++f1)for(var n=1;n=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;x(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}},26:function(e,t){e.exports=function(e,t,n,r){var a=n?n.call(r,e,t):void 0;if(void 0!==a)return!!a;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),c=0;cr&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(m,"$1"+e.trim());case 58:return e.trim()+t.replace(m,"$1"+e.trim());default:if(0<1*n&&0c.charCodeAt(8))break;case 115:o=o.replace(c,"-webkit-"+c)+";"+o;break;case 207:case 102:o=o.replace(c,"-webkit-"+(102s.charCodeAt(0)&&(s=s.trim()),s=[s],0p)&&(M=(D=D.replace(" ",":")).length),01?t-1:0),r=1;r0?" Additional arguments: "+n.join(", "):""))}var A=function(e){var t=document.head,n=e||t,r=document.createElement("style"),a=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(b))return r}}(n),i=void 0!==a?a.nextSibling:null;r.setAttribute(b,"active"),r.setAttribute("data-styled-version","5.0.1");var o=k();return o&&r.setAttribute("nonce",o),n.insertBefore(r,i),r},C=function(){function e(e){var t=this.element=A(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,a=r;e>=a;)(a<<=1)<0&&S(16,""+e);this.groupSizes=new Uint32Array(a),this.groupSizes.set(n),this.length=a;for(var i=r;i=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),a=r+n,i=r;i=T&&(T=t+1),_.set(e,t),N.set(t,e)},L="style["+b+'][data-styled-version="5.0.1"]',$=/(?:\s*)?(.*?){((?:{[^}]*}|(?!{).*?)*)}/g,z=new RegExp("^"+b+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\]'),F=function(e,t,n){for(var r,a=n.split(","),i=0,o=a.length;i0&&(l+=e+",")})),r+=""+s+c+'{content:"'+l+'"}\n'}}}return r}(this)},e}(),B=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},H=function(e){return B(5381,e)};var U=/^\s*\/\/.*$/gm;function V(e){var t,n,r,a=void 0===e?m:e,i=a.options,s=void 0===i?m:i,c=a.plugins,l=void 0===c?h:c,u=new o.a(s),f=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,a,i,o,s,c,l,u,f){switch(n){case 1:if(0===u&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(a[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),p=function(e,r,a){return r>0&&-1!==a.slice(0,r).indexOf(n)&&a.slice(r-n.length,r)!==n?"."+t:e};function g(e,a,i,o){void 0===o&&(o="&");var s=e.replace(U,""),c=a&&i?i+" "+a+" { "+s+" }":s;return t=o,n=a,r=new RegExp("\\"+n+"\\b","g"),u(i||!a?"":a,c)}return u.use([].concat(l,[function(e,t,a){2===e&&a.length&&a[0].lastIndexOf(n)>0&&(a[0]=a[0].replace(r,p))},d,function(e){if(-2===e){var t=f;return f=[],t}}])),g.hash=l.length?l.reduce((function(e,t){return t.name||S(15),B(e,t.name)}),5381).toString():"",g}var W=i.a.createContext(),Y=(W.Consumer,i.a.createContext()),X=(Y.Consumer,new D),Z=V();function K(){return Object(a.useContext)(W)||X}function J(){return Object(a.useContext)(Y)||Z}var Q=function(){function e(e,t){var n=this;this.inject=function(e){e.hasNameForId(n.id,n.name)||e.insertRules(n.id,n.name,Z.apply(void 0,n.stringifyArgs))},this.toString=function(){return S(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.stringifyArgs=t}return e.prototype.getName=function(){return this.name},e}(),ee=/([A-Z])/g,te=/^ms-/;function ne(e){return e.replace(ee,"-$1").toLowerCase().replace(te,"-ms-")}var re=function(e){return null==e||!1===e||""===e},ae=function e(t,n){var r=[];return Object.keys(t).forEach((function(n){if(!re(t[n])){if(p(t[n]))return r.push.apply(r,e(t[n],n)),r;if(g(t[n]))return r.push(ne(n)+":",t[n],";"),r;r.push(ne(n)+": "+(a=n,(null==(i=t[n])||"boolean"==typeof i||""===i?"":"number"!=typeof i||0===i||a in s.a?String(i).trim():i+"px")+";"))}var a,i;return r})),n?[n+" {"].concat(r,["}"]):r};function ie(e,t,n){if(Array.isArray(e)){for(var r,a=[],i=0,o=e.length;i1?t-1:0),r=1;r1?t-1:0),r=1;r25?39:97))};function pe(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=de(t%52)+n;return(de(t%52)+n).replace(fe,"$1-$2")}function he(e){for(var t=0;t>>0);if(!t.hasNameForId(r,i)){var o=n(a,"."+i,void 0,r);t.insertRules(r,i,o)}return this.staticRulesId=i,i}for(var s=this.rules.length,c=B(this.baseHash,n.hash),l="",u=0;u>>0);if(!t.hasNameForId(r,h)){var m=n(l,"."+h,void 0,r);t.insertRules(r,h,m)}return h},e}(),ge=(new Set,function(e,t,n){return void 0===n&&(n=m),e.theme!==n.theme&&e.theme||t||n.theme}),ve=/[[\].#*$><+~=|^:(),"'`-]+/g,ye=/(^-|-$)/g;function be(e){return e.replace(ve,"-").replace(ye,"")}function we(e){return"string"==typeof e&&!0}var xe=function(e){return pe(H(e)>>>0)};var ke=i.a.createContext();ke.Consumer;var Se={};function Ae(e,t,n){var r=e.attrs,i=e.componentStyle,o=e.defaultProps,s=e.foldedComponentIds,l=e.styledComponentId,u=e.target;Object(a.useDebugValue)(l);var d=function(e,t,n){void 0===e&&(e=m);var r=f({},t,{theme:e}),a={};return n.forEach((function(e){var t,n,i,o=e;for(t in g(o)&&(o=o(r)),o)r[t]=a[t]="className"===t?(n=a[t],i=o[t],n&&i?n+" "+i:n||i):o[t]})),[r,a]}(ge(t,Object(a.useContext)(ke),o)||m,t,r),p=d[0],h=d[1],v=function(e,t,n,r){var i=K(),o=J(),s=e.isStatic&&!t?e.generateAndInjectStyles(m,i,o):e.generateAndInjectStyles(n,i,o);return Object(a.useDebugValue)(s),s}(i,r.length>0,p),y=n,b=h.as||t.as||u,w=we(b),x=h!==t?f({},t,{},h):t,k=w||"as"in x||"forwardedAs"in x,S=k?{}:f({},x);if(k)for(var A in x)"forwardedAs"===A?S.as=x[A]:"as"===A||"forwardedAs"===A||w&&!Object(c.a)(A)||(S[A]=x[A]);return t.style&&h.style!==t.style&&(S.style=f({},t.style,{},h.style)),S.className=Array.prototype.concat(s,l,v!==l?v:null,t.className,h.className).filter(Boolean).join(" "),S.ref=y,Object(a.createElement)(b,S)}function Ce(e,t,n){var r,a=y(e),o=!we(e),s=t.displayName,c=void 0===s?function(e){return we(e)?"styled."+e:"Styled("+v(e)+")"}(e):s,l=t.componentId,d=void 0===l?function(e,t){var n="string"!=typeof e?"sc":be(e);Se[n]=(Se[n]||0)+1;var r=n+"-"+xe(n+Se[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):l,p=t.attrs,m=void 0===p?h:p,g=t.displayName&&t.componentId?be(t.displayName)+"-"+t.componentId:t.componentId||d,b=a&&e.attrs?Array.prototype.concat(e.attrs,m).filter(Boolean):m,w=new me(a?e.componentStyle.rules.concat(n):n,g),x=function(e,t){return Ae(r,e,t)};return x.displayName=c,(r=i.a.forwardRef(x)).attrs=b,r.componentStyle=w,r.displayName=c,r.foldedComponentIds=a?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):h,r.styledComponentId=g,r.target=a?e.target:e,r.withComponent=function(e){var r=t.componentId,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r=0||(a[n]=e[n]);return a}(t,["componentId"]),i=r&&r+"-"+(we(e)?e:be(v(e)));return Ce(e,f({},a,{attrs:b,componentId:i}),n)},Object.defineProperty(r,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=a?ue({},e.defaultProps,t):t}}),r.toString=function(){return"."+r.styledComponentId},o&&u()(r,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,self:!0,styledComponentId:!0,target:!0,withComponent:!0}),r}var Ee=function(e){return function e(t,n,a){if(void 0===a&&(a=m),!Object(r.isValidElementType)(n))return S(1,String(n));var i=function(){return t(n,a,oe.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,f({},a,{},r))},i.attrs=function(r){return e(t,n,f({},a,{attrs:Array.prototype.concat(a.attrs,r).filter(Boolean)}))},i}(Ce,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Ee[e]=Ee(e)}));t.b=Ee}).call(this,n(34))},34:function(e,t){var n,r,a=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,l=[],u=!1,f=-1;function d(){u&&c&&(u=!1,c.length?l=c.concat(l):f=-1,l.length&&p())}function p(){if(!u){var e=s(d);u=!0;for(var t=l.length;t;){for(c=l,l=[];++f1)for(var n=1;n=0?"#29A36A":"#E85984"}));function g(e){var t=e.current,n=void 0===t?0:t,r=e.previous,a=void 0===r?0:r,i=e.className,o=void 0===i?"altis-analytics-lift":i,s=Object(p.d)(n,a);return c.a.createElement(m,{className:o,lift:s},c.a.createElement("span",null,s>=0||isNaN(s)?"⬆":"⬇"),Object(p.a)(s))}function v(){var e=o()(["\n\tflex: 1;\n\tmargin: 20px;\n\tpadding: 20px;\n\tbackground: #fff;\n\tbox-shadow: 0 3px 6px rgba( 0, 0, 0, .3 );\n\tborder-radius: 2px;\n\n\th3, p {\n\t\tmargin: 0;\n\t\tflex: none;\n\t\twidth: 100%;\n\t}\n\th3 {\n\t\tmargin-bottom: 10px;\n\t}\n\n\t.dashicon {\n\t\tmargin-top: -6px;\n\t\tmargin-right: 4px;\n\t\tborder-radius: 100px;\n\t\tpadding: 5px;\n\t\ttext-align: center;\n\t}\n\n\t.altis-analytics-card__metrics {\n\t\tdisplay: flex;\n\t\talign-items: baseline;\n\t}\n\n\t.altis-analytics-card__metric {\n\t\tmargin: 20px 0;\n\t\tfont-size: 38px;\n\t\tline-height: 38px;\n\t\tfont-weight: bold;\n\t\tflex: 2;\n\t}\n\n\t.altis-analytics-card__lift {\n\t\tmargin: 20px 0 0;\n\t\tfont-size: 24px;\n\t\tline-height: 38px;\n\t\tfont-weight: bold;\n\t\tflex: 1;\n\t\ttext-align: right;\n\t}\n\n\t&.yellow .dashicon {\n\t\tcolor: #EFBD0B;\n\t\tbackground: rgba(248, 218, 109, .2);\n\t}\n\t&.green .dashicon {\n\t\tcolor: #3FCF8E;\n\t\tbackground: rgba(63, 207, 142, .2);\n\t}\n\t&.blue .dashicon {\n\t\tcolor: #4767df;\n\t\tbackground: rgba(67, 108, 255, .2);\n\t}\n\t&.blue .altis-analytics-card__metric {\n\t\tcolor: #4767df;\n\t}\n"]);return v=function(){return e},e}function y(){var e=o()(["\n\tdisplay: flex;\n\tmargin: 0 -20px;\n"]);return y=function(){return e},e}var b=wp.components.Icon,w=l.b.div(y()),x=l.b.div(v());function k(e){var t=e.cards,n=void 0===t?[]:t;return 0===n.length?null:c.a.createElement(w,{className:"altis-analytics-cards"},n.map((function(e){return c.a.createElement(x,{className:["altis-analytics-card",e.color].join(" ")},c.a.createElement("h3",null,e.icon&&c.a.createElement(b,{icon:e.icon})," ",e.title),c.a.createElement("div",{className:"altis-analytics-card__metrics"},c.a.createElement("div",{className:"altis-analytics-card__metric"},null!==e.metric?Object(p.a)(e.metric):"…"),e.lift&&c.a.createElement(g,d()({className:"altis-analytics-card__lift"},e.lift))),c.a.createElement("p",{className:"description"},e.description))})))}k.defaultProps={title:"",color:"",icon:null,metric:null,lift:null,description:""};var S=k;function A(){var e=o()(["\n\tlabel {\n\t\tcursor: pointer;\n\t\tborder: 1px solid transparent;\n\t\tborder-radius: 100px;\n\t\tpadding: 1px 8px;\n\t\tmargin-right: 2px;\n\t}\n\n\tinput {\n\t\tvisibility: hidden;\n\t\tposition: absolute;\n\t}\n\n\tinput:checked + label {\n\t\tborder-color: rgba(0,0,0,.3);\n\t\tfont-weight: bold;\n\t}\n"]);return A=function(){return e},e}var C=wp.i18n,E=C.__,O=C.sprintf,j=l.b.form(A());function N(e){var t=e.value,n=e.ranges,r=e.onSetRange;return c.a.createElement(j,{className:"altis-analytics-date-range"},n.map((function(e){return c.a.createElement(c.a.Fragment,null,c.a.createElement("input",{checked:t===e,id:"altis-analytics-date-range-".concat(e),name:"altis-analytics-date-range",type:"radio",value:e,onChange:function(t){t.target.checked&&r(e)}}),c.a.createElement("label",{htmlFor:"altis-analytics-date-range-".concat(e)},O(E("%d days","altis-analytics"),e)))})))}function _(){var e=o()(["\n\tpadding-bottom: 30px;\n\n\t& h2 {\n\t\tcolor: #4767df;\n\t}\n\n\t.altis-analytics-block-variant {\n\t\tmargin: 30px 0 40px;\n\n\t\t&--fallback {\n\t\t\tmargin-bottom: 20px;\n\t\t\tborder-bottom: 1px solid rgba( 0, 0, 0, .2 );\n\t\t\tpadding-bottom: 20px;\n\t\t}\n\t}\n\n\tul {\n\t\tlist-style: none;\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tmargin: 10px 0 0;\n\t\tpadding: 0;\n\t}\n\n\tli {\n\t\tmargin-right: 40px;\n\t\tmargin-top: 10px;\n\t\tdisplay: flex;\n\t\tflex-direction: column-reverse;\n\t}\n\n\th3, p {\n\t\tmargin: 0;\n\t}\n\n\th3 {\n\t\tmargin-right: 40px;\n\t}\n\n\tli .description {\n\t\ttext-transform: uppercase;\n\t}\n\n\t.altis-analytics-block-variant__metric {\n\t\tfont-size: 24px;\n\t\tfont-weight: bold;\n\t\tmargin-bottom: 5px;\n\t}\n\n\t.audience-estimate svg {\n\t\tmax-height: 30px;\n\t}\n\n\t.blue {\n\t\tcolor: #4767df;\n\t}\n"]);return _=function(){return e},e}var T=wp.htmlEntities.decodeEntities,I=wp.i18n.__,P=l.b.div(_());function R(e){var t=e.analytics,n=e.variants;if(!n)return null;var r=n&&n.find((function(e){return e.fallback}))||{},a=t?t.audiences.find((function(e){return 0===e.id}))||u:null;return c.a.createElement(P,null,c.a.createElement("h2",null,I("Block Variants","altis-analytics")),n.map((function(e){var n=t&&t.audiences.find((function(t){return t.id===(e.audience&&e.audience.id)||0}))||u;return c.a.createElement("div",{className:"altis-analytics-block-variant ".concat(e.fallback?"altis-analytics-block-variant--fallback":"")},c.a.createElement("div",{className:"altis-analytics-block-variant__header"},c.a.createElement("h3",null,e.fallback?I("Fallback","altis-analytics"):T(e.audience.title)),e.goal&&c.a.createElement("p",{className:"description"},I("Goal","altis-analytics"),": ",c.a.createElement("strong",null,window.Altis.Analytics.Experiments.Goals[e.goal].label))),c.a.createElement("ul",null,c.a.createElement("li",null,c.a.createElement("p",{className:"description"},I("Total views","altis-analytics")),c.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.b)(n.views):"…")),c.a.createElement("li",null,c.a.createElement("p",{className:"description"},I("Unique views","altis-analytics")),c.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.b)(n.unique.views):"…")),e.goal&&c.a.createElement(c.a.Fragment,null,c.a.createElement("li",null,c.a.createElement("p",{className:"description"},I("Conversion rate","altis-analytics")),c.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.a)(n.unique.conversions/n.unique.views*100):"…")),!e.fallback&&r.goal&&a&&c.a.createElement("li",null,c.a.createElement("p",{className:"description"},I("Lift vs. fallback","altis-analytics")),c.a.createElement(g,{className:"altis-analytics-block-variant__metric",current:n.unique.conversions/n.unique.views,previous:a.unique.conversions/a.unique.views}))),!e.fallback&&c.a.createElement("li",null,c.a.createElement("p",{className:"description"},I("Audience coverage","altis-analytics")),c.a.createElement("div",{className:"altis-analytics-block-variant__metric blue"},t&&n?Object(p.a)(n.unique.views/t.unique.views*100):"…"))))})))}R.defaultProps={analytics:null,variants:[]};var L=R;function $(){var e=o()(["\n\tpadding: 40px 60px;\n\tmargin-left: -20px;\n\n\t& h1,\n\t& h2 {\n\t\tfont-size: 24px;\n\t\tmargin: 10px 0;\n\t\tline-height: 1;\n\t}\n\t& h1 + h2 {\n\t\tcolor: #4767df;\n\t}\n\n\t& h2 a {\n\t\ttext-decoration: none;\n\t\tborder-radius: 3px;\n\t\tmargin-left: 4px;\n\t\tmargin-top: -4px;\n\t\tborder: 1px solid rgba(67, 108, 255, .4);\n\t\twidth: 20px;\n\t\theight: 20px;\n\t\tdisplay: inline-block;\n\t\tvertical-align: middle;\n\t\tpadding: 0;\n\t}\n\n\t.altis-analytics-block-metrics {\n\t\tmargin: 40px -60px;\n\t\tbackground-color: rgba(67, 108, 255, .05);\n\t\tpadding: 20px 60px;\n\t}\n\n\t.altis-analytics-date-range {\n\t\tmargin: 0 0 20px;\n\t}\n"]);return $=function(){return e},e}var z=wp.components.Icon,M=wp.data.useSelect,F=wp.htmlEntities.decodeEntities,q=wp.i18n.__,G=l.b.div($());t.a=function(e){var t=e.clientId,n=Object(s.useState)(7),r=a()(n,2),i=r[0],o=r[1],l=M((function(e){return e("analytics/xbs").getPost(t)}),[t]),f=M((function(e){return e("analytics/xbs").getViews(t,{days:i})}),[t,i]),d=M((function(e){return{current:e("analytics/xbs").getViews(t,{days:7}),previous:e("analytics/xbs").getViews(t,{days:7,offset:7})}}),[t]);if(!t)return c.a.createElement("div",{className:"message error"},c.a.createElement("p",null,q("Experience Block not found.")));if(l&&l.error)return c.a.createElement("div",{className:"message error"},c.a.createElement("p",null,l.error.message));var p=null;f&&(p=100-(f.audiences.find((function(e){return 0===e.id}))||u).unique.views/f.unique.views*100);return c.a.createElement(G,{className:"altis-analytics-block"},c.a.createElement("h1",null,q("Experience Insights","altis-analytics")),c.a.createElement("h2",null,l&&F(l.title.rendered)||q("Loading…","altis-analytics"),l&&Number(l.parent)>0&&c.a.createElement(c.a.Fragment,null," ",c.a.createElement("a",{href:"post.php?post=".concat(l.parent,"&action=edit")},c.a.createElement(z,{icon:"edit"}),c.a.createElement("span",{className:"screen-reader-text"},q("Edit block","altis-analytics"))))),c.a.createElement("div",{className:"altis-analytics-block-metrics"},c.a.createElement(N,{ranges:[7,30,90],value:i,onSetRange:o}),c.a.createElement(S,{cards:[{color:"yellow",icon:"visibility",title:q("Block Views","altis-analytics"),metric:f?f.unique.views:null,lift:{current:d.current&&d.current.unique.views,previous:d.previous&&d.previous.unique.views},description:q("Total number of times this block has been viewed by unique visitors to the website.","altis-analytics")},{color:"green",icon:"thumbs-up",title:q("Conversion Rate","altis-analytics"),metric:f?f.unique.conversions/f.unique.views*100:null,lift:{current:d.current&&d.current.unique.conversions/d.current.unique.views,previous:d.previous&&d.previous.unique.conversions/d.previous.unique.views},description:f&&0===f.unique.conversions?q("There are no conversions recorded yet, you may need to choose a conversion goal other than impressions for your variants."):q("Average conversion of the block as a percentage of total unique views of the block.","altis-analytics")},{color:"blue",icon:"groups",title:q("Personalization Coverage","altis-analytics"),metric:p,description:q("The percentage of visitors who are seeing personalised content.","altis-analytics")}]})),c.a.createElement(L,{analytics:f,variants:l&&l.variants||null}))}},5:function(e,t,n){"use strict";n.d(t,"h",(function(){return s})),n.d(t,"c",(function(){return l})),n.d(t,"e",(function(){return u})),n.d(t,"f",(function(){return h})),n.d(t,"g",(function(){return m})),n.d(t,"a",(function(){return g})),n.d(t,"d",(function(){return v})),n.d(t,"b",(function(){return y}));var r=n(1),a=n.n(r),i=n(10),o=n.n(i),s=function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},c=function(e){return e.replace(/[^\0-~]/g,(function(e){return"\\u"+("000"+e.charCodeAt().toString(16)).slice(-4)}))},l=function(){return(navigator.language||navigator.browserLanguage||(navigator.languages||["en_US"])[0]).toLowerCase().replace("-","_")},u=function(e,t){return t},f=function(){var e=o()(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t){e.next=4;break}return e.next=3,t();case 3:t=e.sent;case 4:return e.abrupt("return",n(t));case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),d=function(e){return Array.isArray(e)?e.map((function(e){return c(e.toString())})):c(e.toString())},p=function(e){return parseFloat(Number(Array.isArray(e)?e[0]:e))},h=function(){var e=o()(a.a.mark((function e(t){var n,r,i,o,s=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=s.length>1&&void 0!==s[1]&&s[1],r={},e.t0=a.a.keys(t);case 3:if((e.t1=e.t0()).done){e.next=17;break}if(i=e.t1.value,o=Array.isArray(t[i])?t[i]:[t[i]],!n){e.next=12;break}return e.next=9,f(o,d);case 9:r[i]=e.sent,e.next=15;break;case 12:return e.next=14,f(o[0],d);case 14:r[i]=e.sent;case 15:e.next=3;break;case 17:return e.abrupt("return",r);case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),m=function(){var e=o()(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n={},e.t0=a.a.keys(t);case 2:if((e.t1=e.t0()).done){e.next=9;break}return r=e.t1.value,e.next=6,f(t[r],p);case 6:n[r]=e.sent,e.next=2;break;case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),g=function(e){if(isNaN(e))return 0;if(!isFinite(e))return e>=0?"∞%":"-∞%";var t="",n=e;return e>=1e3&&(t="k",n=e/1e3),e>=1e6&&(t="M",n=e/1e6),n=n<10&&n>0?n.toFixed(1):Math.round(n),Number.isInteger(e)||(t="%"),"".concat(n).concat(t)},v=function(e,t){return(e-t)/e*100},y=function(e){return(new Intl.NumberFormat).format(e)}},8:function(e,t,n){var r=n(20),a=n(21),i=n(22);e.exports=function(e,t){return r(e)||a(e,t)||i()}}})); \ No newline at end of file + */Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,a=r?Symbol.for("react.element"):60103,i=r?Symbol.for("react.portal"):60106,o=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,c=r?Symbol.for("react.profiler"):60114,l=r?Symbol.for("react.provider"):60109,u=r?Symbol.for("react.context"):60110,f=r?Symbol.for("react.async_mode"):60111,d=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,h=r?Symbol.for("react.suspense"):60113,m=r?Symbol.for("react.suspense_list"):60120,g=r?Symbol.for("react.memo"):60115,v=r?Symbol.for("react.lazy"):60116,y=r?Symbol.for("react.fundamental"):60117,b=r?Symbol.for("react.responder"):60118,w=r?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case a:switch(e=e.type){case f:case d:case o:case c:case s:case h:return e;default:switch(e=e&&e.$$typeof){case u:case p:case v:case g:case l:return e;default:return t}}case i:return t}}}function k(e){return x(e)===d}t.typeOf=x,t.AsyncMode=f,t.ConcurrentMode=d,t.ContextConsumer=u,t.ContextProvider=l,t.Element=a,t.ForwardRef=p,t.Fragment=o,t.Lazy=v,t.Memo=g,t.Portal=i,t.Profiler=c,t.StrictMode=s,t.Suspense=h,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===d||e===c||e===s||e===h||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===v||e.$$typeof===g||e.$$typeof===l||e.$$typeof===u||e.$$typeof===p||e.$$typeof===y||e.$$typeof===b||e.$$typeof===w)},t.isAsyncMode=function(e){return k(e)||x(e)===f},t.isConcurrentMode=k,t.isContextConsumer=function(e){return x(e)===u},t.isContextProvider=function(e){return x(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},t.isForwardRef=function(e){return x(e)===p},t.isFragment=function(e){return x(e)===o},t.isLazy=function(e){return x(e)===v},t.isMemo=function(e){return x(e)===g},t.isPortal=function(e){return x(e)===i},t.isProfiler=function(e){return x(e)===c},t.isStrictMode=function(e){return x(e)===s},t.isSuspense=function(e){return x(e)===h}},44:function(e,t,n){"use strict";var r=n(8),a=n.n(r),i=n(2),o=n.n(i),s=n(0),c=n.n(s),l=n(3),u={loads:0,views:0,conversions:0,unique:{loads:0,views:0,conversions:0},audiences:[],posts:[]},f=n(16),d=n.n(f),p=n(5);function h(){var e=o()(["\n\tfont-weight: bold;\n\tcolor: ",";\n\tspan {\n\t\tfont-size: 80%;\n\t}\n"]);return h=function(){return e},e}var m=l.b.div(h(),(function(e){return e.lift>=0?"#29A36A":"#E85984"}));function g(e){var t=e.current,n=void 0===t?0:t,r=e.previous,a=void 0===r?0:r,i=e.className,o=void 0===i?"altis-analytics-lift":i,s=Object(p.e)(n,a);return c.a.createElement(m,{className:o,lift:s},c.a.createElement("span",null,s>=0||isNaN(s)?"⬆":"⬇"),Object(p.a)(s))}function v(){var e=o()(["\n\tflex: 1;\n\tmargin: 20px;\n\tpadding: 20px;\n\tbackground: #fff;\n\tbox-shadow: 0 3px 6px rgba( 0, 0, 0, .3 );\n\tborder-radius: 2px;\n\n\th3, p {\n\t\tmargin: 0;\n\t\tflex: none;\n\t\twidth: 100%;\n\t}\n\th3 {\n\t\tmargin-bottom: 10px;\n\t}\n\n\t.dashicon {\n\t\tmargin-top: -6px;\n\t\tmargin-right: 4px;\n\t\tborder-radius: 100px;\n\t\tpadding: 5px;\n\t\ttext-align: center;\n\t}\n\n\t.altis-analytics-card__metrics {\n\t\tdisplay: flex;\n\t\talign-items: baseline;\n\t}\n\n\t.altis-analytics-card__metric {\n\t\tmargin: 20px 0;\n\t\tfont-size: 38px;\n\t\tline-height: 38px;\n\t\tfont-weight: bold;\n\t\tflex: 2;\n\t}\n\n\t.altis-analytics-card__lift {\n\t\tmargin: 20px 0 0;\n\t\tfont-size: 24px;\n\t\tline-height: 38px;\n\t\tfont-weight: bold;\n\t\tflex: 1;\n\t\ttext-align: right;\n\t}\n\n\t&.yellow .dashicon {\n\t\tcolor: #EFBD0B;\n\t\tbackground: rgba(248, 218, 109, .2);\n\t}\n\t&.green .dashicon {\n\t\tcolor: #3FCF8E;\n\t\tbackground: rgba(63, 207, 142, .2);\n\t}\n\t&.blue .dashicon {\n\t\tcolor: #4767df;\n\t\tbackground: rgba(67, 108, 255, .2);\n\t}\n\t&.blue .altis-analytics-card__metric {\n\t\tcolor: #4767df;\n\t}\n"]);return v=function(){return e},e}function y(){var e=o()(["\n\tdisplay: flex;\n\tmargin: 0 -20px;\n"]);return y=function(){return e},e}var b=wp.components.Icon,w=l.b.div(y()),x=l.b.div(v());function k(e){var t=e.cards,n=void 0===t?[]:t;return 0===n.length?null:c.a.createElement(w,{className:"altis-analytics-cards"},n.map((function(e){return c.a.createElement(x,{className:["altis-analytics-card",e.color].join(" ")},c.a.createElement("h3",null,e.icon&&c.a.createElement(b,{icon:e.icon})," ",e.title),c.a.createElement("div",{className:"altis-analytics-card__metrics"},c.a.createElement("div",{className:"altis-analytics-card__metric"},null!==e.metric?Object(p.a)(e.metric):"…"),e.lift&&c.a.createElement(g,d()({className:"altis-analytics-card__lift"},e.lift))),c.a.createElement("p",{className:"description"},e.description))})))}k.defaultProps={title:"",color:"",icon:null,metric:null,lift:null,description:""};var S=k;function A(){var e=o()(["\n\tlabel {\n\t\tcursor: pointer;\n\t\tborder: 1px solid transparent;\n\t\tborder-radius: 100px;\n\t\tpadding: 1px 8px;\n\t\tmargin-right: 2px;\n\t}\n\n\tinput {\n\t\tvisibility: hidden;\n\t\tposition: absolute;\n\t}\n\n\tinput:checked + label {\n\t\tborder-color: rgba(0,0,0,.3);\n\t\tfont-weight: bold;\n\t}\n"]);return A=function(){return e},e}var C=wp.i18n,E=C.__,O=C.sprintf,j=l.b.form(A());function _(e){var t=e.value,n=e.ranges,r=e.onSetRange;return c.a.createElement(j,{className:"altis-analytics-date-range"},n.map((function(e){return c.a.createElement(c.a.Fragment,null,c.a.createElement("input",{checked:t===e,id:"altis-analytics-date-range-".concat(e),name:"altis-analytics-date-range",type:"radio",value:e,onChange:function(t){t.target.checked&&r(e)}}),c.a.createElement("label",{htmlFor:"altis-analytics-date-range-".concat(e)},O(E("%d days","altis-analytics"),e)))})))}function N(){var e=o()(["\n\tpadding-bottom: 30px;\n\n\t& h2 {\n\t\tcolor: #4767df;\n\t}\n\n\t.altis-analytics-block-variant {\n\t\tmargin: 30px 0 40px;\n\n\t\t&--fallback {\n\t\t\tmargin-bottom: 20px;\n\t\t\tborder-bottom: 1px solid rgba( 0, 0, 0, .2 );\n\t\t\tpadding-bottom: 20px;\n\t\t}\n\t}\n\n\tul {\n\t\tlist-style: none;\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tmargin: 10px 0 0;\n\t\tpadding: 0;\n\t}\n\n\tli {\n\t\tmargin-right: 40px;\n\t\tmargin-top: 10px;\n\t\tdisplay: flex;\n\t\tflex-direction: column-reverse;\n\t}\n\n\th3, p {\n\t\tmargin: 0;\n\t}\n\n\th3 {\n\t\tmargin-right: 40px;\n\t}\n\n\tli .description {\n\t\ttext-transform: uppercase;\n\t}\n\n\t.altis-analytics-block-variant__metric {\n\t\tfont-size: 24px;\n\t\tfont-weight: bold;\n\t\tmargin-bottom: 5px;\n\t}\n\n\t.audience-estimate svg {\n\t\tmax-height: 30px;\n\t}\n\n\t.blue {\n\t\tcolor: #4767df;\n\t}\n"]);return N=function(){return e},e}var T=wp.htmlEntities.decodeEntities,I=wp.i18n.__,P=l.b.div(N());function R(e){var t=e.analytics,n=e.variants;if(!n)return null;var r=n&&n.find((function(e){return e.fallback}))||{},a=t?t.audiences.find((function(e){return 0===e.id}))||u:null;return c.a.createElement(P,null,c.a.createElement("h2",null,I("Block Variants","altis-analytics")),n.map((function(e){var n=t&&t.audiences.find((function(t){return t.id===(e.audience&&e.audience.id)||0}))||u;return c.a.createElement("div",{className:"altis-analytics-block-variant ".concat(e.fallback?"altis-analytics-block-variant--fallback":"")},c.a.createElement("div",{className:"altis-analytics-block-variant__header"},c.a.createElement("h3",null,e.fallback?I("Fallback","altis-analytics"):T(e.audience.title)),e.goal&&c.a.createElement("p",{className:"description"},I("Goal","altis-analytics"),": ",c.a.createElement("strong",null,window.Altis.Analytics.Experiments.Goals[e.goal].label))),c.a.createElement("ul",null,c.a.createElement("li",null,c.a.createElement("p",{className:"description"},I("Total views","altis-analytics")),c.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.c)(n.views):"…")),c.a.createElement("li",null,c.a.createElement("p",{className:"description"},I("Unique views","altis-analytics")),c.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.c)(n.unique.views):"…")),e.goal&&c.a.createElement(c.a.Fragment,null,c.a.createElement("li",null,c.a.createElement("p",{className:"description"},I("Conversion rate","altis-analytics")),c.a.createElement("div",{className:"altis-analytics-block-variant__metric"},n?Object(p.a)(n.unique.conversions/n.unique.views*100):"…")),!e.fallback&&r.goal&&a&&c.a.createElement("li",null,c.a.createElement("p",{className:"description"},I("Lift vs. fallback","altis-analytics")),c.a.createElement(g,{className:"altis-analytics-block-variant__metric",current:n.unique.conversions/n.unique.views,previous:a.unique.conversions/a.unique.views}))),!e.fallback&&c.a.createElement("li",null,c.a.createElement("p",{className:"description"},I("Audience coverage","altis-analytics")),c.a.createElement("div",{className:"altis-analytics-block-variant__metric blue"},t&&n?Object(p.a)(n.unique.views/t.unique.views*100):"…"))))})))}R.defaultProps={analytics:null,variants:[]};var L=R;function $(){var e=o()(["\n\tpadding: 40px 60px;\n\tmargin-left: -20px;\n\n\t& h1,\n\t& h2 {\n\t\tfont-size: 24px;\n\t\tmargin: 10px 0;\n\t\tline-height: 1;\n\t}\n\t& h1 + h2 {\n\t\tcolor: #4767df;\n\t}\n\n\t& h2 a {\n\t\ttext-decoration: none;\n\t\tborder-radius: 3px;\n\t\tmargin-left: 4px;\n\t\tmargin-top: -4px;\n\t\tborder: 1px solid rgba(67, 108, 255, .4);\n\t\twidth: 20px;\n\t\theight: 20px;\n\t\tdisplay: inline-block;\n\t\tvertical-align: middle;\n\t\tpadding: 0;\n\t}\n\n\t.altis-analytics-block-metrics {\n\t\tmargin: 40px -60px;\n\t\tbackground-color: rgba(67, 108, 255, .05);\n\t\tpadding: 20px 60px;\n\t}\n\n\t.altis-analytics-date-range {\n\t\tmargin: 0 0 20px;\n\t}\n"]);return $=function(){return e},e}var z=wp.components.Icon,F=wp.data.useSelect,M=wp.htmlEntities.decodeEntities,q=wp.i18n.__,G=l.b.div($());t.a=function(e){var t=e.clientId,n=Object(s.useState)(7),r=a()(n,2),i=r[0],o=r[1],l=F((function(e){return e("analytics/xbs").getPost(t)}),[t]),f=F((function(e){return e("analytics/xbs").getViews(t,{days:i})}),[t,i]),d=F((function(e){return{current:e("analytics/xbs").getViews(t,{days:7}),previous:e("analytics/xbs").getViews(t,{days:7,offset:7})}}),[t]);if(!t)return c.a.createElement("div",{className:"message error"},c.a.createElement("p",null,q("Experience Block not found.")));if(l&&l.error)return c.a.createElement("div",{className:"message error"},c.a.createElement("p",null,l.error.message));var p=null;f&&(p=100-(f.audiences.find((function(e){return 0===e.id}))||u).unique.views/f.unique.views*100);return c.a.createElement(G,{className:"altis-analytics-block"},c.a.createElement("h1",null,q("Experience Insights","altis-analytics")),c.a.createElement("h2",null,l&&M(l.title.rendered)||q("Loading…","altis-analytics"),l&&Number(l.parent)>0&&c.a.createElement(c.a.Fragment,null," ",c.a.createElement("a",{href:"post.php?post=".concat(l.parent,"&action=edit")},c.a.createElement(z,{icon:"edit"}),c.a.createElement("span",{className:"screen-reader-text"},q("Edit block","altis-analytics"))))),c.a.createElement("div",{className:"altis-analytics-block-metrics"},c.a.createElement(_,{ranges:[7,30,90],value:i,onSetRange:o}),c.a.createElement(S,{cards:[{color:"yellow",icon:"visibility",title:q("Block Views","altis-analytics"),metric:f?f.unique.views:null,lift:{current:d.current&&d.current.unique.views,previous:d.previous&&d.previous.unique.views},description:q("Total number of times this block has been viewed by unique visitors to the website.","altis-analytics")},{color:"green",icon:"thumbs-up",title:q("Conversion Rate","altis-analytics"),metric:f?f.unique.conversions/f.unique.views*100:null,lift:{current:d.current&&d.current.unique.conversions/d.current.unique.views,previous:d.previous&&d.previous.unique.conversions/d.previous.unique.views},description:f&&0===f.unique.conversions?q("There are no conversions recorded yet, you may need to choose a conversion goal other than impressions for your variants."):q("Average conversion of the block as a percentage of total unique views of the block.","altis-analytics")},{color:"blue",icon:"groups",title:q("Personalization Coverage","altis-analytics"),metric:p,description:q("The percentage of visitors who are seeing personalised content.","altis-analytics")}]})),c.a.createElement(L,{analytics:f,variants:l&&l.variants||null}))}},5:function(e,t,n){"use strict";n.d(t,"i",(function(){return s})),n.d(t,"d",(function(){return l})),n.d(t,"f",(function(){return u})),n.d(t,"g",(function(){return h})),n.d(t,"h",(function(){return m})),n.d(t,"a",(function(){return g})),n.d(t,"e",(function(){return v})),n.d(t,"c",(function(){return y})),n.d(t,"b",(function(){return b}));var r=n(1),a=n.n(r),i=n(10),o=n.n(i),s=function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},c=function(e){return e.replace(/[^\0-~]/g,(function(e){return"\\u"+("000"+e.charCodeAt().toString(16)).slice(-4)}))},l=function(){return(navigator.language||navigator.browserLanguage||(navigator.languages||["en_US"])[0]).toLowerCase().replace("-","_")},u=function(e,t){return t},f=function(){var e=o()(a.a.mark((function e(t,n){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t){e.next=4;break}return e.next=3,t();case 3:t=e.sent;case 4:return e.abrupt("return",n(t));case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),d=function(e){return Array.isArray(e)?e.map((function(e){return c(e.toString())})):c(e.toString())},p=function(e){return parseFloat(Number(Array.isArray(e)?e[0]:e))},h=function(){var e=o()(a.a.mark((function e(t){var n,r,i,o,s=arguments;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=s.length>1&&void 0!==s[1]&&s[1],r={},e.t0=a.a.keys(t);case 3:if((e.t1=e.t0()).done){e.next=17;break}if(i=e.t1.value,o=Array.isArray(t[i])?t[i]:[t[i]],!n){e.next=12;break}return e.next=9,f(o,d);case 9:r[i]=e.sent,e.next=15;break;case 12:return e.next=14,f(o[0],d);case 14:r[i]=e.sent;case 15:e.next=3;break;case 17:return e.abrupt("return",r);case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),m=function(){var e=o()(a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n={},e.t0=a.a.keys(t);case 2:if((e.t1=e.t0()).done){e.next=9;break}return r=e.t1.value,e.next=6,f(t[r],p);case 6:n[r]=e.sent,e.next=2;break;case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),g=function(e){if(isNaN(e))return 0;if(!isFinite(e))return e>=0?"∞%":"-∞%";var t="",n=e;return e>=1e3&&(t="k",n=e/1e3),e>=1e6&&(t="M",n=e/1e6),n=n<10&&n>0?n.toFixed(1):Math.round(n),Number.isInteger(e)||(t="%"),"".concat(n).concat(t)},v=function(e,t){return(e-t)/e*100},y=function(e){return(new Intl.NumberFormat).format(e)},b=function(e){return new RegExp([/bot/,/spider/,/crawl/,/APIs-Google/,/AdsBot/,/Googlebot/,/mediapartners/,/Google Favicon/,/FeedFetcher/,/Google-Read-Aloud/,/DuplexWeb-Google/,/googleweblight/,/bing/,/yandex/,/baidu/,/duckduck/,/yahoo/,/ecosia/,/ia_archiver/,/facebook/,/instagram/,/pinterest/,/reddit/,/slack/,/twitter/,/whatsapp/,/youtube/,/semrush/].map((function(e){return e.source})).join("|"),"i").test(e)}},8:function(e,t,n){var r=n(20),a=n(21),i=n(22);e.exports=function(e,t){return r(e)||a(e,t)||i()}}})); \ No newline at end of file diff --git a/build/experiments.b82af12b.js b/build/experiments.4dc415e8.js similarity index 96% rename from build/experiments.b82af12b.js rename to build/experiments.4dc415e8.js index 927fff4b..dc35036c 100644 --- a/build/experiments.b82af12b.js +++ b/build/experiments.4dc415e8.js @@ -1 +1 @@ -!function(t,e){for(var n in e)t[n]=e[n]}(this,function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.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 o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));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=window.Altis.Analytics.Experiments.BuildURL,n(n.s=179)}({11:function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},12:function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},13:function(t,e){function n(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};window.Altis.Analytics.record(s,{attributes:x({},r,{eventTestId:e,eventPostId:n,eventVariantId:t}),metrics:x({},o)})}))}else this.outerHTML=this.fallback}},{key:"getVariantId",value:function(){var t=this.testIdWithPost,e=this.trafficPercentage,n=this.getTestsForUser(),r=!1;if(void 0!==n[t]&&!1!==n[t]&&n[t]e)return this.addTestForUser(m()({},t,!1)),r;r=Math.floor(Math.random()*this.variants.length),this.addTestForUser(m()({},t,r))}return window.Altis&&window.Altis.Analytics&&window.Altis.Analytics.registerAttribute("test_".concat(t),r),r}}]),e}(function(t){function e(){var t,n;c()(this,e);for(var r=arguments.length,o=new Array(r),i=0;i2&&void 0!==arguments[2]?arguments[2]:[];k[t]={callback:e,closest:Array.isArray(n)?n:[n]}},j=function(t,e,n){return t&&t.addEventListener(n,(function(n){"function"==typeof e?e(n):console.error("Altis Analytics goal handler is not a function",t,n)}))},S=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=x({name:t,event:t,callback:j},window.Altis.Analytics.Experiments.Goals[t]||{},{},k[t]||{},{},e);return function(t,e){n.closest&&(t=t.closest(n.closest)),n.selector?t.querySelectorAll(n.selector).forEach((function(t){return n.callback(t,e,n.event)})):n.callback(t,e,n.event)}};I("click",(function(t,e){if(t){var n={elementNode:t.nodeName||"",elementText:t.innerText||"",elementClassName:t.className||"",elementId:t.id||"",elementHref:t.href||""};t.addEventListener("click",(function(t){e(Object.assign({},n,{targetNode:t.target.nodeName||"",targetText:t.target.innerText||"",targetClassName:t.target.className||"",targetId:t.target.id||"",targetSrc:"IMG"===t.target.nodeName?t.target.src:""}))}))}}),["a"]);var P=function(t){function e(){var t,n;c()(this,e);for(var r=arguments.length,o=new Array(r),i=0;i\n\t\t\t\t:host {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t}\n\t\t\t\n\t\t\t\n\t\t",this.setContent(),window.Altis.Analytics.on("updateAudiences",this.setContent)}},{key:"clientId",get:function(){return this.getAttribute("client-id")}}]),e}(v()(HTMLElement));window.Altis.Analytics.Experiments.registerGoal=I,window.Altis.Analytics.Experiments.registerGoalHandler=I,window.Altis.Analytics.onReady((function(){window.customElements.define("ab-test",O),window.customElements.define("personalization-block",P)}));var T=new CustomEvent("altis.experiments.ready");window.dispatchEvent(T)},180:function(t,e){t.exports=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")}},181:function(t,e,n){var r=n(33);function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function i(e,n,c){return o()?t.exports=i=Reflect.construct:t.exports=i=function(t,e,n){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(t,o));return n&&r(i,n.prototype),i},i.apply(null,arguments)}t.exports=i},20:function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},21:function(t,e){t.exports=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(r=(c=a.next()).done)&&(n.push(c.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}}},22:function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},24:function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(t){return typeof t}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(e)}t.exports=n},33:function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,r)}t.exports=n},4:function(t,e){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},52:function(t,e,n){var r=n(11),o=n(33),i=n(180),c=n(181);function a(e){var n="function"==typeof Map?new Map:void 0;return t.exports=a=function(t){if(null===t||!i(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return c(t,arguments,r(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),o(e,t)},a(e)}t.exports=a},6:function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},8:function(t,e,n){var r=n(20),o=n(21),i=n(22);t.exports=function(t,e){return r(t)||o(t,e)||i()}}})); \ No newline at end of file +!function(t,e){for(var n in e)t[n]=e[n]}(this,function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.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 o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));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=window.Altis.Analytics.Experiments.BuildURL,n(n.s=180)}({11:function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},12:function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},13:function(t,e){function n(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};window.Altis.Analytics.record(s,{attributes:x({},r,{eventTestId:e,eventPostId:n,eventVariantId:t}),metrics:x({},o)})}))}else this.outerHTML=this.fallback}},{key:"getVariantId",value:function(){var t=this.testIdWithPost,e=this.trafficPercentage,n=this.getTestsForUser(),r=!1;if(void 0!==n[t]&&!1!==n[t]&&n[t]e)return this.addTestForUser(m()({},t,!1)),r;r=Math.floor(Math.random()*this.variants.length),this.addTestForUser(m()({},t,r))}return window.Altis&&window.Altis.Analytics&&window.Altis.Analytics.registerAttribute("test_".concat(t),r),r}}]),e}(function(t){function e(){var t,n;c()(this,e);for(var r=arguments.length,o=new Array(r),i=0;i2&&void 0!==arguments[2]?arguments[2]:[];k[t]={callback:e,closest:Array.isArray(n)?n:[n]}},j=function(t,e,n){return t&&t.addEventListener(n,(function(n){"function"==typeof e?e(n):console.error("Altis Analytics goal handler is not a function",t,n)}))},S=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=x({name:t,event:t,callback:j},window.Altis.Analytics.Experiments.Goals[t]||{},{},k[t]||{},{},e);return function(t,e){n.closest&&(t=t.closest(n.closest)),n.selector?t.querySelectorAll(n.selector).forEach((function(t){return n.callback(t,e,n.event)})):n.callback(t,e,n.event)}};I("click",(function(t,e){if(t){var n={elementNode:t.nodeName||"",elementText:t.innerText||"",elementClassName:t.className||"",elementId:t.id||"",elementHref:t.href||""};t.addEventListener("click",(function(t){e(Object.assign({},n,{targetNode:t.target.nodeName||"",targetText:t.target.innerText||"",targetClassName:t.target.className||"",targetId:t.target.id||"",targetSrc:"IMG"===t.target.nodeName?t.target.src:""}))}))}}),["a"]);var P=function(t){function e(){var t,n;c()(this,e);for(var r=arguments.length,o=new Array(r),i=0;i\n\t\t\t\t:host {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t}\n\t\t\t\n\t\t\t\n\t\t",this.setContent(),window.Altis.Analytics.on("updateAudiences",this.setContent)}},{key:"clientId",get:function(){return this.getAttribute("client-id")}}]),e}(v()(HTMLElement));window.Altis.Analytics.Experiments.registerGoal=I,window.Altis.Analytics.Experiments.registerGoalHandler=I,window.Altis.Analytics.onReady((function(){window.customElements.define("ab-test",O),window.customElements.define("personalization-block",P)}));var T=new CustomEvent("altis.experiments.ready");window.dispatchEvent(T)},181:function(t,e){t.exports=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")}},182:function(t,e,n){var r=n(33);function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function i(e,n,c){return o()?t.exports=i=Reflect.construct:t.exports=i=function(t,e,n){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(t,o));return n&&r(i,n.prototype),i},i.apply(null,arguments)}t.exports=i},20:function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},21:function(t,e){t.exports=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,o=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(r=(c=a.next()).done)&&(n.push(c.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}}},22:function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},24:function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(t){return typeof t}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(e)}t.exports=n},33:function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,r)}t.exports=n},4:function(t,e){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},53:function(t,e,n){var r=n(11),o=n(33),i=n(181),c=n(182);function a(e){var n="function"==typeof Map?new Map:void 0;return t.exports=a=function(t){if(null===t||!i(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return c(t,arguments,r(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),o(e,t)},a(e)}t.exports=a},6:function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},8:function(t,e,n){var r=n(20),o=n(21),i=n(22);t.exports=function(t,e){return r(t)||o(t,e)||i()}}})); \ No newline at end of file diff --git a/build/manifest.json b/build/manifest.json index 3a794509..627c13e7 100644 --- a/build/manifest.json +++ b/build/manifest.json @@ -1,12 +1,12 @@ { - "analytics.js": "/analytics.b82af12b.js", - "audiences/data.js": "/audiences/data.b82af12b.js", - "audiences/preview.js": "/audiences/preview.b82af12b.js", - "audiences/ui.js": "/audiences/ui.b82af12b.js", - "blocks/data.js": "/blocks/data.b82af12b.js", - "blocks/personalization.js": "/blocks/personalization.b82af12b.js", - "blocks/personalization-variant.js": "/blocks/personalization-variant.b82af12b.js", - "blocks/ui.js": "/blocks/ui.b82af12b.js", - "experiments.js": "/experiments.b82af12b.js", - "titles.js": "/titles.b82af12b.js" + "analytics.js": "/analytics.4dc415e8.js", + "audiences/data.js": "/audiences/data.4dc415e8.js", + "audiences/preview.js": "/audiences/preview.4dc415e8.js", + "audiences/ui.js": "/audiences/ui.4dc415e8.js", + "blocks/data.js": "/blocks/data.4dc415e8.js", + "blocks/personalization.js": "/blocks/personalization.4dc415e8.js", + "blocks/personalization-variant.js": "/blocks/personalization-variant.4dc415e8.js", + "blocks/ui.js": "/blocks/ui.4dc415e8.js", + "experiments.js": "/experiments.4dc415e8.js", + "titles.js": "/titles.4dc415e8.js" } \ No newline at end of file diff --git a/build/titles.b82af12b.js b/build/titles.4dc415e8.js similarity index 99% rename from build/titles.b82af12b.js rename to build/titles.4dc415e8.js index 52cd4558..891e0909 100644 --- a/build/titles.b82af12b.js +++ b/build/titles.4dc415e8.js @@ -1,4 +1,4 @@ -!function(t,e){for(var n in e)t[n]=e[n]}(this,function(t){var e={};function n(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,n),a.l=!0,a.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 a in t)n.d(r,a,function(e){return t[e]}.bind(null,a));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=184)}({0:function(t,e){!function(){t.exports=this.React}()},1:function(t,e,n){t.exports=n(25)},10:function(t,e){function n(t,e,n,r,a,i,o){try{var s=t[i](o),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,a)}t.exports=function(t){return function(){var e=this,r=arguments;return new Promise((function(a,i){var o=t.apply(e,r);function s(t){n(o,a,i,s,c,"next",t)}function c(t){n(o,a,i,s,c,"throw",t)}s(void 0)}))}}},18:function(t,e,n){"use strict";t.exports=n(35)},184:function(t,e,n){"use strict";n.r(e);var r=n(2),a=n.n(r),i=n(0),o=n.n(i),s=n(3),c=n(8),l=n.n(c),u=function(t){return"abcdefghijklmnopqrstuvwxyz".toUpperCase()[Math.max(0,Math.min(t,26))]},f=function(t){return moment(t).format("MMMM D, YYYY — HH:mm")},p=function(t){var e=Math.floor(t/864e5),n=Math.floor((t-864e5*e)/36e5),r=Math.floor((t-864e5*e-36e5*n)/6e4);return"".concat(e,"d ").concat(n,"h ").concat(r,"m")},d=function(t,e){return t.length===e.length&&t.every((function(t,n){return t===e[n]}))},h=function(t){var e=t.time,n=void 0===e?0:e,r=t.interval,a=void 0===r?6e4:r,s=Object(i.useState)(n),c=l()(s,2),u=c[0],f=c[1];return Object(i.useEffect)((function(){if(a){var t=setInterval((function(){f(u-a)}),a);return function(){clearInterval(t)}}})),u<=0?null:o.a.createElement("span",null,p(u))};function m(){var t=a()(["\n\t.altis-experiments-panel-row {\n\t\tflex: 0 0 100%;\n\t}\n\t.components-base-control__help {\n\t\tmargin-top: 5px;\n\t\tcolor: #666;\n\t}\n\tlabel {\n\t\tfont-weight: 500;\n\t}\n"]);return m=function(){return t},t}var g=wp.components.PanelRow,v=Object(s.b)(g)(m()),y=function(t){return o.a.createElement(v,null,o.a.createElement("div",{className:"altis-experiments-panel-row"},t.children))},b=n(1),w=n.n(b),x=n(10),k=n.n(x),E=n(39),S=n.n(E),C={end_time:Date.now()+2592e6,paused:!0,results:{aggs:[],variants:[],winner:null,winning:null},start_time:Date.now(),started:!1,traffic_percentage:35},A=wp.apiFetch,_=wp.data,O=_.withSelect,T=_.withDispatch,j=wp.compose,P=j.compose,I=j.withState,R=wp.i18n.__,N=function(t,e){return e},L=P(I({isSaving:!1,prevTitles:[],error:!1}),O((function(t){var e=t("core/editor").getCurrentPostType();return{ab_tests:t("core/editor").getEditedPostAttribute("ab_tests"),originalTitles:t("core/editor").getCurrentPostAttribute("ab_test_titles")||[],post:t("core/editor").getCurrentPost(),postType:t("core").getPostType(e),test:t("core/editor").getEditedPostAttribute("ab_tests").titles||C,title:t("core/editor").getEditedPostAttribute("title")||"",titles:t("core/editor").getEditedPostAttribute("ab_test_titles")||[]}})),T((function(t,e){var n=e.ab_tests,r=e.post,a=e.postType,i=e.setState,o=function(){var t=k()(w.a.mark((function t(e){return w.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i({isSaving:!0}),t.prev=1,t.next=4,A({path:"/wp/v2/".concat(a.rest_base,"/").concat(r.id)+"?context=edit&_timestamp=".concat(Date.now()),method:"PATCH",body:JSON.stringify(e)});case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),i({error:t.t0});case 9:i({isSaving:!1});case 10:case"end":return t.stop()}}),t,null,[[1,6]])})));return function(e){return t.apply(this,arguments)}}(),s=function(){var e=k()(w.a.mark((function e(){var r,a,i,s,c=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=c.length>0&&void 0!==c[0]?c[0]:{},a=c.length>1&&void 0!==c[1]&&c[1],i=c.length>2&&void 0!==c[2]&&c[2],s={ab_tests:S()(n,{titles:r},{arrayMerge:N})},!1!==a&&(s.ab_test_titles=a),!i){e.next=8;break}return e.next=8,o(s);case 8:t("core/editor").editPost(s);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return{updateTest:s,updateTitles:function(){var e=k()(w.a.mark((function e(n){var r,a,i=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.length>1&&void 0!==i[1]&&i[1],a={ab_test_titles:n},!r){e.next=5;break}return e.next=5,o(a);case 5:t("core/editor").editPost(a);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),resetTest:function(t){var e=t||R("Are you sure you want to reset the test?","altis-analytics");window.confirm(e)&&s(C,[],!0)},saveTest:o}})));function M(){var t=a()(["\n\tfont-weight: bold;\n\n\t&.has-results::after {\n\t\tcontent: '';\n\t\tdisplay: inline-block;\n\t\tmargin-bottom: 0px;\n\t\tmargin-left: 7px;\n\t\twidth: .6rem;\n\t\theight: .6rem;\n\t\tborder-radius: 100px;\n\t\tbackground: #e2182c;\n\t\tbox-shadow: inset 0 0 2px rgba(0,0,0,.15);\n\t}\n"]);return M=function(){return t},t}var D=wp.i18n.__,$=s.b.span.attrs((function(t){return{className:t.winner?"has-results":""}}))(M()),z=L((function(t){var e=((t.test||{}).results||{}).winner,n=void 0===e?null:e;return o.a.createElement($,{winner:Boolean(n)},D("A/B","altis-analytics"))}));function F(){var t=a()(["\n\tposition: absolute;\n\ttop: 0;\n\tright: 0;\n\tfont-size: 90%;\n"]);return F=function(){return t},t}function G(){var t=a()(["\n\tmargin: 25px 0;\n\tposition: relative;\n\n\t.altis-experiments-variant__change {\n\t\tcolor: ",";\n\t}\n"]);return G=function(){return t},t}function B(){var t=a()(["\n\tmargin: 25px 0;\n\n\th3 {\n\t\tmargin-bottom: 10px;\n\t\tfont-weight: 500;\n\t}\n"]);return B=function(){return t},t}function H(){var t=a()(["\n\t&.is-button {\n\t\tborder-color: #e2182c;\n\t\tcolor: #e2182c;\n\n\t\t&:hover {\n\t\t\tbackground: #e2182c;\n\t\t\tborder-color: #e2182c;\n\t\t\tcolor: #fff;\n\t\t}\n\n\t\t&:active:enabled {\n\t\t\tbackground: #d00115;\n\t\t\tborder-color: #d00115;\n\t\t\tcolor: #fff;\n\t\t}\n\t}\n"]);return H=function(){return t},t}function Y(){var t=a()(["\n\ttext-align: center;\n\twidth: 100%;\n\tdisplay: block;\n"]);return Y=function(){return t},t}function U(){var t=a()(["\n\t&& {\n\t\tcolor: #d00115;\n\t\tfont-style: italic;\n\t\tmargin-top: 1em;\n\t\tdisplay: inline-flex;\n\n\t\t.dashicon {\n\t\t\twidth: 1rem;\n\t\t\theight: 1rem;\n\t\t\tmargin-right: 7px;\n\t\t\tflex: 1 0 1rem;\n\t\t}\n\t}\n"]);return U=function(){return t},t}function q(){var t=a()(["\n\tcolor: #6e7b92;\n"]);return q=function(){return t},t}function W(){var t=a()(["\n\t.components-panel__body-title {\n\t\t.components-panel__icon {\n\t\t\tcolor: #adb4c1;\n\t\t\talign-self: flex-end;\n\t\t\twidth: 16px;\n\t\t\theight: 16px;\n\t\t\tposition: absolute;\n\t\t\tright: 45px;\n\t\t\ttop: 1.1rem;\n\t\t}\n\t}\n"]);return W=function(){return t},t}var V=wp.components,X=V.Button,J=V.Icon,K=V.Panel,Z=X,Q=Object(s.b)(K)(W()),tt=s.b.p(q()),et=Object(s.b)((function(t){return o.a.createElement("p",t,o.a.createElement(J,{icon:"warning"}),t.children)})).attrs({className:"ab-tests__warning"})(U()),nt=Object(s.b)(Z).attrs({isPrimary:!0})(Y()),rt=Object(s.b)(nt).attrs({isDestructive:!0,isDefault:!1,isPrimary:!1})(H()),at=s.b.div(B()),it=s.b.div.attrs((function(t){return{className:"altis-experiments-variant ".concat(t.highlight?"altis-experiments-variant--highlight":"")}}))(G(),(function(t){return t.highlight?"#25865b":"inherit"})),ot=s.b.div.attrs({className:"altis-experiments-variant__change"})(F()),st=wp.data.withDispatch,ct=wp.compose.compose,lt=wp.i18n.__,ut=ct(L,st((function(t,e){return{revertTitle:function(){t("core/editor").editPost({title:e.titles[0]})}}})))((function(t){var e=t.test,n=void 0===e?{}:e,r=t.titles,a=void 0===r?[]:r,s=t.resetTest,c=t.revertTitle,l=n.results,d=n.end_time,h=n.start_time,m=n.traffic_percentage,g=l.winner,v=void 0===g?null:g,b=l.variants,w=void 0===b?[]:b,x=dc?e.getTime():i+864e5)}})),e&&o.a.createElement("p",{className:"altis-experiments-date-range__description description"},e))};mt.defaultProps={endTime:Date.now()+2592e6,startTime:Date.now()};var gt=mt,vt=n(9),yt=n.n(vt);function bt(){var t=a()(["\n\ttext-align: right;\n\tflex: 0;\n\talign-self: flex-end;\n\tfont-size: inherit;\n\n\t.dashicon {\n\t\twidth: auto;\n\t\tfont-size: inherit;\n\t\tline-height: inherit;\n\t\tvertical-align: baseline;\n\t}\n\n\tsvg.dashicon, .dashicon svg {\n\t\twidth: 0.9rem;\n\t\tmargin-left: 2px;\n\t}\n"]);return bt=function(){return t},t}function wt(){var t=a()(["\n\tflex: 1;\n\n\t.dashicon {\n\t\tmargin-right: 4px;\n\t\tvertical-align: middle;\n\t\tposition: relative;\n\t\twidth: 0.9rem;\n\t\ttop: -1px;\n\t}\n"]);return wt=function(){return t},t}function xt(){var t=a()(["\n\tfont-size: 85%;\n\tcolor: #666;\n\tdisplay: flex;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n"]);return xt=function(){return t},t}function kt(){var t=a()(["\n\tmargin-bottom: 5px;\n\tposition: relative;\n"]);return kt=function(){return t},t}var Et=wp.components,St=Et.Button,Ct=Et.TextareaControl,At=Et.Icon,_t=wp.i18n.__,Ot=s.b.div(kt()),Tt=s.b.div(xt()),jt=s.b.div(wt()),Pt=Object(s.b)(St).attrs({isLink:!0})(bt()),It=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=yt()(t);return r[n]=e,r},Rt=function(t){var e=t.defaultTitle,n=t.isEditable,r=t.onChange,a=t.postId,s=t.titles,c=t.variants,l=s.length>0?s:[e];return o.a.createElement(i.Fragment,null,l.map((function(t,e){var i=c&&c[e]||{size:0};return o.a.createElement(Ot,{key:e},o.a.createElement(Ct,{key:e,autoFocus:l.length-1===e,label:"\n\t\t\t\t\t\t\t\t".concat(_t("Title","altis-analytics"),"\n\t\t\t\t\t\t\t\t").concat(u(e),"\n\t\t\t\t\t\t\t\t").concat(0===e?_t("(original)","altis-analytics"):"","\n\t\t\t\t\t\t\t"),placeholder:_t("Enter another title here.","altis-analytics"),readOnly:!n,rows:3,value:t,onChange:function(t){return r(It(l,t,e))},onFocus:function(t){var e=2*t.target.value.length;t.target.setSelectionRange(e,e)},onKeyUp:function(n){""===t&&""===n.target.value&&(n.key&&"Backspace"===n.key||n.which&&8===n.which)&&r(function(t,e){var n=yt()(t);return n.splice(e,1),n}(l,e))}}),o.a.createElement(Tt,null,i.size>0&&o.a.createElement(jt,null,o.a.createElement(At,{icon:"visibility"}),i.size," ",o.a.createElement("span",{className:"screen-reader-text"},_t("views","altis-analytics"))),!n&&o.a.createElement(Pt,{href:"/?p=".concat(a,"&set_test=test_titles_").concat(a,":").concat(e),target:"_ab_test_preview"},_t("Preview","altis-analytics"),o.a.createElement(At,{icon:"external"}))))})),n&&l.length<26&&o.a.createElement(Ct,{autoFocus:l.length<=1,label:"".concat(_t("Title","altis-analytics")," ").concat(u(l.length)),placeholder:_t("Enter another title here.","altis-analytics"),rows:3,value:"",onChange:function(t){return r(It(l,t,l.length))}}))};function Nt(){var t=a()(["\n\t.components-base-control__field { justify-content: flex-start; }\n\t.components-range-control__wrapper { margin-left: 0; }\n\t.components-range-control__slider { flex: 1 1 50%; }\n"]);return Nt=function(){return t},t}var Lt=wp.components.RangeControl,Mt=wp.i18n.__,Dt=Object(s.b)(Lt)(Nt()),$t=function(t){var e=t.value,n=t.onChange;return o.a.createElement(i.Fragment,null,o.a.createElement(Dt,{help:Mt("This is the amount of traffic that will be shown one of the variants."),label:Mt("Traffic Percentage"),max:100,min:0,value:e,onChange:n}))},zt=wp.i18n.__,Ft=function(t){var e=t.isSaving,n=t.originalTitles,r=t.post,a=t.prevTitles,s=t.title,c=t.titles,l=t.test,u=t.setState,f=t.updateTest,p=t.updateTitles,m=l.paused,g=l.started,v=l.start_time,b=l.end_time,w=l.traffic_percentage,x=l.results.variants,k=void 0===x?[]:x;Object(i.useEffect)((function(){n.length&&!a.length&&u({prevTitles:n})}),[n,a,u]);var E=function(t){u({prevTitles:c}),f({paused:t},c,!0)},S=g&&v<=Date.now()&&b>=Date.now();return o.a.createElement(i.Fragment,null,o.a.createElement(y,null,m&&o.a.createElement(tt,null,zt("Your test is paused","altis-analytics")),S&&!m&&o.a.createElement(tt,null,zt("Your test is running","altis-analytics")),!m&&v>=Date.now()&&o.a.createElement(tt,null,zt("Your test will start in")," ",o.a.createElement(h,{time:v-Date.now()})),g&&o.a.createElement(nt,{disabled:c.length<2,isBusy:e,onClick:function(){return d(c,a)||m&&window.confirm(zt("Are you sure? Editing the titles will reset the current test results.","altis-analytics"))?E(!m):void E(!m)}},m&&zt("Resume test","altis-analytics"),!m&&zt("Pause test","altis-analytics")),!g&&o.a.createElement(nt,{disabled:c.length<2,isBusy:e,onClick:function(){u({prevTitles:c}),f({started:!0,paused:!1},c,!0)}},zt("Run test","altis-analytics")),g&&m&&!d(c,a)&&o.a.createElement(i.Fragment,null,o.a.createElement(et,null,zt("Editing the titles now will reset the test and delete the previous results.")),o.a.createElement(Z,{isLink:!0,onClick:function(){p(a)}},zt("Undo changes","altis-analytics")))),o.a.createElement(y,null,o.a.createElement("p",null,zt("Add multiple post titles and see which one has a higher conversion rate.","altis-analytics")),o.a.createElement(Rt,{defaultTitle:s,isEditable:m,postId:r.id,titles:c,variants:k,onChange:p})),o.a.createElement(y,null,o.a.createElement($t,{value:w||35,onChange:function(t){return f({traffic_percentage:t})}})),o.a.createElement(y,null,o.a.createElement(gt,{description:zt("The test will stop automatically when it reaches statistical significance.","altis-analytics"),endTime:b||Date.now()+2592e6,startTime:v||Date.now(),onChangeEnd:function(t){return f({end_time:t})},onChangeStart:function(t){return f({start_time:t})}})),g&&o.a.createElement(y,null,o.a.createElement(rt,{onClick:function(){window.confirm(zt("Are you sure you want to cancel the test?","altis-analytics"))&&f({end_time:Date.now()},!1,!0)}},zt("Cancel test","altis-analytics"))))};Ft.defaultProps={test:C};var Gt=L(Ft),Bt=wp.editPost,Ht=Bt.PluginSidebar,Yt=Bt.PluginSidebarMoreMenuItem,Ut=wp.i18n.__,qt=wp.components.PanelBody,Wt=function(t){var e=t.post,n=t.test,r=n.started,a=n.paused,s=n.results,c=n.end_time,l=s.winner,u=void 0===l?null:l,f=[r&&"is-started",a&&"is-paused"].filter(Boolean).join(" "),p=c=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;x(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}},26:function(t,e){t.exports=function(t,e,n,r){var a=n?n.call(r,t,e):void 0;if(void 0!==a)return!!a;if(t===e)return!0;if("object"!=typeof t||!t||"object"!=typeof e||!e)return!1;var i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(e),c=0;cr&&(r=(e=e.trim()).charCodeAt(0)),r){case 38:return e.replace(m,"$1"+t.trim());case 58:return t.trim()+e.replace(m,"$1"+t.trim());default:if(0<1*n&&0c.charCodeAt(8))break;case 115:o=o.replace(c,"-webkit-"+c)+";"+o;break;case 207:case 102:o=o.replace(c,"-webkit-"+(102s.charCodeAt(0)&&(s=s.trim()),s=[s],0d)&&(z=(B=B.replace(" ",":")).length),01?e-1:0),r=1;r0?" Additional arguments: "+n.join(", "):""))}var S=function(t){var e=document.head,n=t||e,r=document.createElement("style"),a=function(t){for(var e=t.childNodes,n=e.length;n>=0;n--){var r=e[n];if(r&&1===r.nodeType&&r.hasAttribute(b))return r}}(n),i=void 0!==a?a.nextSibling:null;r.setAttribute(b,"active"),r.setAttribute("data-styled-version","5.0.1");var o=k();return o&&r.setAttribute("nonce",o),n.insertBefore(r,i),r},C=function(){function t(t){var e=this.element=S(t);e.appendChild(document.createTextNode("")),this.sheet=function(t){if(t.sheet)return t.sheet;for(var e=document.styleSheets,n=0,r=e.length;n=0){var n=document.createTextNode(e),r=this.nodes[t];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},e.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.getRule=function(t){return t=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,a=r;t>=a;)(a<<=1)<0&&E(16,""+t);this.groupSizes=new Uint32Array(a),this.groupSizes.set(n),this.length=a;for(var i=r;i=this.length||0===this.groupSizes[t])return e;for(var n=this.groupSizes[t],r=this.indexOfGroup(t),a=r+n,i=r;i=P&&(P=e+1),T.set(t,e),j.set(e,t)},L="style["+b+'][data-styled-version="5.0.1"]',M=/(?:\s*)?(.*?){((?:{[^}]*}|(?!{).*?)*)}/g,D=new RegExp("^"+b+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\]'),$=function(t,e,n){for(var r,a=n.split(","),i=0,o=a.length;i0&&(l+=t+",")})),r+=""+s+c+'{content:"'+l+'"}\n'}}}return r}(this)},t}(),H=function(t,e){for(var n=e.length;n;)t=33*t^e.charCodeAt(--n);return t},Y=function(t){return H(5381,t)};var U=/^\s*\/\/.*$/gm;function q(t){var e,n,r,a=void 0===t?m:t,i=a.options,s=void 0===i?m:i,c=a.plugins,l=void 0===c?h:c,u=new o.a(s),f=[],p=function(t){function e(e){if(e)try{t(e+"}")}catch(t){}}return function(n,r,a,i,o,s,c,l,u,f){switch(n){case 1:if(0===u&&64===r.charCodeAt(0))return t(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return t(a[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(e)}}}((function(t){f.push(t)})),d=function(t,r,a){return r>0&&-1!==a.slice(0,r).indexOf(n)&&a.slice(r-n.length,r)!==n?"."+e:t};function g(t,a,i,o){void 0===o&&(o="&");var s=t.replace(U,""),c=a&&i?i+" "+a+" { "+s+" }":s;return e=o,n=a,r=new RegExp("\\"+n+"\\b","g"),u(i||!a?"":a,c)}return u.use([].concat(l,[function(t,e,a){2===t&&a.length&&a[0].lastIndexOf(n)>0&&(a[0]=a[0].replace(r,d))},p,function(t){if(-2===t){var e=f;return f=[],e}}])),g.hash=l.length?l.reduce((function(t,e){return e.name||E(15),H(t,e.name)}),5381).toString():"",g}var W=i.a.createContext(),V=(W.Consumer,i.a.createContext()),X=(V.Consumer,new B),J=q();function K(){return Object(a.useContext)(W)||X}function Z(){return Object(a.useContext)(V)||J}var Q=function(){function t(t,e){var n=this;this.inject=function(t){t.hasNameForId(n.id,n.name)||t.insertRules(n.id,n.name,J.apply(void 0,n.stringifyArgs))},this.toString=function(){return E(12,String(n.name))},this.name=t,this.id="sc-keyframes-"+t,this.stringifyArgs=e}return t.prototype.getName=function(){return this.name},t}(),tt=/([A-Z])/g,et=/^ms-/;function nt(t){return t.replace(tt,"-$1").toLowerCase().replace(et,"-ms-")}var rt=function(t){return null==t||!1===t||""===t},at=function t(e,n){var r=[];return Object.keys(e).forEach((function(n){if(!rt(e[n])){if(d(e[n]))return r.push.apply(r,t(e[n],n)),r;if(g(e[n]))return r.push(nt(n)+":",e[n],";"),r;r.push(nt(n)+": "+(a=n,(null==(i=e[n])||"boolean"==typeof i||""===i?"":"number"!=typeof i||0===i||a in s.a?String(i).trim():i+"px")+";"))}var a,i;return r})),n?[n+" {"].concat(r,["}"]):r};function it(t,e,n){if(Array.isArray(t)){for(var r,a=[],i=0,o=t.length;i1?e-1:0),r=1;r1?e-1:0),r=1;r25?39:97))};function dt(t){var e,n="";for(e=Math.abs(t);e>52;e=e/52|0)n=pt(e%52)+n;return(pt(e%52)+n).replace(ft,"$1-$2")}function ht(t){for(var e=0;e>>0);if(!e.hasNameForId(r,i)){var o=n(a,"."+i,void 0,r);e.insertRules(r,i,o)}return this.staticRulesId=i,i}for(var s=this.rules.length,c=H(this.baseHash,n.hash),l="",u=0;u>>0);if(!e.hasNameForId(r,h)){var m=n(l,"."+h,void 0,r);e.insertRules(r,h,m)}return h},t}(),gt=(new Set,function(t,e,n){return void 0===n&&(n=m),t.theme!==n.theme&&t.theme||e||n.theme}),vt=/[[\].#*$><+~=|^:(),"'`-]+/g,yt=/(^-|-$)/g;function bt(t){return t.replace(vt,"-").replace(yt,"")}function wt(t){return"string"==typeof t&&!0}var xt=function(t){return dt(Y(t)>>>0)};var kt=i.a.createContext();kt.Consumer;var Et={};function St(t,e,n){var r=t.attrs,i=t.componentStyle,o=t.defaultProps,s=t.foldedComponentIds,l=t.styledComponentId,u=t.target;Object(a.useDebugValue)(l);var p=function(t,e,n){void 0===t&&(t=m);var r=f({},e,{theme:t}),a={};return n.forEach((function(t){var e,n,i,o=t;for(e in g(o)&&(o=o(r)),o)r[e]=a[e]="className"===e?(n=a[e],i=o[e],n&&i?n+" "+i:n||i):o[e]})),[r,a]}(gt(e,Object(a.useContext)(kt),o)||m,e,r),d=p[0],h=p[1],v=function(t,e,n,r){var i=K(),o=Z(),s=t.isStatic&&!e?t.generateAndInjectStyles(m,i,o):t.generateAndInjectStyles(n,i,o);return Object(a.useDebugValue)(s),s}(i,r.length>0,d),y=n,b=h.as||e.as||u,w=wt(b),x=h!==e?f({},e,{},h):e,k=w||"as"in x||"forwardedAs"in x,E=k?{}:f({},x);if(k)for(var S in x)"forwardedAs"===S?E.as=x[S]:"as"===S||"forwardedAs"===S||w&&!Object(c.a)(S)||(E[S]=x[S]);return e.style&&h.style!==e.style&&(E.style=f({},e.style,{},h.style)),E.className=Array.prototype.concat(s,l,v!==l?v:null,e.className,h.className).filter(Boolean).join(" "),E.ref=y,Object(a.createElement)(b,E)}function Ct(t,e,n){var r,a=y(t),o=!wt(t),s=e.displayName,c=void 0===s?function(t){return wt(t)?"styled."+t:"Styled("+v(t)+")"}(t):s,l=e.componentId,p=void 0===l?function(t,e){var n="string"!=typeof t?"sc":bt(t);Et[n]=(Et[n]||0)+1;var r=n+"-"+xt(n+Et[n]);return e?e+"-"+r:r}(e.displayName,e.parentComponentId):l,d=e.attrs,m=void 0===d?h:d,g=e.displayName&&e.componentId?bt(e.displayName)+"-"+e.componentId:e.componentId||p,b=a&&t.attrs?Array.prototype.concat(t.attrs,m).filter(Boolean):m,w=new mt(a?t.componentStyle.rules.concat(n):n,g),x=function(t,e){return St(r,t,e)};return x.displayName=c,(r=i.a.forwardRef(x)).attrs=b,r.componentStyle=w,r.displayName=c,r.foldedComponentIds=a?Array.prototype.concat(t.foldedComponentIds,t.styledComponentId):h,r.styledComponentId=g,r.target=a?t.target:t,r.withComponent=function(t){var r=e.componentId,a=function(t,e){if(null==t)return{};var n,r,a={},i=Object.keys(t);for(r=0;r=0||(a[n]=t[n]);return a}(e,["componentId"]),i=r&&r+"-"+(wt(t)?t:bt(v(t)));return Ct(t,f({},a,{attrs:b,componentId:i}),n)},Object.defineProperty(r,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=a?ut({},t.defaultProps,e):e}}),r.toString=function(){return"."+r.styledComponentId},o&&u()(r,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,self:!0,styledComponentId:!0,target:!0,withComponent:!0}),r}var At=function(t){return function t(e,n,a){if(void 0===a&&(a=m),!Object(r.isValidElementType)(n))return E(1,String(n));var i=function(){return e(n,a,ot.apply(void 0,arguments))};return i.withConfig=function(r){return t(e,n,f({},a,{},r))},i.attrs=function(r){return t(e,n,f({},a,{attrs:Array.prototype.concat(a.attrs,r).filter(Boolean)}))},i}(Ct,t)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(t){At[t]=At(t)}));e.b=At}).call(this,n(34))},30:function(t,e){t.exports=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1)for(var n=1;n0&&void 0!==c[0]?c[0]:{},a=c.length>1&&void 0!==c[1]&&c[1],i=c.length>2&&void 0!==c[2]&&c[2],s={ab_tests:S()(n,{titles:r},{arrayMerge:N})},!1!==a&&(s.ab_test_titles=a),!i){e.next=8;break}return e.next=8,o(s);case 8:t("core/editor").editPost(s);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return{updateTest:s,updateTitles:function(){var e=k()(w.a.mark((function e(n){var r,a,i=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.length>1&&void 0!==i[1]&&i[1],a={ab_test_titles:n},!r){e.next=5;break}return e.next=5,o(a);case 5:t("core/editor").editPost(a);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),resetTest:function(t){var e=t||R("Are you sure you want to reset the test?","altis-analytics");window.confirm(e)&&s(C,[],!0)},saveTest:o}})));function M(){var t=a()(["\n\tfont-weight: bold;\n\n\t&.has-results::after {\n\t\tcontent: '';\n\t\tdisplay: inline-block;\n\t\tmargin-bottom: 0px;\n\t\tmargin-left: 7px;\n\t\twidth: .6rem;\n\t\theight: .6rem;\n\t\tborder-radius: 100px;\n\t\tbackground: #e2182c;\n\t\tbox-shadow: inset 0 0 2px rgba(0,0,0,.15);\n\t}\n"]);return M=function(){return t},t}var D=wp.i18n.__,$=s.b.span.attrs((function(t){return{className:t.winner?"has-results":""}}))(M()),z=L((function(t){var e=((t.test||{}).results||{}).winner,n=void 0===e?null:e;return o.a.createElement($,{winner:Boolean(n)},D("A/B","altis-analytics"))}));function F(){var t=a()(["\n\tposition: absolute;\n\ttop: 0;\n\tright: 0;\n\tfont-size: 90%;\n"]);return F=function(){return t},t}function G(){var t=a()(["\n\tmargin: 25px 0;\n\tposition: relative;\n\n\t.altis-experiments-variant__change {\n\t\tcolor: ",";\n\t}\n"]);return G=function(){return t},t}function B(){var t=a()(["\n\tmargin: 25px 0;\n\n\th3 {\n\t\tmargin-bottom: 10px;\n\t\tfont-weight: 500;\n\t}\n"]);return B=function(){return t},t}function H(){var t=a()(["\n\t&.is-button {\n\t\tborder-color: #e2182c;\n\t\tcolor: #e2182c;\n\n\t\t&:hover {\n\t\t\tbackground: #e2182c;\n\t\t\tborder-color: #e2182c;\n\t\t\tcolor: #fff;\n\t\t}\n\n\t\t&:active:enabled {\n\t\t\tbackground: #d00115;\n\t\t\tborder-color: #d00115;\n\t\t\tcolor: #fff;\n\t\t}\n\t}\n"]);return H=function(){return t},t}function Y(){var t=a()(["\n\ttext-align: center;\n\twidth: 100%;\n\tdisplay: block;\n"]);return Y=function(){return t},t}function U(){var t=a()(["\n\t&& {\n\t\tcolor: #d00115;\n\t\tfont-style: italic;\n\t\tmargin-top: 1em;\n\t\tdisplay: inline-flex;\n\n\t\t.dashicon {\n\t\t\twidth: 1rem;\n\t\t\theight: 1rem;\n\t\t\tmargin-right: 7px;\n\t\t\tflex: 1 0 1rem;\n\t\t}\n\t}\n"]);return U=function(){return t},t}function q(){var t=a()(["\n\tcolor: #6e7b92;\n"]);return q=function(){return t},t}function W(){var t=a()(["\n\t.components-panel__body-title {\n\t\t.components-panel__icon {\n\t\t\tcolor: #adb4c1;\n\t\t\talign-self: flex-end;\n\t\t\twidth: 16px;\n\t\t\theight: 16px;\n\t\t\tposition: absolute;\n\t\t\tright: 45px;\n\t\t\ttop: 1.1rem;\n\t\t}\n\t}\n"]);return W=function(){return t},t}var V=wp.components,X=V.Button,J=V.Icon,K=V.Panel,Z=X,Q=Object(s.b)(K)(W()),tt=s.b.p(q()),et=Object(s.b)((function(t){return o.a.createElement("p",t,o.a.createElement(J,{icon:"warning"}),t.children)})).attrs({className:"ab-tests__warning"})(U()),nt=Object(s.b)(Z).attrs({isPrimary:!0})(Y()),rt=Object(s.b)(nt).attrs({isDestructive:!0,isDefault:!1,isPrimary:!1})(H()),at=s.b.div(B()),it=s.b.div.attrs((function(t){return{className:"altis-experiments-variant ".concat(t.highlight?"altis-experiments-variant--highlight":"")}}))(G(),(function(t){return t.highlight?"#25865b":"inherit"})),ot=s.b.div.attrs({className:"altis-experiments-variant__change"})(F()),st=wp.data.withDispatch,ct=wp.compose.compose,lt=wp.i18n.__,ut=ct(L,st((function(t,e){return{revertTitle:function(){t("core/editor").editPost({title:e.titles[0]})}}})))((function(t){var e=t.test,n=void 0===e?{}:e,r=t.titles,a=void 0===r?[]:r,s=t.resetTest,c=t.revertTitle,l=n.results,d=n.end_time,h=n.start_time,m=n.traffic_percentage,g=l.winner,v=void 0===g?null:g,b=l.variants,w=void 0===b?[]:b,x=dc?e.getTime():i+864e5)}})),e&&o.a.createElement("p",{className:"altis-experiments-date-range__description description"},e))};mt.defaultProps={endTime:Date.now()+2592e6,startTime:Date.now()};var gt=mt,vt=n(9),yt=n.n(vt);function bt(){var t=a()(["\n\ttext-align: right;\n\tflex: 0;\n\talign-self: flex-end;\n\tfont-size: inherit;\n\n\t.dashicon {\n\t\twidth: auto;\n\t\tfont-size: inherit;\n\t\tline-height: inherit;\n\t\tvertical-align: baseline;\n\t}\n\n\tsvg.dashicon, .dashicon svg {\n\t\twidth: 0.9rem;\n\t\tmargin-left: 2px;\n\t}\n"]);return bt=function(){return t},t}function wt(){var t=a()(["\n\tflex: 1;\n\n\t.dashicon {\n\t\tmargin-right: 4px;\n\t\tvertical-align: middle;\n\t\tposition: relative;\n\t\twidth: 0.9rem;\n\t\ttop: -1px;\n\t}\n"]);return wt=function(){return t},t}function xt(){var t=a()(["\n\tfont-size: 85%;\n\tcolor: #666;\n\tdisplay: flex;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n"]);return xt=function(){return t},t}function kt(){var t=a()(["\n\tmargin-bottom: 5px;\n\tposition: relative;\n"]);return kt=function(){return t},t}var Et=wp.components,St=Et.Button,Ct=Et.TextareaControl,At=Et.Icon,_t=wp.i18n.__,Ot=s.b.div(kt()),Tt=s.b.div(xt()),jt=s.b.div(wt()),Pt=Object(s.b)(St).attrs({isLink:!0})(bt()),It=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=yt()(t);return r[n]=e,r},Rt=function(t){var e=t.defaultTitle,n=t.isEditable,r=t.onChange,a=t.postId,s=t.titles,c=t.variants,l=s.length>0?s:[e];return o.a.createElement(i.Fragment,null,l.map((function(t,e){var i=c&&c[e]||{size:0};return o.a.createElement(Ot,{key:e},o.a.createElement(Ct,{key:e,autoFocus:l.length-1===e,label:"\n\t\t\t\t\t\t\t\t".concat(_t("Title","altis-analytics"),"\n\t\t\t\t\t\t\t\t").concat(u(e),"\n\t\t\t\t\t\t\t\t").concat(0===e?_t("(original)","altis-analytics"):"","\n\t\t\t\t\t\t\t"),placeholder:_t("Enter another title here.","altis-analytics"),readOnly:!n,rows:3,value:t,onChange:function(t){return r(It(l,t,e))},onFocus:function(t){var e=2*t.target.value.length;t.target.setSelectionRange(e,e)},onKeyUp:function(n){""===t&&""===n.target.value&&(n.key&&"Backspace"===n.key||n.which&&8===n.which)&&r(function(t,e){var n=yt()(t);return n.splice(e,1),n}(l,e))}}),o.a.createElement(Tt,null,i.size>0&&o.a.createElement(jt,null,o.a.createElement(At,{icon:"visibility"}),i.size," ",o.a.createElement("span",{className:"screen-reader-text"},_t("views","altis-analytics"))),!n&&o.a.createElement(Pt,{href:"/?p=".concat(a,"&set_test=test_titles_").concat(a,":").concat(e),target:"_ab_test_preview"},_t("Preview","altis-analytics"),o.a.createElement(At,{icon:"external"}))))})),n&&l.length<26&&o.a.createElement(Ct,{autoFocus:l.length<=1,label:"".concat(_t("Title","altis-analytics")," ").concat(u(l.length)),placeholder:_t("Enter another title here.","altis-analytics"),rows:3,value:"",onChange:function(t){return r(It(l,t,l.length))}}))};function Nt(){var t=a()(["\n\t.components-base-control__field { justify-content: flex-start; }\n\t.components-range-control__wrapper { margin-left: 0; }\n\t.components-range-control__slider { flex: 1 1 50%; }\n"]);return Nt=function(){return t},t}var Lt=wp.components.RangeControl,Mt=wp.i18n.__,Dt=Object(s.b)(Lt)(Nt()),$t=function(t){var e=t.value,n=t.onChange;return o.a.createElement(i.Fragment,null,o.a.createElement(Dt,{help:Mt("This is the amount of traffic that will be shown one of the variants."),label:Mt("Traffic Percentage"),max:100,min:0,value:e,onChange:n}))},zt=wp.i18n.__,Ft=function(t){var e=t.isSaving,n=t.originalTitles,r=t.post,a=t.prevTitles,s=t.title,c=t.titles,l=t.test,u=t.setState,f=t.updateTest,p=t.updateTitles,m=l.paused,g=l.started,v=l.start_time,b=l.end_time,w=l.traffic_percentage,x=l.results.variants,k=void 0===x?[]:x;Object(i.useEffect)((function(){n.length&&!a.length&&u({prevTitles:n})}),[n,a,u]);var E=function(t){u({prevTitles:c}),f({paused:t},c,!0)},S=g&&v<=Date.now()&&b>=Date.now();return o.a.createElement(i.Fragment,null,o.a.createElement(y,null,m&&o.a.createElement(tt,null,zt("Your test is paused","altis-analytics")),S&&!m&&o.a.createElement(tt,null,zt("Your test is running","altis-analytics")),!m&&v>=Date.now()&&o.a.createElement(tt,null,zt("Your test will start in")," ",o.a.createElement(h,{time:v-Date.now()})),g&&o.a.createElement(nt,{disabled:c.length<2,isBusy:e,onClick:function(){return d(c,a)||m&&window.confirm(zt("Are you sure? Editing the titles will reset the current test results.","altis-analytics"))?E(!m):void E(!m)}},m&&zt("Resume test","altis-analytics"),!m&&zt("Pause test","altis-analytics")),!g&&o.a.createElement(nt,{disabled:c.length<2,isBusy:e,onClick:function(){u({prevTitles:c}),f({started:!0,paused:!1},c,!0)}},zt("Run test","altis-analytics")),g&&m&&!d(c,a)&&o.a.createElement(i.Fragment,null,o.a.createElement(et,null,zt("Editing the titles now will reset the test and delete the previous results.")),o.a.createElement(Z,{isLink:!0,onClick:function(){p(a)}},zt("Undo changes","altis-analytics")))),o.a.createElement(y,null,o.a.createElement("p",null,zt("Add multiple post titles and see which one has a higher conversion rate.","altis-analytics")),o.a.createElement(Rt,{defaultTitle:s,isEditable:m,postId:r.id,titles:c,variants:k,onChange:p})),o.a.createElement(y,null,o.a.createElement($t,{value:w||35,onChange:function(t){return f({traffic_percentage:t})}})),o.a.createElement(y,null,o.a.createElement(gt,{description:zt("The test will stop automatically when it reaches statistical significance.","altis-analytics"),endTime:b||Date.now()+2592e6,startTime:v||Date.now(),onChangeEnd:function(t){return f({end_time:t})},onChangeStart:function(t){return f({start_time:t})}})),g&&o.a.createElement(y,null,o.a.createElement(rt,{onClick:function(){window.confirm(zt("Are you sure you want to cancel the test?","altis-analytics"))&&f({end_time:Date.now()},!1,!0)}},zt("Cancel test","altis-analytics"))))};Ft.defaultProps={test:C};var Gt=L(Ft),Bt=wp.editPost,Ht=Bt.PluginSidebar,Yt=Bt.PluginSidebarMoreMenuItem,Ut=wp.i18n.__,qt=wp.components.PanelBody,Wt=function(t){var e=t.post,n=t.test,r=n.started,a=n.paused,s=n.results,c=n.end_time,l=s.winner,u=void 0===l?null:l,f=[r&&"is-started",a&&"is-paused"].filter(Boolean).join(" "),p=c=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;x(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}},26:function(t,e){t.exports=function(t,e,n,r){var a=n?n.call(r,t,e):void 0;if(void 0!==a)return!!a;if(t===e)return!0;if("object"!=typeof t||!t||"object"!=typeof e||!e)return!1;var i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(e),c=0;cr&&(r=(e=e.trim()).charCodeAt(0)),r){case 38:return e.replace(m,"$1"+t.trim());case 58:return t.trim()+e.replace(m,"$1"+t.trim());default:if(0<1*n&&0c.charCodeAt(8))break;case 115:o=o.replace(c,"-webkit-"+c)+";"+o;break;case 207:case 102:o=o.replace(c,"-webkit-"+(102s.charCodeAt(0)&&(s=s.trim()),s=[s],0d)&&(z=(B=B.replace(" ",":")).length),01?e-1:0),r=1;r0?" Additional arguments: "+n.join(", "):""))}var S=function(t){var e=document.head,n=t||e,r=document.createElement("style"),a=function(t){for(var e=t.childNodes,n=e.length;n>=0;n--){var r=e[n];if(r&&1===r.nodeType&&r.hasAttribute(b))return r}}(n),i=void 0!==a?a.nextSibling:null;r.setAttribute(b,"active"),r.setAttribute("data-styled-version","5.0.1");var o=k();return o&&r.setAttribute("nonce",o),n.insertBefore(r,i),r},C=function(){function t(t){var e=this.element=S(t);e.appendChild(document.createTextNode("")),this.sheet=function(t){if(t.sheet)return t.sheet;for(var e=document.styleSheets,n=0,r=e.length;n=0){var n=document.createTextNode(e),r=this.nodes[t];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},e.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.getRule=function(t){return t=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,a=r;t>=a;)(a<<=1)<0&&E(16,""+t);this.groupSizes=new Uint32Array(a),this.groupSizes.set(n),this.length=a;for(var i=r;i=this.length||0===this.groupSizes[t])return e;for(var n=this.groupSizes[t],r=this.indexOfGroup(t),a=r+n,i=r;i=P&&(P=e+1),T.set(t,e),j.set(e,t)},L="style["+b+'][data-styled-version="5.0.1"]',M=/(?:\s*)?(.*?){((?:{[^}]*}|(?!{).*?)*)}/g,D=new RegExp("^"+b+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\]'),$=function(t,e,n){for(var r,a=n.split(","),i=0,o=a.length;i0&&(l+=t+",")})),r+=""+s+c+'{content:"'+l+'"}\n'}}}return r}(this)},t}(),H=function(t,e){for(var n=e.length;n;)t=33*t^e.charCodeAt(--n);return t},Y=function(t){return H(5381,t)};var U=/^\s*\/\/.*$/gm;function q(t){var e,n,r,a=void 0===t?m:t,i=a.options,s=void 0===i?m:i,c=a.plugins,l=void 0===c?h:c,u=new o.a(s),f=[],p=function(t){function e(e){if(e)try{t(e+"}")}catch(t){}}return function(n,r,a,i,o,s,c,l,u,f){switch(n){case 1:if(0===u&&64===r.charCodeAt(0))return t(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return t(a[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(e)}}}((function(t){f.push(t)})),d=function(t,r,a){return r>0&&-1!==a.slice(0,r).indexOf(n)&&a.slice(r-n.length,r)!==n?"."+e:t};function g(t,a,i,o){void 0===o&&(o="&");var s=t.replace(U,""),c=a&&i?i+" "+a+" { "+s+" }":s;return e=o,n=a,r=new RegExp("\\"+n+"\\b","g"),u(i||!a?"":a,c)}return u.use([].concat(l,[function(t,e,a){2===t&&a.length&&a[0].lastIndexOf(n)>0&&(a[0]=a[0].replace(r,d))},p,function(t){if(-2===t){var e=f;return f=[],e}}])),g.hash=l.length?l.reduce((function(t,e){return e.name||E(15),H(t,e.name)}),5381).toString():"",g}var W=i.a.createContext(),V=(W.Consumer,i.a.createContext()),X=(V.Consumer,new B),J=q();function K(){return Object(a.useContext)(W)||X}function Z(){return Object(a.useContext)(V)||J}var Q=function(){function t(t,e){var n=this;this.inject=function(t){t.hasNameForId(n.id,n.name)||t.insertRules(n.id,n.name,J.apply(void 0,n.stringifyArgs))},this.toString=function(){return E(12,String(n.name))},this.name=t,this.id="sc-keyframes-"+t,this.stringifyArgs=e}return t.prototype.getName=function(){return this.name},t}(),tt=/([A-Z])/g,et=/^ms-/;function nt(t){return t.replace(tt,"-$1").toLowerCase().replace(et,"-ms-")}var rt=function(t){return null==t||!1===t||""===t},at=function t(e,n){var r=[];return Object.keys(e).forEach((function(n){if(!rt(e[n])){if(d(e[n]))return r.push.apply(r,t(e[n],n)),r;if(g(e[n]))return r.push(nt(n)+":",e[n],";"),r;r.push(nt(n)+": "+(a=n,(null==(i=e[n])||"boolean"==typeof i||""===i?"":"number"!=typeof i||0===i||a in s.a?String(i).trim():i+"px")+";"))}var a,i;return r})),n?[n+" {"].concat(r,["}"]):r};function it(t,e,n){if(Array.isArray(t)){for(var r,a=[],i=0,o=t.length;i1?e-1:0),r=1;r1?e-1:0),r=1;r25?39:97))};function dt(t){var e,n="";for(e=Math.abs(t);e>52;e=e/52|0)n=pt(e%52)+n;return(pt(e%52)+n).replace(ft,"$1-$2")}function ht(t){for(var e=0;e>>0);if(!e.hasNameForId(r,i)){var o=n(a,"."+i,void 0,r);e.insertRules(r,i,o)}return this.staticRulesId=i,i}for(var s=this.rules.length,c=H(this.baseHash,n.hash),l="",u=0;u>>0);if(!e.hasNameForId(r,h)){var m=n(l,"."+h,void 0,r);e.insertRules(r,h,m)}return h},t}(),gt=(new Set,function(t,e,n){return void 0===n&&(n=m),t.theme!==n.theme&&t.theme||e||n.theme}),vt=/[[\].#*$><+~=|^:(),"'`-]+/g,yt=/(^-|-$)/g;function bt(t){return t.replace(vt,"-").replace(yt,"")}function wt(t){return"string"==typeof t&&!0}var xt=function(t){return dt(Y(t)>>>0)};var kt=i.a.createContext();kt.Consumer;var Et={};function St(t,e,n){var r=t.attrs,i=t.componentStyle,o=t.defaultProps,s=t.foldedComponentIds,l=t.styledComponentId,u=t.target;Object(a.useDebugValue)(l);var p=function(t,e,n){void 0===t&&(t=m);var r=f({},e,{theme:t}),a={};return n.forEach((function(t){var e,n,i,o=t;for(e in g(o)&&(o=o(r)),o)r[e]=a[e]="className"===e?(n=a[e],i=o[e],n&&i?n+" "+i:n||i):o[e]})),[r,a]}(gt(e,Object(a.useContext)(kt),o)||m,e,r),d=p[0],h=p[1],v=function(t,e,n,r){var i=K(),o=Z(),s=t.isStatic&&!e?t.generateAndInjectStyles(m,i,o):t.generateAndInjectStyles(n,i,o);return Object(a.useDebugValue)(s),s}(i,r.length>0,d),y=n,b=h.as||e.as||u,w=wt(b),x=h!==e?f({},e,{},h):e,k=w||"as"in x||"forwardedAs"in x,E=k?{}:f({},x);if(k)for(var S in x)"forwardedAs"===S?E.as=x[S]:"as"===S||"forwardedAs"===S||w&&!Object(c.a)(S)||(E[S]=x[S]);return e.style&&h.style!==e.style&&(E.style=f({},e.style,{},h.style)),E.className=Array.prototype.concat(s,l,v!==l?v:null,e.className,h.className).filter(Boolean).join(" "),E.ref=y,Object(a.createElement)(b,E)}function Ct(t,e,n){var r,a=y(t),o=!wt(t),s=e.displayName,c=void 0===s?function(t){return wt(t)?"styled."+t:"Styled("+v(t)+")"}(t):s,l=e.componentId,p=void 0===l?function(t,e){var n="string"!=typeof t?"sc":bt(t);Et[n]=(Et[n]||0)+1;var r=n+"-"+xt(n+Et[n]);return e?e+"-"+r:r}(e.displayName,e.parentComponentId):l,d=e.attrs,m=void 0===d?h:d,g=e.displayName&&e.componentId?bt(e.displayName)+"-"+e.componentId:e.componentId||p,b=a&&t.attrs?Array.prototype.concat(t.attrs,m).filter(Boolean):m,w=new mt(a?t.componentStyle.rules.concat(n):n,g),x=function(t,e){return St(r,t,e)};return x.displayName=c,(r=i.a.forwardRef(x)).attrs=b,r.componentStyle=w,r.displayName=c,r.foldedComponentIds=a?Array.prototype.concat(t.foldedComponentIds,t.styledComponentId):h,r.styledComponentId=g,r.target=a?t.target:t,r.withComponent=function(t){var r=e.componentId,a=function(t,e){if(null==t)return{};var n,r,a={},i=Object.keys(t);for(r=0;r=0||(a[n]=t[n]);return a}(e,["componentId"]),i=r&&r+"-"+(wt(t)?t:bt(v(t)));return Ct(t,f({},a,{attrs:b,componentId:i}),n)},Object.defineProperty(r,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=a?ut({},t.defaultProps,e):e}}),r.toString=function(){return"."+r.styledComponentId},o&&u()(r,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,self:!0,styledComponentId:!0,target:!0,withComponent:!0}),r}var At=function(t){return function t(e,n,a){if(void 0===a&&(a=m),!Object(r.isValidElementType)(n))return E(1,String(n));var i=function(){return e(n,a,ot.apply(void 0,arguments))};return i.withConfig=function(r){return t(e,n,f({},a,{},r))},i.attrs=function(r){return t(e,n,f({},a,{attrs:Array.prototype.concat(a.attrs,r).filter(Boolean)}))},i}(Ct,t)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(t){At[t]=At(t)}));e.b=At}).call(this,n(34))},30:function(t,e){t.exports=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1)for(var n=1;n '\\Altis\\Analytics\\Utils\\get_countries', + 'disable_free_text' => true, + ] ); // UTM Campaign parameters. register_field( 'endpoint.Attributes.initial_utm_campaign', __( 'First UTM Campaign', 'altis-analytics' ) ); @@ -332,8 +335,9 @@ function get_fields() : array { * @param string $field The elasticsearch field name. * @param string $label A human readable label for the field. * @param string $description An optional long description for the field. + * @param array $options An optional object with further field attributes. */ -function register_field( string $field, string $label, ?string $description = null ) { +function register_field( string $field, string $label, ?string $description = null, array $options = [] ) { global $altis_analytics_event_data_maps; if ( empty( $altis_analytics_event_data_maps ) ) { $altis_analytics_event_data_maps = []; @@ -344,7 +348,9 @@ function register_field( string $field, string $label, ?string $description = nu 'label' => $label, 'description' => $description, 'type' => Utils\get_field_type( $field ), + 'options' => $options, ]; + ksort( $altis_analytics_event_data_maps ); } @@ -714,12 +720,31 @@ function get_field_data() : ?array { foreach ( $maps as $field ) { $field_name = $field['name']; if ( isset( $aggregations[ $field_name ]['buckets'] ) ) { - $field['data'] = array_map( function ( $bucket ) { - return [ - 'value' => $bucket['key'], - 'count' => $bucket['doc_count'], - ]; - }, $aggregations[ $field_name ]['buckets'] ); + $options = $field['options']['options'] ?? null; + if ( is_callable( $options ) ) { + $options = call_user_func( $options ); + } + if ( is_array( $options ) ) { + $buckets = wp_list_pluck( $aggregations[ $field_name ]['buckets'], 'doc_count', 'key' ); + $field_data = array_map( function( $value, $label ) use ( $buckets, $total ) { + return [ + 'value' => $value, + 'label' => $label, + 'count' => $buckets[ $value ] ?? 0, + 'percent' => isset( $buckets[ $value ] ) ? intval( $buckets[ $value ] / $total * 100 ) : 0, + ]; + }, array_keys( $options ), $options ); + unset( $field['options']['options'] ); + } else { + $field_data = array_map( function ( $bucket ) use ( $total ) { + return [ + 'value' => $bucket['key'], + 'count' => $bucket['doc_count'], + 'percent' => $bucket['doc_count'] ? intval( $bucket['doc_count'] / $total * 100 ) : 0, + ]; + }, $aggregations[ $field_name ]['buckets'] ); + } + $field['data'] = $field_data; } else { $field['stats'] = $aggregations[ $field_name ]; } diff --git a/inc/blocks/namespace.php b/inc/blocks/namespace.php index a0337dc0..a7882fea 100644 --- a/inc/blocks/namespace.php +++ b/inc/blocks/namespace.php @@ -23,17 +23,19 @@ function setup() { require_once __DIR__ . '/personalization/register.php'; require_once __DIR__ . '/personalization-variant/register.php'; + require_once __DIR__ . '/shim/register.php'; // Register blocks. Personalization\setup(); Personalization_Variant\setup(); + Shim\setup(); // Set up the XB shadow post type. add_action( 'init', __NAMESPACE__ . '\\register_post_type' ); add_action( 'save_post', __NAMESPACE__ . '\\on_save_post', 10, 3 ); // Register experience block category. - add_filter( 'block_categories', __NAMESPACE__ . '\\add_block_category', 100 ); + add_filter( 'block_categories_all', __NAMESPACE__ . '\\add_block_category', 100 ); // Change the default edit post link for XB posts. add_filter( 'get_edit_post_link', __NAMESPACE__ . '\\update_xb_edit_post_link', 10, 2 ); @@ -49,10 +51,6 @@ function setup() { add_action( 'admin_menu', __NAMESPACE__ . '\\add_block_admin_page' ); add_action( 'admin_footer', __NAMESPACE__ . '\\modal_portal' ); - // Shim server side render block to allow passing inner blocks as attribute. - add_filter( 'render_block_data', __NAMESPACE__ . '\\ssr_inner_blocks_shim' ); - register_ssr_inner_blocks_shim(); - // Publication checklist integration. add_action( 'altis.publication-checklist.register_prepublish_checks', __NAMESPACE__ . '\\check_conversion_goals' ); } @@ -713,44 +711,6 @@ function get_views( string $block_id, $args = [] ) { return $data; } -/** - * Extract inner blocks from attributes. - * - * @param array $block The block configuration. - * @return array - */ -function ssr_inner_blocks_shim( array $block ) : array { - if ( $block['blockName'] !== 'altis/shim' ) { - return $block; - } - - // Populate inner blocks by parsing content. - $block['innerBlocks'] = parse_blocks( $block['attrs']['content'] ?? [] ); - - // Populate inner content with an array of null placeholders so inner blocks are processed. - $block['innerContent'] = array_fill( 0, count( $block['innerBlocks'] ), null ); - - return $block; -} - -/** - * Registers an inner blocks SSR shim. - * - * @return void - */ -function register_ssr_inner_blocks_shim() { - register_block_type( 'altis/shim', [ - 'attributes' => [ - 'content' => [ - 'type' => 'string', - ], - ], - 'render_callback' => function ( array $attributes, ?string $inner_content ) : string { - return sprintf( '
%s
', $inner_content ); - }, - ] ); -} - /** * Register conversion goal validation check. * diff --git a/inc/blocks/personalization/index.js b/inc/blocks/personalization/index.js index e8c65297..2d6504c2 100644 --- a/inc/blocks/personalization/index.js +++ b/inc/blocks/personalization/index.js @@ -1,7 +1,11 @@ +import shimBlockData from '../shim/block.json'; + import blockData from './block.json'; + import Status from './components/status'; import edit from './edit'; import save from './save'; +import transforms from './transforms'; const { registerBlockType } = wp.blocks; const { addFilter } = wp.hooks; @@ -19,12 +23,19 @@ const settings = { ], edit, save, + transforms, ...blockData.settings, }; // Register block. registerBlockType( blockData.name, settings ); +// Register shim. +registerBlockType( shimBlockData.name, { + title: 'shim', + ...shimBlockData.settings, +} ); + // Enhance publication checklist if available. addFilter( 'altis-publishing-workflow.item.xbs-valid-conversions', 'altis/xbs', () => { return Status; diff --git a/inc/blocks/personalization/transforms.js b/inc/blocks/personalization/transforms.js new file mode 100644 index 00000000..41495d57 --- /dev/null +++ b/inc/blocks/personalization/transforms.js @@ -0,0 +1,63 @@ +import variantBlockData from '../personalization-variant/block.json'; + +import blockData from './block.json'; + +const { createBlock } = wp.blocks; +const { select } = wp.data; + +/** + * Returns an array of selected block objects. + * + * Note: This removes the need for __experimentalConvert transform attribute, which includes full objects with block names. + * + * @returns {object} Selected blocks' objects. + */ +function getSelectedBlocks() { + const { + getSelectedBlockCount, + getSelectedBlock, + getMultiSelectedBlocks, + } = select( 'core/block-editor' ); + + return getSelectedBlockCount() > 1 ? getMultiSelectedBlocks() : [ getSelectedBlock() ]; +} + +const transforms = { + from: [ + { + type: 'block', + isMultiBlock: true, + blocks: [ '*' ], + /** + * Define transform rules from other blocks. + * + * @returns {object} Return a personalization block with nested original block. + */ + transform: () => createBlock( + blockData.name, + {}, + [ + createBlock( + variantBlockData.name, + { + fallback: true, + audience: null, + }, + getSelectedBlocks().map( block => createBlock( block.name, block.attributes, block.innerBlocks ) ) + ), + ] + ), + /** + * Exclude blocks that we cannot nest, eg: self instances, and anything with defined parent attribute. + * + * @returns {bool} Whether the original block qualifies for transformation. + */ + isMatch: () => ! getSelectedBlocks().filter( block => + block.name === blockData.name + || wp.blocks.getBlockType( block.name ).parent?.length + ).length, + }, + ], +}; + +export default transforms; diff --git a/inc/blocks/shim/block.json b/inc/blocks/shim/block.json new file mode 100644 index 00000000..0de5ad5c --- /dev/null +++ b/inc/blocks/shim/block.json @@ -0,0 +1,14 @@ +{ + "name": "altis/shim", + "settings": { + "category": "altis-experience-blocks", + "supports": { + "inserter": false + }, + "attributes": { + "content": { + "type": "string" + } + } + } +} diff --git a/inc/blocks/shim/register.php b/inc/blocks/shim/register.php new file mode 100644 index 00000000..8c33e32d --- /dev/null +++ b/inc/blocks/shim/register.php @@ -0,0 +1,65 @@ + $block_data['settings']['attributes'], + 'render_callback' => __NAMESPACE__ . '\\render_block', + ] ); +} + +/** + * Render callback for the personalization variant block. + * + * Because this block only saves on the JS side, + * the content string represents only the wrapped inner block markup. + * + * @param array $attributes The block's attributes object. + * @param string $inner_content The block's saved content. + * @return string The final rendered block markup, as an HTML string. + */ +function render_block( array $attributes, ?string $inner_content ) : string { + return sprintf( '
%s
', $inner_content ); +} + +/** + * Extract inner blocks from attributes. + * + * @param array $block The block configuration. + * @return array + */ +function ssr_inner_blocks_shim( array $block ) : array { + if ( $block['blockName'] !== 'altis/shim' ) { + return $block; + } + + // Populate inner blocks by parsing content. + $block['innerBlocks'] = parse_blocks( $block['attrs']['content'] ?? [] ); + + // Populate inner content with an array of null placeholders so inner blocks are processed. + $block['innerContent'] = array_fill( 0, count( $block['innerBlocks'] ), null ); + + return $block; +} diff --git a/inc/namespace.php b/inc/namespace.php index 34bbeb94..0395f328 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -146,7 +146,7 @@ function get_client_side_data() : array { if ( is_search() ) { $data['Attributes']['archiveType'] = 'search'; - $data['Attributes']['search'] = get_search_query(); + $data['Attributes']['search'] = mb_strtolower( get_search_query() ); } if ( is_post_type_archive() ) { @@ -268,6 +268,13 @@ function enqueue_scripts() { */ $consent_cookie_prefix = apply_filters( 'wp_consent_cookie_prefix', 'wp_consent' ); + /** + * Filters whether to exclude bot traffic or not. + * + * @param string $exclude_bots If set to true allows bots that execute JavaScript to be tracked. + */ + $exclude_bots = (bool) apply_filters( 'altis.analytics.exclude_bots', true ); + // Use polyfills.io to fix IE compat issues, only polyfilling features where not supported. wp_enqueue_script( 'altis-analytics-polyfill.io', @@ -311,6 +318,7 @@ function enqueue_scripts() { 'CognitoId' => defined( 'ALTIS_ANALYTICS_COGNITO_ID' ) ? ALTIS_ANALYTICS_COGNITO_ID : null, 'CognitoRegion' => defined( 'ALTIS_ANALYTICS_COGNITO_REGION' ) ? ALTIS_ANALYTICS_COGNITO_REGION : null, 'CognitoEndpoint' => defined( 'ALTIS_ANALYTICS_COGNITO_ENDPOINT' ) ? ALTIS_ANALYTICS_COGNITO_ENDPOINT : null, + 'ExcludeBots' => $exclude_bots, ], 'Noop' => $noop, 'Data' => (object) get_client_side_data(), diff --git a/inc/utils/namespace.php b/inc/utils/namespace.php index 113d0584..bcc45041 100644 --- a/inc/utils/namespace.php +++ b/inc/utils/namespace.php @@ -607,3 +607,267 @@ function sort_by( array $list, string $orderby, string $order = 'desc' ) : array return $list; } + +/** + * Return a list of country names indexed by their respective code, according to ISO 3166. + * + * @return array Array of country names indexed by their respective code. + */ +function get_countries() : array { + return [ + // 'A1' => 'Anonymous Proxy', + // 'A2' => 'Satellite Provider', + // 'O1' => 'Other Country', + 'AF' => 'Afghanistan', + 'AX' => 'Aland Islands', + 'AL' => 'Albania', + 'DZ' => 'Algeria', + 'AS' => 'American Samoa', + 'AD' => 'Andorra', + 'AO' => 'Angola', + 'AI' => 'Anguilla', + 'AQ' => 'Antarctica', + 'AG' => 'Antigua and Barbuda', + 'AR' => 'Argentina', + 'AM' => 'Armenia', + 'AW' => 'Aruba', + 'AP' => 'Asia/Pacific Region', + 'AU' => 'Australia', + 'AT' => 'Austria', + 'AZ' => 'Azerbaijan', + 'BS' => 'Bahamas', + 'BH' => 'Bahrain', + 'BD' => 'Bangladesh', + 'BB' => 'Barbados', + 'BY' => 'Belarus', + 'BE' => 'Belgium', + 'BZ' => 'Belize', + 'BJ' => 'Benin', + 'BM' => 'Bermuda', + 'BT' => 'Bhutan', + 'BO' => 'Bolivia', + 'BQ' => 'Bonaire, Saint Eustatius and Saba', + 'BA' => 'Bosnia and Herzegovina', + 'BW' => 'Botswana', + 'BV' => 'Bouvet Island', + 'BR' => 'Brazil', + 'IO' => 'British Indian Ocean Territory', + 'BN' => 'Brunei Darussalam', + 'BG' => 'Bulgaria', + 'BF' => 'Burkina Faso', + 'BI' => 'Burundi', + 'KH' => 'Cambodia', + 'CM' => 'Cameroon', + 'CA' => 'Canada', + 'CV' => 'Cape Verde', + 'KY' => 'Cayman Islands', + 'CF' => 'Central African Republic', + 'TD' => 'Chad', + 'CL' => 'Chile', + 'CN' => 'China', + 'CX' => 'Christmas Island', + 'CC' => 'Cocos (Keeling) Islands', + 'CO' => 'Colombia', + 'KM' => 'Comoros', + 'CD' => 'Congo, The Democratic Republic of the', + 'CG' => 'Congo', + 'CK' => 'Cook Islands', + 'CR' => 'Costa Rica', + 'CI' => 'Cote d\'Ivoire', + 'HR' => 'Croatia', + 'CU' => 'Cuba', + 'CW' => 'Curacao', + 'CY' => 'Cyprus', + 'CZ' => 'Czech Republic', + 'DK' => 'Denmark', + 'DJ' => 'Djibouti', + 'DM' => 'Dominica', + 'DO' => 'Dominican Republic', + 'EC' => 'Ecuador', + 'EG' => 'Egypt', + 'SV' => 'El Salvador', + 'GQ' => 'Equatorial Guinea', + 'ER' => 'Eritrea', + 'EE' => 'Estonia', + 'ET' => 'Ethiopia', + 'EU' => 'Europe', + 'FK' => 'Falkland Islands (Malvinas)', + 'FO' => 'Faroe Islands', + 'FJ' => 'Fiji', + 'FI' => 'Finland', + 'FR' => 'France', + 'GF' => 'French Guiana', + 'PF' => 'French Polynesia', + 'TF' => 'French Southern Territories', + 'GA' => 'Gabon', + 'GM' => 'Gambia', + 'GE' => 'Georgia', + 'DE' => 'Germany', + 'GH' => 'Ghana', + 'GI' => 'Gibraltar', + 'GR' => 'Greece', + 'GL' => 'Greenland', + 'GD' => 'Grenada', + 'GP' => 'Guadeloupe', + 'GU' => 'Guam', + 'GT' => 'Guatemala', + 'GG' => 'Guernsey', + 'GW' => 'Guinea-Bissau', + 'GN' => 'Guinea', + 'GY' => 'Guyana', + 'HT' => 'Haiti', + 'HM' => 'Heard Island and McDonald Islands', + 'VA' => 'Holy See (Vatican City State)', + 'HN' => 'Honduras', + 'HK' => 'Hong Kong', + 'HU' => 'Hungary', + 'IS' => 'Iceland', + 'IN' => 'India', + 'ID' => 'Indonesia', + 'IR' => 'Iran, Islamic Republic of', + 'IQ' => 'Iraq', + 'IE' => 'Ireland', + 'IM' => 'Isle of Man', + 'IL' => 'Israel', + 'IT' => 'Italy', + 'JM' => 'Jamaica', + 'JP' => 'Japan', + 'JE' => 'Jersey', + 'JO' => 'Jordan', + 'KZ' => 'Kazakhstan', + 'KE' => 'Kenya', + 'KI' => 'Kiribati', + 'KP' => 'Korea, Democratic People\'s Republic of', + 'KR' => 'Korea, Republic of', + 'KW' => 'Kuwait', + 'KG' => 'Kyrgyzstan', + 'LA' => 'Lao People\'s Democratic Republic', + 'LV' => 'Latvia', + 'LB' => 'Lebanon', + 'LS' => 'Lesotho', + 'LR' => 'Liberia', + 'LY' => 'Libyan Arab Jamahiriya', + 'LI' => 'Liechtenstein', + 'LT' => 'Lithuania', + 'LU' => 'Luxembourg', + 'MO' => 'Macao', + 'MK' => 'Macedonia', + 'MG' => 'Madagascar', + 'MW' => 'Malawi', + 'MY' => 'Malaysia', + 'MV' => 'Maldives', + 'ML' => 'Mali', + 'MT' => 'Malta', + 'MH' => 'Marshall Islands', + 'MQ' => 'Martinique', + 'MR' => 'Mauritania', + 'MU' => 'Mauritius', + 'YT' => 'Mayotte', + 'MX' => 'Mexico', + 'FM' => 'Micronesia, Federated States of', + 'MD' => 'Moldova, Republic of', + 'MC' => 'Monaco', + 'MN' => 'Mongolia', + 'ME' => 'Montenegro', + 'MS' => 'Montserrat', + 'MA' => 'Morocco', + 'MZ' => 'Mozambique', + 'MM' => 'Myanmar', + 'NA' => 'Namibia', + 'NR' => 'Nauru', + 'NP' => 'Nepal', + 'NL' => 'Netherlands', + 'NC' => 'New Caledonia', + 'NZ' => 'New Zealand', + 'NI' => 'Nicaragua', + 'NE' => 'Niger', + 'NG' => 'Nigeria', + 'NU' => 'Niue', + 'NF' => 'Norfolk Island', + 'MP' => 'Northern Mariana Islands', + 'NO' => 'Norway', + 'OM' => 'Oman', + 'PK' => 'Pakistan', + 'PW' => 'Palau', + 'PS' => 'Palestinian Territory', + 'PA' => 'Panama', + 'PG' => 'Papua New Guinea', + 'PY' => 'Paraguay', + 'PE' => 'Peru', + 'PH' => 'Philippines', + 'PN' => 'Pitcairn', + 'PL' => 'Poland', + 'PT' => 'Portugal', + 'PR' => 'Puerto Rico', + 'QA' => 'Qatar', + 'RE' => 'Reunion', + 'RO' => 'Romania', + 'RU' => 'Russian Federation', + 'RW' => 'Rwanda', + 'BL' => 'Saint Barthelemy', + 'SH' => 'Saint Helena', + 'KN' => 'Saint Kitts and Nevis', + 'LC' => 'Saint Lucia', + 'MF' => 'Saint Martin', + 'PM' => 'Saint Pierre and Miquelon', + 'VC' => 'Saint Vincent and the Grenadines', + 'WS' => 'Samoa', + 'SM' => 'San Marino', + 'ST' => 'Sao Tome and Principe', + 'SA' => 'Saudi Arabia', + 'SN' => 'Senegal', + 'RS' => 'Serbia', + 'SC' => 'Seychelles', + 'SL' => 'Sierra Leone', + 'SG' => 'Singapore', + 'SX' => 'Sint Maarten', + 'SK' => 'Slovakia', + 'SI' => 'Slovenia', + 'SB' => 'Solomon Islands', + 'SO' => 'Somalia', + 'ZA' => 'South Africa', + 'GS' => 'South Georgia and the South Sandwich Islands', + 'SS' => 'South Sudan', + 'ES' => 'Spain', + 'LK' => 'Sri Lanka', + 'SD' => 'Sudan', + 'SR' => 'Suriname', + 'SJ' => 'Svalbard and Jan Mayen', + 'SZ' => 'Swaziland', + 'SE' => 'Sweden', + 'CH' => 'Switzerland', + 'SY' => 'Syrian Arab Republic', + 'TW' => 'Taiwan', + 'TJ' => 'Tajikistan', + 'TZ' => 'Tanzania, United Republic of', + 'TH' => 'Thailand', + 'TL' => 'Timor-Leste', + 'TG' => 'Togo', + 'TK' => 'Tokelau', + 'TO' => 'Tonga', + 'TT' => 'Trinidad and Tobago', + 'TN' => 'Tunisia', + 'TR' => 'Turkey', + 'TM' => 'Turkmenistan', + 'TC' => 'Turks and Caicos Islands', + 'TV' => 'Tuvalu', + 'UG' => 'Uganda', + 'UA' => 'Ukraine', + 'AE' => 'United Arab Emirates', + 'GB' => 'United Kingdom', + 'UM' => 'United States Minor Outlying Islands', + 'US' => 'United States', + 'UY' => 'Uruguay', + 'UZ' => 'Uzbekistan', + 'VU' => 'Vanuatu', + 'VE' => 'Venezuela', + 'VN' => 'Vietnam', + 'VG' => 'Virgin Islands, British', + 'VI' => 'Virgin Islands, U.S.', + 'WF' => 'Wallis and Futuna', + 'EH' => 'Western Sahara', + 'YE' => 'Yemen', + 'ZM' => 'Zambia', + 'ZW' => 'Zimbabwe', + ]; +} diff --git a/package-lock.json b/package-lock.json index 57ffec36..8ba3a306 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7538,9 +7538,9 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "ua-parser-js": { - "version": "0.7.24", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.24.tgz", - "integrity": "sha512-yo+miGzQx5gakzVK3QFfN0/L9uVhosXBBO7qmnk7c2iw1IhL212wfA3zbnI54B0obGwC/5NWub/iT9sReMx+Fw==" + "version": "0.7.21", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz", + "integrity": "sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ==" }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", diff --git a/plugin.php b/plugin.php index 7bc35d05..23699cef 100644 --- a/plugin.php +++ b/plugin.php @@ -2,7 +2,7 @@ /** * Plugin Name: Altis Analytics * Description: Analytics layer for Altis powered by AWS Pinpoint. - * Version: 4.0.9 + * Version: 4.3.2 * Author: Human Made Limited * Author URI: https://humanmade.com/ * diff --git a/src/analytics.js b/src/analytics.js index 8f635af1..225d43e0 100644 --- a/src/analytics.js +++ b/src/analytics.js @@ -8,6 +8,7 @@ import merge from 'deepmerge'; import UAParser from 'ua-parser-js'; import { + detectRobot, getLanguage, overwriteMerge, prepareAttributes, @@ -36,6 +37,9 @@ if ( ! Config.PinpointId || ! Config.CognitoId ) { /* eslint-enable quotes */ } +// Detect bot traffic. +const isBot = detectRobot( navigator.userAgent || '' ); + /** * Get consent types. * @@ -124,7 +128,7 @@ const getAttributes = ( extra = {} ) => ( { pageSession: pageSession, url: window.location.origin + window.location.pathname, host: window.location.hostname, - search: window.location.search, + queryString: window.location.search, hash: window.location.hash, referer: document.referrer, ...qvParams, @@ -245,9 +249,14 @@ const Analytics = { /** * Gets the AWS SDK client object. * - * @returns {Promise|PinpointClient} Returns a promise for the client or the client itself. + * @returns {Promise|PinpointClient|null} Returns a promise for the client or the client itself. */ getClient: async () => { + // Bail early if we shouldn't set anything up. + if ( isBot && Config.ExcludeBots ) { + return null; + } + if ( Analytics.client ) { return await Analytics.client; } @@ -673,6 +682,11 @@ const Analytics = { metrics: await prepareMetrics( metrics ), }; + // Track if request is coming from a bot. + if ( isBot ) { + preparedData.attributes.isBot = 'true'; + } + const EventId = uuid(); const Event = { [ EventId ]: { @@ -742,6 +756,12 @@ const Analytics = { // Get the client. const client = await Analytics.getClient(); + if ( ! client ) { + if ( ! isBot ) { + console.error( 'Could not create Analytics Client.' ); + } + return; + } // Events are associated with an endpoint. const UserId = Analytics.getUserId(); diff --git a/src/audiences/ui/components/rule.js b/src/audiences/ui/components/rule.js index cd964ff9..78a38a76 100644 --- a/src/audiences/ui/components/rule.js +++ b/src/audiences/ui/components/rule.js @@ -64,14 +64,24 @@ const RuleInput = props => { } = props; // Get the currently available values for the field. - const data = ( currentField.data && currentField.data.map( datum => datum.value ) ) || []; + const options = ( currentField.data && currentField.data.map( option => ( { + value: option.value, + label: ( option.label ? `${ option.label } (${ option.value })` : option.value ) + String( option.percent ? ` ~${ option.percent }%` : '' ), + count: Number( option?.count ) || 0, + percent: Number( option?.percent ) || 0, + } ) ) ) || []; + // Sort options by their size/hits. + const topHits = options.filter( option => option.percent ).slice( 0, 10 ); + topHits.sort( ( a, b ) => b.percent - a.percent ); + // Check if the filter doesn't allow free text. + const allowFreeText = ! currentField?.options?.disable_free_text; // Get input refs to manage focus. const inputEl = useRef( null ); const dropdownRef = useRef( null ); // Default to display of the dropdown if the value is in existing data or empty. - const defaultDropdownState = value === '' || data.indexOf( value ) >= 0; + const defaultDropdownState = value === '' || !! options.find( option => option.value === value ); const [ showDropdown, setShowDropdown ] = useState( defaultDropdownState ); useEffect( () => { if ( showDropdown ) { @@ -163,15 +173,29 @@ const RuleInput = props => { } } > - { data.map( datum => datum !== '' && ( + { topHits.length > 0 && ( + + { topHits.map( option => option.value !== '' && ( + + ) ) } + + ) } + { options.map( option => option.value !== '' && ( ) ) } - + { allowFreeText && ( + + ) } ) } diff --git a/src/utils/index.js b/src/utils/index.js index 7eb9f7d7..0dfb959e 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -192,3 +192,26 @@ export const getLift = ( current, previous ) => { export const formatNumber = number => { return new Intl.NumberFormat().format( number ); }; + +/** + * Detect if the current request is likely to be a bot. + * + * @param {string} userAgent Current user agent string. + * @returns {boolean} True if UA is likely to be from a bot. + */ +export const detectRobot = userAgent => { + const robots = new RegExp( [ + /bot/, /spider/, /crawl/, // GENERAL TERMS + /APIs-Google/, /AdsBot/, /Googlebot/, // GOOGLE ROBOTS + /mediapartners/, /Google Favicon/, + /FeedFetcher/, /Google-Read-Aloud/, + /DuplexWeb-Google/, /googleweblight/, + /bing/, /yandex/, /baidu/, /duckduck/, /yahoo/, // OTHER ENGINES + /ecosia/, /ia_archiver/, + /facebook/, /instagram/, /pinterest/, /reddit/, // SOCIAL MEDIA + /slack/, /twitter/, /whatsapp/, /youtube/, + /semrush/, // OTHER + ].map( r => r.source ).join( '|' ), 'i' ); // BUILD REGEXP + "i" FLAG + + return robots.test( userAgent ); +};