Version Description
- Add support for nofollow in Gutenberg popup
- Fix post_author being set to 0 on CPT
- Fix for duplicate links being created
- Fix clicks ordering on links list
- Fix Redirection dropdown display WP 3.5
Download this release
Release Info
Developer | cartpauj |
Plugin | Shortlinks by Pretty Links – Best WordPress Link Tracking Plugin |
Version | 3.0.10 |
Comparing to | |
See all releases |
Code changes from version 3.0.9 to 3.0.10
- app/controllers/PrliLinksController.php +1 -1
- app/models/PrliLink.php +443 -439
- app/views/links/form_basic.php +1 -1
- js/editor.js +2 -2
- js/editor.js.map +1 -1
- js/editor/components/link-editor/index.js +28 -2
- js/editor/components/link-editor/utils.js +13 -2
- pretty-link.php +1 -1
- readme.txt +8 -1
app/controllers/PrliLinksController.php
CHANGED
@@ -951,7 +951,7 @@ class PrliLinksController extends PrliBaseController {
|
|
951 |
}
|
952 |
elseif($_GET['orderby']=='clicks') {
|
953 |
$orderby = "
|
954 |
-
clicks {$order}
|
955 |
";
|
956 |
}
|
957 |
}
|
951 |
}
|
952 |
elseif($_GET['orderby']=='clicks') {
|
953 |
$orderby = "
|
954 |
+
CAST(clicks AS unsigned) {$order}
|
955 |
";
|
956 |
}
|
957 |
}
|
app/models/PrliLink.php
CHANGED
@@ -23,582 +23,586 @@ class PrliLink {
|
|
23 |
return $wpdb->get_var($q);
|
24 |
}
|
25 |
|
26 |
-
|
27 |
-
|
|
|
28 |
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
-
|
32 |
-
$values['created_at'] = $values['updated_at'] = $now;
|
33 |
|
34 |
-
|
|
|
35 |
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
error_log("Unable to create CPT Post for Link");
|
40 |
-
}
|
41 |
|
42 |
-
|
|
|
43 |
}
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
$values['name'] = $values['slug'];
|
48 |
-
}
|
49 |
-
else {
|
50 |
-
$values['name'] = PrliUtils::get_page_title($values['url'],$values['slug']);
|
51 |
-
}
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
$
|
56 |
-
|
|
|
|
|
57 |
}
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
$
|
|
|
|
|
62 |
|
63 |
-
|
64 |
-
if($link_id) {
|
65 |
-
$prli_link_meta->update_link_meta($link_id, 'delay', 0);
|
66 |
-
}
|
67 |
|
68 |
-
|
69 |
-
$this->update_cpt_status($values['link_cpt_id']);
|
70 |
-
$this->update_cpt_post_date($values['link_cpt_id'], $now);
|
71 |
|
72 |
-
|
|
|
|
|
73 |
|
74 |
-
|
|
|
|
|
75 |
}
|
76 |
|
77 |
-
|
78 |
-
|
|
|
79 |
|
80 |
-
|
81 |
|
82 |
-
|
83 |
-
|
84 |
|
85 |
-
|
|
|
86 |
|
87 |
-
|
88 |
-
error_log("REDIRECT TYPE: " . $values['redirect_type']);
|
89 |
-
if($values['redirect_type'] == 'pixel') {
|
90 |
-
$title = $values['slug'];
|
91 |
-
}
|
92 |
-
else {
|
93 |
-
$title = PrliUtils::get_page_title($values['url'],$values['slug']);
|
94 |
-
}
|
95 |
-
}
|
96 |
|
97 |
-
|
|
|
98 |
|
99 |
-
|
100 |
-
$this->update_cpt_title($link->link_cpt_id, $title);
|
101 |
-
$this->update_cpt_status($link->link_cpt_id);
|
102 |
-
$this->update_cpt_post_modified($link->link_cpt_id, $now);
|
103 |
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
|
107 |
-
|
108 |
-
return $this->update_link_status( $id, 'disabled' );
|
109 |
-
}
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
114 |
|
115 |
-
|
116 |
-
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
WHERE id=%d
|
122 |
-
",
|
123 |
-
$link_status,
|
124 |
-
$id
|
125 |
-
);
|
126 |
|
127 |
-
|
128 |
-
|
|
|
129 |
|
130 |
-
|
131 |
-
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
"UPDATE {$this->table_name} SET group_id = NULL WHERE id = %d",
|
142 |
-
$id
|
143 |
-
);
|
144 |
-
}
|
145 |
|
146 |
-
|
|
|
147 |
|
148 |
-
|
149 |
-
|
150 |
|
151 |
-
|
152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
-
|
155 |
|
156 |
-
|
157 |
-
|
158 |
-
wp_delete_post($link->link_cpt_id, true);
|
159 |
-
}
|
160 |
|
161 |
-
|
162 |
-
|
163 |
-
$destroy = $wpdb->prepare("DELETE FROM {$this->table_name} WHERE id=%d",$id);
|
164 |
|
165 |
-
|
166 |
-
$wpdb->query($reset);
|
167 |
|
168 |
-
|
|
|
|
|
169 |
}
|
170 |
|
171 |
-
|
172 |
-
|
|
|
173 |
|
174 |
-
|
175 |
-
|
176 |
|
177 |
-
|
|
|
178 |
|
179 |
-
|
180 |
-
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
}
|
185 |
|
186 |
-
|
187 |
-
return $this->get_one_by( 'id', $id, $return_type, $include_stats, $exclude_disabled );
|
188 |
-
}
|
189 |
|
190 |
-
|
191 |
-
|
192 |
|
193 |
-
|
|
|
|
|
194 |
|
195 |
-
|
196 |
-
|
|
|
197 |
|
198 |
-
|
|
|
199 |
|
200 |
-
|
201 |
-
$query .= "
|
202 |
-
(
|
203 |
-
SELECT COUNT(*)
|
204 |
-
FROM {$prli_click->table_name} AS cl
|
205 |
-
WHERE cl.link_id = li.id
|
206 |
-
{$op}
|
207 |
-
) as clicks,
|
208 |
-
(
|
209 |
-
SELECT COUNT(*) FROM {$prli_click->table_name} AS cl
|
210 |
-
WHERE cl.link_id = li.id
|
211 |
-
AND cl.first_click <> 0
|
212 |
-
{$op}
|
213 |
-
) as uniques
|
214 |
-
";
|
215 |
-
}
|
216 |
-
else {
|
217 |
-
$query .= "
|
218 |
-
(
|
219 |
-
SELECT lm.meta_value
|
220 |
-
FROM {$prli_link_meta->table_name} AS lm
|
221 |
-
WHERE lm.meta_key=\"static-clicks\"
|
222 |
-
AND lm.link_id=li.id LIMIT 1
|
223 |
-
) as clicks,
|
224 |
-
(
|
225 |
-
SELECT lm.meta_value FROM {$prli_link_meta->table_name} AS lm
|
226 |
-
WHERE lm.meta_key=\"static-uniques\"
|
227 |
-
AND lm.link_id=li.id
|
228 |
-
LIMIT 1
|
229 |
-
) as uniques
|
230 |
-
";
|
231 |
-
}
|
232 |
-
}
|
233 |
-
else {
|
234 |
-
$query = "SELECT li.*, CONCAT(\"{$prli_blogurl}\",\"{$struct}\",li.slug) AS pretty_url";
|
235 |
-
}
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
|
242 |
-
if($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
$query .= "
|
244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
";
|
246 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
|
248 |
-
|
249 |
-
$
|
|
|
|
|
|
|
250 |
|
251 |
-
|
252 |
-
|
253 |
|
254 |
-
|
255 |
-
|
256 |
-
$link->uniques = $prli_link_meta->get_link_meta($link->id,'static-uniques',true);
|
257 |
-
}
|
258 |
|
259 |
-
|
|
|
|
|
260 |
}
|
261 |
|
262 |
-
|
263 |
-
|
264 |
-
$query_str = "SELECT id FROM {$this->table_name} WHERE link_status='enabled' AND url=%s LIMIT 1";
|
265 |
-
$query = $wpdb->prepare($query_str,$target_url);
|
266 |
-
return $wpdb->get_var($query);
|
267 |
-
}
|
268 |
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
return $pretty_link;
|
286 |
}
|
287 |
|
288 |
-
|
289 |
-
|
290 |
-
|
|
|
|
|
291 |
|
292 |
-
|
293 |
-
|
294 |
-
$uri = preg_replace('#' . preg_quote($prli_blogurl) . '#', '', $url);
|
295 |
|
296 |
-
|
297 |
-
|
298 |
|
299 |
-
|
|
|
300 |
|
301 |
-
|
302 |
|
303 |
-
|
304 |
|
305 |
-
|
306 |
-
{
|
307 |
-
// Match longest slug -- this is the most common
|
308 |
-
$pretty_link_params = (isset($match_val[3])?$match_val[3]:'');
|
309 |
-
if( $pretty_link_found = $this->is_pretty_link_slug( $match_val[2] ) )
|
310 |
-
return compact('pretty_link_found');
|
311 |
|
312 |
-
|
313 |
-
|
|
|
|
|
|
|
314 |
|
315 |
-
|
316 |
-
|
317 |
-
for( $i=0; ($i < 25) and
|
318 |
-
$matched_link and
|
319 |
-
!empty($matched_link) and
|
320 |
-
$matched_link != $match_val[2]; $i++ )
|
321 |
-
{
|
322 |
-
$new_match_str ="#^{$subdir_str}({$struct})({$matched_link})(.*?)?$#";
|
323 |
|
324 |
-
|
325 |
-
|
326 |
-
|
|
|
|
|
|
|
|
|
327 |
|
328 |
-
|
329 |
-
|
330 |
-
|
|
|
|
|
|
|
331 |
}
|
332 |
}
|
333 |
-
|
334 |
-
return false;
|
335 |
}
|
336 |
|
337 |
-
|
338 |
-
|
339 |
-
}
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
$query = $wpdb->prepare($query_str, $id);
|
345 |
-
$res = $wpdb->get_row($query, $return_type);
|
346 |
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
|
353 |
-
|
|
|
|
|
|
|
354 |
}
|
355 |
|
356 |
-
|
357 |
-
|
|
|
|
|
|
|
358 |
|
359 |
-
|
360 |
|
361 |
-
|
362 |
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
}
|
382 |
-
else
|
383 |
-
{
|
384 |
-
$query .= "
|
385 |
-
(
|
386 |
-
SELECT lm.meta_value
|
387 |
-
FROM {$prli_link_meta->table_name} AS lm
|
388 |
-
WHERE lm.meta_key=\"static-clicks\"
|
389 |
-
AND lm.link_id=li.id
|
390 |
-
LIMIT 1
|
391 |
-
) as clicks,
|
392 |
-
(
|
393 |
-
SELECT lm.meta_value
|
394 |
-
FROM {$prli_link_meta->table_name} AS lm
|
395 |
-
WHERE lm.meta_key=\"static-uniques\"
|
396 |
-
AND lm.link_id=li.id
|
397 |
-
LIMIT 1
|
398 |
-
) as uniques
|
399 |
-
";
|
400 |
-
}
|
401 |
}
|
402 |
else {
|
403 |
-
$query
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
}
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
" . $prli_utils->prepend_and_or_where(' AND', $where) .
|
409 |
-
$order_by;
|
410 |
-
|
411 |
-
return $wpdb->get_results($query, $return_type);
|
412 |
}
|
413 |
|
414 |
-
|
415 |
-
|
416 |
-
|
|
|
417 |
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
|
|
423 |
|
424 |
-
|
|
|
|
|
|
|
425 |
}
|
426 |
|
427 |
-
$
|
|
|
428 |
|
429 |
-
|
430 |
-
$query = "SELECT slug FROM {$this->table_name}";
|
431 |
-
$slugs = $wpdb->get_col($query,0);
|
432 |
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
$slug = $slug_prefix . PrliUtils::gen_random_string($num_chars);
|
437 |
-
}
|
438 |
|
439 |
-
|
|
|
|
|
|
|
440 |
}
|
441 |
|
442 |
-
|
443 |
-
|
444 |
|
445 |
-
|
446 |
-
|
447 |
-
if($esc_url) {
|
448 |
-
$pretty_link_url = esc_url($pretty_link_url);
|
449 |
-
}
|
450 |
-
else {
|
451 |
-
$pretty_link_url = $pretty_link_url;
|
452 |
-
}
|
453 |
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
}
|
462 |
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
public function sanitize($values)
|
470 |
-
{
|
471 |
-
$sanitized = array(
|
472 |
-
'redirect_type' => isset($values['redirect_type']) && is_string($values['redirect_type']) ? sanitize_key($values['redirect_type']) : '307',
|
473 |
-
'url' => isset($values['url']) && is_string($values['url']) ? esc_url_raw(trim($values['url'])) : '',
|
474 |
-
'slug' => isset($values['slug']) && is_string($values['slug']) ? sanitize_text_field($values['slug']) : '',
|
475 |
-
'name' => isset($values['name']) && is_string($values['name']) ? sanitize_text_field($values['name']) : '',
|
476 |
-
'description' => isset($values['description']) && is_string($values['description']) ? sanitize_textarea_field($values['description']) : '',
|
477 |
-
'group_id' => isset($values['group_id']) && is_numeric($values['group_id']) ? (int) $values['group_id'] : null,
|
478 |
-
'nofollow' => isset($values['nofollow']) ? 1 : 0,
|
479 |
-
'param_forwarding' => isset($values['param_forwarding']) ? 1 : 0,
|
480 |
-
'track_me' => isset($values['track_me']) ? 1 : 0,
|
481 |
-
'link_cpt_id' => isset($values['link_cpt_id']) && is_numeric($values['link_cpt_id']) ? (int) $values['link_cpt_id'] : 0
|
482 |
-
);
|
483 |
-
|
484 |
-
return $sanitized;
|
485 |
}
|
|
|
486 |
|
487 |
-
|
488 |
-
|
489 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
|
491 |
-
|
|
|
492 |
|
493 |
-
|
494 |
-
|
495 |
-
$errors[] = __("Target URL can't be blank", 'pretty-link');
|
496 |
-
}
|
497 |
|
498 |
-
|
499 |
-
$errors[] = __("Target URL must be different than the Pretty Link", 'pretty-link');
|
500 |
-
}
|
501 |
|
502 |
-
|
503 |
-
|
504 |
-
|
|
|
505 |
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
}
|
518 |
|
519 |
-
|
|
|
520 |
}
|
521 |
|
522 |
-
|
523 |
-
|
524 |
-
$
|
525 |
-
$mod = preg_replace("!^{$ugh}!", '', $url);
|
526 |
-
return "\"{$mod}\"";
|
527 |
}
|
528 |
|
529 |
-
|
530 |
-
|
531 |
|
532 |
-
|
|
|
|
|
|
|
|
|
|
|
533 |
|
534 |
-
|
535 |
-
|
536 |
-
return html_entity_decode(rawurldecode($url));
|
537 |
-
},
|
538 |
-
$urls
|
539 |
-
);
|
540 |
|
541 |
-
|
542 |
-
$where = "IN (" . implode( ',', array_map( array($this, 'get_link_slug'), $decoded_urls ) ) . ")";
|
543 |
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
$query = $wpdb->prepare($query, $prli_blogurl.PrliUtils::get_permalink_pre_slug_uri());
|
551 |
-
$plinks = $wpdb->get_col($query);
|
552 |
|
553 |
-
|
|
|
554 |
|
555 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
556 |
|
557 |
-
|
558 |
-
function($url) {
|
559 |
-
return "\"{$url}\"";
|
560 |
-
},
|
561 |
-
$decoded_urls ) ) . ")";
|
562 |
|
563 |
-
|
564 |
-
SELECT li.url AS target_url,
|
565 |
-
CONCAT(%s, li.slug) AS pretty_url
|
566 |
-
FROM {$this->table_name} AS li
|
567 |
-
WHERE li.link_status='enabled'
|
568 |
-
AND li.url {$where}
|
569 |
-
";
|
570 |
-
$query = $wpdb->prepare($query, $prli_blogurl.PrliUtils::get_permalink_pre_slug_uri());
|
571 |
|
572 |
-
|
|
|
|
|
|
|
|
|
573 |
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
582 |
}
|
|
|
583 |
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
}
|
590 |
}
|
591 |
}
|
592 |
}
|
593 |
-
|
594 |
-
return $prli_lookup;
|
595 |
}
|
596 |
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
|
|
|
|
|
|
602 |
|
603 |
public function get_link_from_cpt($cpt_id) {
|
604 |
global $wpdb;
|
@@ -649,6 +653,7 @@ class PrliLink {
|
|
649 |
$inserted = $wpdb->insert(
|
650 |
$wpdb->posts,
|
651 |
array(
|
|
|
652 |
'post_title' => stripslashes($title),
|
653 |
'post_type' => PrliLink::$cpt,
|
654 |
'post_status' => 'publish',
|
@@ -659,7 +664,7 @@ class PrliLink {
|
|
659 |
'comment_status' => 'closed',
|
660 |
'ping_status' => 'closed'
|
661 |
),
|
662 |
-
array('%s','%s','%s','%s','%s','%s','%s')
|
663 |
);
|
664 |
|
665 |
return $inserted ? $wpdb->insert_id : false;
|
@@ -760,4 +765,3 @@ class PrliLink {
|
|
760 |
return $groups;
|
761 |
}
|
762 |
}
|
763 |
-
|
23 |
return $wpdb->get_var($q);
|
24 |
}
|
25 |
|
26 |
+
public function create( $values ) {
|
27 |
+
global $wpdb, $prli_link_meta;
|
28 |
+
static $slugs_done;
|
29 |
|
30 |
+
if(!isset($slugs_done) || !is_array($slugs_done)) { $slugs_done = array(); }
|
31 |
+
|
32 |
+
if(!empty($values['slug'])) {
|
33 |
+
if(isset($slugs_done[$values['slug']]) && $slugs_done[$values['slug']] > 0) {
|
34 |
+
return $slugs_done[$values['slug']]; // Return existing link id so we don't create a duplicate
|
35 |
+
}
|
36 |
+
}
|
37 |
|
38 |
+
$now = current_time('mysql');
|
|
|
39 |
|
40 |
+
$values = $this->sanitize($values);
|
41 |
+
$values['created_at'] = $values['updated_at'] = $now;
|
42 |
|
43 |
+
if($values['link_cpt_id'] == 0) { ## Autocreate CPT
|
44 |
|
45 |
+
$post_id = $this->create_cpt_for_link($values['name'], $now, $now);
|
|
|
|
|
46 |
|
47 |
+
if($post_id == 0 || is_wp_error($post_id)) {
|
48 |
+
error_log("Unable to create CPT Post for Link");
|
49 |
}
|
50 |
|
51 |
+
$values['link_cpt_id'] = $post_id;
|
52 |
+
}
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
+
if(empty($values['name'])) {
|
55 |
+
if($values['redirect_type'] == 'pixel') {
|
56 |
+
$values['name'] = $values['slug'];
|
57 |
+
}
|
58 |
+
else {
|
59 |
+
$values['name'] = PrliUtils::get_page_title($values['url'],$values['slug']);
|
60 |
}
|
61 |
|
62 |
+
// Update the post_title field directly so we don't activate the action
|
63 |
+
// that ultimately calls this function lest we get into an infinite loop
|
64 |
+
$q = $wpdb->prepare("UPDATE {$wpdb->posts} SET post_title=%s WHERE ID=%d", $values['name'], $values['link_cpt_id']);
|
65 |
+
$wpdb->query($q);
|
66 |
+
}
|
67 |
|
68 |
+
$query_results = $wpdb->insert($this->table_name, $values);
|
|
|
|
|
|
|
69 |
|
70 |
+
$link_id = ($query_results ? $wpdb->insert_id : false);
|
|
|
|
|
71 |
|
72 |
+
// Static caching - already here during this request
|
73 |
+
// Prevents dups
|
74 |
+
$slugs_done[$values['slug']] = $link_id;
|
75 |
|
76 |
+
//If JS or MetaRefresh are the default types we need to set this to 0 or the redirects will fail
|
77 |
+
if($link_id) {
|
78 |
+
$prli_link_meta->update_link_meta($link_id, 'delay', 0);
|
79 |
}
|
80 |
|
81 |
+
$this->update_cpt_title($values['link_cpt_id'], $values['name']);
|
82 |
+
$this->update_cpt_status($values['link_cpt_id']);
|
83 |
+
$this->update_cpt_post_date($values['link_cpt_id'], $now);
|
84 |
|
85 |
+
do_action('prli-create-link', $link_id, $values);
|
86 |
|
87 |
+
return $link_id;
|
88 |
+
}
|
89 |
|
90 |
+
public function update( $id, $values ) {
|
91 |
+
global $wpdb, $prli_link;
|
92 |
|
93 |
+
$now = current_time('mysql');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
+
$values = $this->sanitize($values);
|
96 |
+
$values['updated_at'] = $now;
|
97 |
|
98 |
+
$title = isset($values['name'])?trim($values['name']):'';
|
|
|
|
|
|
|
99 |
|
100 |
+
if(empty($title)) {
|
101 |
+
error_log("REDIRECT TYPE: " . $values['redirect_type']);
|
102 |
+
if($values['redirect_type'] == 'pixel') {
|
103 |
+
$title = $values['slug'];
|
104 |
+
}
|
105 |
+
else {
|
106 |
+
$title = PrliUtils::get_page_title($values['url'],$values['slug']);
|
107 |
+
}
|
108 |
}
|
109 |
|
110 |
+
$query_results = $wpdb->update($this->table_name, $values, array('id' => $id));
|
|
|
|
|
111 |
|
112 |
+
$link = $this->getOne($id);
|
113 |
+
$this->update_cpt_title($link->link_cpt_id, $title);
|
114 |
+
$this->update_cpt_status($link->link_cpt_id);
|
115 |
+
$this->update_cpt_post_modified($link->link_cpt_id, $now);
|
116 |
|
117 |
+
return $id;
|
118 |
+
}
|
119 |
|
120 |
+
public function disable_link($id) {
|
121 |
+
return $this->update_link_status( $id, 'disabled' );
|
122 |
+
}
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
+
public function enable_link($id) {
|
125 |
+
return $this->update_link_status( $id, 'enabled' );
|
126 |
+
}
|
127 |
|
128 |
+
public function update_link_status( $id, $link_status='enabled' ) {
|
129 |
+
global $wpdb;
|
130 |
|
131 |
+
$q = $wpdb->prepare("
|
132 |
+
UPDATE {$this->table_name}
|
133 |
+
SET link_status=%s
|
134 |
+
WHERE id=%d
|
135 |
+
",
|
136 |
+
$link_status,
|
137 |
+
$id
|
138 |
+
);
|
|
|
|
|
|
|
|
|
139 |
|
140 |
+
return $wpdb->query($q);
|
141 |
+
}
|
142 |
|
143 |
+
public function update_group($id, $value, $group_id) {
|
144 |
+
global $wpdb;
|
145 |
|
146 |
+
if (isset($value)) {
|
147 |
+
$query = $wpdb->prepare(
|
148 |
+
"UPDATE {$this->table_name} SET group_id = %d WHERE id = %d",
|
149 |
+
$group_id,
|
150 |
+
$id
|
151 |
+
);
|
152 |
+
} else {
|
153 |
+
$query = $wpdb->prepare(
|
154 |
+
"UPDATE {$this->table_name} SET group_id = NULL WHERE id = %d",
|
155 |
+
$id
|
156 |
+
);
|
157 |
+
}
|
158 |
|
159 |
+
$query_results = $wpdb->query($query);
|
160 |
|
161 |
+
return $query_results;
|
162 |
+
}
|
|
|
|
|
163 |
|
164 |
+
public function destroy($id, $delete_mode='delete_cpt') {
|
165 |
+
global $wpdb, $prli_click, $prli_link_meta;
|
|
|
166 |
|
167 |
+
do_action('prli_delete_link', $id);
|
|
|
168 |
|
169 |
+
$link = $this->getOne($id);
|
170 |
+
if($delete_mode=='delete_cpt' && $link->link_cpt_id > 0) {
|
171 |
+
wp_delete_post($link->link_cpt_id, true);
|
172 |
}
|
173 |
|
174 |
+
$metas = $wpdb->prepare("DELETE FROM {$prli_link_meta->table_name} WHERE link_id=%d",$id);
|
175 |
+
$reset = $wpdb->prepare("DELETE FROM {$prli_click->table_name} WHERE link_id=%d",$id);
|
176 |
+
$destroy = $wpdb->prepare("DELETE FROM {$this->table_name} WHERE id=%d",$id);
|
177 |
|
178 |
+
$wpdb->query($metas);
|
179 |
+
$wpdb->query($reset);
|
180 |
|
181 |
+
return $wpdb->query($destroy);
|
182 |
+
}
|
183 |
|
184 |
+
public function reset($id) {
|
185 |
+
global $wpdb, $prli_click, $prli_link_meta;
|
186 |
|
187 |
+
$prli_link_meta->delete_link_meta($id, 'static-clicks');
|
188 |
+
$prli_link_meta->delete_link_meta($id, 'static-uniques');
|
|
|
189 |
|
190 |
+
$reset = $wpdb->prepare("DELETE FROM {$prli_click->table_name} WHERE link_id=%d", $id);
|
|
|
|
|
191 |
|
192 |
+
return $wpdb->query($reset);
|
193 |
+
}
|
194 |
|
195 |
+
public function getOneFromSlug( $slug, $return_type = OBJECT, $include_stats = false, $exclude_disabled=true ) {
|
196 |
+
return $this->get_one_by( 'slug', $slug, $return_type, $include_stats, $exclude_disabled );
|
197 |
+
}
|
198 |
|
199 |
+
public function getOne( $id, $return_type = OBJECT, $include_stats = false, $exclude_disabled=true ) {
|
200 |
+
return $this->get_one_by( 'id', $id, $return_type, $include_stats, $exclude_disabled );
|
201 |
+
}
|
202 |
|
203 |
+
public function get_one_by( $field='id', $val, $return_type = OBJECT, $include_stats = false, $exclude_disabled=true ) {
|
204 |
+
global $wpdb, $prli_click, $prli_options, $prli_link_meta, $prli_blogurl;
|
205 |
|
206 |
+
$struct = PrliUtils::get_permalink_pre_slug_uri();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
+
if($include_stats) {
|
209 |
+
$query = "SELECT li.*, CONCAT(\"{$prli_blogurl}\",\"{$struct}\",li.slug) AS pretty_url, ";
|
210 |
+
|
211 |
+
$op = $prli_click->get_exclude_where_clause( ' AND' );
|
212 |
|
213 |
+
if($prli_options->extended_tracking != 'count') {
|
214 |
+
$query .= "
|
215 |
+
(
|
216 |
+
SELECT COUNT(*)
|
217 |
+
FROM {$prli_click->table_name} AS cl
|
218 |
+
WHERE cl.link_id = li.id
|
219 |
+
{$op}
|
220 |
+
) as clicks,
|
221 |
+
(
|
222 |
+
SELECT COUNT(*) FROM {$prli_click->table_name} AS cl
|
223 |
+
WHERE cl.link_id = li.id
|
224 |
+
AND cl.first_click <> 0
|
225 |
+
{$op}
|
226 |
+
) as uniques
|
227 |
+
";
|
228 |
+
}
|
229 |
+
else {
|
230 |
$query .= "
|
231 |
+
(
|
232 |
+
SELECT lm.meta_value
|
233 |
+
FROM {$prli_link_meta->table_name} AS lm
|
234 |
+
WHERE lm.meta_key=\"static-clicks\"
|
235 |
+
AND lm.link_id=li.id LIMIT 1
|
236 |
+
) as clicks,
|
237 |
+
(
|
238 |
+
SELECT lm.meta_value FROM {$prli_link_meta->table_name} AS lm
|
239 |
+
WHERE lm.meta_key=\"static-uniques\"
|
240 |
+
AND lm.link_id=li.id
|
241 |
+
LIMIT 1
|
242 |
+
) as uniques
|
243 |
";
|
244 |
}
|
245 |
+
}
|
246 |
+
else {
|
247 |
+
$query = "SELECT li.*, CONCAT(\"{$prli_blogurl}\",\"{$struct}\",li.slug) AS pretty_url";
|
248 |
+
}
|
249 |
+
|
250 |
+
$query .= "
|
251 |
+
FROM {$this->table_name} AS li
|
252 |
+
WHERE {$field}=%s
|
253 |
+
";
|
254 |
|
255 |
+
if($exclude_disabled) {
|
256 |
+
$query .= "
|
257 |
+
AND link_status='enabled'
|
258 |
+
";
|
259 |
+
}
|
260 |
|
261 |
+
$query = $wpdb->prepare($query, $val);
|
262 |
+
$link = $wpdb->get_row($query, $return_type);
|
263 |
|
264 |
+
//get_row returns a null if not found - we don't want nulls
|
265 |
+
if(!$link) { $link = false; }
|
|
|
|
|
266 |
|
267 |
+
if($include_stats and $link and $prli_options->extended_tracking == 'count') {
|
268 |
+
$link->clicks = $prli_link_meta->get_link_meta($link->id,'static-clicks',true);
|
269 |
+
$link->uniques = $prli_link_meta->get_link_meta($link->id,'static-uniques',true);
|
270 |
}
|
271 |
|
272 |
+
return $link;
|
273 |
+
}
|
|
|
|
|
|
|
|
|
274 |
|
275 |
+
public function find_first_target_url($target_url) {
|
276 |
+
global $wpdb;
|
277 |
+
$query_str = "SELECT id FROM {$this->table_name} WHERE link_status='enabled' AND url=%s LIMIT 1";
|
278 |
+
$query = $wpdb->prepare($query_str,$target_url);
|
279 |
+
return $wpdb->get_var($query);
|
280 |
+
}
|
281 |
|
282 |
+
public function get_or_create_pretty_link_for_target_url( $target_url, $group=0 ) {
|
283 |
+
global $wpdb;
|
284 |
+
$query_str = "SELECT * FROM {$this->table_name} WHERE link_status='enabled' AND url=%s LIMIT 1";
|
285 |
+
$query = $wpdb->prepare($query_str,$target_url);
|
286 |
+
$pretty_link = $wpdb->get_row($query);
|
287 |
|
288 |
+
if(empty($pretty_link) or !$pretty_link) {
|
289 |
+
$pl_insert_id = prli_create_pretty_link( $target_url, '', '', '', $group );
|
290 |
+
$pretty_link = $this->getOne($pl_insert_id);
|
|
|
291 |
}
|
292 |
|
293 |
+
if( !isset($pretty_link) or empty($pretty_link) or !$pretty_link )
|
294 |
+
return false;
|
295 |
+
else
|
296 |
+
return $pretty_link;
|
297 |
+
}
|
298 |
|
299 |
+
public function is_pretty_link($url, $check_domain=true) {
|
300 |
+
global $prli_blogurl;
|
|
|
301 |
|
302 |
+
if( !$check_domain or preg_match( '#^' . preg_quote( $prli_blogurl ) . '#', $url ) ) {
|
303 |
+
$uri = preg_replace('#' . preg_quote($prli_blogurl) . '#', '', $url);
|
304 |
|
305 |
+
// Resolve WP installs in sub-directories
|
306 |
+
preg_match('#^(https?://.*?)(/.*)$#', $prli_blogurl, $subdir);
|
307 |
|
308 |
+
$struct = PrliUtils::get_permalink_pre_slug_regex();
|
309 |
|
310 |
+
$subdir_str = (isset($subdir[2])?$subdir[2]:'');
|
311 |
|
312 |
+
$match_str = '#^'.$subdir_str.'('.$struct.')([^\?]*?)([\?].*?)?$#';
|
|
|
|
|
|
|
|
|
|
|
313 |
|
314 |
+
if(preg_match($match_str, $uri, $match_val)) {
|
315 |
+
// Match longest slug -- this is the most common
|
316 |
+
$pretty_link_params = (isset($match_val[3])?$match_val[3]:'');
|
317 |
+
if( $pretty_link_found = $this->is_pretty_link_slug( $match_val[2] ) )
|
318 |
+
return compact('pretty_link_found');
|
319 |
|
320 |
+
// Trim down the matched link
|
321 |
+
$matched_link = preg_replace('#/[^/]*?$#','',$match_val[2],1);
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
|
323 |
+
// cycle through the links (maximum depth 25 folders so we don't get out
|
324 |
+
// of control -- that should be enough eh?) and trim the link down each time
|
325 |
+
for( $i=0; ($i < 25) and
|
326 |
+
$matched_link and
|
327 |
+
!empty($matched_link) and
|
328 |
+
$matched_link != $match_val[2]; $i++ ) {
|
329 |
+
$new_match_str ="#^{$subdir_str}({$struct})({$matched_link})(.*?)?$#";
|
330 |
|
331 |
+
$pretty_link_params = (isset($match_val[3])?$match_val:'');
|
332 |
+
if( $pretty_link_found = $this->is_pretty_link_slug( $match_val[2] ) )
|
333 |
+
return compact('pretty_link_found');
|
334 |
+
|
335 |
+
// Trim down the matched link and try again
|
336 |
+
$matched_link = preg_replace('#/[^/]*$#','',$match_val[2],1);
|
337 |
}
|
338 |
}
|
|
|
|
|
339 |
}
|
340 |
|
341 |
+
return false;
|
342 |
+
}
|
|
|
343 |
|
344 |
+
public function is_pretty_link_slug($slug) {
|
345 |
+
return apply_filters('prli-check-if-slug', $this->getOneFromSlug( rawurldecode($slug) ), rawurldecode($slug));
|
346 |
+
}
|
|
|
|
|
347 |
|
348 |
+
public function get_link_min( $id, $return_type = OBJECT ) {
|
349 |
+
global $wpdb, $prli_link_meta;
|
350 |
+
$query_str = "SELECT * FROM {$this->table_name} WHERE link_status='enabled' AND id=%d";
|
351 |
+
$query = $wpdb->prepare($query_str, $id);
|
352 |
+
$res = $wpdb->get_row($query, $return_type);
|
353 |
|
354 |
+
//Load in some meta data too
|
355 |
+
if($res && $return_type == ARRAY_A) {
|
356 |
+
$res['delay'] = (int)$prli_link_meta->get_link_meta($id, 'delay', true);
|
357 |
+
$res['google_tracking'] = (int)$prli_link_meta->get_link_meta($id, 'google_tracking', true);
|
358 |
}
|
359 |
|
360 |
+
return $res;
|
361 |
+
}
|
362 |
+
|
363 |
+
public function getAll($where = '', $order_by = '', $return_type = OBJECT, $include_stats = false) {
|
364 |
+
global $wpdb, $prli_click, $prli_group, $prli_link_meta, $prli_options, $prli_utils, $prli_blogurl;
|
365 |
|
366 |
+
$struct = PrliUtils::get_permalink_pre_slug_regex();
|
367 |
|
368 |
+
$op = $prli_click->get_exclude_where_clause( ' AND' );
|
369 |
|
370 |
+
if($include_stats) {
|
371 |
+
$query = "SELECT li.*, CONCAT(\"{$prli_blogurl}\",\"{$struct}\",li.slug) AS pretty_url, ";
|
372 |
+
if($prli_options->extended_tracking != 'count') {
|
373 |
+
$query .= "
|
374 |
+
(
|
375 |
+
SELECT COUNT(*)
|
376 |
+
FROM {$prli_click->table_name} AS cl
|
377 |
+
WHERE cl.link_id = li.id
|
378 |
+
{$op}
|
379 |
+
) as clicks,
|
380 |
+
(
|
381 |
+
SELECT COUNT(*)
|
382 |
+
FROM {$prli_click->table_name} AS cl
|
383 |
+
WHERE cl.link_id = li.id
|
384 |
+
AND cl.first_click <> 0
|
385 |
+
{$op}
|
386 |
+
) as uniques
|
387 |
+
";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
}
|
389 |
else {
|
390 |
+
$query .= "
|
391 |
+
(
|
392 |
+
SELECT lm.meta_value
|
393 |
+
FROM {$prli_link_meta->table_name} AS lm
|
394 |
+
WHERE lm.meta_key=\"static-clicks\"
|
395 |
+
AND lm.link_id=li.id
|
396 |
+
LIMIT 1
|
397 |
+
) as clicks,
|
398 |
+
(
|
399 |
+
SELECT lm.meta_value
|
400 |
+
FROM {$prli_link_meta->table_name} AS lm
|
401 |
+
WHERE lm.meta_key=\"static-uniques\"
|
402 |
+
AND lm.link_id=li.id
|
403 |
+
LIMIT 1
|
404 |
+
) as uniques
|
405 |
+
";
|
406 |
}
|
407 |
+
}
|
408 |
+
else {
|
409 |
+
$query = "SELECT li.*,CONCAT(\"{$prli_blogurl}\",\"{$struct}\",li.slug) AS pretty_url ";
|
|
|
|
|
|
|
|
|
410 |
}
|
411 |
|
412 |
+
$query .= "FROM {$this->table_name} AS li
|
413 |
+
WHERE li.link_status='enabled'
|
414 |
+
" . $prli_utils->prepend_and_or_where(' AND', $where) .
|
415 |
+
$order_by;
|
416 |
|
417 |
+
return $wpdb->get_results($query, $return_type);
|
418 |
+
}
|
419 |
+
|
420 |
+
public function generateValidSlug($num_chars = 4) {
|
421 |
+
global $wpdb, $plp_update, $plp_options;
|
422 |
+
$slug_prefix = '';
|
423 |
|
424 |
+
//Maybe use a different number of characters?
|
425 |
+
if($plp_update->is_installed()) {
|
426 |
+
if(!empty($plp_options->base_slug_prefix)) {
|
427 |
+
$slug_prefix = $plp_options->base_slug_prefix . '/';
|
428 |
}
|
429 |
|
430 |
+
$num_chars = $plp_options->num_slug_chars;
|
431 |
+
}
|
432 |
|
433 |
+
$slug = $slug_prefix . PrliUtils::gen_random_string($num_chars);
|
|
|
|
|
434 |
|
435 |
+
// Intentionally not checking to see if link is enabled or disabled
|
436 |
+
$query = "SELECT slug FROM {$this->table_name}";
|
437 |
+
$slugs = $wpdb->get_col($query,0);
|
|
|
|
|
438 |
|
439 |
+
// It is highly unlikely that we'll ever see 2 identical random slugs
|
440 |
+
// but just in case, here's some code to prevent collisions
|
441 |
+
while(in_array($slug, $slugs) || is_wp_error(PrliUtils::is_slug_available($slug))) {
|
442 |
+
$slug = $slug_prefix . PrliUtils::gen_random_string($num_chars);
|
443 |
}
|
444 |
|
445 |
+
return apply_filters('prli-auto-generated-slug', $slug, $slugs, $num_chars);
|
446 |
+
}
|
447 |
|
448 |
+
public function get_pretty_link_url($slug, $esc_url=false) {
|
449 |
+
global $prli_blogurl;
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
|
451 |
+
$link = $this->getOneFromSlug($slug);
|
452 |
+
$pretty_link_url = $prli_blogurl . PrliUtils::get_permalink_pre_slug_uri() . $link->slug;
|
453 |
+
if($esc_url) {
|
454 |
+
$pretty_link_url = esc_url($pretty_link_url);
|
455 |
+
}
|
456 |
+
else {
|
457 |
+
$pretty_link_url = $pretty_link_url;
|
458 |
}
|
459 |
|
460 |
+
if( ( !isset($link->param_forwarding) || empty($link->param_forwarding) || $link->param_forwarding=='off' ) &&
|
461 |
+
( isset($link->redirect_type) && $link->redirect_type == 'pixel' ) ) {
|
462 |
+
return '<img src="'.$pretty_link_url.'" width="1" height="1" style="display: none" />';
|
463 |
+
}
|
464 |
+
else {
|
465 |
+
return $pretty_link_url;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
}
|
467 |
+
}
|
468 |
|
469 |
+
/**
|
470 |
+
* Sanitize the given link options and return them
|
471 |
+
*
|
472 |
+
* @param array $values
|
473 |
+
* @return array
|
474 |
+
*/
|
475 |
+
public function sanitize($values) {
|
476 |
+
$sanitized = array(
|
477 |
+
'redirect_type' => isset($values['redirect_type']) && is_string($values['redirect_type']) ? sanitize_key($values['redirect_type']) : '307',
|
478 |
+
'url' => isset($values['url']) && is_string($values['url']) ? esc_url_raw(trim($values['url'])) : '',
|
479 |
+
'slug' => isset($values['slug']) && is_string($values['slug']) ? sanitize_text_field($values['slug']) : '',
|
480 |
+
'name' => isset($values['name']) && is_string($values['name']) ? sanitize_text_field($values['name']) : '',
|
481 |
+
'description' => isset($values['description']) && is_string($values['description']) ? sanitize_textarea_field($values['description']) : '',
|
482 |
+
'group_id' => isset($values['group_id']) && is_numeric($values['group_id']) ? (int) $values['group_id'] : null,
|
483 |
+
'nofollow' => isset($values['nofollow']) ? 1 : 0,
|
484 |
+
'param_forwarding' => isset($values['param_forwarding']) ? 1 : 0,
|
485 |
+
'track_me' => isset($values['track_me']) ? 1 : 0,
|
486 |
+
'link_cpt_id' => isset($values['link_cpt_id']) && is_numeric($values['link_cpt_id']) ? (int) $values['link_cpt_id'] : 0
|
487 |
+
);
|
488 |
|
489 |
+
return $sanitized;
|
490 |
+
}
|
491 |
|
492 |
+
public function validate( $values , $id = null ) {
|
493 |
+
global $wpdb, $prli_utils, $prli_blogurl;
|
|
|
|
|
494 |
|
495 |
+
$values = $this->sanitize($values);
|
|
|
|
|
496 |
|
497 |
+
$errors = array();
|
498 |
+
if( empty($values['url']) && $values['redirect_type'] != 'pixel' ) {
|
499 |
+
$errors[] = __("Target URL can't be blank", 'pretty-link');
|
500 |
+
}
|
501 |
|
502 |
+
if( $values['url'] == $prli_blogurl.PrliUtils::get_permalink_pre_slug_uri().$values['slug'] ) {
|
503 |
+
$errors[] = __("Target URL must be different than the Pretty Link", 'pretty-link');
|
504 |
+
}
|
505 |
|
506 |
+
if( !empty($values['url']) && !PrliUtils::is_url($values['url']) ) {
|
507 |
+
$errors[] = __("Link URL must be a correctly formatted url", 'pretty-link');
|
508 |
+
}
|
509 |
|
510 |
+
if( preg_match('/^[\?\&\#]+$/', $values['slug'] ) ) {
|
511 |
+
$errors[] = __("Pretty Link slugs must not contain question marks, ampersands or number signs.", 'pretty-link');
|
512 |
+
}
|
|
|
513 |
|
514 |
+
if( preg_match('#/$#', $values['slug']) ) {
|
515 |
+
$errors[] = __("Pretty Link slugs must not end with a slash (\"/\")", 'pretty-link');
|
516 |
}
|
517 |
|
518 |
+
$slug_is_available = PrliUtils::is_slug_available($values['slug'],$id);
|
519 |
+
if(is_wp_error($slug_is_available)) {
|
520 |
+
$errors[] = $slug_is_available->get_error_message();
|
|
|
|
|
521 |
}
|
522 |
|
523 |
+
return $errors;
|
524 |
+
}
|
525 |
|
526 |
+
public function get_link_slug($url) {
|
527 |
+
global $prli_blogurl;
|
528 |
+
$ugh = preg_quote($prli_blogurl.PrliUtils::get_permalink_pre_slug_uri(), '!');
|
529 |
+
$mod = preg_replace("!^{$ugh}!", '', $url);
|
530 |
+
return "\"{$mod}\"";
|
531 |
+
}
|
532 |
|
533 |
+
public function get_target_to_pretty_urls($urls=array(),$create_pretty_links=false) {
|
534 |
+
global $wpdb, $prli_blogurl;
|
|
|
|
|
|
|
|
|
535 |
|
536 |
+
if(empty($urls)) { return false; }
|
|
|
537 |
|
538 |
+
$decoded_urls = array_map(
|
539 |
+
function($url) {
|
540 |
+
return html_entity_decode(rawurldecode($url));
|
541 |
+
},
|
542 |
+
$urls
|
543 |
+
);
|
|
|
|
|
544 |
|
545 |
+
// Filter out urls that are already Pretty Links
|
546 |
+
$where = "IN (" . implode( ',', array_map( array($this, 'get_link_slug'), $decoded_urls ) ) . ")";
|
547 |
|
548 |
+
$query = "
|
549 |
+
SELECT CONCAT(%s, li.slug) AS pretty_url
|
550 |
+
FROM {$this->table_name} AS li
|
551 |
+
WHERE li.link_status='enabled'
|
552 |
+
AND li.slug {$where}
|
553 |
+
";
|
554 |
+
$query = $wpdb->prepare($query, $prli_blogurl.PrliUtils::get_permalink_pre_slug_uri());
|
555 |
+
$plinks = $wpdb->get_col($query);
|
556 |
|
557 |
+
$decoded_urls = array_diff($decoded_urls, $plinks);
|
|
|
|
|
|
|
|
|
558 |
|
559 |
+
if(empty($decoded_urls)) { return false; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
560 |
|
561 |
+
$where = "IN (" . implode( ',', array_map(
|
562 |
+
function($url) {
|
563 |
+
return "\"{$url}\"";
|
564 |
+
},
|
565 |
+
$decoded_urls ) ) . ")";
|
566 |
|
567 |
+
$query = "
|
568 |
+
SELECT li.url AS target_url,
|
569 |
+
CONCAT(%s, li.slug) AS pretty_url
|
570 |
+
FROM {$this->table_name} AS li
|
571 |
+
WHERE li.link_status='enabled'
|
572 |
+
AND li.url {$where}
|
573 |
+
";
|
574 |
+
$query = $wpdb->prepare($query, $prli_blogurl.PrliUtils::get_permalink_pre_slug_uri());
|
575 |
+
|
576 |
+
$results = (array)$wpdb->get_results($query);
|
577 |
+
|
578 |
+
$prli_lookup = array();
|
579 |
+
foreach($results as $url_hash) {
|
580 |
+
if(isset($prli_lookup[$url_hash->target_url])) {
|
581 |
+
$prli_lookup[$url_hash->target_url][] = $url_hash->pretty_url;
|
582 |
+
}
|
583 |
+
else {
|
584 |
+
$prli_lookup[$url_hash->target_url] = array($url_hash->pretty_url);
|
585 |
}
|
586 |
+
}
|
587 |
|
588 |
+
if($create_pretty_links) {
|
589 |
+
foreach($decoded_urls as $url) {
|
590 |
+
if(!isset($prli_lookup[$url])) {
|
591 |
+
if( $id = prli_create_pretty_link( $url ) ) {
|
592 |
+
$prli_lookup[$url] = array(prli_get_pretty_link_url($id));
|
|
|
593 |
}
|
594 |
}
|
595 |
}
|
|
|
|
|
596 |
}
|
597 |
|
598 |
+
return $prli_lookup;
|
599 |
+
}
|
600 |
+
|
601 |
+
public static function bookmarklet_link() {
|
602 |
+
global $prli_options;
|
603 |
+
$site_url = site_url();
|
604 |
+
return "javascript:location.href='{$site_url}/index.php?action=prli_bookmarklet&k={$prli_options->bookmarklet_auth}&target_url='+escape(location.href);";
|
605 |
+
}
|
606 |
|
607 |
public function get_link_from_cpt($cpt_id) {
|
608 |
global $wpdb;
|
653 |
$inserted = $wpdb->insert(
|
654 |
$wpdb->posts,
|
655 |
array(
|
656 |
+
'post_author' => get_current_user_id(),
|
657 |
'post_title' => stripslashes($title),
|
658 |
'post_type' => PrliLink::$cpt,
|
659 |
'post_status' => 'publish',
|
664 |
'comment_status' => 'closed',
|
665 |
'ping_status' => 'closed'
|
666 |
),
|
667 |
+
array('%d','%s','%s','%s','%s','%s','%s','%s')
|
668 |
);
|
669 |
|
670 |
return $inserted ? $wpdb->insert_id : false;
|
765 |
return $groups;
|
766 |
}
|
767 |
}
|
|
app/views/links/form_basic.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
); ?>
|
12 |
</th>
|
13 |
<td>
|
14 |
-
<select id="redirect_type" name="redirect_type"
|
15 |
<option value="307"<?php echo $values['redirect_type']['307']; ?>><?php esc_html_e("307 (Temporary)", 'pretty-link') ?> </option>
|
16 |
<option value="302"<?php echo $values['redirect_type']['302']; ?>><?php esc_html_e("302 (Temporary)", 'pretty-link') ?> </option>
|
17 |
<option value="301"<?php echo $values['redirect_type']['301']; ?>><?php esc_html_e("301 (Permanent)", 'pretty-link') ?> </option>
|
11 |
); ?>
|
12 |
</th>
|
13 |
<td>
|
14 |
+
<select id="redirect_type" name="redirect_type">
|
15 |
<option value="307"<?php echo $values['redirect_type']['307']; ?>><?php esc_html_e("307 (Temporary)", 'pretty-link') ?> </option>
|
16 |
<option value="302"<?php echo $values['redirect_type']['302']; ?>><?php esc_html_e("302 (Temporary)", 'pretty-link') ?> </option>
|
17 |
<option value="301"<?php echo $values['redirect_type']['301']; ?>><?php esc_html_e("301 (Permanent)", 'pretty-link') ?> </option>
|
js/editor.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
!function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=38)}([function(t,e){!function(){t.exports=this.wp.element}()},function(t,e){!function(){t.exports=this.wp.i18n}()},function(t,e){!function(){t.exports=this.wp.url}()},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e){!function(){t.exports=this.wp.components}()},function(t,e){!function(){t.exports=this.wp.
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
@@ -9,4 +9,4 @@
|
|
9 |
Licensed under the MIT License (MIT), see
|
10 |
http://jedwatson.github.io/classnames
|
11 |
*/
|
12 |
-
!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var t=[],e=0;e<arguments.length;e++){var o=arguments[e];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o)&&o.length){var s=r.apply(null,o);s&&t.push(s)}else if("object"===i)for(var a in o)n.call(o,a)&&o[a]&&t.push(a)}}return t.join(" ")}void 0!==t&&t.exports?(r.default=r,t.exports=r):void 0===(o=function(){return r}.apply(e,[]))||(t.exports=o)}()},function(t,e,n){var o=n(32);t.exports=function(t,e){if(null==t)return{};var n,r,i=o(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}},function(t,e){!function(){t.exports=this.wp.compose}()},function(t,e,n){"use strict";n.r(e);var o=n(12),r=n.n(o),i=n(11),s=n.n(i),a=n(10),c=n.n(a),u=n(9),l=n.n(u),f=n(3),p=n.n(f),d=n(8),h=n.n(d),v=n(23),b=n.n(v),g=n(16),m=n.n(g),y=n(0),k=n(15),w=n.n(k),O=n(1),j=n(4),L=n(6),S=n(22),x=n(2),E=n(5),_=n(7),C=(n(19),n(14)),R=(n(31),n(13));function T(t){if(!t)return!1;var e=t.trim();if(!e)return!1;if(/^\S+:/.test(e)){var n=Object(x.getProtocol)(e);if(!Object(x.isValidProtocol)(n))return!1;if(Object(R.startsWith)(n,"http")&&!/^https?:\/\/[^\/\s]/i.test(e))return!1;var o=Object(x.getAuthority)(e);if(!Object(x.isValidAuthority)(o))return!1;var r=Object(x.getPath)(e);if(r&&!Object(x.isValidPath)(r))return!1;var i=Object(x.getQueryString)(e);if(i&&!Object(x.isValidQueryString)(i))return!1;var s=Object(x.getFragment)(e);if(s&&!Object(x.isValidFragment)(s))return!1}return!(Object(R.startsWith)(e,"#")&&!Object(x.isValidFragment)(e))}function P(t){var e=t.url,n=t.opensInNewWindow,o=t.text,r={type:"core/link",attributes:{url:e}};if(n){var i=Object(O.sprintf)(Object(O.__)("%s (opens in a new tab)"),o);r.attributes.target="_blank",r.attributes.rel="noreferrer noopener",r.attributes["aria-label"]=i}return r}var N=function(t){return t.stopPropagation()};function A(t,e){return t.addingLink||e.editLink}var I=function(t){var e=t.value,n=t.onChangeInputValue,o=t.onKeyDown,r=t.submitLink,i=t.autocompleteRef;return Object(y.createElement)("form",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",onKeyPress:N,onKeyDown:o,onSubmit:r},Object(y.createElement)(C.default,{value:e,onChange:n,autocompleteRef:i}),Object(y.createElement)(j.IconButton,{icon:"editor-break",label:Object(O.__)("Insert Pretty Link"),type:"submit"}))},U=function(t){var e=t.url,n=Object(x.prependHTTP)(e),o=w()("editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value",{"has-invalid-link":!T(n)});return e?Object(y.createElement)(j.ExternalLink,{className:o,href:e},Object(x.filterURLForDisplay)(Object(x.safeDecodeURI)(e))):Object(y.createElement)("span",{className:o})},W=function(t){var e=t.isActive,n=t.addingLink,o=t.value,r=m()(t,["isActive","addingLink","value"]),i=Object(y.useMemo)(function(){var t=window.getSelection(),e=t.rangeCount>0?t.getRangeAt(0):null;if(e){if(n)return Object(S.getRectangleFromRange)(e);var o=e.startContainer;for(o=o.nextElementSibling||o;o.nodeType!==window.Node.ELEMENT_NODE;)o=o.parentNode;var r=o.closest("a");return r?r.getBoundingClientRect():void 0}},[e,n,o.start,o.end]);return i?Object(y.createElement)(_.URLPopover,b()({anchorRect:i},r)):null},D=function(t){var e=t.url,n=t.editLink;return Object(y.createElement)("div",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",onKeyPress:N},Object(y.createElement)(U,{url:e}),Object(y.createElement)(j.IconButton,{icon:"edit",label:Object(O.__)("Edit"),onClick:n}))},F=function(t){function e(){var t;return r()(this,e),(t=c()(this,l()(e).apply(this,arguments))).editLink=t.editLink.bind(p()(t)),t.submitLink=t.submitLink.bind(p()(t)),t.onKeyDown=t.onKeyDown.bind(p()(t)),t.onChangeInputValue=t.onChangeInputValue.bind(p()(t)),t.setLinkTarget=t.setLinkTarget.bind(p()(t)),t.onClickOutside=t.onClickOutside.bind(p()(t)),t.resetState=t.resetState.bind(p()(t)),t.autocompleteRef=Object(y.createRef)(),t.state={opensInNewWindow:!1,inputValue:"",newLinkUrl:"",newLinkSlug:"",creatingLink:!1,createdLink:!1,createdLinkError:!1},t}return h()(e,t),s()(e,[{key:"onKeyDown",value:function(t){[L.LEFT,L.DOWN,L.RIGHT,L.UP,L.BACKSPACE,L.ENTER].indexOf(t.keyCode)>-1&&t.stopPropagation()}},{key:"onChangeInputValue",value:function(t){this.setState({inputValue:t})}},{key:"setLinkTarget",value:function(t){var e=this.props,n=e.activeAttributes.url,o=void 0===n?"":n,r=e.value,i=e.onChange;if(this.setState({opensInNewWindow:t}),!A(this.props,this.state)){var s=Object(E.getTextContent)(Object(E.slice)(r));i(Object(E.applyFormat)(r,P({url:o,opensInNewWindow:t,text:s})))}}},{key:"editLink",value:function(t){this.setState({editLink:!0}),t.preventDefault()}},{key:"submitLink",value:function(t){var e=this.props,n=e.isActive,o=e.value,r=e.onChange,i=e.speak,s=this.state,a=s.inputValue,c=s.opensInNewWindow,u=Object(x.prependHTTP)(a),l=P({url:u,opensInNewWindow:c,text:Object(E.getTextContent)(Object(E.slice)(o))});if(t.preventDefault(),Object(E.isCollapsed)(o)&&!n){var f=Object(E.applyFormat)(Object(E.create)({text:u}),l,0,u.length);r(Object(E.insert)(o,f))}else r(Object(E.applyFormat)(o,l));this.resetState(),T(u)?i(n?Object(O.__)("Link edited."):Object(O.__)("Link inserted."),"assertive"):i(Object(O.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive")}},{key:"onClickOutside",value:function(t){var e=this.autocompleteRef.current;e&&e.contains(t.target)||this.resetState()}},{key:"resetState",value:function(){this.props.stopAddingLink(),this.setState({editLink:!1})}},{key:"render",value:function(){var t=this,e=this.props,n=e.isActive,o=e.activeAttributes.url,r=e.addingLink,i=e.value;if(!n&&!r)return null;var s=this.state,a=s.inputValue,c=s.opensInNewWindow,u=s.newLinkUrl,l=s.newLinkSlug,f=s.creatingLink,p=s.createdLink,d=s.createdLinkError,h=A(this.props,this.state);return Object(y.createElement)(W,{className:"pretty-link-inserter",value:i,isActive:n,addingLink:r,onClickOutside:this.onClickOutside,onClose:this.resetState,focusOnMount:!!h&&"firstElement",renderSettings:function(){return Object(y.createElement)(y.Fragment,null,Object(y.createElement)("div",null,Object(y.createElement)(j.ToggleControl,{label:Object(O.__)("Open in New Tab"),checked:c,onChange:t.setLinkTarget})),Object(y.createElement)("div",{className:"pretty-link-inserter-form-container"},p&&Object(y.createElement)(j.Notice,{status:"success",onRemove:function(){return t.setState({createdLink:!1})}},Object(y.createElement)("p",null,Object(O.__)("Pretty Link created successfully.","memberpress"))),d&&Object(y.createElement)(j.Notice,{status:"error",onRemove:function(){return t.setState({createdLink:!1,createdLinkError:!1})}},Object(y.createElement)("p",null,Object(O.__)("Pretty Link could not be created. Please try a slug that is not already used.","memberpress"))),Object(y.createElement)("strong",null,Object(O.__)("New Pretty Link","pretty-link")),Object(y.createElement)("form",{onSubmit:function(e){e.preventDefault(),t.setState({creatingLink:!0,createdLinkError:!1}),function(t,e){return new Promise(function(n,o){jQuery.post(ajaxurl,{action:"prli_create_pretty_link",target:t,slug:e,redirect:"",nofollow:1,tracking:1},function(t,e,r){"true"===t?n(t):o(t)}).fail(function(t){o(t)})})}(u,l).then(function(e){t.setState({createdLink:!0,creatingLink:!1,inputValue:plEditor.homeUrl+l,newLinkUrl:"",newLinkSlug:""})}).catch(function(e){t.setState({createdLink:!1,creatingLink:!1,createdLinkError:!0})})}},Object(y.createElement)("p",null,Object(y.createElement)(j.TextControl,{placeholder:"URL",className:"pretty-link-new-link-url",value:u,onChange:function(e){t.setState({newLinkUrl:e})}})),Object(y.createElement)("p",null,Object(y.createElement)(j.TextControl,{placeholder:"Slug",className:"pretty-link-new-link-slug",value:l,onChange:function(e){t.setState({newLinkSlug:e})}})),Object(y.createElement)("p",null,Object(y.createElement)("button",{className:"pretty-link-submit-new-link components-button is-button is-primary",onClick:function(){console.log("Creating new Pretty Link...")}},Object(O.__)("Create New Pretty Link","pretty-link")),f&&Object(y.createElement)(j.Spinner,null)))))}},h?Object(y.createElement)(I,{value:a,onChangeInputValue:this.onChangeInputValue,onKeyDown:this.onKeyDown,submitLink:this.submitLink,autocompleteRef:this.autocompleteRef}):Object(y.createElement)(D,{url:o,editLink:this.editLink}))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var n=t.activeAttributes,o=n.url,r="_blank"===n.target;if(!A(t,e)){if(o!==e.inputValue)return{inputValue:o};if(r!==e.opensInNewWindow)return{opensInNewWindow:r}}return null}}]),e}(y.Component);e.default=Object(j.withSpokenMessages)(F)},function(t,e){!function(){t.exports=this.wp.apiFetch}()},function(t,e){!function(){t.exports=this.wp.htmlEntities}()},function(t,e){!function(){t.exports=this.regeneratorRuntime}()},function(t,e){!function(){t.exports=this.wp.dom}()},function(t,e){function n(){return t.exports=n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},n.apply(this,arguments)}t.exports=n},function(t,e){!function(){t.exports=this.wp.data}()},function(t,e,n){"use strict";t.exports=n(34)},function(t,e){function n(t,e,n,o,r,i,s){try{var a=t[i](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(o,r)}t.exports=function(t){return function(){var e=this,o=arguments;return new Promise(function(r,i){var s=t.apply(e,o);function a(t){n(s,r,i,a,c,"next",t)}function c(t){n(s,r,i,a,c,"throw",t)}a(void 0)})}}},function(t,e,n){"use strict";n.r(e),n.d(e,"prettyLink",function(){return x});var o=n(16),r=n.n(o),i=n(12),s=n.n(i),a=n(11),c=n.n(a),u=n(10),l=n.n(u),f=n(9),p=n.n(f),d=n(3),h=n.n(d),v=n(8),b=n.n(v),g=n(0),m=n(1),y=n(4),k=n(5),w=n(2),O=n(7),j=n(18),L="pretty-link/pretty-link",S=Object(m.__)("Pretty Link"),x={name:L,title:S,tagName:"a",className:"pretty-link",attributes:{url:"href",target:"target"},edit:Object(y.withSpokenMessages)(function(t){function e(){var t;return s()(this,e),(t=l()(this,p()(e).apply(this,arguments))).addLink=t.addLink.bind(h()(t)),t.stopAddingLink=t.stopAddingLink.bind(h()(t)),t.onRemoveFormat=t.onRemoveFormat.bind(h()(t)),t.state={addingLink:!1},t}return b()(e,t),c()(e,[{key:"addLink",value:function(){var t=this.props,e=t.value,n=t.onChange,o=Object(k.getTextContent)(Object(k.slice)(e));o&&Object(w.isURL)(o)?n(Object(k.applyFormat)(e,{type:L,attributes:{url:o}})):this.setState({addingLink:!0})}},{key:"stopAddingLink",value:function(){this.setState({addingLink:!1})}},{key:"onRemoveFormat",value:function(){var t=this.props,e=t.value,n=t.onChange,o=t.speak;n(Object(k.removeFormat)(e,L)),o(Object(m.__)("Link removed."),"assertive")}},{key:"render",value:function(){var t=this.props,e=t.isActive,n=t.activeAttributes,o=t.value,r=t.onChange;return Object(g.createElement)(g.Fragment,null,Object(g.createElement)(O.RichTextShortcut,{type:"primary",character:"p",onUse:this.addLink}),Object(g.createElement)(O.RichTextShortcut,{type:"primaryShift",character:"p",onUse:this.onRemoveFormat}),e&&Object(g.createElement)(O.RichTextToolbarButton,{icon:"star-filled",title:Object(m.__)("Unlink"),onClick:this.onRemoveFormat,isActive:e,shortcutType:"primaryShift",shortcutCharacter:"p"}),!e&&Object(g.createElement)(O.RichTextToolbarButton,{icon:"star-filled",title:S,onClick:this.addLink,isActive:e,shortcutType:"primary",shortcutCharacter:"p"}),Object(g.createElement)(j.default,{addingLink:this.state.addingLink,stopAddingLink:this.stopAddingLink,isActive:e,activeAttributes:n,value:o,onChange:r}))}}]),e}(g.Component))};[x].forEach(function(t){var e=t.name,n=r()(t,["name"]);return Object(k.registerFormatType)(e,n)})},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var r,i=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(r=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:o+i.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")})}},function(t,e,n){var o={},r=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}(function(){return window&&document&&document.all&&!window.atob}),i=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var o=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,n);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(t){o=null}e[t]=o}return e[t]}}(),s=null,a=0,c=[],u=n(28);function l(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=o[r.id];if(i){i.refs++;for(var s=0;s<i.parts.length;s++)i.parts[s](r.parts[s]);for(;s<r.parts.length;s++)i.parts.push(b(r.parts[s],e))}else{var a=[];for(s=0;s<r.parts.length;s++)a.push(b(r.parts[s],e));o[r.id]={id:r.id,refs:1,parts:a}}}}function f(t,e){for(var n=[],o={},r=0;r<t.length;r++){var i=t[r],s=e.base?i[0]+e.base:i[0],a={css:i[1],media:i[2],sourceMap:i[3]};o[s]?o[s].parts.push(a):n.push(o[s]={id:s,parts:[a]})}return n}function p(t,e){var n=i(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=c[c.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),c.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var r=i(t.insertAt.before,n);n.insertBefore(e,r)}}function d(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=c.indexOf(t);e>=0&&c.splice(e,1)}function h(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var o=function(){0;return n.nc}();o&&(t.attrs.nonce=o)}return v(e,t.attrs),p(t,e),e}function v(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function b(t,e){var n,o,r,i;if(e.transform&&t.css){if(!(i="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=i}if(e.singleton){var c=a++;n=s||(s=h(e)),o=m.bind(null,n,c,!1),r=m.bind(null,n,c,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",v(e,t.attrs),p(t,e),e}(e),o=function(t,e,n){var o=n.css,r=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||i)&&(o=u(o));r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var s=new Blob([o],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}.bind(null,n,e),r=function(){d(n),n.href&&URL.revokeObjectURL(n.href)}):(n=h(e),o=function(t,e){var n=e.css,o=e.media;o&&t.setAttribute("media",o);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),r=function(){d(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else r()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=r()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return l(n,e),function(t){for(var r=[],i=0;i<n.length;i++){var s=n[i];(a=o[s.id]).refs--,r.push(a)}t&&l(f(t,e),e);for(i=0;i<r.length;i++){var a;if(0===(a=r[i]).refs){for(var c=0;c<a.parts.length;c++)a.parts[c]();delete o[a.id]}}}};var g=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}();function m(t,e,n,o){var r=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=g(e,r);else{var i=document.createTextNode(r),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(i,s[e]):t.appendChild(i)}}},function(t,e){t.exports=".pretty-link-inserter .block-editor-url-popover__settings {\n display: block; }\n\n.pretty-link-inserter .pretty-link-inserter-form-container {\n margin-top: 30px; }\n"},function(t,e,n){var o=n(30);"string"==typeof o&&(o=[[t.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(29)(o,r);o.locals&&(t.exports=o.locals)},function(t,e){t.exports=function(t,e){if(null==t)return{};var n,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)n=i[o],e.indexOf(n)>=0||(r[n]=t[n]);return r}},function(t,e,n){"use strict";var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};function i(t,e){var n=t["page"+(e?"Y":"X")+"Offset"],o="scroll"+(e?"Top":"Left");if("number"!=typeof n){var r=t.document;"number"!=typeof(n=r.documentElement[o])&&(n=r.body[o])}return n}function s(t){return i(t)}function a(t){return i(t,!0)}function c(t){var e=function(t){var e,n=void 0,o=void 0,r=t.ownerDocument,i=r.body,s=r&&r.documentElement;return n=(e=t.getBoundingClientRect()).left,o=e.top,{left:n-=s.clientLeft||i.clientLeft||0,top:o-=s.clientTop||i.clientTop||0}}(t),n=t.ownerDocument,o=n.defaultView||n.parentWindow;return e.left+=s(o),e.top+=a(o),e}var u=new RegExp("^("+/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source+")(?!px)[a-z%]+$","i"),l=/^(top|right|bottom|left)$/,f="currentStyle",p="runtimeStyle",d="left",h="px";var v=void 0;function b(t,e){for(var n=0;n<t.length;n++)e(t[n])}function g(t){return"border-box"===v(t,"boxSizing")}"undefined"!=typeof window&&(v=window.getComputedStyle?function(t,e,n){var o="",r=t.ownerDocument,i=n||r.defaultView.getComputedStyle(t,null);return i&&(o=i.getPropertyValue(e)||i[e]),o}:function(t,e){var n=t[f]&&t[f][e];if(u.test(n)&&!l.test(e)){var o=t.style,r=o[d],i=t[p][d];t[p][d]=t[f][d],o[d]="fontSize"===e?"1em":n||0,n=o.pixelLeft+h,o[d]=r,t[p][d]=i}return""===n?"auto":n});var m=["margin","border","padding"],y=-1,k=2,w=1;function O(t,e,n){var o=0,r=void 0,i=void 0,s=void 0;for(i=0;i<e.length;i++)if(r=e[i])for(s=0;s<n.length;s++){var a=void 0;a="border"===r?r+n[s]+"Width":r+n[s],o+=parseFloat(v(t,a))||0}return o}function j(t){return null!=t&&t==t.window}var L={};function S(t,e,n){if(j(t))return"width"===e?L.viewportWidth(t):L.viewportHeight(t);if(9===t.nodeType)return"width"===e?L.docWidth(t):L.docHeight(t);var o="width"===e?["Left","Right"]:["Top","Bottom"],r="width"===e?t.offsetWidth:t.offsetHeight,i=(v(t),g(t)),s=0;(null==r||r<=0)&&(r=void 0,(null==(s=v(t,e))||Number(s)<0)&&(s=t.style[e]||0),s=parseFloat(s)||0),void 0===n&&(n=i?w:y);var a=void 0!==r||i,c=r||s;if(n===y)return a?c-O(t,["border","padding"],o):s;if(a){var u=n===k?-O(t,["border"],o):O(t,["margin"],o);return c+(n===w?0:u)}return s+O(t,m.slice(n),o)}b(["Width","Height"],function(t){L["doc"+t]=function(e){var n=e.document;return Math.max(n.documentElement["scroll"+t],n.body["scroll"+t],L["viewport"+t](n))},L["viewport"+t]=function(e){var n="client"+t,o=e.document,r=o.body,i=o.documentElement[n];return"CSS1Compat"===o.compatMode&&i||r&&r[n]||i}});var x={position:"absolute",visibility:"hidden",display:"block"};function E(t){var e=void 0,n=arguments;return 0!==t.offsetWidth?e=S.apply(void 0,n):function(t,e,n){var o={},r=t.style,i=void 0;for(i in e)e.hasOwnProperty(i)&&(o[i]=r[i],r[i]=e[i]);for(i in n.call(t),e)e.hasOwnProperty(i)&&(r[i]=o[i])}(t,x,function(){e=S.apply(void 0,n)}),e}function _(t,e,n){var o=n;if("object"!==(void 0===e?"undefined":r(e)))return void 0!==o?("number"==typeof o&&(o+="px"),void(t.style[e]=o)):v(t,e);for(var i in e)e.hasOwnProperty(i)&&_(t,i,e[i])}b(["width","height"],function(t){var e=t.charAt(0).toUpperCase()+t.slice(1);L["outer"+e]=function(e,n){return e&&E(e,t,n?0:w)};var n="width"===t?["Left","Right"]:["Top","Bottom"];L[t]=function(e,o){if(void 0===o)return e&&E(e,t,y);if(e){v(e);return g(e)&&(o+=O(e,["padding","border"],n)),_(e,t,o)}}}),t.exports=o({getWindow:function(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow},offset:function(t,e){if(void 0===e)return c(t);!function(t,e){"static"===_(t,"position")&&(t.style.position="relative");var n=c(t),o={},r=void 0,i=void 0;for(i in e)e.hasOwnProperty(i)&&(r=parseFloat(_(t,i))||0,o[i]=r+e[i]-n[i]);_(t,o)}(t,e)},isWindow:j,each:b,css:_,clone:function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);if(t.overflow)for(var n in t)t.hasOwnProperty(n)&&(e.overflow[n]=t.overflow[n]);return e},scrollLeft:function(t,e){if(j(t)){if(void 0===e)return s(t);window.scrollTo(e,a(t))}else{if(void 0===e)return t.scrollLeft;t.scrollLeft=e}},scrollTop:function(t,e){if(j(t)){if(void 0===e)return a(t);window.scrollTo(s(t),e)}else{if(void 0===e)return t.scrollTop;t.scrollTop=e}},viewportWidth:0,viewportHeight:0},L)},function(t,e,n){"use strict";var o=n(33);t.exports=function(t,e,n){n=n||{},9===e.nodeType&&(e=o.getWindow(e));var r=n.allowHorizontalScroll,i=n.onlyScrollIfNeeded,s=n.alignWithTop,a=n.alignWithLeft,c=n.offsetTop||0,u=n.offsetLeft||0,l=n.offsetBottom||0,f=n.offsetRight||0;r=void 0===r||r;var p=o.isWindow(e),d=o.offset(t),h=o.outerHeight(t),v=o.outerWidth(t),b=void 0,g=void 0,m=void 0,y=void 0,k=void 0,w=void 0,O=void 0,j=void 0,L=void 0,S=void 0;p?(O=e,S=o.height(O),L=o.width(O),j={left:o.scrollLeft(O),top:o.scrollTop(O)},k={left:d.left-j.left-u,top:d.top-j.top-c},w={left:d.left+v-(j.left+L)+f,top:d.top+h-(j.top+S)+l},y=j):(b=o.offset(e),g=e.clientHeight,m=e.clientWidth,y={left:e.scrollLeft,top:e.scrollTop},k={left:d.left-(b.left+(parseFloat(o.css(e,"borderLeftWidth"))||0))-u,top:d.top-(b.top+(parseFloat(o.css(e,"borderTopWidth"))||0))-c},w={left:d.left+v-(b.left+m+(parseFloat(o.css(e,"borderRightWidth"))||0))+f,top:d.top+h-(b.top+g+(parseFloat(o.css(e,"borderBottomWidth"))||0))+l}),k.top<0||w.top>0?!0===s?o.scrollTop(e,y.top+k.top):!1===s?o.scrollTop(e,y.top+w.top):k.top<0?o.scrollTop(e,y.top+k.top):o.scrollTop(e,y.top+w.top):i||((s=void 0===s||!!s)?o.scrollTop(e,y.top+k.top):o.scrollTop(e,y.top+w.top)),r&&(k.left<0||w.left>0?!0===a?o.scrollLeft(e,y.left+k.left):!1===a?o.scrollLeft(e,y.left+w.left):k.left<0?o.scrollLeft(e,y.left+k.left):o.scrollLeft(e,y.left+w.left):i||((a=void 0===a||!!a)?o.scrollLeft(e,y.left+k.left):o.scrollLeft(e,y.left+w.left)))}},function(t,e){function n(e,o){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,o)}t.exports=n},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=o=function(t){return n(t)}:t.exports=o=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},o(e)}t.exports=o},function(t,e,n){"use strict";n.r(e);var o=n(14);n.d(e,"URLInput",function(){return o.default})},function(t,e,n){n(37),n(18),n(14),t.exports=n(27)}]);
|
1 |
+
!function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=38)}([function(t,e){!function(){t.exports=this.wp.element}()},function(t,e){!function(){t.exports=this.wp.i18n}()},function(t,e){!function(){t.exports=this.wp.url}()},function(t,e){!function(){t.exports=this.wp.richText}()},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e){!function(){t.exports=this.wp.components}()},function(t,e){!function(){t.exports=this.wp.keycodes}()},function(t,e){!function(){t.exports=this.wp.blockEditor}()},function(t,e,n){var o=n(35);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e,n){var o=n(36),r=n(4);t.exports=function(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?r(t):e}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}t.exports=function(t,e,o){return e&&n(t.prototype,e),o&&n(t,o),t}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){!function(){t.exports=this.lodash}()},function(t,e,n){"use strict";n.r(e);var o=n(12),r=n.n(o),i=n(11),s=n.n(i),a=n(10),c=n.n(a),l=n(9),u=n.n(l),f=n(4),p=n.n(f),d=n(8),h=n.n(d),v=n(21),b=n.n(v),g=n(26),m=n.n(g),y=n(0),w=n(13),k=n(15),O=n.n(k),j=n(25),L=n.n(j),S=n(1),x=n(6),E=n(5),_=n(17),C=n(24),T=n(19),R=n.n(T),N=n(2),P=n(20),A=function(t){return t.stopPropagation()},F=function(){var t=m()(b.a.mark(function t(e){var n;return b.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,R()({url:Object(N.addQueryArgs)(ajaxurl,{action:"prli_search_for_links",term:e})});case 2:return n=t.sent,t.abrupt("return",Object(w.map)(n,function(t){return{url:t.pretty_url,title:Object(P.decodeEntities)(t.value)+" ("+Object(P.decodeEntities)(t.slug)+")"||Object(S.__)("(no title)")}}));case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),I=function(t){function e(t){var n,o=t.autocompleteRef;return r()(this,e),(n=c()(this,u()(e).apply(this,arguments))).onChange=n.onChange.bind(p()(n)),n.onKeyDown=n.onKeyDown.bind(p()(n)),n.autocompleteRef=o||Object(y.createRef)(),n.inputRef=Object(y.createRef)(),n.updateSuggestions=Object(w.throttle)(n.updateSuggestions.bind(p()(n)),200),n.suggestionNodes=[],n.state={suggestions:[],showSuggestions:!1,selectedSuggestion:null},n}return h()(e,t),s()(e,[{key:"componentDidUpdate",value:function(){var t=this,e=this.state,n=e.showSuggestions,o=e.selectedSuggestion;n&&null!==o&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,L()(this.suggestionNodes[o],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),this.props.setTimeout(function(){t.scrollingIntoView=!1},100))}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest}},{key:"bindSuggestionNode",value:function(t){var e=this;return function(n){e.suggestionNodes[t]=n}}},{key:"updateSuggestions",value:function(t){var e=this;if(t.length<2||/^https?:/.test(t))this.setState({showSuggestions:!1,selectedSuggestion:null,loading:!1});else{this.setState({showSuggestions:!0,selectedSuggestion:null,loading:!0});var n=F(t);n.then(function(t){e.suggestionsRequest===n&&(e.setState({suggestions:t,loading:!1}),t.length?e.props.debouncedSpeak(Object(S.sprintf)(Object(S._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",t.length),t.length),"assertive"):e.props.debouncedSpeak(Object(S.__)("No results."),"assertive"))}).catch(function(){e.suggestionsRequest===n&&e.setState({loading:!1})}),this.suggestionsRequest=n}}},{key:"onChange",value:function(t){var e=t.target.value;this.props.onChange(e),this.updateSuggestions(e)}},{key:"onKeyDown",value:function(t){var e=this.state,n=e.showSuggestions,o=e.selectedSuggestion,r=e.suggestions,i=e.loading;if(n&&r.length&&!i){var s=this.state.suggestions[this.state.selectedSuggestion];switch(t.keyCode){case x.UP:t.stopPropagation(),t.preventDefault();var a=o?o-1:r.length-1;this.setState({selectedSuggestion:a});break;case x.DOWN:t.stopPropagation(),t.preventDefault();var c=null===o||o===r.length-1?0:o+1;this.setState({selectedSuggestion:c});break;case x.TAB:null!==this.state.selectedSuggestion&&(this.selectLink(s),this.props.speak(Object(S.__)("Link selected.")));break;case x.ENTER:null!==this.state.selectedSuggestion&&(t.stopPropagation(),this.selectLink(s))}}else switch(t.keyCode){case x.UP:0!==t.target.selectionStart&&(t.stopPropagation(),t.preventDefault(),t.target.setSelectionRange(0,0));break;case x.DOWN:this.props.value.length!==t.target.selectionStart&&(t.stopPropagation(),t.preventDefault(),t.target.setSelectionRange(this.props.value.length,this.props.value.length))}}},{key:"selectLink",value:function(t){this.props.onChange(t.url,t),this.setState({selectedSuggestion:null,showSuggestions:!1})}},{key:"handleOnClick",value:function(t){this.selectLink(t),this.inputRef.current.focus()}},{key:"render",value:function(){var t=this,e=this.props,n=e.value,o=void 0===n?"":n,r=e.autoFocus,i=void 0===r||r,s=e.instanceId,a=e.className,c=this.state,l=c.showSuggestions,u=c.suggestions,f=c.selectedSuggestion,p=c.loading,d="block-editor-url-input-suggestions-".concat(s),h="block-editor-url-input-suggestion-".concat(s);return Object(y.createElement)("div",{className:O()("editor-url-input block-editor-url-input",a)},Object(y.createElement)("input",{autoFocus:i,type:"text","aria-label":Object(S.__)("URL"),required:!0,value:o,onChange:this.onChange,onInput:A,placeholder:Object(S.__)("Paste or type to search for your Pretty Link"),onKeyDown:this.onKeyDown,role:"combobox","aria-expanded":l,"aria-autocomplete":"list","aria-owns":d,"aria-activedescendant":null!==f?"".concat(h,"-").concat(f):void 0,ref:this.inputRef}),p&&Object(y.createElement)(E.Spinner,null),l&&!!u.length&&Object(y.createElement)(E.Popover,{position:"bottom",noArrow:!0,focusOnMount:!1},Object(y.createElement)("div",{className:"editor-url-input__suggestions block-editor-url-input__suggestions",id:d,ref:this.autocompleteRef,role:"listbox"},u.map(function(e,n){return Object(y.createElement)("button",{key:e.id,role:"option",tabIndex:"-1",id:"".concat(h,"-").concat(n),ref:t.bindSuggestionNode(n),className:O()("editor-url-input__suggestion block-editor-url-input__suggestion",{"is-selected":n===f}),onClick:function(){return t.handleOnClick(e)},"aria-selected":n===f},e.title)}))))}}]),e}(y.Component);e.default=Object(_.compose)(_.withSafeTimeout,E.withSpokenMessages,_.withInstanceId,Object(C.withSelect)(function(t){return{fetchLinkSuggestions:(0,t("core/block-editor").getSettings)().__experimentalFetchLinkSuggestions}}))(I)},function(t,e,n){var o;
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
9 |
Licensed under the MIT License (MIT), see
|
10 |
http://jedwatson.github.io/classnames
|
11 |
*/
|
12 |
+
!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var t=[],e=0;e<arguments.length;e++){var o=arguments[e];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o)&&o.length){var s=r.apply(null,o);s&&t.push(s)}else if("object"===i)for(var a in o)n.call(o,a)&&o[a]&&t.push(a)}}return t.join(" ")}void 0!==t&&t.exports?(r.default=r,t.exports=r):void 0===(o=function(){return r}.apply(e,[]))||(t.exports=o)}()},function(t,e,n){var o=n(32);t.exports=function(t,e){if(null==t)return{};var n,r,i=o(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}},function(t,e){!function(){t.exports=this.wp.compose}()},function(t,e,n){"use strict";n.r(e);var o=n(12),r=n.n(o),i=n(11),s=n.n(i),a=n(10),c=n.n(a),l=n(9),u=n.n(l),f=n(4),p=n.n(f),d=n(8),h=n.n(d),v=n(23),b=n.n(v),g=n(16),m=n.n(g),y=n(0),w=n(15),k=n.n(w),O=n(1),j=n(5),L=n(6),S=n(22),x=n(2),E=n(3),_=n(7),C=(n(19),n(14)),T=(n(31),n(13));function R(t){if(!t)return!1;var e=t.trim();if(!e)return!1;if(/^\S+:/.test(e)){var n=Object(x.getProtocol)(e);if(!Object(x.isValidProtocol)(n))return!1;if(Object(T.startsWith)(n,"http")&&!/^https?:\/\/[^\/\s]/i.test(e))return!1;var o=Object(x.getAuthority)(e);if(!Object(x.isValidAuthority)(o))return!1;var r=Object(x.getPath)(e);if(r&&!Object(x.isValidPath)(r))return!1;var i=Object(x.getQueryString)(e);if(i&&!Object(x.isValidQueryString)(i))return!1;var s=Object(x.getFragment)(e);if(s&&!Object(x.isValidFragment)(s))return!1}return!(Object(T.startsWith)(e,"#")&&!Object(x.isValidFragment)(e))}function N(t){var e=t.url,n=t.opensInNewWindow,o=t.text,r=t.noFollow,i={type:"core/link",attributes:{url:e}};if(i.attributes.rel="",r&&(i.attributes.rel+="nofollow "),n){var s=Object(O.sprintf)(Object(O.__)("%s (opens in a new tab)"),o);i.attributes.target="_blank",i.attributes.rel+="noreferrer noopener",i.attributes["aria-label"]=s}return""===i.attributes.rel&&delete i.attributes.rel,i}var P=function(t){return t.stopPropagation()};function A(t,e){return t.addingLink||e.editLink}var F=function(t){var e=t.value,n=t.onChangeInputValue,o=t.onKeyDown,r=t.submitLink,i=t.autocompleteRef;return Object(y.createElement)("form",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",onKeyPress:P,onKeyDown:o,onSubmit:r},Object(y.createElement)(C.default,{value:e,onChange:n,autocompleteRef:i}),Object(y.createElement)(j.IconButton,{icon:"editor-break",label:Object(O.__)("Insert Pretty Link"),type:"submit"}))},I=function(t){var e=t.url,n=Object(x.prependHTTP)(e),o=k()("editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value",{"has-invalid-link":!R(n)});return e?Object(y.createElement)(j.ExternalLink,{className:o,href:e},Object(x.filterURLForDisplay)(Object(x.safeDecodeURI)(e))):Object(y.createElement)("span",{className:o})},U=function(t){var e=t.isActive,n=t.addingLink,o=t.value,r=m()(t,["isActive","addingLink","value"]),i=Object(y.useMemo)(function(){var t=window.getSelection(),e=t.rangeCount>0?t.getRangeAt(0):null;if(e){if(n)return Object(S.getRectangleFromRange)(e);var o=e.startContainer;for(o=o.nextElementSibling||o;o.nodeType!==window.Node.ELEMENT_NODE;)o=o.parentNode;var r=o.closest("a");return r?r.getBoundingClientRect():void 0}},[e,n,o.start,o.end]);return i?Object(y.createElement)(_.URLPopover,b()({anchorRect:i},r)):null},W=function(t){var e=t.url,n=t.editLink;return Object(y.createElement)("div",{className:"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",onKeyPress:P},Object(y.createElement)(I,{url:e}),Object(y.createElement)(j.IconButton,{icon:"edit",label:Object(O.__)("Edit"),onClick:n}))},D=function(t){function e(){var t;return r()(this,e),(t=c()(this,u()(e).apply(this,arguments))).editLink=t.editLink.bind(p()(t)),t.submitLink=t.submitLink.bind(p()(t)),t.onKeyDown=t.onKeyDown.bind(p()(t)),t.onChangeInputValue=t.onChangeInputValue.bind(p()(t)),t.setNoFollow=t.setNoFollow.bind(p()(t)),t.setLinkTarget=t.setLinkTarget.bind(p()(t)),t.onClickOutside=t.onClickOutside.bind(p()(t)),t.resetState=t.resetState.bind(p()(t)),t.autocompleteRef=Object(y.createRef)(),t.state={noFollow:!1,opensInNewWindow:!1,inputValue:"",newLinkUrl:"",newLinkSlug:"",creatingLink:!1,createdLink:!1,createdLinkError:!1},t}return h()(e,t),s()(e,[{key:"onKeyDown",value:function(t){[L.LEFT,L.DOWN,L.RIGHT,L.UP,L.BACKSPACE,L.ENTER].indexOf(t.keyCode)>-1&&t.stopPropagation()}},{key:"onChangeInputValue",value:function(t){this.setState({inputValue:t})}},{key:"setLinkTarget",value:function(t){var e=this.props,n=e.activeAttributes.url,o=void 0===n?"":n,r=e.value,i=e.onChange;if(this.setState({opensInNewWindow:t}),!A(this.props,this.state)){var s=Object(E.getTextContent)(Object(E.slice)(r));i(Object(E.applyFormat)(r,N({url:o,opensInNewWindow:t,text:s})))}}},{key:"setNoFollow",value:function(t){var e=this.props,n=e.activeAttributes.url,o=void 0===n?"":n,r=e.value,i=e.onChange;if(this.setState({noFollow:t}),!A(this.props,this.state)){var s=Object(E.getTextContent)(Object(E.slice)(r));i(Object(E.applyFormat)(r,N({url:o,opensInNewWindow:opensInNewWindow,text:s,noFollow:t})))}}},{key:"editLink",value:function(t){this.setState({editLink:!0}),t.preventDefault()}},{key:"submitLink",value:function(t){var e=this.props,n=e.isActive,o=e.value,r=e.onChange,i=e.speak,s=this.state,a=s.inputValue,c=s.opensInNewWindow,l=s.noFollow,u=Object(x.prependHTTP)(a),f=N({url:u,opensInNewWindow:c,text:Object(E.getTextContent)(Object(E.slice)(o)),noFollow:l});if(t.preventDefault(),Object(E.isCollapsed)(o)&&!n){var p=Object(E.applyFormat)(Object(E.create)({text:u}),f,0,u.length);r(Object(E.insert)(o,p))}else r(Object(E.applyFormat)(o,f));this.resetState(),R(u)?i(n?Object(O.__)("Link edited."):Object(O.__)("Link inserted."),"assertive"):i(Object(O.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive")}},{key:"onClickOutside",value:function(t){var e=this.autocompleteRef.current;e&&e.contains(t.target)||this.resetState()}},{key:"resetState",value:function(){this.props.stopAddingLink(),this.setState({editLink:!1})}},{key:"render",value:function(){var t=this,e=this.props,n=e.isActive,o=e.activeAttributes.url,r=e.addingLink,i=e.value;if(!n&&!r)return null;var s=this.state,a=s.inputValue,c=s.noFollow,l=s.opensInNewWindow,u=s.newLinkUrl,f=s.newLinkSlug,p=s.creatingLink,d=s.createdLink,h=s.createdLinkError,v=A(this.props,this.state);return Object(y.createElement)(U,{className:"pretty-link-inserter",value:i,isActive:n,addingLink:r,onClickOutside:this.onClickOutside,onClose:this.resetState,focusOnMount:!!v&&"firstElement",renderSettings:function(){return Object(y.createElement)(y.Fragment,null,Object(y.createElement)("div",null,Object(y.createElement)(j.ToggleControl,{label:Object(O.__)("Open in New Tab"),checked:l,onChange:t.setLinkTarget}),Object(y.createElement)(j.ToggleControl,{label:Object(O.__)("Nofollow"),checked:c,onChange:t.setNoFollow})),Object(y.createElement)("div",{className:"pretty-link-inserter-form-container"},d&&Object(y.createElement)(j.Notice,{status:"success",onRemove:function(){return t.setState({createdLink:!1})}},Object(y.createElement)("p",null,Object(O.__)("Pretty Link created successfully.","memberpress"))),h&&Object(y.createElement)(j.Notice,{status:"error",onRemove:function(){return t.setState({createdLink:!1,createdLinkError:!1})}},Object(y.createElement)("p",null,Object(O.__)("Pretty Link could not be created. Please try a slug that is not already used.","memberpress"))),Object(y.createElement)("strong",null,Object(O.__)("New Pretty Link","pretty-link")),Object(y.createElement)("form",{onSubmit:function(e){e.preventDefault(),t.setState({creatingLink:!0,createdLinkError:!1}),function(t,e){return new Promise(function(n,o){jQuery.post(ajaxurl,{action:"prli_create_pretty_link",target:t,slug:e,redirect:"",nofollow:1,tracking:1},function(t,e,r){"true"===t?n(t):o(t)}).fail(function(t){o(t)})})}(u,f).then(function(e){t.setState({createdLink:!0,creatingLink:!1,inputValue:plEditor.homeUrl+f,newLinkUrl:"",newLinkSlug:""})}).catch(function(e){t.setState({createdLink:!1,creatingLink:!1,createdLinkError:!0})})}},Object(y.createElement)("p",null,Object(y.createElement)(j.TextControl,{placeholder:"URL",className:"pretty-link-new-link-url",value:u,onChange:function(e){t.setState({newLinkUrl:e})}})),Object(y.createElement)("p",null,Object(y.createElement)(j.TextControl,{placeholder:"Slug",className:"pretty-link-new-link-slug",value:f,onChange:function(e){t.setState({newLinkSlug:e})}})),Object(y.createElement)("p",null,Object(y.createElement)("button",{className:"pretty-link-submit-new-link components-button is-button is-primary",onClick:function(){console.log("Creating new Pretty Link...")}},Object(O.__)("Create New Pretty Link","pretty-link")),p&&Object(y.createElement)(j.Spinner,null)))))}},v?Object(y.createElement)(F,{value:a,onChangeInputValue:this.onChangeInputValue,onKeyDown:this.onKeyDown,submitLink:this.submitLink,autocompleteRef:this.autocompleteRef}):Object(y.createElement)(W,{url:o,editLink:this.editLink}))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var n=t.activeAttributes,o=n.url,r="_blank"===n.target;if(!A(t,e)){if(o!==e.inputValue)return{inputValue:o};if(r!==e.opensInNewWindow)return{opensInNewWindow:r}}return null}}]),e}(y.Component);e.default=Object(j.withSpokenMessages)(D)},function(t,e){!function(){t.exports=this.wp.apiFetch}()},function(t,e){!function(){t.exports=this.wp.htmlEntities}()},function(t,e){!function(){t.exports=this.regeneratorRuntime}()},function(t,e){!function(){t.exports=this.wp.dom}()},function(t,e){function n(){return t.exports=n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},n.apply(this,arguments)}t.exports=n},function(t,e){!function(){t.exports=this.wp.data}()},function(t,e,n){"use strict";t.exports=n(34)},function(t,e){function n(t,e,n,o,r,i,s){try{var a=t[i](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(o,r)}t.exports=function(t){return function(){var e=this,o=arguments;return new Promise(function(r,i){var s=t.apply(e,o);function a(t){n(s,r,i,a,c,"next",t)}function c(t){n(s,r,i,a,c,"throw",t)}a(void 0)})}}},function(t,e,n){"use strict";n.r(e),n.d(e,"prettyLink",function(){return x});var o=n(16),r=n.n(o),i=n(12),s=n.n(i),a=n(11),c=n.n(a),l=n(10),u=n.n(l),f=n(9),p=n.n(f),d=n(4),h=n.n(d),v=n(8),b=n.n(v),g=n(0),m=n(1),y=n(5),w=n(3),k=n(2),O=n(7),j=n(18),L="pretty-link/pretty-link",S=Object(m.__)("Pretty Link"),x={name:L,title:S,tagName:"a",className:"pretty-link",attributes:{url:"href",target:"target"},edit:Object(y.withSpokenMessages)(function(t){function e(){var t;return s()(this,e),(t=u()(this,p()(e).apply(this,arguments))).addLink=t.addLink.bind(h()(t)),t.stopAddingLink=t.stopAddingLink.bind(h()(t)),t.onRemoveFormat=t.onRemoveFormat.bind(h()(t)),t.state={addingLink:!1},t}return b()(e,t),c()(e,[{key:"addLink",value:function(){var t=this.props,e=t.value,n=t.onChange,o=Object(w.getTextContent)(Object(w.slice)(e));o&&Object(k.isURL)(o)?n(Object(w.applyFormat)(e,{type:L,attributes:{url:o}})):this.setState({addingLink:!0})}},{key:"stopAddingLink",value:function(){this.setState({addingLink:!1})}},{key:"onRemoveFormat",value:function(){var t=this.props,e=t.value,n=t.onChange,o=t.speak;n(Object(w.removeFormat)(e,L)),o(Object(m.__)("Link removed."),"assertive")}},{key:"render",value:function(){var t=this.props,e=t.isActive,n=t.activeAttributes,o=t.value,r=t.onChange;return Object(g.createElement)(g.Fragment,null,Object(g.createElement)(O.RichTextShortcut,{type:"primary",character:"p",onUse:this.addLink}),Object(g.createElement)(O.RichTextShortcut,{type:"primaryShift",character:"p",onUse:this.onRemoveFormat}),e&&Object(g.createElement)(O.RichTextToolbarButton,{icon:"star-filled",title:Object(m.__)("Unlink"),onClick:this.onRemoveFormat,isActive:e,shortcutType:"primaryShift",shortcutCharacter:"p"}),!e&&Object(g.createElement)(O.RichTextToolbarButton,{icon:"star-filled",title:S,onClick:this.addLink,isActive:e,shortcutType:"primary",shortcutCharacter:"p"}),Object(g.createElement)(j.default,{addingLink:this.state.addingLink,stopAddingLink:this.stopAddingLink,isActive:e,activeAttributes:n,value:o,onChange:r}))}}]),e}(g.Component))};[x].forEach(function(t){var e=t.name,n=r()(t,["name"]);return Object(w.registerFormatType)(e,n)})},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var r,i=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(r=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:o+i.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")})}},function(t,e,n){var o={},r=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}(function(){return window&&document&&document.all&&!window.atob}),i=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var o=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,n);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(t){o=null}e[t]=o}return e[t]}}(),s=null,a=0,c=[],l=n(28);function u(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=o[r.id];if(i){i.refs++;for(var s=0;s<i.parts.length;s++)i.parts[s](r.parts[s]);for(;s<r.parts.length;s++)i.parts.push(b(r.parts[s],e))}else{var a=[];for(s=0;s<r.parts.length;s++)a.push(b(r.parts[s],e));o[r.id]={id:r.id,refs:1,parts:a}}}}function f(t,e){for(var n=[],o={},r=0;r<t.length;r++){var i=t[r],s=e.base?i[0]+e.base:i[0],a={css:i[1],media:i[2],sourceMap:i[3]};o[s]?o[s].parts.push(a):n.push(o[s]={id:s,parts:[a]})}return n}function p(t,e){var n=i(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=c[c.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),c.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var r=i(t.insertAt.before,n);n.insertBefore(e,r)}}function d(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=c.indexOf(t);e>=0&&c.splice(e,1)}function h(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var o=function(){0;return n.nc}();o&&(t.attrs.nonce=o)}return v(e,t.attrs),p(t,e),e}function v(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function b(t,e){var n,o,r,i;if(e.transform&&t.css){if(!(i="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=i}if(e.singleton){var c=a++;n=s||(s=h(e)),o=m.bind(null,n,c,!1),r=m.bind(null,n,c,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",v(e,t.attrs),p(t,e),e}(e),o=function(t,e,n){var o=n.css,r=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||i)&&(o=l(o));r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var s=new Blob([o],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}.bind(null,n,e),r=function(){d(n),n.href&&URL.revokeObjectURL(n.href)}):(n=h(e),o=function(t,e){var n=e.css,o=e.media;o&&t.setAttribute("media",o);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),r=function(){d(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else r()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=r()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return u(n,e),function(t){for(var r=[],i=0;i<n.length;i++){var s=n[i];(a=o[s.id]).refs--,r.push(a)}t&&u(f(t,e),e);for(i=0;i<r.length;i++){var a;if(0===(a=r[i]).refs){for(var c=0;c<a.parts.length;c++)a.parts[c]();delete o[a.id]}}}};var g=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}();function m(t,e,n,o){var r=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=g(e,r);else{var i=document.createTextNode(r),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(i,s[e]):t.appendChild(i)}}},function(t,e){t.exports=".pretty-link-inserter .block-editor-url-popover__settings {\n display: block; }\n\n.pretty-link-inserter .pretty-link-inserter-form-container {\n margin-top: 30px; }\n"},function(t,e,n){var o=n(30);"string"==typeof o&&(o=[[t.i,o,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(29)(o,r);o.locals&&(t.exports=o.locals)},function(t,e){t.exports=function(t,e){if(null==t)return{};var n,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)n=i[o],e.indexOf(n)>=0||(r[n]=t[n]);return r}},function(t,e,n){"use strict";var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};function i(t,e){var n=t["page"+(e?"Y":"X")+"Offset"],o="scroll"+(e?"Top":"Left");if("number"!=typeof n){var r=t.document;"number"!=typeof(n=r.documentElement[o])&&(n=r.body[o])}return n}function s(t){return i(t)}function a(t){return i(t,!0)}function c(t){var e=function(t){var e,n=void 0,o=void 0,r=t.ownerDocument,i=r.body,s=r&&r.documentElement;return n=(e=t.getBoundingClientRect()).left,o=e.top,{left:n-=s.clientLeft||i.clientLeft||0,top:o-=s.clientTop||i.clientTop||0}}(t),n=t.ownerDocument,o=n.defaultView||n.parentWindow;return e.left+=s(o),e.top+=a(o),e}var l=new RegExp("^("+/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source+")(?!px)[a-z%]+$","i"),u=/^(top|right|bottom|left)$/,f="currentStyle",p="runtimeStyle",d="left",h="px";var v=void 0;function b(t,e){for(var n=0;n<t.length;n++)e(t[n])}function g(t){return"border-box"===v(t,"boxSizing")}"undefined"!=typeof window&&(v=window.getComputedStyle?function(t,e,n){var o="",r=t.ownerDocument,i=n||r.defaultView.getComputedStyle(t,null);return i&&(o=i.getPropertyValue(e)||i[e]),o}:function(t,e){var n=t[f]&&t[f][e];if(l.test(n)&&!u.test(e)){var o=t.style,r=o[d],i=t[p][d];t[p][d]=t[f][d],o[d]="fontSize"===e?"1em":n||0,n=o.pixelLeft+h,o[d]=r,t[p][d]=i}return""===n?"auto":n});var m=["margin","border","padding"],y=-1,w=2,k=1;function O(t,e,n){var o=0,r=void 0,i=void 0,s=void 0;for(i=0;i<e.length;i++)if(r=e[i])for(s=0;s<n.length;s++){var a=void 0;a="border"===r?r+n[s]+"Width":r+n[s],o+=parseFloat(v(t,a))||0}return o}function j(t){return null!=t&&t==t.window}var L={};function S(t,e,n){if(j(t))return"width"===e?L.viewportWidth(t):L.viewportHeight(t);if(9===t.nodeType)return"width"===e?L.docWidth(t):L.docHeight(t);var o="width"===e?["Left","Right"]:["Top","Bottom"],r="width"===e?t.offsetWidth:t.offsetHeight,i=(v(t),g(t)),s=0;(null==r||r<=0)&&(r=void 0,(null==(s=v(t,e))||Number(s)<0)&&(s=t.style[e]||0),s=parseFloat(s)||0),void 0===n&&(n=i?k:y);var a=void 0!==r||i,c=r||s;if(n===y)return a?c-O(t,["border","padding"],o):s;if(a){var l=n===w?-O(t,["border"],o):O(t,["margin"],o);return c+(n===k?0:l)}return s+O(t,m.slice(n),o)}b(["Width","Height"],function(t){L["doc"+t]=function(e){var n=e.document;return Math.max(n.documentElement["scroll"+t],n.body["scroll"+t],L["viewport"+t](n))},L["viewport"+t]=function(e){var n="client"+t,o=e.document,r=o.body,i=o.documentElement[n];return"CSS1Compat"===o.compatMode&&i||r&&r[n]||i}});var x={position:"absolute",visibility:"hidden",display:"block"};function E(t){var e=void 0,n=arguments;return 0!==t.offsetWidth?e=S.apply(void 0,n):function(t,e,n){var o={},r=t.style,i=void 0;for(i in e)e.hasOwnProperty(i)&&(o[i]=r[i],r[i]=e[i]);for(i in n.call(t),e)e.hasOwnProperty(i)&&(r[i]=o[i])}(t,x,function(){e=S.apply(void 0,n)}),e}function _(t,e,n){var o=n;if("object"!==(void 0===e?"undefined":r(e)))return void 0!==o?("number"==typeof o&&(o+="px"),void(t.style[e]=o)):v(t,e);for(var i in e)e.hasOwnProperty(i)&&_(t,i,e[i])}b(["width","height"],function(t){var e=t.charAt(0).toUpperCase()+t.slice(1);L["outer"+e]=function(e,n){return e&&E(e,t,n?0:k)};var n="width"===t?["Left","Right"]:["Top","Bottom"];L[t]=function(e,o){if(void 0===o)return e&&E(e,t,y);if(e){v(e);return g(e)&&(o+=O(e,["padding","border"],n)),_(e,t,o)}}}),t.exports=o({getWindow:function(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow},offset:function(t,e){if(void 0===e)return c(t);!function(t,e){"static"===_(t,"position")&&(t.style.position="relative");var n=c(t),o={},r=void 0,i=void 0;for(i in e)e.hasOwnProperty(i)&&(r=parseFloat(_(t,i))||0,o[i]=r+e[i]-n[i]);_(t,o)}(t,e)},isWindow:j,each:b,css:_,clone:function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);if(t.overflow)for(var n in t)t.hasOwnProperty(n)&&(e.overflow[n]=t.overflow[n]);return e},scrollLeft:function(t,e){if(j(t)){if(void 0===e)return s(t);window.scrollTo(e,a(t))}else{if(void 0===e)return t.scrollLeft;t.scrollLeft=e}},scrollTop:function(t,e){if(j(t)){if(void 0===e)return a(t);window.scrollTo(s(t),e)}else{if(void 0===e)return t.scrollTop;t.scrollTop=e}},viewportWidth:0,viewportHeight:0},L)},function(t,e,n){"use strict";var o=n(33);t.exports=function(t,e,n){n=n||{},9===e.nodeType&&(e=o.getWindow(e));var r=n.allowHorizontalScroll,i=n.onlyScrollIfNeeded,s=n.alignWithTop,a=n.alignWithLeft,c=n.offsetTop||0,l=n.offsetLeft||0,u=n.offsetBottom||0,f=n.offsetRight||0;r=void 0===r||r;var p=o.isWindow(e),d=o.offset(t),h=o.outerHeight(t),v=o.outerWidth(t),b=void 0,g=void 0,m=void 0,y=void 0,w=void 0,k=void 0,O=void 0,j=void 0,L=void 0,S=void 0;p?(O=e,S=o.height(O),L=o.width(O),j={left:o.scrollLeft(O),top:o.scrollTop(O)},w={left:d.left-j.left-l,top:d.top-j.top-c},k={left:d.left+v-(j.left+L)+f,top:d.top+h-(j.top+S)+u},y=j):(b=o.offset(e),g=e.clientHeight,m=e.clientWidth,y={left:e.scrollLeft,top:e.scrollTop},w={left:d.left-(b.left+(parseFloat(o.css(e,"borderLeftWidth"))||0))-l,top:d.top-(b.top+(parseFloat(o.css(e,"borderTopWidth"))||0))-c},k={left:d.left+v-(b.left+m+(parseFloat(o.css(e,"borderRightWidth"))||0))+f,top:d.top+h-(b.top+g+(parseFloat(o.css(e,"borderBottomWidth"))||0))+u}),w.top<0||k.top>0?!0===s?o.scrollTop(e,y.top+w.top):!1===s?o.scrollTop(e,y.top+k.top):w.top<0?o.scrollTop(e,y.top+w.top):o.scrollTop(e,y.top+k.top):i||((s=void 0===s||!!s)?o.scrollTop(e,y.top+w.top):o.scrollTop(e,y.top+k.top)),r&&(w.left<0||k.left>0?!0===a?o.scrollLeft(e,y.left+w.left):!1===a?o.scrollLeft(e,y.left+k.left):w.left<0?o.scrollLeft(e,y.left+w.left):o.scrollLeft(e,y.left+k.left):i||((a=void 0===a||!!a)?o.scrollLeft(e,y.left+w.left):o.scrollLeft(e,y.left+k.left)))}},function(t,e){function n(e,o){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,o)}t.exports=n},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=o=function(t){return n(t)}:t.exports=o=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},o(e)}t.exports=o},function(t,e,n){"use strict";n.r(e);var o=n(14);n.d(e,"URLInput",function(){return o.default})},function(t,e,n){n(37),n(18),n(14),t.exports=n(27)}]);
|
js/editor.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/editor/components/index.js","webpack:///./js/editor/components/link-editor/index.js","webpack:///./js/editor/components/link-editor/style.scss?a870","webpack:///./js/editor/components/link-editor/utils.js","webpack:///./js/editor/components/url-input/index.js","webpack:///./js/editor/formats/pretty-link/index.js","webpack:///./node_modules/@babel/runtime/helpers/assertThisInitialized.js","webpack:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack:///./node_modules/@babel/runtime/helpers/classCallCheck.js","webpack:///./node_modules/@babel/runtime/helpers/createClass.js","webpack:///./node_modules/@babel/runtime/helpers/extends.js","webpack:///./node_modules/@babel/runtime/helpers/getPrototypeOf.js","webpack:///./node_modules/@babel/runtime/helpers/inherits.js","webpack:///./node_modules/@babel/runtime/helpers/objectWithoutProperties.js","webpack:///./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js","webpack:///./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","webpack:///./node_modules/@babel/runtime/helpers/setPrototypeOf.js","webpack:///./node_modules/@babel/runtime/helpers/typeof.js","webpack:///./node_modules/classnames/index.js","webpack:///./node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js","webpack:///./node_modules/dom-scroll-into-view/lib/index.js","webpack:///./node_modules/dom-scroll-into-view/lib/util.js","webpack:///./js/editor/components/link-editor/style.scss","webpack:///./node_modules/style-loader/lib/addStyles.js","webpack:///./node_modules/style-loader/lib/urls.js","webpack:///external {\"this\":\"regeneratorRuntime\"}","webpack:///external {\"this\":[\"wp\",\"apiFetch\"]}","webpack:///external {\"this\":[\"wp\",\"blockEditor\"]}","webpack:///external {\"this\":[\"wp\",\"components\"]}","webpack:///external {\"this\":[\"wp\",\"compose\"]}","webpack:///external {\"this\":[\"wp\",\"data\"]}","webpack:///external {\"this\":[\"wp\",\"dom\"]}","webpack:///external {\"this\":[\"wp\",\"element\"]}","webpack:///external {\"this\":[\"wp\",\"htmlEntities\"]}","webpack:///external {\"this\":[\"wp\",\"i18n\"]}","webpack:///external {\"this\":[\"wp\",\"keycodes\"]}","webpack:///external {\"this\":[\"wp\",\"richText\"]}","webpack:///external {\"this\":[\"wp\",\"url\"]}","webpack:///external {\"this\":\"lodash\"}"],"names":["stopKeyPropagation","event","stopPropagation","isShowingInput","props","state","addingLink","editLink","LinkEditor","value","onChangeInputValue","onKeyDown","submitLink","autocompleteRef","__","LinkViewerUrl","url","prependedURL","prependHTTP","linkClassName","classnames","isValidHref","filterURLForDisplay","safeDecodeURI","URLPopoverAtLink","isActive","anchorRect","useMemo","selection","window","getSelection","range","rangeCount","getRangeAt","getRectangleFromRange","element","startContainer","nextElementSibling","nodeType","Node","ELEMENT_NODE","parentNode","closest","getBoundingClientRect","start","end","LinkViewer","createNewPrettyLink","target","slug","Promise","resolve","reject","jQuery","post","ajaxurl","action","redirect","nofollow","tracking","data","textStatus","xhr","fail","error","InlineLinkUI","arguments","bind","setLinkTarget","onClickOutside","resetState","createRef","opensInNewWindow","inputValue","newLinkUrl","newLinkSlug","creatingLink","createdLink","createdLinkError","LEFT","DOWN","RIGHT","UP","BACKSPACE","ENTER","indexOf","keyCode","setState","activeAttributes","onChange","selectedText","getTextContent","slice","applyFormat","createLinkFormat","text","preventDefault","speak","format","isCollapsed","toInsert","create","length","insert","autocompleteElement","current","contains","stopAddingLink","showInput","then","plEditor","homeUrl","catch","console","log","Component","withSpokenMessages","href","trimmedHref","trim","test","protocol","getProtocol","isValidProtocol","startsWith","authority","getAuthority","isValidAuthority","path","getPath","isValidPath","queryString","getQueryString","isValidQueryString","fragment","getFragment","isValidFragment","type","attributes","label","sprintf","rel","stopEventPropagation","fetchLinkSuggestions","search","apiFetch","addQueryArgs","term","links","map","link","pretty_url","title","decodeEntities","URLInput","inputRef","updateSuggestions","throttle","suggestionNodes","suggestions","showSuggestions","selectedSuggestion","scrollingIntoView","scrollIntoView","onlyScrollIfNeeded","setTimeout","suggestionsRequest","index","ref","loading","request","debouncedSpeak","_n","selectionStart","setSelectionRange","suggestion","previousIndex","nextIndex","TAB","selectLink","focus","autoFocus","instanceId","className","suggestionsListboxId","suggestionOptionIdPrefix","undefined","id","bindSuggestionNode","handleOnClick","compose","withSafeTimeout","withInstanceId","withSelect","select","getSettings","__experimentalFetchLinkSuggestions","name","prettyLink","tagName","edit","addLink","onRemoveFormat","isURL","removeFormat","registerFormats","forEach","settings","registerFormatType"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;ACnEA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;AAGA;AAEA;;;;AAGA;AACA;AACA;AAUA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AAEA;;;;AAGA;;AAEA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAAEC,KAAF;AAAA,SAAaA,KAAK,CAACC,eAAN,EAAb;AAAA,CAA3B;;AAEA,SAASC,cAAT,CAAyBC,KAAzB,EAAgCC,KAAhC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AAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE,UAAU,IAA4E;AACxF;AACA,EAAE,iCAAqB,EAAE,mCAAE;AAC3B;AACA,GAAG;AAAA,oGAAC;AACJ,EAAE,MAAM,EAEN;AACF,CAAC;;;;;;;;;;;;;ACnDY;;AAEb,WAAW,mBAAO,CAAC,+DAAQ;;AAE3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA,gC;;;;;;;;;;;;AChIa;;AAEb,iBAAiB,mBAAO,CAAC,+FAAwB,E;;;;;;;;;;;;ACFpC;;AAEb,mDAAmD,gBAAgB,sBAAsB,OAAO,2BAA2B,0BAA0B,yDAAyD,2BAA2B,EAAE,EAAE,EAAE,eAAe;;AAE9P,oGAAoG,mBAAmB,EAAE,mBAAmB,kGAAkG;;AAE9O;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,kBAAkB;AAC/B;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,CAAC,Y;;;;;;;;;;;ACtbD,6EAA6E,mBAAmB,EAAE,gEAAgE,qBAAqB,EAAE,G;;;;;;;;;;;ACAzL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA,cAAc,mBAAO,CAAC,uDAAQ;;AAE9B;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA,iBAAiB,mBAAmB;AACpC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,sBAAsB;AACvC;;AAEA;AACA,mBAAmB,2BAA2B;;AAE9C;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,mBAAmB;AACnC;AACA;;AAEA;AACA;;AAEA,iBAAiB,2BAA2B;AAC5C;AACA;;AAEA,QAAQ,uBAAuB;AAC/B;AACA;AACA,GAAG;AACH;;AAEA,iBAAiB,uBAAuB;AACxC;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA,cAAc;;AAEd,kDAAkD,sBAAsB;AACxE;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA,KAAK,KAAwC,EAAE,EAE7C;;AAEF,QAAQ,sBAAiB;AACzB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD;AACvD;;AAEA,6BAA6B,mBAAmB;;AAEhD;;AAEA;;AAEA;AACA;;;;;;;;;;;;;AC9YA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,WAAW,EAAE;AACrD,wCAAwC,WAAW,EAAE;;AAErD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,sCAAsC;AACtC,GAAG;AACH;AACA,8DAA8D;AAC9D;;AAEA;AACA;AACA,EAAE;;AAEF;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxFA,aAAa,6CAA6C,EAAE,I;;;;;;;;;;;ACA5D,aAAa,yCAAyC,EAAE,I;;;;;;;;;;;ACAxD,aAAa,4CAA4C,EAAE,I;;;;;;;;;;;ACA3D,aAAa,2CAA2C,EAAE,I;;;;;;;;;;;ACA1D,aAAa,wCAAwC,EAAE,I;;;;;;;;;;;ACAvD,aAAa,qCAAqC,EAAE,I;;;;;;;;;;;ACApD,aAAa,oCAAoC,EAAE,I;;;;;;;;;;;ACAnD,aAAa,wCAAwC,EAAE,I;;;;;;;;;;;ACAvD,aAAa,6CAA6C,EAAE,I;;;;;;;;;;;ACA5D,aAAa,qCAAqC,EAAE,I;;;;;;;;;;;ACApD,aAAa,yCAAyC,EAAE,I;;;;;;;;;;;ACAxD,aAAa,yCAAyC,EAAE,I;;;;;;;;;;;ACAxD,aAAa,oCAAoC,EAAE,I;;;;;;;;;;;ACAnD,aAAa,iCAAiC,EAAE,I","file":"editor.js","sourcesContent":[" \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// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","export { default as URLInput } from './url-input';","/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component, Fragment, createRef, useMemo } from '@wordpress/element';\nimport {\n ExternalLink,\n IconButton,\n ToggleControl,\n Button,\n TextControl,\n Notice,\n Spinner,\n withSpokenMessages,\n} from '@wordpress/components';\nimport { LEFT, RIGHT, UP, DOWN, BACKSPACE, ENTER } from '@wordpress/keycodes';\nimport { getRectangleFromRange } from '@wordpress/dom';\nimport { prependHTTP, safeDecodeURI, filterURLForDisplay } from '@wordpress/url';\nimport {\n create,\n insert,\n isCollapsed,\n applyFormat,\n getTextContent,\n slice,\n} from '@wordpress/rich-text';\nimport { URLPopover } from '@wordpress/block-editor';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport URLInput from '../url-input';\nimport './style.scss';\n\n/**\n * Internal dependencies\n */\nimport { createLinkFormat, isValidHref } from './utils';\n\nconst stopKeyPropagation = ( event ) => event.stopPropagation();\n\nfunction isShowingInput( props, state ) {\n return props.addingLink || state.editLink;\n}\n\nconst LinkEditor = ( { value, onChangeInputValue, onKeyDown, submitLink, autocompleteRef } ) => (\n // Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n <form\n className=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content\"\n onKeyPress={ stopKeyPropagation }\n onKeyDown={ onKeyDown }\n onSubmit={ submitLink }\n >\n <URLInput\n value={ value }\n onChange={ onChangeInputValue }\n autocompleteRef={ autocompleteRef }\n />\n <IconButton icon=\"editor-break\" label={ __( 'Insert Pretty Link' ) } type=\"submit\" />\n </form>\n /* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n);\n\nconst LinkViewerUrl = ( { url } ) => {\n const prependedURL = prependHTTP( url );\n const linkClassName = classnames( 'editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value', {\n 'has-invalid-link': ! isValidHref( prependedURL ),\n } );\n\n if ( ! url ) {\n return <span className={ linkClassName }></span>;\n }\n\n return (\n <ExternalLink\n className={ linkClassName }\n href={ url }\n >\n { filterURLForDisplay( safeDecodeURI( url ) ) }\n </ExternalLink>\n );\n};\n\nconst URLPopoverAtLink = ( { isActive, addingLink, value, ...props } ) => {\n const anchorRect = useMemo( () => {\n const selection = window.getSelection();\n const range = selection.rangeCount > 0 ? selection.getRangeAt( 0 ) : null;\n if ( ! range ) {\n return;\n }\n\n if ( addingLink ) {\n return getRectangleFromRange( range );\n }\n\n let element = range.startContainer;\n\n // If the caret is right before the element, select the next element.\n element = element.nextElementSibling || element;\n\n while ( element.nodeType !== window.Node.ELEMENT_NODE ) {\n element = element.parentNode;\n }\n\n const closest = element.closest( 'a' );\n if ( closest ) {\n return closest.getBoundingClientRect();\n }\n }, [ isActive, addingLink, value.start, value.end ] );\n\n if ( ! anchorRect ) {\n return null;\n }\n\n return <URLPopover anchorRect={ anchorRect } { ...props } />;\n};\n\nconst LinkViewer = ( { url, editLink } ) => {\n return (\n // Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n /* eslint-disable jsx-a11y/no-static-element-interactions */\n <div\n className=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content\"\n onKeyPress={ stopKeyPropagation }\n >\n <LinkViewerUrl url={ url } />\n <IconButton icon=\"edit\" label={ __( 'Edit' ) } onClick={ editLink } />\n </div>\n /* eslint-enable jsx-a11y/no-static-element-interactions */\n );\n};\n\nconst createNewPrettyLink = (target, slug) => {\n return new Promise((resolve, reject) => {\n jQuery.post(\n ajaxurl,\n {\n action: 'prli_create_pretty_link',\n target: target,\n slug: slug,\n redirect: '',\n nofollow: 1,\n tracking: 1\n },\n (data, textStatus, xhr) => {\n 'true' === data ? resolve(data) : reject(data);\n }\n ).fail(error => {\n reject(error);\n });\n });\n}\n\nclass InlineLinkUI extends Component {\n constructor() {\n super( ...arguments );\n\n this.editLink = this.editLink.bind( this );\n this.submitLink = this.submitLink.bind( this );\n this.onKeyDown = this.onKeyDown.bind( this );\n this.onChangeInputValue = this.onChangeInputValue.bind( this );\n this.setLinkTarget = this.setLinkTarget.bind( this );\n this.onClickOutside = this.onClickOutside.bind( this );\n this.resetState = this.resetState.bind( this );\n this.autocompleteRef = createRef();\n\n this.state = {\n opensInNewWindow: false,\n inputValue: '',\n newLinkUrl: '',\n newLinkSlug: '',\n creatingLink: false,\n createdLink: false,\n createdLinkError: false\n };\n }\n\n static getDerivedStateFromProps( props, state ) {\n const { activeAttributes: { url, target } } = props;\n const opensInNewWindow = target === '_blank';\n\n if ( ! isShowingInput( props, state ) ) {\n if ( url !== state.inputValue ) {\n return { inputValue: url };\n }\n\n if ( opensInNewWindow !== state.opensInNewWindow ) {\n return { opensInNewWindow };\n }\n }\n\n return null;\n }\n\n onKeyDown( event ) {\n if ( [ LEFT, DOWN, RIGHT, UP, BACKSPACE, ENTER ].indexOf( event.keyCode ) > -1 ) {\n // Stop the key event from propagating up to ObserveTyping.startTypingInTextField.\n event.stopPropagation();\n }\n }\n\n onChangeInputValue( inputValue ) {\n this.setState( { inputValue } );\n }\n\n setLinkTarget( opensInNewWindow ) {\n const { activeAttributes: { url = '' }, value, onChange } = this.props;\n\n this.setState( { opensInNewWindow } );\n\n // Apply now if URL is not being edited.\n if ( ! isShowingInput( this.props, this.state ) ) {\n const selectedText = getTextContent( slice( value ) );\n\n onChange( applyFormat( value, createLinkFormat( {\n url,\n opensInNewWindow,\n text: selectedText,\n } ) ) );\n }\n }\n\n editLink( event ) {\n this.setState( { editLink: true } );\n event.preventDefault();\n }\n\n submitLink( event ) {\n const { isActive, value, onChange, speak } = this.props;\n const { inputValue, opensInNewWindow } = this.state;\n const url = prependHTTP( inputValue );\n const selectedText = getTextContent( slice( value ) );\n const format = createLinkFormat( {\n url,\n opensInNewWindow,\n text: selectedText,\n } );\n\n event.preventDefault();\n\n if ( isCollapsed( value ) && ! isActive ) {\n const toInsert = applyFormat( create( { text: url } ), format, 0, url.length );\n onChange( insert( value, toInsert ) );\n } else {\n onChange( applyFormat( value, format ) );\n }\n\n this.resetState();\n\n if ( ! isValidHref( url ) ) {\n speak( __( 'Warning: the link has been inserted but may have errors. Please test it.' ), 'assertive' );\n } else if ( isActive ) {\n speak( __( 'Link edited.' ), 'assertive' );\n } else {\n speak( __( 'Link inserted.' ), 'assertive' );\n }\n }\n\n onClickOutside( event ) {\n // The autocomplete suggestions list renders in a separate popover (in a portal),\n // so onClickOutside fails to detect that a click on a suggestion occurred in the\n // LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n // return to avoid the popover being closed.\n const autocompleteElement = this.autocompleteRef.current;\n if ( autocompleteElement && autocompleteElement.contains( event.target ) ) {\n return;\n }\n\n this.resetState();\n }\n\n resetState() {\n this.props.stopAddingLink();\n this.setState( { editLink: false } );\n }\n\n render() {\n const { isActive, activeAttributes: { url }, addingLink, value } = this.props;\n\n if ( ! isActive && ! addingLink ) {\n return null;\n }\n\n const { inputValue, opensInNewWindow, newLinkUrl, newLinkSlug, creatingLink, createdLink, createdLinkError } = this.state;\n const showInput = isShowingInput( this.props, this.state );\n\n return (\n <URLPopoverAtLink\n className=\"pretty-link-inserter\"\n value={ value }\n isActive={ isActive }\n addingLink={ addingLink }\n onClickOutside={ this.onClickOutside }\n onClose={ this.resetState }\n focusOnMount={ showInput ? 'firstElement' : false }\n renderSettings={ () => (\n <Fragment>\n <div>\n <ToggleControl\n label={ __( 'Open in New Tab' ) }\n checked={ opensInNewWindow }\n onChange={ this.setLinkTarget }\n />\n </div>\n <div className=\"pretty-link-inserter-form-container\">\n {\n createdLink && (\n <Notice status=\"success\" onRemove={() => this.setState({createdLink: false})}>\n <p>{__( 'Pretty Link created successfully.', 'memberpress' )}</p>\n </Notice>\n )\n }\n {\n createdLinkError && (\n <Notice status=\"error\" onRemove={() => this.setState({createdLink: false, createdLinkError: false})}>\n <p>{__( 'Pretty Link could not be created. Please try a slug that is not already used.', 'memberpress' )}</p>\n </Notice>\n )\n }\n <strong>{__('New Pretty Link', 'pretty-link')}</strong>\n <form onSubmit={(event) => {\n event.preventDefault();\n // Send request to create new Pretty Link\n this.setState({\n creatingLink: true,\n createdLinkError: false,\n });\n createNewPrettyLink( newLinkUrl, newLinkSlug )\n .then(data => {\n this.setState({\n createdLink: true,\n creatingLink: false,\n inputValue: plEditor.homeUrl + newLinkSlug,\n newLinkUrl: '',\n newLinkSlug: ''\n });\n })\n .catch(error => {\n this.setState({\n createdLink: false,\n creatingLink: false,\n createdLinkError: true,\n });\n });\n }}>\n <p>\n <TextControl\n placeholder=\"URL\"\n className=\"pretty-link-new-link-url\"\n value={newLinkUrl}\n onChange={ ( newLinkUrl ) => {\n this.setState( { newLinkUrl } );\n } }\n />\n </p>\n <p>\n <TextControl\n placeholder=\"Slug\"\n className=\"pretty-link-new-link-slug\"\n value={newLinkSlug}\n onChange={ ( newLinkSlug ) => {\n this.setState( { newLinkSlug } );\n } }\n />\n </p>\n <p>\n <button\n className=\"pretty-link-submit-new-link components-button is-button is-primary\"\n onClick={ () => {\n console.log('Creating new Pretty Link...');\n } }\n >\n { __( 'Create New Pretty Link', 'pretty-link' ) }\n </button>\n {\n creatingLink && (\n <Spinner />\n )\n }\n </p>\n </form>\n </div>\n </Fragment>\n ) }\n >\n { showInput ? (\n <LinkEditor\n value={ inputValue }\n onChangeInputValue={ this.onChangeInputValue }\n onKeyDown={ this.onKeyDown }\n submitLink={ this.submitLink }\n autocompleteRef={ this.autocompleteRef }\n />\n ) : (\n <LinkViewer\n url={ url }\n editLink={ this.editLink }\n />\n ) }\n </URLPopoverAtLink>\n );\n }\n}\n\nexport default withSpokenMessages( InlineLinkUI );\n","\nvar content = require(\"!!../../../../node_modules/postcss-loader/src/index.js??ref--6-1!../../../../node_modules/sass-loader/lib/loader.js!./style.scss\");\n\nif(typeof content === 'string') content = [[module.id, content, '']];\n\nvar transform;\nvar insertInto;\n\n\n\nvar options = {\"hmr\":true}\n\noptions.transform = transform\noptions.insertInto = undefined;\n\nvar update = require(\"!../../../../node_modules/style-loader/lib/addStyles.js\")(content, options);\n\nif(content.locals) module.exports = content.locals;\n\nif(module.hot) {\n\tmodule.hot.accept(\"!!../../../../node_modules/postcss-loader/src/index.js??ref--6-1!../../../../node_modules/sass-loader/lib/loader.js!./style.scss\", function() {\n\t\tvar newContent = require(\"!!../../../../node_modules/postcss-loader/src/index.js??ref--6-1!../../../../node_modules/sass-loader/lib/loader.js!./style.scss\");\n\n\t\tif(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n\n\t\tvar locals = (function(a, b) {\n\t\t\tvar key, idx = 0;\n\n\t\t\tfor(key in a) {\n\t\t\t\tif(!b || a[key] !== b[key]) return false;\n\t\t\t\tidx++;\n\t\t\t}\n\n\t\t\tfor(key in b) idx--;\n\n\t\t\treturn idx === 0;\n\t\t}(content.locals, newContent.locals));\n\n\t\tif(!locals) throw new Error('Aborting CSS HMR due to changed css-modules locals.');\n\n\t\tupdate(newContent);\n\t});\n\n\tmodule.hot.dispose(function() { update(); });\n}","/**\n * External dependencies\n */\nimport { startsWith } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n getProtocol,\n isValidProtocol,\n getAuthority,\n isValidAuthority,\n getPath,\n isValidPath,\n getQueryString,\n isValidQueryString,\n getFragment,\n isValidFragment,\n} from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Check for issues with the provided href.\n *\n * @param {string} href The href.\n *\n * @return {boolean} Is the href invalid?\n */\nexport function isValidHref( href ) {\n if ( ! href ) {\n return false;\n }\n\n const trimmedHref = href.trim();\n\n if ( ! trimmedHref ) {\n return false;\n }\n\n // Does the href start with something that looks like a URL protocol?\n if ( /^\\S+:/.test( trimmedHref ) ) {\n const protocol = getProtocol( trimmedHref );\n if ( ! isValidProtocol( protocol ) ) {\n return false;\n }\n\n // Add some extra checks for http(s) URIs, since these are the most common use-case.\n // This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n if ( startsWith( protocol, 'http' ) && ! /^https?:\\/\\/[^\\/\\s]/i.test( trimmedHref ) ) {\n return false;\n }\n\n const authority = getAuthority( trimmedHref );\n if ( ! isValidAuthority( authority ) ) {\n return false;\n }\n\n const path = getPath( trimmedHref );\n if ( path && ! isValidPath( path ) ) {\n return false;\n }\n\n const queryString = getQueryString( trimmedHref );\n if ( queryString && ! isValidQueryString( queryString ) ) {\n return false;\n }\n\n const fragment = getFragment( trimmedHref );\n if ( fragment && ! isValidFragment( fragment ) ) {\n return false;\n }\n }\n\n // Validate anchor links.\n if ( startsWith( trimmedHref, '#' ) && ! isValidFragment( trimmedHref ) ) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Generates the format object that will be applied to the link text.\n *\n * @param {string} url The href of the link.\n * @param {boolean} opensInNewWindow Whether this link will open in a new window.\n * @param {Object} text The text that is being hyperlinked.\n *\n * @return {Object} The final format object.\n */\nexport function createLinkFormat( { url, opensInNewWindow, text } ) {\n const format = {\n type: 'core/link',\n attributes: {\n url,\n },\n };\n\n if ( opensInNewWindow ) {\n // translators: accessibility label for external links, where the argument is the link text\n const label = sprintf( __( '%s (opens in a new tab)' ), text );\n\n format.attributes.target = '_blank';\n format.attributes.rel = 'noreferrer noopener';\n format.attributes[ 'aria-label' ] = label;\n }\n\n return format;\n}\n","/**\n * External dependencies\n */\nimport { throttle, map, pick, defaultTo } from 'lodash';\nimport classnames from 'classnames';\nimport scrollIntoView from 'dom-scroll-into-view';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport { UP, DOWN, ENTER, TAB } from '@wordpress/keycodes';\nimport { Spinner, withSpokenMessages, Popover } from '@wordpress/components';\nimport { withInstanceId, withSafeTimeout, compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\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\nconst fetchLinkSuggestions = async ( search ) => {\n\n const links = await apiFetch( {\n url: addQueryArgs( ajaxurl, {\n action: 'prli_search_for_links',\n term: search,\n } ),\n } );\n\n return map( links, ( link ) => ( {\n url: link.pretty_url,\n title: decodeEntities( link.value ) + ' (' + decodeEntities( link.slug ) + ')' || __( '(no title)' ),\n } ) );\n};\n\nclass URLInput extends Component {\n constructor( { autocompleteRef } ) {\n super( ...arguments );\n\n this.onChange = this.onChange.bind( this );\n this.onKeyDown = this.onKeyDown.bind( this );\n this.autocompleteRef = autocompleteRef || createRef();\n this.inputRef = createRef();\n this.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n this.suggestionNodes = [];\n\n this.state = {\n suggestions: [],\n showSuggestions: false,\n selectedSuggestion: null,\n };\n }\n\n componentDidUpdate() {\n const { showSuggestions, selectedSuggestion } = this.state;\n // only have to worry about scrolling selected suggestion into view\n // when already expanded\n if ( showSuggestions && selectedSuggestion !== null && ! this.scrollingIntoView ) {\n this.scrollingIntoView = true;\n scrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef.current, {\n onlyScrollIfNeeded: true,\n } );\n\n this.props.setTimeout( () => {\n this.scrollingIntoView = false;\n }, 100 );\n }\n }\n\n componentWillUnmount() {\n delete this.suggestionsRequest;\n }\n\n bindSuggestionNode( index ) {\n return ( ref ) => {\n this.suggestionNodes[ index ] = ref;\n };\n }\n\n updateSuggestions( value ) {\n\n // Show the suggestions after typing at least 2 characters\n // and also for URLs\n if ( value.length < 2 || /^https?:/.test( value ) ) {\n this.setState( {\n showSuggestions: false,\n selectedSuggestion: null,\n loading: false,\n } );\n\n return;\n }\n\n this.setState( {\n showSuggestions: true,\n selectedSuggestion: null,\n loading: true,\n } );\n\n const request = fetchLinkSuggestions( value );\n\n request.then( ( suggestions ) => {\n // A fetch Promise doesn't have an abort option. It's mimicked by\n // comparing the request reference in on the instance, which is\n // reset or deleted on subsequent requests or unmounting.\n if ( this.suggestionsRequest !== request ) {\n return;\n }\n\n this.setState( {\n suggestions,\n loading: false,\n } );\n\n if ( !! suggestions.length ) {\n this.props.debouncedSpeak( sprintf( _n(\n '%d result found, use up and down arrow keys to navigate.',\n '%d results found, use up and down arrow keys to navigate.',\n suggestions.length\n ), suggestions.length ), 'assertive' );\n } else {\n this.props.debouncedSpeak( __( 'No results.' ), 'assertive' );\n }\n } ).catch( () => {\n if ( this.suggestionsRequest === request ) {\n this.setState( {\n loading: false,\n } );\n }\n } );\n\n this.suggestionsRequest = request;\n }\n\n onChange( event ) {\n const inputValue = event.target.value;\n this.props.onChange( inputValue );\n this.updateSuggestions( inputValue );\n }\n\n onKeyDown( event ) {\n const { showSuggestions, selectedSuggestion, suggestions, loading } = this.state;\n // If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n // We shouldn't preventDefault to allow block arrow keys navigation\n if ( ! showSuggestions || ! suggestions.length || loading ) {\n // In the Windows version of Firefox the up and down arrows don't move the caret\n // within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n // a form of focus trapping that is disruptive to the user experience. This disruption\n // only happens if the caret is not in the first or last position in the text input.\n // See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n switch ( event.keyCode ) {\n // When UP is pressed, if the caret is at the start of the text, move it to the 0\n // position.\n case UP: {\n if ( 0 !== event.target.selectionStart ) {\n event.stopPropagation();\n event.preventDefault();\n\n // Set the input caret to position 0\n event.target.setSelectionRange( 0, 0 );\n }\n break;\n }\n // When DOWN is pressed, if the caret is not at the end of the text, move it to the\n // last position.\n case DOWN: {\n if ( this.props.value.length !== event.target.selectionStart ) {\n event.stopPropagation();\n event.preventDefault();\n\n // Set the input caret to the last position\n event.target.setSelectionRange( this.props.value.length, this.props.value.length );\n }\n break;\n }\n }\n\n return;\n }\n\n const suggestion = this.state.suggestions[ this.state.selectedSuggestion ];\n\n switch ( event.keyCode ) {\n case UP: {\n event.stopPropagation();\n event.preventDefault();\n const previousIndex = ! selectedSuggestion ? suggestions.length - 1 : selectedSuggestion - 1;\n this.setState( {\n selectedSuggestion: previousIndex,\n } );\n break;\n }\n case DOWN: {\n event.stopPropagation();\n event.preventDefault();\n const nextIndex = selectedSuggestion === null || ( selectedSuggestion === suggestions.length - 1 ) ? 0 : selectedSuggestion + 1;\n this.setState( {\n selectedSuggestion: nextIndex,\n } );\n break;\n }\n case TAB: {\n if ( this.state.selectedSuggestion !== null ) {\n this.selectLink( suggestion );\n // Announce a link has been selected when tabbing away from the input field.\n this.props.speak( __( 'Link selected.' ) );\n }\n break;\n }\n case ENTER: {\n if ( this.state.selectedSuggestion !== null ) {\n event.stopPropagation();\n this.selectLink( suggestion );\n }\n break;\n }\n }\n }\n\n selectLink( suggestion ) {\n this.props.onChange( suggestion.url, suggestion );\n this.setState( {\n selectedSuggestion: null,\n showSuggestions: false,\n } );\n }\n\n handleOnClick( suggestion ) {\n this.selectLink( suggestion );\n // Move focus to the input field when a link suggestion is clicked.\n this.inputRef.current.focus();\n }\n\n render() {\n const { value = '', autoFocus = true, instanceId, className } = this.props;\n const { showSuggestions, suggestions, selectedSuggestion, loading } = this.state;\n\n const suggestionsListboxId = `block-editor-url-input-suggestions-${ instanceId }`;\n const suggestionOptionIdPrefix = `block-editor-url-input-suggestion-${ instanceId }`;\n\n /* eslint-disable jsx-a11y/no-autofocus */\n return (\n <div className={ classnames( 'editor-url-input block-editor-url-input', className ) }>\n <input\n autoFocus={ autoFocus }\n type=\"text\"\n aria-label={ __( 'URL' ) }\n required\n value={ value }\n onChange={ this.onChange }\n onInput={ stopEventPropagation }\n placeholder={ __( 'Paste or type to search for your Pretty Link' ) }\n onKeyDown={ this.onKeyDown }\n role=\"combobox\"\n aria-expanded={ showSuggestions }\n aria-autocomplete=\"list\"\n aria-owns={ suggestionsListboxId }\n aria-activedescendant={ selectedSuggestion !== null ? `${ suggestionOptionIdPrefix }-${ selectedSuggestion }` : undefined }\n ref={ this.inputRef }\n />\n\n { ( loading ) && <Spinner /> }\n\n { showSuggestions && !! suggestions.length &&\n <Popover position=\"bottom\" noArrow focusOnMount={ false }>\n <div\n className=\"editor-url-input__suggestions block-editor-url-input__suggestions\"\n id={ suggestionsListboxId }\n ref={ this.autocompleteRef }\n role=\"listbox\"\n >\n { suggestions.map( ( suggestion, index ) => (\n <button\n key={ suggestion.id }\n role=\"option\"\n tabIndex=\"-1\"\n id={ `${ suggestionOptionIdPrefix }-${ index }` }\n ref={ this.bindSuggestionNode( index ) }\n className={ classnames( 'editor-url-input__suggestion block-editor-url-input__suggestion', {\n 'is-selected': index === selectedSuggestion,\n } ) }\n onClick={ () => this.handleOnClick( suggestion ) }\n aria-selected={ index === selectedSuggestion }\n >\n { suggestion.title }\n </button>\n ) ) }\n </div>\n </Popover>\n }\n </div>\n );\n /* eslint-enable jsx-a11y/no-autofocus */\n }\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/url-input/README.md\n */\nexport default compose(\n withSafeTimeout,\n withSpokenMessages,\n withInstanceId,\n withSelect( ( select ) => {\n const { getSettings } = select( 'core/block-editor' );\n return {\n fetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions,\n };\n } )\n)( URLInput );\n","/**\n * WordPress dependencies\n */\nimport { __ } from \"@wordpress/i18n\";\nimport { withSpokenMessages } from \"@wordpress/components\";\nimport { Component, Fragment } from \"@wordpress/element\";\nimport {\n getTextContent,\n applyFormat,\n removeFormat,\n slice,\n registerFormatType\n} from \"@wordpress/rich-text\";\nimport { isURL, isEmail } from \"@wordpress/url\";\nimport {\n RichTextToolbarButton,\n RichTextShortcut\n} from \"@wordpress/block-editor\";\nimport InlineLinkUI from \"../../components/link-editor\";\n\n/**\n * Block constants\n */\nconst name = \"pretty-link/pretty-link\";\nconst title = __(\"Pretty Link\");\n\nexport const prettyLink = {\n name,\n title,\n tagName: \"a\",\n className: \"pretty-link\",\n attributes: {\n url: \"href\",\n target: \"target\"\n },\n edit: withSpokenMessages(\n class LinkEdit extends Component {\n constructor() {\n super(...arguments);\n\n this.addLink = this.addLink.bind(this);\n this.stopAddingLink = this.stopAddingLink.bind(this);\n this.onRemoveFormat = this.onRemoveFormat.bind(this);\n this.state = {\n addingLink: false\n };\n }\n\n addLink() {\n const { value, onChange } = this.props;\n const text = getTextContent(slice(value));\n\n if (text && isURL(text)) {\n onChange(\n applyFormat(value, { type: name, attributes: { url: text } })\n );\n } else {\n this.setState({ addingLink: true });\n }\n }\n\n stopAddingLink() {\n this.setState({ addingLink: false });\n }\n\n onRemoveFormat() {\n const { value, onChange, speak } = this.props;\n\n onChange(removeFormat(value, name));\n speak(__(\"Link removed.\"), \"assertive\");\n }\n\n render() {\n const { isActive, activeAttributes, value, onChange } = this.props;\n\n return (\n <>\n <RichTextShortcut\n type=\"primary\"\n character=\"p\"\n onUse={this.addLink}\n />\n <RichTextShortcut\n type=\"primaryShift\"\n character=\"p\"\n onUse={this.onRemoveFormat}\n />\n {isActive && (\n <RichTextToolbarButton\n icon=\"star-filled\"\n title={__(\"Unlink\")}\n onClick={this.onRemoveFormat}\n isActive={isActive}\n shortcutType=\"primaryShift\"\n shortcutCharacter=\"p\"\n />\n )}\n {!isActive && (\n <RichTextToolbarButton\n icon=\"star-filled\"\n title={title}\n onClick={this.addLink}\n isActive={isActive}\n shortcutType=\"primary\"\n shortcutCharacter=\"p\"\n />\n )}\n <InlineLinkUI\n addingLink={this.state.addingLink}\n stopAddingLink={this.stopAddingLink}\n isActive={isActive}\n activeAttributes={activeAttributes}\n value={value}\n onChange={onChange}\n />\n </>\n );\n }\n }\n )\n};\n\nfunction registerFormats() {\n [prettyLink].forEach(({ name, ...settings }) =>\n registerFormatType(name, settings)\n );\n}\nregisterFormats();\n","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","var objectWithoutPropertiesLoose = require(\"./objectWithoutPropertiesLoose\");\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutProperties;","function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","/*!\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","'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;","'use strict';\n\nmodule.exports = require('./dom-scroll-into-view');","'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);","module.exports = \".pretty-link-inserter .block-editor-url-popover__settings {\\n display: block; }\\n\\n.pretty-link-inserter .pretty-link-inserter-form-container {\\n margin-top: 30px; }\\n\"","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n\nvar stylesInDom = {};\n\nvar\tmemoize = function (fn) {\n\tvar memo;\n\n\treturn function () {\n\t\tif (typeof memo === \"undefined\") memo = fn.apply(this, arguments);\n\t\treturn memo;\n\t};\n};\n\nvar isOldIE = memoize(function () {\n\t// Test for IE <= 9 as proposed by Browserhacks\n\t// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n\t// Tests for existence of standard globals is to allow style-loader\n\t// to operate correctly into non-standard environments\n\t// @see https://github.com/webpack-contrib/style-loader/issues/177\n\treturn window && document && document.all && !window.atob;\n});\n\nvar getTarget = function (target, parent) {\n if (parent){\n return parent.querySelector(target);\n }\n return document.querySelector(target);\n};\n\nvar getElement = (function (fn) {\n\tvar memo = {};\n\n\treturn function(target, parent) {\n // If passing function in options, then use it for resolve \"head\" element.\n // Useful for Shadow Root style i.e\n // {\n // insertInto: function () { return document.querySelector(\"#foo\").shadowRoot }\n // }\n if (typeof target === 'function') {\n return target();\n }\n if (typeof memo[target] === \"undefined\") {\n\t\t\tvar styleTarget = getTarget.call(this, target, parent);\n\t\t\t// Special case to return head of iframe instead of iframe itself\n\t\t\tif (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n\t\t\t\ttry {\n\t\t\t\t\t// This will throw an exception if access to iframe is blocked\n\t\t\t\t\t// due to cross-origin restrictions\n\t\t\t\t\tstyleTarget = styleTarget.contentDocument.head;\n\t\t\t\t} catch(e) {\n\t\t\t\t\tstyleTarget = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmemo[target] = styleTarget;\n\t\t}\n\t\treturn memo[target]\n\t};\n})();\n\nvar singleton = null;\nvar\tsingletonCounter = 0;\nvar\tstylesInsertedAtTop = [];\n\nvar\tfixUrls = require(\"./urls\");\n\nmodule.exports = function(list, options) {\n\tif (typeof DEBUG !== \"undefined\" && DEBUG) {\n\t\tif (typeof document !== \"object\") throw new Error(\"The style-loader cannot be used in a non-browser environment\");\n\t}\n\n\toptions = options || {};\n\n\toptions.attrs = typeof options.attrs === \"object\" ? options.attrs : {};\n\n\t// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n\t// tags it will allow on a page\n\tif (!options.singleton && typeof options.singleton !== \"boolean\") options.singleton = isOldIE();\n\n\t// By default, add <style> tags to the <head> element\n if (!options.insertInto) options.insertInto = \"head\";\n\n\t// By default, add <style> tags to the bottom of the target\n\tif (!options.insertAt) options.insertAt = \"bottom\";\n\n\tvar styles = listToStyles(list, options);\n\n\taddStylesToDom(styles, options);\n\n\treturn function update (newList) {\n\t\tvar mayRemove = [];\n\n\t\tfor (var i = 0; i < styles.length; i++) {\n\t\t\tvar item = styles[i];\n\t\t\tvar domStyle = stylesInDom[item.id];\n\n\t\t\tdomStyle.refs--;\n\t\t\tmayRemove.push(domStyle);\n\t\t}\n\n\t\tif(newList) {\n\t\t\tvar newStyles = listToStyles(newList, options);\n\t\t\taddStylesToDom(newStyles, options);\n\t\t}\n\n\t\tfor (var i = 0; i < mayRemove.length; i++) {\n\t\t\tvar domStyle = mayRemove[i];\n\n\t\t\tif(domStyle.refs === 0) {\n\t\t\t\tfor (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();\n\n\t\t\t\tdelete stylesInDom[domStyle.id];\n\t\t\t}\n\t\t}\n\t};\n};\n\nfunction addStylesToDom (styles, options) {\n\tfor (var i = 0; i < styles.length; i++) {\n\t\tvar item = styles[i];\n\t\tvar domStyle = stylesInDom[item.id];\n\n\t\tif(domStyle) {\n\t\t\tdomStyle.refs++;\n\n\t\t\tfor(var j = 0; j < domStyle.parts.length; j++) {\n\t\t\t\tdomStyle.parts[j](item.parts[j]);\n\t\t\t}\n\n\t\t\tfor(; j < item.parts.length; j++) {\n\t\t\t\tdomStyle.parts.push(addStyle(item.parts[j], options));\n\t\t\t}\n\t\t} else {\n\t\t\tvar parts = [];\n\n\t\t\tfor(var j = 0; j < item.parts.length; j++) {\n\t\t\t\tparts.push(addStyle(item.parts[j], options));\n\t\t\t}\n\n\t\t\tstylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};\n\t\t}\n\t}\n}\n\nfunction listToStyles (list, options) {\n\tvar styles = [];\n\tvar newStyles = {};\n\n\tfor (var i = 0; i < list.length; i++) {\n\t\tvar item = list[i];\n\t\tvar id = options.base ? item[0] + options.base : item[0];\n\t\tvar css = item[1];\n\t\tvar media = item[2];\n\t\tvar sourceMap = item[3];\n\t\tvar part = {css: css, media: media, sourceMap: sourceMap};\n\n\t\tif(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});\n\t\telse newStyles[id].parts.push(part);\n\t}\n\n\treturn styles;\n}\n\nfunction insertStyleElement (options, style) {\n\tvar target = getElement(options.insertInto)\n\n\tif (!target) {\n\t\tthrow new Error(\"Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.\");\n\t}\n\n\tvar lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];\n\n\tif (options.insertAt === \"top\") {\n\t\tif (!lastStyleElementInsertedAtTop) {\n\t\t\ttarget.insertBefore(style, target.firstChild);\n\t\t} else if (lastStyleElementInsertedAtTop.nextSibling) {\n\t\t\ttarget.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);\n\t\t} else {\n\t\t\ttarget.appendChild(style);\n\t\t}\n\t\tstylesInsertedAtTop.push(style);\n\t} else if (options.insertAt === \"bottom\") {\n\t\ttarget.appendChild(style);\n\t} else if (typeof options.insertAt === \"object\" && options.insertAt.before) {\n\t\tvar nextSibling = getElement(options.insertAt.before, target);\n\t\ttarget.insertBefore(style, nextSibling);\n\t} else {\n\t\tthrow new Error(\"[Style Loader]\\n\\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\\n Must be 'top', 'bottom', or Object.\\n (https://github.com/webpack-contrib/style-loader#insertat)\\n\");\n\t}\n}\n\nfunction removeStyleElement (style) {\n\tif (style.parentNode === null) return false;\n\tstyle.parentNode.removeChild(style);\n\n\tvar idx = stylesInsertedAtTop.indexOf(style);\n\tif(idx >= 0) {\n\t\tstylesInsertedAtTop.splice(idx, 1);\n\t}\n}\n\nfunction createStyleElement (options) {\n\tvar style = document.createElement(\"style\");\n\n\tif(options.attrs.type === undefined) {\n\t\toptions.attrs.type = \"text/css\";\n\t}\n\n\tif(options.attrs.nonce === undefined) {\n\t\tvar nonce = getNonce();\n\t\tif (nonce) {\n\t\t\toptions.attrs.nonce = nonce;\n\t\t}\n\t}\n\n\taddAttrs(style, options.attrs);\n\tinsertStyleElement(options, style);\n\n\treturn style;\n}\n\nfunction createLinkElement (options) {\n\tvar link = document.createElement(\"link\");\n\n\tif(options.attrs.type === undefined) {\n\t\toptions.attrs.type = \"text/css\";\n\t}\n\toptions.attrs.rel = \"stylesheet\";\n\n\taddAttrs(link, options.attrs);\n\tinsertStyleElement(options, link);\n\n\treturn link;\n}\n\nfunction addAttrs (el, attrs) {\n\tObject.keys(attrs).forEach(function (key) {\n\t\tel.setAttribute(key, attrs[key]);\n\t});\n}\n\nfunction getNonce() {\n\tif (typeof __webpack_nonce__ === 'undefined') {\n\t\treturn null;\n\t}\n\n\treturn __webpack_nonce__;\n}\n\nfunction addStyle (obj, options) {\n\tvar style, update, remove, result;\n\n\t// If a transform function was defined, run it on the css\n\tif (options.transform && obj.css) {\n\t result = typeof options.transform === 'function'\n\t\t ? options.transform(obj.css) \n\t\t : options.transform.default(obj.css);\n\n\t if (result) {\n\t \t// If transform returns a value, use that instead of the original css.\n\t \t// This allows running runtime transformations on the css.\n\t \tobj.css = result;\n\t } else {\n\t \t// If the transform function returns a falsy value, don't add this css.\n\t \t// This allows conditional loading of css\n\t \treturn function() {\n\t \t\t// noop\n\t \t};\n\t }\n\t}\n\n\tif (options.singleton) {\n\t\tvar styleIndex = singletonCounter++;\n\n\t\tstyle = singleton || (singleton = createStyleElement(options));\n\n\t\tupdate = applyToSingletonTag.bind(null, style, styleIndex, false);\n\t\tremove = applyToSingletonTag.bind(null, style, styleIndex, true);\n\n\t} else if (\n\t\tobj.sourceMap &&\n\t\ttypeof URL === \"function\" &&\n\t\ttypeof URL.createObjectURL === \"function\" &&\n\t\ttypeof URL.revokeObjectURL === \"function\" &&\n\t\ttypeof Blob === \"function\" &&\n\t\ttypeof btoa === \"function\"\n\t) {\n\t\tstyle = createLinkElement(options);\n\t\tupdate = updateLink.bind(null, style, options);\n\t\tremove = function () {\n\t\t\tremoveStyleElement(style);\n\n\t\t\tif(style.href) URL.revokeObjectURL(style.href);\n\t\t};\n\t} else {\n\t\tstyle = createStyleElement(options);\n\t\tupdate = applyToTag.bind(null, style);\n\t\tremove = function () {\n\t\t\tremoveStyleElement(style);\n\t\t};\n\t}\n\n\tupdate(obj);\n\n\treturn function updateStyle (newObj) {\n\t\tif (newObj) {\n\t\t\tif (\n\t\t\t\tnewObj.css === obj.css &&\n\t\t\t\tnewObj.media === obj.media &&\n\t\t\t\tnewObj.sourceMap === obj.sourceMap\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tupdate(obj = newObj);\n\t\t} else {\n\t\t\tremove();\n\t\t}\n\t};\n}\n\nvar replaceText = (function () {\n\tvar textStore = [];\n\n\treturn function (index, replacement) {\n\t\ttextStore[index] = replacement;\n\n\t\treturn textStore.filter(Boolean).join('\\n');\n\t};\n})();\n\nfunction applyToSingletonTag (style, index, remove, obj) {\n\tvar css = remove ? \"\" : obj.css;\n\n\tif (style.styleSheet) {\n\t\tstyle.styleSheet.cssText = replaceText(index, css);\n\t} else {\n\t\tvar cssNode = document.createTextNode(css);\n\t\tvar childNodes = style.childNodes;\n\n\t\tif (childNodes[index]) style.removeChild(childNodes[index]);\n\n\t\tif (childNodes.length) {\n\t\t\tstyle.insertBefore(cssNode, childNodes[index]);\n\t\t} else {\n\t\t\tstyle.appendChild(cssNode);\n\t\t}\n\t}\n}\n\nfunction applyToTag (style, obj) {\n\tvar css = obj.css;\n\tvar media = obj.media;\n\n\tif(media) {\n\t\tstyle.setAttribute(\"media\", media)\n\t}\n\n\tif(style.styleSheet) {\n\t\tstyle.styleSheet.cssText = css;\n\t} else {\n\t\twhile(style.firstChild) {\n\t\t\tstyle.removeChild(style.firstChild);\n\t\t}\n\n\t\tstyle.appendChild(document.createTextNode(css));\n\t}\n}\n\nfunction updateLink (link, options, obj) {\n\tvar css = obj.css;\n\tvar sourceMap = obj.sourceMap;\n\n\t/*\n\t\tIf convertToAbsoluteUrls isn't defined, but sourcemaps are enabled\n\t\tand there is no publicPath defined then lets turn convertToAbsoluteUrls\n\t\ton by default. Otherwise default to the convertToAbsoluteUrls option\n\t\tdirectly\n\t*/\n\tvar autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;\n\n\tif (options.convertToAbsoluteUrls || autoFixUrls) {\n\t\tcss = fixUrls(css);\n\t}\n\n\tif (sourceMap) {\n\t\t// http://stackoverflow.com/a/26603875\n\t\tcss += \"\\n/*# sourceMappingURL=data:application/json;base64,\" + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + \" */\";\n\t}\n\n\tvar blob = new Blob([css], { type: \"text/css\" });\n\n\tvar oldSrc = link.href;\n\n\tlink.href = URL.createObjectURL(blob);\n\n\tif(oldSrc) URL.revokeObjectURL(oldSrc);\n}\n","\n/**\n * When source maps are enabled, `style-loader` uses a link element with a data-uri to\n * embed the css on the page. This breaks all relative urls because now they are relative to a\n * bundle instead of the current page.\n *\n * One solution is to only use full urls, but that may be impossible.\n *\n * Instead, this function \"fixes\" the relative urls to be absolute according to the current page location.\n *\n * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.\n *\n */\n\nmodule.exports = function (css) {\n // get current location\n var location = typeof window !== \"undefined\" && window.location;\n\n if (!location) {\n throw new Error(\"fixUrls requires window.location\");\n }\n\n\t// blank or null?\n\tif (!css || typeof css !== \"string\") {\n\t return css;\n }\n\n var baseUrl = location.protocol + \"//\" + location.host;\n var currentDir = baseUrl + location.pathname.replace(/\\/[^\\/]*$/, \"/\");\n\n\t// convert each url(...)\n\t/*\n\tThis regular expression is just a way to recursively match brackets within\n\ta string.\n\n\t /url\\s*\\( = Match on the word \"url\" with any whitespace after it and then a parens\n\t ( = Start a capturing group\n\t (?: = Start a non-capturing group\n\t [^)(] = Match anything that isn't a parentheses\n\t | = OR\n\t \\( = Match a start parentheses\n\t (?: = Start another non-capturing groups\n\t [^)(]+ = Match anything that isn't a parentheses\n\t | = OR\n\t \\( = Match a start parentheses\n\t [^)(]* = Match anything that isn't a parentheses\n\t \\) = Match a end parentheses\n\t ) = End Group\n *\\) = Match anything and then a close parens\n ) = Close non-capturing group\n * = Match anything\n ) = Close capturing group\n\t \\) = Match a close parens\n\n\t /gi = Get all matches, not the first. Be case insensitive.\n\t */\n\tvar fixedCss = css.replace(/url\\s*\\(((?:[^)(]|\\((?:[^)(]+|\\([^)(]*\\))*\\))*)\\)/gi, function(fullMatch, origUrl) {\n\t\t// strip quotes (if they exist)\n\t\tvar unquotedOrigUrl = origUrl\n\t\t\t.trim()\n\t\t\t.replace(/^\"(.*)\"$/, function(o, $1){ return $1; })\n\t\t\t.replace(/^'(.*)'$/, function(o, $1){ return $1; });\n\n\t\t// already a full url? no change\n\t\tif (/^(#|data:|http:\\/\\/|https:\\/\\/|file:\\/\\/\\/|\\s*$)/i.test(unquotedOrigUrl)) {\n\t\t return fullMatch;\n\t\t}\n\n\t\t// convert the url to a full url\n\t\tvar newUrl;\n\n\t\tif (unquotedOrigUrl.indexOf(\"//\") === 0) {\n\t\t \t//TODO: should we add protocol?\n\t\t\tnewUrl = unquotedOrigUrl;\n\t\t} else if (unquotedOrigUrl.indexOf(\"/\") === 0) {\n\t\t\t// path should be relative to the base url\n\t\t\tnewUrl = baseUrl + unquotedOrigUrl; // already starts with '/'\n\t\t} else {\n\t\t\t// path should be relative to current directory\n\t\t\tnewUrl = currentDir + unquotedOrigUrl.replace(/^\\.\\//, \"\"); // Strip leading './'\n\t\t}\n\n\t\t// send back the fixed url(...)\n\t\treturn \"url(\" + JSON.stringify(newUrl) + \")\";\n\t});\n\n\t// send back the fixed css\n\treturn fixedCss;\n};\n","(function() { module.exports = this[\"regeneratorRuntime\"]; }());","(function() { module.exports = this[\"wp\"][\"apiFetch\"]; }());","(function() { module.exports = this[\"wp\"][\"blockEditor\"]; }());","(function() { module.exports = this[\"wp\"][\"components\"]; }());","(function() { module.exports = this[\"wp\"][\"compose\"]; }());","(function() { module.exports = this[\"wp\"][\"data\"]; }());","(function() { module.exports = this[\"wp\"][\"dom\"]; }());","(function() { module.exports = this[\"wp\"][\"element\"]; }());","(function() { module.exports = this[\"wp\"][\"htmlEntities\"]; }());","(function() { module.exports = this[\"wp\"][\"i18n\"]; }());","(function() { module.exports = this[\"wp\"][\"keycodes\"]; }());","(function() { module.exports = this[\"wp\"][\"richText\"]; }());","(function() { module.exports = this[\"wp\"][\"url\"]; }());","(function() { module.exports = this[\"lodash\"]; }());"],"sourceRoot":""}
|
1 |
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/editor/components/index.js","webpack:///./js/editor/components/link-editor/index.js","webpack:///./js/editor/components/link-editor/style.scss?a870","webpack:///./js/editor/components/link-editor/utils.js","webpack:///./js/editor/components/url-input/index.js","webpack:///./js/editor/formats/pretty-link/index.js","webpack:///./node_modules/@babel/runtime/helpers/assertThisInitialized.js","webpack:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js","webpack:///./node_modules/@babel/runtime/helpers/classCallCheck.js","webpack:///./node_modules/@babel/runtime/helpers/createClass.js","webpack:///./node_modules/@babel/runtime/helpers/extends.js","webpack:///./node_modules/@babel/runtime/helpers/getPrototypeOf.js","webpack:///./node_modules/@babel/runtime/helpers/inherits.js","webpack:///./node_modules/@babel/runtime/helpers/objectWithoutProperties.js","webpack:///./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js","webpack:///./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","webpack:///./node_modules/@babel/runtime/helpers/setPrototypeOf.js","webpack:///./node_modules/@babel/runtime/helpers/typeof.js","webpack:///./node_modules/classnames/index.js","webpack:///./node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js","webpack:///./node_modules/dom-scroll-into-view/lib/index.js","webpack:///./node_modules/dom-scroll-into-view/lib/util.js","webpack:///./js/editor/components/link-editor/style.scss","webpack:///./node_modules/style-loader/lib/addStyles.js","webpack:///./node_modules/style-loader/lib/urls.js","webpack:///external {\"this\":\"regeneratorRuntime\"}","webpack:///external {\"this\":[\"wp\",\"apiFetch\"]}","webpack:///external {\"this\":[\"wp\",\"blockEditor\"]}","webpack:///external {\"this\":[\"wp\",\"components\"]}","webpack:///external {\"this\":[\"wp\",\"compose\"]}","webpack:///external {\"this\":[\"wp\",\"data\"]}","webpack:///external {\"this\":[\"wp\",\"dom\"]}","webpack:///external {\"this\":[\"wp\",\"element\"]}","webpack:///external {\"this\":[\"wp\",\"htmlEntities\"]}","webpack:///external {\"this\":[\"wp\",\"i18n\"]}","webpack:///external {\"this\":[\"wp\",\"keycodes\"]}","webpack:///external {\"this\":[\"wp\",\"richText\"]}","webpack:///external {\"this\":[\"wp\",\"url\"]}","webpack:///external {\"this\":\"lodash\"}"],"names":["stopKeyPropagation","event","stopPropagation","isShowingInput","props","state","addingLink","editLink","LinkEditor","value","onChangeInputValue","onKeyDown","submitLink","autocompleteRef","__","LinkViewerUrl","url","prependedURL","prependHTTP","linkClassName","classnames","isValidHref","filterURLForDisplay","safeDecodeURI","URLPopoverAtLink","isActive","anchorRect","useMemo","selection","window","getSelection","range","rangeCount","getRangeAt","getRectangleFromRange","element","startContainer","nextElementSibling","nodeType","Node","ELEMENT_NODE","parentNode","closest","getBoundingClientRect","start","end","LinkViewer","createNewPrettyLink","target","slug","Promise","resolve","reject","jQuery","post","ajaxurl","action","redirect","nofollow","tracking","data","textStatus","xhr","fail","error","InlineLinkUI","arguments","bind","setNoFollow","setLinkTarget","onClickOutside","resetState","createRef","noFollow","opensInNewWindow","inputValue","newLinkUrl","newLinkSlug","creatingLink","createdLink","createdLinkError","LEFT","DOWN","RIGHT","UP","BACKSPACE","ENTER","indexOf","keyCode","setState","activeAttributes","onChange","selectedText","getTextContent","slice","applyFormat","createLinkFormat","text","preventDefault","speak","format","isCollapsed","toInsert","create","length","insert","autocompleteElement","current","contains","stopAddingLink","showInput","then","plEditor","homeUrl","catch","console","log","Component","withSpokenMessages","href","trimmedHref","trim","test","protocol","getProtocol","isValidProtocol","startsWith","authority","getAuthority","isValidAuthority","path","getPath","isValidPath","queryString","getQueryString","isValidQueryString","fragment","getFragment","isValidFragment","type","attributes","rel","label","sprintf","stopEventPropagation","fetchLinkSuggestions","search","apiFetch","addQueryArgs","term","links","map","link","pretty_url","title","decodeEntities","URLInput","inputRef","updateSuggestions","throttle","suggestionNodes","suggestions","showSuggestions","selectedSuggestion","scrollingIntoView","scrollIntoView","onlyScrollIfNeeded","setTimeout","suggestionsRequest","index","ref","loading","request","debouncedSpeak","_n","selectionStart","setSelectionRange","suggestion","previousIndex","nextIndex","TAB","selectLink","focus","autoFocus","instanceId","className","suggestionsListboxId","suggestionOptionIdPrefix","undefined","id","bindSuggestionNode","handleOnClick","compose","withSafeTimeout","withInstanceId","withSelect","select","getSettings","__experimentalFetchLinkSuggestions","name","prettyLink","tagName","edit","addLink","onRemoveFormat","isURL","removeFormat","registerFormats","forEach","settings","registerFormatType"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;ACnEA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;AAGA;AAEA;;;;AAGA;AACA;AACA;AAUA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AAEA;;;;AAGA;;AAEA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAAEC,KAAF;AAAA,SAAaA,KAAK,CAACC,eAAN,EAAb;AAAA,CAA3B;;AAEA,SAASC,cAAT,CAAyBC,KAAzB,EAAgCC,KAAhC,EAAwC;AACtC,SAAOD,KAAK,CAACE,UAAN,IAAoBD,KAAK,CAACE,QAAjC;AACD;;AAED,IAAMC,UAAU,GAAG,SAAbA,UAAa;AAAA,MAAIC,KAAJ,QAAIA,KAAJ;AAAA,MAAWC,kBAAX,QAAWA,kBAAX;AAAA,MAA+BC,SAA/B,QAA+BA,SAA/B;AAAA,MAA0CC,UAA1C,QAA0CA,UAA1C;AAAA,MAAsDC,eAAtD,QAAsDA,eAAtD;AAAA,SACjB;;AACA;AACA;AACE,eAAS,EAAC,mGADZ;AAEE,gBAAU,EAAGb,kBAFf;AAGE,eAAS,EAAGW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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA,gC;;;;;;;;;;;;AChIa;;AAEb,iBAAiB,mBAAO,CAAC,+FAAwB,E;;;;;;;;;;;;ACFpC;;AAEb,mDAAmD,gBAAgB,sBAAsB,OAAO,2BAA2B,0BAA0B,yDAAyD,2BAA2B,EAAE,EAAE,EAAE,eAAe;;AAE9P,oGAAoG,mBAAmB,EAAE,mBAAmB,kGAAkG;;AAE9O;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,kBAAkB;AAC/B;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,SAAS,OAAO;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,CAAC,Y;;;;;;;;;;;ACtbD,6EAA6E,mBAAmB,EAAE,gEAAgE,qBAAqB,EAAE,G;;;;;;;;;;;ACAzL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA,cAAc,mBAAO,CAAC,uDAAQ;;AAE9B;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA,iBAAiB,mBAAmB;AACpC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,sBAAsB;AACvC;;AAEA;AACA,mBAAmB,2BAA2B;;AAE9C;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,mBAAmB;AACnC;AACA;;AAEA;AACA;;AAEA,iBAAiB,2BAA2B;AAC5C;AACA;;AAEA,QAAQ,uBAAuB;AAC/B;AACA;AACA,GAAG;AACH;;AAEA,iBAAiB,uBAAuB;AACxC;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA,cAAc;;AAEd,kDAAkD,sBAAsB;AACxE;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA,EAAE;AACF;AACA,EAAE;AACF;AACA;AACA,EAAE;AACF;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;;AAEA;AACA,KAAK,KAAwC,EAAE,EAE7C;;AAEF,QAAQ,sBAAiB;AACzB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE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,EAAE,I;;;;;;;;;;;ACAnD,aAAa,iCAAiC,EAAE,I","file":"editor.js","sourcesContent":[" \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// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","export { default as URLInput } from './url-input';","/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component, Fragment, createRef, useMemo } from '@wordpress/element';\nimport {\n ExternalLink,\n IconButton,\n ToggleControl,\n Button,\n TextControl,\n Notice,\n Spinner,\n withSpokenMessages,\n} from '@wordpress/components';\nimport { LEFT, RIGHT, UP, DOWN, BACKSPACE, ENTER } from '@wordpress/keycodes';\nimport { getRectangleFromRange } from '@wordpress/dom';\nimport { prependHTTP, safeDecodeURI, filterURLForDisplay } from '@wordpress/url';\nimport {\n create,\n insert,\n isCollapsed,\n applyFormat,\n getTextContent,\n slice,\n} from '@wordpress/rich-text';\nimport { URLPopover } from '@wordpress/block-editor';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport URLInput from '../url-input';\nimport './style.scss';\n\n/**\n * Internal dependencies\n */\nimport { createLinkFormat, isValidHref } from './utils';\n\nconst stopKeyPropagation = ( event ) => event.stopPropagation();\n\nfunction isShowingInput( props, state ) {\n return props.addingLink || state.editLink;\n}\n\nconst LinkEditor = ( { value, onChangeInputValue, onKeyDown, submitLink, autocompleteRef } ) => (\n // Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n <form\n className=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content\"\n onKeyPress={ stopKeyPropagation }\n onKeyDown={ onKeyDown }\n onSubmit={ submitLink }\n >\n <URLInput\n value={ value }\n onChange={ onChangeInputValue }\n autocompleteRef={ autocompleteRef }\n />\n <IconButton icon=\"editor-break\" label={ __( 'Insert Pretty Link' ) } type=\"submit\" />\n </form>\n /* eslint-enable jsx-a11y/no-noninteractive-element-interactions */\n);\n\nconst LinkViewerUrl = ( { url } ) => {\n const prependedURL = prependHTTP( url );\n const linkClassName = classnames( 'editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value', {\n 'has-invalid-link': ! isValidHref( prependedURL ),\n } );\n\n if ( ! url ) {\n return <span className={ linkClassName }></span>;\n }\n\n return (\n <ExternalLink\n className={ linkClassName }\n href={ url }\n >\n { filterURLForDisplay( safeDecodeURI( url ) ) }\n </ExternalLink>\n );\n};\n\nconst URLPopoverAtLink = ( { isActive, addingLink, value, ...props } ) => {\n const anchorRect = useMemo( () => {\n const selection = window.getSelection();\n const range = selection.rangeCount > 0 ? selection.getRangeAt( 0 ) : null;\n if ( ! range ) {\n return;\n }\n\n if ( addingLink ) {\n return getRectangleFromRange( range );\n }\n\n let element = range.startContainer;\n\n // If the caret is right before the element, select the next element.\n element = element.nextElementSibling || element;\n\n while ( element.nodeType !== window.Node.ELEMENT_NODE ) {\n element = element.parentNode;\n }\n\n const closest = element.closest( 'a' );\n if ( closest ) {\n return closest.getBoundingClientRect();\n }\n }, [ isActive, addingLink, value.start, value.end ] );\n\n if ( ! anchorRect ) {\n return null;\n }\n\n return <URLPopover anchorRect={ anchorRect } { ...props } />;\n};\n\nconst LinkViewer = ( { url, editLink } ) => {\n return (\n // Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar\n /* eslint-disable jsx-a11y/no-static-element-interactions */\n <div\n className=\"editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content\"\n onKeyPress={ stopKeyPropagation }\n >\n <LinkViewerUrl url={ url } />\n <IconButton icon=\"edit\" label={ __( 'Edit' ) } onClick={ editLink } />\n </div>\n /* eslint-enable jsx-a11y/no-static-element-interactions */\n );\n};\n\nconst createNewPrettyLink = (target, slug) => {\n return new Promise((resolve, reject) => {\n jQuery.post(\n ajaxurl,\n {\n action: 'prli_create_pretty_link',\n target: target,\n slug: slug,\n redirect: '',\n nofollow: 1,\n tracking: 1\n },\n (data, textStatus, xhr) => {\n 'true' === data ? resolve(data) : reject(data);\n }\n ).fail(error => {\n reject(error);\n });\n });\n}\n\nclass InlineLinkUI extends Component {\n constructor() {\n super( ...arguments );\n\n this.editLink = this.editLink.bind( this );\n this.submitLink = this.submitLink.bind( this );\n this.onKeyDown = this.onKeyDown.bind( this );\n this.onChangeInputValue = this.onChangeInputValue.bind( this );\n this.setNoFollow = this.setNoFollow.bind( this );\n this.setLinkTarget = this.setLinkTarget.bind( this );\n this.onClickOutside = this.onClickOutside.bind( this );\n this.resetState = this.resetState.bind( this );\n this.autocompleteRef = createRef();\n\n this.state = {\n noFollow: false,\n opensInNewWindow: false,\n inputValue: '',\n newLinkUrl: '',\n newLinkSlug: '',\n creatingLink: false,\n createdLink: false,\n createdLinkError: false\n };\n }\n\n static getDerivedStateFromProps( props, state ) {\n const { activeAttributes: { url, target } } = props;\n const opensInNewWindow = target === '_blank';\n\n if ( ! isShowingInput( props, state ) ) {\n if ( url !== state.inputValue ) {\n return { inputValue: url };\n }\n\n if ( opensInNewWindow !== state.opensInNewWindow ) {\n return { opensInNewWindow };\n }\n }\n\n return null;\n }\n\n onKeyDown( event ) {\n if ( [ LEFT, DOWN, RIGHT, UP, BACKSPACE, ENTER ].indexOf( event.keyCode ) > -1 ) {\n // Stop the key event from propagating up to ObserveTyping.startTypingInTextField.\n event.stopPropagation();\n }\n }\n\n onChangeInputValue( inputValue ) {\n this.setState( { inputValue } );\n }\n\n setLinkTarget( opensInNewWindow ) {\n const { activeAttributes: { url = '' }, value, onChange } = this.props;\n\n this.setState( { opensInNewWindow } );\n\n // Apply now if URL is not being edited.\n if ( ! isShowingInput( this.props, this.state ) ) {\n const selectedText = getTextContent( slice( value ) );\n\n onChange( applyFormat( value, createLinkFormat( {\n url,\n opensInNewWindow,\n text: selectedText,\n } ) ) );\n }\n }\n\n setNoFollow( noFollow ) {\n const { activeAttributes: { url = '' }, value, onChange } = this.props;\n\n this.setState( { noFollow } );\n\n // Apply now if URL is not being edited.\n if ( ! isShowingInput( this.props, this.state ) ) {\n const selectedText = getTextContent( slice( value ) );\n\n onChange( applyFormat( value, createLinkFormat( {\n url,\n opensInNewWindow,\n text: selectedText,\n noFollow\n } ) ) );\n }\n }\n\n editLink( event ) {\n this.setState( { editLink: true } );\n event.preventDefault();\n }\n\n submitLink( event ) {\n const { isActive, value, onChange, speak } = this.props;\n const { inputValue, opensInNewWindow, noFollow } = this.state;\n const url = prependHTTP( inputValue );\n const selectedText = getTextContent( slice( value ) );\n const format = createLinkFormat( {\n url,\n opensInNewWindow,\n text: selectedText,\n noFollow\n } );\n\n event.preventDefault();\n\n if ( isCollapsed( value ) && ! isActive ) {\n const toInsert = applyFormat( create( { text: url } ), format, 0, url.length );\n onChange( insert( value, toInsert ) );\n } else {\n onChange( applyFormat( value, format ) );\n }\n\n this.resetState();\n\n if ( ! isValidHref( url ) ) {\n speak( __( 'Warning: the link has been inserted but may have errors. Please test it.' ), 'assertive' );\n } else if ( isActive ) {\n speak( __( 'Link edited.' ), 'assertive' );\n } else {\n speak( __( 'Link inserted.' ), 'assertive' );\n }\n }\n\n onClickOutside( event ) {\n // The autocomplete suggestions list renders in a separate popover (in a portal),\n // so onClickOutside fails to detect that a click on a suggestion occurred in the\n // LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n // return to avoid the popover being closed.\n const autocompleteElement = this.autocompleteRef.current;\n if ( autocompleteElement && autocompleteElement.contains( event.target ) ) {\n return;\n }\n\n this.resetState();\n }\n\n resetState() {\n this.props.stopAddingLink();\n this.setState( { editLink: false } );\n }\n\n render() {\n const { isActive, activeAttributes: { url }, addingLink, value } = this.props;\n\n if ( ! isActive && ! addingLink ) {\n return null;\n }\n\n const { inputValue, noFollow, opensInNewWindow, newLinkUrl, newLinkSlug, creatingLink, createdLink, createdLinkError } = this.state;\n const showInput = isShowingInput( this.props, this.state );\n\n return (\n <URLPopoverAtLink\n className=\"pretty-link-inserter\"\n value={ value }\n isActive={ isActive }\n addingLink={ addingLink }\n onClickOutside={ this.onClickOutside }\n onClose={ this.resetState }\n focusOnMount={ showInput ? 'firstElement' : false }\n renderSettings={ () => (\n <Fragment>\n <div>\n <ToggleControl\n label={ __( 'Open in New Tab' ) }\n checked={ opensInNewWindow }\n onChange={ this.setLinkTarget }\n />\n <ToggleControl\n label={ __( 'Nofollow' ) }\n checked={ noFollow }\n onChange={ this.setNoFollow }\n />\n </div>\n <div className=\"pretty-link-inserter-form-container\">\n {\n createdLink && (\n <Notice status=\"success\" onRemove={() => this.setState({createdLink: false})}>\n <p>{__( 'Pretty Link created successfully.', 'memberpress' )}</p>\n </Notice>\n )\n }\n {\n createdLinkError && (\n <Notice status=\"error\" onRemove={() => this.setState({createdLink: false, createdLinkError: false})}>\n <p>{__( 'Pretty Link could not be created. Please try a slug that is not already used.', 'memberpress' )}</p>\n </Notice>\n )\n }\n <strong>{__('New Pretty Link', 'pretty-link')}</strong>\n <form onSubmit={(event) => {\n event.preventDefault();\n // Send request to create new Pretty Link\n this.setState({\n creatingLink: true,\n createdLinkError: false,\n });\n createNewPrettyLink( newLinkUrl, newLinkSlug )\n .then(data => {\n this.setState({\n createdLink: true,\n creatingLink: false,\n inputValue: plEditor.homeUrl + newLinkSlug,\n newLinkUrl: '',\n newLinkSlug: ''\n });\n })\n .catch(error => {\n this.setState({\n createdLink: false,\n creatingLink: false,\n createdLinkError: true,\n });\n });\n }}>\n <p>\n <TextControl\n placeholder=\"URL\"\n className=\"pretty-link-new-link-url\"\n value={newLinkUrl}\n onChange={ ( newLinkUrl ) => {\n this.setState( { newLinkUrl } );\n } }\n />\n </p>\n <p>\n <TextControl\n placeholder=\"Slug\"\n className=\"pretty-link-new-link-slug\"\n value={newLinkSlug}\n onChange={ ( newLinkSlug ) => {\n this.setState( { newLinkSlug } );\n } }\n />\n </p>\n <p>\n <button\n className=\"pretty-link-submit-new-link components-button is-button is-primary\"\n onClick={ () => {\n console.log('Creating new Pretty Link...');\n } }\n >\n { __( 'Create New Pretty Link', 'pretty-link' ) }\n </button>\n {\n creatingLink && (\n <Spinner />\n )\n }\n </p>\n </form>\n </div>\n </Fragment>\n ) }\n >\n { showInput ? (\n <LinkEditor\n value={ inputValue }\n onChangeInputValue={ this.onChangeInputValue }\n onKeyDown={ this.onKeyDown }\n submitLink={ this.submitLink }\n autocompleteRef={ this.autocompleteRef }\n />\n ) : (\n <LinkViewer\n url={ url }\n editLink={ this.editLink }\n />\n ) }\n </URLPopoverAtLink>\n );\n }\n}\n\nexport default withSpokenMessages( InlineLinkUI );\n","\nvar content = require(\"!!../../../../node_modules/postcss-loader/src/index.js??ref--6-1!../../../../node_modules/sass-loader/lib/loader.js!./style.scss\");\n\nif(typeof content === 'string') content = [[module.id, content, '']];\n\nvar transform;\nvar insertInto;\n\n\n\nvar options = {\"hmr\":true}\n\noptions.transform = transform\noptions.insertInto = undefined;\n\nvar update = require(\"!../../../../node_modules/style-loader/lib/addStyles.js\")(content, options);\n\nif(content.locals) module.exports = content.locals;\n\nif(module.hot) {\n\tmodule.hot.accept(\"!!../../../../node_modules/postcss-loader/src/index.js??ref--6-1!../../../../node_modules/sass-loader/lib/loader.js!./style.scss\", function() {\n\t\tvar newContent = require(\"!!../../../../node_modules/postcss-loader/src/index.js??ref--6-1!../../../../node_modules/sass-loader/lib/loader.js!./style.scss\");\n\n\t\tif(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n\n\t\tvar locals = (function(a, b) {\n\t\t\tvar key, idx = 0;\n\n\t\t\tfor(key in a) {\n\t\t\t\tif(!b || a[key] !== b[key]) return false;\n\t\t\t\tidx++;\n\t\t\t}\n\n\t\t\tfor(key in b) idx--;\n\n\t\t\treturn idx === 0;\n\t\t}(content.locals, newContent.locals));\n\n\t\tif(!locals) throw new Error('Aborting CSS HMR due to changed css-modules locals.');\n\n\t\tupdate(newContent);\n\t});\n\n\tmodule.hot.dispose(function() { update(); });\n}","/**\n * External dependencies\n */\nimport { startsWith } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n getProtocol,\n isValidProtocol,\n getAuthority,\n isValidAuthority,\n getPath,\n isValidPath,\n getQueryString,\n isValidQueryString,\n getFragment,\n isValidFragment,\n} from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Check for issues with the provided href.\n *\n * @param {string} href The href.\n *\n * @return {boolean} Is the href invalid?\n */\nexport function isValidHref( href ) {\n if ( ! href ) {\n return false;\n }\n\n const trimmedHref = href.trim();\n\n if ( ! trimmedHref ) {\n return false;\n }\n\n // Does the href start with something that looks like a URL protocol?\n if ( /^\\S+:/.test( trimmedHref ) ) {\n const protocol = getProtocol( trimmedHref );\n if ( ! isValidProtocol( protocol ) ) {\n return false;\n }\n\n // Add some extra checks for http(s) URIs, since these are the most common use-case.\n // This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n if ( startsWith( protocol, 'http' ) && ! /^https?:\\/\\/[^\\/\\s]/i.test( trimmedHref ) ) {\n return false;\n }\n\n const authority = getAuthority( trimmedHref );\n if ( ! isValidAuthority( authority ) ) {\n return false;\n }\n\n const path = getPath( trimmedHref );\n if ( path && ! isValidPath( path ) ) {\n return false;\n }\n\n const queryString = getQueryString( trimmedHref );\n if ( queryString && ! isValidQueryString( queryString ) ) {\n return false;\n }\n\n const fragment = getFragment( trimmedHref );\n if ( fragment && ! isValidFragment( fragment ) ) {\n return false;\n }\n }\n\n // Validate anchor links.\n if ( startsWith( trimmedHref, '#' ) && ! isValidFragment( trimmedHref ) ) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Generates the format object that will be applied to the link text.\n *\n * @param {string} url The href of the link.\n * @param {boolean} opensInNewWindow Whether this link will open in a new window.\n * @param {Object} text The text that is being hyperlinked.\n *\n * @return {Object} The final format object.\n */\nexport function createLinkFormat( { url, opensInNewWindow, text, noFollow } ) {\n const format = {\n type: 'core/link',\n attributes: {\n url,\n },\n };\n\n format.attributes.rel = '';\n\n if ( noFollow ) {\n format.attributes.rel += 'nofollow ';\n }\n\n if ( opensInNewWindow ) {\n // translators: accessibility label for external links, where the argument is the link text\n const label = sprintf( __( '%s (opens in a new tab)' ), text );\n\n format.attributes.target = '_blank';\n format.attributes.rel += 'noreferrer noopener';\n\n format.attributes[ 'aria-label' ] = label;\n }\n\n if ( '' === format.attributes.rel ) {\n delete format.attributes.rel;\n }\n\n return format;\n}\n","/**\n * External dependencies\n */\nimport { throttle, map, pick, defaultTo } from 'lodash';\nimport classnames from 'classnames';\nimport scrollIntoView from 'dom-scroll-into-view';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport { UP, DOWN, ENTER, TAB } from '@wordpress/keycodes';\nimport { Spinner, withSpokenMessages, Popover } from '@wordpress/components';\nimport { withInstanceId, withSafeTimeout, compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\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\nconst fetchLinkSuggestions = async ( search ) => {\n\n const links = await apiFetch( {\n url: addQueryArgs( ajaxurl, {\n action: 'prli_search_for_links',\n term: search,\n } ),\n } );\n\n return map( links, ( link ) => ( {\n url: link.pretty_url,\n title: decodeEntities( link.value ) + ' (' + decodeEntities( link.slug ) + ')' || __( '(no title)' ),\n } ) );\n};\n\nclass URLInput extends Component {\n constructor( { autocompleteRef } ) {\n super( ...arguments );\n\n this.onChange = this.onChange.bind( this );\n this.onKeyDown = this.onKeyDown.bind( this );\n this.autocompleteRef = autocompleteRef || createRef();\n this.inputRef = createRef();\n this.updateSuggestions = throttle( this.updateSuggestions.bind( this ), 200 );\n\n this.suggestionNodes = [];\n\n this.state = {\n suggestions: [],\n showSuggestions: false,\n selectedSuggestion: null,\n };\n }\n\n componentDidUpdate() {\n const { showSuggestions, selectedSuggestion } = this.state;\n // only have to worry about scrolling selected suggestion into view\n // when already expanded\n if ( showSuggestions && selectedSuggestion !== null && ! this.scrollingIntoView ) {\n this.scrollingIntoView = true;\n scrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef.current, {\n onlyScrollIfNeeded: true,\n } );\n\n this.props.setTimeout( () => {\n this.scrollingIntoView = false;\n }, 100 );\n }\n }\n\n componentWillUnmount() {\n delete this.suggestionsRequest;\n }\n\n bindSuggestionNode( index ) {\n return ( ref ) => {\n this.suggestionNodes[ index ] = ref;\n };\n }\n\n updateSuggestions( value ) {\n\n // Show the suggestions after typing at least 2 characters\n // and also for URLs\n if ( value.length < 2 || /^https?:/.test( value ) ) {\n this.setState( {\n showSuggestions: false,\n selectedSuggestion: null,\n loading: false,\n } );\n\n return;\n }\n\n this.setState( {\n showSuggestions: true,\n selectedSuggestion: null,\n loading: true,\n } );\n\n const request = fetchLinkSuggestions( value );\n\n request.then( ( suggestions ) => {\n // A fetch Promise doesn't have an abort option. It's mimicked by\n // comparing the request reference in on the instance, which is\n // reset or deleted on subsequent requests or unmounting.\n if ( this.suggestionsRequest !== request ) {\n return;\n }\n\n this.setState( {\n suggestions,\n loading: false,\n } );\n\n if ( !! suggestions.length ) {\n this.props.debouncedSpeak( sprintf( _n(\n '%d result found, use up and down arrow keys to navigate.',\n '%d results found, use up and down arrow keys to navigate.',\n suggestions.length\n ), suggestions.length ), 'assertive' );\n } else {\n this.props.debouncedSpeak( __( 'No results.' ), 'assertive' );\n }\n } ).catch( () => {\n if ( this.suggestionsRequest === request ) {\n this.setState( {\n loading: false,\n } );\n }\n } );\n\n this.suggestionsRequest = request;\n }\n\n onChange( event ) {\n const inputValue = event.target.value;\n this.props.onChange( inputValue );\n this.updateSuggestions( inputValue );\n }\n\n onKeyDown( event ) {\n const { showSuggestions, selectedSuggestion, suggestions, loading } = this.state;\n // If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n // We shouldn't preventDefault to allow block arrow keys navigation\n if ( ! showSuggestions || ! suggestions.length || loading ) {\n // In the Windows version of Firefox the up and down arrows don't move the caret\n // within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n // a form of focus trapping that is disruptive to the user experience. This disruption\n // only happens if the caret is not in the first or last position in the text input.\n // See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n switch ( event.keyCode ) {\n // When UP is pressed, if the caret is at the start of the text, move it to the 0\n // position.\n case UP: {\n if ( 0 !== event.target.selectionStart ) {\n event.stopPropagation();\n event.preventDefault();\n\n // Set the input caret to position 0\n event.target.setSelectionRange( 0, 0 );\n }\n break;\n }\n // When DOWN is pressed, if the caret is not at the end of the text, move it to the\n // last position.\n case DOWN: {\n if ( this.props.value.length !== event.target.selectionStart ) {\n event.stopPropagation();\n event.preventDefault();\n\n // Set the input caret to the last position\n event.target.setSelectionRange( this.props.value.length, this.props.value.length );\n }\n break;\n }\n }\n\n return;\n }\n\n const suggestion = this.state.suggestions[ this.state.selectedSuggestion ];\n\n switch ( event.keyCode ) {\n case UP: {\n event.stopPropagation();\n event.preventDefault();\n const previousIndex = ! selectedSuggestion ? suggestions.length - 1 : selectedSuggestion - 1;\n this.setState( {\n selectedSuggestion: previousIndex,\n } );\n break;\n }\n case DOWN: {\n event.stopPropagation();\n event.preventDefault();\n const nextIndex = selectedSuggestion === null || ( selectedSuggestion === suggestions.length - 1 ) ? 0 : selectedSuggestion + 1;\n this.setState( {\n selectedSuggestion: nextIndex,\n } );\n break;\n }\n case TAB: {\n if ( this.state.selectedSuggestion !== null ) {\n this.selectLink( suggestion );\n // Announce a link has been selected when tabbing away from the input field.\n this.props.speak( __( 'Link selected.' ) );\n }\n break;\n }\n case ENTER: {\n if ( this.state.selectedSuggestion !== null ) {\n event.stopPropagation();\n this.selectLink( suggestion );\n }\n break;\n }\n }\n }\n\n selectLink( suggestion ) {\n this.props.onChange( suggestion.url, suggestion );\n this.setState( {\n selectedSuggestion: null,\n showSuggestions: false,\n } );\n }\n\n handleOnClick( suggestion ) {\n this.selectLink( suggestion );\n // Move focus to the input field when a link suggestion is clicked.\n this.inputRef.current.focus();\n }\n\n render() {\n const { value = '', autoFocus = true, instanceId, className } = this.props;\n const { showSuggestions, suggestions, selectedSuggestion, loading } = this.state;\n\n const suggestionsListboxId = `block-editor-url-input-suggestions-${ instanceId }`;\n const suggestionOptionIdPrefix = `block-editor-url-input-suggestion-${ instanceId }`;\n\n /* eslint-disable jsx-a11y/no-autofocus */\n return (\n <div className={ classnames( 'editor-url-input block-editor-url-input', className ) }>\n <input\n autoFocus={ autoFocus }\n type=\"text\"\n aria-label={ __( 'URL' ) }\n required\n value={ value }\n onChange={ this.onChange }\n onInput={ stopEventPropagation }\n placeholder={ __( 'Paste or type to search for your Pretty Link' ) }\n onKeyDown={ this.onKeyDown }\n role=\"combobox\"\n aria-expanded={ showSuggestions }\n aria-autocomplete=\"list\"\n aria-owns={ suggestionsListboxId }\n aria-activedescendant={ selectedSuggestion !== null ? `${ suggestionOptionIdPrefix }-${ selectedSuggestion }` : undefined }\n ref={ this.inputRef }\n />\n\n { ( loading ) && <Spinner /> }\n\n { showSuggestions && !! suggestions.length &&\n <Popover position=\"bottom\" noArrow focusOnMount={ false }>\n <div\n className=\"editor-url-input__suggestions block-editor-url-input__suggestions\"\n id={ suggestionsListboxId }\n ref={ this.autocompleteRef }\n role=\"listbox\"\n >\n { suggestions.map( ( suggestion, index ) => (\n <button\n key={ suggestion.id }\n role=\"option\"\n tabIndex=\"-1\"\n id={ `${ suggestionOptionIdPrefix }-${ index }` }\n ref={ this.bindSuggestionNode( index ) }\n className={ classnames( 'editor-url-input__suggestion block-editor-url-input__suggestion', {\n 'is-selected': index === selectedSuggestion,\n } ) }\n onClick={ () => this.handleOnClick( suggestion ) }\n aria-selected={ index === selectedSuggestion }\n >\n { suggestion.title }\n </button>\n ) ) }\n </div>\n </Popover>\n }\n </div>\n );\n /* eslint-enable jsx-a11y/no-autofocus */\n }\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/url-input/README.md\n */\nexport default compose(\n withSafeTimeout,\n withSpokenMessages,\n withInstanceId,\n withSelect( ( select ) => {\n const { getSettings } = select( 'core/block-editor' );\n return {\n fetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions,\n };\n } )\n)( URLInput );\n","/**\n * WordPress dependencies\n */\nimport { __ } from \"@wordpress/i18n\";\nimport { withSpokenMessages } from \"@wordpress/components\";\nimport { Component, Fragment } from \"@wordpress/element\";\nimport {\n getTextContent,\n applyFormat,\n removeFormat,\n slice,\n registerFormatType\n} from \"@wordpress/rich-text\";\nimport { isURL, isEmail } from \"@wordpress/url\";\nimport {\n RichTextToolbarButton,\n RichTextShortcut\n} from \"@wordpress/block-editor\";\nimport InlineLinkUI from \"../../components/link-editor\";\n\n/**\n * Block constants\n */\nconst name = \"pretty-link/pretty-link\";\nconst title = __(\"Pretty Link\");\n\nexport const prettyLink = {\n name,\n title,\n tagName: \"a\",\n className: \"pretty-link\",\n attributes: {\n url: \"href\",\n target: \"target\"\n },\n edit: withSpokenMessages(\n class LinkEdit extends Component {\n constructor() {\n super(...arguments);\n\n this.addLink = this.addLink.bind(this);\n this.stopAddingLink = this.stopAddingLink.bind(this);\n this.onRemoveFormat = this.onRemoveFormat.bind(this);\n this.state = {\n addingLink: false\n };\n }\n\n addLink() {\n const { value, onChange } = this.props;\n const text = getTextContent(slice(value));\n\n if (text && isURL(text)) {\n onChange(\n applyFormat(value, { type: name, attributes: { url: text } })\n );\n } else {\n this.setState({ addingLink: true });\n }\n }\n\n stopAddingLink() {\n this.setState({ addingLink: false });\n }\n\n onRemoveFormat() {\n const { value, onChange, speak } = this.props;\n\n onChange(removeFormat(value, name));\n speak(__(\"Link removed.\"), \"assertive\");\n }\n\n render() {\n const { isActive, activeAttributes, value, onChange } = this.props;\n\n return (\n <>\n <RichTextShortcut\n type=\"primary\"\n character=\"p\"\n onUse={this.addLink}\n />\n <RichTextShortcut\n type=\"primaryShift\"\n character=\"p\"\n onUse={this.onRemoveFormat}\n />\n {isActive && (\n <RichTextToolbarButton\n icon=\"star-filled\"\n title={__(\"Unlink\")}\n onClick={this.onRemoveFormat}\n isActive={isActive}\n shortcutType=\"primaryShift\"\n shortcutCharacter=\"p\"\n />\n )}\n {!isActive && (\n <RichTextToolbarButton\n icon=\"star-filled\"\n title={title}\n onClick={this.addLink}\n isActive={isActive}\n shortcutType=\"primary\"\n shortcutCharacter=\"p\"\n />\n )}\n <InlineLinkUI\n addingLink={this.state.addingLink}\n stopAddingLink={this.stopAddingLink}\n isActive={isActive}\n activeAttributes={activeAttributes}\n value={value}\n onChange={onChange}\n />\n </>\n );\n }\n }\n )\n};\n\nfunction registerFormats() {\n [prettyLink].forEach(({ name, ...settings }) =>\n registerFormatType(name, settings)\n );\n}\nregisterFormats();\n","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","var objectWithoutPropertiesLoose = require(\"./objectWithoutPropertiesLoose\");\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutProperties;","function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","/*!\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","'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;","'use strict';\n\nmodule.exports = require('./dom-scroll-into-view');","'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);","module.exports = \".pretty-link-inserter .block-editor-url-popover__settings {\\n display: block; }\\n\\n.pretty-link-inserter .pretty-link-inserter-form-container {\\n margin-top: 30px; }\\n\"","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n\nvar stylesInDom = {};\n\nvar\tmemoize = function (fn) {\n\tvar memo;\n\n\treturn function () {\n\t\tif (typeof memo === \"undefined\") memo = fn.apply(this, arguments);\n\t\treturn memo;\n\t};\n};\n\nvar isOldIE = memoize(function () {\n\t// Test for IE <= 9 as proposed by Browserhacks\n\t// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n\t// Tests for existence of standard globals is to allow style-loader\n\t// to operate correctly into non-standard environments\n\t// @see https://github.com/webpack-contrib/style-loader/issues/177\n\treturn window && document && document.all && !window.atob;\n});\n\nvar getTarget = function (target, parent) {\n if (parent){\n return parent.querySelector(target);\n }\n return document.querySelector(target);\n};\n\nvar getElement = (function (fn) {\n\tvar memo = {};\n\n\treturn function(target, parent) {\n // If passing function in options, then use it for resolve \"head\" element.\n // Useful for Shadow Root style i.e\n // {\n // insertInto: function () { return document.querySelector(\"#foo\").shadowRoot }\n // }\n if (typeof target === 'function') {\n return target();\n }\n if (typeof memo[target] === \"undefined\") {\n\t\t\tvar styleTarget = getTarget.call(this, target, parent);\n\t\t\t// Special case to return head of iframe instead of iframe itself\n\t\t\tif (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n\t\t\t\ttry {\n\t\t\t\t\t// This will throw an exception if access to iframe is blocked\n\t\t\t\t\t// due to cross-origin restrictions\n\t\t\t\t\tstyleTarget = styleTarget.contentDocument.head;\n\t\t\t\t} catch(e) {\n\t\t\t\t\tstyleTarget = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmemo[target] = styleTarget;\n\t\t}\n\t\treturn memo[target]\n\t};\n})();\n\nvar singleton = null;\nvar\tsingletonCounter = 0;\nvar\tstylesInsertedAtTop = [];\n\nvar\tfixUrls = require(\"./urls\");\n\nmodule.exports = function(list, options) {\n\tif (typeof DEBUG !== \"undefined\" && DEBUG) {\n\t\tif (typeof document !== \"object\") throw new Error(\"The style-loader cannot be used in a non-browser environment\");\n\t}\n\n\toptions = options || {};\n\n\toptions.attrs = typeof options.attrs === \"object\" ? options.attrs : {};\n\n\t// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n\t// tags it will allow on a page\n\tif (!options.singleton && typeof options.singleton !== \"boolean\") options.singleton = isOldIE();\n\n\t// By default, add <style> tags to the <head> element\n if (!options.insertInto) options.insertInto = \"head\";\n\n\t// By default, add <style> tags to the bottom of the target\n\tif (!options.insertAt) options.insertAt = \"bottom\";\n\n\tvar styles = listToStyles(list, options);\n\n\taddStylesToDom(styles, options);\n\n\treturn function update (newList) {\n\t\tvar mayRemove = [];\n\n\t\tfor (var i = 0; i < styles.length; i++) {\n\t\t\tvar item = styles[i];\n\t\t\tvar domStyle = stylesInDom[item.id];\n\n\t\t\tdomStyle.refs--;\n\t\t\tmayRemove.push(domStyle);\n\t\t}\n\n\t\tif(newList) {\n\t\t\tvar newStyles = listToStyles(newList, options);\n\t\t\taddStylesToDom(newStyles, options);\n\t\t}\n\n\t\tfor (var i = 0; i < mayRemove.length; i++) {\n\t\t\tvar domStyle = mayRemove[i];\n\n\t\t\tif(domStyle.refs === 0) {\n\t\t\t\tfor (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();\n\n\t\t\t\tdelete stylesInDom[domStyle.id];\n\t\t\t}\n\t\t}\n\t};\n};\n\nfunction addStylesToDom (styles, options) {\n\tfor (var i = 0; i < styles.length; i++) {\n\t\tvar item = styles[i];\n\t\tvar domStyle = stylesInDom[item.id];\n\n\t\tif(domStyle) {\n\t\t\tdomStyle.refs++;\n\n\t\t\tfor(var j = 0; j < domStyle.parts.length; j++) {\n\t\t\t\tdomStyle.parts[j](item.parts[j]);\n\t\t\t}\n\n\t\t\tfor(; j < item.parts.length; j++) {\n\t\t\t\tdomStyle.parts.push(addStyle(item.parts[j], options));\n\t\t\t}\n\t\t} else {\n\t\t\tvar parts = [];\n\n\t\t\tfor(var j = 0; j < item.parts.length; j++) {\n\t\t\t\tparts.push(addStyle(item.parts[j], options));\n\t\t\t}\n\n\t\t\tstylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};\n\t\t}\n\t}\n}\n\nfunction listToStyles (list, options) {\n\tvar styles = [];\n\tvar newStyles = {};\n\n\tfor (var i = 0; i < list.length; i++) {\n\t\tvar item = list[i];\n\t\tvar id = options.base ? item[0] + options.base : item[0];\n\t\tvar css = item[1];\n\t\tvar media = item[2];\n\t\tvar sourceMap = item[3];\n\t\tvar part = {css: css, media: media, sourceMap: sourceMap};\n\n\t\tif(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});\n\t\telse newStyles[id].parts.push(part);\n\t}\n\n\treturn styles;\n}\n\nfunction insertStyleElement (options, style) {\n\tvar target = getElement(options.insertInto)\n\n\tif (!target) {\n\t\tthrow new Error(\"Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.\");\n\t}\n\n\tvar lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];\n\n\tif (options.insertAt === \"top\") {\n\t\tif (!lastStyleElementInsertedAtTop) {\n\t\t\ttarget.insertBefore(style, target.firstChild);\n\t\t} else if (lastStyleElementInsertedAtTop.nextSibling) {\n\t\t\ttarget.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);\n\t\t} else {\n\t\t\ttarget.appendChild(style);\n\t\t}\n\t\tstylesInsertedAtTop.push(style);\n\t} else if (options.insertAt === \"bottom\") {\n\t\ttarget.appendChild(style);\n\t} else if (typeof options.insertAt === \"object\" && options.insertAt.before) {\n\t\tvar nextSibling = getElement(options.insertAt.before, target);\n\t\ttarget.insertBefore(style, nextSibling);\n\t} else {\n\t\tthrow new Error(\"[Style Loader]\\n\\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\\n Must be 'top', 'bottom', or Object.\\n (https://github.com/webpack-contrib/style-loader#insertat)\\n\");\n\t}\n}\n\nfunction removeStyleElement (style) {\n\tif (style.parentNode === null) return false;\n\tstyle.parentNode.removeChild(style);\n\n\tvar idx = stylesInsertedAtTop.indexOf(style);\n\tif(idx >= 0) {\n\t\tstylesInsertedAtTop.splice(idx, 1);\n\t}\n}\n\nfunction createStyleElement (options) {\n\tvar style = document.createElement(\"style\");\n\n\tif(options.attrs.type === undefined) {\n\t\toptions.attrs.type = \"text/css\";\n\t}\n\n\tif(options.attrs.nonce === undefined) {\n\t\tvar nonce = getNonce();\n\t\tif (nonce) {\n\t\t\toptions.attrs.nonce = nonce;\n\t\t}\n\t}\n\n\taddAttrs(style, options.attrs);\n\tinsertStyleElement(options, style);\n\n\treturn style;\n}\n\nfunction createLinkElement (options) {\n\tvar link = document.createElement(\"link\");\n\n\tif(options.attrs.type === undefined) {\n\t\toptions.attrs.type = \"text/css\";\n\t}\n\toptions.attrs.rel = \"stylesheet\";\n\n\taddAttrs(link, options.attrs);\n\tinsertStyleElement(options, link);\n\n\treturn link;\n}\n\nfunction addAttrs (el, attrs) {\n\tObject.keys(attrs).forEach(function (key) {\n\t\tel.setAttribute(key, attrs[key]);\n\t});\n}\n\nfunction getNonce() {\n\tif (typeof __webpack_nonce__ === 'undefined') {\n\t\treturn null;\n\t}\n\n\treturn __webpack_nonce__;\n}\n\nfunction addStyle (obj, options) {\n\tvar style, update, remove, result;\n\n\t// If a transform function was defined, run it on the css\n\tif (options.transform && obj.css) {\n\t result = typeof options.transform === 'function'\n\t\t ? options.transform(obj.css) \n\t\t : options.transform.default(obj.css);\n\n\t if (result) {\n\t \t// If transform returns a value, use that instead of the original css.\n\t \t// This allows running runtime transformations on the css.\n\t \tobj.css = result;\n\t } else {\n\t \t// If the transform function returns a falsy value, don't add this css.\n\t \t// This allows conditional loading of css\n\t \treturn function() {\n\t \t\t// noop\n\t \t};\n\t }\n\t}\n\n\tif (options.singleton) {\n\t\tvar styleIndex = singletonCounter++;\n\n\t\tstyle = singleton || (singleton = createStyleElement(options));\n\n\t\tupdate = applyToSingletonTag.bind(null, style, styleIndex, false);\n\t\tremove = applyToSingletonTag.bind(null, style, styleIndex, true);\n\n\t} else if (\n\t\tobj.sourceMap &&\n\t\ttypeof URL === \"function\" &&\n\t\ttypeof URL.createObjectURL === \"function\" &&\n\t\ttypeof URL.revokeObjectURL === \"function\" &&\n\t\ttypeof Blob === \"function\" &&\n\t\ttypeof btoa === \"function\"\n\t) {\n\t\tstyle = createLinkElement(options);\n\t\tupdate = updateLink.bind(null, style, options);\n\t\tremove = function () {\n\t\t\tremoveStyleElement(style);\n\n\t\t\tif(style.href) URL.revokeObjectURL(style.href);\n\t\t};\n\t} else {\n\t\tstyle = createStyleElement(options);\n\t\tupdate = applyToTag.bind(null, style);\n\t\tremove = function () {\n\t\t\tremoveStyleElement(style);\n\t\t};\n\t}\n\n\tupdate(obj);\n\n\treturn function updateStyle (newObj) {\n\t\tif (newObj) {\n\t\t\tif (\n\t\t\t\tnewObj.css === obj.css &&\n\t\t\t\tnewObj.media === obj.media &&\n\t\t\t\tnewObj.sourceMap === obj.sourceMap\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tupdate(obj = newObj);\n\t\t} else {\n\t\t\tremove();\n\t\t}\n\t};\n}\n\nvar replaceText = (function () {\n\tvar textStore = [];\n\n\treturn function (index, replacement) {\n\t\ttextStore[index] = replacement;\n\n\t\treturn textStore.filter(Boolean).join('\\n');\n\t};\n})();\n\nfunction applyToSingletonTag (style, index, remove, obj) {\n\tvar css = remove ? \"\" : obj.css;\n\n\tif (style.styleSheet) {\n\t\tstyle.styleSheet.cssText = replaceText(index, css);\n\t} else {\n\t\tvar cssNode = document.createTextNode(css);\n\t\tvar childNodes = style.childNodes;\n\n\t\tif (childNodes[index]) style.removeChild(childNodes[index]);\n\n\t\tif (childNodes.length) {\n\t\t\tstyle.insertBefore(cssNode, childNodes[index]);\n\t\t} else {\n\t\t\tstyle.appendChild(cssNode);\n\t\t}\n\t}\n}\n\nfunction applyToTag (style, obj) {\n\tvar css = obj.css;\n\tvar media = obj.media;\n\n\tif(media) {\n\t\tstyle.setAttribute(\"media\", media)\n\t}\n\n\tif(style.styleSheet) {\n\t\tstyle.styleSheet.cssText = css;\n\t} else {\n\t\twhile(style.firstChild) {\n\t\t\tstyle.removeChild(style.firstChild);\n\t\t}\n\n\t\tstyle.appendChild(document.createTextNode(css));\n\t}\n}\n\nfunction updateLink (link, options, obj) {\n\tvar css = obj.css;\n\tvar sourceMap = obj.sourceMap;\n\n\t/*\n\t\tIf convertToAbsoluteUrls isn't defined, but sourcemaps are enabled\n\t\tand there is no publicPath defined then lets turn convertToAbsoluteUrls\n\t\ton by default. Otherwise default to the convertToAbsoluteUrls option\n\t\tdirectly\n\t*/\n\tvar autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;\n\n\tif (options.convertToAbsoluteUrls || autoFixUrls) {\n\t\tcss = fixUrls(css);\n\t}\n\n\tif (sourceMap) {\n\t\t// http://stackoverflow.com/a/26603875\n\t\tcss += \"\\n/*# sourceMappingURL=data:application/json;base64,\" + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + \" */\";\n\t}\n\n\tvar blob = new Blob([css], { type: \"text/css\" });\n\n\tvar oldSrc = link.href;\n\n\tlink.href = URL.createObjectURL(blob);\n\n\tif(oldSrc) URL.revokeObjectURL(oldSrc);\n}\n","\n/**\n * When source maps are enabled, `style-loader` uses a link element with a data-uri to\n * embed the css on the page. This breaks all relative urls because now they are relative to a\n * bundle instead of the current page.\n *\n * One solution is to only use full urls, but that may be impossible.\n *\n * Instead, this function \"fixes\" the relative urls to be absolute according to the current page location.\n *\n * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.\n *\n */\n\nmodule.exports = function (css) {\n // get current location\n var location = typeof window !== \"undefined\" && window.location;\n\n if (!location) {\n throw new Error(\"fixUrls requires window.location\");\n }\n\n\t// blank or null?\n\tif (!css || typeof css !== \"string\") {\n\t return css;\n }\n\n var baseUrl = location.protocol + \"//\" + location.host;\n var currentDir = baseUrl + location.pathname.replace(/\\/[^\\/]*$/, \"/\");\n\n\t// convert each url(...)\n\t/*\n\tThis regular expression is just a way to recursively match brackets within\n\ta string.\n\n\t /url\\s*\\( = Match on the word \"url\" with any whitespace after it and then a parens\n\t ( = Start a capturing group\n\t (?: = Start a non-capturing group\n\t [^)(] = Match anything that isn't a parentheses\n\t | = OR\n\t \\( = Match a start parentheses\n\t (?: = Start another non-capturing groups\n\t [^)(]+ = Match anything that isn't a parentheses\n\t | = OR\n\t \\( = Match a start parentheses\n\t [^)(]* = Match anything that isn't a parentheses\n\t \\) = Match a end parentheses\n\t ) = End Group\n *\\) = Match anything and then a close parens\n ) = Close non-capturing group\n * = Match anything\n ) = Close capturing group\n\t \\) = Match a close parens\n\n\t /gi = Get all matches, not the first. Be case insensitive.\n\t */\n\tvar fixedCss = css.replace(/url\\s*\\(((?:[^)(]|\\((?:[^)(]+|\\([^)(]*\\))*\\))*)\\)/gi, function(fullMatch, origUrl) {\n\t\t// strip quotes (if they exist)\n\t\tvar unquotedOrigUrl = origUrl\n\t\t\t.trim()\n\t\t\t.replace(/^\"(.*)\"$/, function(o, $1){ return $1; })\n\t\t\t.replace(/^'(.*)'$/, function(o, $1){ return $1; });\n\n\t\t// already a full url? no change\n\t\tif (/^(#|data:|http:\\/\\/|https:\\/\\/|file:\\/\\/\\/|\\s*$)/i.test(unquotedOrigUrl)) {\n\t\t return fullMatch;\n\t\t}\n\n\t\t// convert the url to a full url\n\t\tvar newUrl;\n\n\t\tif (unquotedOrigUrl.indexOf(\"//\") === 0) {\n\t\t \t//TODO: should we add protocol?\n\t\t\tnewUrl = unquotedOrigUrl;\n\t\t} else if (unquotedOrigUrl.indexOf(\"/\") === 0) {\n\t\t\t// path should be relative to the base url\n\t\t\tnewUrl = baseUrl + unquotedOrigUrl; // already starts with '/'\n\t\t} else {\n\t\t\t// path should be relative to current directory\n\t\t\tnewUrl = currentDir + unquotedOrigUrl.replace(/^\\.\\//, \"\"); // Strip leading './'\n\t\t}\n\n\t\t// send back the fixed url(...)\n\t\treturn \"url(\" + JSON.stringify(newUrl) + \")\";\n\t});\n\n\t// send back the fixed css\n\treturn fixedCss;\n};\n","(function() { module.exports = this[\"regeneratorRuntime\"]; }());","(function() { module.exports = this[\"wp\"][\"apiFetch\"]; }());","(function() { module.exports = this[\"wp\"][\"blockEditor\"]; }());","(function() { module.exports = this[\"wp\"][\"components\"]; }());","(function() { module.exports = this[\"wp\"][\"compose\"]; }());","(function() { module.exports = this[\"wp\"][\"data\"]; }());","(function() { module.exports = this[\"wp\"][\"dom\"]; }());","(function() { module.exports = this[\"wp\"][\"element\"]; }());","(function() { module.exports = this[\"wp\"][\"htmlEntities\"]; }());","(function() { module.exports = this[\"wp\"][\"i18n\"]; }());","(function() { module.exports = this[\"wp\"][\"keycodes\"]; }());","(function() { module.exports = this[\"wp\"][\"richText\"]; }());","(function() { module.exports = this[\"wp\"][\"url\"]; }());","(function() { module.exports = this[\"lodash\"]; }());"],"sourceRoot":""}
|
js/editor/components/link-editor/index.js
CHANGED
@@ -163,12 +163,14 @@ class InlineLinkUI extends Component {
|
|
163 |
this.submitLink = this.submitLink.bind( this );
|
164 |
this.onKeyDown = this.onKeyDown.bind( this );
|
165 |
this.onChangeInputValue = this.onChangeInputValue.bind( this );
|
|
|
166 |
this.setLinkTarget = this.setLinkTarget.bind( this );
|
167 |
this.onClickOutside = this.onClickOutside.bind( this );
|
168 |
this.resetState = this.resetState.bind( this );
|
169 |
this.autocompleteRef = createRef();
|
170 |
|
171 |
this.state = {
|
|
|
172 |
opensInNewWindow: false,
|
173 |
inputValue: '',
|
174 |
newLinkUrl: '',
|
@@ -224,6 +226,24 @@ class InlineLinkUI extends Component {
|
|
224 |
}
|
225 |
}
|
226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
editLink( event ) {
|
228 |
this.setState( { editLink: true } );
|
229 |
event.preventDefault();
|
@@ -231,13 +251,14 @@ class InlineLinkUI extends Component {
|
|
231 |
|
232 |
submitLink( event ) {
|
233 |
const { isActive, value, onChange, speak } = this.props;
|
234 |
-
const { inputValue, opensInNewWindow } = this.state;
|
235 |
const url = prependHTTP( inputValue );
|
236 |
const selectedText = getTextContent( slice( value ) );
|
237 |
const format = createLinkFormat( {
|
238 |
url,
|
239 |
opensInNewWindow,
|
240 |
text: selectedText,
|
|
|
241 |
} );
|
242 |
|
243 |
event.preventDefault();
|
@@ -285,7 +306,7 @@ class InlineLinkUI extends Component {
|
|
285 |
return null;
|
286 |
}
|
287 |
|
288 |
-
const { inputValue, opensInNewWindow, newLinkUrl, newLinkSlug, creatingLink, createdLink, createdLinkError } = this.state;
|
289 |
const showInput = isShowingInput( this.props, this.state );
|
290 |
|
291 |
return (
|
@@ -305,6 +326,11 @@ class InlineLinkUI extends Component {
|
|
305 |
checked={ opensInNewWindow }
|
306 |
onChange={ this.setLinkTarget }
|
307 |
/>
|
|
|
|
|
|
|
|
|
|
|
308 |
</div>
|
309 |
<div className="pretty-link-inserter-form-container">
|
310 |
{
|
163 |
this.submitLink = this.submitLink.bind( this );
|
164 |
this.onKeyDown = this.onKeyDown.bind( this );
|
165 |
this.onChangeInputValue = this.onChangeInputValue.bind( this );
|
166 |
+
this.setNoFollow = this.setNoFollow.bind( this );
|
167 |
this.setLinkTarget = this.setLinkTarget.bind( this );
|
168 |
this.onClickOutside = this.onClickOutside.bind( this );
|
169 |
this.resetState = this.resetState.bind( this );
|
170 |
this.autocompleteRef = createRef();
|
171 |
|
172 |
this.state = {
|
173 |
+
noFollow: false,
|
174 |
opensInNewWindow: false,
|
175 |
inputValue: '',
|
176 |
newLinkUrl: '',
|
226 |
}
|
227 |
}
|
228 |
|
229 |
+
setNoFollow( noFollow ) {
|
230 |
+
const { activeAttributes: { url = '' }, value, onChange } = this.props;
|
231 |
+
|
232 |
+
this.setState( { noFollow } );
|
233 |
+
|
234 |
+
// Apply now if URL is not being edited.
|
235 |
+
if ( ! isShowingInput( this.props, this.state ) ) {
|
236 |
+
const selectedText = getTextContent( slice( value ) );
|
237 |
+
|
238 |
+
onChange( applyFormat( value, createLinkFormat( {
|
239 |
+
url,
|
240 |
+
opensInNewWindow,
|
241 |
+
text: selectedText,
|
242 |
+
noFollow
|
243 |
+
} ) ) );
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
editLink( event ) {
|
248 |
this.setState( { editLink: true } );
|
249 |
event.preventDefault();
|
251 |
|
252 |
submitLink( event ) {
|
253 |
const { isActive, value, onChange, speak } = this.props;
|
254 |
+
const { inputValue, opensInNewWindow, noFollow } = this.state;
|
255 |
const url = prependHTTP( inputValue );
|
256 |
const selectedText = getTextContent( slice( value ) );
|
257 |
const format = createLinkFormat( {
|
258 |
url,
|
259 |
opensInNewWindow,
|
260 |
text: selectedText,
|
261 |
+
noFollow
|
262 |
} );
|
263 |
|
264 |
event.preventDefault();
|
306 |
return null;
|
307 |
}
|
308 |
|
309 |
+
const { inputValue, noFollow, opensInNewWindow, newLinkUrl, newLinkSlug, creatingLink, createdLink, createdLinkError } = this.state;
|
310 |
const showInput = isShowingInput( this.props, this.state );
|
311 |
|
312 |
return (
|
326 |
checked={ opensInNewWindow }
|
327 |
onChange={ this.setLinkTarget }
|
328 |
/>
|
329 |
+
<ToggleControl
|
330 |
+
label={ __( 'Nofollow' ) }
|
331 |
+
checked={ noFollow }
|
332 |
+
onChange={ this.setNoFollow }
|
333 |
+
/>
|
334 |
</div>
|
335 |
<div className="pretty-link-inserter-form-container">
|
336 |
{
|
js/editor/components/link-editor/utils.js
CHANGED
@@ -89,7 +89,7 @@ export function isValidHref( href ) {
|
|
89 |
*
|
90 |
* @return {Object} The final format object.
|
91 |
*/
|
92 |
-
export function createLinkFormat( { url, opensInNewWindow, text } ) {
|
93 |
const format = {
|
94 |
type: 'core/link',
|
95 |
attributes: {
|
@@ -97,14 +97,25 @@ export function createLinkFormat( { url, opensInNewWindow, text } ) {
|
|
97 |
},
|
98 |
};
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
if ( opensInNewWindow ) {
|
101 |
// translators: accessibility label for external links, where the argument is the link text
|
102 |
const label = sprintf( __( '%s (opens in a new tab)' ), text );
|
103 |
|
104 |
format.attributes.target = '_blank';
|
105 |
-
format.attributes.rel
|
|
|
106 |
format.attributes[ 'aria-label' ] = label;
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
109 |
return format;
|
110 |
}
|
89 |
*
|
90 |
* @return {Object} The final format object.
|
91 |
*/
|
92 |
+
export function createLinkFormat( { url, opensInNewWindow, text, noFollow } ) {
|
93 |
const format = {
|
94 |
type: 'core/link',
|
95 |
attributes: {
|
97 |
},
|
98 |
};
|
99 |
|
100 |
+
format.attributes.rel = '';
|
101 |
+
|
102 |
+
if ( noFollow ) {
|
103 |
+
format.attributes.rel += 'nofollow ';
|
104 |
+
}
|
105 |
+
|
106 |
if ( opensInNewWindow ) {
|
107 |
// translators: accessibility label for external links, where the argument is the link text
|
108 |
const label = sprintf( __( '%s (opens in a new tab)' ), text );
|
109 |
|
110 |
format.attributes.target = '_blank';
|
111 |
+
format.attributes.rel += 'noreferrer noopener';
|
112 |
+
|
113 |
format.attributes[ 'aria-label' ] = label;
|
114 |
}
|
115 |
|
116 |
+
if ( '' === format.attributes.rel ) {
|
117 |
+
delete format.attributes.rel;
|
118 |
+
}
|
119 |
+
|
120 |
return format;
|
121 |
}
|
pretty-link.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Pretty Links
|
4 |
Plugin URI: https://prettylinks.com/pl/plugin-uri
|
5 |
Description: Shrink, track and share any URL on the Internet from your WordPress website!
|
6 |
-
Version: 3.0.
|
7 |
Author: Blair Williams
|
8 |
Author URI: http://blairwilliams.com
|
9 |
Text Domain: pretty-link
|
3 |
Plugin Name: Pretty Links
|
4 |
Plugin URI: https://prettylinks.com/pl/plugin-uri
|
5 |
Description: Shrink, track and share any URL on the Internet from your WordPress website!
|
6 |
+
Version: 3.0.10
|
7 |
Author: Blair Williams
|
8 |
Author URI: http://blairwilliams.com
|
9 |
Text Domain: pretty-link
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://prettylinks.com
|
|
4 |
Tags: links, link, url, urls, affiliate, affiliates, pretty, marketing, redirect, redirection, forward, plugin, twitter, tweet, rewrite, shorturl, hoplink, hop, shortlink, short, shorten, shortening, click, clicks, track, tracking, tiny, tinyurl, budurl, shrinking, domain, shrink, mask, masking, cloak, cloaking, slug, slugs, admin, administration, stats, statistics, stat, statistic, email, ajax, javascript, ui, csv, download, page, post, pages, posts, shortcode, seo, automation, widget, widgets, dashboard
|
5 |
Requires at least: 5.1
|
6 |
Tested up to: 5.2.2
|
7 |
-
Stable tag: 3.0.
|
8 |
|
9 |
Shrink, beautify, track, manage and share any URL on or off of your WordPress website. Create links that look how you want using your own domain name!
|
10 |
|
@@ -64,6 +64,13 @@ http://blairwilliams.com/w7a
|
|
64 |
3. Make sure you have changed your permalink Common Settings in Settings -> Permalinks away from "Default" to something else. I prefer using custom and then "/%year%/%month%/%postname%/" for the simplest possible URL slugs with the best performance.
|
65 |
|
66 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
= 3.0.9 =
|
68 |
* Change shortcut key to CTRL + P instead of CTRL + K
|
69 |
* Support for Nofollow and Tracking Quick Edit and Bulk Edit on the links list page
|
4 |
Tags: links, link, url, urls, affiliate, affiliates, pretty, marketing, redirect, redirection, forward, plugin, twitter, tweet, rewrite, shorturl, hoplink, hop, shortlink, short, shorten, shortening, click, clicks, track, tracking, tiny, tinyurl, budurl, shrinking, domain, shrink, mask, masking, cloak, cloaking, slug, slugs, admin, administration, stats, statistics, stat, statistic, email, ajax, javascript, ui, csv, download, page, post, pages, posts, shortcode, seo, automation, widget, widgets, dashboard
|
5 |
Requires at least: 5.1
|
6 |
Tested up to: 5.2.2
|
7 |
+
Stable tag: 3.0.10
|
8 |
|
9 |
Shrink, beautify, track, manage and share any URL on or off of your WordPress website. Create links that look how you want using your own domain name!
|
10 |
|
64 |
3. Make sure you have changed your permalink Common Settings in Settings -> Permalinks away from "Default" to something else. I prefer using custom and then "/%year%/%month%/%postname%/" for the simplest possible URL slugs with the best performance.
|
65 |
|
66 |
== Changelog ==
|
67 |
+
= 3.0.10 =
|
68 |
+
* Add support for nofollow in Gutenberg popup
|
69 |
+
* Fix post_author being set to 0 on CPT
|
70 |
+
* Fix for duplicate links being created
|
71 |
+
* Fix clicks ordering on links list
|
72 |
+
* Fix Redirection dropdown display WP 3.5
|
73 |
+
|
74 |
= 3.0.9 =
|
75 |
* Change shortcut key to CTRL + P instead of CTRL + K
|
76 |
* Support for Nofollow and Tracking Quick Edit and Bulk Edit on the links list page
|