Version Description
- Bug Fix: Error with the classic editor in Firefox
- Bug Fix: Duplicate scheduled events queuing up
- Bug Fix: jQuery Migrate warnings
- Bug Fix: The inline link editor jumping around the page on WP 5.6
- Bug Fix: Review notice still showing after leaving review or dismissing
Download this release
Release Info
Developer | caseproof |
Plugin | ThirstyAffiliates Affiliate Link Manager |
Version | 3.10.1 |
Comparing to | |
See all releases |
Code changes from version 3.10.0 to 3.10.1
- Helpers/Plugin_Constants.php +1 -1
- Models/Marketing.php +29 -21
- Models/Migration.php +1 -0
- js/app/gutenberg_support/dist/gutenberg-support.js +1 -1
- js/app/gutenberg_support/dist/gutenberg-support.js.map +1 -1
- js/app/gutenberg_support/src/blocks/ta-image/edit.js +4 -3
- js/app/gutenberg_support/src/blocks/ta-image/index.js +3 -3
- js/app/gutenberg_support/src/blocks/ta-image/search-input.js +1 -1
- js/app/gutenberg_support/src/formats/ta-link/index.js +20 -12
- js/app/gutenberg_support/src/formats/ta-link/inline.js +29 -29
- js/app/gutenberg_support/src/formats/ta-link/url-input.js +1 -1
- js/app/ta-editor.js +3 -3
- js/lib/selectize/selectize.min.js +2 -2
- readme.txt +9 -2
- thirstyaffiliates.php +2 -2
Helpers/Plugin_Constants.php
CHANGED
@@ -27,7 +27,7 @@ class Plugin_Constants {
|
|
27 |
// Plugin configuration constants
|
28 |
const TOKEN = 'ta';
|
29 |
const INSTALLED_VERSION = 'ta_installed_version';
|
30 |
-
const VERSION = '3.10.
|
31 |
const TEXT_DOMAIN = 'thirstyaffiliates';
|
32 |
const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
|
33 |
const META_DATA_PREFIX = '_ta_';
|
27 |
// Plugin configuration constants
|
28 |
const TOKEN = 'ta';
|
29 |
const INSTALLED_VERSION = 'ta_installed_version';
|
30 |
+
const VERSION = '3.10.1';
|
31 |
const TEXT_DOMAIN = 'thirstyaffiliates';
|
32 |
const THEME_TEMPLATE_PATH = 'thirstyaffiliates';
|
33 |
const META_DATA_PREFIX = '_ta_';
|
Models/Marketing.php
CHANGED
@@ -172,19 +172,21 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
|
|
172 |
public function ajax_request_review_response() {
|
173 |
|
174 |
if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX )
|
175 |
-
$response = array( 'status' => 'fail' , 'error_msg' => __( 'Invalid AJAX call' , '
|
176 |
elseif ( !isset( $_POST[ 'review_request_response' ] ) )
|
177 |
-
$response = array( 'status' => 'fail' , 'error_msg' => __( 'Required parameter not passed' , '
|
178 |
else {
|
179 |
|
180 |
update_option( Plugin_Constants::REVIEW_REQUEST_RESPONSE , $_POST[ 'review_request_response' ] );
|
181 |
|
182 |
-
if ( $_POST[ 'review_request_response' ] === 'review-later' )
|
183 |
-
|
|
|
|
|
184 |
|
185 |
delete_option( Plugin_Constants::SHOW_REQUEST_REVIEW );
|
186 |
|
187 |
-
$response = array( 'status' => 'success' , 'success_msg' => __( 'Review request response saved' , '
|
188 |
|
189 |
}
|
190 |
|
@@ -210,29 +212,33 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
|
|
210 |
|
211 |
$review_request_response = get_option( Plugin_Constants::REVIEW_REQUEST_RESPONSE );
|
212 |
|
|
|
|
|
|
|
|
|
213 |
if ( ! is_admin() || ! current_user_can( 'manage_options' ) || $post_type !== Plugin_Constants::AFFILIATE_LINKS_CPT || get_option( Plugin_Constants::SHOW_REQUEST_REVIEW ) !== 'yes' || ( $review_request_response !== 'review-later' && ! empty( $review_request_response ) ) )
|
214 |
return;
|
215 |
|
216 |
?>
|
217 |
<div class="notice notice-info is-dismissible ta-review-notice" id="ta_review_notice">
|
218 |
<div id="ta_review_intro">
|
219 |
-
<p><?php _e( 'Are you enjoying using ThirstyAffiliates?', '
|
220 |
<p><a data-review-selection="yes" class="ta-review-selection" href="#">Yes, I love it</a> 🙂 | <a data-review-selection="no" class="ta-review-selection" href="#">Not really...</a></p>
|
221 |
</div>
|
222 |
<div id="ta_review_yes" style="display: none;">
|
223 |
-
<p><?php _e( 'That\'s awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?', '
|
224 |
<p style="font-weight: bold;">~ Blair Williams<br>CEO of ThirstyAffiliates</p>
|
225 |
<p>
|
226 |
-
<a style="display: inline-block; margin-right: 10px;" href="https://wordpress.org/support/plugin/thirstyaffiliates/reviews/?filter=5#new-post" onclick="delayReviewPrompt('remove')" target="_blank"><?php esc_html_e( 'Okay, you deserve it', '
|
227 |
-
<a style="display: inline-block; margin-right: 10px;" href="#" onclick="delayReviewPrompt('delay')"><?php esc_html_e( 'Nope, maybe later', '
|
228 |
-
<a href="#" onclick="delayReviewPrompt('remove')"><?php esc_html_e( 'I already did', '
|
229 |
</p>
|
230 |
</div>
|
231 |
<div id="ta_review_no" style="display: none;">
|
232 |
-
<p><?php _e( 'We\'re sorry to hear you aren\'t enjoying ThirstyAffiliates. We would love a chance to improve. Could you take a minute and let us know what we can do better?', '
|
233 |
<p>
|
234 |
-
<a style="display: inline-block; margin-right: 10px;" href="https://thirstyaffiliates.com/plugin-feedback/?utm_source=plugin_admin&utm_medium=link&utm_campaign=in_plugin&utm_content=request_review" onclick="delayReviewPrompt('remove')" target="_blank"><?php esc_html_e( 'Give Feedback', '
|
235 |
-
<a href="#" onclick="delayReviewPrompt('
|
236 |
</p>
|
237 |
</div>
|
238 |
</div>
|
@@ -252,7 +258,7 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
|
|
252 |
},
|
253 |
})
|
254 |
.done(function(data) {
|
255 |
-
|
256 |
});
|
257 |
}
|
258 |
|
@@ -449,12 +455,12 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
|
|
449 |
|
450 |
/**
|
451 |
* Hide Enable JS redirect setting notice when setting value is changed.
|
452 |
-
*
|
453 |
* @since 3.3.0
|
454 |
* @access public
|
455 |
-
*
|
456 |
* @param string $value Option value.
|
457 |
-
* @return string Filtered option value.
|
458 |
*/
|
459 |
public function hide_notice_on_enable_js_redirect_setting_change( $value ) {
|
460 |
|
@@ -545,10 +551,10 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
|
|
545 |
}
|
546 |
}
|
547 |
}
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
/*
|
553 |
|--------------------------------------------------------------------------
|
554 |
| Fulfill Implemented Interface Contracts
|
@@ -564,6 +570,8 @@ class Marketing implements Model_Interface , Activatable_Interface , Initiable_I
|
|
564 |
*/
|
565 |
public function activate() {
|
566 |
|
|
|
|
|
567 |
wp_schedule_single_event( time() + 1209600 , Plugin_Constants::CRON_REQUEST_REVIEW );
|
568 |
wp_schedule_single_event( time() + 172800 , Plugin_Constants::CRON_TAPRO_NOTICE );
|
569 |
|
172 |
public function ajax_request_review_response() {
|
173 |
|
174 |
if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX )
|
175 |
+
$response = array( 'status' => 'fail' , 'error_msg' => __( 'Invalid AJAX call' , 'thirstyaffiliates' ) );
|
176 |
elseif ( !isset( $_POST[ 'review_request_response' ] ) )
|
177 |
+
$response = array( 'status' => 'fail' , 'error_msg' => __( 'Required parameter not passed' , 'thirstyaffiliates' ) );
|
178 |
else {
|
179 |
|
180 |
update_option( Plugin_Constants::REVIEW_REQUEST_RESPONSE , $_POST[ 'review_request_response' ] );
|
181 |
|
182 |
+
if ( $_POST[ 'review_request_response' ] === 'review-later' ) {
|
183 |
+
wp_clear_scheduled_hook( Plugin_Constants::CRON_REQUEST_REVIEW );
|
184 |
+
wp_schedule_single_event( time() + 1209600, Plugin_Constants::CRON_REQUEST_REVIEW );
|
185 |
+
}
|
186 |
|
187 |
delete_option( Plugin_Constants::SHOW_REQUEST_REVIEW );
|
188 |
|
189 |
+
$response = array( 'status' => 'success' , 'success_msg' => __( 'Review request response saved' , 'thirstyaffiliates' ) );
|
190 |
|
191 |
}
|
192 |
|
212 |
|
213 |
$review_request_response = get_option( Plugin_Constants::REVIEW_REQUEST_RESPONSE );
|
214 |
|
215 |
+
if ( get_option( 'ta_review_prompt_removed' ) ) {
|
216 |
+
return;
|
217 |
+
}
|
218 |
+
|
219 |
if ( ! is_admin() || ! current_user_can( 'manage_options' ) || $post_type !== Plugin_Constants::AFFILIATE_LINKS_CPT || get_option( Plugin_Constants::SHOW_REQUEST_REVIEW ) !== 'yes' || ( $review_request_response !== 'review-later' && ! empty( $review_request_response ) ) )
|
220 |
return;
|
221 |
|
222 |
?>
|
223 |
<div class="notice notice-info is-dismissible ta-review-notice" id="ta_review_notice">
|
224 |
<div id="ta_review_intro">
|
225 |
+
<p><?php _e( 'Are you enjoying using ThirstyAffiliates?', 'thirstyaffiliates' ); ?></p>
|
226 |
<p><a data-review-selection="yes" class="ta-review-selection" href="#">Yes, I love it</a> 🙂 | <a data-review-selection="no" class="ta-review-selection" href="#">Not really...</a></p>
|
227 |
</div>
|
228 |
<div id="ta_review_yes" style="display: none;">
|
229 |
+
<p><?php _e( 'That\'s awesome! Could you please do me a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?', 'thirstyaffiliates' ); ?></p>
|
230 |
<p style="font-weight: bold;">~ Blair Williams<br>CEO of ThirstyAffiliates</p>
|
231 |
<p>
|
232 |
+
<a style="display: inline-block; margin-right: 10px;" href="https://wordpress.org/support/plugin/thirstyaffiliates/reviews/?filter=5#new-post" onclick="delayReviewPrompt('remove')" target="_blank"><?php esc_html_e( 'Okay, you deserve it', 'thirstyaffiliates' ); ?></a>
|
233 |
+
<a style="display: inline-block; margin-right: 10px;" href="#" onclick="delayReviewPrompt('delay')"><?php esc_html_e( 'Nope, maybe later', 'thirstyaffiliates' ); ?></a>
|
234 |
+
<a href="#" onclick="delayReviewPrompt('remove')"><?php esc_html_e( 'I already did', 'thirstyaffiliates' ); ?></a>
|
235 |
</p>
|
236 |
</div>
|
237 |
<div id="ta_review_no" style="display: none;">
|
238 |
+
<p><?php _e( 'We\'re sorry to hear you aren\'t enjoying ThirstyAffiliates. We would love a chance to improve. Could you take a minute and let us know what we can do better?', 'thirstyaffiliates' ); ?></p>
|
239 |
<p>
|
240 |
+
<a style="display: inline-block; margin-right: 10px;" href="https://thirstyaffiliates.com/plugin-feedback/?utm_source=plugin_admin&utm_medium=link&utm_campaign=in_plugin&utm_content=request_review" onclick="delayReviewPrompt('remove')" target="_blank"><?php esc_html_e( 'Give Feedback', 'thirstyaffiliates' ); ?></a>
|
241 |
+
<a href="#" onclick="delayReviewPrompt('remove')"><?php esc_html_e( 'No thanks', 'thirstyaffiliates' ); ?></a>
|
242 |
</p>
|
243 |
</div>
|
244 |
</div>
|
258 |
},
|
259 |
})
|
260 |
.done(function(data) {
|
261 |
+
|
262 |
});
|
263 |
}
|
264 |
|
455 |
|
456 |
/**
|
457 |
* Hide Enable JS redirect setting notice when setting value is changed.
|
458 |
+
*
|
459 |
* @since 3.3.0
|
460 |
* @access public
|
461 |
+
*
|
462 |
* @param string $value Option value.
|
463 |
+
* @return string Filtered option value.
|
464 |
*/
|
465 |
public function hide_notice_on_enable_js_redirect_setting_change( $value ) {
|
466 |
|
551 |
}
|
552 |
}
|
553 |
}
|
554 |
+
|
555 |
+
|
556 |
+
|
557 |
+
|
558 |
/*
|
559 |
|--------------------------------------------------------------------------
|
560 |
| Fulfill Implemented Interface Contracts
|
570 |
*/
|
571 |
public function activate() {
|
572 |
|
573 |
+
wp_clear_scheduled_hook( Plugin_Constants::CRON_REQUEST_REVIEW );
|
574 |
+
wp_clear_scheduled_hook( Plugin_Constants::CRON_TAPRO_NOTICE );
|
575 |
wp_schedule_single_event( time() + 1209600 , Plugin_Constants::CRON_REQUEST_REVIEW );
|
576 |
wp_schedule_single_event( time() + 172800 , Plugin_Constants::CRON_TAPRO_NOTICE );
|
577 |
|
Models/Migration.php
CHANGED
@@ -843,6 +843,7 @@ class Migration implements Model_Interface , Activatable_Interface , Initiable_I
|
|
843 |
public function activate() {
|
844 |
|
845 |
// Execute one time cron on plugin activation to migrate old data to new data
|
|
|
846 |
wp_schedule_single_event( time() + 5 , Plugin_Constants::CRON_MIGRATE_OLD_PLUGIN_DATA ); // Delay the migration for 5 sec to be sure everything is set up
|
847 |
|
848 |
}
|
843 |
public function activate() {
|
844 |
|
845 |
// Execute one time cron on plugin activation to migrate old data to new data
|
846 |
+
wp_clear_scheduled_hook( Plugin_Constants::CRON_MIGRATE_OLD_PLUGIN_DATA );
|
847 |
wp_schedule_single_event( time() + 5 , Plugin_Constants::CRON_MIGRATE_OLD_PLUGIN_DATA ); // Delay the migration for 5 sec to be sure everything is set up
|
848 |
|
849 |
}
|
js/app/gutenberg_support/dist/gutenberg-support.js
CHANGED
@@ -3,5 +3,5 @@
|
|
3 |
Licensed under the MIT License (MIT), see
|
4 |
http://jedwatson.github.io/classnames
|
5 |
*/
|
6 |
-
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var i=arguments[t];if(i){var o=typeof i;if("string"===o||"number"===o)e.push(i);else if(Array.isArray(i)&&i.length){var a=n.apply(null,i);a&&e.push(a)}else if("object"===o)for(var l in i)r.call(i,l)&&i[l]&&e.push(l)}}return e.join(" ")}var r={}.hasOwnProperty;void 0!==e&&e.exports?(n.default=n,e.exports=n):(i=[],void 0!==(o=function(){return n}.apply(t,i))&&(e.exports=o))}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(8),r=n(17);n.n(r);Object(i.a)(),Object(o.a)()},function(e,t,n){"use strict";function i(){[o].forEach(function(e){if(e){var t=e.name,n=e.settings;r(t,n)}})}t.a=i;var o=n(3),r=wp.blocks.registerBlockType},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"name",function(){return g}),n.d(t,"settings",function(){return w});var o=n(0),r=n.n(o),a=n(4),l=wp.element.Fragment,s=wp.i18n.__,u=wp.blocks,c=(u.createBlock,u.getBlockAttributes,u.getPhrasingContentSchema),p=wp.editor.RichText,d=wp.components,f=d.Path,h=d.SVG,g="ta/image",m={url:{type:"string",source:"attribute",selector:"img",attribute:"src"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},caption:{type:"string",source:"html",selector:"figcaption"},id:{type:"number"},align:{type:"string"},width:{type:"number"},height:{type:"number"},linkid:{type:"number"},href:{type:"string",source:"attribute",selector:"ta",attribute:"href"},affiliateLink:{type:"object"}},v={img:{attributes:["src","alt"],classes:["alignleft","aligncenter","alignright","alignnone",/^wp-image-\d+$/]}},w=(c(),{title:s("ThirstyAffiliates Image"),description:s("Insert an image with an affiliate link to make a visual statement."),icon:wp.element.createElement(h,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement(f,{d:"M0,0h24v24H0V0z",fill:"none"}),wp.element.createElement(f,{d:"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z"}),wp.element.createElement(f,{d:"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z"})),category:"common",keywords:["img",s("photo"),s("affiliate")],attributes:m,getEditWrapperProps:function(e){var t=e.align,n=e.width;if("left"===t||"center"===t||"right"===t||"wide"===t||"full"===t)return{"data-align":t,"data-resized":!!n}},edit:a.a,save:function(e){var t,n=e.attributes,o=n.url,a=n.alt,s=n.caption,u=n.align,c=n.width,d=n.height,f=n.id,h=n.linkid,g=n.href,m=r()((t={},i(t,"align"+u,u),i(t,"is-resized",c||d),t)),v=wp.element.createElement("img",{src:o,alt:a,className:f?"wp-image-"+f:null,width:c,height:d}),w=wp.element.createElement(l,null,wp.element.createElement("ta",{linkid:h,href:g},v),wp.element.createElement(p.Content,{tagName:"figcaption",value:s}));return"left"===u||"right"===u||"center"===u?wp.element.createElement("div",{className:"wp-block-image"},wp.element.createElement("figure",{className:m},w)):wp.element.createElement("figure",{className:"wp-block-image "+m},w)}})},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=n(5),u=n(6),c=n(7),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},d=function(){function e(e,t){var n=[],i=!0,o=!1,r=void 0;try{for(var a,l=e[Symbol.iterator]();!(i=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{!i&&l.return&&l.return()}finally{if(o)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),h=lodash,g=h.get,m=h.isEmpty,v=h.map,w=h.last,b=h.pick,y=h.compact,k=wp.url.getPath,S=wp.i18n,E=S.__,_=S.sprintf,L=wp.element,O=L.Component,C=L.Fragment,I=L.createRef,T=wp.blob,R=T.getBlobByURL,P=T.revokeBlobURL,A=T.isBlobURL,x=wp.components,j=x.Placeholder,N=x.Button,F=x.ButtonGroup,W=x.IconButton,D=x.PanelBody,V=x.ResizableBox,z=x.SelectControl,B=x.Spinner,H=x.TextControl,U=x.TextareaControl,M=x.Toolbar,K=x.withNotices,q=(x.ToggleControl,x.Popover,wp.data.withSelect),G=wp.editor,Q=G.RichText,Z=G.BlockControls,$=G.InspectorControls,X=(G.MediaUpload,G.MediaUploadCheck,G.MediaPlaceholder,G.BlockAlignmentToolbar),Y=G.mediaUpload,J=wp.viewport.withViewportMatch,ee=wp.compose.compose,te=["image"],ne=function(e){var t=b(e,["alt","id","link","caption"]);return t.url=g(e,["sizes","large","url"])||g(e,["media_details","sizes","large","source_url"])||e.url,t},ie=function(e,t){return!e&&A(t)},oe=function(e,t){return t&&!e&&!A(t)},re=function(e){function t(e){var n=e.attributes;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.updateAlt=r.updateAlt.bind(r),r.updateAlignment=r.updateAlignment.bind(r),r.onFocusCaption=r.onFocusCaption.bind(r),r.onImageClick=r.onImageClick.bind(r),r.onSelectImage=r.onSelectImage.bind(r),r.updateImageURL=r.updateImageURL.bind(r),r.updateWidth=r.updateWidth.bind(r),r.updateHeight=r.updateHeight.bind(r),r.updateDimensions=r.updateDimensions.bind(r),r.getFilename=r.getFilename.bind(r),r.toggleIsEditing=r.toggleIsEditing.bind(r),r.onImageError=r.onImageError.bind(r),r.onChangeInputValue=r.onChangeInputValue.bind(r),r.autocompleteRef=I(),r.resetInvalidLink=r.resetInvalidLink.bind(r),r.updateImageSelection=r.updateImageSelection.bind(r),r.onSelectAffiliateImage=r.onSelectAffiliateImage.bind(r),r.editAFfiliateImage=r.editAFfiliateImage.bind(r),r.state={captionFocused:!1,isEditing:!n.url,inputValue:"",linkid:0,post:null,showSuggestions:!1,imageSelection:[],affiliateLink:null},r}return r(t,e),f(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.attributes,i=t.setAttributes,o=t.noticeOperations,r=n.id,a=n.url,l=void 0===a?"":a;if(ie(r,l)){var s=R(l);s&&Y({filesList:[s],onFileChange:function(e){var t=d(e,1),n=t[0];i(ne(n))},allowedTypes:te,onError:function(t){o.createErrorNotice(t),e.setState({isEditing:!0})}})}}},{key:"componentDidUpdate",value:function(e){var t=e.attributes,n=t.id,i=t.url,o=void 0===i?"":i,r=this.props.attributes,a=r.id,l=r.url,s=void 0===l?"":l;ie(n,o)&&!ie(a,s)&&P(s),!this.props.isSelected&&e.isSelected&&this.state.captionFocused&&this.setState({captionFocused:!1})}},{key:"onSelectImage",value:function(e){if(!e||!e.url)return void this.props.setAttributes({url:void 0,alt:void 0,id:void 0,caption:void 0});var t=this.state.affiliateLink;this.setState({isEditing:!1}),this.props.setAttributes(p({},ne(e),{linkid:t.id,href:t.link,affiliateLink:t,width:void 0,height:void 0}))}},{key:"onImageError",value:function(e){var t=Object(s.a)({attributes:{url:e}});void 0!==t&&this.props.onReplace(t)}},{key:"onFocusCaption",value:function(){this.state.captionFocused||this.setState({captionFocused:!0})}},{key:"onImageClick",value:function(){this.state.captionFocused&&this.setState({captionFocused:!1})}},{key:"updateAlt",value:function(e){this.props.setAttributes({alt:e})}},{key:"updateAlignment",value:function(e){var t=-1!==["wide","full"].indexOf(e)?{width:void 0,height:void 0}:{};this.props.setAttributes(p({},t,{align:e}))}},{key:"updateImageURL",value:function(e){this.props.setAttributes({url:e,width:void 0,height:void 0})}},{key:"updateWidth",value:function(e){this.props.setAttributes({width:parseInt(e,10)})}},{key:"updateHeight",value:function(e){this.props.setAttributes({height:parseInt(e,10)})}},{key:"updateDimensions",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return function(){e.props.setAttributes({width:t,height:n})}}},{key:"getFilename",value:function(e){var t=k(e);if(t)return w(t.split("/"))}},{key:"getLinkDestinationOptions",value:function(){return[{value:"none",label:E("None")},{value:"media",label:E("Media File")},{value:"attachment",label:E("Attachment Page")},{value:"custom",label:E("Custom URL")}]}},{key:"toggleIsEditing",value:function(){this.setState({isEditing:!this.state.isEditing})}},{key:"getImageSizeOptions",value:function(){var e=this.props,t=e.imageSizes,n=e.image;return y(v(t,function(e){var t=e.name,i=e.slug,o=g(n,["media_details","sizes",i,"source_url"]);return o?{value:o,label:t}:null}))}},{key:"onChangeInputValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t?t.id:0;this.setState({inputValue:e,linkid:n,post:t})}},{key:"resetInvalidLink",value:function(){this.setState({invalidLink:!1})}},{key:"updateImageSelection",value:function(e,t){this.setState({imageSelection:e,affiliateLink:t})}},{key:"onSelectAffiliateImage",value:function(e){var t=this;if(oe(e.id,e.src))e.url=e.src,this.onSelectImage(e);else{wp.apiFetch({path:wp.url.addQueryArgs("/wp/v2/media/"+e.id,{context:"edit",_locale:"user"})}).then(function(e){e.url=e.source_url,t.onSelectImage(e)})}}},{key:"editAFfiliateImage",value:function(){var e=this.props.attributes,t=e.affiliateLink;this.setState({isEditing:!0,imageSelection:t.images,affiliateLink:t})}},{key:"render",value:function(){var e=this,t=this.state,n=t.isEditing,i=t.imageSelection,o=t.affiliateLink,r=this.props,a=r.attributes,s=r.setAttributes,p=r.isLargeViewport,d=r.isSelected,f=r.className,h=r.maxWidth,g=r.toggleSelection,v=r.isRTL,w=a.url,b=a.alt,y=a.caption,k=a.align,S=(a.linkDestination,a.width),L=a.height,O=a.linkid,I=a.href,T=wp.element.createElement(M,null,wp.element.createElement(W,{className:"ta-edit-image-button components-icon-button components-toolbar__control",label:E("Edit ThirstyAffiliates Image"),icon:"edit",onClick:this.editAFfiliateImage})),R=wp.element.createElement(Z,null,wp.element.createElement(X,{value:k,onChange:this.updateAlignment}),T);if(n)return wp.element.createElement(C,null,R,wp.element.createElement(j,{icon:"format-image",label:E("ThirstyAffiliates Image"),instructions:E("Search for an affiliate link and select image to insert.")},wp.element.createElement(c.a,{updateImageSelection:this.updateImageSelection}),!!i.length&&wp.element.createElement("div",{className:"ta-image-sel-wrap"},wp.element.createElement("h3",null,o.title+" "+E("attached images:")),wp.element.createElement("div",{className:"ta-image-selection"},i.map(function(t,n){return wp.element.createElement("button",{onClick:function(){return e.onSelectAffiliateImage(t)}},wp.element.createElement("img",{src:t.src}))})))));var P=l()(f,{"wp-block-image":!0,"is-transient":A(w),"is-resized":!!S||!!L,"is-focused":d}),x=-1===["wide","full"].indexOf(k)&&p,K=this.getImageSizeOptions(),q=function(t,n){return wp.element.createElement($,null,wp.element.createElement(D,{title:E("Image Settings")},wp.element.createElement(U,{label:E("Alt Text (Alternative Text)"),value:b,onChange:e.updateAlt,help:E("Alternative text describes your image to people who can’t see it. Add a short description with its key details.")}),!m(K)&&wp.element.createElement(z,{label:E("Image Size"),value:w,options:K,onChange:e.updateImageURL}),x&&wp.element.createElement("div",{className:"block-library-image__dimensions"},wp.element.createElement("p",{className:"block-library-image__dimensions__row"},E("Image Dimensions")),wp.element.createElement("div",{className:"block-library-image__dimensions__row"},wp.element.createElement(H,{type:"number",className:"block-library-image__dimensions__width",label:E("Width"),value:void 0!==S?S:"",placeholder:t,min:1,onChange:e.updateWidth}),wp.element.createElement(H,{type:"number",className:"block-library-image__dimensions__height",label:E("Height"),value:void 0!==L?L:"",placeholder:n,min:1,onChange:e.updateHeight})),wp.element.createElement("div",{className:"block-library-image__dimensions__row"},wp.element.createElement(F,{"aria-label":E("Image Size")},[25,50,75,100].map(function(i){var o=Math.round(t*(i/100)),r=Math.round(n*(i/100)),a=S===o&&L===r;return wp.element.createElement(N,{key:i,isSmall:!0,isPrimary:a,"aria-pressed":a,onClick:e.updateDimensions(o,r)},i,"%")})),wp.element.createElement(N,{isSmall:!0,onClick:e.updateDimensions()},E("Reset"))))))};return wp.element.createElement(C,null,R,wp.element.createElement("figure",{className:P},wp.element.createElement(u.a,{src:w,dirtynessTrigger:k},function(t){var n=t.imageWidthWithinContainer,i=t.imageHeightWithinContainer,o=t.imageWidth,r=t.imageHeight,a=e.getFilename(w),l=void 0;l=b||(a?_(E("This image has an empty alt attribute; its file name is %s"),a):E("This image has an empty alt attribute"));var u=wp.element.createElement(C,null,wp.element.createElement("ta",{linkid:O,href:I},wp.element.createElement("img",{src:w,alt:l,onClick:e.onImageClick,onError:function(){return e.onImageError(w)}})),A(w)&&wp.element.createElement(B,null));if(!x||!n)return wp.element.createElement(C,null,q(o,r),wp.element.createElement("div",{style:{width:S,height:L}},u));var c=S||n,p=L||i,d=o/r,f=o<r?20:20*d,m=r<o?20:20/d,y=2.5*h,T=!1,R=!1;return"center"===k?(T=!0,R=!0):v?"left"===k?T=!0:R=!0:"right"===k?R=!0:T=!0,wp.element.createElement(C,null,q(o,r),wp.element.createElement(V,{size:S&&L?{width:S,height:L}:void 0,minWidth:f,maxWidth:y,minHeight:m,maxHeight:y/d,lockAspectRatio:!0,enable:{top:!1,right:T,bottom:!0,left:R},onResizeStart:function(){g(!1)},onResizeStop:function(e,t,n,i){s({width:parseInt(c+i.width,10),height:parseInt(p+i.height,10)}),g(!0)}},u))}),(!Q.isEmpty(y)||d)&&wp.element.createElement(Q,{tagName:"figcaption",placeholder:E("Write caption…"),value:y,unstableOnFocus:this.onFocusCaption,onChange:function(e){return s({caption:e})},isSelected:this.state.captionFocused,inlineToolbar:!0})))}}]),t}(O);t.a=ee([q(function(e,t){var n=e("core"),i=n.getMedia,o=e("core/editor"),r=o.getEditorSettings,a=t.attributes.id,l=r(),s=l.maxWidth,u=l.isRTL,c=l.imageSizes;return{image:a?i(a):null,maxWidth:s,isRTL:u,imageSizes:c}}),J({isLargeViewport:"medium"}),K])(re)},function(e,t,n){"use strict";n.d(t,"a",function(){return l});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=lodash,r=o.includes,a=(wp.element.renderToString,wp.blocks.createBlock),l=function(e,t){var n=e.preview,o=e.name,r=e.attributes.url;if(r){var l=findBlock(r);if("core-embed/wordpress"!==o&&DEFAULT_EMBED_BLOCK!==l&&o!==l)return a(l,{url:r});if(n){var u=n.html;if(s(u)&&"core-embed/wordpress"!==o)return a("core-embed/wordpress",i({url:r},t))}}},s=function(e){return r(e,'class="wp-embedded-content" data-secret')}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=lodash,s=l.noop,u=wp.compose.withGlobalEvents,c=wp.element.Component,p=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.state={width:void 0,height:void 0},e.bindContainer=e.bindContainer.bind(e),e.calculateSize=e.calculateSize.bind(e),e}return r(t,e),a(t,[{key:"bindContainer",value:function(e){this.container=e}},{key:"componentDidUpdate",value:function(e){this.props.src!==e.src&&(this.setState({width:void 0,height:void 0}),this.fetchImageSize()),this.props.dirtynessTrigger!==e.dirtynessTrigger&&this.calculateSize()}},{key:"componentDidMount",value:function(){this.fetchImageSize()}},{key:"componentWillUnmount",value:function(){this.image&&(this.image.onload=s)}},{key:"fetchImageSize",value:function(){this.image=new window.Image,this.image.onload=this.calculateSize,this.image.src=this.props.src}},{key:"calculateSize",value:function(){var e=this.container.clientWidth,t=this.image.width>e,n=this.image.height/this.image.width,i=t?e:this.image.width,o=t?e*n:this.image.height;this.setState({width:i,height:o})}},{key:"render",value:function(){var e={imageWidth:this.image&&this.image.width,imageHeight:this.image&&this.image.height,containerWidth:this.container&&this.container.clientWidth,containerHeight:this.container&&this.container.clientHeight,imageWidthWithinContainer:this.state.width,imageHeightWithinContainer:this.state.height};return wp.element.createElement("div",{ref:this.bindContainer},this.props.children(e))}}]),t}(c);t.a=u({resize:"calculateSize"})(p)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),u=wp.i18n.__,c=wp.element,p=c.Component,d=c.createRef,f=wp.components,h=f.Spinner,g=f.withSpokenMessages,m=f.Popover,v=f.TextControl,w=wp.compose.withInstanceId,b=function(e){function t(e){var n=e.autocompleteRef;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.autocompleteRef=n||d(),r.inputRef=d(),r.searchAffiliateLinks=r.searchAffiliateLinks.bind(r),r.suggestionNodes=[],r.state={posts:[],showSuggestions:!1,selectedSuggestion:null,loading:!1},r}return r(t,e),s(t,[{key:"componentDidUpdate",value:function(){var e=this,t=this.state,n=t.showSuggestions,i=t.selectedSuggestion;n&&null!==i&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,scrollIntoView(this.suggestionNodes[i],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),setTimeout(function(){e.scrollingIntoView=!1},100))}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest}},{key:"bindSuggestionNode",value:function(e){var t=this;return function(n){t.suggestionNodes[e]=n}}},{key:"searchAffiliateLinks",value:function(e){var t=this;if(e.length<2)return void this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});this.setState({showSuggestions:!0,selectedSuggestion:null,loading:!0});var n=new FormData;n.append("action","search_affiliate_links_query"),n.append("keyword",e),n.append("paged",1),n.append("gutenberg",!0),n.append("with_images",!0);var i=fetch(ajaxurl,{method:"POST",body:n});i.then(function(e){return e.json()}).then(function(e){if(e.affiliate_links){var n=e.affiliate_links;t.suggestionsRequest===i&&(t.setState({posts:n,loading:!1}),n.length?t.props.debouncedSpeak(sprintf(_n("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",n.length),n.length),"assertive"):t.props.debouncedSpeak(u("No results."),"assertive"))}}).catch(function(){t.suggestionsRequest===i&&t.setState({loading:!1})}),this.suggestionsRequest=i}},{key:"selectLink",value:function(e){this.setState({selectedSuggestion:e,showSuggestions:!1}),this.props.updateImageSelection(e.images,e)}},{key:"handleOnClick",value:function(e){this.selectLink(e)}},{key:"render",value:function(){var e=this,t=this.props,n=(t.value,t.autoFocus,t.instanceId),i=this.state,o=i.showSuggestions,r=i.posts,a=i.selectedSuggestion,s=i.loading;return wp.element.createElement("div",{class:"edit-search-affiliate-links"},wp.element.createElement("form",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover",onSubmit:this.displayAffiliateImages},wp.element.createElement(v,{type:"text",className:"ta-search-affiliate-links",placeholder:u("Type to search affiliate links"),onChange:this.searchAffiliateLinks,autocomplete:"off"}),s&&wp.element.createElement(h,null),o&&!!r.length&&wp.element.createElement(m,{position:"bottom",focusOnMount:!1},wp.element.createElement("div",{class:"affilate-links-suggestions"},r.map(function(t,i){return wp.element.createElement("button",{key:t.id,role:"option",tabIndex:"-1",id:"editor-url-input-suggestion-"+n+"-"+i,ref:e.bindSuggestionNode(i),className:l()("editor-url-input__suggestion block-editor-url-input__suggestion",{"is-selected":i===a}),onClick:function(){return e.handleOnClick(t)},"aria-selected":i===a},t.title||u("(no title)"))})))))}}]),t}(p);t.a=g(w(b))},function(e,t,n){"use strict";function i(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(){[r.a].forEach(function(e){var t=e.name,n=i(e,["name"]);return a(t,n)})}t.a=o;var r=n(9),a=wp.richText.registerFormatType},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}n.d(t,"a",function(){return O});var a=n(10),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=wp.i18n.__,u=wp.element,c=u.Component,p=u.Fragment,d=wp.components.withSpokenMessages,f=wp.richText,h=f.getTextContent,g=f.applyFormat,m=f.removeFormat,v=f.slice,w=wp.url.isURL,b=wp.editor,y=b.RichTextToolbarButton,k=b.RichTextShortcut,S=wp.components,E=S.Path,_=S.SVG,L=wp.dom.getRectangleFromRange,O={name:"ta/link",title:s("Affiliate Link"),tagName:"ta",className:null,attributes:{url:"href",target:"target"},edit:d(function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.addLink=e.addLink.bind(e),e.stopAddingLink=e.stopAddingLink.bind(e),e.onRemoveFormat=e.onRemoveFormat.bind(e),e.state={addingLink:!1},e}return r(t,e),l(t,[{key:"addLink",value:function(){var e=this.props,t=e.value,n=e.onChange,i=h(v(t));i&&w(i)?n(g(t,{type:"ta/link",attributes:{url:i}})):this.setState({addingLink:!0})}},{key:"stopAddingLink",value:function(){this.setState({addingLink:!1})}},{key:"onRemoveFormat",value:function(){var e=this.props,t=e.value,n=e.onChange,i=e.speak;n(m(t,"ta/link")),i(s("Affiliate Link removed."),"assertive")}},{key:"getAnchorRect",value:function(){var e=window.getSelection(),t=e.rangeCount>0?e.getRangeAt(0):null;if(t){var n=null;if(this.state.addingLink)n=L(t);else{var i=t.startContainer;for(i=i.nextElementSibling||i;i.nodeType!==window.Node.ELEMENT_NODE;)i=i.parentNode;var o=i.closest("ta");o&&(n=o.getBoundingClientRect())}return n}}},{key:"render",value:function(){var e=this.props,t=e.isActive,n=e.activeAttributes,i=e.value,o=e.onChange,r=this.getAnchorRect();return wp.element.createElement(p,null,wp.element.createElement(k,{type:"access",character:"s",onUse:this.onRemoveFormat}),wp.element.createElement(k,{type:"primary",character:"l",onUse:this.addLink}),wp.element.createElement(k,{type:"primaryShift",character:"l",onUse:this.onRemoveFormat}),t&&wp.element.createElement(y,{icon:"editor-unlink",title:s("Remove Affiliate Link"),className:"ta-unlink-button",onClick:this.onRemoveFormat,isActive:t,shortcutType:"primaryShift",shortcutCharacter:"l"}),!t&&wp.element.createElement(y,{icon:wp.element.createElement(_,{xmlns:"http://www.w3.org/2000/svg",width:"16.688",height:"9.875",viewBox:"0 0 16.688 9.875"},wp.element.createElement(E,{id:"TA.svg",fill:"black",class:"cls-1",d:"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z",transform:"translate(-1.188 -5.25)"})),title:s("Affiliate Link"),className:"ta-link-button",onClick:this.addLink,shortcutType:"primary",shortcutCharacter:"l"}),wp.element.createElement(a.a,{addingLink:this.state.addingLink,stopAddingLink:this.stopAddingLink,isActive:t,activeAttributes:n,anchorRect:r,value:i,onChange:o}))}}]),t}(c))}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){var t=e.url,n=e.linkid;e.text;return{type:"ta/link",attributes:{url:t,linkid:n.toString()}}}function l(e,t){return e.addingLink||t.editLink}var s=n(0),u=n.n(s),c=n(11),p=n(12),d=n(13),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),h=wp.i18n.__,g=wp.element,m=g.Component,v=g.createRef,w=wp.components,b=w.ExternalLink,y=(w.ToggleControl,w.IconButton),k=w.withSpokenMessages,S=wp.keycodes,E=S.LEFT,_=S.RIGHT,L=S.UP,O=S.DOWN,C=S.BACKSPACE,I=S.ENTER,T=wp.url,R=T.prependHTTP,P=T.safeDecodeURI,A=T.filterURLForDisplay,x=wp.richText,j=x.create,N=x.insert,F=x.isCollapsed,W=x.applyFormat,D=x.getTextContent,V=x.slice,z=function(e){return e.stopPropagation()},B=function(e){var t=e.value,n=e.onChangeInputValue,i=e.onKeyDown,o=e.submitLink,r=e.invalidLink,a=e.resetInvalidLink,l=e.autocompleteRef;return wp.element.createElement("form",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover",onKeyPress:z,onKeyDown:i,onSubmit:o},wp.element.createElement(d.a,{value:t,onChange:n,autocompleteRef:l,invalidLink:r,resetInvalidLink:a}),wp.element.createElement(y,{icon:"editor-break",label:h("Apply"),type:"submit"}))},H=function(e){var t=e.url,n=R(t),i=u()("editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value",{"has-invalid-link":!Object(c.a)(n)});return t?wp.element.createElement(b,{className:i,href:t},A(P(t))):wp.element.createElement("span",{className:i})},U=function(e){var t=e.url,n=e.editLink;return wp.element.createElement("div",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",onKeyPress:z},wp.element.createElement(H,{url:t}),wp.element.createElement(y,{icon:"edit",label:h("Edit"),onClick:n}))},M=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.editLink=e.editLink.bind(e),e.submitLink=e.submitLink.bind(e),e.onKeyDown=e.onKeyDown.bind(e),e.onChangeInputValue=e.onChangeInputValue.bind(e),e.onClickOutside=e.onClickOutside.bind(e),e.resetState=e.resetState.bind(e),e.autocompleteRef=v(),e.resetInvalidLink=e.resetInvalidLink.bind(e),e.state={inputValue:"",linkid:0,post:null,invalidLink:!1},e}return r(t,e),f(t,[{key:"onKeyDown",value:function(e){[E,O,_,L,C,I].indexOf(e.keyCode)>-1&&e.stopPropagation()}},{key:"onChangeInputValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t?t.id:0;this.setState({inputValue:e,linkid:n,post:t})}},{key:"editLink",value:function(e){this.setState({editLink:!0}),e.preventDefault()}},{key:"submitLink",value:function(e){var t=this.props,n=t.isActive,i=t.value,o=t.onChange,r=t.speak,l=this.state,s=l.inputValue,u=l.linkid,p=l.post,d=R(s),f=D(V(i)),g=a({url:d,linkid:u,text:f});if(e.preventDefault(),!u||!p)return void this.setState({invalidLink:!0});if(F(i)&&!n){var m=W(j({text:p.title}),g,0,d.length);o(N(i,m))}else o(W(i,g));this.resetState(),Object(c.a)(d)?n?r(h("Link edited."),"assertive"):r(h("Link inserted"),"assertive"):r(h("Warning: the link has been inserted but may have errors. Please test it."),"assertive")}},{key:"onClickOutside",value:function(e){var t=this.autocompleteRef.current;t&&t.contains(e.target)||this.resetState()}},{key:"resetState",value:function(){this.props.stopAddingLink(),this.setState({inputValue:"",editLink:!1}),this.resetInvalidLink()}},{key:"resetInvalidLink",value:function(){this.setState({invalidLink:!1})}},{key:"render",value:function(){var e=this.props,t=e.isActive,n=e.activeAttributes,i=n.url,o=(n.linkid,e.addingLink),r=e.anchorRect;e.value,e.onChange;if(!t&&!o)return null;var a=this.state,s=a.inputValue,u=a.invalidLink,c=l(this.props,this.state);return wp.element.createElement(p.a,{onClickOutside:this.onClickOutside,onClose:this.resetState,focusOnMount:!!c&&"firstElement",invalidLink:u,anchorRect:r},c?wp.element.createElement(B,{value:s,onChangeInputValue:this.onChangeInputValue,onKeyDown:this.onKeyDown,submitLink:this.submitLink,autocompleteRef:this.autocompleteRef,updateLinkId:this.updateLinkId,invalidLink:u,resetInvalidLink:this.resetInvalidLink}):wp.element.createElement(U,{url:i,editLink:this.editLink}))}}]),t}(m);t.a=k(M)},function(e,t,n){"use strict";function i(e){if(!e)return!1;var t=e.trim();if(!t)return!1;if(/^\S+:/.test(t)){var n=l(t);if(!s(n))return!1;if(r(n,"http")&&!/^https?:\/\/[^\/\s]/i.test(t))return!1;var i=u(t);if(!c(i))return!1;var o=p(t);if(o&&!d(o))return!1;var a=f(t);if(a&&!h(a))return!1;var v=g(t);if(v&&!m(v))return!1}return!(r(t,"#")&&!m(t))}t.a=i;var o=lodash,r=o.startsWith,a=wp.url,l=a.getProtocol,s=a.isValidProtocol,u=a.getAuthority,c=a.isValidAuthority,p=a.getPath,d=a.isValidPath,f=a.getQueryString,h=a.isValidQueryString,g=a.getFragment,m=a.isValidFragment},function(e,t,n){"use strict";function i(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),u=wp.i18n.__,c=wp.element.Component,p=wp.components,d=p.Popover,f=p.IconButton,h=function(e){function t(){o(this,t);var e=r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.toggleSettingsVisibility=e.toggleSettingsVisibility.bind(e),e.state={isSettingsExpanded:!1},e}return a(t,e),s(t,[{key:"toggleSettingsVisibility",value:function(){this.setState({isSettingsExpanded:!this.state.isSettingsExpanded})}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.renderSettings,o=e.invalidLink,r=e.position,a=void 0===r?"bottom center":r,s=e.focusOnMount,c=void 0===s?"firstElement":s,p=i(e,["children","renderSettings","invalidLink","position","focusOnMount"]),h=this.state.isSettingsExpanded,g=!!n&&h;return wp.element.createElement(d,l({className:"ta-url-popover editor-url-popover block-editor-url-popover",focusOnMount:c,position:a},p),wp.element.createElement("div",{className:"editor-url-popover__row"},t,!!n&&wp.element.createElement(f,{className:"editor-url-popover__settings-toggle",icon:"ellipsis",label:u("Link Settings"),onClick:this.toggleSettingsVisibility,"aria-expanded":h})),g&&wp.element.createElement("div",{className:"editor-url-popover__row editor-url-popover__settings"},n()),o&&wp.element.createElement("div",{class:"ta-invalid-link"},u("Invalid affiliate link")))}}]),t}(c);t.a=h},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=n(14),u=n.n(s),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),p=wp.i18n.__,d=lodash,f=d.throttle,h=wp.element,g=h.Component,m=h.createRef,v=wp.keycodes,w=v.UP,b=v.DOWN,y=v.ENTER,k=v.TAB,S=wp.components,E=S.Spinner,_=S.withSpokenMessages,L=S.Popover,O=wp.compose.withInstanceId,C=function(e){return e.stopPropagation()},I=function(e){function t(e){var n=e.autocompleteRef;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.onChange=r.onChange.bind(r),r.onKeyDown=r.onKeyDown.bind(r),r.autocompleteRef=n||m(),r.inputRef=m(),r.updateSuggestions=f(r.updateSuggestions.bind(r),200),r.suggestionNodes=[],r.state={posts:[],showSuggestions:!1,selectedSuggestion:null},r}return r(t,e),c(t,[{key:"componentDidUpdate",value:function(){var e=this,t=this.state,n=t.showSuggestions,i=t.selectedSuggestion;n&&null!==i&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,u()(this.suggestionNodes[i],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),setTimeout(function(){e.scrollingIntoView=!1},100))}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest}},{key:"bindSuggestionNode",value:function(e){var t=this;return function(n){t.suggestionNodes[e]=n}}},{key:"updateSuggestions",value:function(e){var t=this;if(e.length<2||/^https?:/.test(e))return void this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});this.setState({showSuggestions:!0,selectedSuggestion:null,loading:!0});var n=new FormData;n.append("action","search_affiliate_links_query"),n.append("keyword",e),n.append("paged",1),n.append("gutenberg",!0);var i=fetch(ajaxurl,{method:"POST",body:n});i.then(function(e){return e.json()}).then(function(e){if(e.affiliate_links){var n=e.affiliate_links;t.suggestionsRequest===i&&(t.setState({posts:n,loading:!1}),n.length?t.props.debouncedSpeak(sprintf(_n("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",n.length),n.length),"assertive"):t.props.debouncedSpeak(p("No results."),"assertive"))}}).catch(function(){t.suggestionsRequest===i&&t.setState({loading:!1})}),this.suggestionsRequest=i}},{key:"onChange",value:function(e){this.props.resetInvalidLink();var t=e.target.value;this.props.onChange(t),this.updateSuggestions(t)}},{key:"onKeyDown",value:function(e){var t=this.state,n=t.showSuggestions,i=t.selectedSuggestion,o=t.posts,r=t.loading;if(n&&o.length&&!r){var a=this.state.posts[this.state.selectedSuggestion];switch(e.keyCode){case w:e.stopPropagation(),e.preventDefault();var l=i?i-1:o.length-1;this.setState({selectedSuggestion:l});break;case b:e.stopPropagation(),e.preventDefault();var s=null===i||i===o.length-1?0:i+1;this.setState({selectedSuggestion:s});break;case k:null!==this.state.selectedSuggestion&&(this.selectLink(a),this.props.speak(p("Link selected")));break;case y:null!==this.state.selectedSuggestion&&(e.stopPropagation(),this.selectLink(a))}}else switch(e.keyCode){case w:0!==e.target.selectionStart&&(e.stopPropagation(),e.preventDefault(),e.target.setSelectionRange(0,0));break;case b:this.props.value.length!==e.target.selectionStart&&(e.stopPropagation(),e.preventDefault(),e.target.setSelectionRange(this.props.value.length,this.props.value.length))}}},{key:"selectLink",value:function(e){this.props.onChange(e.link,e),this.setState({selectedSuggestion:null,showSuggestions:!1})}},{key:"handleOnClick",value:function(e){this.selectLink(e),this.inputRef.current.focus()}},{key:"render",value:function(){var e=this,t=this.props,n=t.value,i=void 0===n?"":n,o=t.autoFocus,r=void 0===o||o,a=t.instanceId,s=t.invalidLink,u=this.state,c=u.showSuggestions,d=u.posts,f=u.selectedSuggestion,h=u.loading;return wp.element.createElement("div",{className:"editor-url-input block-editor-url-input"},wp.element.createElement("input",{autoFocus:r,type:"text","aria-label":p("URL"),required:!0,value:i,onChange:this.onChange,onInput:C,placeholder:p("Paste URL or type to search"),onKeyDown:this.onKeyDown,role:"combobox","aria-expanded":c,"aria-autocomplete":"list","aria-owns":"editor-url-input-suggestions-"+a,"aria-activedescendant":null!==f?"editor-url-input-suggestion-"+a+"-"+f:void 0,ref:this.inputRef}),h&&wp.element.createElement(E,null),c&&!!d.length&&!s&&wp.element.createElement(L,{position:"bottom",noArrow:!0,focusOnMount:!1},wp.element.createElement("div",{className:"editor-url-input__suggestions block-editor-url-input__suggestions",id:"editor-url-input-suggestions-"+a,ref:this.autocompleteRef,role:"listbox"},d.map(function(t,n){return wp.element.createElement("button",{key:t.id,role:"option",tabIndex:"-1",id:"block-editor-url-input-suggestion-"+a+"-"+n,ref:e.bindSuggestionNode(n),className:l()("editor-url-input__suggestion block-editor-url-input__suggestion",{"is-selected":n===f}),onClick:function(){return e.handleOnClick(t)},"aria-selected":n===f},t.title||p("(no title)"))}))))}}]),t}(g);t.a=_(O(I))},function(e,t,n){"use strict";e.exports=n(15)},function(e,t,n){"use strict";function i(e,t,n){n=n||{},9===t.nodeType&&(t=o.getWindow(t));var i=n.allowHorizontalScroll,r=n.onlyScrollIfNeeded,a=n.alignWithTop,l=n.alignWithLeft,s=n.offsetTop||0,u=n.offsetLeft||0,c=n.offsetBottom||0,p=n.offsetRight||0;i=void 0===i||i;var d=o.isWindow(t),f=o.offset(e),h=o.outerHeight(e),g=o.outerWidth(e),m=void 0,v=void 0,w=void 0,b=void 0,y=void 0,k=void 0,S=void 0,E=void 0,_=void 0,L=void 0;d?(S=t,L=o.height(S),_=o.width(S),E={left:o.scrollLeft(S),top:o.scrollTop(S)},y={left:f.left-E.left-u,top:f.top-E.top-s},k={left:f.left+g-(E.left+_)+p,top:f.top+h-(E.top+L)+c},b=E):(m=o.offset(t),v=t.clientHeight,w=t.clientWidth,b={left:t.scrollLeft,top:t.scrollTop},y={left:f.left-(m.left+(parseFloat(o.css(t,"borderLeftWidth"))||0))-u,top:f.top-(m.top+(parseFloat(o.css(t,"borderTopWidth"))||0))-s},k={left:f.left+g-(m.left+w+(parseFloat(o.css(t,"borderRightWidth"))||0))+p,top:f.top+h-(m.top+v+(parseFloat(o.css(t,"borderBottomWidth"))||0))+c}),y.top<0||k.top>0?!0===a?o.scrollTop(t,b.top+y.top):!1===a?o.scrollTop(t,b.top+k.top):y.top<0?o.scrollTop(t,b.top+y.top):o.scrollTop(t,b.top+k.top):r||(a=void 0===a||!!a,a?o.scrollTop(t,b.top+y.top):o.scrollTop(t,b.top+k.top)),i&&(y.left<0||k.left>0?!0===l?o.scrollLeft(t,b.left+y.left):!1===l?o.scrollLeft(t,b.left+k.left):y.left<0?o.scrollLeft(t,b.left+y.left):o.scrollLeft(t,b.left+k.left):r||(l=void 0===l||!!l,l?o.scrollLeft(t,b.left+y.left):o.scrollLeft(t,b.left+k.left)))}var o=n(16);e.exports=i},function(e,t,n){"use strict";function i(e){var t=void 0,n=void 0,i=void 0,o=e.ownerDocument,r=o.body,a=o&&o.documentElement;return t=e.getBoundingClientRect(),n=t.left,i=t.top,n-=a.clientLeft||r.clientLeft||0,i-=a.clientTop||r.clientTop||0,{left:n,top:i}}function o(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],i="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;n=o.documentElement[i],"number"!=typeof n&&(n=o.body[i])}return n}function r(e){return o(e)}function a(e){return o(e,!0)}function l(e){var t=i(e),n=e.ownerDocument,o=n.defaultView||n.parentWindow;return t.left+=r(o),t.top+=a(o),t}function s(e,t,n){var i="",o=e.ownerDocument,r=n||o.defaultView.getComputedStyle(e,null);return r&&(i=r.getPropertyValue(t)||r[t]),i}function u(e,t){var n=e[_]&&e[_][t];if(S.test(n)&&!E.test(t)){var i=e.style,o=i[O],r=e[L][O];e[L][O]=e[_][O],i[O]="fontSize"===t?"1em":n||0,n=i.pixelLeft+C,i[O]=o,e[L][O]=r}return""===n?"auto":n}function c(e,t){for(var n=0;n<e.length;n++)t(e[n])}function p(e){return"border-box"===I(e,"boxSizing")}function d(e,t,n){var i={},o=e.style,r=void 0;for(r in t)t.hasOwnProperty(r)&&(i[r]=o[r],o[r]=t[r]);n.call(e);for(r in t)t.hasOwnProperty(r)&&(o[r]=i[r])}function f(e,t,n){var i=0,o=void 0,r=void 0,a=void 0;for(r=0;r<t.length;r++)if(o=t[r])for(a=0;a<n.length;a++){var l=void 0;l="border"===o?o+n[a]+"Width":o+n[a],i+=parseFloat(I(e,l))||0}return i}function h(e){return null!=e&&e==e.window}function g(e,t,n){if(h(e))return"width"===t?x.viewportWidth(e):x.viewportHeight(e);if(9===e.nodeType)return"width"===t?x.docWidth(e):x.docHeight(e);var i="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,r=I(e),a=p(e,r),l=0;(null==o||o<=0)&&(o=void 0,l=I(e,t),(null==l||Number(l)<0)&&(l=e.style[t]||0),l=parseFloat(l)||0),void 0===n&&(n=a?A:R);var s=void 0!==o||a,u=o||l;if(n===R)return s?u-f(e,["border","padding"],i,r):l;if(s){var c=n===P?-f(e,["border"],i,r):f(e,["margin"],i,r);return u+(n===A?0:c)}return l+f(e,T.slice(n),i,r)}function m(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=g.apply(void 0,n):d(e,j,function(){t=g.apply(void 0,n)}),t}function v(e,t,n){var i=n;{if("object"!==(void 0===t?"undefined":y(t)))return void 0!==i?("number"==typeof i&&(i+="px"),void(e.style[t]=i)):I(e,t);for(var o in t)t.hasOwnProperty(o)&&v(e,o,t[o])}}function w(e,t){"static"===v(e,"position")&&(e.style.position="relative");var n=l(e),i={},o=void 0,r=void 0;for(r in t)t.hasOwnProperty(r)&&(o=parseFloat(v(e,r))||0,i[r]=o+t[r]-n[r]);v(e,i)}var b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},k=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,S=new RegExp("^("+k+")(?!px)[a-z%]+$","i"),E=/^(top|right|bottom|left)$/,_="currentStyle",L="runtimeStyle",O="left",C="px",I=void 0;"undefined"!=typeof window&&(I=window.getComputedStyle?s:u);var T=["margin","border","padding"],R=-1,P=2,A=1,x={};c(["Width","Height"],function(e){x["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],x["viewport"+e](n))},x["viewport"+e]=function(t){var n="client"+e,i=t.document,o=i.body,r=i.documentElement,a=r[n];return"CSS1Compat"===i.compatMode&&a||o&&o[n]||a}});var j={position:"absolute",visibility:"hidden",display:"block"};c(["width","height"],function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);x["outer"+t]=function(t,n){return t&&m(t,e,n?0:A)};var n="width"===e?["Left","Right"]:["Top","Bottom"];x[e]=function(t,i){if(void 0===i)return t&&m(t,e,R);if(t){var o=I(t);return p(t)&&(i+=f(t,["padding","border"],n,o)),v(t,e,i)}}}),e.exports=b({getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return l(e);w(e,t)},isWindow:h,each:c,css:v,clone:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);if(e.overflow)for(var n in e)e.hasOwnProperty(n)&&(t.overflow[n]=e.overflow[n]);return t},scrollLeft:function(e,t){if(h(e)){if(void 0===t)return r(e);window.scrollTo(t,a(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(h(e)){if(void 0===t)return a(e);window.scrollTo(r(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},viewportWidth:0,viewportHeight:0},x)},function(e,t){}]);
|
7 |
//# sourceMappingURL=gutenberg-support.js.map
|
3 |
Licensed under the MIT License (MIT), see
|
4 |
http://jedwatson.github.io/classnames
|
5 |
*/
|
6 |
+
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var i=arguments[t];if(i){var o=typeof i;if("string"===o||"number"===o)e.push(i);else if(Array.isArray(i)&&i.length){var a=n.apply(null,i);a&&e.push(a)}else if("object"===o)for(var l in i)r.call(i,l)&&i[l]&&e.push(l)}}return e.join(" ")}var r={}.hasOwnProperty;void 0!==e&&e.exports?(n.default=n,e.exports=n):(i=[],void 0!==(o=function(){return n}.apply(t,i))&&(e.exports=o))}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(8),r=n(17);n.n(r);Object(i.a)(),Object(o.a)()},function(e,t,n){"use strict";function i(){[o].forEach(function(e){if(e){var t=e.name,n=e.settings;r(t,n)}})}t.a=i;var o=n(3),r=wp.blocks.registerBlockType},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"name",function(){return h}),n.d(t,"settings",function(){return v});var o=n(0),r=n.n(o),a=n(4),l=wp.element.Fragment,s=wp.i18n.__,u=wp.dom.getPhrasingContentSchema,c=wp.blockEditor.RichText,p=wp.components,d=p.Path,f=p.SVG,h="ta/image",g={url:{type:"string",source:"attribute",selector:"img",attribute:"src"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},caption:{type:"string",source:"html",selector:"figcaption"},id:{type:"number"},align:{type:"string"},width:{type:"number"},height:{type:"number"},linkid:{type:"number"},href:{type:"string",source:"attribute",selector:"ta",attribute:"href"},affiliateLink:{type:"object"}},m={img:{attributes:["src","alt"],classes:["alignleft","aligncenter","alignright","alignnone",/^wp-image-\d+$/]}},v=(u(),{title:s("ThirstyAffiliates Image"),description:s("Insert an image with an affiliate link to make a visual statement."),icon:wp.element.createElement(f,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement(d,{d:"M0,0h24v24H0V0z",fill:"none"}),wp.element.createElement(d,{d:"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z"}),wp.element.createElement(d,{d:"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z"})),category:"common",keywords:["img",s("photo"),s("affiliate")],attributes:g,getEditWrapperProps:function(e){var t=e.align,n=e.width;if("left"===t||"center"===t||"right"===t||"wide"===t||"full"===t)return{"data-align":t,"data-resized":!!n}},edit:a.a,save:function(e){var t,n=e.attributes,o=n.url,a=n.alt,s=n.caption,u=n.align,p=n.width,d=n.height,f=n.id,h=n.linkid,g=n.href,m=r()((t={},i(t,"align"+u,u),i(t,"is-resized",p||d),t)),v=wp.element.createElement("img",{src:o,alt:a,className:f?"wp-image-"+f:null,width:p,height:d}),w=wp.element.createElement(l,null,wp.element.createElement("ta",{linkid:h,href:g},v),wp.element.createElement(c.Content,{tagName:"figcaption",value:s}));return"left"===u||"right"===u||"center"===u?wp.element.createElement("div",{className:"wp-block-image"},wp.element.createElement("figure",{className:m},w)):wp.element.createElement("figure",{className:"wp-block-image "+m},w)}})},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=n(5),u=n(6),c=n(7),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},d=function(){function e(e,t){var n=[],i=!0,o=!1,r=void 0;try{for(var a,l=e[Symbol.iterator]();!(i=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{!i&&l.return&&l.return()}finally{if(o)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),h=lodash,g=h.get,m=h.isEmpty,v=h.map,w=h.last,b=h.pick,y=h.compact,k=wp.url.getPath,S=wp.i18n,E=S.__,_=S.sprintf,L=wp.element,O=L.Component,C=L.Fragment,I=L.createRef,T=wp.blob,R=T.getBlobByURL,P=T.revokeBlobURL,A=T.isBlobURL,x=wp.components,j=x.Placeholder,N=x.Button,F=x.ButtonGroup,W=x.IconButton,D=x.PanelBody,V=x.ResizableBox,z=x.SelectControl,H=x.Spinner,B=x.TextControl,U=x.TextareaControl,M=x.Toolbar,K=x.withNotices,q=wp.data.withSelect,G=wp.editor.mediaUpload,Q=wp.blockEditor,Z=Q.InspectorControls,$=Q.BlockControls,X=Q.RichText,Y=Q.BlockAlignmentToolbar,J=wp.viewport.withViewportMatch,ee=wp.compose.compose,te=["image"],ne=function(e){var t=b(e,["alt","id","link","caption"]);return t.url=g(e,["sizes","large","url"])||g(e,["media_details","sizes","large","source_url"])||e.url,t},ie=function(e,t){return!e&&A(t)},oe=function(e,t){return t&&!e&&!A(t)},re=function(e){function t(e){var n=e.attributes;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.updateAlt=r.updateAlt.bind(r),r.updateAlignment=r.updateAlignment.bind(r),r.onFocusCaption=r.onFocusCaption.bind(r),r.onImageClick=r.onImageClick.bind(r),r.onSelectImage=r.onSelectImage.bind(r),r.updateImageURL=r.updateImageURL.bind(r),r.updateWidth=r.updateWidth.bind(r),r.updateHeight=r.updateHeight.bind(r),r.updateDimensions=r.updateDimensions.bind(r),r.getFilename=r.getFilename.bind(r),r.toggleIsEditing=r.toggleIsEditing.bind(r),r.onImageError=r.onImageError.bind(r),r.onChangeInputValue=r.onChangeInputValue.bind(r),r.autocompleteRef=I(),r.resetInvalidLink=r.resetInvalidLink.bind(r),r.updateImageSelection=r.updateImageSelection.bind(r),r.onSelectAffiliateImage=r.onSelectAffiliateImage.bind(r),r.editAFfiliateImage=r.editAFfiliateImage.bind(r),r.state={captionFocused:!1,isEditing:!n.url,inputValue:"",linkid:0,post:null,showSuggestions:!1,imageSelection:[],affiliateLink:null},r}return r(t,e),f(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.attributes,i=t.setAttributes,o=t.noticeOperations,r=n.id,a=n.url,l=void 0===a?"":a;if(ie(r,l)){var s=R(l);s&&G({filesList:[s],onFileChange:function(e){var t=d(e,1),n=t[0];i(ne(n))},allowedTypes:te,onError:function(t){o.createErrorNotice(t),e.setState({isEditing:!0})}})}}},{key:"componentDidUpdate",value:function(e){var t=e.attributes,n=t.id,i=t.url,o=void 0===i?"":i,r=this.props.attributes,a=r.id,l=r.url,s=void 0===l?"":l;ie(n,o)&&!ie(a,s)&&P(s),!this.props.isSelected&&e.isSelected&&this.state.captionFocused&&this.setState({captionFocused:!1})}},{key:"onSelectImage",value:function(e){if(!e||!e.url)return void this.props.setAttributes({url:void 0,alt:void 0,id:void 0,caption:void 0});var t=this.state.affiliateLink;this.setState({isEditing:!1}),this.props.setAttributes(p({},ne(e),{linkid:t.id,href:t.link,affiliateLink:t,width:void 0,height:void 0}))}},{key:"onImageError",value:function(e){var t=Object(s.a)({attributes:{url:e}});void 0!==t&&this.props.onReplace(t)}},{key:"onFocusCaption",value:function(){this.state.captionFocused||this.setState({captionFocused:!0})}},{key:"onImageClick",value:function(){this.state.captionFocused&&this.setState({captionFocused:!1})}},{key:"updateAlt",value:function(e){this.props.setAttributes({alt:e})}},{key:"updateAlignment",value:function(e){var t=-1!==["wide","full"].indexOf(e)?{width:void 0,height:void 0}:{};this.props.setAttributes(p({},t,{align:e}))}},{key:"updateImageURL",value:function(e){this.props.setAttributes({url:e,width:void 0,height:void 0})}},{key:"updateWidth",value:function(e){this.props.setAttributes({width:parseInt(e,10)})}},{key:"updateHeight",value:function(e){this.props.setAttributes({height:parseInt(e,10)})}},{key:"updateDimensions",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return function(){e.props.setAttributes({width:t,height:n})}}},{key:"getFilename",value:function(e){var t=k(e);if(t)return w(t.split("/"))}},{key:"getLinkDestinationOptions",value:function(){return[{value:"none",label:E("None")},{value:"media",label:E("Media File")},{value:"attachment",label:E("Attachment Page")},{value:"custom",label:E("Custom URL")}]}},{key:"toggleIsEditing",value:function(){this.setState({isEditing:!this.state.isEditing})}},{key:"getImageSizeOptions",value:function(){var e=this.props,t=e.imageSizes,n=e.image;return y(v(t,function(e){var t=e.name,i=e.slug,o=g(n,["media_details","sizes",i,"source_url"]);return o?{value:o,label:t}:null}))}},{key:"onChangeInputValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t?t.id:0;this.setState({inputValue:e,linkid:n,post:t})}},{key:"resetInvalidLink",value:function(){this.setState({invalidLink:!1})}},{key:"updateImageSelection",value:function(e,t){this.setState({imageSelection:e,affiliateLink:t})}},{key:"onSelectAffiliateImage",value:function(e){var t=this;if(oe(e.id,e.src))e.url=e.src,this.onSelectImage(e);else{wp.apiFetch({path:wp.url.addQueryArgs("/wp/v2/media/"+e.id,{context:"edit",_locale:"user"})}).then(function(e){e.url=e.source_url,t.onSelectImage(e)})}}},{key:"editAFfiliateImage",value:function(){var e=this.props.attributes,t=e.affiliateLink;this.setState({isEditing:!0,imageSelection:t.images,affiliateLink:t})}},{key:"render",value:function(){var e=this,t=this.state,n=t.isEditing,i=t.imageSelection,o=t.affiliateLink,r=this.props,a=r.attributes,s=r.setAttributes,p=r.isLargeViewport,d=r.isSelected,f=r.className,h=r.maxWidth,g=r.toggleSelection,v=r.isRTL,w=a.url,b=a.alt,y=a.caption,k=a.align,S=(a.linkDestination,a.width),L=a.height,O=a.linkid,I=a.href,T=wp.element.createElement(M,{label:E("ThirstyAffiliates Image Settings")},wp.element.createElement(W,{className:"ta-edit-image-button components-icon-button components-toolbar__control",label:E("Edit ThirstyAffiliates Image"),icon:"edit",onClick:this.editAFfiliateImage})),R=wp.element.createElement($,null,wp.element.createElement(Y,{value:k,onChange:this.updateAlignment}),T);if(n)return wp.element.createElement(C,null,R,wp.element.createElement(j,{icon:"format-image",label:E("ThirstyAffiliates Image"),instructions:E("Search for an affiliate link and select image to insert.")},wp.element.createElement(c.a,{updateImageSelection:this.updateImageSelection}),!!i.length&&wp.element.createElement("div",{className:"ta-image-sel-wrap"},wp.element.createElement("h3",null,o.title+" "+E("attached images:")),wp.element.createElement("div",{className:"ta-image-selection"},i.map(function(t,n){return wp.element.createElement("button",{onClick:function(){return e.onSelectAffiliateImage(t)}},wp.element.createElement("img",{src:t.src}))})))));var P=l()(f,{"wp-block-image":!0,"is-transient":A(w),"is-resized":!!S||!!L,"is-focused":d}),x=-1===["wide","full"].indexOf(k)&&p,K=this.getImageSizeOptions(),q=function(t,n){return wp.element.createElement(Z,null,wp.element.createElement(D,{title:E("Image Settings")},wp.element.createElement(U,{label:E("Alt Text (Alternative Text)"),value:b,onChange:e.updateAlt,help:E("Alternative text describes your image to people who can’t see it. Add a short description with its key details.")}),!m(K)&&wp.element.createElement(z,{label:E("Image Size"),value:w,options:K,onChange:e.updateImageURL}),x&&wp.element.createElement("div",{className:"block-library-image__dimensions"},wp.element.createElement("p",{className:"block-library-image__dimensions__row"},E("Image Dimensions")),wp.element.createElement("div",{className:"block-library-image__dimensions__row"},wp.element.createElement(B,{type:"number",className:"block-library-image__dimensions__width",label:E("Width"),value:void 0!==S?S:"",placeholder:t,min:1,onChange:e.updateWidth}),wp.element.createElement(B,{type:"number",className:"block-library-image__dimensions__height",label:E("Height"),value:void 0!==L?L:"",placeholder:n,min:1,onChange:e.updateHeight})),wp.element.createElement("div",{className:"block-library-image__dimensions__row"},wp.element.createElement(F,{"aria-label":E("Image Size")},[25,50,75,100].map(function(i){var o=Math.round(t*(i/100)),r=Math.round(n*(i/100)),a=S===o&&L===r;return wp.element.createElement(N,{key:i,isSmall:!0,isPrimary:a,"aria-pressed":a,onClick:e.updateDimensions(o,r)},i,"%")})),wp.element.createElement(N,{isSmall:!0,onClick:e.updateDimensions()},E("Reset"))))))};return wp.element.createElement(C,null,R,wp.element.createElement("figure",{className:P},wp.element.createElement(u.a,{src:w,dirtynessTrigger:k},function(t){var n=t.imageWidthWithinContainer,i=t.imageHeightWithinContainer,o=t.imageWidth,r=t.imageHeight,a=e.getFilename(w),l=void 0;l=b||(a?_(E("This image has an empty alt attribute; its file name is %s"),a):E("This image has an empty alt attribute"));var u=wp.element.createElement(C,null,wp.element.createElement("ta",{linkid:O,href:I},wp.element.createElement("img",{src:w,alt:l,onClick:e.onImageClick,onError:function(){return e.onImageError(w)}})),A(w)&&wp.element.createElement(H,null));if(!x||!n)return wp.element.createElement(C,null,q(o,r),wp.element.createElement("div",{style:{width:S,height:L}},u));var c=S||n,p=L||i,d=o/r,f=o<r?20:20*d,m=r<o?20:20/d,y=2.5*h,T=!1,R=!1;return"center"===k?(T=!0,R=!0):v?"left"===k?T=!0:R=!0:"right"===k?R=!0:T=!0,wp.element.createElement(C,null,q(o,r),wp.element.createElement(V,{size:S&&L?{width:S,height:L}:void 0,minWidth:f,maxWidth:y,minHeight:m,maxHeight:y/d,lockAspectRatio:!0,enable:{top:!1,right:T,bottom:!0,left:R},onResizeStart:function(){g(!1)},onResizeStop:function(e,t,n,i){s({width:parseInt(c+i.width,10),height:parseInt(p+i.height,10)}),g(!0)}},u))}),(!X.isEmpty(y)||d)&&wp.element.createElement(X,{tagName:"figcaption",placeholder:E("Write caption…"),value:y,unstableOnFocus:this.onFocusCaption,onChange:function(e){return s({caption:e})},isSelected:this.state.captionFocused,inlineToolbar:!0})))}}]),t}(O);t.a=ee([q(function(e,t){var n=e("core"),i=n.getMedia,o=e("core/editor"),r=o.getEditorSettings,a=t.attributes.id,l=r(),s=l.maxWidth,u=l.isRTL,c=l.imageSizes;return{image:a?i(a):null,maxWidth:s,isRTL:u,imageSizes:c}}),J({isLargeViewport:"medium"}),K])(re)},function(e,t,n){"use strict";n.d(t,"a",function(){return l});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},o=lodash,r=o.includes,a=(wp.element.renderToString,wp.blocks.createBlock),l=function(e,t){var n=e.preview,o=e.name,r=e.attributes.url;if(r){var l=findBlock(r);if("core-embed/wordpress"!==o&&DEFAULT_EMBED_BLOCK!==l&&o!==l)return a(l,{url:r});if(n){var u=n.html;if(s(u)&&"core-embed/wordpress"!==o)return a("core-embed/wordpress",i({url:r},t))}}},s=function(e){return r(e,'class="wp-embedded-content" data-secret')}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=lodash,s=l.noop,u=wp.compose.withGlobalEvents,c=wp.element.Component,p=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.state={width:void 0,height:void 0},e.bindContainer=e.bindContainer.bind(e),e.calculateSize=e.calculateSize.bind(e),e}return r(t,e),a(t,[{key:"bindContainer",value:function(e){this.container=e}},{key:"componentDidUpdate",value:function(e){this.props.src!==e.src&&(this.setState({width:void 0,height:void 0}),this.fetchImageSize()),this.props.dirtynessTrigger!==e.dirtynessTrigger&&this.calculateSize()}},{key:"componentDidMount",value:function(){this.fetchImageSize()}},{key:"componentWillUnmount",value:function(){this.image&&(this.image.onload=s)}},{key:"fetchImageSize",value:function(){this.image=new window.Image,this.image.onload=this.calculateSize,this.image.src=this.props.src}},{key:"calculateSize",value:function(){var e=this.container.clientWidth,t=this.image.width>e,n=this.image.height/this.image.width,i=t?e:this.image.width,o=t?e*n:this.image.height;this.setState({width:i,height:o})}},{key:"render",value:function(){var e={imageWidth:this.image&&this.image.width,imageHeight:this.image&&this.image.height,containerWidth:this.container&&this.container.clientWidth,containerHeight:this.container&&this.container.clientHeight,imageWidthWithinContainer:this.state.width,imageHeightWithinContainer:this.state.height};return wp.element.createElement("div",{ref:this.bindContainer},this.props.children(e))}}]),t}(c);t.a=u({resize:"calculateSize"})(p)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),u=wp.i18n.__,c=wp.element,p=c.Component,d=c.createRef,f=wp.components,h=f.Spinner,g=f.withSpokenMessages,m=f.Popover,v=f.TextControl,w=wp.compose.withInstanceId,b=function(e){function t(e){var n=e.autocompleteRef;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.autocompleteRef=n||d(),r.inputRef=d(),r.searchAffiliateLinks=r.searchAffiliateLinks.bind(r),r.suggestionNodes=[],r.state={posts:[],showSuggestions:!1,selectedSuggestion:null,loading:!1},r}return r(t,e),s(t,[{key:"componentDidUpdate",value:function(){var e=this,t=this.state,n=t.showSuggestions,i=t.selectedSuggestion;n&&null!==i&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,scrollIntoView(this.suggestionNodes[i],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),setTimeout(function(){e.scrollingIntoView=!1},100))}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest}},{key:"bindSuggestionNode",value:function(e){var t=this;return function(n){t.suggestionNodes[e]=n}}},{key:"searchAffiliateLinks",value:function(e){var t=this;if(e.length<2)return void this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});this.setState({showSuggestions:!0,selectedSuggestion:null,loading:!0});var n=new FormData;n.append("action","search_affiliate_links_query"),n.append("keyword",e),n.append("paged",1),n.append("gutenberg",!0),n.append("with_images",!0);var i=fetch(ajaxurl,{method:"POST",body:n});i.then(function(e){return e.json()}).then(function(e){if(e.affiliate_links){var n=e.affiliate_links;t.suggestionsRequest===i&&(t.setState({posts:n,loading:!1}),n.length?t.props.debouncedSpeak(sprintf(_n("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",n.length),n.length),"assertive"):t.props.debouncedSpeak(u("No results."),"assertive"))}}).catch(function(){t.suggestionsRequest===i&&t.setState({loading:!1})}),this.suggestionsRequest=i}},{key:"selectLink",value:function(e){this.setState({selectedSuggestion:e,showSuggestions:!1}),this.props.updateImageSelection(e.images,e)}},{key:"handleOnClick",value:function(e){this.selectLink(e)}},{key:"render",value:function(){var e=this,t=this.props,n=(t.value,t.autoFocus,t.instanceId),i=this.state,o=i.showSuggestions,r=i.posts,a=i.selectedSuggestion,s=i.loading;return wp.element.createElement("div",{class:"edit-search-affiliate-links"},wp.element.createElement("form",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover",onSubmit:this.displayAffiliateImages},wp.element.createElement(v,{type:"text",className:"ta-search-affiliate-links",placeholder:u("Type to search affiliate links"),onChange:this.searchAffiliateLinks,autocomplete:"off"}),s&&wp.element.createElement(h,null),o&&!!r.length&&wp.element.createElement(m,{position:"bottom",focusOnMount:!1},wp.element.createElement("div",{class:"affilate-links-suggestions"},r.map(function(t,i){return wp.element.createElement("button",{key:t.id,role:"option",tabIndex:"-1",id:"editor-url-input-suggestion-"+n+"-"+i,ref:e.bindSuggestionNode(i),className:l()("editor-url-input__suggestion block-editor-url-input__suggestion",{"is-selected":i===a}),onClick:function(){return e.handleOnClick(t)},"aria-selected":i===a},t.title||u("(no title)"))})))))}}]),t}(p);t.a=g(w(b))},function(e,t,n){"use strict";function i(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(){[r.a].forEach(function(e){var t=e.name,n=i(e,["name"]);return a(t,n)})}t.a=o;var r=n(9),a=wp.richText.registerFormatType},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}n.d(t,"a",function(){return C});var a=n(10),l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=wp.i18n.__,u=wp.element,c=u.Component,p=u.Fragment,d=wp.components.withSpokenMessages,f=wp.richText,h=f.getTextContent,g=f.applyFormat,m=f.removeFormat,v=f.slice,w=wp.url.isURL,b=wp.blockEditor,y=b.RichTextToolbarButton,k=b.RichTextShortcut,S=wp.components,E=S.Path,_=S.SVG,L=wp.dom.getRectangleFromRange,O=null,C={name:"ta/link",title:s("Affiliate Link"),tagName:"ta",className:null,attributes:{url:"href",target:"target"},edit:d(function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.addLink=e.addLink.bind(e),e.stopAddingLink=e.stopAddingLink.bind(e),e.onRemoveFormat=e.onRemoveFormat.bind(e),e.state={addingLink:!1},e}return r(t,e),l(t,[{key:"addLink",value:function(){var e=this.props,t=e.value,n=e.onChange,i=h(v(t));i&&w(i)?n(g(t,{type:"ta/link",attributes:{url:i}})):this.setState({addingLink:!0})}},{key:"stopAddingLink",value:function(){this.setState({addingLink:!1})}},{key:"onRemoveFormat",value:function(){var e=this.props,t=e.value,n=e.onChange,i=e.speak;n(m(t,"ta/link")),i(s("Affiliate Link removed."),"assertive")}},{key:"getAnchorRect",value:function(){var e=window.getSelection(),t=e.rangeCount>0?e.getRangeAt(0):null;if(t){if(e.anchorNode.nodeType!==window.Node.TEXT_NODE)return O;var n=null;if(this.state.addingLink)n=L(t);else{var i=t.startContainer;for(i=i.nextElementSibling||i;i.nodeType!==window.Node.ELEMENT_NODE;)i=i.parentNode;var o=i.closest("ta");o&&(n=o.getBoundingClientRect())}return O=n,n}}},{key:"render",value:function(){var e=this.props,t=e.isActive,n=e.activeAttributes,i=e.value,o=e.onChange,r=this.getAnchorRect();return wp.element.createElement(p,null,wp.element.createElement(k,{type:"access",character:"s",onUse:this.onRemoveFormat}),wp.element.createElement(k,{type:"primary",character:"l",onUse:this.addLink}),wp.element.createElement(k,{type:"primaryShift",character:"l",onUse:this.onRemoveFormat}),t&&wp.element.createElement(y,{icon:"editor-unlink",title:s("Remove Affiliate Link"),className:"ta-unlink-button",onClick:this.onRemoveFormat,isActive:t,shortcutType:"primaryShift",shortcutCharacter:"l"}),!t&&wp.element.createElement(y,{icon:wp.element.createElement(_,{xmlns:"http://www.w3.org/2000/svg",width:"16.688",height:"9.875",viewBox:"0 0 16.688 9.875"},wp.element.createElement(E,{id:"TA.svg",fill:"black",class:"cls-1",d:"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z",transform:"translate(-1.188 -5.25)"})),title:s("Affiliate Link"),className:"ta-link-button",onClick:this.addLink,shortcutType:"primary",shortcutCharacter:"l"}),wp.element.createElement(a.a,{addingLink:this.state.addingLink,stopAddingLink:this.stopAddingLink,isActive:t,activeAttributes:n,anchorRect:r,value:i,onChange:o}))}}]),t}(c))}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){var t=e.url,n=e.linkid;e.text;return{type:"ta/link",attributes:{url:t,linkid:n.toString()}}}function l(e,t){return e.addingLink||t.editLink}var s=n(0),u=n.n(s),c=n(11),p=n(12),d=n(13),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),h=wp.i18n.__,g=wp.element,m=g.Component,v=g.createRef,w=wp.components,b=w.ExternalLink,y=(w.ToggleControl,w.IconButton),k=w.withSpokenMessages,S=wp.keycodes,E=S.LEFT,_=S.RIGHT,L=S.UP,O=S.DOWN,C=S.BACKSPACE,I=S.ENTER,T=wp.url,R=T.prependHTTP,P=T.safeDecodeURI,A=T.filterURLForDisplay,x=wp.richText,j=x.create,N=x.insert,F=x.isCollapsed,W=x.applyFormat,D=x.getTextContent,V=x.slice,z=function(e){return e.stopPropagation()},H=function(e){var t=e.value,n=e.onChangeInputValue,i=e.onKeyDown,o=e.submitLink,r=e.invalidLink,a=e.resetInvalidLink,l=e.autocompleteRef;return wp.element.createElement("form",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover",onKeyPress:z,onKeyDown:i,onSubmit:o},wp.element.createElement(d.a,{value:t,onChange:n,autocompleteRef:l,invalidLink:r,resetInvalidLink:a}),wp.element.createElement(y,{icon:"editor-break",label:h("Apply"),type:"submit"}))},B=function(e){var t=e.url,n=R(t),i=u()("editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value",{"has-invalid-link":!Object(c.a)(n)});return t?wp.element.createElement(b,{className:i,href:t},A(P(t))):wp.element.createElement("span",{className:i})},U=function(e){var t=e.url,n=e.editLink;return wp.element.createElement("div",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",onKeyPress:z},wp.element.createElement(B,{url:t}),wp.element.createElement(y,{icon:"edit",label:h("Edit"),onClick:n}))},M=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.editLink=e.editLink.bind(e),e.submitLink=e.submitLink.bind(e),e.onKeyDown=e.onKeyDown.bind(e),e.onChangeInputValue=e.onChangeInputValue.bind(e),e.onClickOutside=e.onClickOutside.bind(e),e.resetState=e.resetState.bind(e),e.autocompleteRef=v(),e.resetInvalidLink=e.resetInvalidLink.bind(e),e.state={inputValue:"",linkid:0,post:null,invalidLink:!1},e}return r(t,e),f(t,[{key:"onKeyDown",value:function(e){[E,O,_,L,C,I].indexOf(e.keyCode)>-1&&e.stopPropagation()}},{key:"onChangeInputValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=t?t.id:0;this.setState({inputValue:e,linkid:n,post:t})}},{key:"editLink",value:function(e){this.setState({editLink:!0}),e.preventDefault()}},{key:"submitLink",value:function(e){var t=this.props,n=t.isActive,i=t.value,o=t.onChange,r=t.speak,l=this.state,s=l.inputValue,u=l.linkid,p=l.post,d=R(s),f=D(V(i)),g=a({url:d,linkid:u,text:f});if(e.preventDefault(),!u||!p)return void this.setState({invalidLink:!0});if(F(i)&&!n){var m=W(j({text:p.title}),g,0,d.length);o(N(i,m))}else o(W(i,g));this.resetState(),Object(c.a)(d)?n?r(h("Link edited."),"assertive"):r(h("Link inserted"),"assertive"):r(h("Warning: the link has been inserted but may have errors. Please test it."),"assertive")}},{key:"onClickOutside",value:function(e){var t=this.autocompleteRef.current;t&&t.contains(e.target)||this.resetState()}},{key:"resetState",value:function(){this.props.stopAddingLink(),this.setState({inputValue:"",editLink:!1}),this.resetInvalidLink()}},{key:"resetInvalidLink",value:function(){this.setState({invalidLink:!1})}},{key:"render",value:function(){var e=this.props,t=e.isActive,n=e.activeAttributes,i=n.url,o=(n.linkid,e.addingLink),r=e.anchorRect;e.value,e.onChange;if(!t&&!o)return null;var a=this.state,s=a.inputValue,u=a.invalidLink,c=l(this.props,this.state);return wp.element.createElement(p.a,{onClickOutside:this.onClickOutside,onClose:this.resetState,focusOnMount:!!c&&"firstElement",invalidLink:u,anchorRect:r},c?wp.element.createElement(H,{value:s,onChangeInputValue:this.onChangeInputValue,onKeyDown:this.onKeyDown,submitLink:this.submitLink,autocompleteRef:this.autocompleteRef,updateLinkId:this.updateLinkId,invalidLink:u,resetInvalidLink:this.resetInvalidLink}):wp.element.createElement(U,{url:i,editLink:this.editLink}))}}]),t}(m);t.a=k(M)},function(e,t,n){"use strict";function i(e){if(!e)return!1;var t=e.trim();if(!t)return!1;if(/^\S+:/.test(t)){var n=l(t);if(!s(n))return!1;if(r(n,"http")&&!/^https?:\/\/[^\/\s]/i.test(t))return!1;var i=u(t);if(!c(i))return!1;var o=p(t);if(o&&!d(o))return!1;var a=f(t);if(a&&!h(a))return!1;var v=g(t);if(v&&!m(v))return!1}return!(r(t,"#")&&!m(t))}t.a=i;var o=lodash,r=o.startsWith,a=wp.url,l=a.getProtocol,s=a.isValidProtocol,u=a.getAuthority,c=a.isValidAuthority,p=a.getPath,d=a.isValidPath,f=a.getQueryString,h=a.isValidQueryString,g=a.getFragment,m=a.isValidFragment},function(e,t,n){"use strict";function i(e,t){var n={};for(var i in e)t.indexOf(i)>=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),u=wp.i18n.__,c=wp.element.Component,p=wp.components,d=p.Popover,f=p.IconButton,h=function(e){function t(){o(this,t);var e=r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.toggleSettingsVisibility=e.toggleSettingsVisibility.bind(e),e.state={isSettingsExpanded:!1},e}return a(t,e),s(t,[{key:"toggleSettingsVisibility",value:function(){this.setState({isSettingsExpanded:!this.state.isSettingsExpanded})}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.renderSettings,o=e.invalidLink,r=e.position,a=void 0===r?"bottom center":r,s=e.focusOnMount,c=void 0===s?"firstElement":s,p=i(e,["children","renderSettings","invalidLink","position","focusOnMount"]),h=this.state.isSettingsExpanded,g=!!n&&h;return wp.element.createElement(d,l({className:"ta-url-popover editor-url-popover block-editor-url-popover",focusOnMount:c,position:a},p),wp.element.createElement("div",{className:"editor-url-popover__row"},t,!!n&&wp.element.createElement(f,{className:"editor-url-popover__settings-toggle",icon:"ellipsis",label:u("Link Settings"),onClick:this.toggleSettingsVisibility,"aria-expanded":h})),g&&wp.element.createElement("div",{className:"editor-url-popover__row editor-url-popover__settings"},n()),o&&wp.element.createElement("div",{class:"ta-invalid-link"},u("Invalid affiliate link")))}}]),t}(c);t.a=h},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(0),l=n.n(a),s=n(14),u=n.n(s),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),p=wp.i18n.__,d=lodash,f=d.throttle,h=wp.element,g=h.Component,m=h.createRef,v=wp.keycodes,w=v.UP,b=v.DOWN,y=v.ENTER,k=v.TAB,S=wp.components,E=S.Spinner,_=S.withSpokenMessages,L=S.Popover,O=wp.compose.withInstanceId,C=function(e){return e.stopPropagation()},I=function(e){function t(e){var n=e.autocompleteRef;i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return r.onChange=r.onChange.bind(r),r.onKeyDown=r.onKeyDown.bind(r),r.autocompleteRef=n||m(),r.inputRef=m(),r.updateSuggestions=f(r.updateSuggestions.bind(r),200),r.suggestionNodes=[],r.state={posts:[],showSuggestions:!1,selectedSuggestion:null},r}return r(t,e),c(t,[{key:"componentDidUpdate",value:function(){var e=this,t=this.state,n=t.showSuggestions,i=t.selectedSuggestion;n&&null!==i&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,u()(this.suggestionNodes[i],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),setTimeout(function(){e.scrollingIntoView=!1},100))}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest}},{key:"bindSuggestionNode",value:function(e){var t=this;return function(n){t.suggestionNodes[e]=n}}},{key:"updateSuggestions",value:function(e){var t=this;if(e.length<2||/^https?:/.test(e))return void this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});this.setState({showSuggestions:!0,selectedSuggestion:null,loading:!0});var n=new FormData;n.append("action","search_affiliate_links_query"),n.append("keyword",e),n.append("paged",1),n.append("gutenberg",!0);var i=fetch(ajaxurl,{method:"POST",body:n});i.then(function(e){return e.json()}).then(function(e){if(e.affiliate_links){var n=e.affiliate_links;t.suggestionsRequest===i&&(t.setState({posts:n,loading:!1}),n.length?t.props.debouncedSpeak(sprintf(_n("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",n.length),n.length),"assertive"):t.props.debouncedSpeak(p("No results."),"assertive"))}}).catch(function(){t.suggestionsRequest===i&&t.setState({loading:!1})}),this.suggestionsRequest=i}},{key:"onChange",value:function(e){this.props.resetInvalidLink();var t=e.target.value;this.props.onChange(t),this.updateSuggestions(t)}},{key:"onKeyDown",value:function(e){var t=this.state,n=t.showSuggestions,i=t.selectedSuggestion,o=t.posts,r=t.loading;if(n&&o.length&&!r){var a=this.state.posts[this.state.selectedSuggestion];switch(e.keyCode){case w:e.stopPropagation(),e.preventDefault();var l=i?i-1:o.length-1;this.setState({selectedSuggestion:l});break;case b:e.stopPropagation(),e.preventDefault();var s=null===i||i===o.length-1?0:i+1;this.setState({selectedSuggestion:s});break;case k:null!==this.state.selectedSuggestion&&(this.selectLink(a),this.props.speak(p("Link selected")));break;case y:null!==this.state.selectedSuggestion&&(e.stopPropagation(),this.selectLink(a))}}else switch(e.keyCode){case w:0!==e.target.selectionStart&&(e.stopPropagation(),e.preventDefault(),e.target.setSelectionRange(0,0));break;case b:this.props.value.length!==e.target.selectionStart&&(e.stopPropagation(),e.preventDefault(),e.target.setSelectionRange(this.props.value.length,this.props.value.length))}}},{key:"selectLink",value:function(e){this.props.onChange(e.link,e),this.setState({selectedSuggestion:null,showSuggestions:!1})}},{key:"handleOnClick",value:function(e){this.selectLink(e),this.inputRef.current.focus()}},{key:"render",value:function(){var e=this,t=this.props,n=t.value,i=void 0===n?"":n,o=t.autoFocus,r=void 0===o||o,a=t.instanceId,s=t.invalidLink,u=this.state,c=u.showSuggestions,d=u.posts,f=u.selectedSuggestion,h=u.loading;return wp.element.createElement("div",{className:"editor-url-input block-editor-url-input"},wp.element.createElement("input",{autoFocus:r,type:"text","aria-label":p("URL"),required:!0,value:i,onChange:this.onChange,onInput:C,placeholder:p("Paste URL or type to search"),onKeyDown:this.onKeyDown,role:"combobox","aria-expanded":c,"aria-autocomplete":"list","aria-owns":"editor-url-input-suggestions-"+a,"aria-activedescendant":null!==f?"editor-url-input-suggestion-"+a+"-"+f:void 0,ref:this.inputRef}),h&&wp.element.createElement(E,null),c&&!!d.length&&!s&&wp.element.createElement(L,{position:"bottom",noArrow:!0,focusOnMount:!1},wp.element.createElement("div",{className:"editor-url-input__suggestions block-editor-url-input__suggestions",id:"editor-url-input-suggestions-"+a,ref:this.autocompleteRef,role:"listbox"},d.map(function(t,n){return wp.element.createElement("button",{key:t.id,role:"option",tabIndex:"-1",id:"block-editor-url-input-suggestion-"+a+"-"+n,ref:e.bindSuggestionNode(n),className:l()("editor-url-input__suggestion block-editor-url-input__suggestion",{"is-selected":n===f}),onClick:function(){return e.handleOnClick(t)},"aria-selected":n===f},t.title||p("(no title)"))}))))}}]),t}(g);t.a=_(O(I))},function(e,t,n){"use strict";e.exports=n(15)},function(e,t,n){"use strict";function i(e,t,n){n=n||{},9===t.nodeType&&(t=o.getWindow(t));var i=n.allowHorizontalScroll,r=n.onlyScrollIfNeeded,a=n.alignWithTop,l=n.alignWithLeft,s=n.offsetTop||0,u=n.offsetLeft||0,c=n.offsetBottom||0,p=n.offsetRight||0;i=void 0===i||i;var d=o.isWindow(t),f=o.offset(e),h=o.outerHeight(e),g=o.outerWidth(e),m=void 0,v=void 0,w=void 0,b=void 0,y=void 0,k=void 0,S=void 0,E=void 0,_=void 0,L=void 0;d?(S=t,L=o.height(S),_=o.width(S),E={left:o.scrollLeft(S),top:o.scrollTop(S)},y={left:f.left-E.left-u,top:f.top-E.top-s},k={left:f.left+g-(E.left+_)+p,top:f.top+h-(E.top+L)+c},b=E):(m=o.offset(t),v=t.clientHeight,w=t.clientWidth,b={left:t.scrollLeft,top:t.scrollTop},y={left:f.left-(m.left+(parseFloat(o.css(t,"borderLeftWidth"))||0))-u,top:f.top-(m.top+(parseFloat(o.css(t,"borderTopWidth"))||0))-s},k={left:f.left+g-(m.left+w+(parseFloat(o.css(t,"borderRightWidth"))||0))+p,top:f.top+h-(m.top+v+(parseFloat(o.css(t,"borderBottomWidth"))||0))+c}),y.top<0||k.top>0?!0===a?o.scrollTop(t,b.top+y.top):!1===a?o.scrollTop(t,b.top+k.top):y.top<0?o.scrollTop(t,b.top+y.top):o.scrollTop(t,b.top+k.top):r||(a=void 0===a||!!a,a?o.scrollTop(t,b.top+y.top):o.scrollTop(t,b.top+k.top)),i&&(y.left<0||k.left>0?!0===l?o.scrollLeft(t,b.left+y.left):!1===l?o.scrollLeft(t,b.left+k.left):y.left<0?o.scrollLeft(t,b.left+y.left):o.scrollLeft(t,b.left+k.left):r||(l=void 0===l||!!l,l?o.scrollLeft(t,b.left+y.left):o.scrollLeft(t,b.left+k.left)))}var o=n(16);e.exports=i},function(e,t,n){"use strict";function i(e){var t=void 0,n=void 0,i=void 0,o=e.ownerDocument,r=o.body,a=o&&o.documentElement;return t=e.getBoundingClientRect(),n=t.left,i=t.top,n-=a.clientLeft||r.clientLeft||0,i-=a.clientTop||r.clientTop||0,{left:n,top:i}}function o(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],i="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;n=o.documentElement[i],"number"!=typeof n&&(n=o.body[i])}return n}function r(e){return o(e)}function a(e){return o(e,!0)}function l(e){var t=i(e),n=e.ownerDocument,o=n.defaultView||n.parentWindow;return t.left+=r(o),t.top+=a(o),t}function s(e,t,n){var i="",o=e.ownerDocument,r=n||o.defaultView.getComputedStyle(e,null);return r&&(i=r.getPropertyValue(t)||r[t]),i}function u(e,t){var n=e[_]&&e[_][t];if(S.test(n)&&!E.test(t)){var i=e.style,o=i[O],r=e[L][O];e[L][O]=e[_][O],i[O]="fontSize"===t?"1em":n||0,n=i.pixelLeft+C,i[O]=o,e[L][O]=r}return""===n?"auto":n}function c(e,t){for(var n=0;n<e.length;n++)t(e[n])}function p(e){return"border-box"===I(e,"boxSizing")}function d(e,t,n){var i={},o=e.style,r=void 0;for(r in t)t.hasOwnProperty(r)&&(i[r]=o[r],o[r]=t[r]);n.call(e);for(r in t)t.hasOwnProperty(r)&&(o[r]=i[r])}function f(e,t,n){var i=0,o=void 0,r=void 0,a=void 0;for(r=0;r<t.length;r++)if(o=t[r])for(a=0;a<n.length;a++){var l=void 0;l="border"===o?o+n[a]+"Width":o+n[a],i+=parseFloat(I(e,l))||0}return i}function h(e){return null!=e&&e==e.window}function g(e,t,n){if(h(e))return"width"===t?x.viewportWidth(e):x.viewportHeight(e);if(9===e.nodeType)return"width"===t?x.docWidth(e):x.docHeight(e);var i="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,r=I(e),a=p(e,r),l=0;(null==o||o<=0)&&(o=void 0,l=I(e,t),(null==l||Number(l)<0)&&(l=e.style[t]||0),l=parseFloat(l)||0),void 0===n&&(n=a?A:R);var s=void 0!==o||a,u=o||l;if(n===R)return s?u-f(e,["border","padding"],i,r):l;if(s){var c=n===P?-f(e,["border"],i,r):f(e,["margin"],i,r);return u+(n===A?0:c)}return l+f(e,T.slice(n),i,r)}function m(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=g.apply(void 0,n):d(e,j,function(){t=g.apply(void 0,n)}),t}function v(e,t,n){var i=n;{if("object"!==(void 0===t?"undefined":y(t)))return void 0!==i?("number"==typeof i&&(i+="px"),void(e.style[t]=i)):I(e,t);for(var o in t)t.hasOwnProperty(o)&&v(e,o,t[o])}}function w(e,t){"static"===v(e,"position")&&(e.style.position="relative");var n=l(e),i={},o=void 0,r=void 0;for(r in t)t.hasOwnProperty(r)&&(o=parseFloat(v(e,r))||0,i[r]=o+t[r]-n[r]);v(e,i)}var b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},k=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,S=new RegExp("^("+k+")(?!px)[a-z%]+$","i"),E=/^(top|right|bottom|left)$/,_="currentStyle",L="runtimeStyle",O="left",C="px",I=void 0;"undefined"!=typeof window&&(I=window.getComputedStyle?s:u);var T=["margin","border","padding"],R=-1,P=2,A=1,x={};c(["Width","Height"],function(e){x["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],x["viewport"+e](n))},x["viewport"+e]=function(t){var n="client"+e,i=t.document,o=i.body,r=i.documentElement,a=r[n];return"CSS1Compat"===i.compatMode&&a||o&&o[n]||a}});var j={position:"absolute",visibility:"hidden",display:"block"};c(["width","height"],function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);x["outer"+t]=function(t,n){return t&&m(t,e,n?0:A)};var n="width"===e?["Left","Right"]:["Top","Bottom"];x[e]=function(t,i){if(void 0===i)return t&&m(t,e,R);if(t){var o=I(t);return p(t)&&(i+=f(t,["padding","border"],n,o)),v(t,e,i)}}}),e.exports=b({getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return l(e);w(e,t)},isWindow:h,each:c,css:v,clone:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);if(e.overflow)for(var n in e)e.hasOwnProperty(n)&&(t.overflow[n]=e.overflow[n]);return t},scrollLeft:function(e,t){if(h(e)){if(void 0===t)return r(e);window.scrollTo(t,a(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(h(e)){if(void 0===t)return a(e);window.scrollTo(r(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},viewportWidth:0,viewportHeight:0},x)},function(e,t){}]);
|
7 |
//# sourceMappingURL=gutenberg-support.js.map
|
js/app/gutenberg_support/dist/gutenberg-support.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["webpack:///gutenberg-support.js","webpack:///webpack/bootstrap 75d5f816076e5891d65a","webpack:///./node_modules/classnames/index.js","webpack:///./src/index.js","webpack:///./src/blocks/index.js","webpack:///./src/blocks/ta-image/index.js","webpack:///./src/blocks/ta-image/edit.js","webpack:///./src/blocks/ta-image/util.js","webpack:///./src/blocks/ta-image/image-size.js","webpack:///./src/blocks/ta-image/search-input.js","webpack:///./src/formats/index.js","webpack:///./src/formats/ta-link/index.js","webpack:///./src/formats/ta-link/inline.js","webpack:///./src/formats/ta-link/utils.js","webpack:///./src/formats/ta-link/url-popover.js","webpack:///./src/formats/ta-link/url-input.js","webpack:///./node_modules/dom-scroll-into-view/lib/index.js","webpack:///./node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js","webpack:///./node_modules/dom-scroll-into-view/lib/util.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","classNames","classes","arguments","length","arg","argType","push","Array","isArray","inner","apply","key","hasOwn","join","default","undefined","__webpack_exports__","value","__WEBPACK_IMPORTED_MODULE_0__blocks__","__WEBPACK_IMPORTED_MODULE_1__formats__","__WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__","registerBlocks","registerFormats","taimage","forEach","block","settings","registerBlockType","__WEBPACK_IMPORTED_MODULE_0__ta_image__","wp","blocks","_defineProperty","obj","writable","__WEBPACK_IMPORTED_MODULE_0_classnames__","__WEBPACK_IMPORTED_MODULE_0_classnames___default","__WEBPACK_IMPORTED_MODULE_1__edit__","Fragment","element","__","i18n","_wp$blocks","getPhrasingContentSchema","createBlock","getBlockAttributes","RichText","editor","_wp$components","components","Path","SVG","blockAttributes","url","type","source","selector","attribute","alt","caption","id","align","width","height","linkid","href","affiliateLink","imageSchema","img","attributes","title","description","icon","createElement","viewBox","xmlns","fill","category","keywords","getEditWrapperProps","data-align","data-resized","edit","save","_ref","_classnames","classnames","image","src","className","figure","Content","tagName","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","constructor","setPrototypeOf","__proto__","__WEBPACK_IMPORTED_MODULE_1__util__","__WEBPACK_IMPORTED_MODULE_2__image_size__","__WEBPACK_IMPORTED_MODULE_3__search_input__","_extends","assign","target","_slicedToArray","sliceIterator","arr","_arr","_n","_d","_e","_s","_i","Symbol","iterator","next","done","err","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_lodash","lodash","isEmpty","map","last","pick","compact","getPath","_wp$i18n","sprintf","_wp$element","Component","createRef","_wp$blob","blob","getBlobByURL","revokeBlobURL","isBlobURL","Placeholder","Button","ButtonGroup","IconButton","PanelBody","ResizableBox","SelectControl","Spinner","TextControl","TextareaControl","Toolbar","withNotices","withSelect","ToggleControl","Popover","data","_wp$editor","BlockControls","InspectorControls","BlockAlignmentToolbar","MediaUpload","MediaUploadCheck","MediaPlaceholder","mediaUpload","withViewportMatch","viewport","compose","ALLOWED_MEDIA_TYPES","pickRelevantMediaFiles","imageProps","isTemporaryImage","isExternalImage","ImageEdit","_Component","this","_this","getPrototypeOf","updateAlt","bind","updateAlignment","onFocusCaption","onImageClick","onSelectImage","updateImageURL","updateWidth","updateHeight","updateDimensions","getFilename","toggleIsEditing","onImageError","onChangeInputValue","autocompleteRef","resetInvalidLink","updateImageSelection","onSelectAffiliateImage","editAFfiliateImage","state","captionFocused","isEditing","inputValue","post","showSuggestions","imageSelection","_this2","_props","setAttributes","noticeOperations","_attributes$url","file","filesList","onFileChange","_ref2","_ref3","allowedTypes","onError","message","createErrorNotice","setState","prevProps","_prevProps$attributes","prevID","_prevProps$attributes2","prevURL","_props$attributes","_props$attributes$url","isSelected","media","link","embedBlock","createUpgradedEmbedBlock","onReplace","newAlt","nextAlign","extraUpdatedAttributes","indexOf","parseInt","_this3","path","split","label","_props2","imageSizes","_ref4","slug","sizeUrl","invalidLink","_this4","apiFetch","addQueryArgs","context","_locale","then","source_url","images","_this5","_state","_props3","isLargeViewport","maxWidth","toggleSelection","isRTL","linkDestination","toolbarEditButton","onClick","controls","onChange","instructions","index","wp-block-image","is-transient","is-resized","is-focused","isResizable","imageSizeOptions","getImageSizeOptions","getInspectorControls","imageWidth","imageHeight","help","options","placeholder","min","aria-label","scale","scaledWidth","Math","round","scaledHeight","isCurrent","isSmall","isPrimary","aria-pressed","dirtynessTrigger","sizes","imageWidthWithinContainer","imageHeightWithinContainer","filename","defaultedAlt","style","currentWidth","currentHeight","ratio","minWidth","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","size","maxHeight","lockAspectRatio","enable","top","right","bottom","left","onResizeStart","onResizeStop","event","direction","elt","delta","unstableOnFocus","inlineToolbar","select","_select","getMedia","_select2","getEditorSettings","_getEditorSettings","includes","renderToString","attributesFromPreview","preview","matchingBlock","findBlock","DEFAULT_EMBED_BLOCK","html","isFromWordPress","noop","withGlobalEvents","ImageSize","bindContainer","calculateSize","ref","container","fetchImageSize","onload","window","Image","clientWidth","exceedMaxWidth","containerWidth","containerHeight","clientHeight","children","resize","withSpokenMessages","withInstanceId","ThirstyURLInput","inputRef","searchAffiliateLinks","suggestionNodes","posts","selectedSuggestion","loading","scrollingIntoView","scrollIntoView","current","onlyScrollIfNeeded","setTimeout","suggestionsRequest","formData","FormData","append","request","fetch","ajaxurl","method","body","response","json","affiliate_links","debouncedSpeak","catch","selectLink","instanceId","autoFocus","_state2","class","onSubmit","displayAffiliateImages","autocomplete","position","focusOnMount","role","tabIndex","bindSuggestionNode","is-selected","handleOnClick","aria-selected","_objectWithoutProperties","keys","taLink","registerFormatType","__WEBPACK_IMPORTED_MODULE_0__ta_link__","richText","__WEBPACK_IMPORTED_MODULE_0__inline__","_wp$richText","getTextContent","applyFormat","removeFormat","slice","isURL","RichTextToolbarButton","RichTextShortcut","getRectangleFromRange","dom","LinkEdit","addLink","stopAddingLink","onRemoveFormat","addingLink","text","speak","selection","getSelection","range","rangeCount","getRangeAt","rect","startContainer","nextElementSibling","nodeType","Node","ELEMENT_NODE","parentNode","closest","getBoundingClientRect","isActive","activeAttributes","anchorRect","getAnchorRect","character","onUse","shortcutType","shortcutCharacter","transform","createLinkFormat","toString","isShowingInput","editLink","__WEBPACK_IMPORTED_MODULE_1__utils__","__WEBPACK_IMPORTED_MODULE_2__url_popover__","__WEBPACK_IMPORTED_MODULE_3__url_input__","ExternalLink","_wp$keycodes","keycodes","LEFT","RIGHT","UP","DOWN","BACKSPACE","ENTER","_wp$url","prependHTTP","safeDecodeURI","filterURLForDisplay","insert","isCollapsed","stopKeyPropagation","stopPropagation","LinkEditor","onKeyDown","submitLink","onKeyPress","LinkViewerUrl","prependedURL","linkClassName","has-invalid-link","isValidHref","LinkViewer","InlineAffiliateLinkUI","onClickOutside","resetState","keyCode","preventDefault","selectedText","format","toInsert","autocompleteElement","contains","_props2$activeAttribu","showInput","onClose","updateLinkId","trimmedHref","trim","test","protocol","getProtocol","isValidProtocol","startsWith","authority","getAuthority","isValidAuthority","isValidPath","queryString","getQueryString","isValidQueryString","fragment","getFragment","isValidFragment","ThirstyURLPopover","toggleSettingsVisibility","isSettingsExpanded","renderSettings","_props$position","_props$focusOnMount","popoverProps","showSettings","aria-expanded","__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__","__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default","throttle","TAB","stopEventPropagation","updateSuggestions","previousIndex","nextIndex","selectionStart","setSelectionRange","focus","_props$value","_props$autoFocus","_state3","required","onInput","aria-autocomplete","aria-owns","aria-activedescendant","noArrow","elem","config","util","getWindow","allowHorizontalScroll","alignWithTop","alignWithLeft","offsetTop","offsetLeft","offsetBottom","offsetRight","isWin","isWindow","elemOffset","offset","eh","outerHeight","ew","outerWidth","containerOffset","ch","cw","containerScroll","diffTop","diffBottom","win","winScroll","ww","wh","scrollLeft","scrollTop","parseFloat","css","getClientPosition","box","x","y","doc","ownerDocument","docElem","documentElement","clientLeft","clientTop","getScroll","w","ret","document","getScrollLeft","getScrollTop","getOffset","el","pos","defaultView","parentWindow","_getComputedStyle","computedStyle_","val","computedStyle","getComputedStyle","getPropertyValue","_getComputedStyleIE","CURRENT_STYLE","_RE_NUM_NO_PX","RE_POS","rsLeft","RUNTIME_STYLE","pixelLeft","PX","each","fn","isBorderBoxFn","getComputedStyleX","swap","callback","old","getPBMWidth","which","prop","j","cssProp","getWH","extra","domUtils","viewportWidth","viewportHeight","docWidth","docHeight","borderBoxValue","offsetWidth","offsetHeight","isBorderBox","cssBoxValue","Number","BORDER_INDEX","CONTENT_INDEX","borderBoxValueOrIsBorderBox","padding","PADDING_INDEX","BOX_MODELS","getWHIgnoreDisplay","args","cssShow","v","_typeof","setOffset","RE_NUM","RegExp","refWin","max","documentElementProp","compatMode","visibility","display","first","charAt","toUpperCase","includeMargin","node","clone","overflow","scrollTo"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,E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ACL,OAAA9nB,KAAA8nB,EACA,MAAA1D,GAAAd,SAEAc,GAAAd,UAAAwE,IAIAnB,cAAA,EACAC,eAAA,GACCF,IlBgmGK,SAAUlpB,EAAQD","file":"gutenberg-support.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 1);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (true) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n\t\t\treturn classNames;\n\t\t}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__blocks__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__formats__ = __webpack_require__(8);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__ = __webpack_require__(17);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__);\n\n\n\n\n\nObject(__WEBPACK_IMPORTED_MODULE_0__blocks__[\"a\" /* default */])();\nObject(__WEBPACK_IMPORTED_MODULE_1__formats__[\"a\" /* default */])();\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = registerBlocks;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ta_image__ = __webpack_require__(3);\n\n\nvar registerBlockType = wp.blocks.registerBlockType;\n\n/**\n * Register gutenberg blocks.\n * \n * @since 3.6\n */\n\nfunction registerBlocks() {\n\n [__WEBPACK_IMPORTED_MODULE_0__ta_image__].forEach(function (block) {\n if (!block) return;\n\n var name = block.name,\n settings = block.settings;\n\n registerBlockType(name, settings);\n });\n}\n\n/***/ }),\n/* 3 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"name\", function() { return name; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"settings\", function() { return settings; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__edit__ = __webpack_require__(4);\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\nvar Fragment = wp.element.Fragment;\nvar __ = wp.i18n.__;\nvar _wp$blocks = wp.blocks,\n createBlock = _wp$blocks.createBlock,\n getBlockAttributes = _wp$blocks.getBlockAttributes,\n getPhrasingContentSchema = _wp$blocks.getPhrasingContentSchema;\nvar RichText = wp.editor.RichText;\nvar _wp$components = wp.components,\n Path = _wp$components.Path,\n SVG = _wp$components.SVG;\n\n\n\n\nvar name = 'ta/image';\n\nvar blockAttributes = {\n\turl: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'src'\n\t},\n\talt: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'alt',\n\t\tdefault: ''\n\t},\n\tcaption: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'figcaption'\n\t},\n\tid: {\n\t\ttype: 'number'\n\t},\n\talign: {\n\t\ttype: 'string'\n\t},\n\twidth: {\n\t\ttype: 'number'\n\t},\n\theight: {\n\t\ttype: 'number'\n\t},\n\tlinkid: {\n\t\ttype: 'number'\n\t},\n\thref: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'ta',\n\t\tattribute: 'href'\n\t},\n\taffiliateLink: {\n\t\ttype: 'object'\n\t}\n};\n\nvar imageSchema = {\n\timg: {\n\t\tattributes: ['src', 'alt'],\n\t\tclasses: ['alignleft', 'aligncenter', 'alignright', 'alignnone', /^wp-image-\\d+$/]\n\t}\n};\n\nvar schema = {\n\tfigure: {\n\t\trequire: ['ta', 'img'],\n\t\tchildren: {\n\t\t\tta: {\n\t\t\t\tattributes: ['href', 'linkid'],\n\t\t\t\tchildren: imageSchema\n\t\t\t},\n\t\t\tfigcaption: {\n\t\t\t\tchildren: getPhrasingContentSchema()\n\t\t\t}\n\t\t}\n\t}\n};\n\nfunction getFirstAnchorAttributeFormHTML(html, attributeName) {\n\tvar _document$implementat = document.implementation.createHTMLDocument(''),\n\t body = _document$implementat.body;\n\n\tbody.innerHTML = html;\n\n\tvar firstElementChild = body.firstElementChild;\n\n\n\tif (firstElementChild && firstElementChild.nodeName === 'A') {\n\t\treturn firstElementChild.getAttribute(attributeName) || undefined;\n\t}\n}\n\nvar settings = {\n\ttitle: __('ThirstyAffiliates Image'),\n\n\tdescription: __('Insert an image with an affiliate link to make a visual statement.'),\n\n\ticon: wp.element.createElement(\n\t\tSVG,\n\t\t{ viewBox: \"0 0 24 24\", xmlns: \"http://www.w3.org/2000/svg\" },\n\t\twp.element.createElement(Path, { d: \"M0,0h24v24H0V0z\", fill: \"none\" }),\n\t\twp.element.createElement(Path, { d: \"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" }),\n\t\twp.element.createElement(Path, { d: \"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" })\n\t),\n\n\tcategory: 'common',\n\n\tkeywords: ['img', // \"img\" is not translated as it is intended to reflect the HTML <img> tag.\n\t__('photo'), __('affiliate')],\n\n\tattributes: blockAttributes,\n\n\tgetEditWrapperProps: function getEditWrapperProps(attributes) {\n\t\tvar align = attributes.align,\n\t\t width = attributes.width;\n\n\t\tif ('left' === align || 'center' === align || 'right' === align || 'wide' === align || 'full' === align) {\n\t\t\treturn { 'data-align': align, 'data-resized': !!width };\n\t\t}\n\t},\n\n\n\tedit: __WEBPACK_IMPORTED_MODULE_1__edit__[\"a\" /* default */],\n\n\tsave: function save(_ref) {\n\t\tvar _classnames;\n\n\t\tvar attributes = _ref.attributes;\n\t\tvar url = attributes.url,\n\t\t alt = attributes.alt,\n\t\t caption = attributes.caption,\n\t\t align = attributes.align,\n\t\t width = attributes.width,\n\t\t height = attributes.height,\n\t\t id = attributes.id,\n\t\t linkid = attributes.linkid,\n\t\t href = attributes.href;\n\n\n\t\tvar classes = __WEBPACK_IMPORTED_MODULE_0_classnames___default()((_classnames = {}, _defineProperty(_classnames, \"align\" + align, align), _defineProperty(_classnames, 'is-resized', width || height), _classnames));\n\n\t\tvar image = wp.element.createElement(\"img\", {\n\t\t\tsrc: url,\n\t\t\talt: alt,\n\t\t\tclassName: id ? \"wp-image-\" + id : null,\n\t\t\twidth: width,\n\t\t\theight: height\n\t\t});\n\n\t\tvar figure = wp.element.createElement(\n\t\t\tFragment,\n\t\t\tnull,\n\t\t\twp.element.createElement(\n\t\t\t\t\"ta\",\n\t\t\t\t{ linkid: linkid, href: href },\n\t\t\t\timage\n\t\t\t),\n\t\t\twp.element.createElement(RichText.Content, { tagName: \"figcaption\", value: caption })\n\t\t);\n\n\t\tif ('left' === align || 'right' === align || 'center' === align) {\n\t\t\treturn wp.element.createElement(\n\t\t\t\t\"div\",\n\t\t\t\t{ className: \"wp-block-image\" },\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"figure\",\n\t\t\t\t\t{ className: classes },\n\t\t\t\t\tfigure\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\treturn wp.element.createElement(\n\t\t\t\"figure\",\n\t\t\t{ className: \"wp-block-image \" + classes },\n\t\t\tfigure\n\t\t);\n\t}\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* unused harmony export pickRelevantMediaFiles */\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__image_size__ = __webpack_require__(6);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__search_input__ = __webpack_require__(7);\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar _lodash = lodash,\n get = _lodash.get,\n isEmpty = _lodash.isEmpty,\n map = _lodash.map,\n last = _lodash.last,\n pick = _lodash.pick,\n compact = _lodash.compact;\nvar getPath = wp.url.getPath;\nvar _wp$i18n = wp.i18n,\n __ = _wp$i18n.__,\n sprintf = _wp$i18n.sprintf;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment,\n createRef = _wp$element.createRef;\nvar _wp$blob = wp.blob,\n getBlobByURL = _wp$blob.getBlobByURL,\n revokeBlobURL = _wp$blob.revokeBlobURL,\n isBlobURL = _wp$blob.isBlobURL;\nvar _wp$components = wp.components,\n Placeholder = _wp$components.Placeholder,\n Button = _wp$components.Button,\n ButtonGroup = _wp$components.ButtonGroup,\n IconButton = _wp$components.IconButton,\n PanelBody = _wp$components.PanelBody,\n ResizableBox = _wp$components.ResizableBox,\n SelectControl = _wp$components.SelectControl,\n Spinner = _wp$components.Spinner,\n TextControl = _wp$components.TextControl,\n TextareaControl = _wp$components.TextareaControl,\n Toolbar = _wp$components.Toolbar,\n withNotices = _wp$components.withNotices,\n ToggleControl = _wp$components.ToggleControl,\n Popover = _wp$components.Popover;\nvar withSelect = wp.data.withSelect;\nvar _wp$editor = wp.editor,\n RichText = _wp$editor.RichText,\n BlockControls = _wp$editor.BlockControls,\n InspectorControls = _wp$editor.InspectorControls,\n MediaUpload = _wp$editor.MediaUpload,\n MediaUploadCheck = _wp$editor.MediaUploadCheck,\n MediaPlaceholder = _wp$editor.MediaPlaceholder,\n BlockAlignmentToolbar = _wp$editor.BlockAlignmentToolbar,\n mediaUpload = _wp$editor.mediaUpload;\nvar withViewportMatch = wp.viewport.withViewportMatch;\nvar compose = wp.compose.compose;\n\n\n\n\n\n\n/**\n * Module constants\n */\nvar MIN_SIZE = 20;\nvar LINK_DESTINATION_NONE = 'none';\nvar LINK_DESTINATION_MEDIA = 'media';\nvar LINK_DESTINATION_ATTACHMENT = 'attachment';\nvar LINK_DESTINATION_CUSTOM = 'custom';\nvar NEW_TAB_REL = 'noreferrer noopener';\nvar ALLOWED_MEDIA_TYPES = ['image'];\n\nvar pickRelevantMediaFiles = function pickRelevantMediaFiles(image) {\n\tvar imageProps = pick(image, ['alt', 'id', 'link', 'caption']);\n\timageProps.url = get(image, ['sizes', 'large', 'url']) || get(image, ['media_details', 'sizes', 'large', 'source_url']) || image.url;\n\treturn imageProps;\n};\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\n * while the image is being uploaded and will not have an id yet allocated.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the URL a Blob URL\n */\nvar isTemporaryImage = function isTemporaryImage(id, url) {\n\treturn !id && isBlobURL(url);\n};\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no id\n * and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nvar isExternalImage = function isExternalImage(id, url) {\n\treturn url && !id && !isBlobURL(url);\n};\n\nvar ImageEdit = function (_Component) {\n\t_inherits(ImageEdit, _Component);\n\n\tfunction ImageEdit(_ref) {\n\t\tvar attributes = _ref.attributes;\n\n\t\t_classCallCheck(this, ImageEdit);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ImageEdit.__proto__ || Object.getPrototypeOf(ImageEdit)).apply(this, arguments));\n\n\t\t_this.updateAlt = _this.updateAlt.bind(_this);\n\t\t_this.updateAlignment = _this.updateAlignment.bind(_this);\n\t\t_this.onFocusCaption = _this.onFocusCaption.bind(_this);\n\t\t_this.onImageClick = _this.onImageClick.bind(_this);\n\t\t_this.onSelectImage = _this.onSelectImage.bind(_this);\n\t\t_this.updateImageURL = _this.updateImageURL.bind(_this);\n\t\t_this.updateWidth = _this.updateWidth.bind(_this);\n\t\t_this.updateHeight = _this.updateHeight.bind(_this);\n\t\t_this.updateDimensions = _this.updateDimensions.bind(_this);\n\t\t_this.getFilename = _this.getFilename.bind(_this);\n\t\t_this.toggleIsEditing = _this.toggleIsEditing.bind(_this);\n\t\t_this.onImageError = _this.onImageError.bind(_this);\n\t\t_this.onChangeInputValue = _this.onChangeInputValue.bind(_this);\n\t\t_this.autocompleteRef = createRef();\n\t\t_this.resetInvalidLink = _this.resetInvalidLink.bind(_this);\n\t\t_this.updateImageSelection = _this.updateImageSelection.bind(_this);\n\t\t_this.onSelectAffiliateImage = _this.onSelectAffiliateImage.bind(_this);\n\t\t_this.editAFfiliateImage = _this.editAFfiliateImage.bind(_this);\n\n\t\t_this.state = {\n\t\t\tcaptionFocused: false,\n\t\t\tisEditing: !attributes.url,\n\t\t\tinputValue: '',\n\t\t\tlinkid: 0,\n\t\t\tpost: null,\n\t\t\tshowSuggestions: false,\n\t\t\timageSelection: [],\n\t\t\taffiliateLink: null\n\t\t};\n\t\treturn _this;\n\t}\n\n\t_createClass(ImageEdit, [{\n\t\tkey: \"componentDidMount\",\n\t\tvalue: function componentDidMount() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t attributes = _props.attributes,\n\t\t\t setAttributes = _props.setAttributes,\n\t\t\t noticeOperations = _props.noticeOperations;\n\t\t\tvar id = attributes.id,\n\t\t\t _attributes$url = attributes.url,\n\t\t\t url = _attributes$url === undefined ? '' : _attributes$url;\n\n\n\t\t\tif (isTemporaryImage(id, url)) {\n\t\t\t\tvar file = getBlobByURL(url);\n\n\t\t\t\tif (file) {\n\t\t\t\t\tmediaUpload({\n\t\t\t\t\t\tfilesList: [file],\n\t\t\t\t\t\tonFileChange: function onFileChange(_ref2) {\n\t\t\t\t\t\t\tvar _ref3 = _slicedToArray(_ref2, 1),\n\t\t\t\t\t\t\t image = _ref3[0];\n\n\t\t\t\t\t\t\tsetAttributes(pickRelevantMediaFiles(image));\n\t\t\t\t\t\t},\n\t\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t\t\tonError: function onError(message) {\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice(message);\n\t\t\t\t\t\t\t_this2.setState({ isEditing: true });\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"componentDidUpdate\",\n\t\tvalue: function componentDidUpdate(prevProps) {\n\t\t\tvar _prevProps$attributes = prevProps.attributes,\n\t\t\t prevID = _prevProps$attributes.id,\n\t\t\t _prevProps$attributes2 = _prevProps$attributes.url,\n\t\t\t prevURL = _prevProps$attributes2 === undefined ? '' : _prevProps$attributes2;\n\t\t\tvar _props$attributes = this.props.attributes,\n\t\t\t id = _props$attributes.id,\n\t\t\t _props$attributes$url = _props$attributes.url,\n\t\t\t url = _props$attributes$url === undefined ? '' : _props$attributes$url;\n\n\n\t\t\tif (isTemporaryImage(prevID, prevURL) && !isTemporaryImage(id, url)) {\n\t\t\t\trevokeBlobURL(url);\n\t\t\t}\n\n\t\t\tif (!this.props.isSelected && prevProps.isSelected && this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: false\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onSelectImage\",\n\t\tvalue: function onSelectImage(media) {\n\n\t\t\tif (!media || !media.url) {\n\t\t\t\tthis.props.setAttributes({\n\t\t\t\t\turl: undefined,\n\t\t\t\t\talt: undefined,\n\t\t\t\t\tid: undefined,\n\t\t\t\t\tcaption: undefined\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar affiliateLink = this.state.affiliateLink;\n\n\n\t\t\tthis.setState({\n\t\t\t\tisEditing: false\n\t\t\t});\n\n\t\t\tthis.props.setAttributes(_extends({}, pickRelevantMediaFiles(media), {\n\t\t\t\tlinkid: affiliateLink.id,\n\t\t\t\thref: affiliateLink.link,\n\t\t\t\taffiliateLink: affiliateLink,\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined\n\t\t\t}));\n\t\t}\n\t}, {\n\t\tkey: \"onImageError\",\n\t\tvalue: function onImageError(url) {\n\t\t\t// Check if there's an embed block that handles this URL.\n\t\t\tvar embedBlock = Object(__WEBPACK_IMPORTED_MODULE_1__util__[\"a\" /* createUpgradedEmbedBlock */])({ attributes: { url: url } });\n\t\t\tif (undefined !== embedBlock) {\n\t\t\t\tthis.props.onReplace(embedBlock);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onFocusCaption\",\n\t\tvalue: function onFocusCaption() {\n\t\t\tif (!this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: true\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onImageClick\",\n\t\tvalue: function onImageClick() {\n\t\t\tif (this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: false\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"updateAlt\",\n\t\tvalue: function updateAlt(newAlt) {\n\t\t\tthis.props.setAttributes({ alt: newAlt });\n\t\t}\n\t}, {\n\t\tkey: \"updateAlignment\",\n\t\tvalue: function updateAlignment(nextAlign) {\n\t\t\tvar extraUpdatedAttributes = ['wide', 'full'].indexOf(nextAlign) !== -1 ? { width: undefined, height: undefined } : {};\n\t\t\tthis.props.setAttributes(_extends({}, extraUpdatedAttributes, { align: nextAlign }));\n\t\t}\n\t}, {\n\t\tkey: \"updateImageURL\",\n\t\tvalue: function updateImageURL(url) {\n\t\t\tthis.props.setAttributes({ url: url, width: undefined, height: undefined });\n\t\t}\n\t}, {\n\t\tkey: \"updateWidth\",\n\t\tvalue: function updateWidth(width) {\n\t\t\tthis.props.setAttributes({ width: parseInt(width, 10) });\n\t\t}\n\t}, {\n\t\tkey: \"updateHeight\",\n\t\tvalue: function updateHeight(height) {\n\t\t\tthis.props.setAttributes({ height: parseInt(height, 10) });\n\t\t}\n\t}, {\n\t\tkey: \"updateDimensions\",\n\t\tvalue: function updateDimensions() {\n\t\t\tvar _this3 = this;\n\n\t\t\tvar width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;\n\t\t\tvar height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n\n\t\t\treturn function () {\n\t\t\t\t_this3.props.setAttributes({ width: width, height: height });\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"getFilename\",\n\t\tvalue: function getFilename(url) {\n\t\t\tvar path = getPath(url);\n\t\t\tif (path) {\n\t\t\t\treturn last(path.split('/'));\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"getLinkDestinationOptions\",\n\t\tvalue: function getLinkDestinationOptions() {\n\t\t\treturn [{ value: LINK_DESTINATION_NONE, label: __('None') }, { value: LINK_DESTINATION_MEDIA, label: __('Media File') }, { value: LINK_DESTINATION_ATTACHMENT, label: __('Attachment Page') }, { value: LINK_DESTINATION_CUSTOM, label: __('Custom URL') }];\n\t\t}\n\t}, {\n\t\tkey: \"toggleIsEditing\",\n\t\tvalue: function toggleIsEditing() {\n\t\t\tthis.setState({\n\t\t\t\tisEditing: !this.state.isEditing\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"getImageSizeOptions\",\n\t\tvalue: function getImageSizeOptions() {\n\t\t\tvar _props2 = this.props,\n\t\t\t imageSizes = _props2.imageSizes,\n\t\t\t image = _props2.image;\n\n\t\t\treturn compact(map(imageSizes, function (_ref4) {\n\t\t\t\tvar name = _ref4.name,\n\t\t\t\t slug = _ref4.slug;\n\n\t\t\t\tvar sizeUrl = get(image, ['media_details', 'sizes', slug, 'source_url']);\n\t\t\t\tif (!sizeUrl) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tvalue: sizeUrl,\n\t\t\t\t\tlabel: name\n\t\t\t\t};\n\t\t\t}));\n\t\t}\n\t}, {\n\t\tkey: \"onChangeInputValue\",\n\t\tvalue: function onChangeInputValue(inputValue) {\n\t\t\tvar post = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n\t\t\tvar linkid = post ? post.id : 0;\n\t\t\tthis.setState({ inputValue: inputValue, linkid: linkid, post: post });\n\t\t}\n\t}, {\n\t\tkey: \"resetInvalidLink\",\n\t\tvalue: function resetInvalidLink() {\n\t\t\tthis.setState({ invalidLink: false });\n\t\t}\n\t}, {\n\t\tkey: \"updateImageSelection\",\n\t\tvalue: function updateImageSelection(imageSelection, affiliateLink) {\n\t\t\tthis.setState({\n\t\t\t\timageSelection: imageSelection,\n\t\t\t\taffiliateLink: affiliateLink\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"onSelectAffiliateImage\",\n\t\tvalue: function onSelectAffiliateImage(image) {\n\t\t\tvar _this4 = this;\n\n\t\t\tif (isExternalImage(image.id, image.src)) {\n\t\t\t\timage.url = image.src;\n\t\t\t\tthis.onSelectImage(image);\n\t\t\t} else {\n\t\t\t\tvar request = wp.apiFetch({\n\t\t\t\t\tpath: wp.url.addQueryArgs('/wp/v2/media/' + image.id, {\n\t\t\t\t\t\tcontext: 'edit',\n\t\t\t\t\t\t_locale: 'user'\n\t\t\t\t\t})\n\t\t\t\t});\n\n\t\t\t\trequest.then(function (media) {\n\t\t\t\t\tmedia.url = media.source_url;\n\t\t\t\t\t_this4.onSelectImage(media);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"editAFfiliateImage\",\n\t\tvalue: function editAFfiliateImage() {\n\t\t\tvar attributes = this.props.attributes;\n\t\t\tvar affiliateLink = attributes.affiliateLink;\n\n\n\t\t\tthis.setState({\n\t\t\t\tisEditing: true,\n\t\t\t\timageSelection: affiliateLink.images,\n\t\t\t\taffiliateLink: affiliateLink\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"render\",\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t isEditing = _state.isEditing,\n\t\t\t imageSelection = _state.imageSelection,\n\t\t\t affiliateLink = _state.affiliateLink;\n\t\t\tvar _props3 = this.props,\n\t\t\t attributes = _props3.attributes,\n\t\t\t setAttributes = _props3.setAttributes,\n\t\t\t isLargeViewport = _props3.isLargeViewport,\n\t\t\t isSelected = _props3.isSelected,\n\t\t\t className = _props3.className,\n\t\t\t maxWidth = _props3.maxWidth,\n\t\t\t toggleSelection = _props3.toggleSelection,\n\t\t\t isRTL = _props3.isRTL;\n\t\t\tvar url = attributes.url,\n\t\t\t alt = attributes.alt,\n\t\t\t caption = attributes.caption,\n\t\t\t align = attributes.align,\n\t\t\t linkDestination = attributes.linkDestination,\n\t\t\t width = attributes.width,\n\t\t\t height = attributes.height,\n\t\t\t linkid = attributes.linkid,\n\t\t\t href = attributes.href;\n\n\t\t\tvar toolbarEditButton = wp.element.createElement(\n\t\t\t\tToolbar,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(IconButton, {\n\t\t\t\t\tclassName: \"ta-edit-image-button components-icon-button components-toolbar__control\",\n\t\t\t\t\tlabel: __('Edit ThirstyAffiliates Image'),\n\t\t\t\t\ticon: \"edit\",\n\t\t\t\t\tonClick: this.editAFfiliateImage\n\t\t\t\t})\n\t\t\t);\n\n\t\t\tvar controls = wp.element.createElement(\n\t\t\t\tBlockControls,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(BlockAlignmentToolbar, {\n\t\t\t\t\tvalue: align,\n\t\t\t\t\tonChange: this.updateAlignment\n\t\t\t\t}),\n\t\t\t\ttoolbarEditButton\n\t\t\t);\n\n\t\t\tif (isEditing) {\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tFragment,\n\t\t\t\t\tnull,\n\t\t\t\t\tcontrols,\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPlaceholder,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ticon: \"format-image\",\n\t\t\t\t\t\t\tlabel: __(\"ThirstyAffiliates Image\"),\n\t\t\t\t\t\t\tinstructions: __(\"Search for an affiliate link and select image to insert.\")\n\t\t\t\t\t\t},\n\t\t\t\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__search_input__[\"a\" /* default */], {\n\t\t\t\t\t\t\tupdateImageSelection: this.updateImageSelection\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t!!imageSelection.length && wp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ className: \"ta-image-sel-wrap\" },\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"h3\",\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\taffiliateLink.title + \" \" + __('attached images:')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"ta-image-selection\" },\n\t\t\t\t\t\t\t\timageSelection.map(function (image, index) {\n\t\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\"button\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\t\t\treturn _this5.onSelectAffiliateImage(image);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\twp.element.createElement(\"img\", { src: image.src })\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tvar classes = __WEBPACK_IMPORTED_MODULE_0_classnames___default()(className, {\n\t\t\t\t'wp-block-image': true,\n\t\t\t\t'is-transient': isBlobURL(url),\n\t\t\t\t'is-resized': !!width || !!height,\n\t\t\t\t'is-focused': isSelected\n\t\t\t});\n\n\t\t\tvar isResizable = ['wide', 'full'].indexOf(align) === -1 && isLargeViewport;\n\t\t\tvar imageSizeOptions = this.getImageSizeOptions();\n\n\t\t\tvar getInspectorControls = function getInspectorControls(imageWidth, imageHeight) {\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tInspectorControls,\n\t\t\t\t\tnull,\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ title: __('Image Settings') },\n\t\t\t\t\t\twp.element.createElement(TextareaControl, {\n\t\t\t\t\t\t\tlabel: __('Alt Text (Alternative Text)'),\n\t\t\t\t\t\t\tvalue: alt,\n\t\t\t\t\t\t\tonChange: _this5.updateAlt,\n\t\t\t\t\t\t\thelp: __('Alternative text describes your image to people who can’t see it. Add a short description with its key details.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t!isEmpty(imageSizeOptions) && wp.element.createElement(SelectControl, {\n\t\t\t\t\t\t\tlabel: __('Image Size'),\n\t\t\t\t\t\t\tvalue: url,\n\t\t\t\t\t\t\toptions: imageSizeOptions,\n\t\t\t\t\t\t\tonChange: _this5.updateImageURL\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tisResizable && wp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions\" },\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"p\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\t__('Image Dimensions')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\tclassName: \"block-library-image__dimensions__width\",\n\t\t\t\t\t\t\t\t\tlabel: __('Width'),\n\t\t\t\t\t\t\t\t\tvalue: width !== undefined ? width : '',\n\t\t\t\t\t\t\t\t\tplaceholder: imageWidth,\n\t\t\t\t\t\t\t\t\tmin: 1,\n\t\t\t\t\t\t\t\t\tonChange: _this5.updateWidth\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\tclassName: \"block-library-image__dimensions__height\",\n\t\t\t\t\t\t\t\t\tlabel: __('Height'),\n\t\t\t\t\t\t\t\t\tvalue: height !== undefined ? height : '',\n\t\t\t\t\t\t\t\t\tplaceholder: imageHeight,\n\t\t\t\t\t\t\t\t\tmin: 1,\n\t\t\t\t\t\t\t\t\tonChange: _this5.updateHeight\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tButtonGroup,\n\t\t\t\t\t\t\t\t\t{ \"aria-label\": __('Image Size') },\n\t\t\t\t\t\t\t\t\t[25, 50, 75, 100].map(function (scale) {\n\t\t\t\t\t\t\t\t\t\tvar scaledWidth = Math.round(imageWidth * (scale / 100));\n\t\t\t\t\t\t\t\t\t\tvar scaledHeight = Math.round(imageHeight * (scale / 100));\n\n\t\t\t\t\t\t\t\t\t\tvar isCurrent = width === scaledWidth && height === scaledHeight;\n\n\t\t\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\tButton,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tkey: scale,\n\t\t\t\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimary: isCurrent,\n\t\t\t\t\t\t\t\t\t\t\t\t\"aria-pressed\": isCurrent,\n\t\t\t\t\t\t\t\t\t\t\t\tonClick: _this5.updateDimensions(scaledWidth, scaledHeight)\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tscale,\n\t\t\t\t\t\t\t\t\t\t\t\"%\"\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tButton,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t\t\tonClick: _this5.updateDimensions()\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t__('Reset')\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t};\n\n\t\t\t// Disable reason: Each block can be selected by clicking on it\n\t\t\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t\t\treturn wp.element.createElement(\n\t\t\t\tFragment,\n\t\t\t\tnull,\n\t\t\t\tcontrols,\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"figure\",\n\t\t\t\t\t{ className: classes },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t__WEBPACK_IMPORTED_MODULE_2__image_size__[\"a\" /* default */],\n\t\t\t\t\t\t{ src: url, dirtynessTrigger: align },\n\t\t\t\t\t\tfunction (sizes) {\n\t\t\t\t\t\t\tvar imageWidthWithinContainer = sizes.imageWidthWithinContainer,\n\t\t\t\t\t\t\t imageHeightWithinContainer = sizes.imageHeightWithinContainer,\n\t\t\t\t\t\t\t imageWidth = sizes.imageWidth,\n\t\t\t\t\t\t\t imageHeight = sizes.imageHeight;\n\n\n\t\t\t\t\t\t\tvar filename = _this5.getFilename(url);\n\t\t\t\t\t\t\tvar defaultedAlt = void 0;\n\t\t\t\t\t\t\tif (alt) {\n\t\t\t\t\t\t\t\tdefaultedAlt = alt;\n\t\t\t\t\t\t\t} else if (filename) {\n\t\t\t\t\t\t\t\tdefaultedAlt = sprintf(__('This image has an empty alt attribute; its file name is %s'), filename);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdefaultedAlt = __('This image has an empty alt attribute');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar img =\n\t\t\t\t\t\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t\t\t\t\t\t// should direct focus to block.\n\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\t\"ta\",\n\t\t\t\t\t\t\t\t\t{ linkid: linkid, href: href },\n\t\t\t\t\t\t\t\t\twp.element.createElement(\"img\", { src: url, alt: defaultedAlt, onClick: _this5.onImageClick, onError: function onError() {\n\t\t\t\t\t\t\t\t\t\t\treturn _this5.onImageError(url);\n\t\t\t\t\t\t\t\t\t\t} })\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tisBlobURL(url) && wp.element.createElement(Spinner, null)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\t;\n\n\t\t\t\t\t\t\tif (!isResizable || !imageWidthWithinContainer) {\n\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\tgetInspectorControls(imageWidth, imageHeight),\n\t\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t\t\t{ style: { width: width, height: height } },\n\t\t\t\t\t\t\t\t\t\timg\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar currentWidth = width || imageWidthWithinContainer;\n\t\t\t\t\t\t\tvar currentHeight = height || imageHeightWithinContainer;\n\n\t\t\t\t\t\t\tvar ratio = imageWidth / imageHeight;\n\t\t\t\t\t\t\tvar minWidth = imageWidth < imageHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\t\t\t\t\t\tvar minHeight = imageHeight < imageWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t\t\t\t\t\t// With the current implementation of ResizableBox, an image needs an explicit pixel value for the max-width.\n\t\t\t\t\t\t\t// In absence of being able to set the content-width, this max-width is currently dictated by the vanilla editor style.\n\t\t\t\t\t\t\t// The following variable adds a buffer to this vanilla style, so 3rd party themes have some wiggleroom.\n\t\t\t\t\t\t\t// This does, in most cases, allow you to scale the image beyond the width of the main column, though not infinitely.\n\t\t\t\t\t\t\t// @todo It would be good to revisit this once a content-width variable becomes available.\n\t\t\t\t\t\t\tvar maxWidthBuffer = maxWidth * 2.5;\n\n\t\t\t\t\t\t\tvar showRightHandle = false;\n\t\t\t\t\t\t\tvar showLeftHandle = false;\n\n\t\t\t\t\t\t\t/* eslint-disable no-lonely-if */\n\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\t\t\t\t\t\tif (align === 'center') {\n\t\t\t\t\t\t\t\t// When the image is centered, show both handles.\n\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t} else if (isRTL) {\n\t\t\t\t\t\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t\t\t\t\t\t// Show the right handle and hide the left handle only when it is aligned left.\n\t\t\t\t\t\t\t\t// Otherwise always show the left handle.\n\t\t\t\t\t\t\t\tif (align === 'left') {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Show the left handle and hide the right handle only when the image is aligned right.\n\t\t\t\t\t\t\t\t// Otherwise always show the right handle.\n\t\t\t\t\t\t\t\tif (align === 'right') {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/* eslint-enable no-lonely-if */\n\n\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\tgetInspectorControls(imageWidth, imageHeight),\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tResizableBox,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tsize: width && height ? {\n\t\t\t\t\t\t\t\t\t\t\twidth: width,\n\t\t\t\t\t\t\t\t\t\t\theight: height\n\t\t\t\t\t\t\t\t\t\t} : undefined,\n\t\t\t\t\t\t\t\t\t\tminWidth: minWidth,\n\t\t\t\t\t\t\t\t\t\tmaxWidth: maxWidthBuffer,\n\t\t\t\t\t\t\t\t\t\tminHeight: minHeight,\n\t\t\t\t\t\t\t\t\t\tmaxHeight: maxWidthBuffer / ratio,\n\t\t\t\t\t\t\t\t\t\tlockAspectRatio: true,\n\t\t\t\t\t\t\t\t\t\tenable: {\n\t\t\t\t\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\t\t\t\t\tleft: showLeftHandle\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonResizeStart: function onResizeStart() {\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection(false);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonResizeStop: function onResizeStop(event, direction, elt, delta) {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes({\n\t\t\t\t\t\t\t\t\t\t\t\twidth: parseInt(currentWidth + delta.width, 10),\n\t\t\t\t\t\t\t\t\t\t\t\theight: parseInt(currentHeight + delta.height, 10)\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection(true);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\timg\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t\t(!RichText.isEmpty(caption) || isSelected) && wp.element.createElement(RichText, {\n\t\t\t\t\t\ttagName: \"figcaption\",\n\t\t\t\t\t\tplaceholder: __('Write caption…'),\n\t\t\t\t\t\tvalue: caption,\n\t\t\t\t\t\tunstableOnFocus: this.onFocusCaption,\n\t\t\t\t\t\tonChange: function onChange(value) {\n\t\t\t\t\t\t\treturn setAttributes({ caption: value });\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisSelected: this.state.captionFocused,\n\t\t\t\t\t\tinlineToolbar: true\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t);\n\t\t\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t\t}\n\t}]);\n\n\treturn ImageEdit;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (compose([withSelect(function (select, props) {\n\tvar _select = select('core'),\n\t getMedia = _select.getMedia;\n\n\tvar _select2 = select('core/editor'),\n\t getEditorSettings = _select2.getEditorSettings;\n\n\tvar id = props.attributes.id;\n\n\tvar _getEditorSettings = getEditorSettings(),\n\t maxWidth = _getEditorSettings.maxWidth,\n\t isRTL = _getEditorSettings.isRTL,\n\t imageSizes = _getEditorSettings.imageSizes;\n\n\treturn {\n\t\timage: id ? getMedia(id) : null,\n\t\tmaxWidth: maxWidth,\n\t\tisRTL: isRTL,\n\t\timageSizes: imageSizes\n\t};\n}), withViewportMatch({ isLargeViewport: 'medium' }), withNotices])(ImageEdit));\n\n/***/ }),\n/* 5 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return createUpgradedEmbedBlock; });\n/* unused harmony export isFromWordPress */\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar WORDPRESS_EMBED_BLOCK = 'core-embed/wordpress';\n\nvar _lodash = lodash,\n includes = _lodash.includes;\nvar renderToString = wp.element.renderToString;\nvar createBlock = wp.blocks.createBlock;\n\n/***\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} attributesFromPreview Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\n\nvar createUpgradedEmbedBlock = function createUpgradedEmbedBlock(props, attributesFromPreview) {\n\tvar preview = props.preview,\n\t name = props.name;\n\tvar url = props.attributes.url;\n\n\n\tif (!url) {\n\t\treturn;\n\t}\n\n\tvar matchingBlock = findBlock(url);\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tif (WORDPRESS_EMBED_BLOCK !== name && DEFAULT_EMBED_BLOCK !== matchingBlock) {\n\t\t// At this point, we have discovered a more suitable block for this url, so transform it.\n\t\tif (name !== matchingBlock) {\n\t\t\treturn createBlock(matchingBlock, { url: url });\n\t\t}\n\t}\n\n\tif (preview) {\n\t\tvar html = preview.html;\n\n\t\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\n\t\tif (isFromWordPress(html)) {\n\t\t\t// If this is not the WordPress embed block, transform it into one.\n\t\t\tif (WORDPRESS_EMBED_BLOCK !== name) {\n\t\t\t\treturn createBlock(WORDPRESS_EMBED_BLOCK, _extends({\n\t\t\t\t\turl: url\n\t\t\t\t}, attributesFromPreview));\n\t\t\t}\n\t\t}\n\t}\n};\n\nvar isFromWordPress = function isFromWordPress(html) {\n\treturn includes(html, 'class=\"wp-embedded-content\" data-secret');\n};\n\n/***/ }),\n/* 6 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar _lodash = lodash,\n noop = _lodash.noop;\nvar withGlobalEvents = wp.compose.withGlobalEvents;\nvar Component = wp.element.Component;\n\nvar ImageSize = function (_Component) {\n\t_inherits(ImageSize, _Component);\n\n\tfunction ImageSize() {\n\t\t_classCallCheck(this, ImageSize);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ImageSize.__proto__ || Object.getPrototypeOf(ImageSize)).apply(this, arguments));\n\n\t\t_this.state = {\n\t\t\twidth: undefined,\n\t\t\theight: undefined\n\t\t};\n\t\t_this.bindContainer = _this.bindContainer.bind(_this);\n\t\t_this.calculateSize = _this.calculateSize.bind(_this);\n\t\treturn _this;\n\t}\n\n\t_createClass(ImageSize, [{\n\t\tkey: 'bindContainer',\n\t\tvalue: function bindContainer(ref) {\n\t\t\tthis.container = ref;\n\t\t}\n\t}, {\n\t\tkey: 'componentDidUpdate',\n\t\tvalue: function componentDidUpdate(prevProps) {\n\t\t\tif (this.props.src !== prevProps.src) {\n\t\t\t\tthis.setState({\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined\n\t\t\t\t});\n\t\t\t\tthis.fetchImageSize();\n\t\t\t}\n\n\t\t\tif (this.props.dirtynessTrigger !== prevProps.dirtynessTrigger) {\n\t\t\t\tthis.calculateSize();\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'componentDidMount',\n\t\tvalue: function componentDidMount() {\n\t\t\tthis.fetchImageSize();\n\t\t}\n\t}, {\n\t\tkey: 'componentWillUnmount',\n\t\tvalue: function componentWillUnmount() {\n\t\t\tif (this.image) {\n\t\t\t\tthis.image.onload = noop;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'fetchImageSize',\n\t\tvalue: function fetchImageSize() {\n\t\t\tthis.image = new window.Image();\n\t\t\tthis.image.onload = this.calculateSize;\n\t\t\tthis.image.src = this.props.src;\n\t\t}\n\t}, {\n\t\tkey: 'calculateSize',\n\t\tvalue: function calculateSize() {\n\t\t\tvar maxWidth = this.container.clientWidth;\n\t\t\tvar exceedMaxWidth = this.image.width > maxWidth;\n\t\t\tvar ratio = this.image.height / this.image.width;\n\t\t\tvar width = exceedMaxWidth ? maxWidth : this.image.width;\n\t\t\tvar height = exceedMaxWidth ? maxWidth * ratio : this.image.height;\n\t\t\tthis.setState({ width: width, height: height });\n\t\t}\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar sizes = {\n\t\t\t\timageWidth: this.image && this.image.width,\n\t\t\t\timageHeight: this.image && this.image.height,\n\t\t\t\tcontainerWidth: this.container && this.container.clientWidth,\n\t\t\t\tcontainerHeight: this.container && this.container.clientHeight,\n\t\t\t\timageWidthWithinContainer: this.state.width,\n\t\t\t\timageHeightWithinContainer: this.state.height\n\t\t\t};\n\t\t\treturn wp.element.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ ref: this.bindContainer },\n\t\t\t\tthis.props.children(sizes)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ImageSize;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withGlobalEvents({\n\tresize: 'calculateSize'\n})(ImageSize));\n\n/***/ }),\n/* 7 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$components = wp.components,\n Spinner = _wp$components.Spinner,\n withSpokenMessages = _wp$components.withSpokenMessages,\n Popover = _wp$components.Popover,\n TextControl = _wp$components.TextControl;\nvar withInstanceId = wp.compose.withInstanceId;\n\nvar ThirstyURLInput = function (_Component) {\n\t_inherits(ThirstyURLInput, _Component);\n\n\t/**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tfunction ThirstyURLInput(_ref) {\n\t\tvar autocompleteRef = _ref.autocompleteRef;\n\n\t\t_classCallCheck(this, ThirstyURLInput);\n\n\t\t// this.onChange = this.onChange.bind( this );\n\t\t// this.onKeyDown = this.onKeyDown.bind( this );\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLInput.__proto__ || Object.getPrototypeOf(ThirstyURLInput)).apply(this, arguments));\n\n\t\t_this.autocompleteRef = autocompleteRef || createRef();\n\t\t_this.inputRef = createRef();\n\t\t_this.searchAffiliateLinks = _this.searchAffiliateLinks.bind(_this);\n\t\t// this.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n\t\t_this.suggestionNodes = [];\n\n\t\t_this.state = {\n\t\t\tposts: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null,\n\t\t\tloading: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Component did update method.\n * \n * @since 3.6\n */\n\n\n\t_createClass(ThirstyURLInput, [{\n\t\tkey: \"componentDidUpdate\",\n\t\tvalue: function componentDidUpdate() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t showSuggestions = _state.showSuggestions,\n\t\t\t selectedSuggestion = _state.selectedSuggestion;\n\t\t\t// only have to worry about scrolling selected suggestion into view\n\t\t\t// when already expanded\n\n\t\t\tif (showSuggestions && selectedSuggestion !== null && !this.scrollingIntoView) {\n\t\t\t\tthis.scrollingIntoView = true;\n\t\t\t\tscrollIntoView(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, {\n\t\t\t\t\tonlyScrollIfNeeded: true\n\t\t\t\t});\n\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t_this2.scrollingIntoView = false;\n\t\t\t\t}, 100);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Component unmount method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: \"componentWillUnmount\",\n\t\tvalue: function componentWillUnmount() {\n\t\t\tdelete this.suggestionsRequest;\n\t\t}\n\n\t\t/**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\n\t}, {\n\t\tkey: \"bindSuggestionNode\",\n\t\tvalue: function bindSuggestionNode(index) {\n\t\t\tvar _this3 = this;\n\n\t\t\treturn function (ref) {\n\t\t\t\t_this3.suggestionNodes[index] = ref;\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"searchAffiliateLinks\",\n\t\tvalue: function searchAffiliateLinks(value) {\n\t\t\tvar _this4 = this;\n\n\t\t\t// Show the suggestions after typing at least 2 characters=\n\t\t\tif (value.length < 2) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tshowSuggestions: false,\n\t\t\t\t\tselectedSuggestion: null,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.setState({\n\t\t\t\tshowSuggestions: true,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: true\n\t\t\t});\n\n\t\t\tvar formData = new FormData();\n\t\t\tformData.append(\"action\", \"search_affiliate_links_query\");\n\t\t\tformData.append(\"keyword\", value);\n\t\t\tformData.append(\"paged\", 1);\n\t\t\tformData.append(\"gutenberg\", true);\n\t\t\tformData.append(\"with_images\", true);\n\n\t\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\n\t\t\t// to filter results with category value. This is to prepare next update to add category filter.\n\t\t\tvar request = fetch(ajaxurl, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: formData\n\t\t\t});\n\n\t\t\trequest.then(function (response) {\n\t\t\t\treturn response.json();\n\t\t\t}).then(function (response) {\n\n\t\t\t\tif (!response.affiliate_links) return;\n\n\t\t\t\tvar posts = response.affiliate_links;\n\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif (_this4.suggestionsRequest !== request) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t_this4.setState({\n\t\t\t\t\tposts: posts,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\tif (!!posts.length) {\n\t\t\t\t\t_this4.props.debouncedSpeak(sprintf(_n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', posts.length), posts.length), 'assertive');\n\t\t\t\t} else {\n\t\t\t\t\t_this4.props.debouncedSpeak(__('No results.'), 'assertive');\n\t\t\t\t}\n\t\t\t}).catch(function () {\n\t\t\t\tif (_this4.suggestionsRequest === request) {\n\t\t\t\t\t_this4.setState({\n\t\t\t\t\t\tloading: false\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.suggestionsRequest = request;\n\t\t}\n\n\t\t/**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: \"selectLink\",\n\t\tvalue: function selectLink(post) {\n\t\t\t// this.props.onChange( post.link, post );\n\t\t\tthis.setState({\n\t\t\t\tselectedSuggestion: post,\n\t\t\t\tshowSuggestions: false\n\t\t\t});\n\n\t\t\tthis.props.updateImageSelection(post.images, post);\n\t\t}\n\n\t\t/**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: \"handleOnClick\",\n\t\tvalue: function handleOnClick(post) {\n\t\t\tthis.selectLink(post);\n\t\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\t\t// this.inputRef.current.focus();\n\t\t}\n\t}, {\n\t\tkey: \"render\",\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t _props$value = _props.value,\n\t\t\t value = _props$value === undefined ? '' : _props$value,\n\t\t\t _props$autoFocus = _props.autoFocus,\n\t\t\t autoFocus = _props$autoFocus === undefined ? true : _props$autoFocus,\n\t\t\t instanceId = _props.instanceId;\n\t\t\tvar _state2 = this.state,\n\t\t\t showSuggestions = _state2.showSuggestions,\n\t\t\t posts = _state2.posts,\n\t\t\t selectedSuggestion = _state2.selectedSuggestion,\n\t\t\t loading = _state2.loading;\n\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t\"div\",\n\t\t\t\t{ \"class\": \"edit-search-affiliate-links\" },\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"form\",\n\t\t\t\t\t{\n\t\t\t\t\t\tclassName: \"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover\",\n\t\t\t\t\t\tonSubmit: this.displayAffiliateImages\n\t\t\t\t\t},\n\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\tclassName: \"ta-search-affiliate-links\",\n\t\t\t\t\t\tplaceholder: __(\"Type to search affiliate links\"),\n\t\t\t\t\t\tonChange: this.searchAffiliateLinks,\n\t\t\t\t\t\tautocomplete: \"off\"\n\t\t\t\t\t}),\n\t\t\t\t\tloading && wp.element.createElement(Spinner, null),\n\t\t\t\t\tshowSuggestions && !!posts.length && wp.element.createElement(\n\t\t\t\t\t\tPopover,\n\t\t\t\t\t\t{ position: \"bottom\", focusOnMount: false },\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ \"class\": \"affilate-links-suggestions\" },\n\t\t\t\t\t\t\tposts.map(function (post, index) {\n\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\"button\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tkey: post.id,\n\t\t\t\t\t\t\t\t\t\trole: \"option\",\n\t\t\t\t\t\t\t\t\t\ttabIndex: \"-1\",\n\t\t\t\t\t\t\t\t\t\tid: \"editor-url-input-suggestion-\" + instanceId + \"-\" + index,\n\t\t\t\t\t\t\t\t\t\tref: _this5.bindSuggestionNode(index),\n\t\t\t\t\t\t\t\t\t\tclassName: __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\t\treturn _this5.handleOnClick(post);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\"aria-selected\": index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tpost.title || __('(no title)')\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ThirstyURLInput;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(withInstanceId(ThirstyURLInput)));\n\n/***/ }),\n/* 8 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = registerFormats;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ta_link__ = __webpack_require__(9);\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\n\n\nvar registerFormatType = wp.richText.registerFormatType;\n\n/**\n * Register custom formats.\n * \n * @since 3.6\n */\n\nfunction registerFormats() {\n\n [__WEBPACK_IMPORTED_MODULE_0__ta_link__[\"a\" /* taLink */]].forEach(function (_ref) {\n var name = _ref.name,\n settings = _objectWithoutProperties(_ref, [\"name\"]);\n\n return registerFormatType(name, settings);\n });\n}\n\n/***/ }),\n/* 9 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return taLink; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__inline__ = __webpack_require__(10);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment;\nvar withSpokenMessages = wp.components.withSpokenMessages;\nvar _wp$richText = wp.richText,\n getTextContent = _wp$richText.getTextContent,\n applyFormat = _wp$richText.applyFormat,\n removeFormat = _wp$richText.removeFormat,\n slice = _wp$richText.slice;\nvar isURL = wp.url.isURL;\nvar _wp$editor = wp.editor,\n RichTextToolbarButton = _wp$editor.RichTextToolbarButton,\n RichTextShortcut = _wp$editor.RichTextShortcut;\nvar _wp$components = wp.components,\n Path = _wp$components.Path,\n SVG = _wp$components.SVG;\nvar getRectangleFromRange = wp.dom.getRectangleFromRange;\n\n\nvar name = \"ta/link\";\n\n/**\n * Custom Affiliate link format. When applied will wrap selected text with <ta href=\"\" linkid=\"\"></ta> custom element.\n * Custom element is implemented here as we are not allowed to use <a> tag due to Gutenberg limitations.\n * Element is converted to normal <a> tag on frontend via PHP script filtered on 'the_content'.\n * \n * @since 3.6\n */\nvar taLink = {\n\tname: name,\n\ttitle: __(\"Affiliate Link\"),\n\ttagName: \"ta\",\n\tclassName: null,\n\tattributes: {\n\t\turl: \"href\",\n\t\ttarget: \"target\"\n\t},\n\tedit: withSpokenMessages(function (_Component) {\n\t\t_inherits(LinkEdit, _Component);\n\n\t\t/**\n * Component constructor.\n * \n * @since 3.6\n */\n\t\tfunction LinkEdit() {\n\t\t\t_classCallCheck(this, LinkEdit);\n\n\t\t\tvar _this = _possibleConstructorReturn(this, (LinkEdit.__proto__ || Object.getPrototypeOf(LinkEdit)).apply(this, arguments));\n\n\t\t\t_this.addLink = _this.addLink.bind(_this);\n\t\t\t_this.stopAddingLink = _this.stopAddingLink.bind(_this);\n\t\t\t_this.onRemoveFormat = _this.onRemoveFormat.bind(_this);\n\t\t\t_this.state = {\n\t\t\t\taddingLink: false\n\t\t\t};\n\t\t\treturn _this;\n\t\t}\n\n\t\t/**\n * Callback to set state to adding link status.\n * \n * @since 3.6\n */\n\n\n\t\t_createClass(LinkEdit, [{\n\t\t\tkey: \"addLink\",\n\t\t\tvalue: function addLink() {\n\t\t\t\tvar _props = this.props,\n\t\t\t\t value = _props.value,\n\t\t\t\t onChange = _props.onChange;\n\n\t\t\t\tvar text = getTextContent(slice(value));\n\n\t\t\t\tif (text && isURL(text)) {\n\t\t\t\t\tonChange(applyFormat(value, { type: name, attributes: { url: text } }));\n\t\t\t\t} else {\n\t\t\t\t\tthis.setState({ addingLink: true });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n * Callback to set state to stop adding link status.\n * \n * @since 3.6\n */\n\n\t\t}, {\n\t\t\tkey: \"stopAddingLink\",\n\t\t\tvalue: function stopAddingLink() {\n\t\t\t\tthis.setState({ addingLink: false });\n\t\t\t}\n\n\t\t\t/**\n * Remove format event callback.\n * \n * @since 3.6\n */\n\n\t\t}, {\n\t\t\tkey: \"onRemoveFormat\",\n\t\t\tvalue: function onRemoveFormat() {\n\t\t\t\tvar _props2 = this.props,\n\t\t\t\t value = _props2.value,\n\t\t\t\t onChange = _props2.onChange,\n\t\t\t\t speak = _props2.speak;\n\n\n\t\t\t\tonChange(removeFormat(value, name));\n\t\t\t\tspeak(__(\"Affiliate Link removed.\"), \"assertive\");\n\t\t\t}\n\n\t\t\t/**\n * Get selected anchor text.\n * \n * @since 3.9\n */\n\n\t\t}, {\n\t\t\tkey: \"getAnchorRect\",\n\t\t\tvalue: function getAnchorRect() {\n\n\t\t\t\tvar selection = window.getSelection();\n\t\t\t\tvar range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null;\n\n\t\t\t\tif (!range) return;\n\n\t\t\t\tvar rect = null;\n\n\t\t\t\tif (this.state.addingLink) {\n\t\t\t\t\trect = getRectangleFromRange(range);\n\t\t\t\t} else {\n\n\t\t\t\t\tvar element = range.startContainer;\n\n\t\t\t\t\t// If the caret is right before the element, select the next element.\n\t\t\t\t\telement = element.nextElementSibling || element;\n\n\t\t\t\t\twhile (element.nodeType !== window.Node.ELEMENT_NODE) {\n\t\t\t\t\t\telement = element.parentNode;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar closest = element.closest('ta');\n\t\t\t\t\tif (closest) {\n\t\t\t\t\t\trect = closest.getBoundingClientRect();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn rect;\n\t\t\t}\n\n\t\t\t/**\n * Component render method.\n * \n * @since 3.6\n */\n\n\t\t}, {\n\t\t\tkey: \"render\",\n\t\t\tvalue: function render() {\n\t\t\t\tvar _props3 = this.props,\n\t\t\t\t isActive = _props3.isActive,\n\t\t\t\t activeAttributes = _props3.activeAttributes,\n\t\t\t\t value = _props3.value,\n\t\t\t\t onChange = _props3.onChange;\n\n\n\t\t\t\tvar anchorRect = this.getAnchorRect();\n\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tFragment,\n\t\t\t\t\tnull,\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"access\",\n\t\t\t\t\t\tcharacter: \"s\",\n\t\t\t\t\t\tonUse: this.onRemoveFormat\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"primary\",\n\t\t\t\t\t\tcharacter: \"l\",\n\t\t\t\t\t\tonUse: this.addLink\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"primaryShift\",\n\t\t\t\t\t\tcharacter: \"l\",\n\t\t\t\t\t\tonUse: this.onRemoveFormat\n\t\t\t\t\t}),\n\t\t\t\t\tisActive && wp.element.createElement(RichTextToolbarButton, {\n\t\t\t\t\t\ticon: \"editor-unlink\",\n\t\t\t\t\t\ttitle: __('Remove Affiliate Link'),\n\t\t\t\t\t\tclassName: \"ta-unlink-button\",\n\t\t\t\t\t\tonClick: this.onRemoveFormat,\n\t\t\t\t\t\tisActive: isActive,\n\t\t\t\t\t\tshortcutType: \"primaryShift\",\n\t\t\t\t\t\tshortcutCharacter: \"l\"\n\t\t\t\t\t}),\n\t\t\t\t\t!isActive && wp.element.createElement(RichTextToolbarButton, {\n\t\t\t\t\t\ticon: wp.element.createElement(\n\t\t\t\t\t\t\tSVG,\n\t\t\t\t\t\t\t{ xmlns: \"http://www.w3.org/2000/svg\", width: \"16.688\", height: \"9.875\", viewBox: \"0 0 16.688 9.875\" },\n\t\t\t\t\t\t\twp.element.createElement(Path, { id: \"TA.svg\", fill: \"black\", \"class\": \"cls-1\", d: \"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z\", transform: \"translate(-1.188 -5.25)\" })\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle: __('Affiliate Link'),\n\t\t\t\t\t\tclassName: \"ta-link-button\",\n\t\t\t\t\t\tonClick: this.addLink,\n\t\t\t\t\t\tshortcutType: \"primary\",\n\t\t\t\t\t\tshortcutCharacter: \"l\"\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_0__inline__[\"a\" /* default */], {\n\t\t\t\t\t\taddingLink: this.state.addingLink,\n\t\t\t\t\t\tstopAddingLink: this.stopAddingLink,\n\t\t\t\t\t\tisActive: isActive,\n\t\t\t\t\t\tactiveAttributes: activeAttributes,\n\t\t\t\t\t\tanchorRect: anchorRect,\n\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\tonChange: onChange\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t}]);\n\n\t\treturn LinkEdit;\n\t}(Component))\n};\n\n/***/ }),\n/* 10 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils__ = __webpack_require__(11);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__url_popover__ = __webpack_require__(12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__url_input__ = __webpack_require__(13);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$components = wp.components,\n ExternalLink = _wp$components.ExternalLink,\n ToggleControl = _wp$components.ToggleControl,\n IconButton = _wp$components.IconButton,\n withSpokenMessages = _wp$components.withSpokenMessages;\nvar _wp$keycodes = wp.keycodes,\n LEFT = _wp$keycodes.LEFT,\n RIGHT = _wp$keycodes.RIGHT,\n UP = _wp$keycodes.UP,\n DOWN = _wp$keycodes.DOWN,\n BACKSPACE = _wp$keycodes.BACKSPACE,\n ENTER = _wp$keycodes.ENTER;\nvar _wp$url = wp.url,\n prependHTTP = _wp$url.prependHTTP,\n safeDecodeURI = _wp$url.safeDecodeURI,\n filterURLForDisplay = _wp$url.filterURLForDisplay;\nvar _wp$richText = wp.richText,\n create = _wp$richText.create,\n insert = _wp$richText.insert,\n isCollapsed = _wp$richText.isCollapsed,\n applyFormat = _wp$richText.applyFormat,\n getTextContent = _wp$richText.getTextContent,\n slice = _wp$richText.slice;\n\n\nvar stopKeyPropagation = function stopKeyPropagation(event) {\n\treturn event.stopPropagation();\n};\n\n/**\n * Generates the format object that will be applied to the link text.\n * \n * @since 3.6\n *\n * @param {string} url The href of the link.\n * @param {boolean} linkid Affiliate link ID.\n * @param {Object} text The text that is being hyperlinked.\n *\n * @return {Object} The final format object.\n */\nfunction createLinkFormat(_ref) {\n\tvar url = _ref.url,\n\t linkid = _ref.linkid,\n\t text = _ref.text;\n\n\tvar format = {\n\t\ttype: \"ta/link\",\n\t\tattributes: {\n\t\t\turl: url,\n\t\t\tlinkid: linkid.toString()\n\t\t}\n\t};\n\n\treturn format;\n}\n\n/**\n * Check if input is being show.\n * \n * @since 3.6\n * \n * @param {Object} props Component props.\n * @param {Object} state Component state.\n */\nfunction isShowingInput(props, state) {\n\treturn props.addingLink || state.editLink;\n}\n\n/**\n * Affiliate Link editor JSX element.\n * \n * @since 3.6\n * \n * @param {Object} param0 Component props (destructred).\n */\nvar LinkEditor = function LinkEditor(_ref2) {\n\tvar value = _ref2.value,\n\t onChangeInputValue = _ref2.onChangeInputValue,\n\t onKeyDown = _ref2.onKeyDown,\n\t submitLink = _ref2.submitLink,\n\t invalidLink = _ref2.invalidLink,\n\t resetInvalidLink = _ref2.resetInvalidLink,\n\t autocompleteRef = _ref2.autocompleteRef;\n\treturn (\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t\twp.element.createElement(\n\t\t\t'form',\n\t\t\t{\n\t\t\t\tclassName: 'editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover',\n\t\t\t\tonKeyPress: stopKeyPropagation,\n\t\t\t\tonKeyDown: onKeyDown,\n\t\t\t\tonSubmit: submitLink\n\t\t\t},\n\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__url_input__[\"a\" /* default */], {\n\t\t\t\tvalue: value,\n\t\t\t\tonChange: onChangeInputValue,\n\t\t\t\tautocompleteRef: autocompleteRef,\n\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\tresetInvalidLink: resetInvalidLink\n\t\t\t}),\n\t\t\twp.element.createElement(IconButton, { icon: 'editor-break', label: __('Apply'), type: 'submit' })\n\t\t)\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n\n\t);\n};\n\n/**\n * Affiliate link url viewer JSX element.\n * \n * @param {*} param0 Component props (destructred).\n */\nvar LinkViewerUrl = function LinkViewerUrl(_ref3) {\n\tvar url = _ref3.url;\n\n\tvar prependedURL = prependHTTP(url);\n\tvar linkClassName = __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value', {\n\t\t'has-invalid-link': !Object(__WEBPACK_IMPORTED_MODULE_1__utils__[\"a\" /* isValidHref */])(prependedURL)\n\t});\n\n\tif (!url) {\n\t\treturn wp.element.createElement('span', { className: linkClassName });\n\t}\n\n\treturn wp.element.createElement(\n\t\tExternalLink,\n\t\t{\n\t\t\tclassName: linkClassName,\n\t\t\thref: url\n\t\t},\n\t\tfilterURLForDisplay(safeDecodeURI(url))\n\t);\n};\n\n/**\n * Affiliate link viewer JSX element.\n * \n * @param {*} param0 Component props (destructred).\n */\nvar LinkViewer = function LinkViewer(_ref4) {\n\tvar url = _ref4.url,\n\t editLink = _ref4.editLink;\n\n\treturn (\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\twp.element.createElement(\n\t\t\t'div',\n\t\t\t{\n\t\t\t\tclassName: 'editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content',\n\t\t\t\tonKeyPress: stopKeyPropagation\n\t\t\t},\n\t\t\twp.element.createElement(LinkViewerUrl, { url: url }),\n\t\t\twp.element.createElement(IconButton, { icon: 'edit', label: __('Edit'), onClick: editLink })\n\t\t)\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\n\t);\n};\n\n/**\n * Inline affiliate link UI Component.\n * \n * @since 3.6\n * \n * @param {*} param0 Component props (destructred).\n */\n\nvar InlineAffiliateLinkUI = function (_Component) {\n\t_inherits(InlineAffiliateLinkUI, _Component);\n\n\tfunction InlineAffiliateLinkUI() {\n\t\t_classCallCheck(this, InlineAffiliateLinkUI);\n\n\t\tvar _this = _possibleConstructorReturn(this, (InlineAffiliateLinkUI.__proto__ || Object.getPrototypeOf(InlineAffiliateLinkUI)).apply(this, arguments));\n\n\t\t_this.editLink = _this.editLink.bind(_this);\n\t\t_this.submitLink = _this.submitLink.bind(_this);\n\t\t_this.onKeyDown = _this.onKeyDown.bind(_this);\n\t\t_this.onChangeInputValue = _this.onChangeInputValue.bind(_this);\n\t\t_this.onClickOutside = _this.onClickOutside.bind(_this);\n\t\t_this.resetState = _this.resetState.bind(_this);\n\t\t_this.autocompleteRef = createRef();\n\t\t_this.resetInvalidLink = _this.resetInvalidLink.bind(_this);\n\n\t\t_this.state = {\n\t\t\tinputValue: '',\n\t\t\tlinkid: 0,\n\t\t\tpost: null,\n\t\t\tinvalidLink: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Stop the key event from propagating up to ObserveTyping.startTypingInTextField.\n * \n * @since 3.6\n * \n * @param {Object} event Event object.\n */\n\n\n\t_createClass(InlineAffiliateLinkUI, [{\n\t\tkey: 'onKeyDown',\n\t\tvalue: function onKeyDown(event) {\n\t\t\tif ([LEFT, DOWN, RIGHT, UP, BACKSPACE, ENTER].indexOf(event.keyCode) > -1) {\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Callback to set state when input value is changed.\n * \n * @since 3.6\n * \n * @param {*} inputValue \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: 'onChangeInputValue',\n\t\tvalue: function onChangeInputValue(inputValue) {\n\t\t\tvar post = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n\t\t\tvar linkid = post ? post.id : 0;\n\t\t\tthis.setState({ inputValue: inputValue, linkid: linkid, post: post });\n\t\t}\n\n\t\t/**\n * Callback to set state when edit affiliate link (already inserted) is triggered.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'editLink',\n\t\tvalue: function editLink(event) {\n\t\t\tthis.setState({ editLink: true });\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\t/**\n * Callback to apply the affiliate link format to the selected text or position in the active block.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'submitLink',\n\t\tvalue: function submitLink(event) {\n\t\t\tvar _props = this.props,\n\t\t\t isActive = _props.isActive,\n\t\t\t value = _props.value,\n\t\t\t onChange = _props.onChange,\n\t\t\t speak = _props.speak;\n\t\t\tvar _state = this.state,\n\t\t\t inputValue = _state.inputValue,\n\t\t\t linkid = _state.linkid,\n\t\t\t post = _state.post;\n\n\t\t\tvar url = prependHTTP(inputValue);\n\t\t\tvar selectedText = getTextContent(slice(value));\n\t\t\tvar format = createLinkFormat({\n\t\t\t\turl: url,\n\t\t\t\tlinkid: linkid,\n\t\t\t\ttext: selectedText\n\t\t\t});\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif (!linkid || !post) {\n\t\t\t\tthis.setState({ invalidLink: true });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (isCollapsed(value) && !isActive) {\n\t\t\t\tvar toInsert = applyFormat(create({ text: post.title }), format, 0, url.length);\n\t\t\t\tonChange(insert(value, toInsert));\n\t\t\t} else {\n\t\t\t\tonChange(applyFormat(value, format));\n\t\t\t}\n\n\t\t\tthis.resetState();\n\n\t\t\tif (!Object(__WEBPACK_IMPORTED_MODULE_1__utils__[\"a\" /* isValidHref */])(url)) {\n\t\t\t\tspeak(__('Warning: the link has been inserted but may have errors. Please test it.'), 'assertive');\n\t\t\t} else if (isActive) {\n\t\t\t\tspeak(__('Link edited.'), 'assertive');\n\t\t\t} else {\n\t\t\t\tspeak(__('Link inserted'), 'assertive');\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Callback to run when users clicks outside the popover UI.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'onClickOutside',\n\t\tvalue: function onClickOutside(event) {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onClickOutside fails to detect that a click on a suggestion occured in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tvar autocompleteElement = this.autocompleteRef.current;\n\t\t\tif (autocompleteElement && autocompleteElement.contains(event.target)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.resetState();\n\t\t}\n\n\t\t/**\n * Reset state callback.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'resetState',\n\t\tvalue: function resetState() {\n\t\t\tthis.props.stopAddingLink();\n\t\t\tthis.setState({ inputValue: '', editLink: false });\n\t\t\tthis.resetInvalidLink();\n\t\t}\n\n\t\t/**\n * Reset invalid link state callback. Separated as we need to run this independently from resetState() callback.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'resetInvalidLink',\n\t\tvalue: function resetInvalidLink() {\n\t\t\tthis.setState({ invalidLink: false });\n\t\t}\n\n\t\t/**\n * Component render method.\n *\n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _props2 = this.props,\n\t\t\t isActive = _props2.isActive,\n\t\t\t _props2$activeAttribu = _props2.activeAttributes,\n\t\t\t url = _props2$activeAttribu.url,\n\t\t\t linkid = _props2$activeAttribu.linkid,\n\t\t\t addingLink = _props2.addingLink,\n\t\t\t anchorRect = _props2.anchorRect,\n\t\t\t value = _props2.value,\n\t\t\t onChange = _props2.onChange;\n\n\n\t\t\tif (!isActive && !addingLink) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tvar _state2 = this.state,\n\t\t\t inputValue = _state2.inputValue,\n\t\t\t invalidLink = _state2.invalidLink;\n\n\t\t\tvar showInput = isShowingInput(this.props, this.state);\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t__WEBPACK_IMPORTED_MODULE_2__url_popover__[\"a\" /* default */],\n\t\t\t\t{\n\t\t\t\t\tonClickOutside: this.onClickOutside,\n\t\t\t\t\tonClose: this.resetState,\n\t\t\t\t\tfocusOnMount: showInput ? 'firstElement' : false,\n\t\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\t\tanchorRect: anchorRect\n\t\t\t\t},\n\t\t\t\tshowInput ? wp.element.createElement(LinkEditor, {\n\t\t\t\t\tvalue: inputValue,\n\t\t\t\t\tonChangeInputValue: this.onChangeInputValue,\n\t\t\t\t\tonKeyDown: this.onKeyDown,\n\t\t\t\t\tsubmitLink: this.submitLink,\n\t\t\t\t\tautocompleteRef: this.autocompleteRef,\n\t\t\t\t\tupdateLinkId: this.updateLinkId,\n\t\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\t\tresetInvalidLink: this.resetInvalidLink\n\t\t\t\t}) : wp.element.createElement(LinkViewer, {\n\t\t\t\t\turl: url,\n\t\t\t\t\teditLink: this.editLink\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn InlineAffiliateLinkUI;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(InlineAffiliateLinkUI));\n\n/***/ }),\n/* 11 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = isValidHref;\nvar _lodash = lodash,\n startsWith = _lodash.startsWith;\nvar _wp$url = wp.url,\n getProtocol = _wp$url.getProtocol,\n isValidProtocol = _wp$url.isValidProtocol,\n getAuthority = _wp$url.getAuthority,\n isValidAuthority = _wp$url.isValidAuthority,\n getPath = _wp$url.getPath,\n isValidPath = _wp$url.isValidPath,\n getQueryString = _wp$url.getQueryString,\n isValidQueryString = _wp$url.isValidQueryString,\n getFragment = _wp$url.getFragment,\n isValidFragment = _wp$url.isValidFragment;\n\n/**\n * Check for issues with the provided href.\n * \n * @since 3.6\n *\n * @param {string} href The href.\n * @return {boolean} Is the href invalid?\n */\n\nfunction isValidHref(href) {\n\tif (!href) {\n\t\treturn false;\n\t}\n\n\tvar trimmedHref = href.trim();\n\n\tif (!trimmedHref) {\n\t\treturn false;\n\t}\n\n\t// Does the href start with something that looks like a URL protocol?\n\tif (/^\\S+:/.test(trimmedHref)) {\n\t\tvar protocol = getProtocol(trimmedHref);\n\t\tif (!isValidProtocol(protocol)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Add some extra checks for http(s) URIs, since these are the most common use-case.\n\t\t// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n\t\tif (startsWith(protocol, 'http') && !/^https?:\\/\\/[^\\/\\s]/i.test(trimmedHref)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar authority = getAuthority(trimmedHref);\n\t\tif (!isValidAuthority(authority)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar path = getPath(trimmedHref);\n\t\tif (path && !isValidPath(path)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar queryString = getQueryString(trimmedHref);\n\t\tif (queryString && !isValidQueryString(queryString)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar fragment = getFragment(trimmedHref);\n\t\tif (fragment && !isValidFragment(fragment)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Validate anchor links.\n\tif (startsWith(trimmedHref, '#') && !isValidFragment(trimmedHref)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/***/ }),\n/* 12 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar __ = wp.i18n.__;\nvar Component = wp.element.Component;\nvar _wp$components = wp.components,\n Popover = _wp$components.Popover,\n IconButton = _wp$components.IconButton;\n\n/**\n * Custom URL Popover component.\n * \n * @since 3.6\n */\n\nvar ThirstyURLPopover = function (_Component) {\n\t_inherits(ThirstyURLPopover, _Component);\n\n\t/**\n * Component constructor method.\n * \n * @since 3.6\n */\n\tfunction ThirstyURLPopover() {\n\t\t_classCallCheck(this, ThirstyURLPopover);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLPopover.__proto__ || Object.getPrototypeOf(ThirstyURLPopover)).apply(this, arguments));\n\n\t\t_this.toggleSettingsVisibility = _this.toggleSettingsVisibility.bind(_this);\n\n\t\t_this.state = {\n\t\t\tisSettingsExpanded: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Component constructor.\n * \n * @since 3.6\n */\n\n\n\t_createClass(ThirstyURLPopover, [{\n\t\tkey: 'toggleSettingsVisibility',\n\t\tvalue: function toggleSettingsVisibility() {\n\t\t\tthis.setState({\n\t\t\t\tisSettingsExpanded: !this.state.isSettingsExpanded\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Component render method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _props = this.props,\n\t\t\t children = _props.children,\n\t\t\t renderSettings = _props.renderSettings,\n\t\t\t invalidLink = _props.invalidLink,\n\t\t\t _props$position = _props.position,\n\t\t\t position = _props$position === undefined ? 'bottom center' : _props$position,\n\t\t\t _props$focusOnMount = _props.focusOnMount,\n\t\t\t focusOnMount = _props$focusOnMount === undefined ? 'firstElement' : _props$focusOnMount,\n\t\t\t popoverProps = _objectWithoutProperties(_props, ['children', 'renderSettings', 'invalidLink', 'position', 'focusOnMount']);\n\n\t\t\tvar isSettingsExpanded = this.state.isSettingsExpanded;\n\n\n\t\t\tvar showSettings = !!renderSettings && isSettingsExpanded;\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\tPopover,\n\t\t\t\t_extends({\n\t\t\t\t\tclassName: 'ta-url-popover editor-url-popover block-editor-url-popover',\n\t\t\t\t\tfocusOnMount: focusOnMount,\n\t\t\t\t\tposition: position\n\t\t\t\t}, popoverProps),\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ className: 'editor-url-popover__row' },\n\t\t\t\t\tchildren,\n\t\t\t\t\t!!renderSettings && wp.element.createElement(IconButton, {\n\t\t\t\t\t\tclassName: 'editor-url-popover__settings-toggle',\n\t\t\t\t\t\ticon: 'ellipsis',\n\t\t\t\t\t\tlabel: __('Link Settings'),\n\t\t\t\t\t\tonClick: this.toggleSettingsVisibility,\n\t\t\t\t\t\t'aria-expanded': isSettingsExpanded\n\t\t\t\t\t})\n\t\t\t\t),\n\t\t\t\tshowSettings && wp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ className: 'editor-url-popover__row editor-url-popover__settings' },\n\t\t\t\t\trenderSettings()\n\t\t\t\t),\n\t\t\t\tinvalidLink && wp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ 'class': 'ta-invalid-link' },\n\t\t\t\t\t__('Invalid affiliate link')\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ThirstyURLPopover;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (ThirstyURLPopover);\n\n/***/ }),\n/* 13 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__ = __webpack_require__(14);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\n\nvar __ = wp.i18n.__;\nvar _lodash = lodash,\n throttle = _lodash.throttle;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$keycodes = wp.keycodes,\n UP = _wp$keycodes.UP,\n DOWN = _wp$keycodes.DOWN,\n ENTER = _wp$keycodes.ENTER,\n TAB = _wp$keycodes.TAB;\nvar _wp$components = wp.components,\n Spinner = _wp$components.Spinner,\n withSpokenMessages = _wp$components.withSpokenMessages,\n Popover = _wp$components.Popover;\nvar withInstanceId = wp.compose.withInstanceId;\n\n// Since URLInput is rendered in the context of other inputs, but should be\n// considered a separate modal node, prevent keyboard events from propagating\n// as being considered from the input.\n\nvar stopEventPropagation = function stopEventPropagation(event) {\n\treturn event.stopPropagation();\n};\n\n/**\n * Custom URL Input component.\n * \n * @since 3.6\n */\n\nvar ThirstyURLInput = function (_Component) {\n\t_inherits(ThirstyURLInput, _Component);\n\n\t/**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tfunction ThirstyURLInput(_ref) {\n\t\tvar autocompleteRef = _ref.autocompleteRef;\n\n\t\t_classCallCheck(this, ThirstyURLInput);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLInput.__proto__ || Object.getPrototypeOf(ThirstyURLInput)).apply(this, arguments));\n\n\t\t_this.onChange = _this.onChange.bind(_this);\n\t\t_this.onKeyDown = _this.onKeyDown.bind(_this);\n\t\t_this.autocompleteRef = autocompleteRef || createRef();\n\t\t_this.inputRef = createRef();\n\t\t_this.updateSuggestions = throttle(_this.updateSuggestions.bind(_this), 200);\n\n\t\t_this.suggestionNodes = [];\n\n\t\t_this.state = {\n\t\t\tposts: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Component did update method.\n * \n * @since 3.6\n */\n\n\n\t_createClass(ThirstyURLInput, [{\n\t\tkey: 'componentDidUpdate',\n\t\tvalue: function componentDidUpdate() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t showSuggestions = _state.showSuggestions,\n\t\t\t selectedSuggestion = _state.selectedSuggestion;\n\t\t\t// only have to worry about scrolling selected suggestion into view\n\t\t\t// when already expanded\n\n\t\t\tif (showSuggestions && selectedSuggestion !== null && !this.scrollingIntoView) {\n\t\t\t\tthis.scrollingIntoView = true;\n\t\t\t\t__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default()(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, {\n\t\t\t\t\tonlyScrollIfNeeded: true\n\t\t\t\t});\n\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t_this2.scrollingIntoView = false;\n\t\t\t\t}, 100);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Component unmount method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'componentWillUnmount',\n\t\tvalue: function componentWillUnmount() {\n\t\t\tdelete this.suggestionsRequest;\n\t\t}\n\n\t\t/**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\n\t}, {\n\t\tkey: 'bindSuggestionNode',\n\t\tvalue: function bindSuggestionNode(index) {\n\t\t\tvar _this3 = this;\n\n\t\t\treturn function (ref) {\n\t\t\t\t_this3.suggestionNodes[index] = ref;\n\t\t\t};\n\t\t}\n\n\t\t/**\n * Callback to show suggestions based on value inputted on search field.\n * \n * @since 3.6\n * \n * @param {*} value \n */\n\n\t}, {\n\t\tkey: 'updateSuggestions',\n\t\tvalue: function updateSuggestions(value) {\n\t\t\tvar _this4 = this;\n\n\t\t\t// Show the suggestions after typing at least 2 characters\n\t\t\t// and also for URLs\n\t\t\tif (value.length < 2 || /^https?:/.test(value)) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tshowSuggestions: false,\n\t\t\t\t\tselectedSuggestion: null,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.setState({\n\t\t\t\tshowSuggestions: true,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: true\n\t\t\t});\n\n\t\t\tvar formData = new FormData();\n\t\t\tformData.append(\"action\", \"search_affiliate_links_query\");\n\t\t\tformData.append(\"keyword\", value);\n\t\t\tformData.append(\"paged\", 1);\n\t\t\tformData.append(\"gutenberg\", true);\n\n\t\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\n\t\t\t// to filter results with category value. This is to prepare next update to add category filter.\n\t\t\tvar request = fetch(ajaxurl, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: formData\n\t\t\t});\n\n\t\t\trequest.then(function (response) {\n\t\t\t\treturn response.json();\n\t\t\t}).then(function (response) {\n\n\t\t\t\tif (!response.affiliate_links) return;\n\n\t\t\t\tvar posts = response.affiliate_links;\n\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif (_this4.suggestionsRequest !== request) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t_this4.setState({\n\t\t\t\t\tposts: posts,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\tif (!!posts.length) {\n\t\t\t\t\t_this4.props.debouncedSpeak(sprintf(_n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', posts.length), posts.length), 'assertive');\n\t\t\t\t} else {\n\t\t\t\t\t_this4.props.debouncedSpeak(__('No results.'), 'assertive');\n\t\t\t\t}\n\t\t\t}).catch(function () {\n\t\t\t\tif (_this4.suggestionsRequest === request) {\n\t\t\t\t\t_this4.setState({\n\t\t\t\t\t\tloading: false\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.suggestionsRequest = request;\n\t\t}\n\n\t\t/**\n * Search input value change event callback method.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'onChange',\n\t\tvalue: function onChange(event) {\n\t\t\tthis.props.resetInvalidLink();\n\t\t\tvar inputValue = event.target.value;\n\t\t\tthis.props.onChange(inputValue);\n\t\t\tthis.updateSuggestions(inputValue);\n\t\t}\n\n\t\t/**\n * Keydown event callback. Handles selecting result via keyboard.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'onKeyDown',\n\t\tvalue: function onKeyDown(event) {\n\t\t\tvar _state2 = this.state,\n\t\t\t showSuggestions = _state2.showSuggestions,\n\t\t\t selectedSuggestion = _state2.selectedSuggestion,\n\t\t\t posts = _state2.posts,\n\t\t\t loading = _state2.loading;\n\t\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n\t\t\t// We shouldn't preventDefault to allow block arrow keys navigation\n\n\t\t\tif (!showSuggestions || !posts.length || loading) {\n\t\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\n\t\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n\t\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\n\t\t\t\t// only happens if the caret is not in the first or last position in the text input.\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n\t\t\t\tswitch (event.keyCode) {\n\t\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\n\t\t\t\t\t// position.\n\t\t\t\t\tcase UP:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (0 !== event.target.selectionStart) {\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t\t\t// Set the input caret to position 0\n\t\t\t\t\t\t\t\tevent.target.setSelectionRange(0, 0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\n\t\t\t\t\t// last position.\n\t\t\t\t\tcase DOWN:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (this.props.value.length !== event.target.selectionStart) {\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t\t\t// Set the input caret to the last position\n\t\t\t\t\t\t\t\tevent.target.setSelectionRange(this.props.value.length, this.props.value.length);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar post = this.state.posts[this.state.selectedSuggestion];\n\n\t\t\tswitch (event.keyCode) {\n\t\t\t\tcase UP:\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tvar previousIndex = !selectedSuggestion ? posts.length - 1 : selectedSuggestion - 1;\n\t\t\t\t\t\tthis.setState({\n\t\t\t\t\t\t\tselectedSuggestion: previousIndex\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase DOWN:\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tvar nextIndex = selectedSuggestion === null || selectedSuggestion === posts.length - 1 ? 0 : selectedSuggestion + 1;\n\t\t\t\t\t\tthis.setState({\n\t\t\t\t\t\t\tselectedSuggestion: nextIndex\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase TAB:\n\t\t\t\t\t{\n\t\t\t\t\t\tif (this.state.selectedSuggestion !== null) {\n\t\t\t\t\t\t\tthis.selectLink(post);\n\t\t\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\n\t\t\t\t\t\t\tthis.props.speak(__('Link selected'));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase ENTER:\n\t\t\t\t\t{\n\t\t\t\t\t\tif (this.state.selectedSuggestion !== null) {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tthis.selectLink(post);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: 'selectLink',\n\t\tvalue: function selectLink(post) {\n\t\t\tthis.props.onChange(post.link, post);\n\t\t\tthis.setState({\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tshowSuggestions: false\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: 'handleOnClick',\n\t\tvalue: function handleOnClick(post) {\n\t\t\tthis.selectLink(post);\n\t\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\t\tthis.inputRef.current.focus();\n\t\t}\n\n\t\t/**\n * Component render method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t _props$value = _props.value,\n\t\t\t value = _props$value === undefined ? '' : _props$value,\n\t\t\t _props$autoFocus = _props.autoFocus,\n\t\t\t autoFocus = _props$autoFocus === undefined ? true : _props$autoFocus,\n\t\t\t instanceId = _props.instanceId,\n\t\t\t invalidLink = _props.invalidLink;\n\t\t\tvar _state3 = this.state,\n\t\t\t showSuggestions = _state3.showSuggestions,\n\t\t\t posts = _state3.posts,\n\t\t\t selectedSuggestion = _state3.selectedSuggestion,\n\t\t\t loading = _state3.loading;\n\t\t\t/* eslint-disable jsx-a11y/no-autofocus */\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ className: 'editor-url-input block-editor-url-input' },\n\t\t\t\twp.element.createElement('input', {\n\t\t\t\t\tautoFocus: autoFocus,\n\t\t\t\t\ttype: 'text',\n\t\t\t\t\t'aria-label': __('URL'),\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalue: value,\n\t\t\t\t\tonChange: this.onChange,\n\t\t\t\t\tonInput: stopEventPropagation,\n\t\t\t\t\tplaceholder: __('Paste URL or type to search'),\n\t\t\t\t\tonKeyDown: this.onKeyDown,\n\t\t\t\t\trole: 'combobox',\n\t\t\t\t\t'aria-expanded': showSuggestions,\n\t\t\t\t\t'aria-autocomplete': 'list',\n\t\t\t\t\t'aria-owns': 'editor-url-input-suggestions-' + instanceId,\n\t\t\t\t\t'aria-activedescendant': selectedSuggestion !== null ? 'editor-url-input-suggestion-' + instanceId + '-' + selectedSuggestion : undefined,\n\t\t\t\t\tref: this.inputRef\n\t\t\t\t}),\n\t\t\t\tloading && wp.element.createElement(Spinner, null),\n\t\t\t\tshowSuggestions && !!posts.length && !invalidLink && wp.element.createElement(\n\t\t\t\t\tPopover,\n\t\t\t\t\t{ position: 'bottom', noArrow: true, focusOnMount: false },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t'div',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tclassName: 'editor-url-input__suggestions block-editor-url-input__suggestions',\n\t\t\t\t\t\t\tid: 'editor-url-input-suggestions-' + instanceId,\n\t\t\t\t\t\t\tref: this.autocompleteRef,\n\t\t\t\t\t\t\trole: 'listbox'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tposts.map(function (post, index) {\n\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t'button',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tkey: post.id,\n\t\t\t\t\t\t\t\t\trole: 'option',\n\t\t\t\t\t\t\t\t\ttabIndex: '-1',\n\t\t\t\t\t\t\t\t\tid: 'block-editor-url-input-suggestion-' + instanceId + '-' + index,\n\t\t\t\t\t\t\t\t\tref: _this5.bindSuggestionNode(index),\n\t\t\t\t\t\t\t\t\tclassName: __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\treturn _this5.handleOnClick(post);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t'aria-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tpost.title || __('(no title)')\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t\t/* eslint-enable jsx-a11y/no-autofocus */\n\t\t}\n\t}]);\n\n\treturn ThirstyURLInput;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(withInstanceId(ThirstyURLInput)));\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(15);\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar util = __webpack_require__(16);\n\nfunction scrollIntoView(elem, container, config) {\n config = config || {};\n // document 归一化到 window\n if (container.nodeType === 9) {\n container = util.getWindow(container);\n }\n\n var allowHorizontalScroll = config.allowHorizontalScroll;\n var onlyScrollIfNeeded = config.onlyScrollIfNeeded;\n var alignWithTop = config.alignWithTop;\n var alignWithLeft = config.alignWithLeft;\n var offsetTop = config.offsetTop || 0;\n var offsetLeft = config.offsetLeft || 0;\n var offsetBottom = config.offsetBottom || 0;\n var offsetRight = config.offsetRight || 0;\n\n allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;\n\n var isWin = util.isWindow(container);\n var elemOffset = util.offset(elem);\n var eh = util.outerHeight(elem);\n var ew = util.outerWidth(elem);\n var containerOffset = undefined;\n var ch = undefined;\n var cw = undefined;\n var containerScroll = undefined;\n var diffTop = undefined;\n var diffBottom = undefined;\n var win = undefined;\n var winScroll = undefined;\n var ww = undefined;\n var wh = undefined;\n\n if (isWin) {\n win = container;\n wh = util.height(win);\n ww = util.width(win);\n winScroll = {\n left: util.scrollLeft(win),\n top: util.scrollTop(win)\n };\n // elem 相对 container 可视视窗的距离\n diffTop = {\n left: elemOffset.left - winScroll.left - offsetLeft,\n top: elemOffset.top - winScroll.top - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,\n top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom\n };\n containerScroll = winScroll;\n } else {\n containerOffset = util.offset(container);\n ch = container.clientHeight;\n cw = container.clientWidth;\n containerScroll = {\n left: container.scrollLeft,\n top: container.scrollTop\n };\n // elem 相对 container 可视视窗的距离\n // 注意边框, offset 是边框到根节点\n diffTop = {\n left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,\n top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,\n top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom\n };\n }\n\n if (diffTop.top < 0 || diffBottom.top > 0) {\n // 强制向上\n if (alignWithTop === true) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else if (alignWithTop === false) {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n } else {\n // 自动调整\n if (diffTop.top < 0) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;\n if (alignWithTop) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n }\n\n if (allowHorizontalScroll) {\n if (diffTop.left < 0 || diffBottom.left > 0) {\n // 强制向上\n if (alignWithLeft === true) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else if (alignWithLeft === false) {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n } else {\n // 自动调整\n if (diffTop.left < 0) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;\n if (alignWithLeft) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n }\n }\n}\n\nmodule.exports = scrollIntoView;\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nvar RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nfunction getClientPosition(elem) {\n var box = undefined;\n var x = undefined;\n var y = undefined;\n var doc = elem.ownerDocument;\n var body = doc.body;\n var docElem = doc && doc.documentElement;\n // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式\n box = elem.getBoundingClientRect();\n\n // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop\n // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确\n // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin\n\n x = box.left;\n y = box.top;\n\n // In IE, most of the time, 2 extra pixels are added to the top and left\n // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and\n // IE6 standards mode, this border can be overridden by setting the\n // document element's border to zero -- thus, we cannot rely on the\n // offset always being 2 pixels.\n\n // In quirks mode, the offset can be determined by querying the body's\n // clientLeft/clientTop, but in standards mode, it is found by querying\n // the document element's clientLeft/clientTop. Since we already called\n // getClientBoundingRect we have already forced a reflow, so it is not\n // too expensive just to query them all.\n\n // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的\n // 窗口边框标准是设 documentElement ,quirks 时设置 body\n // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去\n // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置\n // 标准 ie 下 docElem.clientTop 就是 border-top\n // ie7 html 即窗口边框改变不了。永远为 2\n // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0\n\n x -= docElem.clientLeft || body.clientLeft || 0;\n y -= docElem.clientTop || body.clientTop || 0;\n\n return {\n left: x,\n top: y\n };\n}\n\nfunction getScroll(w, top) {\n var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];\n var method = 'scroll' + (top ? 'Top' : 'Left');\n if (typeof ret !== 'number') {\n var d = w.document;\n // ie6,7,8 standard mode\n ret = d.documentElement[method];\n if (typeof ret !== 'number') {\n // quirks mode\n ret = d.body[method];\n }\n }\n return ret;\n}\n\nfunction getScrollLeft(w) {\n return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n var pos = getClientPosition(el);\n var doc = el.ownerDocument;\n var w = doc.defaultView || doc.parentWindow;\n pos.left += getScrollLeft(w);\n pos.top += getScrollTop(w);\n return pos;\n}\nfunction _getComputedStyle(elem, name, computedStyle_) {\n var val = '';\n var d = elem.ownerDocument;\n var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);\n\n // https://github.com/kissyteam/kissy/issues/61\n if (computedStyle) {\n val = computedStyle.getPropertyValue(name) || computedStyle[name];\n }\n\n return val;\n}\n\nvar _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');\nvar RE_POS = /^(top|right|bottom|left)$/;\nvar CURRENT_STYLE = 'currentStyle';\nvar RUNTIME_STYLE = 'runtimeStyle';\nvar LEFT = 'left';\nvar PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n // currentStyle maybe null\n // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];\n\n // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值\n // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n // 在 ie 下不对,需要直接用 offset 方式\n // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了\n\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // exclude left right for relativity\n if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n // Remember the original values\n var style = elem.style;\n var left = style[LEFT];\n var rsLeft = elem[RUNTIME_STYLE][LEFT];\n\n // prevent flashing of content\n elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];\n\n // Put in the new values to get a computed value out\n style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;\n ret = style.pixelLeft + PX;\n\n // Revert the changed values\n style[LEFT] = left;\n\n elem[RUNTIME_STYLE][LEFT] = rsLeft;\n }\n return ret === '' ? 'auto' : ret;\n}\n\nvar getComputedStyleX = undefined;\nif (typeof window !== 'undefined') {\n getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;\n}\n\nfunction each(arr, fn) {\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i]);\n }\n}\n\nfunction isBorderBoxFn(elem) {\n return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nvar BOX_MODELS = ['margin', 'border', 'padding'];\nvar CONTENT_INDEX = -1;\nvar PADDING_INDEX = 2;\nvar BORDER_INDEX = 1;\nvar MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n var old = {};\n var style = elem.style;\n var name = undefined;\n\n // Remember the old values, and insert the new ones\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n old[name] = style[name];\n style[name] = options[name];\n }\n }\n\n callback.call(elem);\n\n // Revert the old values\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n style[name] = old[name];\n }\n }\n}\n\nfunction getPBMWidth(elem, props, which) {\n var value = 0;\n var prop = undefined;\n var j = undefined;\n var i = undefined;\n for (j = 0; j < props.length; j++) {\n prop = props[j];\n if (prop) {\n for (i = 0; i < which.length; i++) {\n var cssProp = undefined;\n if (prop === 'border') {\n cssProp = prop + which[i] + 'Width';\n } else {\n cssProp = prop + which[i];\n }\n value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n }\n }\n }\n return value;\n}\n\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\nfunction isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}\n\nvar domUtils = {};\n\neach(['Width', 'Height'], function (name) {\n domUtils['doc' + name] = function (refWin) {\n var d = refWin.document;\n return Math.max(\n // firefox chrome documentElement.scrollHeight< body.scrollHeight\n // ie standard mode : documentElement.scrollHeight> body.scrollHeight\n d.documentElement['scroll' + name],\n // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?\n d.body['scroll' + name], domUtils['viewport' + name](d));\n };\n\n domUtils['viewport' + name] = function (win) {\n // pc browser includes scrollbar in window.innerWidth\n var prop = 'client' + name;\n var doc = win.document;\n var body = doc.body;\n var documentElement = doc.documentElement;\n var documentElementProp = documentElement[prop];\n // 标准模式取 documentElement\n // backcompat 取 body\n return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;\n };\n});\n\n/*\n 得到元素的大小信息\n @param elem\n @param name\n @param {String} [extra] 'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\nfunction getWH(elem, name, extra) {\n if (isWindow(elem)) {\n return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);\n } else if (elem.nodeType === 9) {\n return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);\n }\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem, computedStyle);\n var cssBoxValue = 0;\n if (borderBoxValue == null || borderBoxValue <= 0) {\n borderBoxValue = undefined;\n // Fall back to computed then un computed css if necessary\n cssBoxValue = getComputedStyleX(elem, name);\n if (cssBoxValue == null || Number(cssBoxValue) < 0) {\n cssBoxValue = elem.style[name] || 0;\n }\n // Normalize '', auto, and prepare for extra\n cssBoxValue = parseFloat(cssBoxValue) || 0;\n }\n if (extra === undefined) {\n extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n }\n var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;\n var val = borderBoxValue || cssBoxValue;\n if (extra === CONTENT_INDEX) {\n if (borderBoxValueOrIsBorderBox) {\n return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);\n }\n return cssBoxValue;\n }\n if (borderBoxValueOrIsBorderBox) {\n var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);\n return val + (extra === BORDER_INDEX ? 0 : padding);\n }\n return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);\n}\n\nvar cssShow = {\n position: 'absolute',\n visibility: 'hidden',\n display: 'block'\n};\n\n// fix #119 : https://github.com/kissyteam/kissy/issues/119\nfunction getWHIgnoreDisplay(elem) {\n var val = undefined;\n var args = arguments;\n // in case elem is window\n // elem.offsetWidth === undefined\n if (elem.offsetWidth !== 0) {\n val = getWH.apply(undefined, args);\n } else {\n swap(elem, cssShow, function () {\n val = getWH.apply(undefined, args);\n });\n }\n return val;\n}\n\nfunction css(el, name, v) {\n var value = v;\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {\n for (var i in name) {\n if (name.hasOwnProperty(i)) {\n css(el, i, name[i]);\n }\n }\n return undefined;\n }\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value += 'px';\n }\n el.style[name] = value;\n return undefined;\n }\n return getComputedStyleX(el, name);\n}\n\neach(['width', 'height'], function (name) {\n var first = name.charAt(0).toUpperCase() + name.slice(1);\n domUtils['outer' + first] = function (el, includeMargin) {\n return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);\n };\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n domUtils[name] = function (elem, val) {\n if (val !== undefined) {\n if (elem) {\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem);\n if (isBorderBox) {\n val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);\n }\n return css(elem, name, val);\n }\n return undefined;\n }\n return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n };\n});\n\n// 设置 elem 相对 elem.ownerDocument 的坐标\nfunction setOffset(elem, offset) {\n // set position first, in-case top/left are set even on static elem\n if (css(elem, 'position') === 'static') {\n elem.style.position = 'relative';\n }\n\n var old = getOffset(elem);\n var ret = {};\n var current = undefined;\n var key = undefined;\n\n for (key in offset) {\n if (offset.hasOwnProperty(key)) {\n current = parseFloat(css(elem, key)) || 0;\n ret[key] = current + offset[key] - old[key];\n }\n }\n css(elem, ret);\n}\n\nmodule.exports = _extends({\n getWindow: function getWindow(node) {\n var doc = node.ownerDocument || node;\n return doc.defaultView || doc.parentWindow;\n },\n offset: function offset(el, value) {\n if (typeof value !== 'undefined') {\n setOffset(el, value);\n } else {\n return getOffset(el);\n }\n },\n\n isWindow: isWindow,\n each: each,\n css: css,\n clone: function clone(obj) {\n var ret = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret[i] = obj[i];\n }\n }\n var overflow = obj.overflow;\n if (overflow) {\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret.overflow[i] = obj.overflow[i];\n }\n }\n }\n return ret;\n },\n scrollLeft: function scrollLeft(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollLeft(w);\n }\n window.scrollTo(v, getScrollTop(w));\n } else {\n if (v === undefined) {\n return w.scrollLeft;\n }\n w.scrollLeft = v;\n }\n },\n scrollTop: function scrollTop(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollTop(w);\n }\n window.scrollTo(getScrollLeft(w), v);\n } else {\n if (v === undefined) {\n return w.scrollTop;\n }\n w.scrollTop = v;\n }\n },\n\n viewportWidth: 0,\n viewportHeight: 0\n}, domUtils);\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// gutenberg-support.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 75d5f816076e5891d65a","/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/classnames/index.js\n// module id = 0\n// module chunks = 0","import registerBlocks from \"./blocks\";\nimport registerFormats from \"./formats\";\n\nimport \"./assets/styles/index.scss\";\n\nregisterBlocks();\nregisterFormats();\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","import * as taimage from \"./ta-image\";\n\nconst { registerBlockType } = wp.blocks;\n\n/**\n * Register gutenberg blocks.\n * \n * @since 3.6\n */\nexport default function registerBlocks() {\n\n [\n taimage\n ].forEach( ( block ) => {\n if ( ! block ) return;\n\n const { name , settings } = block;\n registerBlockType( name , settings );\n } );\n}\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/index.js","import classnames from \"classnames\";\n\nconst { Fragment } = wp.element;\nconst { __ } = wp.i18n;\nconst { createBlock, getBlockAttributes, getPhrasingContentSchema } = wp.blocks;\nconst { RichText } = wp.editor;\nconst { Path , SVG } = wp.components;\n\nimport edit from \"./edit\";\n\nexport const name = 'ta/image';\n\nconst blockAttributes = {\n\turl: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'src',\n\t},\n\talt: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'alt',\n\t\tdefault: '',\n\t},\n\tcaption: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'figcaption',\n\t},\n\tid: {\n\t\ttype: 'number',\n\t},\n\talign: {\n\t\ttype: 'string',\n\t},\n\twidth: {\n\t\ttype: 'number',\n\t},\n\theight: {\n\t\ttype: 'number',\n\t},\n\tlinkid: {\n\t\ttype: 'number',\n\t},\n\thref: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'ta',\n\t\tattribute: 'href'\n\t},\n\taffiliateLink: {\n\t\ttype: 'object'\n\t}\n};\n\nconst imageSchema = {\n\timg: {\n\t\tattributes: [ 'src', 'alt' ],\n\t\tclasses: [ 'alignleft', 'aligncenter', 'alignright', 'alignnone', /^wp-image-\\d+$/ ],\n\t},\n};\n\nconst schema = {\n\tfigure: {\n\t\trequire: [ 'ta' , 'img' ],\n\t\tchildren: {\n\t\t\tta: {\n\t\t\t\tattributes: [ 'href', 'linkid' ],\n\t\t\t\tchildren: imageSchema,\n\t\t\t},\n\t\t\tfigcaption: {\n\t\t\t\tchildren: getPhrasingContentSchema(),\n\t\t\t},\n\t\t},\n\t},\n};\n\nfunction getFirstAnchorAttributeFormHTML( html, attributeName ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\n\tbody.innerHTML = html;\n\n\tconst { firstElementChild } = body;\n\n\tif (\n\t\tfirstElementChild &&\n\t\tfirstElementChild.nodeName === 'A'\n\t) {\n\t\treturn firstElementChild.getAttribute( attributeName ) || undefined;\n\t}\n}\n\nexport const settings = {\n\ttitle: __( 'ThirstyAffiliates Image' ),\n\n\tdescription: __( 'Insert an image with an affiliate link to make a visual statement.' ),\n\n\ticon: <SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><Path d=\"M0,0h24v24H0V0z\" fill=\"none\" /><Path d=\"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" /><Path d=\"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" /></SVG>,\n\n\tcategory: 'common',\n\n\tkeywords: [\n\t\t'img', // \"img\" is not translated as it is intended to reflect the HTML <img> tag.\n\t\t__( 'photo' ),\n\t\t__( 'affiliate' )\n\t],\n\n\tattributes: blockAttributes,\n\n\tgetEditWrapperProps( attributes ) {\n\t\tconst { align, width } = attributes;\n\t\tif ( 'left' === align || 'center' === align || 'right' === align || 'wide' === align || 'full' === align ) {\n\t\t\treturn { 'data-align': align, 'data-resized': !! width };\n\t\t}\n\t},\n\n\tedit,\n\n\tsave( { attributes } ) {\n\t\tconst {\n\t\t\turl,\n\t\t\talt,\n\t\t\tcaption,\n\t\t\talign,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tid,\n\t\t\tlinkid,\n\t\t\thref\n\t\t} = attributes;\n\n\t\tconst classes = classnames( {\n\t\t\t[ `align${ align }` ]: align,\n\t\t\t'is-resized': width || height,\n\t\t} );\n\n\t\tconst image = (\n\t\t\t<img\n\t\t\t\tsrc={ url }\n\t\t\t\talt={ alt }\n\t\t\t\tclassName={ id ? `wp-image-${ id }` : null }\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t/>\n\t\t);\n\n\t\tconst figure = (\n\t\t\t<Fragment>\n\t\t\t\t<ta linkid={ linkid } href={ href }>\n\t\t\t\t{ image }\n\t\t\t\t</ta>\n\t\t\t\t<RichText.Content tagName=\"figcaption\" value={ caption } />\n\t\t\t</Fragment>\n\t\t);\n\n\t\tif ( 'left' === align || 'right' === align || 'center' === align ) {\n\t\t\treturn (\n\t\t\t\t<div className='wp-block-image'>\n\t\t\t\t\t<figure className={ classes }>\n\t\t\t\t\t\t{ figure }\n\t\t\t\t\t</figure>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<figure className={ `wp-block-image ${classes}` }>\n\t\t\t\t{ figure }\n\t\t\t</figure>\n\t\t);\n\t}\n};\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/index.js","import classnames from \"classnames\";\n\nconst { get , isEmpty , map , last , pick , compact } = lodash;\nconst { getPath } = wp.url;\nconst { __, sprintf } = wp.i18n;\nconst { Component, Fragment , createRef } = wp.element;\nconst { getBlobByURL, revokeBlobURL, isBlobURL } = wp.blob;\nconst { Placeholder , Button , ButtonGroup , IconButton , PanelBody , ResizableBox , SelectControl , Spinner , TextControl , TextareaControl , Toolbar , withNotices , ToggleControl , Popover } = wp.components;\nconst { withSelect } = wp.data;\nconst { RichText , BlockControls , InspectorControls , MediaUpload , MediaUploadCheck , MediaPlaceholder , BlockAlignmentToolbar , mediaUpload } = wp.editor;\nconst { withViewportMatch } = wp.viewport;\nconst { compose } = wp.compose;\n\nimport { createUpgradedEmbedBlock } from \"./util\";\nimport ImageSize from \"./image-size\";\nimport ThirstyURLInput from './search-input';\n\n/**\n * Module constants\n */\nconst MIN_SIZE = 20;\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst NEW_TAB_REL = 'noreferrer noopener';\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\nexport const pickRelevantMediaFiles = ( image ) => {\n\tconst imageProps = pick( image, [ 'alt', 'id', 'link', 'caption' ] );\n\timageProps.url = get( image, [ 'sizes', 'large', 'url' ] ) || get( image, [ 'media_details', 'sizes', 'large', 'source_url' ] ) || image.url;\n\treturn imageProps;\n};\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\n * while the image is being uploaded and will not have an id yet allocated.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the URL a Blob URL\n */\nconst isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no id\n * and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nconst isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\n\nclass ImageEdit extends Component {\n\tconstructor( { attributes } ) {\n\t\tsuper( ...arguments );\n\t\tthis.updateAlt = this.updateAlt.bind( this );\n\t\tthis.updateAlignment = this.updateAlignment.bind( this );\n\t\tthis.onFocusCaption = this.onFocusCaption.bind( this );\n\t\tthis.onImageClick = this.onImageClick.bind( this );\n\t\tthis.onSelectImage = this.onSelectImage.bind( this );\n\t\tthis.updateImageURL = this.updateImageURL.bind( this );\n\t\tthis.updateWidth = this.updateWidth.bind( this );\n\t\tthis.updateHeight = this.updateHeight.bind( this );\n\t\tthis.updateDimensions = this.updateDimensions.bind( this );\n\t\tthis.getFilename = this.getFilename.bind( this );\n\t\tthis.toggleIsEditing = this.toggleIsEditing.bind( this );\n\t\tthis.onImageError = this.onImageError.bind( this );\n\t\tthis.onChangeInputValue = this.onChangeInputValue.bind( this );\n\t\tthis.autocompleteRef = createRef();\n\t\tthis.resetInvalidLink = this.resetInvalidLink.bind( this );\n\t\tthis.updateImageSelection = this.updateImageSelection.bind( this );\n\t\tthis.onSelectAffiliateImage = this.onSelectAffiliateImage.bind( this );\n\t\tthis.editAFfiliateImage = this.editAFfiliateImage.bind( this );\n\n\t\tthis.state = {\n\t\t\tcaptionFocused: false,\n\t\t\tisEditing: ! attributes.url,\n\t\t\tinputValue : '',\n\t\t\tlinkid : 0,\n\t\t\tpost : null,\n\t\t\tshowSuggestions : false,\n\t\t\timageSelection : [],\n\t\t\taffiliateLink : null\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { attributes, setAttributes, noticeOperations } = this.props;\n\t\tconst { id, url = '' } = attributes;\n\n\t\tif ( isTemporaryImage( id, url ) ) {\n\t\t\tconst file = getBlobByURL( url );\n\n\t\t\tif ( file ) {\n\t\t\t\tmediaUpload( {\n\t\t\t\t\tfilesList: [ file ],\n\t\t\t\t\tonFileChange: ( [ image ] ) => {\n\t\t\t\t\t\tsetAttributes( pickRelevantMediaFiles( image ) );\n\t\t\t\t\t},\n\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t\tonError: ( message ) => {\n\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\tthis.setState( { isEditing: true } );\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { id: prevID, url: prevURL = '' } = prevProps.attributes;\n\t\tconst { id, url = '' } = this.props.attributes;\n\n\t\tif ( isTemporaryImage( prevID, prevURL ) && ! isTemporaryImage( id, url ) ) {\n\t\t\trevokeBlobURL( url );\n\t\t}\n\n\t\tif ( ! this.props.isSelected && prevProps.isSelected && this.state.captionFocused ) {\n\t\t\tthis.setState( {\n\t\t\t\tcaptionFocused: false,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonSelectImage( media ) {\n\n\t\tif ( ! media || ! media.url ) {\n\t\t\tthis.props.setAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\talt: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: undefined\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\tconst { affiliateLink } = this.state;\n\n\t\tthis.setState( {\n\t\t\tisEditing: false,\n\t\t} );\n\n\t\tthis.props.setAttributes( {\n\t\t\t...pickRelevantMediaFiles( media ),\n\t\t\tlinkid: affiliateLink.id,\n\t\t\thref: affiliateLink.link,\n\t\t\taffiliateLink : affiliateLink,\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t} );\n\t}\n\n\tonImageError( url ) {\n\t\t// Check if there's an embed block that handles this URL.\n\t\tconst embedBlock = createUpgradedEmbedBlock(\n\t\t\t{ attributes: { url } }\n\t\t);\n\t\tif ( undefined !== embedBlock ) {\n\t\t\tthis.props.onReplace( embedBlock );\n\t\t}\n\t}\n\n\tonFocusCaption() {\n\t\tif ( ! this.state.captionFocused ) {\n\t\t\tthis.setState( {\n\t\t\t\tcaptionFocused: true,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonImageClick() {\n\t\tif ( this.state.captionFocused ) {\n\t\t\tthis.setState( {\n\t\t\t\tcaptionFocused: false,\n\t\t\t} );\n\t\t}\n\t}\n\n\tupdateAlt( newAlt ) {\n\t\tthis.props.setAttributes( { alt: newAlt } );\n\t}\n\n\tupdateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].indexOf( nextAlign ) !== -1 ?\n\t\t\t{ width: undefined, height: undefined } :\n\t\t\t{};\n\t\tthis.props.setAttributes( { ...extraUpdatedAttributes, align: nextAlign } );\n\t}\n\n\tupdateImageURL( url ) {\n\t\tthis.props.setAttributes( { url, width: undefined, height: undefined } );\n\t}\n\n\tupdateWidth( width ) {\n\t\tthis.props.setAttributes( { width: parseInt( width, 10 ) } );\n\t}\n\n\tupdateHeight( height ) {\n\t\tthis.props.setAttributes( { height: parseInt( height, 10 ) } );\n\t}\n\n\tupdateDimensions( width = undefined, height = undefined ) {\n\t\treturn () => {\n\t\t\tthis.props.setAttributes( { width, height } );\n\t\t};\n\t}\n\n\tgetFilename( url ) {\n\t\tconst path = getPath( url );\n\t\tif ( path ) {\n\t\t\treturn last( path.split( '/' ) );\n\t\t}\n\t}\n\n\tgetLinkDestinationOptions() {\n\t\treturn [\n\t\t\t{ value: LINK_DESTINATION_NONE, label: __( 'None' ) },\n\t\t\t{ value: LINK_DESTINATION_MEDIA, label: __( 'Media File' ) },\n\t\t\t{ value: LINK_DESTINATION_ATTACHMENT, label: __( 'Attachment Page' ) },\n\t\t\t{ value: LINK_DESTINATION_CUSTOM, label: __( 'Custom URL' ) },\n\t\t];\n\t}\n\n\ttoggleIsEditing() {\n\t\tthis.setState( {\n\t\t\tisEditing: ! this.state.isEditing,\n\t\t} );\n\t}\n\n\tgetImageSizeOptions() {\n\t\tconst { imageSizes, image } = this.props;\n\t\treturn compact( map( imageSizes, ( { name, slug } ) => {\n\t\t\tconst sizeUrl = get( image, [ 'media_details', 'sizes', slug, 'source_url' ] );\n\t\t\tif ( ! sizeUrl ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tvalue: sizeUrl,\n\t\t\t\tlabel: name,\n\t\t\t};\n\t\t} ) );\n\t}\n\n\tonChangeInputValue( inputValue , post = null ) {\n\t\tconst linkid = post ? post.id : 0;\n\t\tthis.setState( { inputValue , linkid , post } );\n\t}\n\n\tresetInvalidLink() {\n\t\tthis.setState( { invalidLink : false } );\n\t}\n\n\tupdateImageSelection( imageSelection , affiliateLink ) {\n\t\tthis.setState({\n\t\t\timageSelection,\n\t\t\taffiliateLink\n\t\t});\n\t}\n\n\tonSelectAffiliateImage( image ) {\n\n\t\tif ( isExternalImage( image.id, image.src ) ) {\n\t\t\timage.url = image.src;\n\t\t\tthis.onSelectImage( image );\n\t\t} else {\n\t\t\tconst request = wp.apiFetch( {\n\t\t\t\tpath: wp.url.addQueryArgs( '/wp/v2/media/' + image.id , {\n\t\t\t\t\tcontext: 'edit',\n\t\t\t\t\t_locale: 'user'\n\t\t\t\t} ),\n\t\t\t} );\n\n\t\t\trequest.then( (media) => {\n\t\t\t\tmedia.url = media.source_url;\n\t\t\t\tthis.onSelectImage( media );\n\t\t\t} );\n\t\t}\n\t}\n\n\teditAFfiliateImage() {\n\n\t\tconst { attributes } = this.props;\n\t\tconst { affiliateLink } = attributes;\n\n\t\tthis.setState({\n\t\t\tisEditing : true,\n\t\t\timageSelection : affiliateLink.images,\n\t\t\taffiliateLink\n\t\t});\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tisEditing,\n\t\t\timageSelection,\n\t\t\taffiliateLink,\n\t\t} = this.state;\n\t\tconst {\n\t\t\tattributes,\n\t\t\tsetAttributes,\n\t\t\tisLargeViewport,\n\t\t\tisSelected,\n\t\t\tclassName,\n\t\t\tmaxWidth,\n\t\t\ttoggleSelection,\n\t\t\tisRTL,\n\t\t} = this.props;\n\t\tconst {\n\t\t\turl,\n\t\t\talt,\n\t\t\tcaption,\n\t\t\talign,\n\t\t\tlinkDestination,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tlinkid,\n\t\t\thref\n\t\t} = attributes;\n\t\tconst toolbarEditButton = (\n\t\t\t<Toolbar>\n\t\t\t\t<IconButton\n\t\t\t\t\tclassName=\"ta-edit-image-button components-icon-button components-toolbar__control\"\n\t\t\t\t\tlabel={ __( 'Edit ThirstyAffiliates Image' ) }\n\t\t\t\t\ticon=\"edit\"\n\t\t\t\t\tonClick={ this.editAFfiliateImage }\n\t\t\t\t/>\n\t\t\t</Toolbar>\n\t\t);\n\n\t\tconst controls = (\n\t\t\t<BlockControls>\n\t\t\t\t<BlockAlignmentToolbar\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ this.updateAlignment }\n\t\t\t\t/>\n\t\t\t\t{ toolbarEditButton }\n\t\t\t</BlockControls>\n\t\t);\n\n\t\tif ( isEditing ) {\n\t\t\treturn (\n\t\t\t\t<Fragment>\n\t\t\t\t\t{ controls }\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ \"format-image\" }\n\t\t\t\t\t\tlabel={ __( \"ThirstyAffiliates Image\" ) }\n\t\t\t\t\t\tinstructions={ __( \"Search for an affiliate link and select image to insert.\" ) }\n\t\t\t\t\t>\n\n\t\t\t\t\t\t<ThirstyURLInput\n\t\t\t\t\t\t\tupdateImageSelection={ this.updateImageSelection }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t{ !! imageSelection.length &&\n\t\t\t\t\t\t\t<div className=\"ta-image-sel-wrap\">\n\t\t\t\t\t\t\t\t<h3>{ `${affiliateLink.title} ${ __( 'attached images:' ) }` }</h3>\n\t\t\t\t\t\t\t\t<div className=\"ta-image-selection\">\n\t\t\t\t\t\t\t\t\t{ imageSelection.map( ( image , index ) => (\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => this.onSelectAffiliateImage( image ) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<img src={ image.src } />\n\t\t\t\t\t\t\t\t\t\t</button>\n\n\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t</Placeholder>\n\t\t\t\t</Fragment>\n\t\t\t);\n\t\t}\n\n\t\tconst classes = classnames( className, {\n\t\t\t'wp-block-image' : true,\n\t\t\t'is-transient': isBlobURL( url ),\n\t\t\t'is-resized': !! width || !! height,\n\t\t\t'is-focused': isSelected,\n\t\t} );\n\n\t\tconst isResizable = [ 'wide', 'full' ].indexOf( align ) === -1 && isLargeViewport;\n\t\tconst imageSizeOptions = this.getImageSizeOptions();\n\n\t\tconst getInspectorControls = ( imageWidth, imageHeight ) => (\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Image Settings' ) }>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tlabel={ __( 'Alt Text (Alternative Text)' ) }\n\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\tonChange={ this.updateAlt }\n\t\t\t\t\t\thelp={ __( 'Alternative text describes your image to people who can’t see it. Add a short description with its key details.' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isEmpty( imageSizeOptions ) && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Image Size' ) }\n\t\t\t\t\t\t\tvalue={ url }\n\t\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\t\tonChange={ this.updateImageURL }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isResizable && (\n\t\t\t\t\t\t<div className=\"block-library-image__dimensions\">\n\t\t\t\t\t\t\t<p className=\"block-library-image__dimensions__row\">\n\t\t\t\t\t\t\t\t{ __( 'Image Dimensions' ) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<div className=\"block-library-image__dimensions__row\">\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-image__dimensions__width\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\t\t\tvalue={ width !== undefined ? width : '' }\n\t\t\t\t\t\t\t\t\tplaceholder={ imageWidth }\n\t\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\t\tonChange={ this.updateWidth }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-image__dimensions__height\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\t\t\t\tvalue={ height !== undefined ? height : '' }\n\t\t\t\t\t\t\t\t\tplaceholder={ imageHeight }\n\t\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\t\tonChange={ this.updateHeight }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"block-library-image__dimensions__row\">\n\t\t\t\t\t\t\t\t<ButtonGroup aria-label={ __( 'Image Size' ) }>\n\t\t\t\t\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( scale ) => {\n\t\t\t\t\t\t\t\t\t\tconst scaledWidth = Math.round( imageWidth * ( scale / 100 ) );\n\t\t\t\t\t\t\t\t\t\tconst scaledHeight = Math.round( imageHeight * ( scale / 100 ) );\n\n\t\t\t\t\t\t\t\t\t\tconst isCurrent = width === scaledWidth && height === scaledHeight;\n\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ scale }\n\t\t\t\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimary={ isCurrent }\n\t\t\t\t\t\t\t\t\t\t\t\taria-pressed={ isCurrent }\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ this.updateDimensions( scaledWidth, scaledHeight ) }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ scale }%\n\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\tonClick={ this.updateDimensions() }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t);\n\n\t\t// Disable reason: Each block can be selected by clicking on it\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t{ controls }\n\t\t\t\t<figure className={ classes }>\n\t\t\t\t\t<ImageSize src={ url } dirtynessTrigger={ align }>\n\t\t\t\t\t\t{ ( sizes ) => {\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\timageWidthWithinContainer,\n\t\t\t\t\t\t\t\timageHeightWithinContainer,\n\t\t\t\t\t\t\t\timageWidth,\n\t\t\t\t\t\t\t\timageHeight,\n\t\t\t\t\t\t\t} = sizes;\n\n\t\t\t\t\t\t\tconst filename = this.getFilename( url );\n\t\t\t\t\t\t\tlet defaultedAlt;\n\t\t\t\t\t\t\tif ( alt ) {\n\t\t\t\t\t\t\t\tdefaultedAlt = alt;\n\t\t\t\t\t\t\t} else if ( filename ) {\n\t\t\t\t\t\t\t\tdefaultedAlt = sprintf( __( 'This image has an empty alt attribute; its file name is %s' ), filename );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst img = (\n\t\t\t\t\t\t\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t\t\t\t\t\t\t// should direct focus to block.\n\t\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t<ta linkid={ linkid } href={ href }>\n\t\t\t\t\t\t\t\t\t\t<img src={ url } alt={ defaultedAlt } onClick={ this.onImageClick } onError={ () => this.onImageError( url ) } />\n\t\t\t\t\t\t\t\t\t</ta>\n\t\t\t\t\t\t\t\t\t{ isBlobURL( url ) && <Spinner /> }\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( ! isResizable || ! imageWidthWithinContainer ) {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t{ getInspectorControls( imageWidth, imageHeight ) }\n\t\t\t\t\t\t\t\t\t\t<div style={ { width, height } }>\n\t\t\t\t\t\t\t\t\t\t\t{ img }\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst currentWidth = width || imageWidthWithinContainer;\n\t\t\t\t\t\t\tconst currentHeight = height || imageHeightWithinContainer;\n\n\t\t\t\t\t\t\tconst ratio = imageWidth / imageHeight;\n\t\t\t\t\t\t\tconst minWidth = imageWidth < imageHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\t\t\t\t\t\tconst minHeight = imageHeight < imageWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t\t\t\t\t\t// With the current implementation of ResizableBox, an image needs an explicit pixel value for the max-width.\n\t\t\t\t\t\t\t// In absence of being able to set the content-width, this max-width is currently dictated by the vanilla editor style.\n\t\t\t\t\t\t\t// The following variable adds a buffer to this vanilla style, so 3rd party themes have some wiggleroom.\n\t\t\t\t\t\t\t// This does, in most cases, allow you to scale the image beyond the width of the main column, though not infinitely.\n\t\t\t\t\t\t\t// @todo It would be good to revisit this once a content-width variable becomes available.\n\t\t\t\t\t\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\t\t\t\t\t\t\tlet showRightHandle = false;\n\t\t\t\t\t\t\tlet showLeftHandle = false;\n\n\t\t\t\t\t\t\t/* eslint-disable no-lonely-if */\n\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\t\t\t\t\t\tif ( align === 'center' ) {\n\t\t\t\t\t\t\t\t// When the image is centered, show both handles.\n\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t} else if ( isRTL ) {\n\t\t\t\t\t\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t\t\t\t\t\t// Show the right handle and hide the left handle only when it is aligned left.\n\t\t\t\t\t\t\t\t// Otherwise always show the left handle.\n\t\t\t\t\t\t\t\tif ( align === 'left' ) {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Show the left handle and hide the right handle only when the image is aligned right.\n\t\t\t\t\t\t\t\t// Otherwise always show the right handle.\n\t\t\t\t\t\t\t\tif ( align === 'right' ) {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/* eslint-enable no-lonely-if */\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t{ getInspectorControls( imageWidth, imageHeight ) }\n\t\t\t\t\t\t\t\t\t<ResizableBox\n\t\t\t\t\t\t\t\t\t\tsize={\n\t\t\t\t\t\t\t\t\t\t\twidth && height ? {\n\t\t\t\t\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\t\t\t\t\theight,\n\t\t\t\t\t\t\t\t\t\t\t} : undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tminWidth={ minWidth }\n\t\t\t\t\t\t\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\t\t\t\t\t\t\tminHeight={ minHeight }\n\t\t\t\t\t\t\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\t\t\t\t\t\t\tlockAspectRatio\n\t\t\t\t\t\t\t\t\t\tenable={ {\n\t\t\t\t\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonResizeStart={ () => {\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: parseInt( currentWidth + delta.width, 10 ),\n\t\t\t\t\t\t\t\t\t\t\t\theight: parseInt( currentHeight + delta.height, 10 ),\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ img }\n\t\t\t\t\t\t\t\t\t</ResizableBox>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t</ImageSize>\n\t\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\t\tplaceholder={ __( 'Write caption…' ) }\n\t\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\t\tunstableOnFocus={ this.onFocusCaption }\n\t\t\t\t\t\t\tonChange={ ( value ) => setAttributes( { caption: value } ) }\n\t\t\t\t\t\t\tisSelected={ this.state.captionFocused }\n\t\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</figure>\n\t\t\t</Fragment>\n\t\t);\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select, props ) => {\n\t\tconst { getMedia } = select( 'core' );\n\t\tconst { getEditorSettings } = select( 'core/editor' );\n\t\tconst { id } = props.attributes;\n\t\tconst { maxWidth, isRTL, imageSizes } = getEditorSettings();\n\n\t\treturn {\n\t\t\timage: id ? getMedia( id ) : null,\n\t\t\tmaxWidth,\n\t\t\tisRTL,\n\t\t\timageSizes,\n\t\t};\n\t} ),\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\n\twithNotices,\n] )( ImageEdit );\n\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/edit.js","const WORDPRESS_EMBED_BLOCK = 'core-embed/wordpress';\n\nconst { includes } = lodash;\nconst { renderToString } = wp.element;\nconst { createBlock } = wp.blocks;\n\n/***\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} attributesFromPreview Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\nexport const createUpgradedEmbedBlock = ( props, attributesFromPreview ) => {\n\tconst { preview, name } = props;\n\tconst { url } = props.attributes;\n\n\tif ( ! url ) {\n\t\treturn;\n\t}\n\n\tconst matchingBlock = findBlock( url );\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tif ( WORDPRESS_EMBED_BLOCK !== name && DEFAULT_EMBED_BLOCK !== matchingBlock ) {\n\t\t// At this point, we have discovered a more suitable block for this url, so transform it.\n\t\tif ( name !== matchingBlock ) {\n\t\t\treturn createBlock( matchingBlock, { url } );\n\t\t}\n\t}\n\n\tif ( preview ) {\n\t\tconst { html } = preview;\n\n\t\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\t\tif ( isFromWordPress( html ) ) {\n\t\t\t// If this is not the WordPress embed block, transform it into one.\n\t\t\tif ( WORDPRESS_EMBED_BLOCK !== name ) {\n\t\t\t\treturn createBlock(\n\t\t\t\t\tWORDPRESS_EMBED_BLOCK,\n\t\t\t\t\t{\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t// By now we have the preview, but when the new block first renders, it\n\t\t\t\t\t\t// won't have had all the attributes set, and so won't get the correct\n\t\t\t\t\t\t// type and it won't render correctly. So, we pass through the current attributes\n\t\t\t\t\t\t// here so that the initial render works when we switch to the WordPress\n\t\t\t\t\t\t// block. This only affects the WordPress block because it can't be\n\t\t\t\t\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\n\t\t\t\t\t\t// relies on the preview to set the correct render type.\n\t\t\t\t\t\t...attributesFromPreview,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport const isFromWordPress = ( html ) => {\n\treturn includes( html, 'class=\"wp-embedded-content\" data-secret' );\n};\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/util.js","const { noop } = lodash;\n\nconst { withGlobalEvents } = wp.compose;\nconst { Component } = wp.element;\n\nclass ImageSize extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t};\n\t\tthis.bindContainer = this.bindContainer.bind( this );\n\t\tthis.calculateSize = this.calculateSize.bind( this );\n\t}\n\n\tbindContainer( ref ) {\n\t\tthis.container = ref;\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( this.props.src !== prevProps.src ) {\n\t\t\tthis.setState( {\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t} );\n\t\t\tthis.fetchImageSize();\n\t\t}\n\n\t\tif ( this.props.dirtynessTrigger !== prevProps.dirtynessTrigger ) {\n\t\t\tthis.calculateSize();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.fetchImageSize();\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.image ) {\n\t\t\tthis.image.onload = noop;\n\t\t}\n\t}\n\n\tfetchImageSize() {\n\t\tthis.image = new window.Image();\n\t\tthis.image.onload = this.calculateSize;\n\t\tthis.image.src = this.props.src;\n\t}\n\n\tcalculateSize() {\n\t\tconst maxWidth = this.container.clientWidth;\n\t\tconst exceedMaxWidth = this.image.width > maxWidth;\n\t\tconst ratio = this.image.height / this.image.width;\n\t\tconst width = exceedMaxWidth ? maxWidth : this.image.width;\n\t\tconst height = exceedMaxWidth ? maxWidth * ratio : this.image.height;\n\t\tthis.setState( { width, height } );\n\t}\n\n\trender() {\n\t\tconst sizes = {\n\t\t\timageWidth: this.image && this.image.width,\n\t\t\timageHeight: this.image && this.image.height,\n\t\t\tcontainerWidth: this.container && this.container.clientWidth,\n\t\t\tcontainerHeight: this.container && this.container.clientHeight,\n\t\t\timageWidthWithinContainer: this.state.width,\n\t\t\timageHeightWithinContainer: this.state.height,\n\t\t};\n\t\treturn (\n\t\t\t<div ref={ this.bindContainer }>\n\t\t\t\t{ this.props.children( sizes ) }\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default withGlobalEvents( {\n\tresize: 'calculateSize',\n} )( ImageSize );\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/image-size.js","import classnames from \"classnames\";\n\nconst { __ } = wp.i18n;\nconst { Component , createRef } = wp.element;\nconst { Spinner, withSpokenMessages, Popover , TextControl } = wp.components;\nconst { withInstanceId } = wp.compose;\n\nclass ThirstyURLInput extends Component {\n\n /**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tconstructor( { autocompleteRef } ) {\n\t\tsuper( ...arguments );\n\n\t\t// this.onChange = this.onChange.bind( this );\n\t\t// this.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.autocompleteRef = autocompleteRef || createRef();\n\t\tthis.inputRef = createRef();\n\t\tthis.searchAffiliateLinks = this.searchAffiliateLinks.bind( this );\n\t\t// this.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n\t\tthis.suggestionNodes = [];\n\n\t\tthis.state = {\n\t\t\tposts : [],\n\t\t\tshowSuggestions : false,\n\t\t\tselectedSuggestion : null,\n\t\t\tloading : false\n\t\t};\n\t}\n\n\t/**\n * Component did update method.\n * \n * @since 3.6\n */\n\tcomponentDidUpdate() {\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\n\t\t// only have to worry about scrolling selected suggestion into view\n\t\t// when already expanded\n\t\tif ( showSuggestions && selectedSuggestion !== null && ! this.scrollingIntoView ) {\n\t\t\tthis.scrollingIntoView = true;\n\t\t\tscrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef.current, {\n\t\t\t\tonlyScrollIfNeeded: true,\n\t\t\t} );\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tthis.scrollingIntoView = false;\n\t\t\t}, 100 );\n\t\t}\n\t}\n\n\t/**\n * Component unmount method.\n * \n * @since 3.6\n */\n\tcomponentWillUnmount() {\n\t\tdelete this.suggestionsRequest;\n\t}\n\n\t/**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\tbindSuggestionNode( index ) {\n\t\treturn ( ref ) => {\n\t\t\tthis.suggestionNodes[ index ] = ref;\n\t\t};\n\t}\n\t\n\tsearchAffiliateLinks( value ) {\n\n\t\t// Show the suggestions after typing at least 2 characters=\n\t\tif ( value.length < 2 ) {\n\t\t\tthis.setState( {\n\t\t\t\tshowSuggestions: false,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: false,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setState({\n\t\t\tshowSuggestions : true,\n\t\t\tselectedSuggestion : null,\n\t\t\tloading : true\n\t\t});\n\n\t\tconst formData = new FormData();\n formData.append( \"action\" , \"search_affiliate_links_query\" );\n formData.append( \"keyword\" , value );\n formData.append( \"paged\" , 1 );\n\t\tformData.append( \"gutenberg\" , true );\n\t\tformData.append( \"with_images\" , true );\n\t\t\n\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\n // to filter results with category value. This is to prepare next update to add category filter.\n const request = fetch( ajaxurl , {\n method : \"POST\",\n body : formData\n\t\t} );\n\t\t\n\t\trequest\n .then( response => response.json() )\n .then( ( response ) => {\n\n if ( ! response.affiliate_links ) return;\n\n const posts = response.affiliate_links;\n\n\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\treturn;\n }\n\n\t\t\tthis.setState( {\n\t\t\t\tposts,\n\t\t\t\tloading: false,\n } );\n\n\t\t\tif ( !! posts.length ) {\n\t\t\t\tthis.props.debouncedSpeak( sprintf( _n(\n\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\tposts.length\n\t\t\t\t), posts.length ), 'assertive' );\n\t\t\t} else {\n\t\t\t\tthis.props.debouncedSpeak( __( 'No results.' ), 'assertive' );\n }\n\n\t\t} ).catch( () => {\n\t\t\tif ( this.suggestionsRequest === request ) {\n\t\t\t\tthis.setState( {\n\t\t\t\t\tloading: false,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\tthis.suggestionsRequest = request;\n\t}\n\n\t/**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\tselectLink( post ) {\n\t\t// this.props.onChange( post.link, post );\n\t\tthis.setState( {\n\t\t\tselectedSuggestion: post,\n\t\t\tshowSuggestions: false,\n\t\t} );\n\n\t\tthis.props.updateImageSelection( post.images , post );\n\t}\n\n\t/**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\thandleOnClick( post ) {\n\t\tthis.selectLink( post );\n\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\t// this.inputRef.current.focus();\n\t}\n\n render() {\n const { value = '', autoFocus = true, instanceId } = this.props;\n const { showSuggestions , posts, selectedSuggestion , loading } = this.state;\n \n return (\n <div class=\"edit-search-affiliate-links\">\n\t\t\t\t<form\n\t\t\t\t\tclassName=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover\"\n\t\t\t\t\tonSubmit={ this.displayAffiliateImages }\n\t\t\t\t>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tclassName=\"ta-search-affiliate-links\"\n\t\t\t\t\t\tplaceholder={ __( \"Type to search affiliate links\" ) }\n\t\t\t\t\t\tonChange={ this.searchAffiliateLinks }\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ ( loading ) && <Spinner /> }\n\n\t\t\t\t\t{ showSuggestions && !! posts.length && \n\t\t\t\t\t\t<Popover position=\"bottom\" focusOnMount={ false }>\n\t\t\t\t\t\t\t<div class=\"affilate-links-suggestions\">\n\t\t\t\t\t\t\t\t{ posts.map( ( post, index ) => (\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\tkey={ post.id }\n\t\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t\t\tid={ `editor-url-input-suggestion-${ instanceId }-${ index }` }\n\t\t\t\t\t\t\t\t\t\tref={ this.bindSuggestionNode( index ) }\n\t\t\t\t\t\t\t\t\t\tclassName={ classnames( 'editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion,\n\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => this.handleOnClick( post ) }\n\t\t\t\t\t\t\t\t\t\taria-selected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ post.title || __( '(no title)' ) }\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t\t}\n\t\t\t\t</form>\n </div>\n );\n }\n}\n\nexport default withSpokenMessages( withInstanceId( ThirstyURLInput ) );\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/search-input.js","import { taLink } from \"./ta-link\";\n\nconst { registerFormatType } = wp.richText;\n\n/**\n * Register custom formats.\n * \n * @since 3.6\n */\nexport default function registerFormats() {\n\n [\n taLink\n ].forEach( ( { name , ...settings } ) => registerFormatType( name , settings ) );\n}\n\n\n// WEBPACK FOOTER //\n// ./src/formats/index.js","import InlineAffiliateLinkUI from './inline';\n\nconst { __ } = wp.i18n;\nconst { Component , Fragment } = wp.element;\nconst { withSpokenMessages } = wp.components;\nconst { getTextContent , applyFormat , removeFormat , slice } = wp.richText;\nconst { isURL } = wp.url;\nconst { RichTextToolbarButton , RichTextShortcut } = wp.editor;\nconst { Path , SVG } = wp.components;\nconst { getRectangleFromRange } = wp.dom;\n\nconst name = \"ta/link\";\n\n/**\n * Custom Affiliate link format. When applied will wrap selected text with <ta href=\"\" linkid=\"\"></ta> custom element.\n * Custom element is implemented here as we are not allowed to use <a> tag due to Gutenberg limitations.\n * Element is converted to normal <a> tag on frontend via PHP script filtered on 'the_content'.\n * \n * @since 3.6\n */\nexport const taLink = {\n name,\n title : __( \"Affiliate Link\" ),\n tagName : \"ta\",\n className : null,\n attributes : {\n\t\turl : \"href\",\n\t\ttarget : \"target\"\n },\n edit : withSpokenMessages( class LinkEdit extends Component {\n\t\t\n\t\t/**\n\t\t * Component constructor.\n\t\t * \n\t\t * @since 3.6\n\t\t */\n\t\tconstructor() {\n\t\t\tsuper( ...arguments );\n\n\t\t\tthis.addLink = this.addLink.bind( this );\n\t\t\tthis.stopAddingLink = this.stopAddingLink.bind( this );\n\t\t\tthis.onRemoveFormat = this.onRemoveFormat.bind( this );\n\t\t\tthis.state = {\n\t\t\t\taddingLink: false,\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Callback to set state to adding link status.\n\t\t * \n\t\t * @since 3.6\n\t\t */\n\t\taddLink() {\n\n\t\t\tconst { value, onChange } = this.props;\n\t\t\tconst text = getTextContent( slice( value ) );\n\n\t\t\tif ( text && isURL( text ) ) {\n\t\t\t\tonChange( applyFormat( value, { type: name, attributes: { url: text } } ) );\n\t\t\t} else {\n\t\t\t\tthis.setState( { addingLink: true } );\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Callback to set state to stop adding link status.\n\t\t * \n\t\t * @since 3.6\n\t\t */\n\t\tstopAddingLink() {\n\t\t\tthis.setState( { addingLink: false } );\n\t\t}\n\n\t\t/**\n\t\t * Remove format event callback.\n\t\t * \n\t\t * @since 3.6\n\t\t */\n\t\tonRemoveFormat() {\n\t\t\tconst { value , onChange , speak } = this.props;\n\n\t\t\tonChange( removeFormat( value , name ) );\n\t\t\tspeak( __( \"Affiliate Link removed.\" ), \"assertive\" );\n\t\t}\n\n\t\t/**\n\t\t * Get selected anchor text.\n\t\t * \n\t\t * @since 3.9\n\t\t */\n\t\tgetAnchorRect() {\n\n\t\t\tconst selection = window.getSelection();\n\t\t\tconst range = selection.rangeCount > 0 ? selection.getRangeAt( 0 ) : null;\n\n\t\t\tif ( ! range ) return;\n\n\t\t\tlet rect = null;\n\n\t\t\tif ( this.state.addingLink ) {\n\t\t\t\trect = getRectangleFromRange( range );\n\t\t\t} else {\n\n\t\t\t\tlet element = range.startContainer;\n\n\t\t\t\t// If the caret is right before the element, select the next element.\n\t\t\t\telement = element.nextElementSibling || element;\n\n\t\t\t\twhile ( element.nodeType !== window.Node.ELEMENT_NODE ) {\n\t\t\t\t\telement = element.parentNode;\n\t\t\t\t}\n\n\t\t\t\tconst closest = element.closest( 'ta' );\n\t\t\t\tif ( closest ) {\n\t\t\t\t\trect = closest.getBoundingClientRect();\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\n\t\t\treturn rect;\n\t\t}\n\n\t\t/**\n\t\t * Component render method.\n\t\t * \n\t\t * @since 3.6\n\t\t */\n\t\trender() {\n\t\t\tconst { isActive , activeAttributes , value , onChange } = this.props;\n\n\t\t\tconst anchorRect = this.getAnchorRect();\n\n\t\t\treturn (\n\t\t\t\t<Fragment>\n\t\t\t\t\t<RichTextShortcut\n\t\t\t\t\t\ttype=\"access\"\n\t\t\t\t\t\tcharacter=\"s\"\n\t\t\t\t\t\tonUse={ this.onRemoveFormat }\n\t\t\t\t\t/>\n\t\t\t\t\t<RichTextShortcut\n\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\tcharacter=\"l\"\n\t\t\t\t\t\tonUse={ this.addLink }\n\t\t\t\t\t/>\n\t\t\t\t\t<RichTextShortcut\n\t\t\t\t\t\ttype=\"primaryShift\"\n\t\t\t\t\t\tcharacter=\"l\"\n\t\t\t\t\t\tonUse={ this.onRemoveFormat }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isActive && <RichTextToolbarButton\n\t\t\t\t\t\ticon=\"editor-unlink\"\n\t\t\t\t\t\ttitle={ __( 'Remove Affiliate Link' ) }\n\t\t\t\t\t\tclassName=\"ta-unlink-button\"\n\t\t\t\t\t\tonClick={ this.onRemoveFormat }\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\tshortcutType=\"primaryShift\"\n\t\t\t\t\t\tshortcutCharacter=\"l\"\n\t\t\t\t\t/> }\n\t\t\t\t\t{ ! isActive && <RichTextToolbarButton\n\t\t\t\t\t\ticon={ <SVG xmlns=\"http://www.w3.org/2000/svg\" width=\"16.688\" height=\"9.875\" viewBox=\"0 0 16.688 9.875\"><Path id=\"TA.svg\" fill=\"black\" class=\"cls-1\" d=\"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z\" transform=\"translate(-1.188 -5.25)\"/></SVG> }\n\t\t\t\t\t\ttitle={ __( 'Affiliate Link' ) }\n\t\t\t\t\t\tclassName=\"ta-link-button\"\n\t\t\t\t\t\tonClick={ this.addLink }\n\t\t\t\t\t\tshortcutType=\"primary\"\n\t\t\t\t\t\tshortcutCharacter=\"l\"\n\t\t\t\t\t/> }\n\t\t\t\t\t<InlineAffiliateLinkUI\n\t\t\t\t\t\taddingLink={ this.state.addingLink }\n\t\t\t\t\t\tstopAddingLink={ this.stopAddingLink }\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\t\tanchorRect={ anchorRect }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</Fragment>\n\t\t\t);\n\t\t}\n } )\n}\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/index.js","import classnames from \"classnames\";\nimport { isValidHref } from './utils';\nimport ThirstyURLPopover from './url-popover';\nimport ThirstyURLInput from './url-input';\n\nconst { __ } = wp.i18n;\nconst { Component , createRef } = wp.element;\nconst { ExternalLink , ToggleControl , IconButton , withSpokenMessages } = wp.components;\nconst { LEFT, RIGHT, UP, DOWN, BACKSPACE, ENTER } = wp.keycodes;\nconst { prependHTTP , safeDecodeURI , filterURLForDisplay } = wp.url;\nconst { create , insert , isCollapsed , applyFormat , getTextContent , slice } = wp.richText;\n\nconst stopKeyPropagation = ( event ) => event.stopPropagation();\n\n/**\n * Generates the format object that will be applied to the link text.\n * \n * @since 3.6\n *\n * @param {string} url The href of the link.\n * @param {boolean} linkid Affiliate link ID.\n * @param {Object} text The text that is being hyperlinked.\n *\n * @return {Object} The final format object.\n */\nfunction createLinkFormat( { url , linkid , text } ) {\n\tconst format = {\n\t\ttype: \"ta/link\",\n\t\tattributes: {\n\t\t\turl,\n\t\t\tlinkid : linkid.toString()\n\t\t},\n\t};\n\n\treturn format;\n}\n\n/**\n * Check if input is being show.\n * \n * @since 3.6\n * \n * @param {Object} props Component props.\n * @param {Object} state Component state.\n */\nfunction isShowingInput( props , state ) {\n\treturn props.addingLink || state.editLink;\n}\n\n/**\n * Affiliate Link editor JSX element.\n * \n * @since 3.6\n * \n * @param {Object} param0 Component props (destructred).\n */\nconst LinkEditor = ( { value , onChangeInputValue , onKeyDown , submitLink, invalidLink , resetInvalidLink , autocompleteRef } ) => (\n\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t<form\n\t\tclassName=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover\"\n\t\tonKeyPress={ stopKeyPropagation }\n\t\tonKeyDown={ onKeyDown }\n\t\tonSubmit={ submitLink }\n\t>\n\t\t<ThirstyURLInput\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChangeInputValue }\n\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\tinvalidLink={ invalidLink }\n\t\t\tresetInvalidLink={ resetInvalidLink }\n\t\t/>\n\t\t<IconButton icon=\"editor-break\" label={ __( 'Apply' ) } type=\"submit\" />\n\t</form>\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n);\n\n/**\n * Affiliate link url viewer JSX element.\n * \n * @param {*} param0 Component props (destructred).\n */\nconst LinkViewerUrl = ( { url } ) => {\n\tconst prependedURL = prependHTTP( url );\n\tconst linkClassName = classnames( 'editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value', {\n\t\t'has-invalid-link': ! isValidHref( prependedURL ),\n\t} );\n\n\tif ( ! url ) {\n\t\treturn <span className={ linkClassName }></span>;\n\t}\n\n\treturn (\n\t\t<ExternalLink\n\t\t\tclassName={ linkClassName }\n\t\t\thref={ url }\n\t\t>\n\t\t\t{ filterURLForDisplay( safeDecodeURI( url ) ) }\n\t\t</ExternalLink>\n\t);\n};\n\n/**\n * Affiliate link viewer JSX element.\n * \n * @param {*} param0 Component props (destructred).\n */\nconst LinkViewer = ( { url, editLink } ) => {\n\treturn (\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\t<div\n\t\t\tclassName=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content\"\n\t\t\tonKeyPress={ stopKeyPropagation }\n\t\t>\n\t\t\t<LinkViewerUrl url={ url } />\n\t\t\t<IconButton icon=\"edit\" label={ __( 'Edit' ) } onClick={ editLink } />\n\t\t</div>\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\t);\n};\n\n/**\n * Inline affiliate link UI Component.\n * \n * @since 3.6\n * \n * @param {*} param0 Component props (destructred).\n */\nclass InlineAffiliateLinkUI extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.editLink = this.editLink.bind( this );\n\t\tthis.submitLink = this.submitLink.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.onChangeInputValue = this.onChangeInputValue.bind( this );\n\t\tthis.onClickOutside = this.onClickOutside.bind( this );\n\t\tthis.resetState = this.resetState.bind( this );\n\t\tthis.autocompleteRef = createRef();\n\t\tthis.resetInvalidLink = this.resetInvalidLink.bind( this );\n\n\t\tthis.state = {\n\t\t\tinputValue : '',\n\t\t\tlinkid : 0,\n\t\t\tpost : null,\n\t\t\tinvalidLink : false\n\t\t};\n\t}\n\n\t/**\n\t * Stop the key event from propagating up to ObserveTyping.startTypingInTextField.\n\t * \n\t * @since 3.6\n\t * \n\t * @param {Object} event Event object.\n\t */\n\tonKeyDown( event ) {\n\t\tif ( [ LEFT, DOWN, RIGHT, UP, BACKSPACE, ENTER ].indexOf( event.keyCode ) > -1 ) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\t}\n\n\t/**\n\t * Callback to set state when input value is changed.\n\t * \n\t * @since 3.6\n\t * \n\t * @param {*} inputValue \n\t * @param {*} post \n\t */\n\tonChangeInputValue( inputValue , post = null ) {\n\t\tconst linkid = post ? post.id : 0;\n\t\tthis.setState( { inputValue , linkid , post } );\n\t}\n\n\t/**\n\t * Callback to set state when edit affiliate link (already inserted) is triggered.\n\t * \n\t * @since 3.6\n\t * \n\t * @param {*} event \n\t */\n\teditLink( event ) {\n\t\tthis.setState( { editLink: true } );\n\t\tevent.preventDefault();\n\t}\n\n\t/**\n\t * Callback to apply the affiliate link format to the selected text or position in the active block.\n\t * \n\t * @since 3.6\n\t * \n\t * @param {*} event \n\t */\n\tsubmitLink( event ) {\n\t\tconst { isActive, value, onChange, speak } = this.props;\n\t\tconst { inputValue, linkid , post } = this.state;\n\t\tconst url = prependHTTP( inputValue );\n\t\tconst selectedText = getTextContent( slice( value ) );\n\t\tconst format = createLinkFormat( {\n\t\t\turl,\n\t\t\tlinkid,\n\t\t\ttext: selectedText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! linkid || ! post ) {\n\t\t\tthis.setState( { invalidLink : true } )\n\t\t\treturn;\n\t\t} \n\n\t\tif ( isCollapsed( value ) && ! isActive ) {\n\t\t\tconst toInsert = applyFormat( create( { text: post.title } ), format, 0, url.length );\n\t\t\tonChange( insert( value, toInsert ) );\n\t\t} else {\n\t\t\tonChange( applyFormat( value, format ) );\n\t\t}\n\n\t\tthis.resetState();\n\n\t\tif ( ! isValidHref( url ) ) {\n\t\t\tspeak( __( 'Warning: the link has been inserted but may have errors. Please test it.' ), 'assertive' );\n\t\t} else if ( isActive ) {\n\t\t\tspeak( __( 'Link edited.' ), 'assertive' );\n\t\t} else {\n\t\t\tspeak( __( 'Link inserted' ), 'assertive' );\n\t\t}\n\t}\n\n\t/**\n\t * Callback to run when users clicks outside the popover UI.\n\t * \n\t * @since 3.6\n\t * \n\t * @param {*} event \n\t */\n\tonClickOutside( event ) {\n\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t// so onClickOutside fails to detect that a click on a suggestion occured in the\n\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t// return to avoid the popover being closed.\n\t\tconst autocompleteElement = this.autocompleteRef.current;\n\t\tif ( autocompleteElement && autocompleteElement.contains( event.target ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.resetState();\n\t}\n\n\t/**\n\t * Reset state callback.\n\t * \n\t * @since 3.6\n\t */\n\tresetState() {\n\t\tthis.props.stopAddingLink();\n\t\tthis.setState( { inputValue : '' , editLink: false } );\n\t\tthis.resetInvalidLink();\n\t}\n\n\t/**\n\t * Reset invalid link state callback. Separated as we need to run this independently from resetState() callback.\n\t * \n\t * @since 3.6\n\t */\n\tresetInvalidLink() {\n\t\tthis.setState( { invalidLink : false } );\n\t}\n\n\t/**\n\t * Component render method.\n\t *\n\t * @since 3.6\n\t */\n\trender() {\n\t\tconst { isActive, activeAttributes: { url , linkid }, addingLink, anchorRect, value, onChange } = this.props;\n\n\t\tif ( ! isActive && ! addingLink ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { inputValue , invalidLink } = this.state;\n\t\tconst showInput = isShowingInput( this.props, this.state );\n\n\t\treturn (\n\t\t\t<ThirstyURLPopover\n\t\t\t\tonClickOutside={ this.onClickOutside }\n\t\t\t\tonClose={ this.resetState }\n\t\t\t\tfocusOnMount={ showInput ? 'firstElement' : false }\n\t\t\t\tinvalidLink={ invalidLink }\n\t\t\t\tanchorRect= { anchorRect }\n\t\t\t>\n\t\t\t\t{ showInput ? (\n\t\t\t\t\t<LinkEditor\n\t\t\t\t\t\tvalue={ inputValue }\n\t\t\t\t\t\tonChangeInputValue={ this.onChangeInputValue }\n\t\t\t\t\t\tonKeyDown={ this.onKeyDown }\n\t\t\t\t\t\tsubmitLink={ this.submitLink }\n\t\t\t\t\t\tautocompleteRef={ this.autocompleteRef }\n\t\t\t\t\t\tupdateLinkId= { this.updateLinkId }\n\t\t\t\t\t\tinvalidLink={ invalidLink }\n\t\t\t\t\t\tresetInvalidLink={ this.resetInvalidLink }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<LinkViewer\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\teditLink={ this.editLink }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</ThirstyURLPopover>\n\t\t);\n\t}\n}\n\nexport default withSpokenMessages( InlineAffiliateLinkUI );\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/inline.js","const { startsWith } = lodash;\n\nconst {\n getProtocol,\n\tisValidProtocol,\n\tgetAuthority,\n\tisValidAuthority,\n\tgetPath,\n\tisValidPath,\n\tgetQueryString,\n\tisValidQueryString,\n\tgetFragment,\n\tisValidFragment,\n} = wp.url;\n\n/**\n * Check for issues with the provided href.\n * \n * @since 3.6\n *\n * @param {string} href The href.\n * @return {boolean} Is the href invalid?\n */\nexport function isValidHref( href ) {\n\tif ( ! href ) {\n\t\treturn false;\n\t}\n\n\tconst trimmedHref = href.trim();\n\n\tif ( ! trimmedHref ) {\n\t\treturn false;\n\t}\n\n\t// Does the href start with something that looks like a URL protocol?\n\tif ( /^\\S+:/.test( trimmedHref ) ) {\n\t\tconst protocol = getProtocol( trimmedHref );\n\t\tif ( ! isValidProtocol( protocol ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Add some extra checks for http(s) URIs, since these are the most common use-case.\n\t\t// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n\t\tif ( startsWith( protocol, 'http' ) && ! /^https?:\\/\\/[^\\/\\s]/i.test( trimmedHref ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst authority = getAuthority( trimmedHref );\n\t\tif ( ! isValidAuthority( authority ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst path = getPath( trimmedHref );\n\t\tif ( path && ! isValidPath( path ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst queryString = getQueryString( trimmedHref );\n\t\tif ( queryString && ! isValidQueryString( queryString ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst fragment = getFragment( trimmedHref );\n\t\tif ( fragment && ! isValidFragment( fragment ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Validate anchor links.\n\tif ( startsWith( trimmedHref, '#' ) && ! isValidFragment( trimmedHref ) ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/utils.js","const { __ } = wp.i18n;\nconst { Component } = wp.element;\nconst { Popover , IconButton } = wp.components;\n\n/**\n * Custom URL Popover component.\n * \n * @since 3.6\n */\nclass ThirstyURLPopover extends Component {\n\n /**\n * Component constructor method.\n * \n * @since 3.6\n */\n\tconstructor() {\n super( ...arguments );\n \n this.toggleSettingsVisibility = this.toggleSettingsVisibility.bind( this );\n\n\t\tthis.state = {\n\t\t\tisSettingsExpanded: false,\n\t\t};\n }\n \n /**\n * Component constructor.\n * \n * @since 3.6\n */\n toggleSettingsVisibility() {\n\t\tthis.setState( {\n\t\t\tisSettingsExpanded: ! this.state.isSettingsExpanded,\n\t\t} );\n\t}\n\n /**\n * Component render method.\n * \n * @since 3.6\n */\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\trenderSettings,\n invalidLink,\n\t\t\tposition = 'bottom center',\n\t\t\tfocusOnMount = 'firstElement',\n\t\t\t...popoverProps\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\tisSettingsExpanded,\n } = this.state;\n \n const showSettings = !! renderSettings && isSettingsExpanded;\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\tclassName=\"ta-url-popover editor-url-popover block-editor-url-popover\"\n\t\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t\tposition={ position }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t<div className=\"editor-url-popover__row\">\n { children }\n { !! renderSettings && (\n\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\tclassName=\"editor-url-popover__settings-toggle\"\n\t\t\t\t\t\t\ticon=\"ellipsis\"\n\t\t\t\t\t\t\tlabel={ __( 'Link Settings' ) }\n\t\t\t\t\t\t\tonClick={ this.toggleSettingsVisibility }\n\t\t\t\t\t\t\taria-expanded={ isSettingsExpanded }\n\t\t\t\t\t\t/>\n ) }\n\t\t\t\t</div>\n { showSettings && (\n\t\t\t\t\t<div className=\"editor-url-popover__row editor-url-popover__settings\">\n\t\t\t\t\t\t{ renderSettings() }\n\t\t\t\t\t</div>\n ) }\n { invalidLink && <div class=\"ta-invalid-link\">{ __( 'Invalid affiliate link' ) }</div> }\n\t\t\t</Popover>\n\t\t);\n\t}\n}\n\nexport default ThirstyURLPopover;\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/url-popover.js","import classnames from 'classnames';\nimport scrollIntoView from 'dom-scroll-into-view';\n\nconst { __ } = wp.i18n;\nconst { throttle } = lodash;\nconst { Component , createRef } = wp.element;\nconst { UP, DOWN, ENTER, TAB } = wp.keycodes;\nconst { Spinner, withSpokenMessages, Popover } = wp.components;\nconst { withInstanceId } = wp.compose;\n\n// Since URLInput is rendered in the context of other inputs, but should be\n// considered a separate modal node, prevent keyboard events from propagating\n// as being considered from the input.\nconst stopEventPropagation = ( event ) => event.stopPropagation();\n\n/**\n * Custom URL Input component.\n * \n * @since 3.6\n */\nclass ThirstyURLInput extends Component {\n\n /**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tconstructor( { autocompleteRef } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.onChange = this.onChange.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.autocompleteRef = autocompleteRef || createRef();\n\t\tthis.inputRef = createRef();\n\t\tthis.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n\t\tthis.suggestionNodes = [];\n\n\t\tthis.state = {\n\t\t\tposts: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null,\n\t\t};\n\t}\n\n /**\n * Component did update method.\n * \n * @since 3.6\n */\n\tcomponentDidUpdate() {\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\n\t\t// only have to worry about scrolling selected suggestion into view\n\t\t// when already expanded\n\t\tif ( showSuggestions && selectedSuggestion !== null && ! this.scrollingIntoView ) {\n\t\t\tthis.scrollingIntoView = true;\n\t\t\tscrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef.current, {\n\t\t\t\tonlyScrollIfNeeded: true,\n\t\t\t} );\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tthis.scrollingIntoView = false;\n\t\t\t}, 100 );\n\t\t}\n\t}\n\n /**\n * Component unmount method.\n * \n * @since 3.6\n */\n\tcomponentWillUnmount() {\n\t\tdelete this.suggestionsRequest;\n\t}\n\n /**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\tbindSuggestionNode( index ) {\n\t\treturn ( ref ) => {\n\t\t\tthis.suggestionNodes[ index ] = ref;\n\t\t};\n\t}\n\n /**\n * Callback to show suggestions based on value inputted on search field.\n * \n * @since 3.6\n * \n * @param {*} value \n */\n\tupdateSuggestions( value ) {\n\t\t// Show the suggestions after typing at least 2 characters\n\t\t// and also for URLs\n\t\tif ( value.length < 2 || /^https?:/.test( value ) ) {\n\t\t\tthis.setState( {\n\t\t\t\tshowSuggestions: false,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: false,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setState( {\n\t\t\tshowSuggestions: true,\n\t\t\tselectedSuggestion: null,\n\t\t\tloading: true,\n\t\t} );\n\n const formData = new FormData();\n formData.append( \"action\" , \"search_affiliate_links_query\" );\n formData.append( \"keyword\" , value );\n formData.append( \"paged\" , 1 );\n formData.append( \"gutenberg\" , true );\n \n // We are getting data via the WP AJAX instead of rest API as it is not possible yet\n // to filter results with category value. This is to prepare next update to add category filter.\n const request = fetch( ajaxurl , {\n method : \"POST\",\n body : formData\n } );\n\n request\n .then( response => response.json() )\n .then( ( response ) => {\n\n if ( ! response.affiliate_links ) return;\n\n const posts = response.affiliate_links;\n\n\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\treturn;\n }\n\n\t\t\tthis.setState( {\n\t\t\t\tposts,\n\t\t\t\tloading: false,\n } );\n\n\t\t\tif ( !! posts.length ) {\n\t\t\t\tthis.props.debouncedSpeak( sprintf( _n(\n\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\tposts.length\n\t\t\t\t), posts.length ), 'assertive' );\n\t\t\t} else {\n\t\t\t\tthis.props.debouncedSpeak( __( 'No results.' ), 'assertive' );\n }\n\n\t\t} ).catch( () => {\n\t\t\tif ( this.suggestionsRequest === request ) {\n\t\t\t\tthis.setState( {\n\t\t\t\t\tloading: false,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\tthis.suggestionsRequest = request;\n\t}\n\n /**\n * Search input value change event callback method.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\tonChange( event ) {\n this.props.resetInvalidLink();\n\t\tconst inputValue = event.target.value;\n\t\tthis.props.onChange( inputValue );\n\t\tthis.updateSuggestions( inputValue );\n\t}\n\n /**\n * Keydown event callback. Handles selecting result via keyboard.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\tonKeyDown( event ) {\n\t\tconst { showSuggestions, selectedSuggestion, posts, loading } = this.state;\n\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n\t\t// We shouldn't preventDefault to allow block arrow keys navigation\n\t\tif ( ! showSuggestions || ! posts.length || loading ) {\n\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\n\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\n\t\t\t// only happens if the caret is not in the first or last position in the text input.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n\t\t\tswitch ( event.keyCode ) {\n\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\n\t\t\t\t// position.\n\t\t\t\tcase UP: {\n\t\t\t\t\tif ( 0 !== event.target.selectionStart ) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to position 0\n\t\t\t\t\t\tevent.target.setSelectionRange( 0, 0 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\n\t\t\t\t// last position.\n\t\t\t\tcase DOWN: {\n\t\t\t\t\tif ( this.props.value.length !== event.target.selectionStart ) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to the last position\n\t\t\t\t\t\tevent.target.setSelectionRange( this.props.value.length, this.props.value.length );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst post = this.state.posts[ this.state.selectedSuggestion ];\n\n\t\tswitch ( event.keyCode ) {\n\t\t\tcase UP: {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst previousIndex = ! selectedSuggestion ? posts.length - 1 : selectedSuggestion - 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: previousIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase DOWN: {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst nextIndex = selectedSuggestion === null || ( selectedSuggestion === posts.length - 1 ) ? 0 : selectedSuggestion + 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: nextIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase TAB: {\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tthis.selectLink( post );\n\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\n\t\t\t\t\tthis.props.speak( __( 'Link selected' ) );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ENTER: {\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tthis.selectLink( post );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n /**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\tselectLink( post ) {\n\t\tthis.props.onChange( post.link, post );\n\t\tthis.setState( {\n\t\t\tselectedSuggestion: null,\n\t\t\tshowSuggestions: false,\n\t\t} );\n\t}\n\n /**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\thandleOnClick( post ) {\n\t\tthis.selectLink( post );\n\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\tthis.inputRef.current.focus();\n\t}\n\n /**\n * Component render method.\n * \n * @since 3.6\n */\n\trender() {\n\t\tconst { value = '', autoFocus = true, instanceId , invalidLink } = this.props;\n\t\tconst { showSuggestions, posts, selectedSuggestion, loading } = this.state;\n\t\t/* eslint-disable jsx-a11y/no-autofocus */\n\t\treturn (\n\t\t\t<div className=\"editor-url-input block-editor-url-input\">\n\t\t\t\t<input\n\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\taria-label={ __( 'URL' ) }\n\t\t\t\t\trequired\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ this.onChange }\n\t\t\t\t\tonInput={ stopEventPropagation }\n\t\t\t\t\tplaceholder={ __( 'Paste URL or type to search' ) }\n\t\t\t\t\tonKeyDown={ this.onKeyDown }\n\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\taria-expanded={ showSuggestions }\n\t\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\t\taria-owns={ `editor-url-input-suggestions-${ instanceId }` }\n\t\t\t\t\taria-activedescendant={ selectedSuggestion !== null ? `editor-url-input-suggestion-${ instanceId }-${ selectedSuggestion }` : undefined }\n\t\t\t\t\tref={ this.inputRef }\n\t\t\t\t/>\n\n\t\t\t\t{ ( loading ) && <Spinner /> }\n\n\t\t\t\t{ showSuggestions && !! posts.length && ! invalidLink &&\n\t\t\t\t\t<Popover position=\"bottom\" noArrow focusOnMount={ false }>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"editor-url-input__suggestions block-editor-url-input__suggestions\"\n\t\t\t\t\t\t\tid={ `editor-url-input-suggestions-${ instanceId }` }\n\t\t\t\t\t\t\tref={ this.autocompleteRef }\n\t\t\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ posts.map( ( post, index ) => (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tkey={ post.id }\n\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t\tid={ `block-editor-url-input-suggestion-${ instanceId }-${ index }` }\n\t\t\t\t\t\t\t\t\tref={ this.bindSuggestionNode( index ) }\n\t\t\t\t\t\t\t\t\tclassName={ classnames( 'editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion,\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\tonClick={ () => this.handleOnClick( post ) }\n\t\t\t\t\t\t\t\t\taria-selected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ post.title || __( '(no title)' ) }\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Popover>\n\t\t\t\t}\n\t\t\t</div>\n\t\t);\n\t\t/* eslint-enable jsx-a11y/no-autofocus */\n\t}\n}\n\nexport default withSpokenMessages( withInstanceId( ThirstyURLInput ) );\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/url-input.js","'use strict';\n\nmodule.exports = require('./dom-scroll-into-view');\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/index.js\n// module id = 14\n// module chunks = 0","'use strict';\n\nvar util = require('./util');\n\nfunction scrollIntoView(elem, container, config) {\n config = config || {};\n // document 归一化到 window\n if (container.nodeType === 9) {\n container = util.getWindow(container);\n }\n\n var allowHorizontalScroll = config.allowHorizontalScroll;\n var onlyScrollIfNeeded = config.onlyScrollIfNeeded;\n var alignWithTop = config.alignWithTop;\n var alignWithLeft = config.alignWithLeft;\n var offsetTop = config.offsetTop || 0;\n var offsetLeft = config.offsetLeft || 0;\n var offsetBottom = config.offsetBottom || 0;\n var offsetRight = config.offsetRight || 0;\n\n allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;\n\n var isWin = util.isWindow(container);\n var elemOffset = util.offset(elem);\n var eh = util.outerHeight(elem);\n var ew = util.outerWidth(elem);\n var containerOffset = undefined;\n var ch = undefined;\n var cw = undefined;\n var containerScroll = undefined;\n var diffTop = undefined;\n var diffBottom = undefined;\n var win = undefined;\n var winScroll = undefined;\n var ww = undefined;\n var wh = undefined;\n\n if (isWin) {\n win = container;\n wh = util.height(win);\n ww = util.width(win);\n winScroll = {\n left: util.scrollLeft(win),\n top: util.scrollTop(win)\n };\n // elem 相对 container 可视视窗的距离\n diffTop = {\n left: elemOffset.left - winScroll.left - offsetLeft,\n top: elemOffset.top - winScroll.top - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,\n top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom\n };\n containerScroll = winScroll;\n } else {\n containerOffset = util.offset(container);\n ch = container.clientHeight;\n cw = container.clientWidth;\n containerScroll = {\n left: container.scrollLeft,\n top: container.scrollTop\n };\n // elem 相对 container 可视视窗的距离\n // 注意边框, offset 是边框到根节点\n diffTop = {\n left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,\n top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,\n top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom\n };\n }\n\n if (diffTop.top < 0 || diffBottom.top > 0) {\n // 强制向上\n if (alignWithTop === true) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else if (alignWithTop === false) {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n } else {\n // 自动调整\n if (diffTop.top < 0) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;\n if (alignWithTop) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n }\n\n if (allowHorizontalScroll) {\n if (diffTop.left < 0 || diffBottom.left > 0) {\n // 强制向上\n if (alignWithLeft === true) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else if (alignWithLeft === false) {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n } else {\n // 自动调整\n if (diffTop.left < 0) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;\n if (alignWithLeft) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n }\n }\n}\n\nmodule.exports = scrollIntoView;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js\n// module id = 15\n// module chunks = 0","'use strict';\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nvar RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nfunction getClientPosition(elem) {\n var box = undefined;\n var x = undefined;\n var y = undefined;\n var doc = elem.ownerDocument;\n var body = doc.body;\n var docElem = doc && doc.documentElement;\n // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式\n box = elem.getBoundingClientRect();\n\n // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop\n // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确\n // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin\n\n x = box.left;\n y = box.top;\n\n // In IE, most of the time, 2 extra pixels are added to the top and left\n // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and\n // IE6 standards mode, this border can be overridden by setting the\n // document element's border to zero -- thus, we cannot rely on the\n // offset always being 2 pixels.\n\n // In quirks mode, the offset can be determined by querying the body's\n // clientLeft/clientTop, but in standards mode, it is found by querying\n // the document element's clientLeft/clientTop. Since we already called\n // getClientBoundingRect we have already forced a reflow, so it is not\n // too expensive just to query them all.\n\n // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的\n // 窗口边框标准是设 documentElement ,quirks 时设置 body\n // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去\n // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置\n // 标准 ie 下 docElem.clientTop 就是 border-top\n // ie7 html 即窗口边框改变不了。永远为 2\n // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0\n\n x -= docElem.clientLeft || body.clientLeft || 0;\n y -= docElem.clientTop || body.clientTop || 0;\n\n return {\n left: x,\n top: y\n };\n}\n\nfunction getScroll(w, top) {\n var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];\n var method = 'scroll' + (top ? 'Top' : 'Left');\n if (typeof ret !== 'number') {\n var d = w.document;\n // ie6,7,8 standard mode\n ret = d.documentElement[method];\n if (typeof ret !== 'number') {\n // quirks mode\n ret = d.body[method];\n }\n }\n return ret;\n}\n\nfunction getScrollLeft(w) {\n return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n var pos = getClientPosition(el);\n var doc = el.ownerDocument;\n var w = doc.defaultView || doc.parentWindow;\n pos.left += getScrollLeft(w);\n pos.top += getScrollTop(w);\n return pos;\n}\nfunction _getComputedStyle(elem, name, computedStyle_) {\n var val = '';\n var d = elem.ownerDocument;\n var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);\n\n // https://github.com/kissyteam/kissy/issues/61\n if (computedStyle) {\n val = computedStyle.getPropertyValue(name) || computedStyle[name];\n }\n\n return val;\n}\n\nvar _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');\nvar RE_POS = /^(top|right|bottom|left)$/;\nvar CURRENT_STYLE = 'currentStyle';\nvar RUNTIME_STYLE = 'runtimeStyle';\nvar LEFT = 'left';\nvar PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n // currentStyle maybe null\n // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];\n\n // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值\n // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n // 在 ie 下不对,需要直接用 offset 方式\n // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了\n\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // exclude left right for relativity\n if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n // Remember the original values\n var style = elem.style;\n var left = style[LEFT];\n var rsLeft = elem[RUNTIME_STYLE][LEFT];\n\n // prevent flashing of content\n elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];\n\n // Put in the new values to get a computed value out\n style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;\n ret = style.pixelLeft + PX;\n\n // Revert the changed values\n style[LEFT] = left;\n\n elem[RUNTIME_STYLE][LEFT] = rsLeft;\n }\n return ret === '' ? 'auto' : ret;\n}\n\nvar getComputedStyleX = undefined;\nif (typeof window !== 'undefined') {\n getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;\n}\n\nfunction each(arr, fn) {\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i]);\n }\n}\n\nfunction isBorderBoxFn(elem) {\n return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nvar BOX_MODELS = ['margin', 'border', 'padding'];\nvar CONTENT_INDEX = -1;\nvar PADDING_INDEX = 2;\nvar BORDER_INDEX = 1;\nvar MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n var old = {};\n var style = elem.style;\n var name = undefined;\n\n // Remember the old values, and insert the new ones\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n old[name] = style[name];\n style[name] = options[name];\n }\n }\n\n callback.call(elem);\n\n // Revert the old values\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n style[name] = old[name];\n }\n }\n}\n\nfunction getPBMWidth(elem, props, which) {\n var value = 0;\n var prop = undefined;\n var j = undefined;\n var i = undefined;\n for (j = 0; j < props.length; j++) {\n prop = props[j];\n if (prop) {\n for (i = 0; i < which.length; i++) {\n var cssProp = undefined;\n if (prop === 'border') {\n cssProp = prop + which[i] + 'Width';\n } else {\n cssProp = prop + which[i];\n }\n value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n }\n }\n }\n return value;\n}\n\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\nfunction isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}\n\nvar domUtils = {};\n\neach(['Width', 'Height'], function (name) {\n domUtils['doc' + name] = function (refWin) {\n var d = refWin.document;\n return Math.max(\n // firefox chrome documentElement.scrollHeight< body.scrollHeight\n // ie standard mode : documentElement.scrollHeight> body.scrollHeight\n d.documentElement['scroll' + name],\n // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?\n d.body['scroll' + name], domUtils['viewport' + name](d));\n };\n\n domUtils['viewport' + name] = function (win) {\n // pc browser includes scrollbar in window.innerWidth\n var prop = 'client' + name;\n var doc = win.document;\n var body = doc.body;\n var documentElement = doc.documentElement;\n var documentElementProp = documentElement[prop];\n // 标准模式取 documentElement\n // backcompat 取 body\n return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;\n };\n});\n\n/*\n 得到元素的大小信息\n @param elem\n @param name\n @param {String} [extra] 'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\nfunction getWH(elem, name, extra) {\n if (isWindow(elem)) {\n return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);\n } else if (elem.nodeType === 9) {\n return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);\n }\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem, computedStyle);\n var cssBoxValue = 0;\n if (borderBoxValue == null || borderBoxValue <= 0) {\n borderBoxValue = undefined;\n // Fall back to computed then un computed css if necessary\n cssBoxValue = getComputedStyleX(elem, name);\n if (cssBoxValue == null || Number(cssBoxValue) < 0) {\n cssBoxValue = elem.style[name] || 0;\n }\n // Normalize '', auto, and prepare for extra\n cssBoxValue = parseFloat(cssBoxValue) || 0;\n }\n if (extra === undefined) {\n extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n }\n var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;\n var val = borderBoxValue || cssBoxValue;\n if (extra === CONTENT_INDEX) {\n if (borderBoxValueOrIsBorderBox) {\n return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);\n }\n return cssBoxValue;\n }\n if (borderBoxValueOrIsBorderBox) {\n var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);\n return val + (extra === BORDER_INDEX ? 0 : padding);\n }\n return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);\n}\n\nvar cssShow = {\n position: 'absolute',\n visibility: 'hidden',\n display: 'block'\n};\n\n// fix #119 : https://github.com/kissyteam/kissy/issues/119\nfunction getWHIgnoreDisplay(elem) {\n var val = undefined;\n var args = arguments;\n // in case elem is window\n // elem.offsetWidth === undefined\n if (elem.offsetWidth !== 0) {\n val = getWH.apply(undefined, args);\n } else {\n swap(elem, cssShow, function () {\n val = getWH.apply(undefined, args);\n });\n }\n return val;\n}\n\nfunction css(el, name, v) {\n var value = v;\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {\n for (var i in name) {\n if (name.hasOwnProperty(i)) {\n css(el, i, name[i]);\n }\n }\n return undefined;\n }\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value += 'px';\n }\n el.style[name] = value;\n return undefined;\n }\n return getComputedStyleX(el, name);\n}\n\neach(['width', 'height'], function (name) {\n var first = name.charAt(0).toUpperCase() + name.slice(1);\n domUtils['outer' + first] = function (el, includeMargin) {\n return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);\n };\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n domUtils[name] = function (elem, val) {\n if (val !== undefined) {\n if (elem) {\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem);\n if (isBorderBox) {\n val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);\n }\n return css(elem, name, val);\n }\n return undefined;\n }\n return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n };\n});\n\n// 设置 elem 相对 elem.ownerDocument 的坐标\nfunction setOffset(elem, offset) {\n // set position first, in-case top/left are set even on static elem\n if (css(elem, 'position') === 'static') {\n elem.style.position = 'relative';\n }\n\n var old = getOffset(elem);\n var ret = {};\n var current = undefined;\n var key = undefined;\n\n for (key in offset) {\n if (offset.hasOwnProperty(key)) {\n current = parseFloat(css(elem, key)) || 0;\n ret[key] = current + offset[key] - old[key];\n }\n }\n css(elem, ret);\n}\n\nmodule.exports = _extends({\n getWindow: function getWindow(node) {\n var doc = node.ownerDocument || node;\n return doc.defaultView || doc.parentWindow;\n },\n offset: function offset(el, value) {\n if (typeof value !== 'undefined') {\n setOffset(el, value);\n } else {\n return getOffset(el);\n }\n },\n\n isWindow: isWindow,\n each: each,\n css: css,\n clone: function clone(obj) {\n var ret = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret[i] = obj[i];\n }\n }\n var overflow = obj.overflow;\n if (overflow) {\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret.overflow[i] = obj.overflow[i];\n }\n }\n }\n return ret;\n },\n scrollLeft: function scrollLeft(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollLeft(w);\n }\n window.scrollTo(v, getScrollTop(w));\n } else {\n if (v === undefined) {\n return w.scrollLeft;\n }\n w.scrollLeft = v;\n }\n },\n scrollTop: function scrollTop(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollTop(w);\n }\n window.scrollTo(getScrollLeft(w), v);\n } else {\n if (v === undefined) {\n return w.scrollTop;\n }\n w.scrollTop = v;\n }\n },\n\n viewportWidth: 0,\n viewportHeight: 0\n}, domUtils);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/util.js\n// module id = 16\n// module chunks = 0"],"sourceRoot":""}
|
1 |
+
{"version":3,"sources":["webpack:///gutenberg-support.js","webpack:///webpack/bootstrap 0398ccf6c6e68ef11d5b","webpack:///./node_modules/classnames/index.js","webpack:///./src/index.js","webpack:///./src/blocks/index.js","webpack:///./src/blocks/ta-image/index.js","webpack:///./src/blocks/ta-image/edit.js","webpack:///./src/blocks/ta-image/util.js","webpack:///./src/blocks/ta-image/image-size.js","webpack:///./src/blocks/ta-image/search-input.js","webpack:///./src/formats/index.js","webpack:///./src/formats/ta-link/index.js","webpack:///./src/formats/ta-link/inline.js","webpack:///./src/formats/ta-link/utils.js","webpack:///./src/formats/ta-link/url-popover.js","webpack:///./src/formats/ta-link/url-input.js","webpack:///./node_modules/dom-scroll-into-view/lib/index.js","webpack:///./node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js","webpack:///./node_modules/dom-scroll-into-view/lib/util.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","classNames","classes","arguments","length","arg","argType","push","Array","isArray","inner","apply","key","hasOwn","join","default","undefined","__webpack_exports__","value","__WEBPACK_IMPORTED_MODULE_0__blocks__","__WEBPACK_IMPORTED_MODULE_1__formats__","__WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__","registerBlocks","registerFormats","taimage","forEach","block","settings","registerBlockType","__WEBPACK_IMPORTED_MODULE_0__ta_image__","wp","blocks","_defineProperty","obj","writable","__WEBPACK_IMPORTED_MODULE_0_classnames__","__WEBPACK_IMPORTED_MODULE_0_classnames___default","__WEBPACK_IMPORTED_MODULE_1__edit__","Fragment","element","__","i18n","getPhrasingContentSchema","dom","RichText","blockEditor","_wp$components","components","Path","SVG","blockAttributes","url","type","source","selector","attribute","alt","caption","id","align","width","height","linkid","href","affiliateLink","imageSchema","img","attributes","title","description","icon","createElement","viewBox","xmlns","fill","category","keywords","getEditWrapperProps","data-align","data-resized","edit","save","_ref","_classnames","classnames","image","src","className","figure","Content","tagName","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","constructor","setPrototypeOf","__proto__","__WEBPACK_IMPORTED_MODULE_1__util__","__WEBPACK_IMPORTED_MODULE_2__image_size__","__WEBPACK_IMPORTED_MODULE_3__search_input__","_extends","assign","target","_slicedToArray","sliceIterator","arr","_arr","_n","_d","_e","_s","_i","Symbol","iterator","next","done","err","_createClass","defineProperties","props","descriptor","protoProps","staticProps","_lodash","lodash","isEmpty","map","last","pick","compact","getPath","_wp$i18n","sprintf","_wp$element","Component","createRef","_wp$blob","blob","getBlobByURL","revokeBlobURL","isBlobURL","Placeholder","Button","ButtonGroup","IconButton","PanelBody","ResizableBox","SelectControl","Spinner","TextControl","TextareaControl","Toolbar","withNotices","withSelect","data","mediaUpload","editor","_wp$blockEditor","InspectorControls","BlockControls","BlockAlignmentToolbar","withViewportMatch","viewport","compose","ALLOWED_MEDIA_TYPES","pickRelevantMediaFiles","imageProps","isTemporaryImage","isExternalImage","ImageEdit","_Component","this","_this","getPrototypeOf","updateAlt","bind","updateAlignment","onFocusCaption","onImageClick","onSelectImage","updateImageURL","updateWidth","updateHeight","updateDimensions","getFilename","toggleIsEditing","onImageError","onChangeInputValue","autocompleteRef","resetInvalidLink","updateImageSelection","onSelectAffiliateImage","editAFfiliateImage","state","captionFocused","isEditing","inputValue","post","showSuggestions","imageSelection","_this2","_props","setAttributes","noticeOperations","_attributes$url","file","filesList","onFileChange","_ref2","_ref3","allowedTypes","onError","message","createErrorNotice","setState","prevProps","_prevProps$attributes","prevID","_prevProps$attributes2","prevURL","_props$attributes","_props$attributes$url","isSelected","media","link","embedBlock","createUpgradedEmbedBlock","onReplace","newAlt","nextAlign","extraUpdatedAttributes","indexOf","parseInt","_this3","path","split","label","_props2","imageSizes","_ref4","slug","sizeUrl","invalidLink","_this4","apiFetch","addQueryArgs","context","_locale","then","source_url","images","_this5","_state","_props3","isLargeViewport","maxWidth","toggleSelection","isRTL","linkDestination","toolbarEditButton","onClick","controls","onChange","instructions","index","wp-block-image","is-transient","is-resized","is-focused","isResizable","imageSizeOptions","getImageSizeOptions","getInspectorControls","imageWidth","imageHeight","help","options","placeholder","min","aria-label","scale","scaledWidth","Math","round","scaledHeight","isCurrent","isSmall","isPrimary","aria-pressed","dirtynessTrigger","sizes","imageWidthWithinContainer","imageHeightWithinContainer","filename","defaultedAlt","style","currentWidth","currentHeight","ratio","minWidth","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","size","maxHeight","lockAspectRatio","enable","top","right","bottom","left","onResizeStart","onResizeStop","event","direction","elt","delta","unstableOnFocus","inlineToolbar","select","_select","getMedia","_select2","getEditorSettings","_getEditorSettings","includes","createBlock","renderToString","attributesFromPreview","preview","matchingBlock","findBlock","DEFAULT_EMBED_BLOCK","html","isFromWordPress","noop","withGlobalEvents","ImageSize","bindContainer","calculateSize","ref","container","fetchImageSize","onload","window","Image","clientWidth","exceedMaxWidth","containerWidth","containerHeight","clientHeight","children","resize","withSpokenMessages","Popover","withInstanceId","ThirstyURLInput","inputRef","searchAffiliateLinks","suggestionNodes","posts","selectedSuggestion","loading","scrollingIntoView","scrollIntoView","current","onlyScrollIfNeeded","setTimeout","suggestionsRequest","formData","FormData","append","request","fetch","ajaxurl","method","body","response","json","affiliate_links","debouncedSpeak","catch","selectLink","instanceId","autoFocus","_state2","class","onSubmit","displayAffiliateImages","autocomplete","position","focusOnMount","role","tabIndex","bindSuggestionNode","is-selected","handleOnClick","aria-selected","_objectWithoutProperties","keys","taLink","registerFormatType","__WEBPACK_IMPORTED_MODULE_0__ta_link__","richText","__WEBPACK_IMPORTED_MODULE_0__inline__","_wp$richText","getTextContent","applyFormat","removeFormat","slice","isURL","RichTextToolbarButton","RichTextShortcut","getRectangleFromRange","lastAnchorRect","LinkEdit","addLink","stopAddingLink","onRemoveFormat","addingLink","text","speak","selection","getSelection","range","rangeCount","getRangeAt","anchorNode","nodeType","Node","TEXT_NODE","rect","startContainer","nextElementSibling","ELEMENT_NODE","parentNode","closest","getBoundingClientRect","isActive","activeAttributes","anchorRect","getAnchorRect","character","onUse","shortcutType","shortcutCharacter","transform","createLinkFormat","toString","isShowingInput","editLink","__WEBPACK_IMPORTED_MODULE_1__utils__","__WEBPACK_IMPORTED_MODULE_2__url_popover__","__WEBPACK_IMPORTED_MODULE_3__url_input__","ExternalLink","ToggleControl","_wp$keycodes","keycodes","LEFT","RIGHT","UP","DOWN","BACKSPACE","ENTER","_wp$url","prependHTTP","safeDecodeURI","filterURLForDisplay","insert","isCollapsed","stopKeyPropagation","stopPropagation","LinkEditor","onKeyDown","submitLink","onKeyPress","LinkViewerUrl","prependedURL","linkClassName","has-invalid-link","isValidHref","LinkViewer","InlineAffiliateLinkUI","onClickOutside","resetState","keyCode","preventDefault","selectedText","format","toInsert","autocompleteElement","contains","_props2$activeAttribu","showInput","onClose","updateLinkId","trimmedHref","trim","test","protocol","getProtocol","isValidProtocol","startsWith","authority","getAuthority","isValidAuthority","isValidPath","queryString","getQueryString","isValidQueryString","fragment","getFragment","isValidFragment","ThirstyURLPopover","toggleSettingsVisibility","isSettingsExpanded","renderSettings","_props$position","_props$focusOnMount","popoverProps","showSettings","aria-expanded","__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__","__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default","throttle","TAB","stopEventPropagation","updateSuggestions","previousIndex","nextIndex","selectionStart","setSelectionRange","focus","_props$value","_props$autoFocus","_state3","required","onInput","aria-autocomplete","aria-owns","aria-activedescendant","noArrow","elem","config","util","getWindow","allowHorizontalScroll","alignWithTop","alignWithLeft","offsetTop","offsetLeft","offsetBottom","offsetRight","isWin","isWindow","elemOffset","offset","eh","outerHeight","ew","outerWidth","containerOffset","ch","cw","containerScroll","diffTop","diffBottom","win","winScroll","ww","wh","scrollLeft","scrollTop","parseFloat","css","getClientPosition","box","x","y","doc","ownerDocument","docElem","documentElement","clientLeft","clientTop","getScroll","w","ret","document","getScrollLeft","getScrollTop","getOffset","el","pos","defaultView","parentWindow","_getComputedStyle","computedStyle_","val","computedStyle","getComputedStyle","getPropertyValue","_getComputedStyleIE","CURRENT_STYLE","_RE_NUM_NO_PX","RE_POS","rsLeft","RUNTIME_STYLE","pixelLeft","PX","each","fn","isBorderBoxFn","getComputedStyleX","swap","callback","old","getPBMWidth","which","prop","j","cssProp","getWH","extra","domUtils","viewportWidth","viewportHeight","docWidth","docHeight","borderBoxValue","offsetWidth","offsetHeight","isBorderBox","cssBoxValue","Number","BORDER_INDEX","CONTENT_INDEX","borderBoxValueOrIsBorderBox","padding","PADDING_INDEX","BOX_MODELS","getWHIgnoreDisplay","args","cssShow","v","_typeof","setOffset","RE_NUM","RegExp","refWin","max","documentElementProp","compatMode","visibility","display","first","charAt","toUpperCase","includeMargin","node","clone","overflow","scrollTo"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMM,SAAUtB,EAAQD,EAASH,GEnEjC,GAAA2B,GAAAC;;;;;CAOA,WACA,YAIA,SAAAC,KAGA,OAFAC,MAEAzB,EAAA,EAAiBA,EAAA0B,UAAAC,OAAsB3B,IAAA,CACvC,GAAA4B,GAAAF,UAAA1B,EACA,IAAA4B,EAAA,CAEA,GAAAC,SAAAD,EAEA,eAAAC,GAAA,WAAA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AmjB,KACA,QAAA3mB,KAAAwD,GACAA,EAAArC,eAAAnB,KACA2mB,EAAA3mB,GAAAwD,EAAAxD,GAIA,IADAwD,EAAA6nB,SAEA,OAAArrB,KAAAwD,GACAA,EAAArC,eAAAnB,KACA2mB,EAAA0E,SAAArrB,GAAAwD,EAAA6nB,SAAArrB,GAIA,OAAA2mB,IAEAhB,WAAA,SAAAe,EAAA0D,GACA,GAAA1F,EAAAgC,GAAA,CACA,OAAAnkB,KAAA6nB,EACA,MAAAvD,GAAAH,EAEAlP,QAAA8T,SAAAlB,EAAAtD,EAAAJ,QACK,CACL,OAAAnkB,KAAA6nB,EACA,MAAA1D,GAAAf,UAEAe,GAAAf,WAAAyE,IAGAxE,UAAA,SAAAc,EAAA0D,GACA,GAAA1F,EAAAgC,GAAA,CACA,OAAAnkB,KAAA6nB,EACA,MAAAtD,GAAAJ,EAEAlP,QAAA8T,SAAAzE,EAAAH,GAAA0D,OACK,CACL,OAAA7nB,KAAA6nB,EACA,MAAA1D,GAAAd,SAEAc,GAAAd,UAAAwE,IAIAnB,cAAA,EACAC,eAAA,GACCF,IlBgmGK,SAAUjpB,EAAQD","file":"gutenberg-support.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 1);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (true) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n\t\t\treturn classNames;\n\t\t}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__blocks__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__formats__ = __webpack_require__(8);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__ = __webpack_require__(17);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__assets_styles_index_scss__);\n\n\n\n\n\nObject(__WEBPACK_IMPORTED_MODULE_0__blocks__[\"a\" /* default */])();\nObject(__WEBPACK_IMPORTED_MODULE_1__formats__[\"a\" /* default */])();\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = registerBlocks;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ta_image__ = __webpack_require__(3);\n\n\nvar registerBlockType = wp.blocks.registerBlockType;\n\n/**\n * Register gutenberg blocks.\n * \n * @since 3.6\n */\n\nfunction registerBlocks() {\n\n [__WEBPACK_IMPORTED_MODULE_0__ta_image__].forEach(function (block) {\n if (!block) return;\n\n var name = block.name,\n settings = block.settings;\n\n registerBlockType(name, settings);\n });\n}\n\n/***/ }),\n/* 3 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"name\", function() { return name; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"settings\", function() { return settings; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__edit__ = __webpack_require__(4);\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\nvar Fragment = wp.element.Fragment;\nvar __ = wp.i18n.__;\nvar getPhrasingContentSchema = wp.dom.getPhrasingContentSchema;\nvar RichText = wp.blockEditor.RichText;\nvar _wp$components = wp.components,\n Path = _wp$components.Path,\n SVG = _wp$components.SVG;\n\n\n\n\nvar name = 'ta/image';\n\nvar blockAttributes = {\n\turl: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'src'\n\t},\n\talt: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'alt',\n\t\tdefault: ''\n\t},\n\tcaption: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'figcaption'\n\t},\n\tid: {\n\t\ttype: 'number'\n\t},\n\talign: {\n\t\ttype: 'string'\n\t},\n\twidth: {\n\t\ttype: 'number'\n\t},\n\theight: {\n\t\ttype: 'number'\n\t},\n\tlinkid: {\n\t\ttype: 'number'\n\t},\n\thref: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'ta',\n\t\tattribute: 'href'\n\t},\n\taffiliateLink: {\n\t\ttype: 'object'\n\t}\n};\n\nvar imageSchema = {\n\timg: {\n\t\tattributes: ['src', 'alt'],\n\t\tclasses: ['alignleft', 'aligncenter', 'alignright', 'alignnone', /^wp-image-\\d+$/]\n\t}\n};\n\nvar schema = {\n\tfigure: {\n\t\trequire: ['ta', 'img'],\n\t\tchildren: {\n\t\t\tta: {\n\t\t\t\tattributes: ['href', 'linkid'],\n\t\t\t\tchildren: imageSchema\n\t\t\t},\n\t\t\tfigcaption: {\n\t\t\t\tchildren: getPhrasingContentSchema()\n\t\t\t}\n\t\t}\n\t}\n};\n\nfunction getFirstAnchorAttributeFormHTML(html, attributeName) {\n\tvar _document$implementat = document.implementation.createHTMLDocument(''),\n\t body = _document$implementat.body;\n\n\tbody.innerHTML = html;\n\n\tvar firstElementChild = body.firstElementChild;\n\n\n\tif (firstElementChild && firstElementChild.nodeName === 'A') {\n\t\treturn firstElementChild.getAttribute(attributeName) || undefined;\n\t}\n}\n\nvar settings = {\n\ttitle: __('ThirstyAffiliates Image'),\n\n\tdescription: __('Insert an image with an affiliate link to make a visual statement.'),\n\n\ticon: wp.element.createElement(\n\t\tSVG,\n\t\t{ viewBox: \"0 0 24 24\", xmlns: \"http://www.w3.org/2000/svg\" },\n\t\twp.element.createElement(Path, { d: \"M0,0h24v24H0V0z\", fill: \"none\" }),\n\t\twp.element.createElement(Path, { d: \"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" }),\n\t\twp.element.createElement(Path, { d: \"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" })\n\t),\n\n\tcategory: 'common',\n\n\tkeywords: ['img', // \"img\" is not translated as it is intended to reflect the HTML <img> tag.\n\t__('photo'), __('affiliate')],\n\n\tattributes: blockAttributes,\n\n\tgetEditWrapperProps: function getEditWrapperProps(attributes) {\n\t\tvar align = attributes.align,\n\t\t width = attributes.width;\n\n\t\tif ('left' === align || 'center' === align || 'right' === align || 'wide' === align || 'full' === align) {\n\t\t\treturn { 'data-align': align, 'data-resized': !!width };\n\t\t}\n\t},\n\n\n\tedit: __WEBPACK_IMPORTED_MODULE_1__edit__[\"a\" /* default */],\n\n\tsave: function save(_ref) {\n\t\tvar _classnames;\n\n\t\tvar attributes = _ref.attributes;\n\t\tvar url = attributes.url,\n\t\t alt = attributes.alt,\n\t\t caption = attributes.caption,\n\t\t align = attributes.align,\n\t\t width = attributes.width,\n\t\t height = attributes.height,\n\t\t id = attributes.id,\n\t\t linkid = attributes.linkid,\n\t\t href = attributes.href;\n\n\n\t\tvar classes = __WEBPACK_IMPORTED_MODULE_0_classnames___default()((_classnames = {}, _defineProperty(_classnames, \"align\" + align, align), _defineProperty(_classnames, 'is-resized', width || height), _classnames));\n\n\t\tvar image = wp.element.createElement(\"img\", {\n\t\t\tsrc: url,\n\t\t\talt: alt,\n\t\t\tclassName: id ? \"wp-image-\" + id : null,\n\t\t\twidth: width,\n\t\t\theight: height\n\t\t});\n\n\t\tvar figure = wp.element.createElement(\n\t\t\tFragment,\n\t\t\tnull,\n\t\t\twp.element.createElement(\n\t\t\t\t\"ta\",\n\t\t\t\t{ linkid: linkid, href: href },\n\t\t\t\timage\n\t\t\t),\n\t\t\twp.element.createElement(RichText.Content, { tagName: \"figcaption\", value: caption })\n\t\t);\n\n\t\tif ('left' === align || 'right' === align || 'center' === align) {\n\t\t\treturn wp.element.createElement(\n\t\t\t\t\"div\",\n\t\t\t\t{ className: \"wp-block-image\" },\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"figure\",\n\t\t\t\t\t{ className: classes },\n\t\t\t\t\tfigure\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\treturn wp.element.createElement(\n\t\t\t\"figure\",\n\t\t\t{ className: \"wp-block-image \" + classes },\n\t\t\tfigure\n\t\t);\n\t}\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* unused harmony export pickRelevantMediaFiles */\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__image_size__ = __webpack_require__(6);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__search_input__ = __webpack_require__(7);\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar _lodash = lodash,\n get = _lodash.get,\n isEmpty = _lodash.isEmpty,\n map = _lodash.map,\n last = _lodash.last,\n pick = _lodash.pick,\n compact = _lodash.compact;\nvar getPath = wp.url.getPath;\nvar _wp$i18n = wp.i18n,\n __ = _wp$i18n.__,\n sprintf = _wp$i18n.sprintf;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment,\n createRef = _wp$element.createRef;\nvar _wp$blob = wp.blob,\n getBlobByURL = _wp$blob.getBlobByURL,\n revokeBlobURL = _wp$blob.revokeBlobURL,\n isBlobURL = _wp$blob.isBlobURL;\nvar _wp$components = wp.components,\n Placeholder = _wp$components.Placeholder,\n Button = _wp$components.Button,\n ButtonGroup = _wp$components.ButtonGroup,\n IconButton = _wp$components.IconButton,\n PanelBody = _wp$components.PanelBody,\n ResizableBox = _wp$components.ResizableBox,\n SelectControl = _wp$components.SelectControl,\n Spinner = _wp$components.Spinner,\n TextControl = _wp$components.TextControl,\n TextareaControl = _wp$components.TextareaControl,\n Toolbar = _wp$components.Toolbar,\n withNotices = _wp$components.withNotices;\nvar withSelect = wp.data.withSelect;\nvar mediaUpload = wp.editor.mediaUpload;\nvar _wp$blockEditor = wp.blockEditor,\n InspectorControls = _wp$blockEditor.InspectorControls,\n BlockControls = _wp$blockEditor.BlockControls,\n RichText = _wp$blockEditor.RichText,\n BlockAlignmentToolbar = _wp$blockEditor.BlockAlignmentToolbar;\nvar withViewportMatch = wp.viewport.withViewportMatch;\nvar compose = wp.compose.compose;\n\n\n\n\n\n\n/**\n * Module constants\n */\nvar MIN_SIZE = 20;\nvar LINK_DESTINATION_NONE = 'none';\nvar LINK_DESTINATION_MEDIA = 'media';\nvar LINK_DESTINATION_ATTACHMENT = 'attachment';\nvar LINK_DESTINATION_CUSTOM = 'custom';\nvar NEW_TAB_REL = 'noreferrer noopener';\nvar ALLOWED_MEDIA_TYPES = ['image'];\n\nvar pickRelevantMediaFiles = function pickRelevantMediaFiles(image) {\n\tvar imageProps = pick(image, ['alt', 'id', 'link', 'caption']);\n\timageProps.url = get(image, ['sizes', 'large', 'url']) || get(image, ['media_details', 'sizes', 'large', 'source_url']) || image.url;\n\treturn imageProps;\n};\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\n * while the image is being uploaded and will not have an id yet allocated.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the URL a Blob URL\n */\nvar isTemporaryImage = function isTemporaryImage(id, url) {\n\treturn !id && isBlobURL(url);\n};\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no id\n * and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nvar isExternalImage = function isExternalImage(id, url) {\n\treturn url && !id && !isBlobURL(url);\n};\n\nvar ImageEdit = function (_Component) {\n\t_inherits(ImageEdit, _Component);\n\n\tfunction ImageEdit(_ref) {\n\t\tvar attributes = _ref.attributes;\n\n\t\t_classCallCheck(this, ImageEdit);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ImageEdit.__proto__ || Object.getPrototypeOf(ImageEdit)).apply(this, arguments));\n\n\t\t_this.updateAlt = _this.updateAlt.bind(_this);\n\t\t_this.updateAlignment = _this.updateAlignment.bind(_this);\n\t\t_this.onFocusCaption = _this.onFocusCaption.bind(_this);\n\t\t_this.onImageClick = _this.onImageClick.bind(_this);\n\t\t_this.onSelectImage = _this.onSelectImage.bind(_this);\n\t\t_this.updateImageURL = _this.updateImageURL.bind(_this);\n\t\t_this.updateWidth = _this.updateWidth.bind(_this);\n\t\t_this.updateHeight = _this.updateHeight.bind(_this);\n\t\t_this.updateDimensions = _this.updateDimensions.bind(_this);\n\t\t_this.getFilename = _this.getFilename.bind(_this);\n\t\t_this.toggleIsEditing = _this.toggleIsEditing.bind(_this);\n\t\t_this.onImageError = _this.onImageError.bind(_this);\n\t\t_this.onChangeInputValue = _this.onChangeInputValue.bind(_this);\n\t\t_this.autocompleteRef = createRef();\n\t\t_this.resetInvalidLink = _this.resetInvalidLink.bind(_this);\n\t\t_this.updateImageSelection = _this.updateImageSelection.bind(_this);\n\t\t_this.onSelectAffiliateImage = _this.onSelectAffiliateImage.bind(_this);\n\t\t_this.editAFfiliateImage = _this.editAFfiliateImage.bind(_this);\n\n\t\t_this.state = {\n\t\t\tcaptionFocused: false,\n\t\t\tisEditing: !attributes.url,\n\t\t\tinputValue: '',\n\t\t\tlinkid: 0,\n\t\t\tpost: null,\n\t\t\tshowSuggestions: false,\n\t\t\timageSelection: [],\n\t\t\taffiliateLink: null\n\t\t};\n\t\treturn _this;\n\t}\n\n\t_createClass(ImageEdit, [{\n\t\tkey: \"componentDidMount\",\n\t\tvalue: function componentDidMount() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t attributes = _props.attributes,\n\t\t\t setAttributes = _props.setAttributes,\n\t\t\t noticeOperations = _props.noticeOperations;\n\t\t\tvar id = attributes.id,\n\t\t\t _attributes$url = attributes.url,\n\t\t\t url = _attributes$url === undefined ? '' : _attributes$url;\n\n\n\t\t\tif (isTemporaryImage(id, url)) {\n\t\t\t\tvar file = getBlobByURL(url);\n\n\t\t\t\tif (file) {\n\t\t\t\t\tmediaUpload({\n\t\t\t\t\t\tfilesList: [file],\n\t\t\t\t\t\tonFileChange: function onFileChange(_ref2) {\n\t\t\t\t\t\t\tvar _ref3 = _slicedToArray(_ref2, 1),\n\t\t\t\t\t\t\t image = _ref3[0];\n\n\t\t\t\t\t\t\tsetAttributes(pickRelevantMediaFiles(image));\n\t\t\t\t\t\t},\n\t\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t\t\tonError: function onError(message) {\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice(message);\n\t\t\t\t\t\t\t_this2.setState({ isEditing: true });\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"componentDidUpdate\",\n\t\tvalue: function componentDidUpdate(prevProps) {\n\t\t\tvar _prevProps$attributes = prevProps.attributes,\n\t\t\t prevID = _prevProps$attributes.id,\n\t\t\t _prevProps$attributes2 = _prevProps$attributes.url,\n\t\t\t prevURL = _prevProps$attributes2 === undefined ? '' : _prevProps$attributes2;\n\t\t\tvar _props$attributes = this.props.attributes,\n\t\t\t id = _props$attributes.id,\n\t\t\t _props$attributes$url = _props$attributes.url,\n\t\t\t url = _props$attributes$url === undefined ? '' : _props$attributes$url;\n\n\n\t\t\tif (isTemporaryImage(prevID, prevURL) && !isTemporaryImage(id, url)) {\n\t\t\t\trevokeBlobURL(url);\n\t\t\t}\n\n\t\t\tif (!this.props.isSelected && prevProps.isSelected && this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: false\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onSelectImage\",\n\t\tvalue: function onSelectImage(media) {\n\n\t\t\tif (!media || !media.url) {\n\t\t\t\tthis.props.setAttributes({\n\t\t\t\t\turl: undefined,\n\t\t\t\t\talt: undefined,\n\t\t\t\t\tid: undefined,\n\t\t\t\t\tcaption: undefined\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar affiliateLink = this.state.affiliateLink;\n\n\n\t\t\tthis.setState({\n\t\t\t\tisEditing: false\n\t\t\t});\n\n\t\t\tthis.props.setAttributes(_extends({}, pickRelevantMediaFiles(media), {\n\t\t\t\tlinkid: affiliateLink.id,\n\t\t\t\thref: affiliateLink.link,\n\t\t\t\taffiliateLink: affiliateLink,\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined\n\t\t\t}));\n\t\t}\n\t}, {\n\t\tkey: \"onImageError\",\n\t\tvalue: function onImageError(url) {\n\t\t\t// Check if there's an embed block that handles this URL.\n\t\t\tvar embedBlock = Object(__WEBPACK_IMPORTED_MODULE_1__util__[\"a\" /* createUpgradedEmbedBlock */])({ attributes: { url: url } });\n\t\t\tif (undefined !== embedBlock) {\n\t\t\t\tthis.props.onReplace(embedBlock);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onFocusCaption\",\n\t\tvalue: function onFocusCaption() {\n\t\t\tif (!this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: true\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onImageClick\",\n\t\tvalue: function onImageClick() {\n\t\t\tif (this.state.captionFocused) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcaptionFocused: false\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"updateAlt\",\n\t\tvalue: function updateAlt(newAlt) {\n\t\t\tthis.props.setAttributes({ alt: newAlt });\n\t\t}\n\t}, {\n\t\tkey: \"updateAlignment\",\n\t\tvalue: function updateAlignment(nextAlign) {\n\t\t\tvar extraUpdatedAttributes = ['wide', 'full'].indexOf(nextAlign) !== -1 ? { width: undefined, height: undefined } : {};\n\t\t\tthis.props.setAttributes(_extends({}, extraUpdatedAttributes, { align: nextAlign }));\n\t\t}\n\t}, {\n\t\tkey: \"updateImageURL\",\n\t\tvalue: function updateImageURL(url) {\n\t\t\tthis.props.setAttributes({ url: url, width: undefined, height: undefined });\n\t\t}\n\t}, {\n\t\tkey: \"updateWidth\",\n\t\tvalue: function updateWidth(width) {\n\t\t\tthis.props.setAttributes({ width: parseInt(width, 10) });\n\t\t}\n\t}, {\n\t\tkey: \"updateHeight\",\n\t\tvalue: function updateHeight(height) {\n\t\t\tthis.props.setAttributes({ height: parseInt(height, 10) });\n\t\t}\n\t}, {\n\t\tkey: \"updateDimensions\",\n\t\tvalue: function updateDimensions() {\n\t\t\tvar _this3 = this;\n\n\t\t\tvar width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;\n\t\t\tvar height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n\n\t\t\treturn function () {\n\t\t\t\t_this3.props.setAttributes({ width: width, height: height });\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"getFilename\",\n\t\tvalue: function getFilename(url) {\n\t\t\tvar path = getPath(url);\n\t\t\tif (path) {\n\t\t\t\treturn last(path.split('/'));\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"getLinkDestinationOptions\",\n\t\tvalue: function getLinkDestinationOptions() {\n\t\t\treturn [{ value: LINK_DESTINATION_NONE, label: __('None') }, { value: LINK_DESTINATION_MEDIA, label: __('Media File') }, { value: LINK_DESTINATION_ATTACHMENT, label: __('Attachment Page') }, { value: LINK_DESTINATION_CUSTOM, label: __('Custom URL') }];\n\t\t}\n\t}, {\n\t\tkey: \"toggleIsEditing\",\n\t\tvalue: function toggleIsEditing() {\n\t\t\tthis.setState({\n\t\t\t\tisEditing: !this.state.isEditing\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"getImageSizeOptions\",\n\t\tvalue: function getImageSizeOptions() {\n\t\t\tvar _props2 = this.props,\n\t\t\t imageSizes = _props2.imageSizes,\n\t\t\t image = _props2.image;\n\n\t\t\treturn compact(map(imageSizes, function (_ref4) {\n\t\t\t\tvar name = _ref4.name,\n\t\t\t\t slug = _ref4.slug;\n\n\t\t\t\tvar sizeUrl = get(image, ['media_details', 'sizes', slug, 'source_url']);\n\t\t\t\tif (!sizeUrl) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tvalue: sizeUrl,\n\t\t\t\t\tlabel: name\n\t\t\t\t};\n\t\t\t}));\n\t\t}\n\t}, {\n\t\tkey: \"onChangeInputValue\",\n\t\tvalue: function onChangeInputValue(inputValue) {\n\t\t\tvar post = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n\t\t\tvar linkid = post ? post.id : 0;\n\t\t\tthis.setState({ inputValue: inputValue, linkid: linkid, post: post });\n\t\t}\n\t}, {\n\t\tkey: \"resetInvalidLink\",\n\t\tvalue: function resetInvalidLink() {\n\t\t\tthis.setState({ invalidLink: false });\n\t\t}\n\t}, {\n\t\tkey: \"updateImageSelection\",\n\t\tvalue: function updateImageSelection(imageSelection, affiliateLink) {\n\t\t\tthis.setState({\n\t\t\t\timageSelection: imageSelection,\n\t\t\t\taffiliateLink: affiliateLink\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"onSelectAffiliateImage\",\n\t\tvalue: function onSelectAffiliateImage(image) {\n\t\t\tvar _this4 = this;\n\n\t\t\tif (isExternalImage(image.id, image.src)) {\n\t\t\t\timage.url = image.src;\n\t\t\t\tthis.onSelectImage(image);\n\t\t\t} else {\n\t\t\t\tvar request = wp.apiFetch({\n\t\t\t\t\tpath: wp.url.addQueryArgs('/wp/v2/media/' + image.id, {\n\t\t\t\t\t\tcontext: 'edit',\n\t\t\t\t\t\t_locale: 'user'\n\t\t\t\t\t})\n\t\t\t\t});\n\n\t\t\t\trequest.then(function (media) {\n\t\t\t\t\tmedia.url = media.source_url;\n\t\t\t\t\t_this4.onSelectImage(media);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"editAFfiliateImage\",\n\t\tvalue: function editAFfiliateImage() {\n\t\t\tvar attributes = this.props.attributes;\n\t\t\tvar affiliateLink = attributes.affiliateLink;\n\n\n\t\t\tthis.setState({\n\t\t\t\tisEditing: true,\n\t\t\t\timageSelection: affiliateLink.images,\n\t\t\t\taffiliateLink: affiliateLink\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"render\",\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t isEditing = _state.isEditing,\n\t\t\t imageSelection = _state.imageSelection,\n\t\t\t affiliateLink = _state.affiliateLink;\n\t\t\tvar _props3 = this.props,\n\t\t\t attributes = _props3.attributes,\n\t\t\t setAttributes = _props3.setAttributes,\n\t\t\t isLargeViewport = _props3.isLargeViewport,\n\t\t\t isSelected = _props3.isSelected,\n\t\t\t className = _props3.className,\n\t\t\t maxWidth = _props3.maxWidth,\n\t\t\t toggleSelection = _props3.toggleSelection,\n\t\t\t isRTL = _props3.isRTL;\n\t\t\tvar url = attributes.url,\n\t\t\t alt = attributes.alt,\n\t\t\t caption = attributes.caption,\n\t\t\t align = attributes.align,\n\t\t\t linkDestination = attributes.linkDestination,\n\t\t\t width = attributes.width,\n\t\t\t height = attributes.height,\n\t\t\t linkid = attributes.linkid,\n\t\t\t href = attributes.href;\n\n\t\t\tvar toolbarEditButton = wp.element.createElement(\n\t\t\t\tToolbar,\n\t\t\t\t{ label: __('ThirstyAffiliates Image Settings') },\n\t\t\t\twp.element.createElement(IconButton, {\n\t\t\t\t\tclassName: \"ta-edit-image-button components-icon-button components-toolbar__control\",\n\t\t\t\t\tlabel: __('Edit ThirstyAffiliates Image'),\n\t\t\t\t\ticon: \"edit\",\n\t\t\t\t\tonClick: this.editAFfiliateImage\n\t\t\t\t})\n\t\t\t);\n\n\t\t\tvar controls = wp.element.createElement(\n\t\t\t\tBlockControls,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(BlockAlignmentToolbar, {\n\t\t\t\t\tvalue: align,\n\t\t\t\t\tonChange: this.updateAlignment\n\t\t\t\t}),\n\t\t\t\ttoolbarEditButton\n\t\t\t);\n\n\t\t\tif (isEditing) {\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tFragment,\n\t\t\t\t\tnull,\n\t\t\t\t\tcontrols,\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPlaceholder,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ticon: \"format-image\",\n\t\t\t\t\t\t\tlabel: __(\"ThirstyAffiliates Image\"),\n\t\t\t\t\t\t\tinstructions: __(\"Search for an affiliate link and select image to insert.\")\n\t\t\t\t\t\t},\n\t\t\t\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__search_input__[\"a\" /* default */], {\n\t\t\t\t\t\t\tupdateImageSelection: this.updateImageSelection\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t!!imageSelection.length && wp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ className: \"ta-image-sel-wrap\" },\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"h3\",\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\taffiliateLink.title + \" \" + __('attached images:')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"ta-image-selection\" },\n\t\t\t\t\t\t\t\timageSelection.map(function (image, index) {\n\t\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\"button\",\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\t\t\treturn _this5.onSelectAffiliateImage(image);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\twp.element.createElement(\"img\", { src: image.src })\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tvar classes = __WEBPACK_IMPORTED_MODULE_0_classnames___default()(className, {\n\t\t\t\t'wp-block-image': true,\n\t\t\t\t'is-transient': isBlobURL(url),\n\t\t\t\t'is-resized': !!width || !!height,\n\t\t\t\t'is-focused': isSelected\n\t\t\t});\n\n\t\t\tvar isResizable = ['wide', 'full'].indexOf(align) === -1 && isLargeViewport;\n\t\t\tvar imageSizeOptions = this.getImageSizeOptions();\n\n\t\t\tvar getInspectorControls = function getInspectorControls(imageWidth, imageHeight) {\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tInspectorControls,\n\t\t\t\t\tnull,\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ title: __('Image Settings') },\n\t\t\t\t\t\twp.element.createElement(TextareaControl, {\n\t\t\t\t\t\t\tlabel: __('Alt Text (Alternative Text)'),\n\t\t\t\t\t\t\tvalue: alt,\n\t\t\t\t\t\t\tonChange: _this5.updateAlt,\n\t\t\t\t\t\t\thelp: __('Alternative text describes your image to people who can’t see it. Add a short description with its key details.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t!isEmpty(imageSizeOptions) && wp.element.createElement(SelectControl, {\n\t\t\t\t\t\t\tlabel: __('Image Size'),\n\t\t\t\t\t\t\tvalue: url,\n\t\t\t\t\t\t\toptions: imageSizeOptions,\n\t\t\t\t\t\t\tonChange: _this5.updateImageURL\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tisResizable && wp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions\" },\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"p\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\t__('Image Dimensions')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\tclassName: \"block-library-image__dimensions__width\",\n\t\t\t\t\t\t\t\t\tlabel: __('Width'),\n\t\t\t\t\t\t\t\t\tvalue: width !== undefined ? width : '',\n\t\t\t\t\t\t\t\t\tplaceholder: imageWidth,\n\t\t\t\t\t\t\t\t\tmin: 1,\n\t\t\t\t\t\t\t\t\tonChange: _this5.updateWidth\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\tclassName: \"block-library-image__dimensions__height\",\n\t\t\t\t\t\t\t\t\tlabel: __('Height'),\n\t\t\t\t\t\t\t\t\tvalue: height !== undefined ? height : '',\n\t\t\t\t\t\t\t\t\tplaceholder: imageHeight,\n\t\t\t\t\t\t\t\t\tmin: 1,\n\t\t\t\t\t\t\t\t\tonChange: _this5.updateHeight\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t{ className: \"block-library-image__dimensions__row\" },\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tButtonGroup,\n\t\t\t\t\t\t\t\t\t{ \"aria-label\": __('Image Size') },\n\t\t\t\t\t\t\t\t\t[25, 50, 75, 100].map(function (scale) {\n\t\t\t\t\t\t\t\t\t\tvar scaledWidth = Math.round(imageWidth * (scale / 100));\n\t\t\t\t\t\t\t\t\t\tvar scaledHeight = Math.round(imageHeight * (scale / 100));\n\n\t\t\t\t\t\t\t\t\t\tvar isCurrent = width === scaledWidth && height === scaledHeight;\n\n\t\t\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\tButton,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tkey: scale,\n\t\t\t\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimary: isCurrent,\n\t\t\t\t\t\t\t\t\t\t\t\t\"aria-pressed\": isCurrent,\n\t\t\t\t\t\t\t\t\t\t\t\tonClick: _this5.updateDimensions(scaledWidth, scaledHeight)\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tscale,\n\t\t\t\t\t\t\t\t\t\t\t\"%\"\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tButton,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t\t\tonClick: _this5.updateDimensions()\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t__('Reset')\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t};\n\n\t\t\t// Disable reason: Each block can be selected by clicking on it\n\t\t\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t\t\treturn wp.element.createElement(\n\t\t\t\tFragment,\n\t\t\t\tnull,\n\t\t\t\tcontrols,\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"figure\",\n\t\t\t\t\t{ className: classes },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t__WEBPACK_IMPORTED_MODULE_2__image_size__[\"a\" /* default */],\n\t\t\t\t\t\t{ src: url, dirtynessTrigger: align },\n\t\t\t\t\t\tfunction (sizes) {\n\t\t\t\t\t\t\tvar imageWidthWithinContainer = sizes.imageWidthWithinContainer,\n\t\t\t\t\t\t\t imageHeightWithinContainer = sizes.imageHeightWithinContainer,\n\t\t\t\t\t\t\t imageWidth = sizes.imageWidth,\n\t\t\t\t\t\t\t imageHeight = sizes.imageHeight;\n\n\n\t\t\t\t\t\t\tvar filename = _this5.getFilename(url);\n\t\t\t\t\t\t\tvar defaultedAlt = void 0;\n\t\t\t\t\t\t\tif (alt) {\n\t\t\t\t\t\t\t\tdefaultedAlt = alt;\n\t\t\t\t\t\t\t} else if (filename) {\n\t\t\t\t\t\t\t\tdefaultedAlt = sprintf(__('This image has an empty alt attribute; its file name is %s'), filename);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdefaultedAlt = __('This image has an empty alt attribute');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar img =\n\t\t\t\t\t\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t\t\t\t\t\t// should direct focus to block.\n\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\t\"ta\",\n\t\t\t\t\t\t\t\t\t{ linkid: linkid, href: href },\n\t\t\t\t\t\t\t\t\twp.element.createElement(\"img\", { src: url, alt: defaultedAlt, onClick: _this5.onImageClick, onError: function onError() {\n\t\t\t\t\t\t\t\t\t\t\treturn _this5.onImageError(url);\n\t\t\t\t\t\t\t\t\t\t} })\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tisBlobURL(url) && wp.element.createElement(Spinner, null)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\t;\n\n\t\t\t\t\t\t\tif (!isResizable || !imageWidthWithinContainer) {\n\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\tgetInspectorControls(imageWidth, imageHeight),\n\t\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t\t\t\t{ style: { width: width, height: height } },\n\t\t\t\t\t\t\t\t\t\timg\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar currentWidth = width || imageWidthWithinContainer;\n\t\t\t\t\t\t\tvar currentHeight = height || imageHeightWithinContainer;\n\n\t\t\t\t\t\t\tvar ratio = imageWidth / imageHeight;\n\t\t\t\t\t\t\tvar minWidth = imageWidth < imageHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\t\t\t\t\t\tvar minHeight = imageHeight < imageWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t\t\t\t\t\t// With the current implementation of ResizableBox, an image needs an explicit pixel value for the max-width.\n\t\t\t\t\t\t\t// In absence of being able to set the content-width, this max-width is currently dictated by the vanilla editor style.\n\t\t\t\t\t\t\t// The following variable adds a buffer to this vanilla style, so 3rd party themes have some wiggleroom.\n\t\t\t\t\t\t\t// This does, in most cases, allow you to scale the image beyond the width of the main column, though not infinitely.\n\t\t\t\t\t\t\t// @todo It would be good to revisit this once a content-width variable becomes available.\n\t\t\t\t\t\t\tvar maxWidthBuffer = maxWidth * 2.5;\n\n\t\t\t\t\t\t\tvar showRightHandle = false;\n\t\t\t\t\t\t\tvar showLeftHandle = false;\n\n\t\t\t\t\t\t\t/* eslint-disable no-lonely-if */\n\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\t\t\t\t\t\tif (align === 'center') {\n\t\t\t\t\t\t\t\t// When the image is centered, show both handles.\n\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t} else if (isRTL) {\n\t\t\t\t\t\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t\t\t\t\t\t// Show the right handle and hide the left handle only when it is aligned left.\n\t\t\t\t\t\t\t\t// Otherwise always show the left handle.\n\t\t\t\t\t\t\t\tif (align === 'left') {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Show the left handle and hide the right handle only when the image is aligned right.\n\t\t\t\t\t\t\t\t// Otherwise always show the right handle.\n\t\t\t\t\t\t\t\tif (align === 'right') {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/* eslint-enable no-lonely-if */\n\n\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\tFragment,\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\tgetInspectorControls(imageWidth, imageHeight),\n\t\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t\tResizableBox,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tsize: width && height ? {\n\t\t\t\t\t\t\t\t\t\t\twidth: width,\n\t\t\t\t\t\t\t\t\t\t\theight: height\n\t\t\t\t\t\t\t\t\t\t} : undefined,\n\t\t\t\t\t\t\t\t\t\tminWidth: minWidth,\n\t\t\t\t\t\t\t\t\t\tmaxWidth: maxWidthBuffer,\n\t\t\t\t\t\t\t\t\t\tminHeight: minHeight,\n\t\t\t\t\t\t\t\t\t\tmaxHeight: maxWidthBuffer / ratio,\n\t\t\t\t\t\t\t\t\t\tlockAspectRatio: true,\n\t\t\t\t\t\t\t\t\t\tenable: {\n\t\t\t\t\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\t\t\t\t\tleft: showLeftHandle\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonResizeStart: function onResizeStart() {\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection(false);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tonResizeStop: function onResizeStop(event, direction, elt, delta) {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes({\n\t\t\t\t\t\t\t\t\t\t\t\twidth: parseInt(currentWidth + delta.width, 10),\n\t\t\t\t\t\t\t\t\t\t\t\theight: parseInt(currentHeight + delta.height, 10)\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection(true);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\timg\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t\t(!RichText.isEmpty(caption) || isSelected) && wp.element.createElement(RichText, {\n\t\t\t\t\t\ttagName: \"figcaption\",\n\t\t\t\t\t\tplaceholder: __('Write caption…'),\n\t\t\t\t\t\tvalue: caption,\n\t\t\t\t\t\tunstableOnFocus: this.onFocusCaption,\n\t\t\t\t\t\tonChange: function onChange(value) {\n\t\t\t\t\t\t\treturn setAttributes({ caption: value });\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisSelected: this.state.captionFocused,\n\t\t\t\t\t\tinlineToolbar: true\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t);\n\t\t\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t\t}\n\t}]);\n\n\treturn ImageEdit;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (compose([withSelect(function (select, props) {\n\tvar _select = select('core'),\n\t getMedia = _select.getMedia;\n\n\tvar _select2 = select('core/editor'),\n\t getEditorSettings = _select2.getEditorSettings;\n\n\tvar id = props.attributes.id;\n\n\tvar _getEditorSettings = getEditorSettings(),\n\t maxWidth = _getEditorSettings.maxWidth,\n\t isRTL = _getEditorSettings.isRTL,\n\t imageSizes = _getEditorSettings.imageSizes;\n\n\treturn {\n\t\timage: id ? getMedia(id) : null,\n\t\tmaxWidth: maxWidth,\n\t\tisRTL: isRTL,\n\t\timageSizes: imageSizes\n\t};\n}), withViewportMatch({ isLargeViewport: 'medium' }), withNotices])(ImageEdit));\n\n/***/ }),\n/* 5 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return createUpgradedEmbedBlock; });\n/* unused harmony export isFromWordPress */\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar WORDPRESS_EMBED_BLOCK = 'core-embed/wordpress';\n\nvar _lodash = lodash,\n includes = _lodash.includes;\nvar renderToString = wp.element.renderToString;\nvar createBlock = wp.blocks.createBlock;\n\n/***\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} attributesFromPreview Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\n\nvar createUpgradedEmbedBlock = function createUpgradedEmbedBlock(props, attributesFromPreview) {\n\tvar preview = props.preview,\n\t name = props.name;\n\tvar url = props.attributes.url;\n\n\n\tif (!url) {\n\t\treturn;\n\t}\n\n\tvar matchingBlock = findBlock(url);\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tif (WORDPRESS_EMBED_BLOCK !== name && DEFAULT_EMBED_BLOCK !== matchingBlock) {\n\t\t// At this point, we have discovered a more suitable block for this url, so transform it.\n\t\tif (name !== matchingBlock) {\n\t\t\treturn createBlock(matchingBlock, { url: url });\n\t\t}\n\t}\n\n\tif (preview) {\n\t\tvar html = preview.html;\n\n\t\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\n\t\tif (isFromWordPress(html)) {\n\t\t\t// If this is not the WordPress embed block, transform it into one.\n\t\t\tif (WORDPRESS_EMBED_BLOCK !== name) {\n\t\t\t\treturn createBlock(WORDPRESS_EMBED_BLOCK, _extends({\n\t\t\t\t\turl: url\n\t\t\t\t}, attributesFromPreview));\n\t\t\t}\n\t\t}\n\t}\n};\n\nvar isFromWordPress = function isFromWordPress(html) {\n\treturn includes(html, 'class=\"wp-embedded-content\" data-secret');\n};\n\n/***/ }),\n/* 6 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar _lodash = lodash,\n noop = _lodash.noop;\nvar withGlobalEvents = wp.compose.withGlobalEvents;\nvar Component = wp.element.Component;\n\nvar ImageSize = function (_Component) {\n\t_inherits(ImageSize, _Component);\n\n\tfunction ImageSize() {\n\t\t_classCallCheck(this, ImageSize);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ImageSize.__proto__ || Object.getPrototypeOf(ImageSize)).apply(this, arguments));\n\n\t\t_this.state = {\n\t\t\twidth: undefined,\n\t\t\theight: undefined\n\t\t};\n\t\t_this.bindContainer = _this.bindContainer.bind(_this);\n\t\t_this.calculateSize = _this.calculateSize.bind(_this);\n\t\treturn _this;\n\t}\n\n\t_createClass(ImageSize, [{\n\t\tkey: 'bindContainer',\n\t\tvalue: function bindContainer(ref) {\n\t\t\tthis.container = ref;\n\t\t}\n\t}, {\n\t\tkey: 'componentDidUpdate',\n\t\tvalue: function componentDidUpdate(prevProps) {\n\t\t\tif (this.props.src !== prevProps.src) {\n\t\t\t\tthis.setState({\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined\n\t\t\t\t});\n\t\t\t\tthis.fetchImageSize();\n\t\t\t}\n\n\t\t\tif (this.props.dirtynessTrigger !== prevProps.dirtynessTrigger) {\n\t\t\t\tthis.calculateSize();\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'componentDidMount',\n\t\tvalue: function componentDidMount() {\n\t\t\tthis.fetchImageSize();\n\t\t}\n\t}, {\n\t\tkey: 'componentWillUnmount',\n\t\tvalue: function componentWillUnmount() {\n\t\t\tif (this.image) {\n\t\t\t\tthis.image.onload = noop;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'fetchImageSize',\n\t\tvalue: function fetchImageSize() {\n\t\t\tthis.image = new window.Image();\n\t\t\tthis.image.onload = this.calculateSize;\n\t\t\tthis.image.src = this.props.src;\n\t\t}\n\t}, {\n\t\tkey: 'calculateSize',\n\t\tvalue: function calculateSize() {\n\t\t\tvar maxWidth = this.container.clientWidth;\n\t\t\tvar exceedMaxWidth = this.image.width > maxWidth;\n\t\t\tvar ratio = this.image.height / this.image.width;\n\t\t\tvar width = exceedMaxWidth ? maxWidth : this.image.width;\n\t\t\tvar height = exceedMaxWidth ? maxWidth * ratio : this.image.height;\n\t\t\tthis.setState({ width: width, height: height });\n\t\t}\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar sizes = {\n\t\t\t\timageWidth: this.image && this.image.width,\n\t\t\t\timageHeight: this.image && this.image.height,\n\t\t\t\tcontainerWidth: this.container && this.container.clientWidth,\n\t\t\t\tcontainerHeight: this.container && this.container.clientHeight,\n\t\t\t\timageWidthWithinContainer: this.state.width,\n\t\t\t\timageHeightWithinContainer: this.state.height\n\t\t\t};\n\t\t\treturn wp.element.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ ref: this.bindContainer },\n\t\t\t\tthis.props.children(sizes)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ImageSize;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withGlobalEvents({\n\tresize: 'calculateSize'\n})(ImageSize));\n\n/***/ }),\n/* 7 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$components = wp.components,\n Spinner = _wp$components.Spinner,\n withSpokenMessages = _wp$components.withSpokenMessages,\n Popover = _wp$components.Popover,\n TextControl = _wp$components.TextControl;\nvar withInstanceId = wp.compose.withInstanceId;\n\nvar ThirstyURLInput = function (_Component) {\n\t_inherits(ThirstyURLInput, _Component);\n\n\t/**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tfunction ThirstyURLInput(_ref) {\n\t\tvar autocompleteRef = _ref.autocompleteRef;\n\n\t\t_classCallCheck(this, ThirstyURLInput);\n\n\t\t// this.onChange = this.onChange.bind( this );\n\t\t// this.onKeyDown = this.onKeyDown.bind( this );\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLInput.__proto__ || Object.getPrototypeOf(ThirstyURLInput)).apply(this, arguments));\n\n\t\t_this.autocompleteRef = autocompleteRef || createRef();\n\t\t_this.inputRef = createRef();\n\t\t_this.searchAffiliateLinks = _this.searchAffiliateLinks.bind(_this);\n\t\t// this.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n\t\t_this.suggestionNodes = [];\n\n\t\t_this.state = {\n\t\t\tposts: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null,\n\t\t\tloading: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Component did update method.\n * \n * @since 3.6\n */\n\n\n\t_createClass(ThirstyURLInput, [{\n\t\tkey: \"componentDidUpdate\",\n\t\tvalue: function componentDidUpdate() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t showSuggestions = _state.showSuggestions,\n\t\t\t selectedSuggestion = _state.selectedSuggestion;\n\t\t\t// only have to worry about scrolling selected suggestion into view\n\t\t\t// when already expanded\n\n\t\t\tif (showSuggestions && selectedSuggestion !== null && !this.scrollingIntoView) {\n\t\t\t\tthis.scrollingIntoView = true;\n\t\t\t\tscrollIntoView(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, {\n\t\t\t\t\tonlyScrollIfNeeded: true\n\t\t\t\t});\n\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t_this2.scrollingIntoView = false;\n\t\t\t\t}, 100);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Component unmount method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: \"componentWillUnmount\",\n\t\tvalue: function componentWillUnmount() {\n\t\t\tdelete this.suggestionsRequest;\n\t\t}\n\n\t\t/**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\n\t}, {\n\t\tkey: \"bindSuggestionNode\",\n\t\tvalue: function bindSuggestionNode(index) {\n\t\t\tvar _this3 = this;\n\n\t\t\treturn function (ref) {\n\t\t\t\t_this3.suggestionNodes[index] = ref;\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"searchAffiliateLinks\",\n\t\tvalue: function searchAffiliateLinks(value) {\n\t\t\tvar _this4 = this;\n\n\t\t\t// Show the suggestions after typing at least 2 characters=\n\t\t\tif (value.length < 2) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tshowSuggestions: false,\n\t\t\t\t\tselectedSuggestion: null,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.setState({\n\t\t\t\tshowSuggestions: true,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: true\n\t\t\t});\n\n\t\t\tvar formData = new FormData();\n\t\t\tformData.append(\"action\", \"search_affiliate_links_query\");\n\t\t\tformData.append(\"keyword\", value);\n\t\t\tformData.append(\"paged\", 1);\n\t\t\tformData.append(\"gutenberg\", true);\n\t\t\tformData.append(\"with_images\", true);\n\n\t\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\n\t\t\t// to filter results with category value. This is to prepare next update to add category filter.\n\t\t\tvar request = fetch(ajaxurl, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: formData\n\t\t\t});\n\n\t\t\trequest.then(function (response) {\n\t\t\t\treturn response.json();\n\t\t\t}).then(function (response) {\n\n\t\t\t\tif (!response.affiliate_links) return;\n\n\t\t\t\tvar posts = response.affiliate_links;\n\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif (_this4.suggestionsRequest !== request) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t_this4.setState({\n\t\t\t\t\tposts: posts,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\tif (!!posts.length) {\n\t\t\t\t\t_this4.props.debouncedSpeak(sprintf(_n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', posts.length), posts.length), 'assertive');\n\t\t\t\t} else {\n\t\t\t\t\t_this4.props.debouncedSpeak(__('No results.'), 'assertive');\n\t\t\t\t}\n\t\t\t}).catch(function () {\n\t\t\t\tif (_this4.suggestionsRequest === request) {\n\t\t\t\t\t_this4.setState({\n\t\t\t\t\t\tloading: false\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.suggestionsRequest = request;\n\t\t}\n\n\t\t/**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: \"selectLink\",\n\t\tvalue: function selectLink(post) {\n\t\t\t// this.props.onChange( post.link, post );\n\t\t\tthis.setState({\n\t\t\t\tselectedSuggestion: post,\n\t\t\t\tshowSuggestions: false\n\t\t\t});\n\n\t\t\tthis.props.updateImageSelection(post.images, post);\n\t\t}\n\n\t\t/**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: \"handleOnClick\",\n\t\tvalue: function handleOnClick(post) {\n\t\t\tthis.selectLink(post);\n\t\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\t\t// this.inputRef.current.focus();\n\t\t}\n\t}, {\n\t\tkey: \"render\",\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t _props$value = _props.value,\n\t\t\t value = _props$value === undefined ? '' : _props$value,\n\t\t\t _props$autoFocus = _props.autoFocus,\n\t\t\t autoFocus = _props$autoFocus === undefined ? true : _props$autoFocus,\n\t\t\t instanceId = _props.instanceId;\n\t\t\tvar _state2 = this.state,\n\t\t\t showSuggestions = _state2.showSuggestions,\n\t\t\t posts = _state2.posts,\n\t\t\t selectedSuggestion = _state2.selectedSuggestion,\n\t\t\t loading = _state2.loading;\n\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t\"div\",\n\t\t\t\t{ \"class\": \"edit-search-affiliate-links\" },\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t\"form\",\n\t\t\t\t\t{\n\t\t\t\t\t\tclassName: \"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover\",\n\t\t\t\t\t\tonSubmit: this.displayAffiliateImages\n\t\t\t\t\t},\n\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\tclassName: \"ta-search-affiliate-links\",\n\t\t\t\t\t\tplaceholder: __(\"Type to search affiliate links\"),\n\t\t\t\t\t\tonChange: this.searchAffiliateLinks,\n\t\t\t\t\t\tautocomplete: \"off\"\n\t\t\t\t\t}),\n\t\t\t\t\tloading && wp.element.createElement(Spinner, null),\n\t\t\t\t\tshowSuggestions && !!posts.length && wp.element.createElement(\n\t\t\t\t\t\tPopover,\n\t\t\t\t\t\t{ position: \"bottom\", focusOnMount: false },\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\"div\",\n\t\t\t\t\t\t\t{ \"class\": \"affilate-links-suggestions\" },\n\t\t\t\t\t\t\tposts.map(function (post, index) {\n\t\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t\t\"button\",\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tkey: post.id,\n\t\t\t\t\t\t\t\t\t\trole: \"option\",\n\t\t\t\t\t\t\t\t\t\ttabIndex: \"-1\",\n\t\t\t\t\t\t\t\t\t\tid: \"editor-url-input-suggestion-\" + instanceId + \"-\" + index,\n\t\t\t\t\t\t\t\t\t\tref: _this5.bindSuggestionNode(index),\n\t\t\t\t\t\t\t\t\t\tclassName: __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\t\treturn _this5.handleOnClick(post);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\"aria-selected\": index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tpost.title || __('(no title)')\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ThirstyURLInput;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(withInstanceId(ThirstyURLInput)));\n\n/***/ }),\n/* 8 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = registerFormats;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ta_link__ = __webpack_require__(9);\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\n\n\nvar registerFormatType = wp.richText.registerFormatType;\n\n/**\n * Register custom formats.\n * \n * @since 3.6\n */\n\nfunction registerFormats() {\n\n [__WEBPACK_IMPORTED_MODULE_0__ta_link__[\"a\" /* taLink */]].forEach(function (_ref) {\n var name = _ref.name,\n settings = _objectWithoutProperties(_ref, [\"name\"]);\n\n return registerFormatType(name, settings);\n });\n}\n\n/***/ }),\n/* 9 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return taLink; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__inline__ = __webpack_require__(10);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment;\nvar withSpokenMessages = wp.components.withSpokenMessages;\nvar _wp$richText = wp.richText,\n getTextContent = _wp$richText.getTextContent,\n applyFormat = _wp$richText.applyFormat,\n removeFormat = _wp$richText.removeFormat,\n slice = _wp$richText.slice;\nvar isURL = wp.url.isURL;\nvar _wp$blockEditor = wp.blockEditor,\n RichTextToolbarButton = _wp$blockEditor.RichTextToolbarButton,\n RichTextShortcut = _wp$blockEditor.RichTextShortcut;\nvar _wp$components = wp.components,\n Path = _wp$components.Path,\n SVG = _wp$components.SVG;\nvar getRectangleFromRange = wp.dom.getRectangleFromRange;\n\n\nvar name = \"ta/link\";\nvar lastAnchorRect = null;\n\n/**\n * Custom Affiliate link format. When applied will wrap selected text with <ta href=\"\" linkid=\"\"></ta> custom element.\n * Custom element is implemented here as we are not allowed to use <a> tag due to Gutenberg limitations.\n * Element is converted to normal <a> tag on frontend via PHP script filtered on 'the_content'.\n *\n * @since 3.6\n */\nvar taLink = {\n\tname: name,\n\ttitle: __(\"Affiliate Link\"),\n\ttagName: \"ta\",\n\tclassName: null,\n\tattributes: {\n\t\turl: \"href\",\n\t\ttarget: \"target\"\n\t},\n\tedit: withSpokenMessages(function (_Component) {\n\t\t_inherits(LinkEdit, _Component);\n\n\t\t/**\n * Component constructor.\n *\n * @since 3.6\n */\n\t\tfunction LinkEdit() {\n\t\t\t_classCallCheck(this, LinkEdit);\n\n\t\t\tvar _this = _possibleConstructorReturn(this, (LinkEdit.__proto__ || Object.getPrototypeOf(LinkEdit)).apply(this, arguments));\n\n\t\t\t_this.addLink = _this.addLink.bind(_this);\n\t\t\t_this.stopAddingLink = _this.stopAddingLink.bind(_this);\n\t\t\t_this.onRemoveFormat = _this.onRemoveFormat.bind(_this);\n\t\t\t_this.state = {\n\t\t\t\taddingLink: false\n\t\t\t};\n\t\t\treturn _this;\n\t\t}\n\n\t\t/**\n * Callback to set state to adding link status.\n *\n * @since 3.6\n */\n\n\n\t\t_createClass(LinkEdit, [{\n\t\t\tkey: \"addLink\",\n\t\t\tvalue: function addLink() {\n\t\t\t\tvar _props = this.props,\n\t\t\t\t value = _props.value,\n\t\t\t\t onChange = _props.onChange;\n\n\t\t\t\tvar text = getTextContent(slice(value));\n\n\t\t\t\tif (text && isURL(text)) {\n\t\t\t\t\tonChange(applyFormat(value, { type: name, attributes: { url: text } }));\n\t\t\t\t} else {\n\t\t\t\t\tthis.setState({ addingLink: true });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n * Callback to set state to stop adding link status.\n *\n * @since 3.6\n */\n\n\t\t}, {\n\t\t\tkey: \"stopAddingLink\",\n\t\t\tvalue: function stopAddingLink() {\n\t\t\t\tthis.setState({ addingLink: false });\n\t\t\t}\n\n\t\t\t/**\n * Remove format event callback.\n *\n * @since 3.6\n */\n\n\t\t}, {\n\t\t\tkey: \"onRemoveFormat\",\n\t\t\tvalue: function onRemoveFormat() {\n\t\t\t\tvar _props2 = this.props,\n\t\t\t\t value = _props2.value,\n\t\t\t\t onChange = _props2.onChange,\n\t\t\t\t speak = _props2.speak;\n\n\n\t\t\t\tonChange(removeFormat(value, name));\n\t\t\t\tspeak(__(\"Affiliate Link removed.\"), \"assertive\");\n\t\t\t}\n\n\t\t\t/**\n * Get selected anchor text.\n *\n * @since 3.9\n */\n\n\t\t}, {\n\t\t\tkey: \"getAnchorRect\",\n\t\t\tvalue: function getAnchorRect() {\n\n\t\t\t\tvar selection = window.getSelection();\n\t\t\t\tvar range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null;\n\n\t\t\t\tif (!range) return;\n\n\t\t\t\t// Fix for the link UI jumping around the screen on WP 5.6\n\t\t\t\tif (selection.anchorNode.nodeType !== window.Node.TEXT_NODE) {\n\t\t\t\t\treturn lastAnchorRect;\n\t\t\t\t}\n\n\t\t\t\tvar rect = null;\n\n\t\t\t\tif (this.state.addingLink) {\n\t\t\t\t\trect = getRectangleFromRange(range);\n\t\t\t\t} else {\n\n\t\t\t\t\tvar element = range.startContainer;\n\n\t\t\t\t\t// If the caret is right before the element, select the next element.\n\t\t\t\t\telement = element.nextElementSibling || element;\n\n\t\t\t\t\twhile (element.nodeType !== window.Node.ELEMENT_NODE) {\n\t\t\t\t\t\telement = element.parentNode;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar closest = element.closest('ta');\n\t\t\t\t\tif (closest) {\n\t\t\t\t\t\trect = closest.getBoundingClientRect();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlastAnchorRect = rect;\n\n\t\t\t\treturn rect;\n\t\t\t}\n\n\t\t\t/**\n * Component render method.\n *\n * @since 3.6\n */\n\n\t\t}, {\n\t\t\tkey: \"render\",\n\t\t\tvalue: function render() {\n\t\t\t\tvar _props3 = this.props,\n\t\t\t\t isActive = _props3.isActive,\n\t\t\t\t activeAttributes = _props3.activeAttributes,\n\t\t\t\t value = _props3.value,\n\t\t\t\t onChange = _props3.onChange;\n\n\n\t\t\t\tvar anchorRect = this.getAnchorRect();\n\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\tFragment,\n\t\t\t\t\tnull,\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"access\",\n\t\t\t\t\t\tcharacter: \"s\",\n\t\t\t\t\t\tonUse: this.onRemoveFormat\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"primary\",\n\t\t\t\t\t\tcharacter: \"l\",\n\t\t\t\t\t\tonUse: this.addLink\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(RichTextShortcut, {\n\t\t\t\t\t\ttype: \"primaryShift\",\n\t\t\t\t\t\tcharacter: \"l\",\n\t\t\t\t\t\tonUse: this.onRemoveFormat\n\t\t\t\t\t}),\n\t\t\t\t\tisActive && wp.element.createElement(RichTextToolbarButton, {\n\t\t\t\t\t\ticon: \"editor-unlink\",\n\t\t\t\t\t\ttitle: __('Remove Affiliate Link'),\n\t\t\t\t\t\tclassName: \"ta-unlink-button\",\n\t\t\t\t\t\tonClick: this.onRemoveFormat,\n\t\t\t\t\t\tisActive: isActive,\n\t\t\t\t\t\tshortcutType: \"primaryShift\",\n\t\t\t\t\t\tshortcutCharacter: \"l\"\n\t\t\t\t\t}),\n\t\t\t\t\t!isActive && wp.element.createElement(RichTextToolbarButton, {\n\t\t\t\t\t\ticon: wp.element.createElement(\n\t\t\t\t\t\t\tSVG,\n\t\t\t\t\t\t\t{ xmlns: \"http://www.w3.org/2000/svg\", width: \"16.688\", height: \"9.875\", viewBox: \"0 0 16.688 9.875\" },\n\t\t\t\t\t\t\twp.element.createElement(Path, { id: \"TA.svg\", fill: \"black\", \"class\": \"cls-1\", d: \"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z\", transform: \"translate(-1.188 -5.25)\" })\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle: __('Affiliate Link'),\n\t\t\t\t\t\tclassName: \"ta-link-button\",\n\t\t\t\t\t\tonClick: this.addLink,\n\t\t\t\t\t\tshortcutType: \"primary\",\n\t\t\t\t\t\tshortcutCharacter: \"l\"\n\t\t\t\t\t}),\n\t\t\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_0__inline__[\"a\" /* default */], {\n\t\t\t\t\t\taddingLink: this.state.addingLink,\n\t\t\t\t\t\tstopAddingLink: this.stopAddingLink,\n\t\t\t\t\t\tisActive: isActive,\n\t\t\t\t\t\tactiveAttributes: activeAttributes,\n\t\t\t\t\t\tanchorRect: anchorRect,\n\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\tonChange: onChange\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t}]);\n\n\t\treturn LinkEdit;\n\t}(Component))\n};\n\n/***/ }),\n/* 10 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils__ = __webpack_require__(11);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__url_popover__ = __webpack_require__(12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__url_input__ = __webpack_require__(13);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\n\n\n\nvar __ = wp.i18n.__;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$components = wp.components,\n ExternalLink = _wp$components.ExternalLink,\n ToggleControl = _wp$components.ToggleControl,\n IconButton = _wp$components.IconButton,\n withSpokenMessages = _wp$components.withSpokenMessages;\nvar _wp$keycodes = wp.keycodes,\n LEFT = _wp$keycodes.LEFT,\n RIGHT = _wp$keycodes.RIGHT,\n UP = _wp$keycodes.UP,\n DOWN = _wp$keycodes.DOWN,\n BACKSPACE = _wp$keycodes.BACKSPACE,\n ENTER = _wp$keycodes.ENTER;\nvar _wp$url = wp.url,\n prependHTTP = _wp$url.prependHTTP,\n safeDecodeURI = _wp$url.safeDecodeURI,\n filterURLForDisplay = _wp$url.filterURLForDisplay;\nvar _wp$richText = wp.richText,\n create = _wp$richText.create,\n insert = _wp$richText.insert,\n isCollapsed = _wp$richText.isCollapsed,\n applyFormat = _wp$richText.applyFormat,\n getTextContent = _wp$richText.getTextContent,\n slice = _wp$richText.slice;\n\n\nvar stopKeyPropagation = function stopKeyPropagation(event) {\n\treturn event.stopPropagation();\n};\n\n/**\n * Generates the format object that will be applied to the link text.\n *\n * @since 3.6\n *\n * @param {string} url The href of the link.\n * @param {boolean} linkid Affiliate link ID.\n * @param {Object} text The text that is being hyperlinked.\n *\n * @return {Object} The final format object.\n */\nfunction createLinkFormat(_ref) {\n\tvar url = _ref.url,\n\t linkid = _ref.linkid,\n\t text = _ref.text;\n\n\tvar format = {\n\t\ttype: \"ta/link\",\n\t\tattributes: {\n\t\t\turl: url,\n\t\t\tlinkid: linkid.toString()\n\t\t}\n\t};\n\n\treturn format;\n}\n\n/**\n * Check if input is being show.\n *\n * @since 3.6\n *\n * @param {Object} props Component props.\n * @param {Object} state Component state.\n */\nfunction isShowingInput(props, state) {\n\treturn props.addingLink || state.editLink;\n}\n\n/**\n * Affiliate Link editor JSX element.\n *\n * @since 3.6\n *\n * @param {Object} param0 Component props (destructred).\n */\nvar LinkEditor = function LinkEditor(_ref2) {\n\tvar value = _ref2.value,\n\t onChangeInputValue = _ref2.onChangeInputValue,\n\t onKeyDown = _ref2.onKeyDown,\n\t submitLink = _ref2.submitLink,\n\t invalidLink = _ref2.invalidLink,\n\t resetInvalidLink = _ref2.resetInvalidLink,\n\t autocompleteRef = _ref2.autocompleteRef;\n\treturn (\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t\twp.element.createElement(\n\t\t\t'form',\n\t\t\t{\n\t\t\t\tclassName: 'editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover',\n\t\t\t\tonKeyPress: stopKeyPropagation,\n\t\t\t\tonKeyDown: onKeyDown,\n\t\t\t\tonSubmit: submitLink\n\t\t\t},\n\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_3__url_input__[\"a\" /* default */], {\n\t\t\t\tvalue: value,\n\t\t\t\tonChange: onChangeInputValue,\n\t\t\t\tautocompleteRef: autocompleteRef,\n\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\tresetInvalidLink: resetInvalidLink\n\t\t\t}),\n\t\t\twp.element.createElement(IconButton, { icon: 'editor-break', label: __('Apply'), type: 'submit' })\n\t\t)\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n\n\t);\n};\n\n/**\n * Affiliate link url viewer JSX element.\n *\n * @param {*} param0 Component props (destructred).\n */\nvar LinkViewerUrl = function LinkViewerUrl(_ref3) {\n\tvar url = _ref3.url;\n\n\tvar prependedURL = prependHTTP(url);\n\tvar linkClassName = __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value', {\n\t\t'has-invalid-link': !Object(__WEBPACK_IMPORTED_MODULE_1__utils__[\"a\" /* isValidHref */])(prependedURL)\n\t});\n\n\tif (!url) {\n\t\treturn wp.element.createElement('span', { className: linkClassName });\n\t}\n\n\treturn wp.element.createElement(\n\t\tExternalLink,\n\t\t{\n\t\t\tclassName: linkClassName,\n\t\t\thref: url\n\t\t},\n\t\tfilterURLForDisplay(safeDecodeURI(url))\n\t);\n};\n\n/**\n * Affiliate link viewer JSX element.\n *\n * @param {*} param0 Component props (destructred).\n */\nvar LinkViewer = function LinkViewer(_ref4) {\n\tvar url = _ref4.url,\n\t editLink = _ref4.editLink;\n\n\treturn (\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\twp.element.createElement(\n\t\t\t'div',\n\t\t\t{\n\t\t\t\tclassName: 'editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content',\n\t\t\t\tonKeyPress: stopKeyPropagation\n\t\t\t},\n\t\t\twp.element.createElement(LinkViewerUrl, { url: url }),\n\t\t\twp.element.createElement(IconButton, { icon: 'edit', label: __('Edit'), onClick: editLink })\n\t\t)\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\n\t);\n};\n\n/**\n * Inline affiliate link UI Component.\n *\n * @since 3.6\n *\n * @param {*} param0 Component props (destructred).\n */\n\nvar InlineAffiliateLinkUI = function (_Component) {\n\t_inherits(InlineAffiliateLinkUI, _Component);\n\n\tfunction InlineAffiliateLinkUI() {\n\t\t_classCallCheck(this, InlineAffiliateLinkUI);\n\n\t\tvar _this = _possibleConstructorReturn(this, (InlineAffiliateLinkUI.__proto__ || Object.getPrototypeOf(InlineAffiliateLinkUI)).apply(this, arguments));\n\n\t\t_this.editLink = _this.editLink.bind(_this);\n\t\t_this.submitLink = _this.submitLink.bind(_this);\n\t\t_this.onKeyDown = _this.onKeyDown.bind(_this);\n\t\t_this.onChangeInputValue = _this.onChangeInputValue.bind(_this);\n\t\t_this.onClickOutside = _this.onClickOutside.bind(_this);\n\t\t_this.resetState = _this.resetState.bind(_this);\n\t\t_this.autocompleteRef = createRef();\n\t\t_this.resetInvalidLink = _this.resetInvalidLink.bind(_this);\n\n\t\t_this.state = {\n\t\t\tinputValue: '',\n\t\t\tlinkid: 0,\n\t\t\tpost: null,\n\t\t\tinvalidLink: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Stop the key event from propagating up to ObserveTyping.startTypingInTextField.\n *\n * @since 3.6\n *\n * @param {Object} event Event object.\n */\n\n\n\t_createClass(InlineAffiliateLinkUI, [{\n\t\tkey: 'onKeyDown',\n\t\tvalue: function onKeyDown(event) {\n\t\t\tif ([LEFT, DOWN, RIGHT, UP, BACKSPACE, ENTER].indexOf(event.keyCode) > -1) {\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Callback to set state when input value is changed.\n *\n * @since 3.6\n *\n * @param {*} inputValue\n * @param {*} post\n */\n\n\t}, {\n\t\tkey: 'onChangeInputValue',\n\t\tvalue: function onChangeInputValue(inputValue) {\n\t\t\tvar post = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n\t\t\tvar linkid = post ? post.id : 0;\n\t\t\tthis.setState({ inputValue: inputValue, linkid: linkid, post: post });\n\t\t}\n\n\t\t/**\n * Callback to set state when edit affiliate link (already inserted) is triggered.\n *\n * @since 3.6\n *\n * @param {*} event\n */\n\n\t}, {\n\t\tkey: 'editLink',\n\t\tvalue: function editLink(event) {\n\t\t\tthis.setState({ editLink: true });\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\t/**\n * Callback to apply the affiliate link format to the selected text or position in the active block.\n *\n * @since 3.6\n *\n * @param {*} event\n */\n\n\t}, {\n\t\tkey: 'submitLink',\n\t\tvalue: function submitLink(event) {\n\t\t\tvar _props = this.props,\n\t\t\t isActive = _props.isActive,\n\t\t\t value = _props.value,\n\t\t\t onChange = _props.onChange,\n\t\t\t speak = _props.speak;\n\t\t\tvar _state = this.state,\n\t\t\t inputValue = _state.inputValue,\n\t\t\t linkid = _state.linkid,\n\t\t\t post = _state.post;\n\n\t\t\tvar url = prependHTTP(inputValue);\n\t\t\tvar selectedText = getTextContent(slice(value));\n\t\t\tvar format = createLinkFormat({\n\t\t\t\turl: url,\n\t\t\t\tlinkid: linkid,\n\t\t\t\ttext: selectedText\n\t\t\t});\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif (!linkid || !post) {\n\t\t\t\tthis.setState({ invalidLink: true });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (isCollapsed(value) && !isActive) {\n\t\t\t\tvar toInsert = applyFormat(create({ text: post.title }), format, 0, url.length);\n\t\t\t\tonChange(insert(value, toInsert));\n\t\t\t} else {\n\t\t\t\tonChange(applyFormat(value, format));\n\t\t\t}\n\n\t\t\tthis.resetState();\n\n\t\t\tif (!Object(__WEBPACK_IMPORTED_MODULE_1__utils__[\"a\" /* isValidHref */])(url)) {\n\t\t\t\tspeak(__('Warning: the link has been inserted but may have errors. Please test it.'), 'assertive');\n\t\t\t} else if (isActive) {\n\t\t\t\tspeak(__('Link edited.'), 'assertive');\n\t\t\t} else {\n\t\t\t\tspeak(__('Link inserted'), 'assertive');\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Callback to run when users clicks outside the popover UI.\n *\n * @since 3.6\n *\n * @param {*} event\n */\n\n\t}, {\n\t\tkey: 'onClickOutside',\n\t\tvalue: function onClickOutside(event) {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onClickOutside fails to detect that a click on a suggestion occured in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tvar autocompleteElement = this.autocompleteRef.current;\n\t\t\tif (autocompleteElement && autocompleteElement.contains(event.target)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.resetState();\n\t\t}\n\n\t\t/**\n * Reset state callback.\n *\n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'resetState',\n\t\tvalue: function resetState() {\n\t\t\tthis.props.stopAddingLink();\n\t\t\tthis.setState({ inputValue: '', editLink: false });\n\t\t\tthis.resetInvalidLink();\n\t\t}\n\n\t\t/**\n * Reset invalid link state callback. Separated as we need to run this independently from resetState() callback.\n *\n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'resetInvalidLink',\n\t\tvalue: function resetInvalidLink() {\n\t\t\tthis.setState({ invalidLink: false });\n\t\t}\n\n\t\t/**\n * Component render method.\n *\n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _props2 = this.props,\n\t\t\t isActive = _props2.isActive,\n\t\t\t _props2$activeAttribu = _props2.activeAttributes,\n\t\t\t url = _props2$activeAttribu.url,\n\t\t\t linkid = _props2$activeAttribu.linkid,\n\t\t\t addingLink = _props2.addingLink,\n\t\t\t anchorRect = _props2.anchorRect,\n\t\t\t value = _props2.value,\n\t\t\t onChange = _props2.onChange;\n\n\n\t\t\tif (!isActive && !addingLink) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tvar _state2 = this.state,\n\t\t\t inputValue = _state2.inputValue,\n\t\t\t invalidLink = _state2.invalidLink;\n\n\t\t\tvar showInput = isShowingInput(this.props, this.state);\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t__WEBPACK_IMPORTED_MODULE_2__url_popover__[\"a\" /* default */],\n\t\t\t\t{\n\t\t\t\t\tonClickOutside: this.onClickOutside,\n\t\t\t\t\tonClose: this.resetState,\n\t\t\t\t\tfocusOnMount: showInput ? 'firstElement' : false,\n\t\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\t\tanchorRect: anchorRect\n\t\t\t\t},\n\t\t\t\tshowInput ? wp.element.createElement(LinkEditor, {\n\t\t\t\t\tvalue: inputValue,\n\t\t\t\t\tonChangeInputValue: this.onChangeInputValue,\n\t\t\t\t\tonKeyDown: this.onKeyDown,\n\t\t\t\t\tsubmitLink: this.submitLink,\n\t\t\t\t\tautocompleteRef: this.autocompleteRef,\n\t\t\t\t\tupdateLinkId: this.updateLinkId,\n\t\t\t\t\tinvalidLink: invalidLink,\n\t\t\t\t\tresetInvalidLink: this.resetInvalidLink\n\t\t\t\t}) : wp.element.createElement(LinkViewer, {\n\t\t\t\t\turl: url,\n\t\t\t\t\teditLink: this.editLink\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn InlineAffiliateLinkUI;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(InlineAffiliateLinkUI));\n\n/***/ }),\n/* 11 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export (immutable) */ __webpack_exports__[\"a\"] = isValidHref;\nvar _lodash = lodash,\n startsWith = _lodash.startsWith;\nvar _wp$url = wp.url,\n getProtocol = _wp$url.getProtocol,\n isValidProtocol = _wp$url.isValidProtocol,\n getAuthority = _wp$url.getAuthority,\n isValidAuthority = _wp$url.isValidAuthority,\n getPath = _wp$url.getPath,\n isValidPath = _wp$url.isValidPath,\n getQueryString = _wp$url.getQueryString,\n isValidQueryString = _wp$url.isValidQueryString,\n getFragment = _wp$url.getFragment,\n isValidFragment = _wp$url.isValidFragment;\n\n/**\n * Check for issues with the provided href.\n * \n * @since 3.6\n *\n * @param {string} href The href.\n * @return {boolean} Is the href invalid?\n */\n\nfunction isValidHref(href) {\n\tif (!href) {\n\t\treturn false;\n\t}\n\n\tvar trimmedHref = href.trim();\n\n\tif (!trimmedHref) {\n\t\treturn false;\n\t}\n\n\t// Does the href start with something that looks like a URL protocol?\n\tif (/^\\S+:/.test(trimmedHref)) {\n\t\tvar protocol = getProtocol(trimmedHref);\n\t\tif (!isValidProtocol(protocol)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Add some extra checks for http(s) URIs, since these are the most common use-case.\n\t\t// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n\t\tif (startsWith(protocol, 'http') && !/^https?:\\/\\/[^\\/\\s]/i.test(trimmedHref)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar authority = getAuthority(trimmedHref);\n\t\tif (!isValidAuthority(authority)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar path = getPath(trimmedHref);\n\t\tif (path && !isValidPath(path)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar queryString = getQueryString(trimmedHref);\n\t\tif (queryString && !isValidQueryString(queryString)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar fragment = getFragment(trimmedHref);\n\t\tif (fragment && !isValidFragment(fragment)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Validate anchor links.\n\tif (startsWith(trimmedHref, '#') && !isValidFragment(trimmedHref)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/***/ }),\n/* 12 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar __ = wp.i18n.__;\nvar Component = wp.element.Component;\nvar _wp$components = wp.components,\n Popover = _wp$components.Popover,\n IconButton = _wp$components.IconButton;\n\n/**\n * Custom URL Popover component.\n * \n * @since 3.6\n */\n\nvar ThirstyURLPopover = function (_Component) {\n\t_inherits(ThirstyURLPopover, _Component);\n\n\t/**\n * Component constructor method.\n * \n * @since 3.6\n */\n\tfunction ThirstyURLPopover() {\n\t\t_classCallCheck(this, ThirstyURLPopover);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLPopover.__proto__ || Object.getPrototypeOf(ThirstyURLPopover)).apply(this, arguments));\n\n\t\t_this.toggleSettingsVisibility = _this.toggleSettingsVisibility.bind(_this);\n\n\t\t_this.state = {\n\t\t\tisSettingsExpanded: false\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Component constructor.\n * \n * @since 3.6\n */\n\n\n\t_createClass(ThirstyURLPopover, [{\n\t\tkey: 'toggleSettingsVisibility',\n\t\tvalue: function toggleSettingsVisibility() {\n\t\t\tthis.setState({\n\t\t\t\tisSettingsExpanded: !this.state.isSettingsExpanded\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Component render method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _props = this.props,\n\t\t\t children = _props.children,\n\t\t\t renderSettings = _props.renderSettings,\n\t\t\t invalidLink = _props.invalidLink,\n\t\t\t _props$position = _props.position,\n\t\t\t position = _props$position === undefined ? 'bottom center' : _props$position,\n\t\t\t _props$focusOnMount = _props.focusOnMount,\n\t\t\t focusOnMount = _props$focusOnMount === undefined ? 'firstElement' : _props$focusOnMount,\n\t\t\t popoverProps = _objectWithoutProperties(_props, ['children', 'renderSettings', 'invalidLink', 'position', 'focusOnMount']);\n\n\t\t\tvar isSettingsExpanded = this.state.isSettingsExpanded;\n\n\n\t\t\tvar showSettings = !!renderSettings && isSettingsExpanded;\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\tPopover,\n\t\t\t\t_extends({\n\t\t\t\t\tclassName: 'ta-url-popover editor-url-popover block-editor-url-popover',\n\t\t\t\t\tfocusOnMount: focusOnMount,\n\t\t\t\t\tposition: position\n\t\t\t\t}, popoverProps),\n\t\t\t\twp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ className: 'editor-url-popover__row' },\n\t\t\t\t\tchildren,\n\t\t\t\t\t!!renderSettings && wp.element.createElement(IconButton, {\n\t\t\t\t\t\tclassName: 'editor-url-popover__settings-toggle',\n\t\t\t\t\t\ticon: 'ellipsis',\n\t\t\t\t\t\tlabel: __('Link Settings'),\n\t\t\t\t\t\tonClick: this.toggleSettingsVisibility,\n\t\t\t\t\t\t'aria-expanded': isSettingsExpanded\n\t\t\t\t\t})\n\t\t\t\t),\n\t\t\t\tshowSettings && wp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ className: 'editor-url-popover__row editor-url-popover__settings' },\n\t\t\t\t\trenderSettings()\n\t\t\t\t),\n\t\t\t\tinvalidLink && wp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ 'class': 'ta-invalid-link' },\n\t\t\t\t\t__('Invalid affiliate link')\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn ThirstyURLPopover;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (ThirstyURLPopover);\n\n/***/ }),\n/* 13 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_classnames__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__ = __webpack_require__(14);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view__);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n\n\n\nvar __ = wp.i18n.__;\nvar _lodash = lodash,\n throttle = _lodash.throttle;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n createRef = _wp$element.createRef;\nvar _wp$keycodes = wp.keycodes,\n UP = _wp$keycodes.UP,\n DOWN = _wp$keycodes.DOWN,\n ENTER = _wp$keycodes.ENTER,\n TAB = _wp$keycodes.TAB;\nvar _wp$components = wp.components,\n Spinner = _wp$components.Spinner,\n withSpokenMessages = _wp$components.withSpokenMessages,\n Popover = _wp$components.Popover;\nvar withInstanceId = wp.compose.withInstanceId;\n\n// Since URLInput is rendered in the context of other inputs, but should be\n// considered a separate modal node, prevent keyboard events from propagating\n// as being considered from the input.\n\nvar stopEventPropagation = function stopEventPropagation(event) {\n\treturn event.stopPropagation();\n};\n\n/**\n * Custom URL Input component.\n * \n * @since 3.6\n */\n\nvar ThirstyURLInput = function (_Component) {\n\t_inherits(ThirstyURLInput, _Component);\n\n\t/**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tfunction ThirstyURLInput(_ref) {\n\t\tvar autocompleteRef = _ref.autocompleteRef;\n\n\t\t_classCallCheck(this, ThirstyURLInput);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ThirstyURLInput.__proto__ || Object.getPrototypeOf(ThirstyURLInput)).apply(this, arguments));\n\n\t\t_this.onChange = _this.onChange.bind(_this);\n\t\t_this.onKeyDown = _this.onKeyDown.bind(_this);\n\t\t_this.autocompleteRef = autocompleteRef || createRef();\n\t\t_this.inputRef = createRef();\n\t\t_this.updateSuggestions = throttle(_this.updateSuggestions.bind(_this), 200);\n\n\t\t_this.suggestionNodes = [];\n\n\t\t_this.state = {\n\t\t\tposts: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null\n\t\t};\n\t\treturn _this;\n\t}\n\n\t/**\n * Component did update method.\n * \n * @since 3.6\n */\n\n\n\t_createClass(ThirstyURLInput, [{\n\t\tkey: 'componentDidUpdate',\n\t\tvalue: function componentDidUpdate() {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar _state = this.state,\n\t\t\t showSuggestions = _state.showSuggestions,\n\t\t\t selectedSuggestion = _state.selectedSuggestion;\n\t\t\t// only have to worry about scrolling selected suggestion into view\n\t\t\t// when already expanded\n\n\t\t\tif (showSuggestions && selectedSuggestion !== null && !this.scrollingIntoView) {\n\t\t\t\tthis.scrollingIntoView = true;\n\t\t\t\t__WEBPACK_IMPORTED_MODULE_1_dom_scroll_into_view___default()(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, {\n\t\t\t\t\tonlyScrollIfNeeded: true\n\t\t\t\t});\n\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t_this2.scrollingIntoView = false;\n\t\t\t\t}, 100);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Component unmount method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'componentWillUnmount',\n\t\tvalue: function componentWillUnmount() {\n\t\t\tdelete this.suggestionsRequest;\n\t\t}\n\n\t\t/**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\n\t}, {\n\t\tkey: 'bindSuggestionNode',\n\t\tvalue: function bindSuggestionNode(index) {\n\t\t\tvar _this3 = this;\n\n\t\t\treturn function (ref) {\n\t\t\t\t_this3.suggestionNodes[index] = ref;\n\t\t\t};\n\t\t}\n\n\t\t/**\n * Callback to show suggestions based on value inputted on search field.\n * \n * @since 3.6\n * \n * @param {*} value \n */\n\n\t}, {\n\t\tkey: 'updateSuggestions',\n\t\tvalue: function updateSuggestions(value) {\n\t\t\tvar _this4 = this;\n\n\t\t\t// Show the suggestions after typing at least 2 characters\n\t\t\t// and also for URLs\n\t\t\tif (value.length < 2 || /^https?:/.test(value)) {\n\t\t\t\tthis.setState({\n\t\t\t\t\tshowSuggestions: false,\n\t\t\t\t\tselectedSuggestion: null,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.setState({\n\t\t\t\tshowSuggestions: true,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: true\n\t\t\t});\n\n\t\t\tvar formData = new FormData();\n\t\t\tformData.append(\"action\", \"search_affiliate_links_query\");\n\t\t\tformData.append(\"keyword\", value);\n\t\t\tformData.append(\"paged\", 1);\n\t\t\tformData.append(\"gutenberg\", true);\n\n\t\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\n\t\t\t// to filter results with category value. This is to prepare next update to add category filter.\n\t\t\tvar request = fetch(ajaxurl, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: formData\n\t\t\t});\n\n\t\t\trequest.then(function (response) {\n\t\t\t\treturn response.json();\n\t\t\t}).then(function (response) {\n\n\t\t\t\tif (!response.affiliate_links) return;\n\n\t\t\t\tvar posts = response.affiliate_links;\n\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif (_this4.suggestionsRequest !== request) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t_this4.setState({\n\t\t\t\t\tposts: posts,\n\t\t\t\t\tloading: false\n\t\t\t\t});\n\n\t\t\t\tif (!!posts.length) {\n\t\t\t\t\t_this4.props.debouncedSpeak(sprintf(_n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', posts.length), posts.length), 'assertive');\n\t\t\t\t} else {\n\t\t\t\t\t_this4.props.debouncedSpeak(__('No results.'), 'assertive');\n\t\t\t\t}\n\t\t\t}).catch(function () {\n\t\t\t\tif (_this4.suggestionsRequest === request) {\n\t\t\t\t\t_this4.setState({\n\t\t\t\t\t\tloading: false\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.suggestionsRequest = request;\n\t\t}\n\n\t\t/**\n * Search input value change event callback method.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'onChange',\n\t\tvalue: function onChange(event) {\n\t\t\tthis.props.resetInvalidLink();\n\t\t\tvar inputValue = event.target.value;\n\t\t\tthis.props.onChange(inputValue);\n\t\t\tthis.updateSuggestions(inputValue);\n\t\t}\n\n\t\t/**\n * Keydown event callback. Handles selecting result via keyboard.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\n\t}, {\n\t\tkey: 'onKeyDown',\n\t\tvalue: function onKeyDown(event) {\n\t\t\tvar _state2 = this.state,\n\t\t\t showSuggestions = _state2.showSuggestions,\n\t\t\t selectedSuggestion = _state2.selectedSuggestion,\n\t\t\t posts = _state2.posts,\n\t\t\t loading = _state2.loading;\n\t\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n\t\t\t// We shouldn't preventDefault to allow block arrow keys navigation\n\n\t\t\tif (!showSuggestions || !posts.length || loading) {\n\t\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\n\t\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n\t\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\n\t\t\t\t// only happens if the caret is not in the first or last position in the text input.\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n\t\t\t\tswitch (event.keyCode) {\n\t\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\n\t\t\t\t\t// position.\n\t\t\t\t\tcase UP:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (0 !== event.target.selectionStart) {\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t\t\t// Set the input caret to position 0\n\t\t\t\t\t\t\t\tevent.target.setSelectionRange(0, 0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\n\t\t\t\t\t// last position.\n\t\t\t\t\tcase DOWN:\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (this.props.value.length !== event.target.selectionStart) {\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t\t\t// Set the input caret to the last position\n\t\t\t\t\t\t\t\tevent.target.setSelectionRange(this.props.value.length, this.props.value.length);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar post = this.state.posts[this.state.selectedSuggestion];\n\n\t\t\tswitch (event.keyCode) {\n\t\t\t\tcase UP:\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tvar previousIndex = !selectedSuggestion ? posts.length - 1 : selectedSuggestion - 1;\n\t\t\t\t\t\tthis.setState({\n\t\t\t\t\t\t\tselectedSuggestion: previousIndex\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase DOWN:\n\t\t\t\t\t{\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tvar nextIndex = selectedSuggestion === null || selectedSuggestion === posts.length - 1 ? 0 : selectedSuggestion + 1;\n\t\t\t\t\t\tthis.setState({\n\t\t\t\t\t\t\tselectedSuggestion: nextIndex\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase TAB:\n\t\t\t\t\t{\n\t\t\t\t\t\tif (this.state.selectedSuggestion !== null) {\n\t\t\t\t\t\t\tthis.selectLink(post);\n\t\t\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\n\t\t\t\t\t\t\tthis.props.speak(__('Link selected'));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase ENTER:\n\t\t\t\t\t{\n\t\t\t\t\t\tif (this.state.selectedSuggestion !== null) {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tthis.selectLink(post);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: 'selectLink',\n\t\tvalue: function selectLink(post) {\n\t\t\tthis.props.onChange(post.link, post);\n\t\t\tthis.setState({\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tshowSuggestions: false\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\n\t}, {\n\t\tkey: 'handleOnClick',\n\t\tvalue: function handleOnClick(post) {\n\t\t\tthis.selectLink(post);\n\t\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\t\tthis.inputRef.current.focus();\n\t\t}\n\n\t\t/**\n * Component render method.\n * \n * @since 3.6\n */\n\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar _props = this.props,\n\t\t\t _props$value = _props.value,\n\t\t\t value = _props$value === undefined ? '' : _props$value,\n\t\t\t _props$autoFocus = _props.autoFocus,\n\t\t\t autoFocus = _props$autoFocus === undefined ? true : _props$autoFocus,\n\t\t\t instanceId = _props.instanceId,\n\t\t\t invalidLink = _props.invalidLink;\n\t\t\tvar _state3 = this.state,\n\t\t\t showSuggestions = _state3.showSuggestions,\n\t\t\t posts = _state3.posts,\n\t\t\t selectedSuggestion = _state3.selectedSuggestion,\n\t\t\t loading = _state3.loading;\n\t\t\t/* eslint-disable jsx-a11y/no-autofocus */\n\n\t\t\treturn wp.element.createElement(\n\t\t\t\t'div',\n\t\t\t\t{ className: 'editor-url-input block-editor-url-input' },\n\t\t\t\twp.element.createElement('input', {\n\t\t\t\t\tautoFocus: autoFocus,\n\t\t\t\t\ttype: 'text',\n\t\t\t\t\t'aria-label': __('URL'),\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalue: value,\n\t\t\t\t\tonChange: this.onChange,\n\t\t\t\t\tonInput: stopEventPropagation,\n\t\t\t\t\tplaceholder: __('Paste URL or type to search'),\n\t\t\t\t\tonKeyDown: this.onKeyDown,\n\t\t\t\t\trole: 'combobox',\n\t\t\t\t\t'aria-expanded': showSuggestions,\n\t\t\t\t\t'aria-autocomplete': 'list',\n\t\t\t\t\t'aria-owns': 'editor-url-input-suggestions-' + instanceId,\n\t\t\t\t\t'aria-activedescendant': selectedSuggestion !== null ? 'editor-url-input-suggestion-' + instanceId + '-' + selectedSuggestion : undefined,\n\t\t\t\t\tref: this.inputRef\n\t\t\t\t}),\n\t\t\t\tloading && wp.element.createElement(Spinner, null),\n\t\t\t\tshowSuggestions && !!posts.length && !invalidLink && wp.element.createElement(\n\t\t\t\t\tPopover,\n\t\t\t\t\t{ position: 'bottom', noArrow: true, focusOnMount: false },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t'div',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tclassName: 'editor-url-input__suggestions block-editor-url-input__suggestions',\n\t\t\t\t\t\t\tid: 'editor-url-input-suggestions-' + instanceId,\n\t\t\t\t\t\t\tref: this.autocompleteRef,\n\t\t\t\t\t\t\trole: 'listbox'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tposts.map(function (post, index) {\n\t\t\t\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t\t\t\t'button',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tkey: post.id,\n\t\t\t\t\t\t\t\t\trole: 'option',\n\t\t\t\t\t\t\t\t\ttabIndex: '-1',\n\t\t\t\t\t\t\t\t\tid: 'block-editor-url-input-suggestion-' + instanceId + '-' + index,\n\t\t\t\t\t\t\t\t\tref: _this5.bindSuggestionNode(index),\n\t\t\t\t\t\t\t\t\tclassName: __WEBPACK_IMPORTED_MODULE_0_classnames___default()('editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tonClick: function onClick() {\n\t\t\t\t\t\t\t\t\t\treturn _this5.handleOnClick(post);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t'aria-selected': index === selectedSuggestion\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tpost.title || __('(no title)')\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t\t/* eslint-enable jsx-a11y/no-autofocus */\n\t\t}\n\t}]);\n\n\treturn ThirstyURLInput;\n}(Component);\n\n/* harmony default export */ __webpack_exports__[\"a\"] = (withSpokenMessages(withInstanceId(ThirstyURLInput)));\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(15);\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar util = __webpack_require__(16);\n\nfunction scrollIntoView(elem, container, config) {\n config = config || {};\n // document 归一化到 window\n if (container.nodeType === 9) {\n container = util.getWindow(container);\n }\n\n var allowHorizontalScroll = config.allowHorizontalScroll;\n var onlyScrollIfNeeded = config.onlyScrollIfNeeded;\n var alignWithTop = config.alignWithTop;\n var alignWithLeft = config.alignWithLeft;\n var offsetTop = config.offsetTop || 0;\n var offsetLeft = config.offsetLeft || 0;\n var offsetBottom = config.offsetBottom || 0;\n var offsetRight = config.offsetRight || 0;\n\n allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;\n\n var isWin = util.isWindow(container);\n var elemOffset = util.offset(elem);\n var eh = util.outerHeight(elem);\n var ew = util.outerWidth(elem);\n var containerOffset = undefined;\n var ch = undefined;\n var cw = undefined;\n var containerScroll = undefined;\n var diffTop = undefined;\n var diffBottom = undefined;\n var win = undefined;\n var winScroll = undefined;\n var ww = undefined;\n var wh = undefined;\n\n if (isWin) {\n win = container;\n wh = util.height(win);\n ww = util.width(win);\n winScroll = {\n left: util.scrollLeft(win),\n top: util.scrollTop(win)\n };\n // elem 相对 container 可视视窗的距离\n diffTop = {\n left: elemOffset.left - winScroll.left - offsetLeft,\n top: elemOffset.top - winScroll.top - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,\n top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom\n };\n containerScroll = winScroll;\n } else {\n containerOffset = util.offset(container);\n ch = container.clientHeight;\n cw = container.clientWidth;\n containerScroll = {\n left: container.scrollLeft,\n top: container.scrollTop\n };\n // elem 相对 container 可视视窗的距离\n // 注意边框, offset 是边框到根节点\n diffTop = {\n left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,\n top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,\n top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom\n };\n }\n\n if (diffTop.top < 0 || diffBottom.top > 0) {\n // 强制向上\n if (alignWithTop === true) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else if (alignWithTop === false) {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n } else {\n // 自动调整\n if (diffTop.top < 0) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;\n if (alignWithTop) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n }\n\n if (allowHorizontalScroll) {\n if (diffTop.left < 0 || diffBottom.left > 0) {\n // 强制向上\n if (alignWithLeft === true) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else if (alignWithLeft === false) {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n } else {\n // 自动调整\n if (diffTop.left < 0) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;\n if (alignWithLeft) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n }\n }\n}\n\nmodule.exports = scrollIntoView;\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nvar RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nfunction getClientPosition(elem) {\n var box = undefined;\n var x = undefined;\n var y = undefined;\n var doc = elem.ownerDocument;\n var body = doc.body;\n var docElem = doc && doc.documentElement;\n // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式\n box = elem.getBoundingClientRect();\n\n // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop\n // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确\n // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin\n\n x = box.left;\n y = box.top;\n\n // In IE, most of the time, 2 extra pixels are added to the top and left\n // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and\n // IE6 standards mode, this border can be overridden by setting the\n // document element's border to zero -- thus, we cannot rely on the\n // offset always being 2 pixels.\n\n // In quirks mode, the offset can be determined by querying the body's\n // clientLeft/clientTop, but in standards mode, it is found by querying\n // the document element's clientLeft/clientTop. Since we already called\n // getClientBoundingRect we have already forced a reflow, so it is not\n // too expensive just to query them all.\n\n // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的\n // 窗口边框标准是设 documentElement ,quirks 时设置 body\n // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去\n // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置\n // 标准 ie 下 docElem.clientTop 就是 border-top\n // ie7 html 即窗口边框改变不了。永远为 2\n // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0\n\n x -= docElem.clientLeft || body.clientLeft || 0;\n y -= docElem.clientTop || body.clientTop || 0;\n\n return {\n left: x,\n top: y\n };\n}\n\nfunction getScroll(w, top) {\n var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];\n var method = 'scroll' + (top ? 'Top' : 'Left');\n if (typeof ret !== 'number') {\n var d = w.document;\n // ie6,7,8 standard mode\n ret = d.documentElement[method];\n if (typeof ret !== 'number') {\n // quirks mode\n ret = d.body[method];\n }\n }\n return ret;\n}\n\nfunction getScrollLeft(w) {\n return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n var pos = getClientPosition(el);\n var doc = el.ownerDocument;\n var w = doc.defaultView || doc.parentWindow;\n pos.left += getScrollLeft(w);\n pos.top += getScrollTop(w);\n return pos;\n}\nfunction _getComputedStyle(elem, name, computedStyle_) {\n var val = '';\n var d = elem.ownerDocument;\n var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);\n\n // https://github.com/kissyteam/kissy/issues/61\n if (computedStyle) {\n val = computedStyle.getPropertyValue(name) || computedStyle[name];\n }\n\n return val;\n}\n\nvar _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');\nvar RE_POS = /^(top|right|bottom|left)$/;\nvar CURRENT_STYLE = 'currentStyle';\nvar RUNTIME_STYLE = 'runtimeStyle';\nvar LEFT = 'left';\nvar PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n // currentStyle maybe null\n // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];\n\n // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值\n // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n // 在 ie 下不对,需要直接用 offset 方式\n // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了\n\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // exclude left right for relativity\n if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n // Remember the original values\n var style = elem.style;\n var left = style[LEFT];\n var rsLeft = elem[RUNTIME_STYLE][LEFT];\n\n // prevent flashing of content\n elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];\n\n // Put in the new values to get a computed value out\n style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;\n ret = style.pixelLeft + PX;\n\n // Revert the changed values\n style[LEFT] = left;\n\n elem[RUNTIME_STYLE][LEFT] = rsLeft;\n }\n return ret === '' ? 'auto' : ret;\n}\n\nvar getComputedStyleX = undefined;\nif (typeof window !== 'undefined') {\n getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;\n}\n\nfunction each(arr, fn) {\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i]);\n }\n}\n\nfunction isBorderBoxFn(elem) {\n return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nvar BOX_MODELS = ['margin', 'border', 'padding'];\nvar CONTENT_INDEX = -1;\nvar PADDING_INDEX = 2;\nvar BORDER_INDEX = 1;\nvar MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n var old = {};\n var style = elem.style;\n var name = undefined;\n\n // Remember the old values, and insert the new ones\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n old[name] = style[name];\n style[name] = options[name];\n }\n }\n\n callback.call(elem);\n\n // Revert the old values\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n style[name] = old[name];\n }\n }\n}\n\nfunction getPBMWidth(elem, props, which) {\n var value = 0;\n var prop = undefined;\n var j = undefined;\n var i = undefined;\n for (j = 0; j < props.length; j++) {\n prop = props[j];\n if (prop) {\n for (i = 0; i < which.length; i++) {\n var cssProp = undefined;\n if (prop === 'border') {\n cssProp = prop + which[i] + 'Width';\n } else {\n cssProp = prop + which[i];\n }\n value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n }\n }\n }\n return value;\n}\n\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\nfunction isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}\n\nvar domUtils = {};\n\neach(['Width', 'Height'], function (name) {\n domUtils['doc' + name] = function (refWin) {\n var d = refWin.document;\n return Math.max(\n // firefox chrome documentElement.scrollHeight< body.scrollHeight\n // ie standard mode : documentElement.scrollHeight> body.scrollHeight\n d.documentElement['scroll' + name],\n // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?\n d.body['scroll' + name], domUtils['viewport' + name](d));\n };\n\n domUtils['viewport' + name] = function (win) {\n // pc browser includes scrollbar in window.innerWidth\n var prop = 'client' + name;\n var doc = win.document;\n var body = doc.body;\n var documentElement = doc.documentElement;\n var documentElementProp = documentElement[prop];\n // 标准模式取 documentElement\n // backcompat 取 body\n return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;\n };\n});\n\n/*\n 得到元素的大小信息\n @param elem\n @param name\n @param {String} [extra] 'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\nfunction getWH(elem, name, extra) {\n if (isWindow(elem)) {\n return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);\n } else if (elem.nodeType === 9) {\n return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);\n }\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem, computedStyle);\n var cssBoxValue = 0;\n if (borderBoxValue == null || borderBoxValue <= 0) {\n borderBoxValue = undefined;\n // Fall back to computed then un computed css if necessary\n cssBoxValue = getComputedStyleX(elem, name);\n if (cssBoxValue == null || Number(cssBoxValue) < 0) {\n cssBoxValue = elem.style[name] || 0;\n }\n // Normalize '', auto, and prepare for extra\n cssBoxValue = parseFloat(cssBoxValue) || 0;\n }\n if (extra === undefined) {\n extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n }\n var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;\n var val = borderBoxValue || cssBoxValue;\n if (extra === CONTENT_INDEX) {\n if (borderBoxValueOrIsBorderBox) {\n return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);\n }\n return cssBoxValue;\n }\n if (borderBoxValueOrIsBorderBox) {\n var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);\n return val + (extra === BORDER_INDEX ? 0 : padding);\n }\n return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);\n}\n\nvar cssShow = {\n position: 'absolute',\n visibility: 'hidden',\n display: 'block'\n};\n\n// fix #119 : https://github.com/kissyteam/kissy/issues/119\nfunction getWHIgnoreDisplay(elem) {\n var val = undefined;\n var args = arguments;\n // in case elem is window\n // elem.offsetWidth === undefined\n if (elem.offsetWidth !== 0) {\n val = getWH.apply(undefined, args);\n } else {\n swap(elem, cssShow, function () {\n val = getWH.apply(undefined, args);\n });\n }\n return val;\n}\n\nfunction css(el, name, v) {\n var value = v;\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {\n for (var i in name) {\n if (name.hasOwnProperty(i)) {\n css(el, i, name[i]);\n }\n }\n return undefined;\n }\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value += 'px';\n }\n el.style[name] = value;\n return undefined;\n }\n return getComputedStyleX(el, name);\n}\n\neach(['width', 'height'], function (name) {\n var first = name.charAt(0).toUpperCase() + name.slice(1);\n domUtils['outer' + first] = function (el, includeMargin) {\n return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);\n };\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n domUtils[name] = function (elem, val) {\n if (val !== undefined) {\n if (elem) {\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem);\n if (isBorderBox) {\n val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);\n }\n return css(elem, name, val);\n }\n return undefined;\n }\n return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n };\n});\n\n// 设置 elem 相对 elem.ownerDocument 的坐标\nfunction setOffset(elem, offset) {\n // set position first, in-case top/left are set even on static elem\n if (css(elem, 'position') === 'static') {\n elem.style.position = 'relative';\n }\n\n var old = getOffset(elem);\n var ret = {};\n var current = undefined;\n var key = undefined;\n\n for (key in offset) {\n if (offset.hasOwnProperty(key)) {\n current = parseFloat(css(elem, key)) || 0;\n ret[key] = current + offset[key] - old[key];\n }\n }\n css(elem, ret);\n}\n\nmodule.exports = _extends({\n getWindow: function getWindow(node) {\n var doc = node.ownerDocument || node;\n return doc.defaultView || doc.parentWindow;\n },\n offset: function offset(el, value) {\n if (typeof value !== 'undefined') {\n setOffset(el, value);\n } else {\n return getOffset(el);\n }\n },\n\n isWindow: isWindow,\n each: each,\n css: css,\n clone: function clone(obj) {\n var ret = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret[i] = obj[i];\n }\n }\n var overflow = obj.overflow;\n if (overflow) {\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret.overflow[i] = obj.overflow[i];\n }\n }\n }\n return ret;\n },\n scrollLeft: function scrollLeft(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollLeft(w);\n }\n window.scrollTo(v, getScrollTop(w));\n } else {\n if (v === undefined) {\n return w.scrollLeft;\n }\n w.scrollLeft = v;\n }\n },\n scrollTop: function scrollTop(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollTop(w);\n }\n window.scrollTo(getScrollLeft(w), v);\n } else {\n if (v === undefined) {\n return w.scrollTop;\n }\n w.scrollTop = v;\n }\n },\n\n viewportWidth: 0,\n viewportHeight: 0\n}, domUtils);\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// gutenberg-support.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 0398ccf6c6e68ef11d5b","/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/classnames/index.js\n// module id = 0\n// module chunks = 0","import registerBlocks from \"./blocks\";\nimport registerFormats from \"./formats\";\n\nimport \"./assets/styles/index.scss\";\n\nregisterBlocks();\nregisterFormats();\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","import * as taimage from \"./ta-image\";\n\nconst { registerBlockType } = wp.blocks;\n\n/**\n * Register gutenberg blocks.\n * \n * @since 3.6\n */\nexport default function registerBlocks() {\n\n [\n taimage\n ].forEach( ( block ) => {\n if ( ! block ) return;\n\n const { name , settings } = block;\n registerBlockType( name , settings );\n } );\n}\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/index.js","import classnames from \"classnames\";\n\nconst { Fragment } = wp.element;\nconst { __ } = wp.i18n;\nconst { getPhrasingContentSchema } = wp.dom;\nconst { RichText } = wp.blockEditor;\nconst { Path , SVG } = wp.components;\n\nimport edit from \"./edit\";\n\nexport const name = 'ta/image';\n\nconst blockAttributes = {\n\turl: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'src',\n\t},\n\talt: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'img',\n\t\tattribute: 'alt',\n\t\tdefault: '',\n\t},\n\tcaption: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'figcaption',\n\t},\n\tid: {\n\t\ttype: 'number',\n\t},\n\talign: {\n\t\ttype: 'string',\n\t},\n\twidth: {\n\t\ttype: 'number',\n\t},\n\theight: {\n\t\ttype: 'number',\n\t},\n\tlinkid: {\n\t\ttype: 'number',\n\t},\n\thref: {\n\t\ttype: 'string',\n\t\tsource: 'attribute',\n\t\tselector: 'ta',\n\t\tattribute: 'href'\n\t},\n\taffiliateLink: {\n\t\ttype: 'object'\n\t}\n};\n\nconst imageSchema = {\n\timg: {\n\t\tattributes: [ 'src', 'alt' ],\n\t\tclasses: [ 'alignleft', 'aligncenter', 'alignright', 'alignnone', /^wp-image-\\d+$/ ],\n\t},\n};\n\nconst schema = {\n\tfigure: {\n\t\trequire: [ 'ta' , 'img' ],\n\t\tchildren: {\n\t\t\tta: {\n\t\t\t\tattributes: [ 'href', 'linkid' ],\n\t\t\t\tchildren: imageSchema,\n\t\t\t},\n\t\t\tfigcaption: {\n\t\t\t\tchildren: getPhrasingContentSchema(),\n\t\t\t},\n\t\t},\n\t},\n};\n\nfunction getFirstAnchorAttributeFormHTML( html, attributeName ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\n\tbody.innerHTML = html;\n\n\tconst { firstElementChild } = body;\n\n\tif (\n\t\tfirstElementChild &&\n\t\tfirstElementChild.nodeName === 'A'\n\t) {\n\t\treturn firstElementChild.getAttribute( attributeName ) || undefined;\n\t}\n}\n\nexport const settings = {\n\ttitle: __( 'ThirstyAffiliates Image' ),\n\n\tdescription: __( 'Insert an image with an affiliate link to make a visual statement.' ),\n\n\ticon: <SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><Path d=\"M0,0h24v24H0V0z\" fill=\"none\" /><Path d=\"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" /><Path d=\"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" /></SVG>,\n\n\tcategory: 'common',\n\n\tkeywords: [\n\t\t'img', // \"img\" is not translated as it is intended to reflect the HTML <img> tag.\n\t\t__( 'photo' ),\n\t\t__( 'affiliate' )\n\t],\n\n\tattributes: blockAttributes,\n\n\tgetEditWrapperProps( attributes ) {\n\t\tconst { align, width } = attributes;\n\t\tif ( 'left' === align || 'center' === align || 'right' === align || 'wide' === align || 'full' === align ) {\n\t\t\treturn { 'data-align': align, 'data-resized': !! width };\n\t\t}\n\t},\n\n\tedit,\n\n\tsave( { attributes } ) {\n\t\tconst {\n\t\t\turl,\n\t\t\talt,\n\t\t\tcaption,\n\t\t\talign,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tid,\n\t\t\tlinkid,\n\t\t\thref\n\t\t} = attributes;\n\n\t\tconst classes = classnames( {\n\t\t\t[ `align${ align }` ]: align,\n\t\t\t'is-resized': width || height,\n\t\t} );\n\n\t\tconst image = (\n\t\t\t<img\n\t\t\t\tsrc={ url }\n\t\t\t\talt={ alt }\n\t\t\t\tclassName={ id ? `wp-image-${ id }` : null }\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t/>\n\t\t);\n\n\t\tconst figure = (\n\t\t\t<Fragment>\n\t\t\t\t<ta linkid={ linkid } href={ href }>\n\t\t\t\t{ image }\n\t\t\t\t</ta>\n\t\t\t\t<RichText.Content tagName=\"figcaption\" value={ caption } />\n\t\t\t</Fragment>\n\t\t);\n\n\t\tif ( 'left' === align || 'right' === align || 'center' === align ) {\n\t\t\treturn (\n\t\t\t\t<div className='wp-block-image'>\n\t\t\t\t\t<figure className={ classes }>\n\t\t\t\t\t\t{ figure }\n\t\t\t\t\t</figure>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<figure className={ `wp-block-image ${classes}` }>\n\t\t\t\t{ figure }\n\t\t\t</figure>\n\t\t);\n\t}\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/index.js","import classnames from \"classnames\";\n\nconst { get , isEmpty , map , last , pick , compact } = lodash;\nconst { getPath } = wp.url;\nconst { __, sprintf } = wp.i18n;\nconst { Component, Fragment , createRef } = wp.element;\nconst { getBlobByURL, revokeBlobURL, isBlobURL } = wp.blob;\nconst { Placeholder , Button , ButtonGroup , IconButton , PanelBody , ResizableBox , SelectControl , Spinner , TextControl , TextareaControl , Toolbar , withNotices } = wp.components;\nconst { withSelect } = wp.data;\nconst { mediaUpload } = wp.editor;\nconst { InspectorControls , BlockControls , RichText , BlockAlignmentToolbar } = wp.blockEditor;\nconst { withViewportMatch } = wp.viewport;\nconst { compose } = wp.compose;\n\nimport { createUpgradedEmbedBlock } from \"./util\";\nimport ImageSize from \"./image-size\";\nimport ThirstyURLInput from './search-input';\n\n/**\n * Module constants\n */\nconst MIN_SIZE = 20;\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst NEW_TAB_REL = 'noreferrer noopener';\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\nexport const pickRelevantMediaFiles = ( image ) => {\n\tconst imageProps = pick( image, [ 'alt', 'id', 'link', 'caption' ] );\n\timageProps.url = get( image, [ 'sizes', 'large', 'url' ] ) || get( image, [ 'media_details', 'sizes', 'large', 'source_url' ] ) || image.url;\n\treturn imageProps;\n};\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily\n * while the image is being uploaded and will not have an id yet allocated.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the URL a Blob URL\n */\nconst isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no id\n * and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nconst isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\n\nclass ImageEdit extends Component {\n\tconstructor( { attributes } ) {\n\t\tsuper( ...arguments );\n\t\tthis.updateAlt = this.updateAlt.bind( this );\n\t\tthis.updateAlignment = this.updateAlignment.bind( this );\n\t\tthis.onFocusCaption = this.onFocusCaption.bind( this );\n\t\tthis.onImageClick = this.onImageClick.bind( this );\n\t\tthis.onSelectImage = this.onSelectImage.bind( this );\n\t\tthis.updateImageURL = this.updateImageURL.bind( this );\n\t\tthis.updateWidth = this.updateWidth.bind( this );\n\t\tthis.updateHeight = this.updateHeight.bind( this );\n\t\tthis.updateDimensions = this.updateDimensions.bind( this );\n\t\tthis.getFilename = this.getFilename.bind( this );\n\t\tthis.toggleIsEditing = this.toggleIsEditing.bind( this );\n\t\tthis.onImageError = this.onImageError.bind( this );\n\t\tthis.onChangeInputValue = this.onChangeInputValue.bind( this );\n\t\tthis.autocompleteRef = createRef();\n\t\tthis.resetInvalidLink = this.resetInvalidLink.bind( this );\n\t\tthis.updateImageSelection = this.updateImageSelection.bind( this );\n\t\tthis.onSelectAffiliateImage = this.onSelectAffiliateImage.bind( this );\n\t\tthis.editAFfiliateImage = this.editAFfiliateImage.bind( this );\n\n\t\tthis.state = {\n\t\t\tcaptionFocused: false,\n\t\t\tisEditing: ! attributes.url,\n\t\t\tinputValue : '',\n\t\t\tlinkid : 0,\n\t\t\tpost : null,\n\t\t\tshowSuggestions : false,\n\t\t\timageSelection : [],\n\t\t\taffiliateLink : null\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { attributes, setAttributes, noticeOperations } = this.props;\n\t\tconst { id, url = '' } = attributes;\n\n\t\tif ( isTemporaryImage( id, url ) ) {\n\t\t\tconst file = getBlobByURL( url );\n\n\t\t\tif ( file ) {\n\t\t\t\tmediaUpload( {\n\t\t\t\t\tfilesList: [ file ],\n\t\t\t\t\tonFileChange: ( [ image ] ) => {\n\t\t\t\t\t\tsetAttributes( pickRelevantMediaFiles( image ) );\n\t\t\t\t\t},\n\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t\tonError: ( message ) => {\n\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\tthis.setState( { isEditing: true } );\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { id: prevID, url: prevURL = '' } = prevProps.attributes;\n\t\tconst { id, url = '' } = this.props.attributes;\n\n\t\tif ( isTemporaryImage( prevID, prevURL ) && ! isTemporaryImage( id, url ) ) {\n\t\t\trevokeBlobURL( url );\n\t\t}\n\n\t\tif ( ! this.props.isSelected && prevProps.isSelected && this.state.captionFocused ) {\n\t\t\tthis.setState( {\n\t\t\t\tcaptionFocused: false,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonSelectImage( media ) {\n\n\t\tif ( ! media || ! media.url ) {\n\t\t\tthis.props.setAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\talt: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: undefined\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\tconst { affiliateLink } = this.state;\n\n\t\tthis.setState( {\n\t\t\tisEditing: false,\n\t\t} );\n\n\t\tthis.props.setAttributes( {\n\t\t\t...pickRelevantMediaFiles( media ),\n\t\t\tlinkid: affiliateLink.id,\n\t\t\thref: affiliateLink.link,\n\t\t\taffiliateLink : affiliateLink,\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t} );\n\t}\n\n\tonImageError( url ) {\n\t\t// Check if there's an embed block that handles this URL.\n\t\tconst embedBlock = createUpgradedEmbedBlock(\n\t\t\t{ attributes: { url } }\n\t\t);\n\t\tif ( undefined !== embedBlock ) {\n\t\t\tthis.props.onReplace( embedBlock );\n\t\t}\n\t}\n\n\tonFocusCaption() {\n\t\tif ( ! this.state.captionFocused ) {\n\t\t\tthis.setState( {\n\t\t\t\tcaptionFocused: true,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonImageClick() {\n\t\tif ( this.state.captionFocused ) {\n\t\t\tthis.setState( {\n\t\t\t\tcaptionFocused: false,\n\t\t\t} );\n\t\t}\n\t}\n\n\tupdateAlt( newAlt ) {\n\t\tthis.props.setAttributes( { alt: newAlt } );\n\t}\n\n\tupdateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].indexOf( nextAlign ) !== -1 ?\n\t\t\t{ width: undefined, height: undefined } :\n\t\t\t{};\n\t\tthis.props.setAttributes( { ...extraUpdatedAttributes, align: nextAlign } );\n\t}\n\n\tupdateImageURL( url ) {\n\t\tthis.props.setAttributes( { url, width: undefined, height: undefined } );\n\t}\n\n\tupdateWidth( width ) {\n\t\tthis.props.setAttributes( { width: parseInt( width, 10 ) } );\n\t}\n\n\tupdateHeight( height ) {\n\t\tthis.props.setAttributes( { height: parseInt( height, 10 ) } );\n\t}\n\n\tupdateDimensions( width = undefined, height = undefined ) {\n\t\treturn () => {\n\t\t\tthis.props.setAttributes( { width, height } );\n\t\t};\n\t}\n\n\tgetFilename( url ) {\n\t\tconst path = getPath( url );\n\t\tif ( path ) {\n\t\t\treturn last( path.split( '/' ) );\n\t\t}\n\t}\n\n\tgetLinkDestinationOptions() {\n\t\treturn [\n\t\t\t{ value: LINK_DESTINATION_NONE, label: __( 'None' ) },\n\t\t\t{ value: LINK_DESTINATION_MEDIA, label: __( 'Media File' ) },\n\t\t\t{ value: LINK_DESTINATION_ATTACHMENT, label: __( 'Attachment Page' ) },\n\t\t\t{ value: LINK_DESTINATION_CUSTOM, label: __( 'Custom URL' ) },\n\t\t];\n\t}\n\n\ttoggleIsEditing() {\n\t\tthis.setState( {\n\t\t\tisEditing: ! this.state.isEditing,\n\t\t} );\n\t}\n\n\tgetImageSizeOptions() {\n\t\tconst { imageSizes, image } = this.props;\n\t\treturn compact( map( imageSizes, ( { name, slug } ) => {\n\t\t\tconst sizeUrl = get( image, [ 'media_details', 'sizes', slug, 'source_url' ] );\n\t\t\tif ( ! sizeUrl ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tvalue: sizeUrl,\n\t\t\t\tlabel: name,\n\t\t\t};\n\t\t} ) );\n\t}\n\n\tonChangeInputValue( inputValue , post = null ) {\n\t\tconst linkid = post ? post.id : 0;\n\t\tthis.setState( { inputValue , linkid , post } );\n\t}\n\n\tresetInvalidLink() {\n\t\tthis.setState( { invalidLink : false } );\n\t}\n\n\tupdateImageSelection( imageSelection , affiliateLink ) {\n\t\tthis.setState({\n\t\t\timageSelection,\n\t\t\taffiliateLink\n\t\t});\n\t}\n\n\tonSelectAffiliateImage( image ) {\n\n\t\tif ( isExternalImage( image.id, image.src ) ) {\n\t\t\timage.url = image.src;\n\t\t\tthis.onSelectImage( image );\n\t\t} else {\n\t\t\tconst request = wp.apiFetch( {\n\t\t\t\tpath: wp.url.addQueryArgs( '/wp/v2/media/' + image.id , {\n\t\t\t\t\tcontext: 'edit',\n\t\t\t\t\t_locale: 'user'\n\t\t\t\t} ),\n\t\t\t} );\n\n\t\t\trequest.then( (media) => {\n\t\t\t\tmedia.url = media.source_url;\n\t\t\t\tthis.onSelectImage( media );\n\t\t\t} );\n\t\t}\n\t}\n\n\teditAFfiliateImage() {\n\n\t\tconst { attributes } = this.props;\n\t\tconst { affiliateLink } = attributes;\n\n\t\tthis.setState({\n\t\t\tisEditing : true,\n\t\t\timageSelection : affiliateLink.images,\n\t\t\taffiliateLink\n\t\t});\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tisEditing,\n\t\t\timageSelection,\n\t\t\taffiliateLink,\n\t\t} = this.state;\n\t\tconst {\n\t\t\tattributes,\n\t\t\tsetAttributes,\n\t\t\tisLargeViewport,\n\t\t\tisSelected,\n\t\t\tclassName,\n\t\t\tmaxWidth,\n\t\t\ttoggleSelection,\n\t\t\tisRTL,\n\t\t} = this.props;\n\t\tconst {\n\t\t\turl,\n\t\t\talt,\n\t\t\tcaption,\n\t\t\talign,\n\t\t\tlinkDestination,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tlinkid,\n\t\t\thref\n\t\t} = attributes;\n\t\tconst toolbarEditButton = (\n\t\t\t<Toolbar label={ __( 'ThirstyAffiliates Image Settings' ) }>\n\t\t\t\t<IconButton\n\t\t\t\t\tclassName=\"ta-edit-image-button components-icon-button components-toolbar__control\"\n\t\t\t\t\tlabel={ __( 'Edit ThirstyAffiliates Image' ) }\n\t\t\t\t\ticon=\"edit\"\n\t\t\t\t\tonClick={ this.editAFfiliateImage }\n\t\t\t\t/>\n\t\t\t</Toolbar>\n\t\t);\n\n\t\tconst controls = (\n\t\t\t<BlockControls>\n\t\t\t\t<BlockAlignmentToolbar\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ this.updateAlignment }\n\t\t\t\t/>\n\t\t\t\t{ toolbarEditButton }\n\t\t\t</BlockControls>\n\t\t);\n\n\t\tif ( isEditing ) {\n\t\t\treturn (\n\t\t\t\t<Fragment>\n\t\t\t\t\t{ controls }\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ \"format-image\" }\n\t\t\t\t\t\tlabel={ __( \"ThirstyAffiliates Image\" ) }\n\t\t\t\t\t\tinstructions={ __( \"Search for an affiliate link and select image to insert.\" ) }\n\t\t\t\t\t>\n\n\t\t\t\t\t\t<ThirstyURLInput\n\t\t\t\t\t\t\tupdateImageSelection={ this.updateImageSelection }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t{ !! imageSelection.length &&\n\t\t\t\t\t\t\t<div className=\"ta-image-sel-wrap\">\n\t\t\t\t\t\t\t\t<h3>{ `${affiliateLink.title} ${ __( 'attached images:' ) }` }</h3>\n\t\t\t\t\t\t\t\t<div className=\"ta-image-selection\">\n\t\t\t\t\t\t\t\t\t{ imageSelection.map( ( image , index ) => (\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => this.onSelectAffiliateImage( image ) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<img src={ image.src } />\n\t\t\t\t\t\t\t\t\t\t</button>\n\n\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t</Placeholder>\n\t\t\t\t</Fragment>\n\t\t\t);\n\t\t}\n\n\t\tconst classes = classnames( className, {\n\t\t\t'wp-block-image' : true,\n\t\t\t'is-transient': isBlobURL( url ),\n\t\t\t'is-resized': !! width || !! height,\n\t\t\t'is-focused': isSelected,\n\t\t} );\n\n\t\tconst isResizable = [ 'wide', 'full' ].indexOf( align ) === -1 && isLargeViewport;\n\t\tconst imageSizeOptions = this.getImageSizeOptions();\n\n\t\tconst getInspectorControls = ( imageWidth, imageHeight ) => (\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Image Settings' ) }>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tlabel={ __( 'Alt Text (Alternative Text)' ) }\n\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\tonChange={ this.updateAlt }\n\t\t\t\t\t\thelp={ __( 'Alternative text describes your image to people who can’t see it. Add a short description with its key details.' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isEmpty( imageSizeOptions ) && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Image Size' ) }\n\t\t\t\t\t\t\tvalue={ url }\n\t\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\t\tonChange={ this.updateImageURL }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isResizable && (\n\t\t\t\t\t\t<div className=\"block-library-image__dimensions\">\n\t\t\t\t\t\t\t<p className=\"block-library-image__dimensions__row\">\n\t\t\t\t\t\t\t\t{ __( 'Image Dimensions' ) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<div className=\"block-library-image__dimensions__row\">\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-image__dimensions__width\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\t\t\tvalue={ width !== undefined ? width : '' }\n\t\t\t\t\t\t\t\t\tplaceholder={ imageWidth }\n\t\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\t\tonChange={ this.updateWidth }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\t\t\tclassName=\"block-library-image__dimensions__height\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\t\t\t\tvalue={ height !== undefined ? height : '' }\n\t\t\t\t\t\t\t\t\tplaceholder={ imageHeight }\n\t\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\t\tonChange={ this.updateHeight }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"block-library-image__dimensions__row\">\n\t\t\t\t\t\t\t\t<ButtonGroup aria-label={ __( 'Image Size' ) }>\n\t\t\t\t\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( scale ) => {\n\t\t\t\t\t\t\t\t\t\tconst scaledWidth = Math.round( imageWidth * ( scale / 100 ) );\n\t\t\t\t\t\t\t\t\t\tconst scaledHeight = Math.round( imageHeight * ( scale / 100 ) );\n\n\t\t\t\t\t\t\t\t\t\tconst isCurrent = width === scaledWidth && height === scaledHeight;\n\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ scale }\n\t\t\t\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\t\t\t\tisPrimary={ isCurrent }\n\t\t\t\t\t\t\t\t\t\t\t\taria-pressed={ isCurrent }\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ this.updateDimensions( scaledWidth, scaledHeight ) }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ scale }%\n\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\tonClick={ this.updateDimensions() }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t);\n\n\t\t// Disable reason: Each block can be selected by clicking on it\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t{ controls }\n\t\t\t\t<figure className={ classes }>\n\t\t\t\t\t<ImageSize src={ url } dirtynessTrigger={ align }>\n\t\t\t\t\t\t{ ( sizes ) => {\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\timageWidthWithinContainer,\n\t\t\t\t\t\t\t\timageHeightWithinContainer,\n\t\t\t\t\t\t\t\timageWidth,\n\t\t\t\t\t\t\t\timageHeight,\n\t\t\t\t\t\t\t} = sizes;\n\n\t\t\t\t\t\t\tconst filename = this.getFilename( url );\n\t\t\t\t\t\t\tlet defaultedAlt;\n\t\t\t\t\t\t\tif ( alt ) {\n\t\t\t\t\t\t\t\tdefaultedAlt = alt;\n\t\t\t\t\t\t\t} else if ( filename ) {\n\t\t\t\t\t\t\t\tdefaultedAlt = sprintf( __( 'This image has an empty alt attribute; its file name is %s' ), filename );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst img = (\n\t\t\t\t\t\t\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t\t\t\t\t\t\t// should direct focus to block.\n\t\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t<ta linkid={ linkid } href={ href }>\n\t\t\t\t\t\t\t\t\t\t<img src={ url } alt={ defaultedAlt } onClick={ this.onImageClick } onError={ () => this.onImageError( url ) } />\n\t\t\t\t\t\t\t\t\t</ta>\n\t\t\t\t\t\t\t\t\t{ isBlobURL( url ) && <Spinner /> }\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( ! isResizable || ! imageWidthWithinContainer ) {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t{ getInspectorControls( imageWidth, imageHeight ) }\n\t\t\t\t\t\t\t\t\t\t<div style={ { width, height } }>\n\t\t\t\t\t\t\t\t\t\t\t{ img }\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst currentWidth = width || imageWidthWithinContainer;\n\t\t\t\t\t\t\tconst currentHeight = height || imageHeightWithinContainer;\n\n\t\t\t\t\t\t\tconst ratio = imageWidth / imageHeight;\n\t\t\t\t\t\t\tconst minWidth = imageWidth < imageHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\t\t\t\t\t\tconst minHeight = imageHeight < imageWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t\t\t\t\t\t// With the current implementation of ResizableBox, an image needs an explicit pixel value for the max-width.\n\t\t\t\t\t\t\t// In absence of being able to set the content-width, this max-width is currently dictated by the vanilla editor style.\n\t\t\t\t\t\t\t// The following variable adds a buffer to this vanilla style, so 3rd party themes have some wiggleroom.\n\t\t\t\t\t\t\t// This does, in most cases, allow you to scale the image beyond the width of the main column, though not infinitely.\n\t\t\t\t\t\t\t// @todo It would be good to revisit this once a content-width variable becomes available.\n\t\t\t\t\t\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\t\t\t\t\t\t\tlet showRightHandle = false;\n\t\t\t\t\t\t\tlet showLeftHandle = false;\n\n\t\t\t\t\t\t\t/* eslint-disable no-lonely-if */\n\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\t\t\t\t\t\tif ( align === 'center' ) {\n\t\t\t\t\t\t\t\t// When the image is centered, show both handles.\n\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t} else if ( isRTL ) {\n\t\t\t\t\t\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t\t\t\t\t\t// Show the right handle and hide the left handle only when it is aligned left.\n\t\t\t\t\t\t\t\t// Otherwise always show the left handle.\n\t\t\t\t\t\t\t\tif ( align === 'left' ) {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Show the left handle and hide the right handle only when the image is aligned right.\n\t\t\t\t\t\t\t\t// Otherwise always show the right handle.\n\t\t\t\t\t\t\t\tif ( align === 'right' ) {\n\t\t\t\t\t\t\t\t\tshowLeftHandle = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tshowRightHandle = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/* eslint-enable no-lonely-if */\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t{ getInspectorControls( imageWidth, imageHeight ) }\n\t\t\t\t\t\t\t\t\t<ResizableBox\n\t\t\t\t\t\t\t\t\t\tsize={\n\t\t\t\t\t\t\t\t\t\t\twidth && height ? {\n\t\t\t\t\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\t\t\t\t\theight,\n\t\t\t\t\t\t\t\t\t\t\t} : undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tminWidth={ minWidth }\n\t\t\t\t\t\t\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\t\t\t\t\t\t\tminHeight={ minHeight }\n\t\t\t\t\t\t\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\t\t\t\t\t\t\tlockAspectRatio\n\t\t\t\t\t\t\t\t\t\tenable={ {\n\t\t\t\t\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonResizeStart={ () => {\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: parseInt( currentWidth + delta.width, 10 ),\n\t\t\t\t\t\t\t\t\t\t\t\theight: parseInt( currentHeight + delta.height, 10 ),\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ img }\n\t\t\t\t\t\t\t\t\t</ResizableBox>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t</ImageSize>\n\t\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\t\tplaceholder={ __( 'Write caption…' ) }\n\t\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\t\tunstableOnFocus={ this.onFocusCaption }\n\t\t\t\t\t\t\tonChange={ ( value ) => setAttributes( { caption: value } ) }\n\t\t\t\t\t\t\tisSelected={ this.state.captionFocused }\n\t\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</figure>\n\t\t\t</Fragment>\n\t\t);\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select, props ) => {\n\t\tconst { getMedia } = select( 'core' );\n\t\tconst { getEditorSettings } = select( 'core/editor' );\n\t\tconst { id } = props.attributes;\n\t\tconst { maxWidth, isRTL, imageSizes } = getEditorSettings();\n\n\t\treturn {\n\t\t\timage: id ? getMedia( id ) : null,\n\t\t\tmaxWidth,\n\t\t\tisRTL,\n\t\t\timageSizes,\n\t\t};\n\t} ),\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\n\twithNotices,\n] )( ImageEdit );\n\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/edit.js","const WORDPRESS_EMBED_BLOCK = 'core-embed/wordpress';\n\nconst { includes } = lodash;\nconst { renderToString } = wp.element;\nconst { createBlock } = wp.blocks;\n\n/***\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} attributesFromPreview Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\nexport const createUpgradedEmbedBlock = ( props, attributesFromPreview ) => {\n\tconst { preview, name } = props;\n\tconst { url } = props.attributes;\n\n\tif ( ! url ) {\n\t\treturn;\n\t}\n\n\tconst matchingBlock = findBlock( url );\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tif ( WORDPRESS_EMBED_BLOCK !== name && DEFAULT_EMBED_BLOCK !== matchingBlock ) {\n\t\t// At this point, we have discovered a more suitable block for this url, so transform it.\n\t\tif ( name !== matchingBlock ) {\n\t\t\treturn createBlock( matchingBlock, { url } );\n\t\t}\n\t}\n\n\tif ( preview ) {\n\t\tconst { html } = preview;\n\n\t\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\t\tif ( isFromWordPress( html ) ) {\n\t\t\t// If this is not the WordPress embed block, transform it into one.\n\t\t\tif ( WORDPRESS_EMBED_BLOCK !== name ) {\n\t\t\t\treturn createBlock(\n\t\t\t\t\tWORDPRESS_EMBED_BLOCK,\n\t\t\t\t\t{\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t// By now we have the preview, but when the new block first renders, it\n\t\t\t\t\t\t// won't have had all the attributes set, and so won't get the correct\n\t\t\t\t\t\t// type and it won't render correctly. So, we pass through the current attributes\n\t\t\t\t\t\t// here so that the initial render works when we switch to the WordPress\n\t\t\t\t\t\t// block. This only affects the WordPress block because it can't be\n\t\t\t\t\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\n\t\t\t\t\t\t// relies on the preview to set the correct render type.\n\t\t\t\t\t\t...attributesFromPreview,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport const isFromWordPress = ( html ) => {\n\treturn includes( html, 'class=\"wp-embedded-content\" data-secret' );\n};\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/util.js","const { noop } = lodash;\n\nconst { withGlobalEvents } = wp.compose;\nconst { Component } = wp.element;\n\nclass ImageSize extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t};\n\t\tthis.bindContainer = this.bindContainer.bind( this );\n\t\tthis.calculateSize = this.calculateSize.bind( this );\n\t}\n\n\tbindContainer( ref ) {\n\t\tthis.container = ref;\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( this.props.src !== prevProps.src ) {\n\t\t\tthis.setState( {\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t} );\n\t\t\tthis.fetchImageSize();\n\t\t}\n\n\t\tif ( this.props.dirtynessTrigger !== prevProps.dirtynessTrigger ) {\n\t\t\tthis.calculateSize();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.fetchImageSize();\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.image ) {\n\t\t\tthis.image.onload = noop;\n\t\t}\n\t}\n\n\tfetchImageSize() {\n\t\tthis.image = new window.Image();\n\t\tthis.image.onload = this.calculateSize;\n\t\tthis.image.src = this.props.src;\n\t}\n\n\tcalculateSize() {\n\t\tconst maxWidth = this.container.clientWidth;\n\t\tconst exceedMaxWidth = this.image.width > maxWidth;\n\t\tconst ratio = this.image.height / this.image.width;\n\t\tconst width = exceedMaxWidth ? maxWidth : this.image.width;\n\t\tconst height = exceedMaxWidth ? maxWidth * ratio : this.image.height;\n\t\tthis.setState( { width, height } );\n\t}\n\n\trender() {\n\t\tconst sizes = {\n\t\t\timageWidth: this.image && this.image.width,\n\t\t\timageHeight: this.image && this.image.height,\n\t\t\tcontainerWidth: this.container && this.container.clientWidth,\n\t\t\tcontainerHeight: this.container && this.container.clientHeight,\n\t\t\timageWidthWithinContainer: this.state.width,\n\t\t\timageHeightWithinContainer: this.state.height,\n\t\t};\n\t\treturn (\n\t\t\t<div ref={ this.bindContainer }>\n\t\t\t\t{ this.props.children( sizes ) }\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default withGlobalEvents( {\n\tresize: 'calculateSize',\n} )( ImageSize );\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/image-size.js","import classnames from \"classnames\";\n\nconst { __ } = wp.i18n;\nconst { Component , createRef } = wp.element;\nconst { Spinner, withSpokenMessages, Popover , TextControl } = wp.components;\nconst { withInstanceId } = wp.compose;\n\nclass ThirstyURLInput extends Component {\n\n /**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tconstructor( { autocompleteRef } ) {\n\t\tsuper( ...arguments );\n\n\t\t// this.onChange = this.onChange.bind( this );\n\t\t// this.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.autocompleteRef = autocompleteRef || createRef();\n\t\tthis.inputRef = createRef();\n\t\tthis.searchAffiliateLinks = this.searchAffiliateLinks.bind( this );\n\t\t// this.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n\t\tthis.suggestionNodes = [];\n\n\t\tthis.state = {\n\t\t\tposts : [],\n\t\t\tshowSuggestions : false,\n\t\t\tselectedSuggestion : null,\n\t\t\tloading : false\n\t\t};\n\t}\n\n\t/**\n * Component did update method.\n * \n * @since 3.6\n */\n\tcomponentDidUpdate() {\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\n\t\t// only have to worry about scrolling selected suggestion into view\n\t\t// when already expanded\n\t\tif ( showSuggestions && selectedSuggestion !== null && ! this.scrollingIntoView ) {\n\t\t\tthis.scrollingIntoView = true;\n\t\t\tscrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef.current, {\n\t\t\t\tonlyScrollIfNeeded: true,\n\t\t\t} );\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tthis.scrollingIntoView = false;\n\t\t\t}, 100 );\n\t\t}\n\t}\n\n\t/**\n * Component unmount method.\n * \n * @since 3.6\n */\n\tcomponentWillUnmount() {\n\t\tdelete this.suggestionsRequest;\n\t}\n\n\t/**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\tbindSuggestionNode( index ) {\n\t\treturn ( ref ) => {\n\t\t\tthis.suggestionNodes[ index ] = ref;\n\t\t};\n\t}\n\t\n\tsearchAffiliateLinks( value ) {\n\n\t\t// Show the suggestions after typing at least 2 characters=\n\t\tif ( value.length < 2 ) {\n\t\t\tthis.setState( {\n\t\t\t\tshowSuggestions: false,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: false,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setState({\n\t\t\tshowSuggestions : true,\n\t\t\tselectedSuggestion : null,\n\t\t\tloading : true\n\t\t});\n\n\t\tconst formData = new FormData();\n formData.append( \"action\" , \"search_affiliate_links_query\" );\n formData.append( \"keyword\" , value );\n formData.append( \"paged\" , 1 );\n\t\tformData.append( \"gutenberg\" , true );\n\t\tformData.append( \"with_images\" , true );\n\t\t\n\t\t// We are getting data via the WP AJAX instead of rest API as it is not possible yet\n // to filter results with category value. This is to prepare next update to add category filter.\n const request = fetch( ajaxurl , {\n method : \"POST\",\n body : formData\n\t\t} );\n\t\t\n\t\trequest\n .then( response => response.json() )\n .then( ( response ) => {\n\n if ( ! response.affiliate_links ) return;\n\n const posts = response.affiliate_links;\n\n\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\treturn;\n }\n\n\t\t\tthis.setState( {\n\t\t\t\tposts,\n\t\t\t\tloading: false,\n } );\n\n\t\t\tif ( !! posts.length ) {\n\t\t\t\tthis.props.debouncedSpeak( sprintf( _n(\n\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\tposts.length\n\t\t\t\t), posts.length ), 'assertive' );\n\t\t\t} else {\n\t\t\t\tthis.props.debouncedSpeak( __( 'No results.' ), 'assertive' );\n }\n\n\t\t} ).catch( () => {\n\t\t\tif ( this.suggestionsRequest === request ) {\n\t\t\t\tthis.setState( {\n\t\t\t\t\tloading: false,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\tthis.suggestionsRequest = request;\n\t}\n\n\t/**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\tselectLink( post ) {\n\t\t// this.props.onChange( post.link, post );\n\t\tthis.setState( {\n\t\t\tselectedSuggestion: post,\n\t\t\tshowSuggestions: false,\n\t\t} );\n\n\t\tthis.props.updateImageSelection( post.images , post );\n\t}\n\n\t/**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\thandleOnClick( post ) {\n\t\tthis.selectLink( post );\n\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\t// this.inputRef.current.focus();\n\t}\n\n render() {\n const { value = '', autoFocus = true, instanceId } = this.props;\n const { showSuggestions , posts, selectedSuggestion , loading } = this.state;\n \n return (\n <div class=\"edit-search-affiliate-links\">\n\t\t\t\t<form\n\t\t\t\t\tclassName=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover\"\n\t\t\t\t\tonSubmit={ this.displayAffiliateImages }\n\t\t\t\t>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tclassName=\"ta-search-affiliate-links\"\n\t\t\t\t\t\tplaceholder={ __( \"Type to search affiliate links\" ) }\n\t\t\t\t\t\tonChange={ this.searchAffiliateLinks }\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ ( loading ) && <Spinner /> }\n\n\t\t\t\t\t{ showSuggestions && !! posts.length && \n\t\t\t\t\t\t<Popover position=\"bottom\" focusOnMount={ false }>\n\t\t\t\t\t\t\t<div class=\"affilate-links-suggestions\">\n\t\t\t\t\t\t\t\t{ posts.map( ( post, index ) => (\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\tkey={ post.id }\n\t\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t\t\tid={ `editor-url-input-suggestion-${ instanceId }-${ index }` }\n\t\t\t\t\t\t\t\t\t\tref={ this.bindSuggestionNode( index ) }\n\t\t\t\t\t\t\t\t\t\tclassName={ classnames( 'editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion,\n\t\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => this.handleOnClick( post ) }\n\t\t\t\t\t\t\t\t\t\taria-selected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ post.title || __( '(no title)' ) }\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t\t}\n\t\t\t\t</form>\n </div>\n );\n }\n}\n\nexport default withSpokenMessages( withInstanceId( ThirstyURLInput ) );\n\n\n\n// WEBPACK FOOTER //\n// ./src/blocks/ta-image/search-input.js","import { taLink } from \"./ta-link\";\n\nconst { registerFormatType } = wp.richText;\n\n/**\n * Register custom formats.\n * \n * @since 3.6\n */\nexport default function registerFormats() {\n\n [\n taLink\n ].forEach( ( { name , ...settings } ) => registerFormatType( name , settings ) );\n}\n\n\n// WEBPACK FOOTER //\n// ./src/formats/index.js","import InlineAffiliateLinkUI from './inline';\n\nconst { __ } = wp.i18n;\nconst { Component , Fragment } = wp.element;\nconst { withSpokenMessages } = wp.components;\nconst { getTextContent , applyFormat , removeFormat , slice } = wp.richText;\nconst { isURL } = wp.url;\nconst { RichTextToolbarButton , RichTextShortcut } = wp.blockEditor;\nconst { Path , SVG } = wp.components;\nconst { getRectangleFromRange } = wp.dom;\n\nconst name = \"ta/link\";\nlet lastAnchorRect = null;\n\n/**\n * Custom Affiliate link format. When applied will wrap selected text with <ta href=\"\" linkid=\"\"></ta> custom element.\n * Custom element is implemented here as we are not allowed to use <a> tag due to Gutenberg limitations.\n * Element is converted to normal <a> tag on frontend via PHP script filtered on 'the_content'.\n *\n * @since 3.6\n */\nexport const taLink = {\n name,\n title : __( \"Affiliate Link\" ),\n tagName : \"ta\",\n className : null,\n attributes : {\n\t\turl : \"href\",\n\t\ttarget : \"target\"\n },\n edit : withSpokenMessages( class LinkEdit extends Component {\n\n\t\t/**\n\t\t * Component constructor.\n\t\t *\n\t\t * @since 3.6\n\t\t */\n\t\tconstructor() {\n\t\t\tsuper( ...arguments );\n\n\t\t\tthis.addLink = this.addLink.bind( this );\n\t\t\tthis.stopAddingLink = this.stopAddingLink.bind( this );\n\t\t\tthis.onRemoveFormat = this.onRemoveFormat.bind( this );\n\t\t\tthis.state = {\n\t\t\t\taddingLink: false,\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Callback to set state to adding link status.\n\t\t *\n\t\t * @since 3.6\n\t\t */\n\t\taddLink() {\n\n\t\t\tconst { value, onChange } = this.props;\n\t\t\tconst text = getTextContent( slice( value ) );\n\n\t\t\tif ( text && isURL( text ) ) {\n\t\t\t\tonChange( applyFormat( value, { type: name, attributes: { url: text } } ) );\n\t\t\t} else {\n\t\t\t\tthis.setState( { addingLink: true } );\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Callback to set state to stop adding link status.\n\t\t *\n\t\t * @since 3.6\n\t\t */\n\t\tstopAddingLink() {\n\t\t\tthis.setState( { addingLink: false } );\n\t\t}\n\n\t\t/**\n\t\t * Remove format event callback.\n\t\t *\n\t\t * @since 3.6\n\t\t */\n\t\tonRemoveFormat() {\n\t\t\tconst { value , onChange , speak } = this.props;\n\n\t\t\tonChange( removeFormat( value , name ) );\n\t\t\tspeak( __( \"Affiliate Link removed.\" ), \"assertive\" );\n\t\t}\n\n\t\t/**\n\t\t * Get selected anchor text.\n\t\t *\n\t\t * @since 3.9\n\t\t */\n\t\tgetAnchorRect() {\n\n\t\t\tconst selection = window.getSelection();\n\t\t\tconst range = selection.rangeCount > 0 ? selection.getRangeAt( 0 ) : null;\n\n\t\t\tif ( ! range ) return;\n\n\t\t\t// Fix for the link UI jumping around the screen on WP 5.6\n\t\t\tif(selection.anchorNode.nodeType !== window.Node.TEXT_NODE) {\n\t\t\t return lastAnchorRect;\n }\n\n\t\t\tlet rect = null;\n\n\t\t\tif ( this.state.addingLink ) {\n\t\t\t\trect = getRectangleFromRange( range );\n\t\t\t} else {\n\n\t\t\t\tlet element = range.startContainer;\n\n\t\t\t\t// If the caret is right before the element, select the next element.\n\t\t\t\telement = element.nextElementSibling || element;\n\n\t\t\t\twhile ( element.nodeType !== window.Node.ELEMENT_NODE ) {\n\t\t\t\t\telement = element.parentNode;\n\t\t\t\t}\n\n\t\t\t\tconst closest = element.closest( 'ta' );\n\t\t\t\tif ( closest ) {\n\t\t\t\t\trect = closest.getBoundingClientRect();\n\t\t\t\t}\n\n\t\t\t}\n\n lastAnchorRect = rect;\n\n\t\t\treturn rect;\n\t\t}\n\n\t\t/**\n\t\t * Component render method.\n\t\t *\n\t\t * @since 3.6\n\t\t */\n\t\trender() {\n\t\t\tconst { isActive , activeAttributes , value , onChange } = this.props;\n\n\t\t\tconst anchorRect = this.getAnchorRect();\n\n\t\t\treturn (\n\t\t\t\t<Fragment>\n\t\t\t\t\t<RichTextShortcut\n\t\t\t\t\t\ttype=\"access\"\n\t\t\t\t\t\tcharacter=\"s\"\n\t\t\t\t\t\tonUse={ this.onRemoveFormat }\n\t\t\t\t\t/>\n\t\t\t\t\t<RichTextShortcut\n\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\tcharacter=\"l\"\n\t\t\t\t\t\tonUse={ this.addLink }\n\t\t\t\t\t/>\n\t\t\t\t\t<RichTextShortcut\n\t\t\t\t\t\ttype=\"primaryShift\"\n\t\t\t\t\t\tcharacter=\"l\"\n\t\t\t\t\t\tonUse={ this.onRemoveFormat }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isActive && <RichTextToolbarButton\n\t\t\t\t\t\ticon=\"editor-unlink\"\n\t\t\t\t\t\ttitle={ __( 'Remove Affiliate Link' ) }\n\t\t\t\t\t\tclassName=\"ta-unlink-button\"\n\t\t\t\t\t\tonClick={ this.onRemoveFormat }\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\tshortcutType=\"primaryShift\"\n\t\t\t\t\t\tshortcutCharacter=\"l\"\n\t\t\t\t\t/> }\n\t\t\t\t\t{ ! isActive && <RichTextToolbarButton\n\t\t\t\t\t\ticon={ <SVG xmlns=\"http://www.w3.org/2000/svg\" width=\"16.688\" height=\"9.875\" viewBox=\"0 0 16.688 9.875\"><Path id=\"TA.svg\" fill=\"black\" class=\"cls-1\" d=\"M2.115,15.12H4.847L6.836,7.7H9.777l0.63-2.381H1.821L1.177,7.7H4.118Zm4.758,0H9.829l1.177-1.751h3.782l0.238,1.751h2.858L16.357,5.245H13.7Zm5.5-3.866,1.835-2.816,0.35,2.816H12.378Z\" transform=\"translate(-1.188 -5.25)\"/></SVG> }\n\t\t\t\t\t\ttitle={ __( 'Affiliate Link' ) }\n\t\t\t\t\t\tclassName=\"ta-link-button\"\n\t\t\t\t\t\tonClick={ this.addLink }\n\t\t\t\t\t\tshortcutType=\"primary\"\n\t\t\t\t\t\tshortcutCharacter=\"l\"\n\t\t\t\t\t/> }\n\t\t\t\t\t<InlineAffiliateLinkUI\n\t\t\t\t\t\taddingLink={ this.state.addingLink }\n\t\t\t\t\t\tstopAddingLink={ this.stopAddingLink }\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\tactiveAttributes={ activeAttributes }\n anchorRect={ anchorRect }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</Fragment>\n\t\t\t);\n\t\t}\n } )\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/index.js","import classnames from \"classnames\";\nimport { isValidHref } from './utils';\nimport ThirstyURLPopover from './url-popover';\nimport ThirstyURLInput from './url-input';\n\nconst { __ } = wp.i18n;\nconst { Component , createRef } = wp.element;\nconst { ExternalLink , ToggleControl , IconButton , withSpokenMessages } = wp.components;\nconst { LEFT, RIGHT, UP, DOWN, BACKSPACE, ENTER } = wp.keycodes;\nconst { prependHTTP , safeDecodeURI , filterURLForDisplay } = wp.url;\nconst { create , insert , isCollapsed , applyFormat , getTextContent , slice } = wp.richText;\n\nconst stopKeyPropagation = ( event ) => event.stopPropagation();\n\n/**\n * Generates the format object that will be applied to the link text.\n *\n * @since 3.6\n *\n * @param {string} url The href of the link.\n * @param {boolean} linkid Affiliate link ID.\n * @param {Object} text The text that is being hyperlinked.\n *\n * @return {Object} The final format object.\n */\nfunction createLinkFormat( { url , linkid , text } ) {\n\tconst format = {\n\t\ttype: \"ta/link\",\n\t\tattributes: {\n\t\t\turl,\n\t\t\tlinkid : linkid.toString()\n\t\t},\n\t};\n\n\treturn format;\n}\n\n/**\n * Check if input is being show.\n *\n * @since 3.6\n *\n * @param {Object} props Component props.\n * @param {Object} state Component state.\n */\nfunction isShowingInput( props , state ) {\n\treturn props.addingLink || state.editLink;\n}\n\n/**\n * Affiliate Link editor JSX element.\n *\n * @since 3.6\n *\n * @param {Object} param0 Component props (destructred).\n */\nconst LinkEditor = ( { value , onChangeInputValue , onKeyDown , submitLink, invalidLink , resetInvalidLink , autocompleteRef } ) => (\n\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\t<form\n\t\tclassName=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content ta-link-search-popover\"\n\t\tonKeyPress={ stopKeyPropagation }\n\t\tonKeyDown={ onKeyDown }\n\t\tonSubmit={ submitLink }\n\t>\n\t\t<ThirstyURLInput\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChangeInputValue }\n\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\tinvalidLink={ invalidLink }\n\t\t\tresetInvalidLink={ resetInvalidLink }\n\t\t/>\n\t\t<IconButton icon=\"editor-break\" label={ __( 'Apply' ) } type=\"submit\" />\n\t</form>\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n);\n\n/**\n * Affiliate link url viewer JSX element.\n *\n * @param {*} param0 Component props (destructred).\n */\nconst LinkViewerUrl = ( { url } ) => {\n\tconst prependedURL = prependHTTP( url );\n\tconst linkClassName = classnames( 'editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value', {\n\t\t'has-invalid-link': ! isValidHref( prependedURL ),\n\t} );\n\n\tif ( ! url ) {\n\t\treturn <span className={ linkClassName }></span>;\n\t}\n\n\treturn (\n\t\t<ExternalLink\n\t\t\tclassName={ linkClassName }\n\t\t\thref={ url }\n\t\t>\n\t\t\t{ filterURLForDisplay( safeDecodeURI( url ) ) }\n\t\t</ExternalLink>\n\t);\n};\n\n/**\n * Affiliate link viewer JSX element.\n *\n * @param {*} param0 Component props (destructred).\n */\nconst LinkViewer = ( { url, editLink } ) => {\n\treturn (\n\t\t// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\t<div\n\t\t\tclassName=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content\"\n\t\t\tonKeyPress={ stopKeyPropagation }\n\t\t>\n\t\t\t<LinkViewerUrl url={ url } />\n\t\t\t<IconButton icon=\"edit\" label={ __( 'Edit' ) } onClick={ editLink } />\n\t\t</div>\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\t);\n};\n\n/**\n * Inline affiliate link UI Component.\n *\n * @since 3.6\n *\n * @param {*} param0 Component props (destructred).\n */\nclass InlineAffiliateLinkUI extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.editLink = this.editLink.bind( this );\n\t\tthis.submitLink = this.submitLink.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.onChangeInputValue = this.onChangeInputValue.bind( this );\n\t\tthis.onClickOutside = this.onClickOutside.bind( this );\n\t\tthis.resetState = this.resetState.bind( this );\n\t\tthis.autocompleteRef = createRef();\n\t\tthis.resetInvalidLink = this.resetInvalidLink.bind( this );\n\n\t\tthis.state = {\n\t\t\tinputValue : '',\n\t\t\tlinkid : 0,\n\t\t\tpost : null,\n\t\t\tinvalidLink : false\n\t\t};\n\t}\n\n\t/**\n\t * Stop the key event from propagating up to ObserveTyping.startTypingInTextField.\n\t *\n\t * @since 3.6\n\t *\n\t * @param {Object} event Event object.\n\t */\n\tonKeyDown( event ) {\n\t\tif ( [ LEFT, DOWN, RIGHT, UP, BACKSPACE, ENTER ].indexOf( event.keyCode ) > -1 ) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\t}\n\n\t/**\n\t * Callback to set state when input value is changed.\n\t *\n\t * @since 3.6\n\t *\n\t * @param {*} inputValue\n\t * @param {*} post\n\t */\n\tonChangeInputValue( inputValue , post = null ) {\n\t\tconst linkid = post ? post.id : 0;\n\t\tthis.setState( { inputValue , linkid , post } );\n\t}\n\n\t/**\n\t * Callback to set state when edit affiliate link (already inserted) is triggered.\n\t *\n\t * @since 3.6\n\t *\n\t * @param {*} event\n\t */\n\teditLink( event ) {\n\t\tthis.setState( { editLink: true } );\n\t\tevent.preventDefault();\n\t}\n\n\t/**\n\t * Callback to apply the affiliate link format to the selected text or position in the active block.\n\t *\n\t * @since 3.6\n\t *\n\t * @param {*} event\n\t */\n\tsubmitLink( event ) {\n\t\tconst { isActive, value, onChange, speak } = this.props;\n\t\tconst { inputValue, linkid , post } = this.state;\n\t\tconst url = prependHTTP( inputValue );\n\t\tconst selectedText = getTextContent( slice( value ) );\n\t\tconst format = createLinkFormat( {\n\t\t\turl,\n\t\t\tlinkid,\n\t\t\ttext: selectedText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! linkid || ! post ) {\n\t\t\tthis.setState( { invalidLink : true } )\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isCollapsed( value ) && ! isActive ) {\n\t\t\tconst toInsert = applyFormat( create( { text: post.title } ), format, 0, url.length );\n\t\t\tonChange( insert( value, toInsert ) );\n\t\t} else {\n\t\t\tonChange( applyFormat( value, format ) );\n\t\t}\n\n\t\tthis.resetState();\n\n\t\tif ( ! isValidHref( url ) ) {\n\t\t\tspeak( __( 'Warning: the link has been inserted but may have errors. Please test it.' ), 'assertive' );\n\t\t} else if ( isActive ) {\n\t\t\tspeak( __( 'Link edited.' ), 'assertive' );\n\t\t} else {\n\t\t\tspeak( __( 'Link inserted' ), 'assertive' );\n\t\t}\n\t}\n\n\t/**\n\t * Callback to run when users clicks outside the popover UI.\n\t *\n\t * @since 3.6\n\t *\n\t * @param {*} event\n\t */\n\tonClickOutside( event ) {\n\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t// so onClickOutside fails to detect that a click on a suggestion occured in the\n\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t// return to avoid the popover being closed.\n\t\tconst autocompleteElement = this.autocompleteRef.current;\n\t\tif ( autocompleteElement && autocompleteElement.contains( event.target ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.resetState();\n\t}\n\n\t/**\n\t * Reset state callback.\n\t *\n\t * @since 3.6\n\t */\n\tresetState() {\n\t\tthis.props.stopAddingLink();\n\t\tthis.setState( { inputValue : '' , editLink: false } );\n\t\tthis.resetInvalidLink();\n\t}\n\n\t/**\n\t * Reset invalid link state callback. Separated as we need to run this independently from resetState() callback.\n\t *\n\t * @since 3.6\n\t */\n\tresetInvalidLink() {\n\t\tthis.setState( { invalidLink : false } );\n\t}\n\n\t/**\n\t * Component render method.\n\t *\n\t * @since 3.6\n\t */\n\trender() {\n\t\tconst { isActive, activeAttributes: { url , linkid }, addingLink, anchorRect, value, onChange } = this.props;\n\n\t\tif ( ! isActive && ! addingLink ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { inputValue , invalidLink } = this.state;\n\t\tconst showInput = isShowingInput( this.props, this.state );\n\n\t\treturn (\n\t\t\t<ThirstyURLPopover\n\t\t\t\tonClickOutside={ this.onClickOutside }\n\t\t\t\tonClose={ this.resetState }\n\t\t\t\tfocusOnMount={ showInput ? 'firstElement' : false }\n\t\t\t\tinvalidLink={ invalidLink }\n anchorRect={ anchorRect }\n\t\t\t>\n\t\t\t\t{ showInput ? (\n\t\t\t\t\t<LinkEditor\n\t\t\t\t\t\tvalue={ inputValue }\n\t\t\t\t\t\tonChangeInputValue={ this.onChangeInputValue }\n\t\t\t\t\t\tonKeyDown={ this.onKeyDown }\n\t\t\t\t\t\tsubmitLink={ this.submitLink }\n\t\t\t\t\t\tautocompleteRef={ this.autocompleteRef }\n\t\t\t\t\t\tupdateLinkId= { this.updateLinkId }\n\t\t\t\t\t\tinvalidLink={ invalidLink }\n\t\t\t\t\t\tresetInvalidLink={ this.resetInvalidLink }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<LinkViewer\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\teditLink={ this.editLink }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</ThirstyURLPopover>\n\t\t);\n\t}\n}\n\nexport default withSpokenMessages( InlineAffiliateLinkUI );\n\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/inline.js","const { startsWith } = lodash;\n\nconst {\n getProtocol,\n\tisValidProtocol,\n\tgetAuthority,\n\tisValidAuthority,\n\tgetPath,\n\tisValidPath,\n\tgetQueryString,\n\tisValidQueryString,\n\tgetFragment,\n\tisValidFragment,\n} = wp.url;\n\n/**\n * Check for issues with the provided href.\n * \n * @since 3.6\n *\n * @param {string} href The href.\n * @return {boolean} Is the href invalid?\n */\nexport function isValidHref( href ) {\n\tif ( ! href ) {\n\t\treturn false;\n\t}\n\n\tconst trimmedHref = href.trim();\n\n\tif ( ! trimmedHref ) {\n\t\treturn false;\n\t}\n\n\t// Does the href start with something that looks like a URL protocol?\n\tif ( /^\\S+:/.test( trimmedHref ) ) {\n\t\tconst protocol = getProtocol( trimmedHref );\n\t\tif ( ! isValidProtocol( protocol ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Add some extra checks for http(s) URIs, since these are the most common use-case.\n\t\t// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n\t\tif ( startsWith( protocol, 'http' ) && ! /^https?:\\/\\/[^\\/\\s]/i.test( trimmedHref ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst authority = getAuthority( trimmedHref );\n\t\tif ( ! isValidAuthority( authority ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst path = getPath( trimmedHref );\n\t\tif ( path && ! isValidPath( path ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst queryString = getQueryString( trimmedHref );\n\t\tif ( queryString && ! isValidQueryString( queryString ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst fragment = getFragment( trimmedHref );\n\t\tif ( fragment && ! isValidFragment( fragment ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Validate anchor links.\n\tif ( startsWith( trimmedHref, '#' ) && ! isValidFragment( trimmedHref ) ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/utils.js","const { __ } = wp.i18n;\nconst { Component } = wp.element;\nconst { Popover , IconButton } = wp.components;\n\n/**\n * Custom URL Popover component.\n * \n * @since 3.6\n */\nclass ThirstyURLPopover extends Component {\n\n /**\n * Component constructor method.\n * \n * @since 3.6\n */\n\tconstructor() {\n super( ...arguments );\n \n this.toggleSettingsVisibility = this.toggleSettingsVisibility.bind( this );\n\n\t\tthis.state = {\n\t\t\tisSettingsExpanded: false,\n\t\t};\n }\n \n /**\n * Component constructor.\n * \n * @since 3.6\n */\n toggleSettingsVisibility() {\n\t\tthis.setState( {\n\t\t\tisSettingsExpanded: ! this.state.isSettingsExpanded,\n\t\t} );\n\t}\n\n /**\n * Component render method.\n * \n * @since 3.6\n */\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\trenderSettings,\n invalidLink,\n\t\t\tposition = 'bottom center',\n\t\t\tfocusOnMount = 'firstElement',\n\t\t\t...popoverProps\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\tisSettingsExpanded,\n } = this.state;\n \n const showSettings = !! renderSettings && isSettingsExpanded;\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\tclassName=\"ta-url-popover editor-url-popover block-editor-url-popover\"\n\t\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t\tposition={ position }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t<div className=\"editor-url-popover__row\">\n { children }\n { !! renderSettings && (\n\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\tclassName=\"editor-url-popover__settings-toggle\"\n\t\t\t\t\t\t\ticon=\"ellipsis\"\n\t\t\t\t\t\t\tlabel={ __( 'Link Settings' ) }\n\t\t\t\t\t\t\tonClick={ this.toggleSettingsVisibility }\n\t\t\t\t\t\t\taria-expanded={ isSettingsExpanded }\n\t\t\t\t\t\t/>\n ) }\n\t\t\t\t</div>\n { showSettings && (\n\t\t\t\t\t<div className=\"editor-url-popover__row editor-url-popover__settings\">\n\t\t\t\t\t\t{ renderSettings() }\n\t\t\t\t\t</div>\n ) }\n { invalidLink && <div class=\"ta-invalid-link\">{ __( 'Invalid affiliate link' ) }</div> }\n\t\t\t</Popover>\n\t\t);\n\t}\n}\n\nexport default ThirstyURLPopover;\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/url-popover.js","import classnames from 'classnames';\nimport scrollIntoView from 'dom-scroll-into-view';\n\nconst { __ } = wp.i18n;\nconst { throttle } = lodash;\nconst { Component , createRef } = wp.element;\nconst { UP, DOWN, ENTER, TAB } = wp.keycodes;\nconst { Spinner, withSpokenMessages, Popover } = wp.components;\nconst { withInstanceId } = wp.compose;\n\n// Since URLInput is rendered in the context of other inputs, but should be\n// considered a separate modal node, prevent keyboard events from propagating\n// as being considered from the input.\nconst stopEventPropagation = ( event ) => event.stopPropagation();\n\n/**\n * Custom URL Input component.\n * \n * @since 3.6\n */\nclass ThirstyURLInput extends Component {\n\n /**\n * Component constructor method.\n * \n * @since 3.6\n * \n * @param {*} param0 \n */\n\tconstructor( { autocompleteRef } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.onChange = this.onChange.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.autocompleteRef = autocompleteRef || createRef();\n\t\tthis.inputRef = createRef();\n\t\tthis.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n\t\tthis.suggestionNodes = [];\n\n\t\tthis.state = {\n\t\t\tposts: [],\n\t\t\tshowSuggestions: false,\n\t\t\tselectedSuggestion: null,\n\t\t};\n\t}\n\n /**\n * Component did update method.\n * \n * @since 3.6\n */\n\tcomponentDidUpdate() {\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\n\t\t// only have to worry about scrolling selected suggestion into view\n\t\t// when already expanded\n\t\tif ( showSuggestions && selectedSuggestion !== null && ! this.scrollingIntoView ) {\n\t\t\tthis.scrollingIntoView = true;\n\t\t\tscrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef.current, {\n\t\t\t\tonlyScrollIfNeeded: true,\n\t\t\t} );\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tthis.scrollingIntoView = false;\n\t\t\t}, 100 );\n\t\t}\n\t}\n\n /**\n * Component unmount method.\n * \n * @since 3.6\n */\n\tcomponentWillUnmount() {\n\t\tdelete this.suggestionsRequest;\n\t}\n\n /**\n * Bind suggestion to node.\n * \n * @param {*} index \n */\n\tbindSuggestionNode( index ) {\n\t\treturn ( ref ) => {\n\t\t\tthis.suggestionNodes[ index ] = ref;\n\t\t};\n\t}\n\n /**\n * Callback to show suggestions based on value inputted on search field.\n * \n * @since 3.6\n * \n * @param {*} value \n */\n\tupdateSuggestions( value ) {\n\t\t// Show the suggestions after typing at least 2 characters\n\t\t// and also for URLs\n\t\tif ( value.length < 2 || /^https?:/.test( value ) ) {\n\t\t\tthis.setState( {\n\t\t\t\tshowSuggestions: false,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: false,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setState( {\n\t\t\tshowSuggestions: true,\n\t\t\tselectedSuggestion: null,\n\t\t\tloading: true,\n\t\t} );\n\n const formData = new FormData();\n formData.append( \"action\" , \"search_affiliate_links_query\" );\n formData.append( \"keyword\" , value );\n formData.append( \"paged\" , 1 );\n formData.append( \"gutenberg\" , true );\n \n // We are getting data via the WP AJAX instead of rest API as it is not possible yet\n // to filter results with category value. This is to prepare next update to add category filter.\n const request = fetch( ajaxurl , {\n method : \"POST\",\n body : formData\n } );\n\n request\n .then( response => response.json() )\n .then( ( response ) => {\n\n if ( ! response.affiliate_links ) return;\n\n const posts = response.affiliate_links;\n\n\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\treturn;\n }\n\n\t\t\tthis.setState( {\n\t\t\t\tposts,\n\t\t\t\tloading: false,\n } );\n\n\t\t\tif ( !! posts.length ) {\n\t\t\t\tthis.props.debouncedSpeak( sprintf( _n(\n\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\tposts.length\n\t\t\t\t), posts.length ), 'assertive' );\n\t\t\t} else {\n\t\t\t\tthis.props.debouncedSpeak( __( 'No results.' ), 'assertive' );\n }\n\n\t\t} ).catch( () => {\n\t\t\tif ( this.suggestionsRequest === request ) {\n\t\t\t\tthis.setState( {\n\t\t\t\t\tloading: false,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\tthis.suggestionsRequest = request;\n\t}\n\n /**\n * Search input value change event callback method.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\tonChange( event ) {\n this.props.resetInvalidLink();\n\t\tconst inputValue = event.target.value;\n\t\tthis.props.onChange( inputValue );\n\t\tthis.updateSuggestions( inputValue );\n\t}\n\n /**\n * Keydown event callback. Handles selecting result via keyboard.\n * \n * @since 3.6\n * \n * @param {*} event \n */\n\tonKeyDown( event ) {\n\t\tconst { showSuggestions, selectedSuggestion, posts, loading } = this.state;\n\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n\t\t// We shouldn't preventDefault to allow block arrow keys navigation\n\t\tif ( ! showSuggestions || ! posts.length || loading ) {\n\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\n\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\n\t\t\t// only happens if the caret is not in the first or last position in the text input.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n\t\t\tswitch ( event.keyCode ) {\n\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\n\t\t\t\t// position.\n\t\t\t\tcase UP: {\n\t\t\t\t\tif ( 0 !== event.target.selectionStart ) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to position 0\n\t\t\t\t\t\tevent.target.setSelectionRange( 0, 0 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\n\t\t\t\t// last position.\n\t\t\t\tcase DOWN: {\n\t\t\t\t\tif ( this.props.value.length !== event.target.selectionStart ) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to the last position\n\t\t\t\t\t\tevent.target.setSelectionRange( this.props.value.length, this.props.value.length );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst post = this.state.posts[ this.state.selectedSuggestion ];\n\n\t\tswitch ( event.keyCode ) {\n\t\t\tcase UP: {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst previousIndex = ! selectedSuggestion ? posts.length - 1 : selectedSuggestion - 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: previousIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase DOWN: {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst nextIndex = selectedSuggestion === null || ( selectedSuggestion === posts.length - 1 ) ? 0 : selectedSuggestion + 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: nextIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase TAB: {\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tthis.selectLink( post );\n\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\n\t\t\t\t\tthis.props.speak( __( 'Link selected' ) );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ENTER: {\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tthis.selectLink( post );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n /**\n * Set state when an affiliate link is selected.\n * \n * @since 3.6\n * \n * @param {*} post \n */\n\tselectLink( post ) {\n\t\tthis.props.onChange( post.link, post );\n\t\tthis.setState( {\n\t\t\tselectedSuggestion: null,\n\t\t\tshowSuggestions: false,\n\t\t} );\n\t}\n\n /**\n * Callback handler for when affiliate link is selected.\n * \n * @param {*} post \n */\n\thandleOnClick( post ) {\n\t\tthis.selectLink( post );\n\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\tthis.inputRef.current.focus();\n\t}\n\n /**\n * Component render method.\n * \n * @since 3.6\n */\n\trender() {\n\t\tconst { value = '', autoFocus = true, instanceId , invalidLink } = this.props;\n\t\tconst { showSuggestions, posts, selectedSuggestion, loading } = this.state;\n\t\t/* eslint-disable jsx-a11y/no-autofocus */\n\t\treturn (\n\t\t\t<div className=\"editor-url-input block-editor-url-input\">\n\t\t\t\t<input\n\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\taria-label={ __( 'URL' ) }\n\t\t\t\t\trequired\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ this.onChange }\n\t\t\t\t\tonInput={ stopEventPropagation }\n\t\t\t\t\tplaceholder={ __( 'Paste URL or type to search' ) }\n\t\t\t\t\tonKeyDown={ this.onKeyDown }\n\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\taria-expanded={ showSuggestions }\n\t\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\t\taria-owns={ `editor-url-input-suggestions-${ instanceId }` }\n\t\t\t\t\taria-activedescendant={ selectedSuggestion !== null ? `editor-url-input-suggestion-${ instanceId }-${ selectedSuggestion }` : undefined }\n\t\t\t\t\tref={ this.inputRef }\n\t\t\t\t/>\n\n\t\t\t\t{ ( loading ) && <Spinner /> }\n\n\t\t\t\t{ showSuggestions && !! posts.length && ! invalidLink &&\n\t\t\t\t\t<Popover position=\"bottom\" noArrow focusOnMount={ false }>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"editor-url-input__suggestions block-editor-url-input__suggestions\"\n\t\t\t\t\t\t\tid={ `editor-url-input-suggestions-${ instanceId }` }\n\t\t\t\t\t\t\tref={ this.autocompleteRef }\n\t\t\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ posts.map( ( post, index ) => (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tkey={ post.id }\n\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t\tid={ `block-editor-url-input-suggestion-${ instanceId }-${ index }` }\n\t\t\t\t\t\t\t\t\tref={ this.bindSuggestionNode( index ) }\n\t\t\t\t\t\t\t\t\tclassName={ classnames( 'editor-url-input__suggestion block-editor-url-input__suggestion', {\n\t\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion,\n\t\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t\t\tonClick={ () => this.handleOnClick( post ) }\n\t\t\t\t\t\t\t\t\taria-selected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ post.title || __( '(no title)' ) }\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Popover>\n\t\t\t\t}\n\t\t\t</div>\n\t\t);\n\t\t/* eslint-enable jsx-a11y/no-autofocus */\n\t}\n}\n\nexport default withSpokenMessages( withInstanceId( ThirstyURLInput ) );\n\n\n\n// WEBPACK FOOTER //\n// ./src/formats/ta-link/url-input.js","'use strict';\n\nmodule.exports = require('./dom-scroll-into-view');\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/index.js\n// module id = 14\n// module chunks = 0","'use strict';\n\nvar util = require('./util');\n\nfunction scrollIntoView(elem, container, config) {\n config = config || {};\n // document 归一化到 window\n if (container.nodeType === 9) {\n container = util.getWindow(container);\n }\n\n var allowHorizontalScroll = config.allowHorizontalScroll;\n var onlyScrollIfNeeded = config.onlyScrollIfNeeded;\n var alignWithTop = config.alignWithTop;\n var alignWithLeft = config.alignWithLeft;\n var offsetTop = config.offsetTop || 0;\n var offsetLeft = config.offsetLeft || 0;\n var offsetBottom = config.offsetBottom || 0;\n var offsetRight = config.offsetRight || 0;\n\n allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;\n\n var isWin = util.isWindow(container);\n var elemOffset = util.offset(elem);\n var eh = util.outerHeight(elem);\n var ew = util.outerWidth(elem);\n var containerOffset = undefined;\n var ch = undefined;\n var cw = undefined;\n var containerScroll = undefined;\n var diffTop = undefined;\n var diffBottom = undefined;\n var win = undefined;\n var winScroll = undefined;\n var ww = undefined;\n var wh = undefined;\n\n if (isWin) {\n win = container;\n wh = util.height(win);\n ww = util.width(win);\n winScroll = {\n left: util.scrollLeft(win),\n top: util.scrollTop(win)\n };\n // elem 相对 container 可视视窗的距离\n diffTop = {\n left: elemOffset.left - winScroll.left - offsetLeft,\n top: elemOffset.top - winScroll.top - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,\n top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom\n };\n containerScroll = winScroll;\n } else {\n containerOffset = util.offset(container);\n ch = container.clientHeight;\n cw = container.clientWidth;\n containerScroll = {\n left: container.scrollLeft,\n top: container.scrollTop\n };\n // elem 相对 container 可视视窗的距离\n // 注意边框, offset 是边框到根节点\n diffTop = {\n left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,\n top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop\n };\n diffBottom = {\n left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,\n top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom\n };\n }\n\n if (diffTop.top < 0 || diffBottom.top > 0) {\n // 强制向上\n if (alignWithTop === true) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else if (alignWithTop === false) {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n } else {\n // 自动调整\n if (diffTop.top < 0) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;\n if (alignWithTop) {\n util.scrollTop(container, containerScroll.top + diffTop.top);\n } else {\n util.scrollTop(container, containerScroll.top + diffBottom.top);\n }\n }\n }\n\n if (allowHorizontalScroll) {\n if (diffTop.left < 0 || diffBottom.left > 0) {\n // 强制向上\n if (alignWithLeft === true) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else if (alignWithLeft === false) {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n } else {\n // 自动调整\n if (diffTop.left < 0) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n } else {\n if (!onlyScrollIfNeeded) {\n alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;\n if (alignWithLeft) {\n util.scrollLeft(container, containerScroll.left + diffTop.left);\n } else {\n util.scrollLeft(container, containerScroll.left + diffBottom.left);\n }\n }\n }\n }\n}\n\nmodule.exports = scrollIntoView;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js\n// module id = 15\n// module chunks = 0","'use strict';\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\nvar RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nfunction getClientPosition(elem) {\n var box = undefined;\n var x = undefined;\n var y = undefined;\n var doc = elem.ownerDocument;\n var body = doc.body;\n var docElem = doc && doc.documentElement;\n // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式\n box = elem.getBoundingClientRect();\n\n // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop\n // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确\n // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin\n\n x = box.left;\n y = box.top;\n\n // In IE, most of the time, 2 extra pixels are added to the top and left\n // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and\n // IE6 standards mode, this border can be overridden by setting the\n // document element's border to zero -- thus, we cannot rely on the\n // offset always being 2 pixels.\n\n // In quirks mode, the offset can be determined by querying the body's\n // clientLeft/clientTop, but in standards mode, it is found by querying\n // the document element's clientLeft/clientTop. Since we already called\n // getClientBoundingRect we have already forced a reflow, so it is not\n // too expensive just to query them all.\n\n // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的\n // 窗口边框标准是设 documentElement ,quirks 时设置 body\n // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去\n // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置\n // 标准 ie 下 docElem.clientTop 就是 border-top\n // ie7 html 即窗口边框改变不了。永远为 2\n // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0\n\n x -= docElem.clientLeft || body.clientLeft || 0;\n y -= docElem.clientTop || body.clientTop || 0;\n\n return {\n left: x,\n top: y\n };\n}\n\nfunction getScroll(w, top) {\n var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];\n var method = 'scroll' + (top ? 'Top' : 'Left');\n if (typeof ret !== 'number') {\n var d = w.document;\n // ie6,7,8 standard mode\n ret = d.documentElement[method];\n if (typeof ret !== 'number') {\n // quirks mode\n ret = d.body[method];\n }\n }\n return ret;\n}\n\nfunction getScrollLeft(w) {\n return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n var pos = getClientPosition(el);\n var doc = el.ownerDocument;\n var w = doc.defaultView || doc.parentWindow;\n pos.left += getScrollLeft(w);\n pos.top += getScrollTop(w);\n return pos;\n}\nfunction _getComputedStyle(elem, name, computedStyle_) {\n var val = '';\n var d = elem.ownerDocument;\n var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);\n\n // https://github.com/kissyteam/kissy/issues/61\n if (computedStyle) {\n val = computedStyle.getPropertyValue(name) || computedStyle[name];\n }\n\n return val;\n}\n\nvar _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');\nvar RE_POS = /^(top|right|bottom|left)$/;\nvar CURRENT_STYLE = 'currentStyle';\nvar RUNTIME_STYLE = 'runtimeStyle';\nvar LEFT = 'left';\nvar PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n // currentStyle maybe null\n // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];\n\n // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值\n // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n // 在 ie 下不对,需要直接用 offset 方式\n // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了\n\n // From the awesome hack by Dean Edwards\n // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n // If we're not dealing with a regular pixel number\n // but a number that has a weird ending, we need to convert it to pixels\n // exclude left right for relativity\n if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n // Remember the original values\n var style = elem.style;\n var left = style[LEFT];\n var rsLeft = elem[RUNTIME_STYLE][LEFT];\n\n // prevent flashing of content\n elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];\n\n // Put in the new values to get a computed value out\n style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;\n ret = style.pixelLeft + PX;\n\n // Revert the changed values\n style[LEFT] = left;\n\n elem[RUNTIME_STYLE][LEFT] = rsLeft;\n }\n return ret === '' ? 'auto' : ret;\n}\n\nvar getComputedStyleX = undefined;\nif (typeof window !== 'undefined') {\n getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;\n}\n\nfunction each(arr, fn) {\n for (var i = 0; i < arr.length; i++) {\n fn(arr[i]);\n }\n}\n\nfunction isBorderBoxFn(elem) {\n return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nvar BOX_MODELS = ['margin', 'border', 'padding'];\nvar CONTENT_INDEX = -1;\nvar PADDING_INDEX = 2;\nvar BORDER_INDEX = 1;\nvar MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n var old = {};\n var style = elem.style;\n var name = undefined;\n\n // Remember the old values, and insert the new ones\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n old[name] = style[name];\n style[name] = options[name];\n }\n }\n\n callback.call(elem);\n\n // Revert the old values\n for (name in options) {\n if (options.hasOwnProperty(name)) {\n style[name] = old[name];\n }\n }\n}\n\nfunction getPBMWidth(elem, props, which) {\n var value = 0;\n var prop = undefined;\n var j = undefined;\n var i = undefined;\n for (j = 0; j < props.length; j++) {\n prop = props[j];\n if (prop) {\n for (i = 0; i < which.length; i++) {\n var cssProp = undefined;\n if (prop === 'border') {\n cssProp = prop + which[i] + 'Width';\n } else {\n cssProp = prop + which[i];\n }\n value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n }\n }\n }\n return value;\n}\n\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\nfunction isWindow(obj) {\n // must use == for ie8\n /* eslint eqeqeq:0 */\n return obj != null && obj == obj.window;\n}\n\nvar domUtils = {};\n\neach(['Width', 'Height'], function (name) {\n domUtils['doc' + name] = function (refWin) {\n var d = refWin.document;\n return Math.max(\n // firefox chrome documentElement.scrollHeight< body.scrollHeight\n // ie standard mode : documentElement.scrollHeight> body.scrollHeight\n d.documentElement['scroll' + name],\n // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?\n d.body['scroll' + name], domUtils['viewport' + name](d));\n };\n\n domUtils['viewport' + name] = function (win) {\n // pc browser includes scrollbar in window.innerWidth\n var prop = 'client' + name;\n var doc = win.document;\n var body = doc.body;\n var documentElement = doc.documentElement;\n var documentElementProp = documentElement[prop];\n // 标准模式取 documentElement\n // backcompat 取 body\n return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;\n };\n});\n\n/*\n 得到元素的大小信息\n @param elem\n @param name\n @param {String} [extra] 'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\nfunction getWH(elem, name, extra) {\n if (isWindow(elem)) {\n return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);\n } else if (elem.nodeType === 9) {\n return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);\n }\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem, computedStyle);\n var cssBoxValue = 0;\n if (borderBoxValue == null || borderBoxValue <= 0) {\n borderBoxValue = undefined;\n // Fall back to computed then un computed css if necessary\n cssBoxValue = getComputedStyleX(elem, name);\n if (cssBoxValue == null || Number(cssBoxValue) < 0) {\n cssBoxValue = elem.style[name] || 0;\n }\n // Normalize '', auto, and prepare for extra\n cssBoxValue = parseFloat(cssBoxValue) || 0;\n }\n if (extra === undefined) {\n extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n }\n var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;\n var val = borderBoxValue || cssBoxValue;\n if (extra === CONTENT_INDEX) {\n if (borderBoxValueOrIsBorderBox) {\n return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);\n }\n return cssBoxValue;\n }\n if (borderBoxValueOrIsBorderBox) {\n var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);\n return val + (extra === BORDER_INDEX ? 0 : padding);\n }\n return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);\n}\n\nvar cssShow = {\n position: 'absolute',\n visibility: 'hidden',\n display: 'block'\n};\n\n// fix #119 : https://github.com/kissyteam/kissy/issues/119\nfunction getWHIgnoreDisplay(elem) {\n var val = undefined;\n var args = arguments;\n // in case elem is window\n // elem.offsetWidth === undefined\n if (elem.offsetWidth !== 0) {\n val = getWH.apply(undefined, args);\n } else {\n swap(elem, cssShow, function () {\n val = getWH.apply(undefined, args);\n });\n }\n return val;\n}\n\nfunction css(el, name, v) {\n var value = v;\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {\n for (var i in name) {\n if (name.hasOwnProperty(i)) {\n css(el, i, name[i]);\n }\n }\n return undefined;\n }\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value += 'px';\n }\n el.style[name] = value;\n return undefined;\n }\n return getComputedStyleX(el, name);\n}\n\neach(['width', 'height'], function (name) {\n var first = name.charAt(0).toUpperCase() + name.slice(1);\n domUtils['outer' + first] = function (el, includeMargin) {\n return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);\n };\n var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n domUtils[name] = function (elem, val) {\n if (val !== undefined) {\n if (elem) {\n var computedStyle = getComputedStyleX(elem);\n var isBorderBox = isBorderBoxFn(elem);\n if (isBorderBox) {\n val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);\n }\n return css(elem, name, val);\n }\n return undefined;\n }\n return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n };\n});\n\n// 设置 elem 相对 elem.ownerDocument 的坐标\nfunction setOffset(elem, offset) {\n // set position first, in-case top/left are set even on static elem\n if (css(elem, 'position') === 'static') {\n elem.style.position = 'relative';\n }\n\n var old = getOffset(elem);\n var ret = {};\n var current = undefined;\n var key = undefined;\n\n for (key in offset) {\n if (offset.hasOwnProperty(key)) {\n current = parseFloat(css(elem, key)) || 0;\n ret[key] = current + offset[key] - old[key];\n }\n }\n css(elem, ret);\n}\n\nmodule.exports = _extends({\n getWindow: function getWindow(node) {\n var doc = node.ownerDocument || node;\n return doc.defaultView || doc.parentWindow;\n },\n offset: function offset(el, value) {\n if (typeof value !== 'undefined') {\n setOffset(el, value);\n } else {\n return getOffset(el);\n }\n },\n\n isWindow: isWindow,\n each: each,\n css: css,\n clone: function clone(obj) {\n var ret = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret[i] = obj[i];\n }\n }\n var overflow = obj.overflow;\n if (overflow) {\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n ret.overflow[i] = obj.overflow[i];\n }\n }\n }\n return ret;\n },\n scrollLeft: function scrollLeft(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollLeft(w);\n }\n window.scrollTo(v, getScrollTop(w));\n } else {\n if (v === undefined) {\n return w.scrollLeft;\n }\n w.scrollLeft = v;\n }\n },\n scrollTop: function scrollTop(w, v) {\n if (isWindow(w)) {\n if (v === undefined) {\n return getScrollTop(w);\n }\n window.scrollTo(getScrollLeft(w), v);\n } else {\n if (v === undefined) {\n return w.scrollTop;\n }\n w.scrollTop = v;\n }\n },\n\n viewportWidth: 0,\n viewportHeight: 0\n}, domUtils);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/dom-scroll-into-view/lib/util.js\n// module id = 16\n// module chunks = 0"],"sourceRoot":""}
|
js/app/gutenberg_support/src/blocks/ta-image/edit.js
CHANGED
@@ -5,9 +5,10 @@ const { getPath } = wp.url;
|
|
5 |
const { __, sprintf } = wp.i18n;
|
6 |
const { Component, Fragment , createRef } = wp.element;
|
7 |
const { getBlobByURL, revokeBlobURL, isBlobURL } = wp.blob;
|
8 |
-
const { Placeholder , Button , ButtonGroup , IconButton , PanelBody , ResizableBox , SelectControl , Spinner , TextControl , TextareaControl , Toolbar , withNotices
|
9 |
const { withSelect } = wp.data;
|
10 |
-
const {
|
|
|
11 |
const { withViewportMatch } = wp.viewport;
|
12 |
const { compose } = wp.compose;
|
13 |
|
@@ -321,7 +322,7 @@ class ImageEdit extends Component {
|
|
321 |
href
|
322 |
} = attributes;
|
323 |
const toolbarEditButton = (
|
324 |
-
<Toolbar>
|
325 |
<IconButton
|
326 |
className="ta-edit-image-button components-icon-button components-toolbar__control"
|
327 |
label={ __( 'Edit ThirstyAffiliates Image' ) }
|
5 |
const { __, sprintf } = wp.i18n;
|
6 |
const { Component, Fragment , createRef } = wp.element;
|
7 |
const { getBlobByURL, revokeBlobURL, isBlobURL } = wp.blob;
|
8 |
+
const { Placeholder , Button , ButtonGroup , IconButton , PanelBody , ResizableBox , SelectControl , Spinner , TextControl , TextareaControl , Toolbar , withNotices } = wp.components;
|
9 |
const { withSelect } = wp.data;
|
10 |
+
const { mediaUpload } = wp.editor;
|
11 |
+
const { InspectorControls , BlockControls , RichText , BlockAlignmentToolbar } = wp.blockEditor;
|
12 |
const { withViewportMatch } = wp.viewport;
|
13 |
const { compose } = wp.compose;
|
14 |
|
322 |
href
|
323 |
} = attributes;
|
324 |
const toolbarEditButton = (
|
325 |
+
<Toolbar label={ __( 'ThirstyAffiliates Image Settings' ) }>
|
326 |
<IconButton
|
327 |
className="ta-edit-image-button components-icon-button components-toolbar__control"
|
328 |
label={ __( 'Edit ThirstyAffiliates Image' ) }
|
js/app/gutenberg_support/src/blocks/ta-image/index.js
CHANGED
@@ -2,8 +2,8 @@ import classnames from "classnames";
|
|
2 |
|
3 |
const { Fragment } = wp.element;
|
4 |
const { __ } = wp.i18n;
|
5 |
-
const {
|
6 |
-
const { RichText } = wp.
|
7 |
const { Path , SVG } = wp.components;
|
8 |
|
9 |
import edit from "./edit";
|
@@ -171,4 +171,4 @@ export const settings = {
|
|
171 |
</figure>
|
172 |
);
|
173 |
}
|
174 |
-
};
|
2 |
|
3 |
const { Fragment } = wp.element;
|
4 |
const { __ } = wp.i18n;
|
5 |
+
const { getPhrasingContentSchema } = wp.dom;
|
6 |
+
const { RichText } = wp.blockEditor;
|
7 |
const { Path , SVG } = wp.components;
|
8 |
|
9 |
import edit from "./edit";
|
171 |
</figure>
|
172 |
);
|
173 |
}
|
174 |
+
};
|
js/app/gutenberg_support/src/blocks/ta-image/search-input.js
CHANGED
@@ -225,4 +225,4 @@ class ThirstyURLInput extends Component {
|
|
225 |
}
|
226 |
}
|
227 |
|
228 |
-
export default withSpokenMessages( withInstanceId( ThirstyURLInput ) );
|
225 |
}
|
226 |
}
|
227 |
|
228 |
+
export default withSpokenMessages( withInstanceId( ThirstyURLInput ) );
|
js/app/gutenberg_support/src/formats/ta-link/index.js
CHANGED
@@ -5,17 +5,18 @@ const { Component , Fragment } = wp.element;
|
|
5 |
const { withSpokenMessages } = wp.components;
|
6 |
const { getTextContent , applyFormat , removeFormat , slice } = wp.richText;
|
7 |
const { isURL } = wp.url;
|
8 |
-
const { RichTextToolbarButton , RichTextShortcut } = wp.
|
9 |
const { Path , SVG } = wp.components;
|
10 |
const { getRectangleFromRange } = wp.dom;
|
11 |
|
12 |
const name = "ta/link";
|
|
|
13 |
|
14 |
/**
|
15 |
* Custom Affiliate link format. When applied will wrap selected text with <ta href="" linkid=""></ta> custom element.
|
16 |
* Custom element is implemented here as we are not allowed to use <a> tag due to Gutenberg limitations.
|
17 |
* Element is converted to normal <a> tag on frontend via PHP script filtered on 'the_content'.
|
18 |
-
*
|
19 |
* @since 3.6
|
20 |
*/
|
21 |
export const taLink = {
|
@@ -28,10 +29,10 @@ export const taLink = {
|
|
28 |
target : "target"
|
29 |
},
|
30 |
edit : withSpokenMessages( class LinkEdit extends Component {
|
31 |
-
|
32 |
/**
|
33 |
* Component constructor.
|
34 |
-
*
|
35 |
* @since 3.6
|
36 |
*/
|
37 |
constructor() {
|
@@ -47,7 +48,7 @@ export const taLink = {
|
|
47 |
|
48 |
/**
|
49 |
* Callback to set state to adding link status.
|
50 |
-
*
|
51 |
* @since 3.6
|
52 |
*/
|
53 |
addLink() {
|
@@ -64,7 +65,7 @@ export const taLink = {
|
|
64 |
|
65 |
/**
|
66 |
* Callback to set state to stop adding link status.
|
67 |
-
*
|
68 |
* @since 3.6
|
69 |
*/
|
70 |
stopAddingLink() {
|
@@ -73,7 +74,7 @@ export const taLink = {
|
|
73 |
|
74 |
/**
|
75 |
* Remove format event callback.
|
76 |
-
*
|
77 |
* @since 3.6
|
78 |
*/
|
79 |
onRemoveFormat() {
|
@@ -85,7 +86,7 @@ export const taLink = {
|
|
85 |
|
86 |
/**
|
87 |
* Get selected anchor text.
|
88 |
-
*
|
89 |
* @since 3.9
|
90 |
*/
|
91 |
getAnchorRect() {
|
@@ -95,6 +96,11 @@ export const taLink = {
|
|
95 |
|
96 |
if ( ! range ) return;
|
97 |
|
|
|
|
|
|
|
|
|
|
|
98 |
let rect = null;
|
99 |
|
100 |
if ( this.state.addingLink ) {
|
@@ -114,15 +120,17 @@ export const taLink = {
|
|
114 |
if ( closest ) {
|
115 |
rect = closest.getBoundingClientRect();
|
116 |
}
|
117 |
-
|
118 |
}
|
119 |
|
|
|
|
|
120 |
return rect;
|
121 |
}
|
122 |
|
123 |
/**
|
124 |
* Component render method.
|
125 |
-
*
|
126 |
* @since 3.6
|
127 |
*/
|
128 |
render() {
|
@@ -169,7 +177,7 @@ export const taLink = {
|
|
169 |
stopAddingLink={ this.stopAddingLink }
|
170 |
isActive={ isActive }
|
171 |
activeAttributes={ activeAttributes }
|
172 |
-
|
173 |
value={ value }
|
174 |
onChange={ onChange }
|
175 |
/>
|
@@ -177,4 +185,4 @@ export const taLink = {
|
|
177 |
);
|
178 |
}
|
179 |
} )
|
180 |
-
}
|
5 |
const { withSpokenMessages } = wp.components;
|
6 |
const { getTextContent , applyFormat , removeFormat , slice } = wp.richText;
|
7 |
const { isURL } = wp.url;
|
8 |
+
const { RichTextToolbarButton , RichTextShortcut } = wp.blockEditor;
|
9 |
const { Path , SVG } = wp.components;
|
10 |
const { getRectangleFromRange } = wp.dom;
|
11 |
|
12 |
const name = "ta/link";
|
13 |
+
let lastAnchorRect = null;
|
14 |
|
15 |
/**
|
16 |
* Custom Affiliate link format. When applied will wrap selected text with <ta href="" linkid=""></ta> custom element.
|
17 |
* Custom element is implemented here as we are not allowed to use <a> tag due to Gutenberg limitations.
|
18 |
* Element is converted to normal <a> tag on frontend via PHP script filtered on 'the_content'.
|
19 |
+
*
|
20 |
* @since 3.6
|
21 |
*/
|
22 |
export const taLink = {
|
29 |
target : "target"
|
30 |
},
|
31 |
edit : withSpokenMessages( class LinkEdit extends Component {
|
32 |
+
|
33 |
/**
|
34 |
* Component constructor.
|
35 |
+
*
|
36 |
* @since 3.6
|
37 |
*/
|
38 |
constructor() {
|
48 |
|
49 |
/**
|
50 |
* Callback to set state to adding link status.
|
51 |
+
*
|
52 |
* @since 3.6
|
53 |
*/
|
54 |
addLink() {
|
65 |
|
66 |
/**
|
67 |
* Callback to set state to stop adding link status.
|
68 |
+
*
|
69 |
* @since 3.6
|
70 |
*/
|
71 |
stopAddingLink() {
|
74 |
|
75 |
/**
|
76 |
* Remove format event callback.
|
77 |
+
*
|
78 |
* @since 3.6
|
79 |
*/
|
80 |
onRemoveFormat() {
|
86 |
|
87 |
/**
|
88 |
* Get selected anchor text.
|
89 |
+
*
|
90 |
* @since 3.9
|
91 |
*/
|
92 |
getAnchorRect() {
|
96 |
|
97 |
if ( ! range ) return;
|
98 |
|
99 |
+
// Fix for the link UI jumping around the screen on WP 5.6
|
100 |
+
if(selection.anchorNode.nodeType !== window.Node.TEXT_NODE) {
|
101 |
+
return lastAnchorRect;
|
102 |
+
}
|
103 |
+
|
104 |
let rect = null;
|
105 |
|
106 |
if ( this.state.addingLink ) {
|
120 |
if ( closest ) {
|
121 |
rect = closest.getBoundingClientRect();
|
122 |
}
|
123 |
+
|
124 |
}
|
125 |
|
126 |
+
lastAnchorRect = rect;
|
127 |
+
|
128 |
return rect;
|
129 |
}
|
130 |
|
131 |
/**
|
132 |
* Component render method.
|
133 |
+
*
|
134 |
* @since 3.6
|
135 |
*/
|
136 |
render() {
|
177 |
stopAddingLink={ this.stopAddingLink }
|
178 |
isActive={ isActive }
|
179 |
activeAttributes={ activeAttributes }
|
180 |
+
anchorRect={ anchorRect }
|
181 |
value={ value }
|
182 |
onChange={ onChange }
|
183 |
/>
|
185 |
);
|
186 |
}
|
187 |
} )
|
188 |
+
}
|
js/app/gutenberg_support/src/formats/ta-link/inline.js
CHANGED
@@ -14,7 +14,7 @@ const stopKeyPropagation = ( event ) => event.stopPropagation();
|
|
14 |
|
15 |
/**
|
16 |
* Generates the format object that will be applied to the link text.
|
17 |
-
*
|
18 |
* @since 3.6
|
19 |
*
|
20 |
* @param {string} url The href of the link.
|
@@ -37,9 +37,9 @@ function createLinkFormat( { url , linkid , text } ) {
|
|
37 |
|
38 |
/**
|
39 |
* Check if input is being show.
|
40 |
-
*
|
41 |
* @since 3.6
|
42 |
-
*
|
43 |
* @param {Object} props Component props.
|
44 |
* @param {Object} state Component state.
|
45 |
*/
|
@@ -49,9 +49,9 @@ function isShowingInput( props , state ) {
|
|
49 |
|
50 |
/**
|
51 |
* Affiliate Link editor JSX element.
|
52 |
-
*
|
53 |
* @since 3.6
|
54 |
-
*
|
55 |
* @param {Object} param0 Component props (destructred).
|
56 |
*/
|
57 |
const LinkEditor = ( { value , onChangeInputValue , onKeyDown , submitLink, invalidLink , resetInvalidLink , autocompleteRef } ) => (
|
@@ -77,7 +77,7 @@ const LinkEditor = ( { value , onChangeInputValue , onKeyDown , submitLink, inva
|
|
77 |
|
78 |
/**
|
79 |
* Affiliate link url viewer JSX element.
|
80 |
-
*
|
81 |
* @param {*} param0 Component props (destructred).
|
82 |
*/
|
83 |
const LinkViewerUrl = ( { url } ) => {
|
@@ -102,7 +102,7 @@ const LinkViewerUrl = ( { url } ) => {
|
|
102 |
|
103 |
/**
|
104 |
* Affiliate link viewer JSX element.
|
105 |
-
*
|
106 |
* @param {*} param0 Component props (destructred).
|
107 |
*/
|
108 |
const LinkViewer = ( { url, editLink } ) => {
|
@@ -122,9 +122,9 @@ const LinkViewer = ( { url, editLink } ) => {
|
|
122 |
|
123 |
/**
|
124 |
* Inline affiliate link UI Component.
|
125 |
-
*
|
126 |
* @since 3.6
|
127 |
-
*
|
128 |
* @param {*} param0 Component props (destructred).
|
129 |
*/
|
130 |
class InlineAffiliateLinkUI extends Component {
|
@@ -150,9 +150,9 @@ class InlineAffiliateLinkUI extends Component {
|
|
150 |
|
151 |
/**
|
152 |
* Stop the key event from propagating up to ObserveTyping.startTypingInTextField.
|
153 |
-
*
|
154 |
* @since 3.6
|
155 |
-
*
|
156 |
* @param {Object} event Event object.
|
157 |
*/
|
158 |
onKeyDown( event ) {
|
@@ -163,11 +163,11 @@ class InlineAffiliateLinkUI extends Component {
|
|
163 |
|
164 |
/**
|
165 |
* Callback to set state when input value is changed.
|
166 |
-
*
|
167 |
* @since 3.6
|
168 |
-
*
|
169 |
-
* @param {*} inputValue
|
170 |
-
* @param {*} post
|
171 |
*/
|
172 |
onChangeInputValue( inputValue , post = null ) {
|
173 |
const linkid = post ? post.id : 0;
|
@@ -176,10 +176,10 @@ class InlineAffiliateLinkUI extends Component {
|
|
176 |
|
177 |
/**
|
178 |
* Callback to set state when edit affiliate link (already inserted) is triggered.
|
179 |
-
*
|
180 |
* @since 3.6
|
181 |
-
*
|
182 |
-
* @param {*} event
|
183 |
*/
|
184 |
editLink( event ) {
|
185 |
this.setState( { editLink: true } );
|
@@ -188,10 +188,10 @@ class InlineAffiliateLinkUI extends Component {
|
|
188 |
|
189 |
/**
|
190 |
* Callback to apply the affiliate link format to the selected text or position in the active block.
|
191 |
-
*
|
192 |
* @since 3.6
|
193 |
-
*
|
194 |
-
* @param {*} event
|
195 |
*/
|
196 |
submitLink( event ) {
|
197 |
const { isActive, value, onChange, speak } = this.props;
|
@@ -209,7 +209,7 @@ class InlineAffiliateLinkUI extends Component {
|
|
209 |
if ( ! linkid || ! post ) {
|
210 |
this.setState( { invalidLink : true } )
|
211 |
return;
|
212 |
-
}
|
213 |
|
214 |
if ( isCollapsed( value ) && ! isActive ) {
|
215 |
const toInsert = applyFormat( create( { text: post.title } ), format, 0, url.length );
|
@@ -231,10 +231,10 @@ class InlineAffiliateLinkUI extends Component {
|
|
231 |
|
232 |
/**
|
233 |
* Callback to run when users clicks outside the popover UI.
|
234 |
-
*
|
235 |
* @since 3.6
|
236 |
-
*
|
237 |
-
* @param {*} event
|
238 |
*/
|
239 |
onClickOutside( event ) {
|
240 |
// The autocomplete suggestions list renders in a separate popover (in a portal),
|
@@ -251,7 +251,7 @@ class InlineAffiliateLinkUI extends Component {
|
|
251 |
|
252 |
/**
|
253 |
* Reset state callback.
|
254 |
-
*
|
255 |
* @since 3.6
|
256 |
*/
|
257 |
resetState() {
|
@@ -262,7 +262,7 @@ class InlineAffiliateLinkUI extends Component {
|
|
262 |
|
263 |
/**
|
264 |
* Reset invalid link state callback. Separated as we need to run this independently from resetState() callback.
|
265 |
-
*
|
266 |
* @since 3.6
|
267 |
*/
|
268 |
resetInvalidLink() {
|
@@ -290,7 +290,7 @@ class InlineAffiliateLinkUI extends Component {
|
|
290 |
onClose={ this.resetState }
|
291 |
focusOnMount={ showInput ? 'firstElement' : false }
|
292 |
invalidLink={ invalidLink }
|
293 |
-
|
294 |
>
|
295 |
{ showInput ? (
|
296 |
<LinkEditor
|
@@ -314,4 +314,4 @@ class InlineAffiliateLinkUI extends Component {
|
|
314 |
}
|
315 |
}
|
316 |
|
317 |
-
export default withSpokenMessages( InlineAffiliateLinkUI );
|
14 |
|
15 |
/**
|
16 |
* Generates the format object that will be applied to the link text.
|
17 |
+
*
|
18 |
* @since 3.6
|
19 |
*
|
20 |
* @param {string} url The href of the link.
|
37 |
|
38 |
/**
|
39 |
* Check if input is being show.
|
40 |
+
*
|
41 |
* @since 3.6
|
42 |
+
*
|
43 |
* @param {Object} props Component props.
|
44 |
* @param {Object} state Component state.
|
45 |
*/
|
49 |
|
50 |
/**
|
51 |
* Affiliate Link editor JSX element.
|
52 |
+
*
|
53 |
* @since 3.6
|
54 |
+
*
|
55 |
* @param {Object} param0 Component props (destructred).
|
56 |
*/
|
57 |
const LinkEditor = ( { value , onChangeInputValue , onKeyDown , submitLink, invalidLink , resetInvalidLink , autocompleteRef } ) => (
|
77 |
|
78 |
/**
|
79 |
* Affiliate link url viewer JSX element.
|
80 |
+
*
|
81 |
* @param {*} param0 Component props (destructred).
|
82 |
*/
|
83 |
const LinkViewerUrl = ( { url } ) => {
|
102 |
|
103 |
/**
|
104 |
* Affiliate link viewer JSX element.
|
105 |
+
*
|
106 |
* @param {*} param0 Component props (destructred).
|
107 |
*/
|
108 |
const LinkViewer = ( { url, editLink } ) => {
|
122 |
|
123 |
/**
|
124 |
* Inline affiliate link UI Component.
|
125 |
+
*
|
126 |
* @since 3.6
|
127 |
+
*
|
128 |
* @param {*} param0 Component props (destructred).
|
129 |
*/
|
130 |
class InlineAffiliateLinkUI extends Component {
|
150 |
|
151 |
/**
|
152 |
* Stop the key event from propagating up to ObserveTyping.startTypingInTextField.
|
153 |
+
*
|
154 |
* @since 3.6
|
155 |
+
*
|
156 |
* @param {Object} event Event object.
|
157 |
*/
|
158 |
onKeyDown( event ) {
|
163 |
|
164 |
/**
|
165 |
* Callback to set state when input value is changed.
|
166 |
+
*
|
167 |
* @since 3.6
|
168 |
+
*
|
169 |
+
* @param {*} inputValue
|
170 |
+
* @param {*} post
|
171 |
*/
|
172 |
onChangeInputValue( inputValue , post = null ) {
|
173 |
const linkid = post ? post.id : 0;
|
176 |
|
177 |
/**
|
178 |
* Callback to set state when edit affiliate link (already inserted) is triggered.
|
179 |
+
*
|
180 |
* @since 3.6
|
181 |
+
*
|
182 |
+
* @param {*} event
|
183 |
*/
|
184 |
editLink( event ) {
|
185 |
this.setState( { editLink: true } );
|
188 |
|
189 |
/**
|
190 |
* Callback to apply the affiliate link format to the selected text or position in the active block.
|
191 |
+
*
|
192 |
* @since 3.6
|
193 |
+
*
|
194 |
+
* @param {*} event
|
195 |
*/
|
196 |
submitLink( event ) {
|
197 |
const { isActive, value, onChange, speak } = this.props;
|
209 |
if ( ! linkid || ! post ) {
|
210 |
this.setState( { invalidLink : true } )
|
211 |
return;
|
212 |
+
}
|
213 |
|
214 |
if ( isCollapsed( value ) && ! isActive ) {
|
215 |
const toInsert = applyFormat( create( { text: post.title } ), format, 0, url.length );
|
231 |
|
232 |
/**
|
233 |
* Callback to run when users clicks outside the popover UI.
|
234 |
+
*
|
235 |
* @since 3.6
|
236 |
+
*
|
237 |
+
* @param {*} event
|
238 |
*/
|
239 |
onClickOutside( event ) {
|
240 |
// The autocomplete suggestions list renders in a separate popover (in a portal),
|
251 |
|
252 |
/**
|
253 |
* Reset state callback.
|
254 |
+
*
|
255 |
* @since 3.6
|
256 |
*/
|
257 |
resetState() {
|
262 |
|
263 |
/**
|
264 |
* Reset invalid link state callback. Separated as we need to run this independently from resetState() callback.
|
265 |
+
*
|
266 |
* @since 3.6
|
267 |
*/
|
268 |
resetInvalidLink() {
|
290 |
onClose={ this.resetState }
|
291 |
focusOnMount={ showInput ? 'firstElement' : false }
|
292 |
invalidLink={ invalidLink }
|
293 |
+
anchorRect={ anchorRect }
|
294 |
>
|
295 |
{ showInput ? (
|
296 |
<LinkEditor
|
314 |
}
|
315 |
}
|
316 |
|
317 |
+
export default withSpokenMessages( InlineAffiliateLinkUI );
|
js/app/gutenberg_support/src/formats/ta-link/url-input.js
CHANGED
@@ -356,4 +356,4 @@ class ThirstyURLInput extends Component {
|
|
356 |
}
|
357 |
}
|
358 |
|
359 |
-
export default withSpokenMessages( withInstanceId( ThirstyURLInput ) );
|
356 |
}
|
357 |
}
|
358 |
|
359 |
+
export default withSpokenMessages( withInstanceId( ThirstyURLInput ) );
|
js/app/ta-editor.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
var ThirstyLinkPicker;
|
2 |
|
3 |
jQuery( document ).ready( function($) {
|
4 |
|
@@ -89,7 +89,7 @@ jQuery( document ).ready( function($) {
|
|
89 |
|
90 |
/**
|
91 |
* Remove placeholders.
|
92 |
-
*
|
93 |
* @since 3.5
|
94 |
*/
|
95 |
removePlaceholders : function() {
|
@@ -107,7 +107,7 @@ jQuery( document ).ready( function($) {
|
|
107 |
$element.attr( 'data-thirstylink-edit', null );
|
108 |
}
|
109 |
});
|
110 |
-
|
111 |
editor.$( '.temp-ta-node' ).each( function( i, element ) {
|
112 |
var $element = editor.$( element );
|
113 |
$element.replaceWith( $element.html() );
|
1 |
+
var ThirstyLinkPicker = {};
|
2 |
|
3 |
jQuery( document ).ready( function($) {
|
4 |
|
89 |
|
90 |
/**
|
91 |
* Remove placeholders.
|
92 |
+
*
|
93 |
* @since 3.5
|
94 |
*/
|
95 |
removePlaceholders : function() {
|
107 |
$element.attr( 'data-thirstylink-edit', null );
|
108 |
}
|
109 |
});
|
110 |
+
|
111 |
editor.$( '.temp-ta-node' ).each( function( i, element ) {
|
112 |
var $element = editor.$( element );
|
113 |
$element.replaceWith( $element.html() );
|
js/lib/selectize/selectize.min.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
/*! selectize.js - v0.12.4 | https://github.com/selectize/selectize.js | Apache License (v2) */
|
2 |
-
!function(a,b){"function"==typeof define&&define.amd?define("sifter",b):"object"==typeof exports?module.exports=b():a.Sifter=b()}(this,function(){var a=function(a,b){this.items=a,this.settings=b||{diacritics:!0}};a.prototype.tokenize=function(a){if(a=e(String(a||"").toLowerCase()),!a||!a.length)return[];var b,c,d,g,i=[],j=a.split(/ +/);for(b=0,c=j.length;b<c;b++){if(d=f(j[b]),this.settings.diacritics)for(g in h)h.hasOwnProperty(g)&&(d=d.replace(new RegExp(g,"g"),h[g]));i.push({string:j[b],regex:new RegExp(d,"i")})}return i},a.prototype.iterator=function(a,b){var c;c=g(a)?Array.prototype.forEach||function(a){for(var b=0,c=this.length;b<c;b++)a(this[b],b,this)}:function(a){for(var b in this)this.hasOwnProperty(b)&&a(this[b],b,this)},c.apply(a,[b])},a.prototype.getScoreFunction=function(a,b){var c,e,f,g,h;c=this,a=c.prepareSearch(a,b),f=a.tokens,e=a.options.fields,g=f.length,h=a.options.nesting;var i=function(a,b){var c,d;return a?(a=String(a||""),d=a.search(b.regex),d===-1?0:(c=b.string.length/a.length,0===d&&(c+=.5),c)):0},j=function(){var a=e.length;return a?1===a?function(a,b){return i(d(b,e[0],h),a)}:function(b,c){for(var f=0,g=0;f<a;f++)g+=i(d(c,e[f],h),b);return g/a}:function(){return 0}}();return g?1===g?function(a){return j(f[0],a)}:"and"===a.options.conjunction?function(a){for(var b,c=0,d=0;c<g;c++){if(b=j(f[c],a),b<=0)return 0;d+=b}return d/g}:function(a){for(var b=0,c=0;b<g;b++)c+=j(f[b],a);return c/g}:function(){return 0}},a.prototype.getSortFunction=function(a,c){var e,f,g,h,i,j,k,l,m,n,o;if(g=this,a=g.prepareSearch(a,c),o=!a.query&&c.sort_empty||c.sort,m=function(a,b){return"$score"===a?b.score:d(g.items[b.id],a,c.nesting)},i=[],o)for(e=0,f=o.length;e<f;e++)(a.query||"$score"!==o[e].field)&&i.push(o[e]);if(a.query){for(n=!0,e=0,f=i.length;e<f;e++)if("$score"===i[e].field){n=!1;break}n&&i.unshift({field:"$score",direction:"desc"})}else for(e=0,f=i.length;e<f;e++)if("$score"===i[e].field){i.splice(e,1);break}for(l=[],e=0,f=i.length;e<f;e++)l.push("desc"===i[e].direction?-1:1);return j=i.length,j?1===j?(h=i[0].field,k=l[0],function(a,c){return k*b(m(h,a),m(h,c))}):function(a,c){var d,e,f;for(d=0;d<j;d++)if(f=i[d].field,e=l[d]*b(m(f,a),m(f,c)))return e;return 0}:null},a.prototype.prepareSearch=function(a,b){if("object"==typeof a)return a;b=c({},b);var d=b.fields,e=b.sort,f=b.sort_empty;return d&&!g(d)&&(b.fields=[d]),e&&!g(e)&&(b.sort=[e]),f&&!g(f)&&(b.sort_empty=[f]),{options:b,query:String(a||"").toLowerCase(),tokens:this.tokenize(a),total:0,items:[]}},a.prototype.search=function(a,b){var c,d,e,f,g=this;return d=this.prepareSearch(a,b),b=d.options,a=d.query,f=b.score||g.getScoreFunction(d),a.length?g.iterator(g.items,function(a,e){c=f(a),(b.filter===!1||c>0)&&d.items.push({score:c,id:e})}):g.iterator(g.items,function(a,b){d.items.push({score:1,id:b})}),e=g.getSortFunction(d,b),e&&d.items.sort(e),d.total=d.items.length,"number"==typeof b.limit&&(d.items=d.items.slice(0,b.limit)),d};var b=function(a,b){return"number"==typeof a&&"number"==typeof b?a>b?1:a<b?-1:0:(a=i(String(a||"")),b=i(String(b||"")),a>b?1:b>a?-1:0)},c=function(a,b){var c,d,e,f;for(c=1,d=arguments.length;c<d;c++)if(f=arguments[c])for(e in f)f.hasOwnProperty(e)&&(a[e]=f[e]);return a},d=function(a,b,c){if(a&&b){if(!c)return a[b];for(var d=b.split(".");d.length&&(a=a[d.shift()]););return a}},e=function(a){return(a+"").replace(/^\s+|\s+$|/g,"")},f=function(a){return(a+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},g=Array.isArray||"undefined"!=typeof $&&$.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},h={a:"[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]",b:"[b␢βΒB฿𐌁ᛒ]",c:"[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]",d:"[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]",e:"[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]",f:"[fƑƒḞḟ]",g:"[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]",h:"[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]",i:"[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]",j:"[jȷĴĵɈɉʝɟʲ]",k:"[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]",l:"[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]",n:"[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]",o:"[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]",p:"[pṔṕṖṗⱣᵽƤƥᵱ]",q:"[qꝖꝗʠɊɋꝘꝙq̃]",r:"[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]",s:"[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]",t:"[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]",u:"[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]",v:"[vṼṽṾṿƲʋꝞꝟⱱʋ]",w:"[wẂẃẀẁŴŵẄẅẆẇẈẉ]",x:"[xẌẍẊẋχ]",y:"[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]",z:"[zŹźẐẑŽžŻżẒẓẔẕƵƶ]"},i=function(){var a,b,c,d,e="",f={};for(c in h)if(h.hasOwnProperty(c))for(d=h[c].substring(2,h[c].length-1),e+=d,a=0,b=d.length;a<b;a++)f[d.charAt(a)]=c;var g=new RegExp("["+e+"]","g");return function(a){return a.replace(g,function(a){return f[a]}).toLowerCase()}}();return a}),function(a,b){"function"==typeof define&&define.amd?define("microplugin",b):"object"==typeof exports?module.exports=b():a.MicroPlugin=b()}(this,function(){var a={};a.mixin=function(a){a.plugins={},a.prototype.initializePlugins=function(a){var c,d,e,f=this,g=[];if(f.plugins={names:[],settings:{},requested:{},loaded:{}},b.isArray(a))for(c=0,d=a.length;c<d;c++)"string"==typeof a[c]?g.push(a[c]):(f.plugins.settings[a[c].name]=a[c].options,g.push(a[c].name));else if(a)for(e in a)a.hasOwnProperty(e)&&(f.plugins.settings[e]=a[e],g.push(e));for(;g.length;)f.require(g.shift())},a.prototype.loadPlugin=function(b){var c=this,d=c.plugins,e=a.plugins[b];if(!a.plugins.hasOwnProperty(b))throw new Error('Unable to find "'+b+'" plugin');d.requested[b]=!0,d.loaded[b]=e.fn.apply(c,[c.plugins.settings[b]||{}]),d.names.push(b)},a.prototype.require=function(a){var b=this,c=b.plugins;if(!b.plugins.loaded.hasOwnProperty(a)){if(c.requested[a])throw new Error('Plugin has circular dependency ("'+a+'")');b.loadPlugin(a)}return c.loaded[a]},a.define=function(b,c){a.plugins[b]={name:b,fn:c}}};var b={isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}};return a}),function(a,b){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],b):"object"==typeof exports?module.exports=b(require("jquery"),require("sifter"),require("microplugin")):a.Selectize=b(a.jQuery,a.Sifter,a.MicroPlugin)}(this,function(a,b,c){"use strict";var d=function(a,b){if("string"!=typeof b||b.length){var c="string"==typeof b?new RegExp(b,"i"):b,d=function(a){var b=0;if(3===a.nodeType){var e=a.data.search(c);if(e>=0&&a.data.length>0){var f=a.data.match(c),g=document.createElement("span");g.className="highlight";var h=a.splitText(e),i=(h.splitText(f[0].length),h.cloneNode(!0));g.appendChild(i),h.parentNode.replaceChild(g,h),b=1}}else if(1===a.nodeType&&a.childNodes&&!/(script|style)/i.test(a.tagName))for(var j=0;j<a.childNodes.length;++j)j+=d(a.childNodes[j]);return b};return a.each(function(){d(this)})}};a.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;var a=this.parentNode;a.replaceChild(this.firstChild,this),a.normalize()}).end()};var e=function(){};e.prototype={on:function(a,b){this._events=this._events||{},this._events[a]=this._events[a]||[],this._events[a].push(b)},off:function(a,b){var c=arguments.length;return 0===c?delete this._events:1===c?delete this._events[a]:(this._events=this._events||{},void(a in this._events!=!1&&this._events[a].splice(this._events[a].indexOf(b),1)))},trigger:function(a){if(this._events=this._events||{},a in this._events!=!1)for(var b=0;b<this._events[a].length;b++)this._events[a][b].apply(this,Array.prototype.slice.call(arguments,1))}},e.mixin=function(a){for(var b=["on","off","trigger"],c=0;c<b.length;c++)a.prototype[b[c]]=e.prototype[b[c]]};var f=/Mac/.test(navigator.userAgent),g=65,h=13,i=27,j=37,k=38,l=80,m=39,n=40,o=78,p=8,q=46,r=16,s=f?91:17,t=f?18:17,u=9,v=1,w=2,x=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("input").validity,y=function(a){return"undefined"!=typeof a},z=function(a){return"undefined"==typeof a||null===a?null:"boolean"==typeof a?a?"1":"0":a+""},A=function(a){return(a+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},B={};B.before=function(a,b,c){var d=a[b];a[b]=function(){return c.apply(a,arguments),d.apply(a,arguments)}},B.after=function(a,b,c){var d=a[b];a[b]=function(){var b=d.apply(a,arguments);return c.apply(a,arguments),b}};var C=function(a){var b=!1;return function(){b||(b=!0,a.apply(this,arguments))}},D=function(a,b){var c;return function(){var d=this,e=arguments;window.clearTimeout(c),c=window.setTimeout(function(){a.apply(d,e)},b)}},E=function(a,b,c){var d,e=a.trigger,f={};a.trigger=function(){var c=arguments[0];return b.indexOf(c)===-1?e.apply(a,arguments):void(f[c]=arguments)},c.apply(a,[]),a.trigger=e;for(d in f)f.hasOwnProperty(d)&&e.apply(a,f[d])},F=function(a,b,c,d){a.on(b,c,function(b){for(var c=b.target;c&&c.parentNode!==a[0];)c=c.parentNode;return b.currentTarget=c,d.apply(this,[b])})},G=function(a){var b={};if("selectionStart"in a)b.start=a.selectionStart,b.length=a.selectionEnd-b.start;else if(document.selection){a.focus();var c=document.selection.createRange(),d=document.selection.createRange().text.length;c.moveStart("character",-a.value.length),b.start=c.text.length-d,b.length=d}return b},H=function(a,b,c){var d,e,f={};if(c)for(d=0,e=c.length;d<e;d++)f[c[d]]=a.css(c[d]);else f=a.css();b.css(f)},I=function(b,c){if(!b)return 0;var d=a("<test>").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).text(b).appendTo("body");H(c,d,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]);var e=d.width();return d.remove(),e},J=function(a){var b=null,c=function(c,d){var e,f,g,h,i,j,k,l;c=c||window.event||{},d=d||{},c.metaKey||c.altKey||(d.force||a.data("grow")!==!1)&&(e=a.val(),c.type&&"keydown"===c.type.toLowerCase()&&(f=c.keyCode,g=f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||32===f,f===q||f===p?(l=G(a[0]),l.length?e=e.substring(0,l.start)+e.substring(l.start+l.length):f===p&&l.start?e=e.substring(0,l.start-1)+e.substring(l.start+1):f===q&&"undefined"!=typeof l.start&&(e=e.substring(0,l.start)+e.substring(l.start+1))):g&&(j=c.shiftKey,k=String.fromCharCode(c.keyCode),k=j?k.toUpperCase():k.toLowerCase(),e+=k)),h=a.attr("placeholder"),!e&&h&&(e=h),i=I(e,a)+4,i!==b&&(b=i,a.width(i),a.triggerHandler("resize")))};a.on("keydown keyup update blur",c),c()},K=function(a){var b=document.createElement("div");return b.appendChild(a.cloneNode(!0)),b.innerHTML},L=function(a,b){b||(b={});var c="Selectize";console.error(c+": "+a),b.explanation&&(console.group&&console.group(),console.error(b.explanation),console.group&&console.groupEnd())},M=function(c,d){var e,f,g,h,i=this;h=c[0],h.selectize=i;var j=window.getComputedStyle&&window.getComputedStyle(h,null);if(g=j?j.getPropertyValue("direction"):h.currentStyle&&h.currentStyle.direction,g=g||c.parents("[dir]:first").attr("dir")||"",a.extend(i,{order:0,settings:d,$input:c,tabIndex:c.attr("tabindex")||"",tagType:"select"===h.tagName.toLowerCase()?v:w,rtl:/rtl/i.test(g),eventNS:".selectize"+ ++M.count,highlightedValue:null,isOpen:!1,isDisabled:!1,isRequired:c.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===d.loadThrottle?i.onSearchChange:D(i.onSearchChange,d.loadThrottle)}),i.sifter=new b(this.options,{diacritics:d.diacritics}),i.settings.options){for(e=0,f=i.settings.options.length;e<f;e++)i.registerOption(i.settings.options[e]);delete i.settings.options}if(i.settings.optgroups){for(e=0,f=i.settings.optgroups.length;e<f;e++)i.registerOptionGroup(i.settings.optgroups[e]);delete i.settings.optgroups}i.settings.mode=i.settings.mode||(1===i.settings.maxItems?"single":"multi"),"boolean"!=typeof i.settings.hideSelected&&(i.settings.hideSelected="multi"===i.settings.mode),i.initializePlugins(i.settings.plugins),i.setupCallbacks(),i.setupTemplates(),i.setup()};return e.mixin(M),"undefined"!=typeof c?c.mixin(M):L("Dependency MicroPlugin is missing",{explanation:'Make sure you either: (1) are using the "standalone" version of Selectize, or (2) require MicroPlugin before you load Selectize.'}),a.extend(M.prototype,{setup:function(){var b,c,d,e,g,h,i,j,k,l,m=this,n=m.settings,o=m.eventNS,p=a(window),q=a(document),u=m.$input;if(i=m.settings.mode,j=u.attr("class")||"",b=a("<div>").addClass(n.wrapperClass).addClass(j).addClass(i),c=a("<div>").addClass(n.inputClass).addClass("items").appendTo(b),d=a('<input type="text" autocomplete="off" />').appendTo(c).attr("tabindex",u.is(":disabled")?"-1":m.tabIndex),h=a(n.dropdownParent||b),e=a("<div>").addClass(n.dropdownClass).addClass(i).hide().appendTo(h),g=a("<div>").addClass(n.dropdownContentClass).appendTo(e),(l=u.attr("id"))&&(d.attr("id",l+"-selectized"),a("label[for='"+l+"']").attr("for",l+"-selectized")),m.settings.copyClassesToDropdown&&e.addClass(j),b.css({width:u[0].style.width}),m.plugins.names.length&&(k="plugin-"+m.plugins.names.join(" plugin-"),b.addClass(k),e.addClass(k)),(null===n.maxItems||n.maxItems>1)&&m.tagType===v&&u.attr("multiple","multiple"),m.settings.placeholder&&d.attr("placeholder",n.placeholder),!m.settings.splitOn&&m.settings.delimiter){var w=m.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");m.settings.splitOn=new RegExp("\\s*"+w+"+\\s*")}u.attr("autocorrect")&&d.attr("autocorrect",u.attr("autocorrect")),u.attr("autocapitalize")&&d.attr("autocapitalize",u.attr("autocapitalize")),m.$wrapper=b,m.$control=c,m.$control_input=d,m.$dropdown=e,m.$dropdown_content=g,e.on("mouseenter","[data-selectable]",function(){return m.onOptionHover.apply(m,arguments)}),e.on("mousedown click","[data-selectable]",function(){return m.onOptionSelect.apply(m,arguments)}),F(c,"mousedown","*:not(input)",function(){return m.onItemSelect.apply(m,arguments)}),J(d),c.on({mousedown:function(){return m.onMouseDown.apply(m,arguments)},click:function(){return m.onClick.apply(m,arguments)}}),d.on({mousedown:function(a){a.stopPropagation()},keydown:function(){return m.onKeyDown.apply(m,arguments)},keyup:function(){return m.onKeyUp.apply(m,arguments)},keypress:function(){return m.onKeyPress.apply(m,arguments)},resize:function(){m.positionDropdown.apply(m,[])},blur:function(){return m.onBlur.apply(m,arguments)},focus:function(){return m.ignoreBlur=!1,m.onFocus.apply(m,arguments)},paste:function(){return m.onPaste.apply(m,arguments)}}),q.on("keydown"+o,function(a){m.isCmdDown=a[f?"metaKey":"ctrlKey"],m.isCtrlDown=a[f?"altKey":"ctrlKey"],m.isShiftDown=a.shiftKey}),q.on("keyup"+o,function(a){a.keyCode===t&&(m.isCtrlDown=!1),a.keyCode===r&&(m.isShiftDown=!1),a.keyCode===s&&(m.isCmdDown=!1)}),q.on("mousedown"+o,function(a){if(m.isFocused){if(a.target===m.$dropdown[0]||a.target.parentNode===m.$dropdown[0])return!1;m.$control.has(a.target).length||a.target===m.$control[0]||m.blur(a.target)}}),p.on(["scroll"+o,"resize"+o].join(" "),function(){m.isOpen&&m.positionDropdown.apply(m,arguments)}),p.on("mousemove"+o,function(){m.ignoreHover=!1}),this.revertSettings={$children:u.children().detach(),tabindex:u.attr("tabindex")},u.attr("tabindex",-1).hide().after(m.$wrapper),a.isArray(n.items)&&(m.setValue(n.items),delete n.items),x&&u.on("invalid"+o,function(a){a.preventDefault(),m.isInvalid=!0,m.refreshState()}),m.updateOriginalInput(),m.refreshItems(),m.refreshState(),m.updatePlaceholder(),m.isSetup=!0,u.is(":disabled")&&m.disable(),m.on("change",this.onChange),u.data("selectize",m),u.addClass("selectized"),m.trigger("initialize"),n.preload===!0&&m.onSearchChange("")},setupTemplates:function(){var b=this,c=b.settings.labelField,d=b.settings.optgroupLabelField,e={optgroup:function(a){return'<div class="optgroup">'+a.html+"</div>"},optgroup_header:function(a,b){return'<div class="optgroup-header">'+b(a[d])+"</div>"},option:function(a,b){return'<div class="option">'+b(a[c])+"</div>"},item:function(a,b){return'<div class="item">'+b(a[c])+"</div>"},option_create:function(a,b){return'<div class="create">Add <strong>'+b(a.input)+"</strong>…</div>"}};b.settings.render=a.extend({},e,b.settings.render)},setupCallbacks:function(){var a,b,c={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(a in c)c.hasOwnProperty(a)&&(b=this.settings[c[a]],b&&this.on(a,b))},onClick:function(a){var b=this;b.isFocused||(b.focus(),a.preventDefault())},onMouseDown:function(b){var c=this,d=b.isDefaultPrevented();a(b.target);if(c.isFocused){if(b.target!==c.$control_input[0])return"single"===c.settings.mode?c.isOpen?c.close():c.open():d||c.setActiveItem(null),!1}else d||window.setTimeout(function(){c.focus()},0)},onChange:function(){this.$input.trigger("change")},onPaste:function(b){var c=this;return c.isFull()||c.isInputHidden||c.isLocked?void b.preventDefault():void(c.settings.splitOn&&setTimeout(function(){var b=c.$control_input.val();if(b.match(c.settings.splitOn))for(var d=a.trim(b).split(c.settings.splitOn),e=0,f=d.length;e<f;e++)c.createItem(d[e])},0))},onKeyPress:function(a){if(this.isLocked)return a&&a.preventDefault();var b=String.fromCharCode(a.keyCode||a.which);return this.settings.create&&"multi"===this.settings.mode&&b===this.settings.delimiter?(this.createItem(),a.preventDefault(),!1):void 0},onKeyDown:function(a){var b=(a.target===this.$control_input[0],this);if(b.isLocked)return void(a.keyCode!==u&&a.preventDefault());switch(a.keyCode){case g:if(b.isCmdDown)return void b.selectAll();break;case i:return void(b.isOpen&&(a.preventDefault(),a.stopPropagation(),b.close()));case o:if(!a.ctrlKey||a.altKey)break;case n:if(!b.isOpen&&b.hasOptions)b.open();else if(b.$activeOption){b.ignoreHover=!0;var c=b.getAdjacentOption(b.$activeOption,1);c.length&&b.setActiveOption(c,!0,!0)}return void a.preventDefault();case l:if(!a.ctrlKey||a.altKey)break;case k:if(b.$activeOption){b.ignoreHover=!0;var d=b.getAdjacentOption(b.$activeOption,-1);d.length&&b.setActiveOption(d,!0,!0)}return void a.preventDefault();case h:return void(b.isOpen&&b.$activeOption&&(b.onOptionSelect({currentTarget:b.$activeOption}),a.preventDefault()));case j:return void b.advanceSelection(-1,a);case m:return void b.advanceSelection(1,a);case u:return b.settings.selectOnTab&&b.isOpen&&b.$activeOption&&(b.onOptionSelect({currentTarget:b.$activeOption}),b.isFull()||a.preventDefault()),void(b.settings.create&&b.createItem()&&a.preventDefault());case p:case q:return void b.deleteSelection(a)}return!b.isFull()&&!b.isInputHidden||(f?a.metaKey:a.ctrlKey)?void 0:void a.preventDefault()},onKeyUp:function(a){var b=this;if(b.isLocked)return a&&a.preventDefault();var c=b.$control_input.val()||"";b.lastValue!==c&&(b.lastValue=c,b.onSearchChange(c),b.refreshOptions(),b.trigger("type",c))},onSearchChange:function(a){var b=this,c=b.settings.load;c&&(b.loadedSearches.hasOwnProperty(a)||(b.loadedSearches[a]=!0,b.load(function(d){c.apply(b,[a,d])})))},onFocus:function(a){var b=this,c=b.isFocused;return b.isDisabled?(b.blur(),a&&a.preventDefault(),!1):void(b.ignoreFocus||(b.isFocused=!0,"focus"===b.settings.preload&&b.onSearchChange(""),c||b.trigger("focus"),b.$activeItems.length||(b.showInput(),b.setActiveItem(null),b.refreshOptions(!!b.settings.openOnFocus)),b.refreshState()))},onBlur:function(a,b){var c=this;if(c.isFocused&&(c.isFocused=!1,!c.ignoreFocus)){if(!c.ignoreBlur&&document.activeElement===c.$dropdown_content[0])return c.ignoreBlur=!0,void c.onFocus(a);var d=function(){c.close(),c.setTextboxValue(""),c.setActiveItem(null),c.setActiveOption(null),c.setCaret(c.items.length),c.refreshState(),b&&b.focus&&b.focus(),c.ignoreFocus=!1,c.trigger("blur")};c.ignoreFocus=!0,c.settings.create&&c.settings.createOnBlur?c.createItem(null,!1,d):d()}},onOptionHover:function(a){this.ignoreHover||this.setActiveOption(a.currentTarget,!1)},onOptionSelect:function(b){var c,d,e=this;b.preventDefault&&(b.preventDefault(),b.stopPropagation()),d=a(b.currentTarget),d.hasClass("create")?e.createItem(null,function(){e.settings.closeAfterSelect&&e.close()}):(c=d.attr("data-value"),"undefined"!=typeof c&&(e.lastQuery=null,e.setTextboxValue(""),e.addItem(c),e.settings.closeAfterSelect?e.close():!e.settings.hideSelected&&b.type&&/mouse/.test(b.type)&&e.setActiveOption(e.getOption(c))))},onItemSelect:function(a){var b=this;b.isLocked||"multi"===b.settings.mode&&(a.preventDefault(),b.setActiveItem(a.currentTarget,a))},load:function(a){var b=this,c=b.$wrapper.addClass(b.settings.loadingClass);b.loading++,a.apply(b,[function(a){b.loading=Math.max(b.loading-1,0),a&&a.length&&(b.addOption(a),b.refreshOptions(b.isFocused&&!b.isInputHidden)),b.loading||c.removeClass(b.settings.loadingClass),b.trigger("load",a)}])},setTextboxValue:function(a){var b=this.$control_input,c=b.val()!==a;c&&(b.val(a).triggerHandler("update"),this.lastValue=a)},getValue:function(){return this.tagType===v&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(a,b){var c=b?[]:["change"];E(this,c,function(){this.clear(b),this.addItems(a,b)})},setActiveItem:function(b,c){var d,e,f,g,h,i,j,k,l=this;if("single"!==l.settings.mode){if(b=a(b),!b.length)return a(l.$activeItems).removeClass("active"),l.$activeItems=[],void(l.isFocused&&l.showInput());if(d=c&&c.type.toLowerCase(),"mousedown"===d&&l.isShiftDown&&l.$activeItems.length){for(k=l.$control.children(".active:last"),g=Array.prototype.indexOf.apply(l.$control[0].childNodes,[k[0]]),h=Array.prototype.indexOf.apply(l.$control[0].childNodes,[b[0]]),g>h&&(j=g,g=h,h=j),e=g;e<=h;e++)i=l.$control[0].childNodes[e],l.$activeItems.indexOf(i)===-1&&(a(i).addClass("active"),l.$activeItems.push(i));c.preventDefault()}else"mousedown"===d&&l.isCtrlDown||"keydown"===d&&this.isShiftDown?b.hasClass("active")?(f=l.$activeItems.indexOf(b[0]),l.$activeItems.splice(f,1),b.removeClass("active")):l.$activeItems.push(b.addClass("active")[0]):(a(l.$activeItems).removeClass("active"),l.$activeItems=[b.addClass("active")[0]]);l.hideInput(),this.isFocused||l.focus()}},setActiveOption:function(b,c,d){var e,f,g,h,i,j=this;j.$activeOption&&j.$activeOption.removeClass("active"),j.$activeOption=null,b=a(b),b.length&&(j.$activeOption=b.addClass("active"),!c&&y(c)||(e=j.$dropdown_content.height(),f=j.$activeOption.outerHeight(!0),c=j.$dropdown_content.scrollTop()||0,g=j.$activeOption.offset().top-j.$dropdown_content.offset().top+c,h=g,i=g-e+f,g+f>e+c?j.$dropdown_content.stop().animate({scrollTop:i},d?j.settings.scrollDuration:0):g<c&&j.$dropdown_content.stop().animate({scrollTop:h},d?j.settings.scrollDuration:0)))},selectAll:function(){var a=this;"single"!==a.settings.mode&&(a.$activeItems=Array.prototype.slice.apply(a.$control.children(":not(input)").addClass("active")),a.$activeItems.length&&(a.hideInput(),a.close()),a.focus())},hideInput:function(){var a=this;a.setTextboxValue(""),a.$control_input.css({opacity:0,position:"absolute",left:a.rtl?1e4:-1e4}),a.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var a=this;a.isDisabled||(a.ignoreFocus=!0,a.$control_input[0].focus(),window.setTimeout(function(){a.ignoreFocus=!1,a.onFocus()},0))},blur:function(a){this.$control_input[0].blur(),this.onBlur(null,a)},getScoreFunction:function(a){return this.sifter.getScoreFunction(a,this.getSearchOptions())},getSearchOptions:function(){var a=this.settings,b=a.sortField;return"string"==typeof b&&(b=[{field:b}]),{fields:a.searchField,conjunction:a.searchConjunction,sort:b}},search:function(b){var c,d,e,f=this,g=f.settings,h=this.getSearchOptions();if(g.score&&(e=f.settings.score.apply(this,[b]),"function"!=typeof e))throw new Error('Selectize "score" setting must be a function that returns a function');if(b!==f.lastQuery?(f.lastQuery=b,d=f.sifter.search(b,a.extend(h,{score:e})),f.currentResults=d):d=a.extend(!0,{},f.currentResults),g.hideSelected)for(c=d.items.length-1;c>=0;c--)f.items.indexOf(z(d.items[c].id))!==-1&&d.items.splice(c,1);return d},refreshOptions:function(b){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;"undefined"==typeof b&&(b=!0);var t=this,u=a.trim(t.$control_input.val()),v=t.search(u),w=t.$dropdown_content,x=t.$activeOption&&z(t.$activeOption.attr("data-value"));for(g=v.items.length,"number"==typeof t.settings.maxOptions&&(g=Math.min(g,t.settings.maxOptions)),h={},i=[],c=0;c<g;c++)for(j=t.options[v.items[c].id],k=t.render("option",j),l=j[t.settings.optgroupField]||"",m=a.isArray(l)?l:[l],e=0,f=m&&m.length;e<f;e++)l=m[e],t.optgroups.hasOwnProperty(l)||(l=""),h.hasOwnProperty(l)||(h[l]=document.createDocumentFragment(),i.push(l)),h[l].appendChild(k);for(this.settings.lockOptgroupOrder&&i.sort(function(a,b){var c=t.optgroups[a].$order||0,d=t.optgroups[b].$order||0;return c-d}),n=document.createDocumentFragment(),c=0,g=i.length;c<g;c++)l=i[c],t.optgroups.hasOwnProperty(l)&&h[l].childNodes.length?(o=document.createDocumentFragment(),o.appendChild(t.render("optgroup_header",t.optgroups[l])),o.appendChild(h[l]),n.appendChild(t.render("optgroup",a.extend({},t.optgroups[l],{html:K(o),dom:o})))):n.appendChild(h[l]);if(w.html(n),t.settings.highlight&&v.query.length&&v.tokens.length)for(w.removeHighlight(),c=0,g=v.tokens.length;c<g;c++)d(w,v.tokens[c].regex);if(!t.settings.hideSelected)for(c=0,g=t.items.length;c<g;c++)t.getOption(t.items[c]).addClass("selected");p=t.canCreate(u),p&&(w.prepend(t.render("option_create",{input:u})),s=a(w[0].childNodes[0])),t.hasOptions=v.items.length>0||p,t.hasOptions?(v.items.length>0?(r=x&&t.getOption(x),r&&r.length?q=r:"single"===t.settings.mode&&t.items.length&&(q=t.getOption(t.items[0])),q&&q.length||(q=s&&!t.settings.addPrecedence?t.getAdjacentOption(s,1):w.find("[data-selectable]:first"))):q=s,t.setActiveOption(q),b&&!t.isOpen&&t.open()):(t.setActiveOption(null),b&&t.isOpen&&t.close())},addOption:function(b){var c,d,e,f=this;if(a.isArray(b))for(c=0,d=b.length;c<d;c++)f.addOption(b[c]);else(e=f.registerOption(b))&&(f.userOptions[e]=!0,f.lastQuery=null,f.trigger("option_add",e,b))},registerOption:function(a){var b=z(a[this.settings.valueField]);return"undefined"!=typeof b&&null!==b&&!this.options.hasOwnProperty(b)&&(a.$order=a.$order||++this.order,this.options[b]=a,b)},registerOptionGroup:function(a){var b=z(a[this.settings.optgroupValueField]);return!!b&&(a.$order=a.$order||++this.order,this.optgroups[b]=a,b)},addOptionGroup:function(a,b){b[this.settings.optgroupValueField]=a,(a=this.registerOptionGroup(b))&&this.trigger("optgroup_add",a,b)},removeOptionGroup:function(a){this.optgroups.hasOwnProperty(a)&&(delete this.optgroups[a],this.renderCache={},this.trigger("optgroup_remove",a))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(b,c){var d,e,f,g,h,i,j,k=this;if(b=z(b),f=z(c[k.settings.valueField]),null!==b&&k.options.hasOwnProperty(b)){if("string"!=typeof f)throw new Error("Value must be set in option data");j=k.options[b].$order,f!==b&&(delete k.options[b],g=k.items.indexOf(b),g!==-1&&k.items.splice(g,1,f)),c.$order=c.$order||j,k.options[f]=c,h=k.renderCache.item,i=k.renderCache.option,h&&(delete h[b],delete h[f]),i&&(delete i[b],delete i[f]),k.items.indexOf(f)!==-1&&(d=k.getItem(b),e=a(k.render("item",c)),d.hasClass("active")&&e.addClass("active"),d.replaceWith(e)),k.lastQuery=null,k.isOpen&&k.refreshOptions(!1)}},removeOption:function(a,b){var c=this;a=z(a);var d=c.renderCache.item,e=c.renderCache.option;d&&delete d[a],e&&delete e[a],delete c.userOptions[a],delete c.options[a],c.lastQuery=null,c.trigger("option_remove",a),c.removeItem(a,b)},clearOptions:function(){var a=this;a.loadedSearches={},a.userOptions={},a.renderCache={},a.options=a.sifter.items={},a.lastQuery=null,a.trigger("option_clear"),a.clear()},getOption:function(a){return this.getElementWithValue(a,this.$dropdown_content.find("[data-selectable]"))},getAdjacentOption:function(b,c){var d=this.$dropdown.find("[data-selectable]"),e=d.index(b)+c;return e>=0&&e<d.length?d.eq(e):a()},getElementWithValue:function(b,c){if(b=z(b),"undefined"!=typeof b&&null!==b)for(var d=0,e=c.length;d<e;d++)if(c[d].getAttribute("data-value")===b)return a(c[d]);return a()},getItem:function(a){return this.getElementWithValue(a,this.$control.children())},addItems:function(b,c){for(var d=a.isArray(b)?b:[b],e=0,f=d.length;e<f;e++)this.isPending=e<f-1,this.addItem(d[e],c)},addItem:function(b,c){var d=c?[]:["change"];E(this,d,function(){var d,e,f,g,h,i=this,j=i.settings.mode;return b=z(b),i.items.indexOf(b)!==-1?void("single"===j&&i.close()):void(i.options.hasOwnProperty(b)&&("single"===j&&i.clear(c),"multi"===j&&i.isFull()||(d=a(i.render("item",i.options[b])),h=i.isFull(),i.items.splice(i.caretPos,0,b),i.insertAtCaret(d),(!i.isPending||!h&&i.isFull())&&i.refreshState(),i.isSetup&&(f=i.$dropdown_content.find("[data-selectable]"),i.isPending||(e=i.getOption(b),g=i.getAdjacentOption(e,1).attr("data-value"),i.refreshOptions(i.isFocused&&"single"!==j),g&&i.setActiveOption(i.getOption(g))),!f.length||i.isFull()?i.close():i.positionDropdown(),i.updatePlaceholder(),i.trigger("item_add",b,d),i.updateOriginalInput({silent:c})))))})},removeItem:function(b,c){var d,e,f,g=this;d=b instanceof a?b:g.getItem(b),b=z(d.attr("data-value")),e=g.items.indexOf(b),e!==-1&&(d.remove(),d.hasClass("active")&&(f=g.$activeItems.indexOf(d[0]),g.$activeItems.splice(f,1)),g.items.splice(e,1),g.lastQuery=null,!g.settings.persist&&g.userOptions.hasOwnProperty(b)&&g.removeOption(b,c),e<g.caretPos&&g.setCaret(g.caretPos-1),g.refreshState(),g.updatePlaceholder(),g.updateOriginalInput({silent:c}),g.positionDropdown(),g.trigger("item_remove",b,d))},createItem:function(b,c){var d=this,e=d.caretPos;b=b||a.trim(d.$control_input.val()||"");var f=arguments[arguments.length-1];if("function"!=typeof f&&(f=function(){}),"boolean"!=typeof c&&(c=!0),!d.canCreate(b))return f(),!1;d.lock();var g="function"==typeof d.settings.create?this.settings.create:function(a){var b={};return b[d.settings.labelField]=a,b[d.settings.valueField]=a,b},h=C(function(a){if(d.unlock(),!a||"object"!=typeof a)return f();var b=z(a[d.settings.valueField]);return"string"!=typeof b?f():(d.setTextboxValue(""),d.addOption(a),d.setCaret(e),d.addItem(b),d.refreshOptions(c&&"single"!==d.settings.mode),void f(a))}),i=g.apply(this,[b,h]);return"undefined"!=typeof i&&h(i),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var a=!this.items.length;this.isInvalid=a,this.$control_input.prop("required",a),this.$input.prop("required",!a)},refreshClasses:function(){var b=this,c=b.isFull(),d=b.isLocked;b.$wrapper.toggleClass("rtl",b.rtl),b.$control.toggleClass("focus",b.isFocused).toggleClass("disabled",b.isDisabled).toggleClass("required",b.isRequired).toggleClass("invalid",b.isInvalid).toggleClass("locked",d).toggleClass("full",c).toggleClass("not-full",!c).toggleClass("input-active",b.isFocused&&!b.isInputHidden).toggleClass("dropdown-active",b.isOpen).toggleClass("has-options",!a.isEmptyObject(b.options)).toggleClass("has-items",b.items.length>0),b.$control_input.data("grow",!c&&!d)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(a){var b,c,d,e,f=this;if(a=a||{},f.tagType===v){for(d=[],b=0,c=f.items.length;b<c;b++)e=f.options[f.items[b]][f.settings.labelField]||"",d.push('<option value="'+A(f.items[b])+'" selected="selected">'+A(e)+"</option>");d.length||this.$input.attr("multiple")||d.push('<option value="" selected="selected"></option>'),
|
3 |
-
f.$input.html(d.join(""))}else f.$input.val(f.getValue()),f.$input.attr("value",f.$input.val());f.isSetup&&(a.silent||f.trigger("change",f.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var a=this.$control_input;this.items.length?a.removeAttr("placeholder"):a.attr("placeholder",this.settings.placeholder),a.triggerHandler("update",{force:!0})}},open:function(){var a=this;a.isLocked||a.isOpen||"multi"===a.settings.mode&&a.isFull()||(a.focus(),a.isOpen=!0,a.refreshState(),a.$dropdown.css({visibility:"hidden",display:"block"}),a.positionDropdown(),a.$dropdown.css({visibility:"visible"}),a.trigger("dropdown_open",a.$dropdown))},close:function(){var a=this,b=a.isOpen;"single"===a.settings.mode&&a.items.length&&(a.hideInput(),a.$control_input.blur()),a.isOpen=!1,a.$dropdown.hide(),a.setActiveOption(null),a.refreshState(),b&&a.trigger("dropdown_close",a.$dropdown)},positionDropdown:function(){var a=this.$control,b="body"===this.settings.dropdownParent?a.offset():a.position();b.top+=a.outerHeight(!0),this.$dropdown.css({width:a.outerWidth(),top:b.top,left:b.left})},clear:function(a){var b=this;b.items.length&&(b.$control.children(":not(input)").remove(),b.items=[],b.lastQuery=null,b.setCaret(0),b.setActiveItem(null),b.updatePlaceholder(),b.updateOriginalInput({silent:a}),b.refreshState(),b.showInput(),b.trigger("clear"))},insertAtCaret:function(b){var c=Math.min(this.caretPos,this.items.length);0===c?this.$control.prepend(b):a(this.$control[0].childNodes[c]).before(b),this.setCaret(c+1)},deleteSelection:function(b){var c,d,e,f,g,h,i,j,k,l=this;if(e=b&&b.keyCode===p?-1:1,f=G(l.$control_input[0]),l.$activeOption&&!l.settings.hideSelected&&(i=l.getAdjacentOption(l.$activeOption,-1).attr("data-value")),g=[],l.$activeItems.length){for(k=l.$control.children(".active:"+(e>0?"last":"first")),h=l.$control.children(":not(input)").index(k),e>0&&h++,c=0,d=l.$activeItems.length;c<d;c++)g.push(a(l.$activeItems[c]).attr("data-value"));b&&(b.preventDefault(),b.stopPropagation())}else(l.isFocused||"single"===l.settings.mode)&&l.items.length&&(e<0&&0===f.start&&0===f.length?g.push(l.items[l.caretPos-1]):e>0&&f.start===l.$control_input.val().length&&g.push(l.items[l.caretPos]));if(!g.length||"function"==typeof l.settings.onDelete&&l.settings.onDelete.apply(l,[g])===!1)return!1;for("undefined"!=typeof h&&l.setCaret(h);g.length;)l.removeItem(g.pop());return l.showInput(),l.positionDropdown(),l.refreshOptions(!0),i&&(j=l.getOption(i),j.length&&l.setActiveOption(j)),!0},advanceSelection:function(a,b){var c,d,e,f,g,h,i=this;0!==a&&(i.rtl&&(a*=-1),c=a>0?"last":"first",d=G(i.$control_input[0]),i.isFocused&&!i.isInputHidden?(f=i.$control_input.val().length,g=a<0?0===d.start&&0===d.length:d.start===f,g&&!f&&i.advanceCaret(a,b)):(h=i.$control.children(".active:"+c),h.length&&(e=i.$control.children(":not(input)").index(h),i.setActiveItem(null),i.setCaret(a>0?e+1:e))))},advanceCaret:function(a,b){var c,d,e=this;0!==a&&(c=a>0?"next":"prev",e.isShiftDown?(d=e.$control_input[c](),d.length&&(e.hideInput(),e.setActiveItem(d),b&&b.preventDefault())):e.setCaret(e.caretPos+a))},setCaret:function(b){var c=this;if(b="single"===c.settings.mode?c.items.length:Math.max(0,Math.min(c.items.length,b)),!c.isPending){var d,e,f,g;for(f=c.$control.children(":not(input)"),d=0,e=f.length;d<e;d++)g=a(f[d]).detach(),d<b?c.$control_input.before(g):c.$control.append(g)}c.caretPos=b},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){var a=this;a.$input.prop("disabled",!0),a.$control_input.prop("disabled",!0).prop("tabindex",-1),a.isDisabled=!0,a.lock()},enable:function(){var a=this;a.$input.prop("disabled",!1),a.$control_input.prop("disabled",!1).prop("tabindex",a.tabIndex),a.isDisabled=!1,a.unlock()},destroy:function(){var b=this,c=b.eventNS,d=b.revertSettings;b.trigger("destroy"),b.off(),b.$wrapper.remove(),b.$dropdown.remove(),b.$input.html("").append(d.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:d.tabindex}).show(),b.$control_input.removeData("grow"),b.$input.removeData("selectize"),a(window).off(c),a(document).off(c),a(document.body).off(c),delete b.$input[0].selectize},render:function(b,c){var d,e,f="",g=!1,h=this;return"option"!==b&&"item"!==b||(d=z(c[h.settings.valueField]),g=!!d),g&&(y(h.renderCache[b])||(h.renderCache[b]={}),h.renderCache[b].hasOwnProperty(d))?h.renderCache[b][d]:(f=a(h.settings.render[b].apply(this,[c,A])),"option"===b||"option_create"===b?f.attr("data-selectable",""):"optgroup"===b&&(e=c[h.settings.optgroupValueField]||"",f.attr("data-group",e)),"option"!==b&&"item"!==b||f.attr("data-value",d||""),g&&(h.renderCache[b][d]=f[0]),f[0])},clearCache:function(a){var b=this;"undefined"==typeof a?b.renderCache={}:delete b.renderCache[a]},canCreate:function(a){var b=this;if(!b.settings.create)return!1;var c=b.settings.createFilter;return a.length&&("function"!=typeof c||c.apply(b,[a]))&&("string"!=typeof c||new RegExp(c).test(a))&&(!(c instanceof RegExp)||c.test(a))}}),M.count=0,M.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!1,preload:!1,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,copyClassesToDropdown:!0,render:{}},a.fn.selectize=function(b){var c=a.fn.selectize.defaults,d=a.extend({},c,b),e=d.dataAttr,f=d.labelField,g=d.valueField,h=d.optgroupField,i=d.optgroupLabelField,j=d.optgroupValueField,k=function(b,c){var h,i,j,k,l=b.attr(e);if(l)for(c.options=JSON.parse(l),h=0,i=c.options.length;h<i;h++)c.items.push(c.options[h][g]);else{var m=a.trim(b.val()||"");if(!d.allowEmptyOption&&!m.length)return;for(j=m.split(d.delimiter),h=0,i=j.length;h<i;h++)k={},k[f]=j[h],k[g]=j[h],c.options.push(k);c.items=j}},l=function(b,c){var k,l,m,n,o=c.options,p={},q=function(a){var b=e&&a.attr(e);return"string"==typeof b&&b.length?JSON.parse(b):null},r=function(b,e){b=a(b);var i=z(b.val());if(i||d.allowEmptyOption)if(p.hasOwnProperty(i)){if(e){var j=p[i][h];j?a.isArray(j)?j.push(e):p[i][h]=[j,e]:p[i][h]=e}}else{var k=q(b)||{};k[f]=k[f]||b.text(),k[g]=k[g]||i,k[h]=k[h]||e,p[i]=k,o.push(k),b.is(":selected")&&c.items.push(i)}},s=function(b){var d,e,f,g,h;for(b=a(b),f=b.attr("label"),f&&(g=q(b)||{},g[i]=f,g[j]=f,c.optgroups.push(g)),h=a("option",b),d=0,e=h.length;d<e;d++)r(h[d],f)};for(c.maxItems=b.attr("multiple")?null:1,n=b.children(),k=0,l=n.length;k<l;k++)m=n[k].tagName.toLowerCase(),"optgroup"===m?s(n[k]):"option"===m&&r(n[k])};return this.each(function(){if(!this.selectize){var e,f=a(this),g=this.tagName.toLowerCase(),h=f.attr("placeholder")||f.attr("data-placeholder");h||d.allowEmptyOption||(h=f.children('option[value=""]').text());var i={placeholder:h,options:[],optgroups:[],items:[]};"select"===g?l(f,i):k(f,i),e=new M(f,a.extend(!0,{},c,i,b))}})},a.fn.selectize.defaults=M.defaults,a.fn.selectize.support={validity:x},M.define("drag_drop",function(b){if(!a.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===this.settings.mode){var c=this;c.lock=function(){var a=c.lock;return function(){var b=c.$control.data("sortable");return b&&b.disable(),a.apply(c,arguments)}}(),c.unlock=function(){var a=c.unlock;return function(){var b=c.$control.data("sortable");return b&&b.enable(),a.apply(c,arguments)}}(),c.setup=function(){var b=c.setup;return function(){b.apply(this,arguments);var d=c.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:c.isLocked,start:function(a,b){b.placeholder.css("width",b.helper.css("width")),d.css({overflow:"visible"})},stop:function(){d.css({overflow:"hidden"});var b=c.$activeItems?c.$activeItems.slice():null,e=[];d.children("[data-value]").each(function(){e.push(a(this).attr("data-value"))}),c.setValue(e),c.setActiveItem(b)}})}}()}}),M.define("dropdown_header",function(b){var c=this;b=a.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(a){return'<div class="'+a.headerClass+'"><div class="'+a.titleRowClass+'"><span class="'+a.labelClass+'">'+a.title+'</span><a href="javascript:void(0)" class="'+a.closeClass+'">×</a></div></div>'}},b),c.setup=function(){var d=c.setup;return function(){d.apply(c,arguments),c.$dropdown_header=a(b.html(b)),c.$dropdown.prepend(c.$dropdown_header)}}()}),M.define("optgroup_columns",function(b){var c=this;b=a.extend({equalizeWidth:!0,equalizeHeight:!0},b),this.getAdjacentOption=function(b,c){var d=b.closest("[data-group]").find("[data-selectable]"),e=d.index(b)+c;return e>=0&&e<d.length?d.eq(e):a()},this.onKeyDown=function(){var a=c.onKeyDown;return function(b){var d,e,f,g;return!this.isOpen||b.keyCode!==j&&b.keyCode!==m?a.apply(this,arguments):(c.ignoreHover=!0,g=this.$activeOption.closest("[data-group]"),d=g.find("[data-selectable]").index(this.$activeOption),g=b.keyCode===j?g.prev("[data-group]"):g.next("[data-group]"),f=g.find("[data-selectable]"),e=f.eq(Math.min(f.length-1,d)),void(e.length&&this.setActiveOption(e)))}}();var d=function(){var a,b=d.width,c=document;return"undefined"==typeof b&&(a=c.createElement("div"),a.innerHTML='<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',a=a.firstChild,c.body.appendChild(a),b=d.width=a.offsetWidth-a.clientWidth,c.body.removeChild(a)),b},e=function(){var e,f,g,h,i,j,k;if(k=a("[data-group]",c.$dropdown_content),f=k.length,f&&c.$dropdown_content.width()){if(b.equalizeHeight){for(g=0,e=0;e<f;e++)g=Math.max(g,k.eq(e).height());k.css({height:g})}b.equalizeWidth&&(j=c.$dropdown_content.innerWidth()-d(),h=Math.round(j/f),k.css({width:h}),f>1&&(i=j-h*(f-1),k.eq(f-1).css({width:i})))}};(b.equalizeHeight||b.equalizeWidth)&&(B.after(this,"positionDropdown",e),B.after(this,"refreshOptions",e))}),M.define("remove_button",function(b){b=a.extend({label:"×",title:"Remove",className:"remove",append:!0},b);var c=function(b,c){c.className="remove-single";var d=b,e='<a href="javascript:void(0)" class="'+c.className+'" tabindex="-1" title="'+A(c.title)+'">'+c.label+"</a>",f=function(a,b){return a+b};b.setup=function(){var g=d.setup;return function(){if(c.append){var h=a(d.$input.context).attr("id"),i=(a("#"+h),d.settings.render.item);d.settings.render.item=function(a){return f(i.apply(b,arguments),e)}}g.apply(b,arguments),b.$control.on("click","."+c.className,function(a){a.preventDefault(),d.isLocked||d.clear()})}}()},d=function(b,c){var d=b,e='<a href="javascript:void(0)" class="'+c.className+'" tabindex="-1" title="'+A(c.title)+'">'+c.label+"</a>",f=function(a,b){var c=a.search(/(<\/[^>]+>\s*)$/);return a.substring(0,c)+b+a.substring(c)};b.setup=function(){var g=d.setup;return function(){if(c.append){var h=d.settings.render.item;d.settings.render.item=function(a){return f(h.apply(b,arguments),e)}}g.apply(b,arguments),b.$control.on("click","."+c.className,function(b){if(b.preventDefault(),!d.isLocked){var c=a(b.currentTarget).parent();d.setActiveItem(c),d.deleteSelection()&&d.setCaret(d.items.length)}})}}()};return"single"===this.settings.mode?void c(this,b):void d(this,b)}),M.define("restore_on_backspace",function(a){var b=this;a.text=a.text||function(a){return a[this.settings.labelField]},this.onKeyDown=function(){var c=b.onKeyDown;return function(b){var d,e;return b.keyCode===p&&""===this.$control_input.val()&&!this.$activeItems.length&&(d=this.caretPos-1,d>=0&&d<this.items.length)?(e=this.options[this.items[d]],this.deleteSelection(b)&&(this.setTextboxValue(a.text.apply(this,[e])),this.refreshOptions(!0)),void b.preventDefault()):c.apply(this,arguments)}}()}),M});
|
1 |
/*! selectize.js - v0.12.4 | https://github.com/selectize/selectize.js | Apache License (v2) */
|
2 |
+
/*! ThirstyAffiliates modified to fix jQuery Migrate Warning "jQuery.fn.attr('value', val) no longer sets properties" */
|
3 |
+
!function(t,e){"function"==typeof define&&define.amd?define("sifter",e):"object"==typeof exports?module.exports=e():t.Sifter=e()}(this,function(){var t=function(t,e){this.items=t,this.settings=e||{diacritics:!0}};t.prototype.tokenize=function(t){if(!(t=s(String(t||"").toLowerCase()))||!t.length)return[];var e,i,n,r,l=[],h=t.split(/ +/);for(e=0,i=h.length;e<i;e++){if(n=o(h[e]),this.settings.diacritics)for(r in a)a.hasOwnProperty(r)&&(n=n.replace(new RegExp(r,"g"),a[r]));l.push({string:h[e],regex:new RegExp(n,"i")})}return l},t.prototype.iterator=function(t,e){(r(t)?Array.prototype.forEach||function(t){for(var e=0,i=this.length;e<i;e++)t(this[e],e,this)}:function(t){for(var e in this)this.hasOwnProperty(e)&&t(this[e],e,this)}).apply(t,[e])},t.prototype.getScoreFunction=function(t,e){var i,s,o,r;t=this.prepareSearch(t,e),s=t.tokens,i=t.options.fields,o=s.length,r=t.options.nesting;var a,l=function(t,e){var i,n;return t?-1===(n=(t=String(t||"")).search(e.regex))?0:(i=e.string.length/t.length,0===n&&(i+=.5),i):0},h=(a=i.length)?1===a?function(t,e){return l(n(e,i[0],r),t)}:function(t,e){for(var s=0,o=0;s<a;s++)o+=l(n(e,i[s],r),t);return o/a}:function(){return 0};return o?1===o?function(t){return h(s[0],t)}:"and"===t.options.conjunction?function(t){for(var e,i=0,n=0;i<o;i++){if((e=h(s[i],t))<=0)return 0;n+=e}return n/o}:function(t){for(var e=0,i=0;e<o;e++)i+=h(s[e],t);return i/o}:function(){return 0}},t.prototype.getSort |