<div class="container-home">
	<div class="pt_page_headr">
		<h4 class="page_head"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" fill="currentColor" d="M12.75 3.00008C12.75 2.58586 12.4142 2.25008 12 2.25008C11.5858 2.25008 11.25 2.58586 11.25 3.00008V15.1894L8.53033 12.4697C8.23744 12.1769 7.76256 12.1769 7.46967 12.4697C7.17678 12.7626 7.17678 13.2375 7.46967 13.5304L11.4697 17.5304C11.6103 17.6711 11.8011 17.7501 12 17.7501C12.1989 17.7501 12.3897 17.6711 12.5303 17.5304L16.5303 13.5304C16.8232 13.2375 16.8232 12.7626 16.5303 12.4697C16.2374 12.1769 15.7626 12.1769 15.4697 12.4697L12.75 15.1894V3.00008ZM7.5 8.25H7.45481C6.32039 8.24999 5.4057 8.24998 4.67621 8.33222C3.92193 8.41726 3.27341 8.59809 2.71713 9.02494C2.45714 9.22444 2.22443 9.45716 2.02493 9.71714C1.59808 10.2734 1.41725 10.922 1.33221 11.6762C1.24997 12.4057 1.24999 13.3204 1.25 14.4548V14.5V15V15.0549C1.24998 16.4225 1.24996 17.5248 1.36652 18.3918C1.48754 19.2919 1.74643 20.0497 2.34835 20.6517C2.95027 21.2536 3.70814 21.5125 4.60825 21.6335C5.4752 21.75 6.57751 21.75 7.94507 21.75H8H16H16.0548C17.4224 21.75 18.5248 21.7501 19.3918 21.6335C20.2919 21.5125 21.0497 21.2536 21.6516 20.6517C22.2536 20.0497 22.5125 19.2919 22.6335 18.3918C22.75 17.5248 22.75 16.4225 22.75 15.0549V15V14.5V14.4548C22.75 13.3204 22.75 12.4057 22.6678 11.6762C22.5828 10.922 22.4019 10.2734 21.9751 9.71714C21.7756 9.45716 21.5429 9.22444 21.2829 9.02495C20.7266 8.59809 20.0781 8.41726 19.3238 8.33222C18.5943 8.24998 17.6796 8.24999 16.5452 8.25H16.5452H16.5L16.5 9L16.5 8.25L16 8.25002C15.5858 8.25003 15.25 8.58582 15.25 9.00004C15.25 9.41425 15.5858 9.75003 16 9.75002L16.5 9.75H16.5C17.6902 9.75 18.5201 9.75112 19.1558 9.82278C19.7763 9.89274 20.1181 10.0219 20.3697 10.215C20.5257 10.3347 20.6653 10.4743 20.785 10.6303C20.9781 10.8819 21.1073 11.2238 21.1772 11.8443C21.2489 12.4799 21.25 13.3098 21.25 14.5V15C21.25 16.4354 21.2484 17.4365 21.1469 18.1919C21.0482 18.9257 20.8678 19.3142 20.591 19.591C20.3142 19.8678 19.9257 20.0482 19.1919 20.1469C18.4365 20.2484 17.4354 20.25 16 20.25H8C6.56458 20.25 5.56347 20.2484 4.80812 20.1469C4.07435 20.0482 3.68577 19.8678 3.40901 19.591C3.13225 19.3142 2.9518 18.9257 2.85315 18.1919C2.75159 17.4365 2.75 16.4354 2.75 15V14.5C2.75 13.3098 2.75112 12.4799 2.82277 11.8443C2.89273 11.2238 3.02187 10.8819 3.21496 10.6303C3.33466 10.4743 3.47429 10.3347 3.63028 10.215C3.88192 10.0219 4.22375 9.89273 4.84425 9.82278C5.47986 9.75112 6.30976 9.75 7.49998 9.75H7.5L7.99998 9.75002C8.41419 9.75003 8.74999 9.41425 8.75 9.00004C8.75001 8.58582 8.41424 8.25003 8.00002 8.25002L7.50002 8.25L7.5 9L7.5 8.25Z"></path></svg> {{LANG import_new_video}}</h4>
		<small>{{LANG import_subhead}}</small>
	</div>
	<div class="pt_import_vdo">
		<div class="content pt_shadow">
			<div id="fetch-form">
				<form action="" class="form-horizontal" method="POST">
					<div class="imp_hdr_ico">
						<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 479.992 479.992" fill="currentColor"> <g> <g> <path d="M377.052,114.712L250.556,3.96c-6.048-5.28-15.04-5.28-21.088,0L102.94,114.712c-6.656,5.824-7.328,15.968-1.472,22.624 l21.088,23.968c5.856,6.624,15.936,7.264,22.56,1.472l62.88-55.104v228.32c0,8.832,7.168,16,16,16h32c8.832,0,16-7.168,16-16 v-228.32l62.88,55.104c6.656,5.792,16.736,5.152,22.56-1.472l21.088-24C384.38,130.68,383.708,120.536,377.052,114.712z"/> </g> </g> <g> <g> <path d="M415.996,415.992h-352c-8.832,0-16,7.168-16,16v32c0,8.832,7.168,16,16,16h352c8.832,0,16-7.168,16-16v-32 C431.996,423.16,424.828,415.992,415.996,415.992z"/> </g> </g></svg>
						<div><h2>{{LANG use_url_import}}</h2><p>{{LANG videos_will_private}}</p></div>
					</div>
					<div class="row">
						<div class="col-md-9">
							<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="feather feather-link"><path fill="currentColor" d="M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z"></path></svg>
							<input id="url" name="url" type="text" placeholder="{{LANG video_url}}" class="form-control input-md" autofocus> 
							<span class="help-block">{{LANG url_desc}}, <?php echo ($pt->config->facebook_import == 'on') ? 'Facebook, ': '';?>mp4<?php echo ($pt->config->ok_import == 'on') ? ',ok.ru': '';?></span>
						</div>
						<div class="col-md-3">
							<button type="button" class="btn btn-main fetch-url">{{LANG fetch_Video}}</button>
						</div>
					</div>
					<div class="clear"></div>
				</form>
			</div>
		</div>
		<div class="import-form-content hidden">
			<div class="content pt_shadow">
				<div class="row pt_upload_vdo_row">
					<div class="col-md-7" id="import-form">
						<form action="" class="form-horizontal pt_forms" method="POST" id="submit-imported-video">
							<div class="pp_mat_input">
								<input id="title" name="title" type="text" placeholder=" ">
								<label for="title">{{LANG video_title}}</label>
								<span class="help-block">{{LANG video_title_help}}</span>
							</div>
							<div class="pp_mat_input">
								<textarea name="description" id="description" cols="30" rows="8" class="description"></textarea>
								<label for="description">{{LANG video_descritpion}}</label>
							</div>
							<div class="pp_mat_input">
								<select class="selectpicker show-menu-arrow" name="category_id" id="category_id">
									<option value="" disabled>{{LANG category}}</option>
									<?php foreach($pt->categories as $key => $category) {?>
										<option value="<?php echo $key?>"><?php echo $category?></option>
									<?php } ?>
								</select>
							</div>
							<div class="pp_mat_input">
								<select class="selectpicker show-menu-arrow" name="sub_category_id" id="sub_category_id">
									<option value="" disabled>{{LANG sub_category}}</option>
									<?php echo $pt->sub_categories_array["'1'"]; ?>
								</select>
							</div>
							<?php if ($pt->config->geo_blocking == 'on') { ?>
								<div class="pp_mat_input" id="geo_blocking">
									<select class="selectpicker show-menu-arrow show-tick" multiple name="continents-list[]" data-live-search="true" title="{{LANG geo_blocking}}" data-actions-box="true">
										<?php foreach ($pt->continents as $key => $name): ?>
											<option value="<?php echo($name); ?>"><?php echo($name); ?></option>
										<?php endforeach; ?>
									</select>
								</div>
							<?php } ?>
							<div class="pp_mat_input">
								<input id="mySingleFieldTags" name="tags" type="text" placeholder=" ">
								<label for="tags">{{LANG tags}}</label>
								<span class="help-block">{{LANG tags_help}}</span>
							</div>
							<div class="pp_mat_input hidden" id="duration_format">
								<input id="duration" name="duration" type="text" placeholder=" " class="duration">
								<label for="duration">{{LANG duration}}</label>
								<span class="help-block">EX : 03:30</span>
							</div>
							<div class="row">
								<div class="col-md-6">
									<div class="form-group">
										<label>{{LANG privacy}}</label>
										<div class="pt_vdo_cstm_radio">
											<input type="radio" id="privacy0" name="privacy" value="0" checked>
											<label for="privacy0">{{LANG public}}</label>
										</div>
										<div class="pt_vdo_cstm_radio">
											<input type="radio" id="privacy1" name="privacy" value="1">
											<label for="privacy1">{{LANG private}}</label>
										</div>
										<div class="pt_vdo_cstm_radio">
											<input type="radio" id="privacy2" name="privacy" value="2">
											<label for="privacy2">{{LANG unlisted}}</label>
										</div>
									</div>
								</div>
								<div class="col-md-6">
									<div class="form-group">
										<label>{{LANG age_restriction}}</label>
										<div class="pt_vdo_cstm_radio">
											<input type="radio" id="age_restriction0" name="age_restriction" value="1" checked>
											<label for="age_restriction0">{{LANG all_ages}}</label>
										</div>
										<div class="pt_vdo_cstm_radio">
											<input type="radio" id="age_restriction1" name="age_restriction" value="2">
											<label for="age_restriction1">{{LANG only_18}}</label>
										</div>
									</div>
								</div>
							</div>
							<?php if ((($pt->config->usr_v_mon == 'on' && $pt->config->user_mon_approve == 'off') || ($pt->config->usr_v_mon == 'on' && $pt->config->user_mon_approve == 'on' && $pt->user->monetization == '1')) && $pt->user->video_mon == '1') { ?>
								<div class="form-group">
									<label>{{LANG monetization}}</label>
									<div class="pt_vdo_cstm_radio">
										<input type="radio" id="monetization1" name="monetization" value="1" checked>
										<label for="monetization1">{{LANG enable}}</label>
									</div>
									<div class="pt_vdo_cstm_radio">
										<input type="radio" id="monetization0" name="monetization" value="0">
										<label for="monetization0">{{LANG disable}}</label>
									</div>
								</div>
							<?php } ?>
							<input type="hidden" name="thumbnail-image" class="thumbnail">
							<input type="hidden" name="video-type" class="type">
							<input type="hidden" name="video-id" class="video-id">
							<input type="hidden" name="twitch_type" class="twitch_type">
							<!-- <input type="hidden" name="duration" class="duration"> -->
							<input id="thumbnail" name="thumbnail" type="file" accept="image/*" class="hidden">
							<div class="text-center">
								<button type="submit" class="btn btn-main submit-url setting-panel-mdbtn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg> {{LANG publish}}</button>
							</div>
							<div class="clear"></div>
						</form>
					</div>
					<div class="col-md-5">
						<div class="thumbnail-preview edit-thumb thumbnail-preview-renderer">
							<img src="" alt="Picture">
						</div>
						<div class="video-title">
							<p></p>
						</div>
						<div class="video-description">
							<p></p>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="clear"></div>
</div>

<script>
	var el = $(".description").emojioneArea({
      pickerPosition: "bottom",
       tonesStyle: "radio",
       events: {
         keyup: function (editor, event) {
          }
       },
       filters: {
           flags : false,
           objects : false,
           travel_places : false,
           activity : false
       }
   });
$('.selectpicker').selectpicker({});
<?php 
$js_array = json_encode($pt->sub_categories_array);
echo "var sub_categories_array = ". $js_array . ";\n";
?>
$(document).on('change', '#category_id', function(event) {
   event.preventDefault();
   id = $(this).val();
   if (typeof(sub_categories_array["'"+id+"'"]) == 'undefined') {
   	$('#sub_category_div').hide();
    $('#sub_category_id').html('');
   }
   else{
   	$('#sub_category_div').show();
    $('#sub_category_id').html(sub_categories_array["'"+id+"'"]);
  }
  $('.selectpicker').selectpicker('refresh');
});


$(function () {
   $('.edit-thumb').on('click', function(event) {
      $('#thumbnail').trigger('click');
   });

   $('#thumbnail').on('change', function(event) {
      readURL(this);
   });

   $('#submit-imported-video').ajaxForm({
       url: '{{LINK aj/submit-imported-video}}?hash=' + $('.main_session').val(),
       beforeSend: function() {
         $('.submit-url').attr('disabled', true);
         $('.submit-url').text("{{LANG please_wait}}");
       },
       success: function(data) {
         if (data.status == 200) {
            window.location.href = data.link;
         } 
         else {
            $('.submit-url').attr('disabled', false);
             $('.submit-url').html('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg> {{LANG publish}}');
			Snackbar.show({text: '<div>'+ data.message +'</div>'});
         }
       }
   });
   $('#description').keyup(function(event) {
      str = $(this).val().replace(/(?:\r\n|\r|\n)/g, '<br />');
      $('.video-description p').html(str);
   });
   $('#title').keyup(function(event) {
      $('.video-title p').html($(this).val());
   });
   $('#mySingleFieldTags').tagit({
      allowSpaces: true
   });
	$('.fetch-url').on('click', function () {
		$(this).text("{{LANG please_wait}}");
		$.post('{{CONFIG site_url}}/aj/fetch-video', {link: $('#url').val()}, function(data, textStatus, xhr) {
			$('.fetch-url').text('{{LANG fetch_Video}}');
			if (data.status == 200) {
            if ($("#mySingleFieldTags").val()) {
               $(".tagit-choice").remove();
            }
            $('.alert-danger').empty();
				$('#title').val(data.title);
            $('.video-title p').html(data.title);
            $('#description').val(data.description);
            $('.emojionearea-editor').html(data.description);
            $('.video-description p').html(data.description_br);
            $('#mySingleFieldTags').val(data.tags);
            $('.duration').val(data.duration);
            if (data.type == 'mp4') {
              $('#duration_format').removeClass('hidden');
            }
            else{
              $('#duration_format').addClass('hidden');
            }
            var partsOfStr = data.tags.split(',');
            for (i = 0; i < partsOfStr.length; i++) {
               $('#mySingleFieldTags').tagit("createTag", partsOfStr[i]);
            }
            $('.thumbnail').val(data.thumbnail);
            
            $('.thumbnail-preview img').attr('src', data.full_thumb);
            $('.video-id').val(data.video_id);
            $('.twitch_type').val(data.twitch_type);
            $('.type').val(data.type);
            $('.import-form-content').removeClass('hidden');
			} 

         else if(data.status == 401){
            swal({
               title: '{{LANG oops}}!',
               text: "{{LANG import_limit_reached}}!",
               type: 'info',
               showCancelButton: true,
               confirmButtonColor: '#3085d6',
               cancelButtonColor: '#d33',
               confirmButtonText: '{{LANG upgrade_now}}',
               cancelButtonText: '{{LANG cancel}}',
               confirmButtonClass: 'btn btn-success margin-right',
               cancelButtonClass: 'btn',
               buttonsStyling: false
            }).then(function(){
               window.location.href = '{{LINK go_pro}}';
            },
            function() {
               window.location.href = '{{LINK }}';
            });
            
         }
         else {
				Snackbar.show({text: '<div>'+ data.message +'</div>'});
			}
		},dataType = 'json');
	});
});
</script>