From c97686680ca4e8e214d9123e748de528d87679c1 Mon Sep 17 00:00:00 2001 From: Ashima-Arora <117061227+Ashima-Arora@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:07:36 +0530 Subject: [PATCH 1/8] initial code changes for dt-componenets integration in new contact form --- dt-assets/js/new-record.js | 42 ++++++++++++-------- dt-core/global-functions.php | 77 +++++------------------------------- template-new-post.php | 4 +- 3 files changed, 36 insertions(+), 87 deletions(-) diff --git a/dt-assets/js/new-record.js b/dt-assets/js/new-record.js index df6b5956ea..401d2f5333 100644 --- a/dt-assets/js/new-record.js +++ b/dt-assets/js/new-record.js @@ -91,21 +91,23 @@ jQuery(function($) { }) /* breadcrumb: new-field-type Add the new link type data to the new_post array */ - $(".js-create-post").on("submit", function() { + $(".js-create-post").on("submit", function(e) { $(".js-create-post-button") .attr("disabled", true) .addClass("loading"); - new_post.title = $(".js-create-post input[name=title]").val() - $('.select-field').each((index, entry)=>{ - if ( $(entry).val() ){ - new_post[$(entry).attr('id')] = $(entry).val() - } + e.preventDefault(); + new_post.title = $(".js-create-post [name= name]").val() + + $('dt-single-select').each((entry) => { + new_post[$(entry).attr('id')] = $(entry).attr('value') }) - $('.text-input').each((index, entry)=>{ + + $('dt-text').each((entry)=>{ if ( $(entry).val() ){ new_post[$(entry).attr('id')] = $(entry).val() } }) + $('.link-input').each((index, entry) => { let fieldKey = $(entry).data('field-key') let type = $(entry).data('type') @@ -119,23 +121,28 @@ jQuery(function($) { } ) } }) + $('.dt_textarea').each((index, entry)=>{ if ( $(entry).val() ){ new_post[$(entry).attr('id')] = $(entry).val() } }); - $('.dt-communication-channel').each((index, entry)=>{ - let val = $(entry).val() - if ( val.length > 0 ){ - let channel = $(entry).data('field') - if ( !new_post[channel]){ - new_post[channel] =[] - } - new_post[channel].push({ - value: $(entry).val() - }) + + $('dt-comm-channel').each((index, entry)=>{ + let channel = $(entry).attr('id'); + console.log('id', channel) + const commChannelComponentValue = JSON.parse($(entry).attr('value')) + if (typeof new_post[channel] === 'undefined') { + new_post[channel] = []; } + console.log('value---',typeof(commChannelComponentValue)) + commChannelComponentValue.map(currentItem => { + console.log('currentItem', currentItem.value) + new_post[channel].push({value: currentItem.value}); + }) + console.log('new_post', new_post) }) + $('.selected-select-button').each((index, entry)=>{ let optionKey = $(entry).attr('id') let fieldKey = $(entry).data("field-key") @@ -1103,6 +1110,7 @@ jQuery(function($) { }); $(record).find('.multi_select .typeahead__query input').each((index, entry) => { + console.log('here-----multi-select') if ($(entry).is(':visible')) { fields.push($(entry).data('field')); } diff --git a/dt-core/global-functions.php b/dt-core/global-functions.php index 972951304c..58bb4a85a4 100755 --- a/dt-core/global-functions.php +++ b/dt-core/global-functions.php @@ -638,73 +638,19 @@ function render_field_for_display( $field_key, $fields, $post, $show_extra_contr ' . esc_html( $disabled ) . ' ' . ( $is_private ? 'private privateLabel=' . esc_attr( _x( "Private Field: Only I can see it\'s content", 'disciple_tools' ) ) : null ) . ' '; - $supported_web_components = [ 'text', 'key_select', 'date', 'tags', 'connection', 'multi_select' ]; + $supported_web_components = [ 'text', 'key_select', 'date', 'tags', 'connection', 'multi_select']; ?> - -
- - - "> - - - - - - - - - - - - - -
+ + + requiredmessage="" icon="https://cdn-icons-png.flaticon.com/512/1077/1077114.png" iconalttext="Icon Alt Text" privatelabel="" error="" onchange="" + > + + -
- - data-field="" - class="dt-communication-channel input-group-field" dir="auto" /> -
+ diff --git a/template-new-post.php b/template-new-post.php index 8c4611bc0f..f5b2bcfa06 100644 --- a/template-new-post.php +++ b/template-new-post.php @@ -133,7 +133,7 @@ class="button"
class="form-field "> $dt_post_type ] ); if ( isset( $field_settings['required'] ) && $field_settings['required'] === true ) { ?>

@@ -151,7 +151,7 @@ class="form-field ">
- +
From 10aa5d77ae97c2a3773c6f824ceb6dd27a910e55 Mon Sep 17 00:00:00 2001 From: Ashima-Arora <117061227+Ashima-Arora@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:40:45 +0530 Subject: [PATCH 2/8] changes in new-record.js to fetch the values from dt components --- dt-assets/js/new-record.js | 77 ++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 23 deletions(-) diff --git a/dt-assets/js/new-record.js b/dt-assets/js/new-record.js index 401d2f5333..6ae1cb041e 100644 --- a/dt-assets/js/new-record.js +++ b/dt-assets/js/new-record.js @@ -1,7 +1,18 @@ jQuery(function($) { + if (window.WebComponentServices && window.WebComponentServices.ComponentService) { + console.log(window.new_record_localized,'okok') + const service = new window.WebComponentServices.ComponentService( + window.new_record_localized.post_type, + '', + // eslint-disable-next-line no-undef + wpApiShare.nonce); + service.initialize(); + window.componentService = service; + } window.post_type_fields = window.new_record_localized.post_type_settings.fields let new_post = {} let temp_type = $('.type-options .selected').attr('id') + console.log('temp_type', temp_type); if ( temp_type ){ new_post.type = temp_type; } @@ -96,19 +107,45 @@ jQuery(function($) { .attr("disabled", true) .addClass("loading"); e.preventDefault(); - new_post.title = $(".js-create-post [name= name]").val() - - $('dt-single-select').each((entry) => { - new_post[$(entry).attr('id')] = $(entry).attr('value') - }) + new_post.title = $(".js-create-post [name=name]").val() - $('dt-text').each((entry)=>{ + $('.text-input').each((index, entry)=>{ if ( $(entry).val() ){ new_post[$(entry).attr('id')] = $(entry).val() } }) - $('.link-input').each((index, entry) => { + // $('dt-text').each((index, entry)=>{ + // if ( $(entry).val() ){ + // new_post[$(entry).attr('id')] = $(entry).attr('value') + // } + // }) + + // $('dt-comm-channel').each((index, entry)=>{ + // let channel = $(entry).attr('id'); + // console.log('channel', channel) + // console.log('typeof new_post[channel]', typeof(commChannelComponentValue)) + // if (typeof new_post[channel] === 'undefined') { + // new_post[channel] = []; + // } + // console.log('$(entry)', entry) + // if($(entry).attr('value')) { + // console.log('here') + // const commChannelComponentValue = JSON.parse($(entry).attr('value')) + // commChannelComponentValue && commChannelComponentValue.map(currentItem => { + // new_post[channel].push({value: currentItem.value}); + // }) + + // } + // console.log('newpost', new_post) + + // }) + + // $('dt-single-select').each((entry) => { + // new_post[$(entry).attr('id')] = $(entry).attr('value') + // }) + + $('.link-input').each(( entry) => { let fieldKey = $(entry).data('field-key') let type = $(entry).data('type') if ( $(entry).val() ){ @@ -128,22 +165,15 @@ jQuery(function($) { } }); - $('dt-comm-channel').each((index, entry)=>{ - let channel = $(entry).attr('id'); - console.log('id', channel) - const commChannelComponentValue = JSON.parse($(entry).attr('value')) - if (typeof new_post[channel] === 'undefined') { - new_post[channel] = []; - } - console.log('value---',typeof(commChannelComponentValue)) - commChannelComponentValue.map(currentItem => { - console.log('currentItem', currentItem.value) - new_post[channel].push({value: currentItem.value}); - }) - console.log('new_post', new_post) - }) + // $('dt-connection').each((index, entry)=>{ + // let channel = $(entry).attr('id'); + // const dtConnectionValues = JSON.parse($(entry).attr('value')) + // dtConnectionValues.map(currentItem => { + // new_post[channel].push({value: currentItem.value}); + // }) + // }); - $('.selected-select-button').each((index, entry)=>{ + $('.selected-select-button').each((index, entry)=>{ let optionKey = $(entry).attr('id') let fieldKey = $(entry).data("field-key") if ( !new_post[fieldKey]){ @@ -153,12 +183,13 @@ jQuery(function($) { "value": optionKey }) }) + if ( typeof window.selected_location_grid_meta !== 'undefined' ){ new_post['location_grid_meta'] = window.selected_location_grid_meta.location_grid_meta } - window.API.create_post( window.new_record_localized.post_type, new_post).promise().then(function(data) { + // console.log('data', data) window.location = data.permalink; }).catch(function(error) { const message = error.responseJSON?.message || error.responseText From d8e32e9e03cc40c325deaaffb10b5c05ac983def Mon Sep 17 00:00:00 2001 From: Ashima-Arora <117061227+Ashima-Arora@users.noreply.github.com> Date: Wed, 15 May 2024 17:17:30 +0530 Subject: [PATCH 3/8] integrating most of the components in new contact form --- dt-assets/js/new-record.js | 2088 ++++++++++++++++++++------------- dt-contacts/access-module.php | 1553 ++++++++++++------------ dt-core/global-functions.php | 1925 +++++++++++++++--------------- 3 files changed, 3081 insertions(+), 2485 deletions(-) diff --git a/dt-assets/js/new-record.js b/dt-assets/js/new-record.js index 6ae1cb041e..e5ed4a667d 100644 --- a/dt-assets/js/new-record.js +++ b/dt-assets/js/new-record.js @@ -1,229 +1,381 @@ -jQuery(function($) { - if (window.WebComponentServices && window.WebComponentServices.ComponentService) { - console.log(window.new_record_localized,'okok') - const service = new window.WebComponentServices.ComponentService( - window.new_record_localized.post_type, - '', - // eslint-disable-next-line no-undef - wpApiShare.nonce); - service.initialize(); - window.componentService = service; +// Check if the web component services and ComponentService are available +if ( + window.WebComponentServices && + window.WebComponentServices.ComponentService +) { + // Create a new instance of ComponentService + const service = new window.WebComponentServices.ComponentService( + window.new_record_localized.post_type, + "", + // eslint-disable-next-line no-undef + wpApiShare.nonce + ); + // Initialize the ComponentService + service.initialize(); + window.componentService = service; + + // Create a new instance of apiService + const initApiService = new window.WebComponentServices.ApiService( + // eslint-disable-next-line no-undef + wpApiShare.nonce + ); + + // Add an event listener to the form with the class 'js-create-post' when it's submitted + document + .querySelector(".js-create-post") + .addEventListener("submit", function (event) { + if (event) { + event.preventDefault(); + } + const form = event.target; + // Initialize an object to store form data and element data + const formData = new FormData(form); + const data = { + form: {}, + el: { + type: "access", + }, + }; + + formData.forEach((value, key) => (data.form[key] = value)); + Array.from(form.elements).forEach((el) => { + if ( + el.localName.startsWith("dt-") && + el.value && + String(el.value).trim() !== "" + ) { + // Check specific element types and handle accordingly + if (el.localName.startsWith("dt-comm")) { + // For 'dt-comm' elements, extract and store filtered values + const filteredValues = el.value.map((item) => { + return { value: item.value }; + }); + data.el[el.name] = filteredValues; + } else if ( + el.localName.startsWith("dt-multi") || + el.localName.startsWith("dt-tags") + ) { + // For 'dt-multi' or 'dt-tags' elements, extract and store filtered values + const filteredValues = el.value.map((item) => { + return { value: item }; + }); + data.el[el.name] = { values: filteredValues }; + } else if (el.localName.startsWith("dt-connection")) { + // For 'dt-connection' elements, extract and store filtered values + const filteredValues = el.value.map((item) => { + return { value: item.label }; + }); + data.el[el.name] = { values: filteredValues }; + } else { + // For other elements, simply store the value + data.el[el.name] = el.value; + } + } + }); + // Call the createPost method of initApiService to create a post with the collected data + initApiService.createPost("contacts", data.el).then(function (response) { + // window.location = response.permalink + console.log("response", response); + }); + }); + + // Select all elements with class '.form-fields' and 'dt-comm-channel' + document + .querySelectorAll(".form-fields dt-comm-channel") + .forEach(function (element) { + element.addEventListener("change", function (event) { + let element_index = event.target.id; + let valueAttri = event.target.value; + valueAttri.forEach(function (item) { + let value = item.value; + // Call a function to check if the field value exists + check_field_value_exists(element_index, value); + }); + }); + }); + + // Function to capitalize the first letter of a given string + const capitalizeFirstLetter = (string) => { + return string.charAt(0).toUpperCase() + string.slice(1); + }; + + // eslint-disable-next-line no-inner-declarations + async function check_field_value_exists(field_type, value) { + const email = value; + let post_type = window.wpApiShare.post_type; + let data = { + communication_channel: field_type, + field_value: email, + }; + await initApiService + .checkFieldValueExists(post_type, data) + .then((response) => { + return response; + }) + .then((result) => { + if (!Object.keys(result).length) { + document + .querySelector(`.form-fields dt-comm-channel[id="${field_type}"]`) + .setAttribute("error", ""); + } else { + document + .querySelector(`.form-fields dt-comm-channel[id="${field_type}"]`) + .setAttribute( + "error", + `${capitalizeFirstLetter( + field_type.split("_")[1] + )} already exists` + ); + } + }) + .catch((error) => { + console.error("Error fetching data:", error); + }); } - window.post_type_fields = window.new_record_localized.post_type_settings.fields - let new_post = {} - let temp_type = $('.type-options .selected').attr('id') - console.log('temp_type', temp_type); - if ( temp_type ){ +} +// Below JQuery code would gradually removed, when all the web-components are integrate abd tested. + +jQuery(function ($) { + window.post_type_fields = + window.new_record_localized.post_type_settings.fields; + // console.log('dededded',window.post_type_fields); + let new_post = {}; + let temp_type = $(".type-options .selected").attr("id"); + if (temp_type) { new_post.type = temp_type; } - document.querySelector('.form-fields input').focus() - $('.type-option').on('click', function(){ - let type = $(this).attr('id') - $('.type-option.selected').removeClass('selected') - $(this).addClass('selected') - $(`#${type} input`).prop('checked', true) - $('.form-fields').show(); - $(`.form-field`).hide() - $(`.form-field.all`).show() - $(`.form-field.${type}`).show() - $('#show-shield-banner').show() - $('#show-hidden-fields').show(); - $('#hide-hidden-fields').hide(); - new_post.type = type + document.querySelector(".form-fields input").focus(); + $(".type-option").on("click", function () { + let type = $(this).attr("id"); + $(".type-option.selected").removeClass("selected"); + $(this).addClass("selected"); + $(`#${type} input`).prop("checked", true); + $(".form-fields").show(); + $(`.form-field`).hide(); + $(`.form-field.all`).show(); + $(`.form-field.${type}`).show(); + $("#show-shield-banner").show(); + $("#show-hidden-fields").show(); + $("#hide-hidden-fields").hide(); + new_post.type = type; /* Focus first field in form */ - document.querySelector('.form-fields input').focus() - }) - $('#show-hidden-fields').on('click', function (){ - $('.form-field').show() - $('#show-hidden-fields').hide() - $('#hide-hidden-fields').show(); - }) - $('#hide-hidden-fields').on('click', function () { - $('.form-field').hide(); + document.querySelector(".form-fields input").focus(); + }); + $("#show-hidden-fields").on("click", function () { + $(".form-field").show(); + $("#show-hidden-fields").hide(); + $("#hide-hidden-fields").show(); + }); + $("#hide-hidden-fields").on("click", function () { + $(".form-field").hide(); $(`.form-field.all`).show(); $(`.form-field.${new_post.type}`).show(); - $('#hide-hidden-fields').hide(); - $('#show-hidden-fields').show(); + $("#hide-hidden-fields").hide(); + $("#show-hidden-fields").show(); }); $(".js-create-post-button").removeAttr("disabled"); // Clicking the plus sign next to the field label - $('button.add-button').on('click', e => { - const listClass = $(e.currentTarget).data('list-class') - const $list = $(`#edit-${listClass}`) - const field = $(e.currentTarget).data('list-class') - const fieldName = window.new_record_localized.post_type_settings.fields[field].name - const fieldType = $(e.currentTarget).data('field-type') - var elementIndex = $(`input[data-${field}-index]`).length - - if (fieldType === 'link') { - const addLinkForm = $(`.add-link-${field}`) - addLinkForm.show() - - $(`#cancel-link-button-${field}`).on('click', () => addLinkForm.hide()) + $("button.add-button").on("click", (e) => { + const listClass = $(e.currentTarget).data("list-class"); + const $list = $(`#edit-${listClass}`); + const field = $(e.currentTarget).data("list-class"); + const fieldName = + window.new_record_localized.post_type_settings.fields[field].name; + const fieldType = $(e.currentTarget).data("field-type"); + var elementIndex = $(`input[data-${field}-index]`).length; + + if (fieldType === "link") { + const addLinkForm = $(`.add-link-${field}`); + addLinkForm.show(); + + $(`#cancel-link-button-${field}`).on("click", () => addLinkForm.hide()); } else { $list.append(`
  • - - - +
  • - `) + `); } - }) + }); /* breadcrumb: new-field-type Add anything that the field type needs for creating a new record */ - $('.add-link-dropdown[data-only-one-option]').on('click', window.SHAREDFUNCTIONS.addLink) + $(".add-link-dropdown[data-only-one-option]").on( + "click", + window.SHAREDFUNCTIONS.addLink + ); - $('.add-link__option').on('click', (event) => { - window.SHAREDFUNCTIONS.addLink(event) - $(event.target).parent().hide() + $(".add-link__option").on("click", (event) => { + window.SHAREDFUNCTIONS.addLink(event); + $(event.target).parent().hide(); setTimeout(() => { - event.target.parentElement.removeAttribute('style') - }, 100) - }) - - $(document).on('click', '.link-delete-button', function(){ - $(this).closest('.link-section').remove() - }) - - $('.js-create-post').on('click', '.delete-button', function () { - var field_type = $(this).prev('input').data('field') - var element_index = $(this).data(`${field_type}-index`) - console.log(field_type, element_index) - $(`.communication-channel-error[data-${field_type}-index="${element_index}"]`).remove() - $(this).parent().remove() - }) - - /* breadcrumb: new-field-type Add the new link type data to the new_post array */ - $(".js-create-post").on("submit", function(e) { - $(".js-create-post-button") - .attr("disabled", true) - .addClass("loading"); - e.preventDefault(); - new_post.title = $(".js-create-post [name=name]").val() - - $('.text-input').each((index, entry)=>{ - if ( $(entry).val() ){ - new_post[$(entry).attr('id')] = $(entry).val() - } - }) - - // $('dt-text').each((index, entry)=>{ - // if ( $(entry).val() ){ - // new_post[$(entry).attr('id')] = $(entry).attr('value') - // } - // }) - - // $('dt-comm-channel').each((index, entry)=>{ - // let channel = $(entry).attr('id'); - // console.log('channel', channel) - // console.log('typeof new_post[channel]', typeof(commChannelComponentValue)) - // if (typeof new_post[channel] === 'undefined') { - // new_post[channel] = []; - // } - // console.log('$(entry)', entry) - // if($(entry).attr('value')) { - // console.log('here') - // const commChannelComponentValue = JSON.parse($(entry).attr('value')) - // commChannelComponentValue && commChannelComponentValue.map(currentItem => { - // new_post[channel].push({value: currentItem.value}); - // }) - - // } - // console.log('newpost', new_post) - - // }) - - // $('dt-single-select').each((entry) => { - // new_post[$(entry).attr('id')] = $(entry).attr('value') - // }) - - $('.link-input').each(( entry) => { - let fieldKey = $(entry).data('field-key') - let type = $(entry).data('type') - if ( $(entry).val() ){ - if ( !Object.prototype.hasOwnProperty.call( new_post, fieldKey ) ) { - new_post[fieldKey] = { values: [] } - } - new_post[fieldKey].values.push( { - value: $(entry).val(), - type: type, - } ) - } - }) - - $('.dt_textarea').each((index, entry)=>{ - if ( $(entry).val() ){ - new_post[$(entry).attr('id')] = $(entry).val() - } - }); - - // $('dt-connection').each((index, entry)=>{ - // let channel = $(entry).attr('id'); - // const dtConnectionValues = JSON.parse($(entry).attr('value')) - // dtConnectionValues.map(currentItem => { - // new_post[channel].push({value: currentItem.value}); - // }) - // }); - - $('.selected-select-button').each((index, entry)=>{ - let optionKey = $(entry).attr('id') - let fieldKey = $(entry).data("field-key") - if ( !new_post[fieldKey]){ - new_post[fieldKey] = {values:[]}; - } - new_post[fieldKey].values.push({ - "value": optionKey - }) - }) + event.target.parentElement.removeAttribute("style"); + }, 100); + }); - if ( typeof window.selected_location_grid_meta !== 'undefined' ){ - new_post['location_grid_meta'] = window.selected_location_grid_meta.location_grid_meta - } + $(document).on("click", ".link-delete-button", function () { + $(this).closest(".link-section").remove(); + }); - window.API.create_post( window.new_record_localized.post_type, new_post).promise().then(function(data) { - // console.log('data', data) - window.location = data.permalink; - }).catch(function(error) { - const message = error.responseJSON?.message || error.responseText - $(".js-create-post-button").removeClass("loading").addClass("alert").attr("disabled", false) - $(".error-text").html(message); - }); - return false; + $(".js-create-post").on("click", ".delete-button", function () { + var field_type = $(this).prev("input").data("field"); + var element_index = $(this).data(`${field_type}-index`); + $( + `.communication-channel-error[data-${field_type}-index="${element_index}"]` + ).remove(); + $(this).parent().remove(); }); - let field_settings = window.new_record_localized.post_type_settings.fields + /* breadcrumb: new-field-type Add the new link type data to the new_post array */ + // $(".js-create-post").on("submit", function(e) { + // $(".js-create-post-button") + // .attr("disabled", true) + // .addClass("loading"); + // e.preventDefault(); + // new_post.title = $(".js-create-post [name=name]").val() + + // $('.text-input').each((index, entry)=>{ + // if ( $(entry).val() ){ + // new_post[$(entry).attr('id')] = $(entry).val() + // } + // }) + + // $('dt-text').each((index, entry)=>{ + // if ( $(entry).val() ){ + // new_post[$(entry).attr('id')] = $(entry).attr('value') + // } + // }) + + // $('dt-comm-channel').each((index, entry)=>{ + // let channel = $(entry).attr('id'); + // console.log('channel', channel) + // console.log('typeof new_post[channel]', typeof(commChannelComponentValue)) + // if (typeof new_post[channel] === 'undefined') { + // new_post[channel] = []; + // } + // console.log('$(entry)', entry) + // if($(entry).attr('value')) { + // console.log('here') + // const commChannelComponentValue = JSON.parse($(entry).attr('value')) + // commChannelComponentValue && commChannelComponentValue.map(currentItem => { + // new_post[channel].push({value: currentItem.value}); + // }) + + // } + // console.log('newpost', new_post) + + // }) + + // $('dt-single-select').each((entry) => { + // new_post[$(entry).attr('id')] = $(entry).attr('value') + // }) + + // $('.link-input').each(( entry) => { + // let fieldKey = $(entry).data('field-key') + // let type = $(entry).data('type') + // if ( $(entry).val() ){ + // if ( !Object.prototype.hasOwnProperty.call( new_post, fieldKey ) ) { + // new_post[fieldKey] = { values: [] } + // } + // new_post[fieldKey].values.push( { + // value: $(entry).val(), + // type: type, + // } ) + // } + // }) + + // $('.dt_textarea').each((index, entry)=>{ + // if ( $(entry).val() ){ + // new_post[$(entry).attr('id')] = $(entry).val() + // } + // }); + + // $('dt-connection').each((index, entry)=>{ + // let channel = $(entry).attr('id'); + // const dtConnectionValues = JSON.parse($(entry).attr('value')) + // dtConnectionValues.map(currentItem => { + // new_post[channel].push({value: currentItem.value}); + // }) + // }); + + // $('.selected-select-button').each((index, entry)=>{ + // let optionKey = $(entry).attr('id') + // let fieldKey = $(entry).data("field-key") + // if ( !new_post[fieldKey]){ + // new_post[fieldKey] = {values:[]}; + // } + // new_post[fieldKey].values.push({ + // "value": optionKey + // }) + // }) + + // if ( typeof window.selected_location_grid_meta !== 'undefined' ){ + // new_post['location_grid_meta'] = window.selected_location_grid_meta.location_grid_meta + // } + + // window.API.create_post( window.new_record_localized.post_type, new_post).promise().then(function(data) { + // window.location = data.permalink; + // }).catch(function(error) { + // const message = error.responseJSON?.message || error.responseText + // $(".js-create-post-button").removeClass("loading").addClass("alert").attr("disabled", false) + // $(".error-text").html(message); + // }); + // return false; + // }); + + let field_settings = window.new_record_localized.post_type_settings.fields; function date_picker_init(is_bulk = false, bulk_id = 0) { - // Determine field class name to be used. - let field_class = (!is_bulk) ? `.dt_date_picker` : `.dt_date_picker-${bulk_id}`; + let field_class = !is_bulk + ? `.dt_date_picker` + : `.dt_date_picker-${bulk_id}`; // Assign on click listener. $(field_class).datepicker({ constrainInput: false, - dateFormat: 'yy-mm-dd', + dateFormat: "yy-mm-dd", onClose: function (date) { date = window.SHAREDFUNCTIONS.convertArabicToEnglishNumbers(date); if (!$(this).val()) { - date = " ";//null; + date = " "; //null; } - let id = $(this).attr('id') - new_post[id] = date + let id = $(this).attr("id"); + new_post[id] = date; if (this.value) { - this.value = window.SHAREDFUNCTIONS.formatDate(window.moment.utc(date).unix()); + this.value = window.SHAREDFUNCTIONS.formatDate( + window.moment.utc(date).unix() + ); } // If bulk related, capture epoch if (is_bulk) { - $(this).data('selected-date-epoch', window.moment.utc(date).unix()); + $(this).data("selected-date-epoch", window.moment.utc(date).unix()); } }, changeMonth: true, @@ -233,40 +385,39 @@ jQuery(function($) { } function button_multi_select_init(is_bulk = false, bulk_id = 0) { - // Determine field class name to be used. - let field_class = (!is_bulk) ? `.dt_multi_select` : `.dt_multi_select-${bulk_id}`; + let field_class = !is_bulk + ? `.dt_multi_select` + : `.dt_multi_select-${bulk_id}`; // Assign on click listener. - $(field_class).on('click', function () { - + $(field_class).on("click", function () { let field = $(this); if (field.hasClass("selected-select-button")) { - field.addClass("empty-select-button") - field.removeClass("selected-select-button") + field.addClass("empty-select-button"); + field.removeClass("selected-select-button"); } else { - field.removeClass("empty-select-button") - field.addClass("selected-select-button") + field.removeClass("empty-select-button"); + field.addClass("selected-select-button"); } - }); } function typeahead_general_init(is_bulk = false, bulk_id = 0) { - $(".typeahead__query input").each((key, el)=>{ - let field_key = $(el).data('field') - let post_type = $(el).data('post_type') - let field_type = $(el).data('field_type') - window.typeaheadTotals = {} + $(".typeahead__query input").each((key, el) => { + let field_key = $(el).data("field"); + let post_type = $(el).data("post_type"); + let field_type = $(el).data("field_type"); + window.typeaheadTotals = {}; // Determine field class name to be used. - let field_class = (!is_bulk) ? `.js-typeahead-${field_key}` : `.js-typeahead-${field_key}-${bulk_id}`; + let field_class = !is_bulk + ? `.js-typeahead-${field_key}` + : `.js-typeahead-${field_key}-${bulk_id}`; if (!window.Typeahead[field_class]) { - - if ( field_type === "connection"){ - + if (field_type === "connection") { $.typeahead({ input: field_class, minLength: 0, @@ -274,13 +425,16 @@ jQuery(function($) { searchOnFocus: true, maxItem: 20, template: window.TYPEAHEADS.contactListRowTemplate, - source: window.TYPEAHEADS.typeaheadPostsSource(post_type, field_key), + source: window.TYPEAHEADS.typeaheadPostsSource( + post_type, + field_key + ), display: ["name", "label"], - templateValue: function() { + templateValue: function () { if (this.items[this.items.length - 1].label) { - return "{{label}}" + return "{{label}}"; } else { - return "{{name}}" + return "{{name}}"; } }, dynamic: true, @@ -290,71 +444,91 @@ jQuery(function($) { callback: { onCancel: function (node, item) { if (!is_bulk) { - window.lodash.pullAllBy(new_post[field_key].values, [{value: item.ID}], "value"); + window.lodash.pullAllBy( + new_post[field_key].values, + [{ value: item.ID }], + "value" + ); } - } - } + }, + }, }, callback: { onResult: function (node, query, result, resultCount) { - let text = window.TYPEAHEADS.typeaheadHelpText(resultCount, query, result) + let text = window.TYPEAHEADS.typeaheadHelpText( + resultCount, + query, + result + ); $(`#${field_key}-result-container`).html(text); }, onHideLayout: function () { $(`#${field_key}-result-container`).html(""); }, - onClick: function (node, a, item, event ) { + onClick: function (node, a, item, event) { if (!is_bulk) { if (!new_post[field_key]) { - new_post[field_key] = {values: []} + new_post[field_key] = { values: [] }; } - new_post[field_key].values.push({value: item.ID}) + new_post[field_key].values.push({ value: item.ID }); } //get list from opening again - this.addMultiselectItemLayout(item) - event.preventDefault() + this.addMultiselectItemLayout(item); + event.preventDefault(); this.hideLayout(); this.resetInput(); - } - } + }, + }, }); - } else if ( field_type === "location" ){ + } else if (field_type === "location") { $.typeahead({ input: field_class, minLength: 0, accent: true, searchOnFocus: true, maxItem: 20, - dropdownFilter: [{ - key: 'group', - value: 'focus', - template: window.SHAREDFUNCTIONS.escapeHTML(window.wpApiShare.translations.regions_of_focus), - all: window.SHAREDFUNCTIONS.escapeHTML(window.wpApiShare.translations.all_locations), - }], + dropdownFilter: [ + { + key: "group", + value: "focus", + template: window.SHAREDFUNCTIONS.escapeHTML( + window.wpApiShare.translations.regions_of_focus + ), + all: window.SHAREDFUNCTIONS.escapeHTML( + window.wpApiShare.translations.all_locations + ), + }, + ], source: { focus: { display: "name", ajax: { - url: window.wpApiShare.root + 'dt/v1/mapping_module/search_location_grid_by_name', + url: + window.wpApiShare.root + + "dt/v1/mapping_module/search_location_grid_by_name", data: { s: "{{query}}", filter: function () { - return window.lodash.get(window.Typeahead[field_class].filters.dropdown, 'value', 'all') - } + return window.lodash.get( + window.Typeahead[field_class].filters.dropdown, + "value", + "all" + ); + }, }, beforeSend: function (xhr) { - xhr.setRequestHeader('X-WP-Nonce', window.wpApiShare.nonce); + xhr.setRequestHeader("X-WP-Nonce", window.wpApiShare.nonce); }, callback: { done: function (data) { if (typeof window.typeaheadTotals !== "undefined") { - window.typeaheadTotals.field = data.total + window.typeaheadTotals.field = data.total; } - return data.location_grid - } - } - } - } + return data.location_grid; + }, + }, + }, + }, }, display: "name", templateValue: "{{name}}", @@ -365,43 +539,61 @@ jQuery(function($) { callback: { onCancel: function (node, item) { if (!is_bulk) { - window.lodash.pullAllBy(new_post[field_key].values, [{value: item.ID}], "value"); + window.lodash.pullAllBy( + new_post[field_key].values, + [{ value: item.ID }], + "value" + ); } - } - } + }, + }, }, callback: { - onClick: function(node, a, item, event){ + onClick: function (node, a, item, event) { if (!is_bulk) { if (!new_post[field_key]) { - new_post[field_key] = {values: []} + new_post[field_key] = { values: [] }; } - new_post[field_key].values.push({value: item.ID}) + new_post[field_key].values.push({ value: item.ID }); } //get list from opening again - this.addMultiselectItemLayout(item) - event.preventDefault() + this.addMultiselectItemLayout(item); + event.preventDefault(); this.hideLayout(); this.resetInput(); }, - onReady(){ - this.filters.dropdown = {key: "group", value: "focus", template: window.SHAREDFUNCTIONS.escapeHTML(window.wpApiShare.translations.regions_of_focus)} + onReady() { + this.filters.dropdown = { + key: "group", + value: "focus", + template: window.SHAREDFUNCTIONS.escapeHTML( + window.wpApiShare.translations.regions_of_focus + ), + }; this.container .removeClass("filter") .find("." + this.options.selector.filterButton) - .html(window.SHAREDFUNCTIONS.escapeHTML(window.wpApiShare.translations.regions_of_focus)); + .html( + window.SHAREDFUNCTIONS.escapeHTML( + window.wpApiShare.translations.regions_of_focus + ) + ); }, onResult: function (node, query, result, resultCount) { - resultCount = window.typeaheadTotals.location_grid - let text = window.TYPEAHEADS.typeaheadHelpText(resultCount, query, result) - $('#location_grid-result-container').html(text); + resultCount = window.typeaheadTotals.location_grid; + let text = window.TYPEAHEADS.typeaheadHelpText( + resultCount, + query, + result + ); + $("#location_grid-result-container").html(text); }, onHideLayout: function () { - $('#location_grid-result-container').html(""); - } - } + $("#location_grid-result-container").html(""); + }, + }, }); - } else if ( field_type === "user_select" ){ + } else if (field_type === "user_select") { $.typeahead({ input: field_class, minLength: 0, @@ -414,39 +606,59 @@ jQuery(function($) { return `
    - ${window.SHAREDFUNCTIONS.escapeHTML( item.name )} + ${window.SHAREDFUNCTIONS.escapeHTML(item.name)} - ${ item.status_color ? ` ` : '' } - ${ item.update_needed && item.update_needed > 0 ? ` - - ${window.SHAREDFUNCTIONS.escapeHTML(item.update_needed)} - ` : '' } -
    ` + ${ + item.status_color + ? ` ` + : "" + } + ${ + item.update_needed && item.update_needed > 0 + ? ` + + ${window.SHAREDFUNCTIONS.escapeHTML( + item.update_needed + )} + ` + : "" + } + `; }, dynamic: true, hint: true, - emptyTemplate: window.SHAREDFUNCTIONS.escapeHTML(window.wpApiShare.translations.no_records_found), + emptyTemplate: window.SHAREDFUNCTIONS.escapeHTML( + window.wpApiShare.translations.no_records_found + ), callback: { - onClick: function(node, a, item){ + onClick: function (node, a, item) { if (!is_bulk) { new_post[field_key] = item.ID; } }, onResult: function (node, query, result, resultCount) { - let text = window.TYPEAHEADS.typeaheadHelpText(resultCount, query, result) + let text = window.TYPEAHEADS.typeaheadHelpText( + resultCount, + query, + result + ); $(`#${field_key}-result-container`).html(text); }, onHideLayout: function () { $(`.${field_key}-result-container`).html(""); - } + }, }, }); - let user_input = $(`.js-typeahead-${field_key}`) - $(`.search_${field_key}`).on('click', function () { - user_input.val("") - user_input.trigger('input.typeahead') - user_input.focus() - }) + let user_input = $(`.js-typeahead-${field_key}`); + $(`.search_${field_key}`).on("click", function () { + user_input.val(""); + user_input.trigger("input.typeahead"); + user_input.focus(); + }); } } }); @@ -455,50 +667,62 @@ jQuery(function($) { function typeahead_multi_select_init(is_bulk = false, bulk_id = 0) { //multi-select typeaheads for (let input of $(".multi_select .typeahead__query input")) { - let field = $(input).data('field') - let typeahead_name = (!is_bulk) ? `.js-typeahead-${field}` : `.js-typeahead-${field}-${bulk_id}`; - const post_type = window.new_record_localized.post_type + let field = $(input).data("field"); + let typeahead_name = !is_bulk + ? `.js-typeahead-${field}` + : `.js-typeahead-${field}-${bulk_id}`; + const post_type = window.new_record_localized.post_type; if (window.Typeahead[typeahead_name]) { - return + return; } - let source_data = {data: []} - let field_options = window.lodash.get(field_settings, `${field}.default`, {}) + let source_data = { data: [] }; + let field_options = window.lodash.get( + field_settings, + `${field}.default`, + {} + ); if (Object.keys(field_options).length > 0) { window.lodash.forOwn(field_options, (val, key) => { if (!val.deleted) { source_data.data.push({ key: key, name: key, - value: val.label || key - }) + value: val.label || key, + }); } - }) + }); } else { source_data = { [field]: { display: ["value"], ajax: { - url: window.wpApiShare.root + `dt-posts/v2/${post_type}/multi-select-values`, + url: + window.wpApiShare.root + + `dt-posts/v2/${post_type}/multi-select-values`, data: { s: "{{query}}", - field + field, }, beforeSend: function (xhr) { - xhr.setRequestHeader('X-WP-Nonce', window.wpApiShare.nonce); + xhr.setRequestHeader("X-WP-Nonce", window.wpApiShare.nonce); }, callback: { done: function (data) { - return (data || []).map(tag => { - let label = window.lodash.get(field_options, tag + ".label", tag) - return {value: label, key: tag} - }) - } - } - } - } - } + return (data || []).map((tag) => { + let label = window.lodash.get( + field_options, + tag + ".label", + tag + ); + return { value: label, key: tag }; + }); + }, + }, + }, + }, + }; } $.typeahead({ input: typeahead_name, @@ -506,7 +730,9 @@ jQuery(function($) { maxItem: 20, searchOnFocus: true, template: function (query, item) { - return `${window.SHAREDFUNCTIONS.escapeHTML(item.value)}` + return `${window.SHAREDFUNCTIONS.escapeHTML( + item.value + )}`; }, source: source_data, display: "value", @@ -518,27 +744,34 @@ jQuery(function($) { callback: { onCancel: function (node, item, event) { if (!is_bulk) { - window.lodash.pullAllBy(new_post[field].values, [{value: item.key}], "value"); + window.lodash.pullAllBy( + new_post[field].values, + [{ value: item.key }], + "value" + ); } - } - } + }, + }, }, callback: { onClick: function (node, a, item, event) { if (!is_bulk) { if (!new_post[field]) { - new_post[field] = {values: []} + new_post[field] = { values: [] }; } - new_post[field].values.push({value: item.key}) + new_post[field].values.push({ value: item.key }); } - this.addMultiselectItemLayout(item) - event.preventDefault() + this.addMultiselectItemLayout(item); + event.preventDefault(); this.hideLayout(); this.resetInput(); - }, onResult: function (node, query, result, resultCount) { - let text = window.TYPEAHEADS.typeaheadHelpText(resultCount, query, result) + let text = window.TYPEAHEADS.typeaheadHelpText( + resultCount, + query, + result + ); //adding the result text moves the input. timeout keeps the dropdown from closing as the user clicks and cursor moves away from the input. setTimeout(() => { $(`#${field}-result-container`).html(text); @@ -546,8 +779,8 @@ jQuery(function($) { }, onHideLayout: function () { $(`#${field}-result-container`).html(""); - } - } + }, + }, }); } } @@ -556,11 +789,13 @@ jQuery(function($) { /** * Tags */ - $('.tags .typeahead__query input').each((key, input) => { - let field = $(input).data('field') || 'tags' - let typeahead_name = (!is_bulk) ? `.js-typeahead-${field}` : `.js-typeahead-${field}-${bulk_id}`; + $(".tags .typeahead__query input").each((key, input) => { + let field = $(input).data("field") || "tags"; + let typeahead_name = !is_bulk + ? `.js-typeahead-${field}` + : `.js-typeahead-${field}-${bulk_id}`; - const post_type = window.new_record_localized.post_type + const post_type = window.new_record_localized.post_type; $.typeahead({ input: typeahead_name, minLength: 0, @@ -570,52 +805,54 @@ jQuery(function($) { tags: { display: ["value"], ajax: { - url: window.wpApiShare.root + `dt-posts/v2/${post_type}/multi-select-values`, + url: + window.wpApiShare.root + + `dt-posts/v2/${post_type}/multi-select-values`, data: { s: "{{query}}", - field: field + field: field, }, beforeSend: function (xhr) { - xhr.setRequestHeader('X-WP-Nonce', window.wpApiShare.nonce); + xhr.setRequestHeader("X-WP-Nonce", window.wpApiShare.nonce); }, callback: { done: function (data) { - return (data || []).map(tag => { - return {value: tag} - }) - } - } - } - } + return (data || []).map((tag) => { + return { value: tag }; + }); + }, + }, + }, + }, }, display: "value", templateValue: "{{value}}", emptyTemplate: function (query) { - const {addNewTagText, tagExistsText} = this.node[0].dataset + const { addNewTagText, tagExistsText } = this.node[0].dataset; if (this.comparedItems.includes(query)) { - return tagExistsText.replace('%s', query) + return tagExistsText.replace("%s", query); } - const liItem = $('
  • ') - const button = $(''; - $(field_div).find('.section-subheader').append('' + button_html + ''); + function apply_field_value_copy_controls_button( + record_id, + field_div, + field_class, + field_id + ) { + if ($(field_div).find(".field-value-copy-controls").length === 0) { + let button_html = + ''; + $(field_div) + .find(".section-subheader") + .append( + '' + + button_html + + "" + ); } } - function copy_field_value_across_records(record_id, field_div, field_class, field_id) { - + function copy_field_value_across_records( + record_id, + field_div, + field_class, + field_id + ) { // First, source field value to be copied. Ensure typeaheads are handled with a little more tlc..! ;) let value = null; - if (field_class === 'typeahead__query input') { - - let typeahead_selector = '.js-typeahead-' + field_id + '-' + record_id; + if (field_class === "typeahead__query input") { + let typeahead_selector = ".js-typeahead-" + field_id + "-" + record_id; let typeahead = window.Typeahead[typeahead_selector]; value = { items: typeahead.items, items_compared: typeahead.comparedItems, - items_label_container: typeahead.label.container + items_label_container: typeahead.label.container, }; - } else { - value = $(field_div).find('.' + field_class).val(); + value = $(field_div) + .find("." + field_class) + .val(); } // Assuming we have a valid value, proceed with copying across records. if (value) { - $('#form_fields_records').find('.form-fields-record').each((key, record) => { - - // Ignore primary source record! - if (record_id != $(record).find('#bulk_record_id').val()) { - - // Copy value across to other record fields. - $(record).find('.text-input').each((index, field) => { - if ($(field).attr('id') == field_id) { - $(field).val(value); - } - }); - - $(record).find('.select-field').each((index, field) => { - if ($(field).attr('id') == field_id) { - $(field).val(value); - } - }); - - // Again, handle typeaheads slightly differently! - $(record).find('.typeahead__query input').each((index, field) => { - if ($(field).data('field') == field_id) { - - let typeahead_selector = '.js-typeahead-' + field_id + '-' + $(record).find('#bulk_record_id').val(); - let typeahead = window.Typeahead[typeahead_selector]; - - // Assuming we have a valid handle, proceed. - if (typeahead) { + $("#form_fields_records") + .find(".form-fields-record") + .each((key, record) => { + // Ignore primary source record! + if (record_id != $(record).find("#bulk_record_id").val()) { + // Copy value across to other record fields. + $(record) + .find(".text-input") + .each((index, field) => { + if ($(field).attr("id") == field_id) { + $(field).val(value); + } + }); - // Clear down existing typeahead arrays and containers - typeahead.items = []; - typeahead.comparedItems = []; - jQuery(typeahead.label.container).empty(); + $(record) + .find(".select-field") + .each((index, field) => { + if ($(field).attr("id") == field_id) { + $(field).val(value); + } + }); - // Append copied items. - $.each(value.items, function (idx, item) { - typeahead.addMultiselectItemLayout(item); - }); - } - } - }); - } - }); + // Again, handle typeaheads slightly differently! + $(record) + .find(".typeahead__query input") + .each((index, field) => { + if ($(field).data("field") == field_id) { + let typeahead_selector = + ".js-typeahead-" + + field_id + + "-" + + $(record).find("#bulk_record_id").val(); + let typeahead = window.Typeahead[typeahead_selector]; + + // Assuming we have a valid handle, proceed. + if (typeahead) { + // Clear down existing typeahead arrays and containers + typeahead.items = []; + typeahead.comparedItems = []; + jQuery(typeahead.label.container).empty(); + + // Append copied items. + $.each(value.items, function (idx, item) { + typeahead.addMultiselectItemLayout(item); + }); + } + } + }); + } + }); } } @@ -1396,26 +1866,29 @@ jQuery(function($) { * Handle record removals. */ - $(document).on('click', '.record-removal-button', function (evt) { - delete_record_by_id($(evt.currentTarget).data('record-id')); + $(document).on("click", ".record-removal-button", function (evt) { + delete_record_by_id($(evt.currentTarget).data("record-id")); }); function generate_record_removal_button_html(record_id) { - let button_html = ``; + let button_html = ``; return button_html; } function delete_record_by_id(record_id) { if (record_id) { - let deleted_record = null; // Locate corresponding record. - $('#form_fields_records').find('.form-fields-record').each((key, record) => { - if ($(record).find('#bulk_record_id').val() == record_id) { - deleted_record = record; - } - }); + $("#form_fields_records") + .find(".form-fields-record") + .each((key, record) => { + if ($(record).find("#bulk_record_id").val() == record_id) { + deleted_record = record; + } + }); // If found, remove identified record from list. if (deleted_record) { @@ -1425,66 +1898,79 @@ jQuery(function($) { } // Check for phone and email duplication - let non_duplicable_fields = ['contact_phone', 'contact_email']; - $.each(non_duplicable_fields, function(field_key, field_type){ - if ( window.new_record_localized.post_type_settings.fields[field_type] ){ - var field_name = window.new_record_localized.post_type_settings.fields[field_type].name - $(`input[data-field="${field_type}"]`).attr(`data-${field_type}-index`, '0'); - $(`input[data-field="${field_type}"]`).after(``); + let non_duplicable_fields = ["contact_phone", "contact_email"]; + $.each(non_duplicable_fields, function (field_key, field_type) { + if (window.new_record_localized.post_type_settings.fields[field_type]) { + var field_name = + window.new_record_localized.post_type_settings.fields[field_type].name; + $(`input[data-field="${field_type}"]`).attr( + `data-${field_type}-index`, + "0" + ); + $(`input[data-field="${field_type}"]`).after( + `` + ); $(`input[data-field="${field_type}"]`).parent().after(` `); } - }) - - function check_field_value_exists(field_type, element_index) { - var email = $(`input[data-${field_type}-index="${element_index}"]`).val(); - $(`.loading-spinner[data-${field_type}-index="${element_index}"]`).attr('class','loading-spinner active'); - if (!email) { - $(`.communication-channel-error[data-${field_type}-index="${element_index}"]`).hide(); - $(`.loading-spinner[data-${field_type}-index="${element_index}"]`).attr('class','loading-spinner'); - return; - } - var post_type = window.wpApiShare.post_type; - var data = {"communication_channel": `${field_type}`, "field_value": email,} - jQuery.ajax({ - type: "POST", - data: JSON.stringify(data), - contentType: "application/json; charset=utf-8", - dataType: "json", - url: window.wpApiShare.root + `dt-posts/v2/${post_type}/check_field_value_exists`, - beforeSend: (xhr) => { - xhr.setRequestHeader("X-WP-Nonce", window.wpApiShare.nonce); - }, - }).then(result => { - if (!$.isEmptyObject(result)) { - var duplicate_ids_html = ''; - $.each(result, function(k,v) { - if ( k > 0 ) { - duplicate_ids_html += ', '; - } - duplicate_ids_html += `${window.new_record_localized.translations.contact} #${v.post_id}`; - }); - $(`.duplicate-ids[data-${field_type}-index="${element_index}"]`).html(duplicate_ids_html); - $(`.communication-channel-error[data-${field_type}-index="${element_index}"]`).show(); - } else { - $(`.communication-channel-error[data-${field_type}-index="${element_index}"]`).hide(); - $(`.duplicate-ids[data-${field_type}-index="${element_index}"]`).html(''); - } - $(`.loading-spinner[data-${field_type}-index="${element_index}"]`).attr('class','loading-spinner'); - }); - } - - $('.form-fields').on('change', 'input[data-field^="contact_"]', function() { - var post_type = $(this).data('field'); - var element_index = $(this).data(`${post_type}-index`); - check_field_value_exists(post_type, element_index) }); + // function check_field_value_exists(field_type, element_index) { + // var email = $(`input[data-${field_type}-index="${element_index}"]`).val(); + // console.log(email); + // $(`.loading-spinner[data-${field_type}-index="${element_index}"]`).attr('class','loading-spinner active'); + // if (!email) { + // $(`.communication-channel-error[data-${field_type}-index="${element_index}"]`).hide(); + // $(`.loading-spinner[data-${field_type}-index="${element_index}"]`).attr('class','loading-spinner'); + // return; + // } + // var post_type = window.wpApiShare.post_type; + // var data = {"communication_channel": `${field_type}`, "field_value": email,} + // jQuery.ajax({ + // type: "POST", + // data: JSON.stringify(data), + // contentType: "application/json; charset=utf-8", + // dataType: "json", + // url: window.wpApiShare.root + `dt-posts/v2/${post_type}/check_field_value_exists`, + // beforeSend: (xhr) => { + // xhr.setRequestHeader("X-WP-Nonce", window.wpApiShare.nonce); + // }, + // }).then(result => { + // if (!$.isEmptyObject(result)) { + // var duplicate_ids_html = ''; + // $.each(result, function(k,v) { + // if ( k > 0 ) { + // duplicate_ids_html += ', '; + // } + // duplicate_ids_html += `${window.new_record_localized.translations.contact} #${v.post_id}`; + // }); + // $(`.duplicate-ids[data-${field_type}-index="${element_index}"]`).html(duplicate_ids_html); + // $(`.communication-channel-error[data-${field_type}-index="${element_index}"]`).show(); + // } else { + // $(`.communication-channel-error[data-${field_type}-index="${element_index}"]`).hide(); + // $(`.duplicate-ids[data-${field_type}-index="${element_index}"]`).html(''); + // } + // $(`.loading-spinner[data-${field_type}-index="${element_index}"]`).attr('class','loading-spinner'); + // }); + // } + + // $('.form-fields dt-comm-channel').on('change', function(e) { + // // $('#contact_').on('change', function() { + // console.log('cnjdcjdncjd'); + // var post_type = $(this).attr('posttype'); + // console.log(post_type); + // var element_index = $(this).attr('id');; + // console.log(element_index); + // check_field_value_exists(post_type, element_index) + // }); + /** * ============== [ BULK RECORD ADDING FUNCTIONALITY ] ============== */ - }); diff --git a/dt-contacts/access-module.php b/dt-contacts/access-module.php index 5db26307a5..376b6c1745 100644 --- a/dt-contacts/access-module.php +++ b/dt-contacts/access-module.php @@ -1,79 +1,85 @@ true, 'create_contacts' => true ]; + public function dt_set_roles_and_permissions($expected_roles) + { + $base_contacts_permissions = ['access_contacts' => true, 'create_contacts' => true]; $all_user_caps = Disciple_Tools_Roles::default_user_caps(); $metrics_caps = Disciple_Tools_Roles::default_all_metrics_caps(); $expected_roles['dispatcher'] = [ - 'label' => __( 'Dispatcher', 'disciple_tools' ), + 'label' => __('Dispatcher', 'disciple_tools'), 'description' => 'Monitor new D.T contacts and assign them to waiting Multipliers', - 'permissions' => array_merge( $base_contacts_permissions, $all_user_caps, $metrics_caps ), - 'type' => [ 'base', 'access' ], + 'permissions' => array_merge($base_contacts_permissions, $all_user_caps, $metrics_caps), + 'type' => ['base', 'access'], 'order' => 20 ]; $expected_roles['partner'] = [ - 'label' => __( 'Partner', 'disciple_tools' ), + 'label' => __('Partner', 'disciple_tools'), 'description' => 'Allow access to a specific contact source so a partner can see progress', - 'permissions' => array_merge( $base_contacts_permissions, $all_user_caps ), - 'type' => [ 'base', 'access' ], + 'permissions' => array_merge($base_contacts_permissions, $all_user_caps), + 'type' => ['base', 'access'], 'order' => 35 ]; $expected_roles['marketer'] = [ - 'label' => __( 'Digital Responder', 'disciple_tools' ), + 'label' => __('Digital Responder', 'disciple_tools'), 'description' => 'Talk to leads online and report in D.T when Contacts are ready for follow-up', - 'permissions' => array_merge( $base_contacts_permissions, $all_user_caps, $metrics_caps ), - 'type' => [ 'base', 'access' ], + 'permissions' => array_merge($base_contacts_permissions, $all_user_caps, $metrics_caps), + 'type' => ['base', 'access'], 'order' => 50 ]; @@ -94,284 +100,285 @@ public function dt_set_roles_and_permissions( $expected_roles ){ return $expected_roles; } - public function dt_custom_fields_settings( $fields, $post_type ){ + public function dt_custom_fields_settings($fields, $post_type) + { $declared_fields = $fields; - if ( $post_type === 'contacts' ){ - if ( isset( $fields['type']['default']['personal'] ) ){ + if ($post_type === 'contacts') { + if (isset($fields['type']['default']['personal'])) { $fields['type']['default']['personal']['default'] = false; } $fields['type']['default']['access'] = [ - 'label' => __( 'Standard Contact', 'disciple_tools' ), + 'label' => __('Standard Contact', 'disciple_tools'), 'color' => '#2196F3', - 'description' => __( 'A contact to collaborate on', 'disciple_tools' ), - 'visibility' => __( 'Me and project leadership', 'disciple_tools' ), + 'description' => __('A contact to collaborate on', 'disciple_tools'), + 'visibility' => __('Me and project leadership', 'disciple_tools'), 'icon' => get_template_directory_uri() . '/dt-assets/images/share.svg?v=2', 'order' => 20, 'default' => true, ]; $fields['type']['default']['access_placeholder'] = [ - 'label' => __( 'Connection', 'disciple_tools' ), + 'label' => __('Connection', 'disciple_tools'), 'color' => '#FF9800', - 'description' => __( 'Connected to a contact, or generational fruit', 'disciple_tools' ), + 'description' => __('Connected to a contact, or generational fruit', 'disciple_tools'), 'icon' => get_template_directory_uri() . '/dt-assets/images/share.svg?v=2', 'order' => 40, - 'visibility' => __( 'Collaborators', 'disciple_tools' ), + 'visibility' => __('Collaborators', 'disciple_tools'), 'in_create_form' => false, ]; $fields['assigned_to'] = [ - 'name' => __( 'Assigned To', 'disciple_tools' ), - 'description' => __( 'Select the main person who is responsible for reporting on this contact.', 'disciple_tools' ), - 'type' => 'user_select', - 'default' => '', - 'tile' => 'status', + 'name' => __('Assigned To', 'disciple_tools'), + 'description' => __('Select the main person who is responsible for reporting on this contact.', 'disciple_tools'), + 'type' => 'user_select', + 'default' => '', + 'tile' => 'status', 'icon' => get_template_directory_uri() . '/dt-assets/images/assigned-to.svg?v=2', 'show_in_table' => 25, - 'only_for_types' => [ 'access', 'user' ], + 'only_for_types' => ['access', 'user'], 'custom_display' => false ]; $fields['seeker_path'] = [ - 'name' => __( 'Seeker Path', 'disciple_tools' ), - 'description' => _x( 'Set the status of your progression with the contact. These are the steps that happen in a specific order to help a contact move forward.', 'Seeker Path field description', 'disciple_tools' ), - 'type' => 'key_select', - 'default' => [ - 'none' => [ - 'label' => __( 'Contact Attempt Needed', 'disciple_tools' ), - 'description' => '' + 'name' => __('Seeker Path', 'disciple_tools'), + 'description' => _x('Set the status of your progression with the contact. These are the steps that happen in a specific order to help a contact move forward.', 'Seeker Path field description', 'disciple_tools'), + 'type' => 'key_select', + 'default' => [ + 'none' => [ + 'label' => __('Contact Attempt Needed', 'disciple_tools'), + 'description' => '' ], - 'attempted' => [ - 'label' => __( 'Contact Attempted', 'disciple_tools' ), - 'description' => '' + 'attempted' => [ + 'label' => __('Contact Attempted', 'disciple_tools'), + 'description' => '' ], 'established' => [ - 'label' => __( 'Contact Established', 'disciple_tools' ), - 'description' => '' + 'label' => __('Contact Established', 'disciple_tools'), + 'description' => '' ], - 'scheduled' => [ - 'label' => __( 'First Meeting Scheduled', 'disciple_tools' ), - 'description' => '' + 'scheduled' => [ + 'label' => __('First Meeting Scheduled', 'disciple_tools'), + 'description' => '' ], - 'met' => [ - 'label' => __( 'First Meeting Complete', 'disciple_tools' ), - 'description' => '' + 'met' => [ + 'label' => __('First Meeting Complete', 'disciple_tools'), + 'description' => '' ], - 'ongoing' => [ - 'label' => __( 'Ongoing Meetings', 'disciple_tools' ), - 'description' => '' + 'ongoing' => [ + 'label' => __('Ongoing Meetings', 'disciple_tools'), + 'description' => '' ], - 'coaching' => [ - 'label' => __( 'Being Coached', 'disciple_tools' ), - 'description' => '' + 'coaching' => [ + 'label' => __('Being Coached', 'disciple_tools'), + 'description' => '' ], ], 'customizable' => 'add_only', 'tile' => 'followup', 'show_in_table' => 15, - 'only_for_types' => [ 'access' ], + 'only_for_types' => ['access'], 'icon' => get_template_directory_uri() . '/dt-assets/images/sign-post.svg?v=2', ]; $fields['overall_status'] = [ - 'name' => __( 'Contact Status', 'disciple_tools' ), - 'type' => 'key_select', + 'name' => __('Contact Status', 'disciple_tools'), + 'type' => 'key_select', 'default_color' => '#366184', - 'default' => [ - 'new' => [ - 'label' => __( 'New Contact', 'disciple_tools' ), - 'description' => _x( 'The contact is new in the system.', 'Contact Status field description', 'disciple_tools' ), + 'default' => [ + 'new' => [ + 'label' => __('New Contact', 'disciple_tools'), + 'description' => _x('The contact is new in the system.', 'Contact Status field description', 'disciple_tools'), 'color' => '#F43636', ], 'unassignable' => [ - 'label' => __( 'Not Ready', 'disciple_tools' ), - 'description' => _x( 'There is not enough information to move forward with the contact at this time.', 'Contact Status field description', 'disciple_tools' ), + 'label' => __('Not Ready', 'disciple_tools'), + 'description' => _x('There is not enough information to move forward with the contact at this time.', 'Contact Status field description', 'disciple_tools'), 'color' => '#FF9800', ], - 'unassigned' => [ - 'label' => __( 'Dispatch Needed', 'disciple_tools' ), - 'description' => _x( 'This contact needs to be assigned to a multiplier.', 'Contact Status field description', 'disciple_tools' ), + 'unassigned' => [ + 'label' => __('Dispatch Needed', 'disciple_tools'), + 'description' => _x('This contact needs to be assigned to a multiplier.', 'Contact Status field description', 'disciple_tools'), 'color' => '#F43636', ], - 'assigned' => [ - 'label' => __( 'Waiting to be accepted', 'disciple_tools' ), - 'description' => _x( 'The contact has been assigned to someone, but has not yet been accepted by that person.', 'Contact Status field description', 'disciple_tools' ), + 'assigned' => [ + 'label' => __('Waiting to be accepted', 'disciple_tools'), + 'description' => _x('The contact has been assigned to someone, but has not yet been accepted by that person.', 'Contact Status field description', 'disciple_tools'), 'color' => '#FF9800', ], - 'active' => [], //already declared. Here to indicate order - 'paused' => [ - 'label' => __( 'Paused', 'disciple_tools' ), - 'description' => _x( 'This contact is currently on hold (i.e. on vacation or not responding).', 'Contact Status field description', 'disciple_tools' ), + 'active' => [], //already declared. Here to indicate order + 'paused' => [ + 'label' => __('Paused', 'disciple_tools'), + 'description' => _x('This contact is currently on hold (i.e. on vacation or not responding).', 'Contact Status field description', 'disciple_tools'), 'color' => '#FF9800', ], 'closed' => [] //already declared. Here to indicate order ], - 'tile' => 'status', + 'tile' => 'status', 'customizable' => 'add_only', 'custom_display' => true, 'icon' => get_template_directory_uri() . '/dt-assets/images/status.svg?v=2', 'show_in_table' => 10, - 'only_for_types' => [ 'access' ], + 'only_for_types' => ['access'], 'select_cannot_be_empty' => true ]; $fields['reason_unassignable'] = [ - 'name' => __( 'Reason Not Ready', 'disciple_tools' ), - 'description' => _x( 'The main reason the contact is not ready to be assigned to a user.', 'Optional Documentation', 'disciple_tools' ), - 'type' => 'key_select', - 'default' => [ - 'none' => [ + 'name' => __('Reason Not Ready', 'disciple_tools'), + 'description' => _x('The main reason the contact is not ready to be assigned to a user.', 'Optional Documentation', 'disciple_tools'), + 'type' => 'key_select', + 'default' => [ + 'none' => [ 'label' => '', ], 'insufficient' => [ - 'label' => __( 'Insufficient Contact Information', 'disciple_tools' ) + 'label' => __('Insufficient Contact Information', 'disciple_tools') ], - 'location' => [ - 'label' => __( 'Unknown Location', 'disciple_tools' ) + 'location' => [ + 'label' => __('Unknown Location', 'disciple_tools') ], - 'media' => [ - 'label' => __( 'Only wants media', 'disciple_tools' ) + 'media' => [ + 'label' => __('Only wants media', 'disciple_tools') ], 'outside_area' => [ - 'label' => __( 'Outside Area', 'disciple_tools' ) + 'label' => __('Outside Area', 'disciple_tools') ], 'needs_review' => [ - 'label' => __( 'Needs Review', 'disciple_tools' ) + 'label' => __('Needs Review', 'disciple_tools') ], 'awaiting_confirmation' => [ - 'label' => __( 'Waiting for Confirmation', 'disciple_tools' ) + 'label' => __('Waiting for Confirmation', 'disciple_tools') ], ], 'customizable' => 'all', - 'only_for_types' => [ 'access' ] + 'only_for_types' => ['access'] ]; $fields['reason_paused'] = [ - 'name' => __( 'Reason Paused', 'disciple_tools' ), - 'description' => _x( 'A paused contact is one you are not currently interacting with but expect to in the future.', 'Optional Documentation', 'disciple_tools' ), - 'type' => 'key_select', + 'name' => __('Reason Paused', 'disciple_tools'), + 'description' => _x('A paused contact is one you are not currently interacting with but expect to in the future.', 'Optional Documentation', 'disciple_tools'), + 'type' => 'key_select', 'default' => [ - 'none' => [ 'label' => '' ], - 'vacation' => [ 'label' => _x( 'Contact on vacation', 'Reason Paused label', 'disciple_tools' ) ], - 'not_responding' => [ 'label' => _x( 'Contact not responding', 'Reason Paused label', 'disciple_tools' ) ], - 'not_available' => [ 'label' => _x( 'Contact not available', 'Reason Paused label', 'disciple_tools' ) ], - 'little_interest' => [ 'label' => _x( 'Contact has little interest/hunger', 'Reason Paused label', 'disciple_tools' ) ], - 'no_initiative' => [ 'label' => _x( 'Contact shows no initiative', 'Reason Paused label', 'disciple_tools' ) ], - 'questionable_motives' => [ 'label' => _x( 'Contact has questionable motives', 'Reason Paused label', 'disciple_tools' ) ], - 'ball_in_their_court' => [ 'label' => _x( 'Ball is in the contact\'s court', 'Reason Paused label', 'disciple_tools' ) ], - 'wait_and_see' => [ 'label' => _x( 'We want to see if/how the contact responds to automated text messages', 'Reason Paused label', 'disciple_tools' ) ], + 'none' => ['label' => ''], + 'vacation' => ['label' => _x('Contact on vacation', 'Reason Paused label', 'disciple_tools')], + 'not_responding' => ['label' => _x('Contact not responding', 'Reason Paused label', 'disciple_tools')], + 'not_available' => ['label' => _x('Contact not available', 'Reason Paused label', 'disciple_tools')], + 'little_interest' => ['label' => _x('Contact has little interest/hunger', 'Reason Paused label', 'disciple_tools')], + 'no_initiative' => ['label' => _x('Contact shows no initiative', 'Reason Paused label', 'disciple_tools')], + 'questionable_motives' => ['label' => _x('Contact has questionable motives', 'Reason Paused label', 'disciple_tools')], + 'ball_in_their_court' => ['label' => _x('Ball is in the contact\'s court', 'Reason Paused label', 'disciple_tools')], + 'wait_and_see' => ['label' => _x('We want to see if/how the contact responds to automated text messages', 'Reason Paused label', 'disciple_tools')], ], 'customizable' => 'all', - 'only_for_types' => [ 'access' ] + 'only_for_types' => ['access'] ]; $fields['reason_closed'] = [ - 'name' => __( 'Reason Archived', 'disciple_tools' ), - 'description' => _x( "A closed contact is one you can't or don't wish to interact with.", 'Optional Documentation', 'disciple_tools' ), - 'type' => 'key_select', - 'default' => [ - 'none' => [ 'label' => '' ], - 'duplicate' => [ 'label' => _x( 'Duplicate', 'Reason Closed label', 'disciple_tools' ) ], - 'insufficient' => [ 'label' => _x( 'Insufficient contact info', 'Reason Closed label', 'disciple_tools' ) ], - 'denies_submission' => [ 'label' => _x( 'Denies submitting contact request', 'Reason Closed label', 'disciple_tools' ) ], - 'hostile_self_gain' => [ 'label' => _x( 'Hostile, playing games or self gain', 'Reason Closed label', 'disciple_tools' ) ], - 'apologetics' => [ 'label' => _x( 'Only wants to argue or debate', 'Reason Closed label', 'disciple_tools' ) ], - 'media_only' => [ 'label' => _x( 'Just wanted media or book', 'Reason Closed label', 'disciple_tools' ) ], - 'no_longer_interested' => [ 'label' => _x( 'No longer interested', 'Reason Closed label', 'disciple_tools' ) ], - 'no_longer_responding' => [ 'label' => _x( 'No longer responding', 'Reason Closed label', 'disciple_tools' ) ], - 'already_connected' => [ 'label' => _x( 'Already in church or connected with others', 'Reason Closed label', 'disciple_tools' ) ], - 'transfer' => [ 'label' => _x( 'Transferred contact to partner', 'Reason Closed label', 'disciple_tools' ) ], - 'martyred' => [ 'label' => _x( 'Martyred', 'Reason Closed label', 'disciple_tools' ) ], - 'moved' => [ 'label' => _x( 'Moved or relocated', 'Reason Closed label', 'disciple_tools' ) ], - 'gdpr' => [ 'label' => _x( 'GDPR request', 'Reason Closed label', 'disciple_tools' ) ], - 'unknown' => [ 'label' => _x( 'Unknown', 'Reason Closed label', 'disciple_tools' ) ] + 'name' => __('Reason Archived', 'disciple_tools'), + 'description' => _x("A closed contact is one you can't or don't wish to interact with.", 'Optional Documentation', 'disciple_tools'), + 'type' => 'key_select', + 'default' => [ + 'none' => ['label' => ''], + 'duplicate' => ['label' => _x('Duplicate', 'Reason Closed label', 'disciple_tools')], + 'insufficient' => ['label' => _x('Insufficient contact info', 'Reason Closed label', 'disciple_tools')], + 'denies_submission' => ['label' => _x('Denies submitting contact request', 'Reason Closed label', 'disciple_tools')], + 'hostile_self_gain' => ['label' => _x('Hostile, playing games or self gain', 'Reason Closed label', 'disciple_tools')], + 'apologetics' => ['label' => _x('Only wants to argue or debate', 'Reason Closed label', 'disciple_tools')], + 'media_only' => ['label' => _x('Just wanted media or book', 'Reason Closed label', 'disciple_tools')], + 'no_longer_interested' => ['label' => _x('No longer interested', 'Reason Closed label', 'disciple_tools')], + 'no_longer_responding' => ['label' => _x('No longer responding', 'Reason Closed label', 'disciple_tools')], + 'already_connected' => ['label' => _x('Already in church or connected with others', 'Reason Closed label', 'disciple_tools')], + 'transfer' => ['label' => _x('Transferred contact to partner', 'Reason Closed label', 'disciple_tools')], + 'martyred' => ['label' => _x('Martyred', 'Reason Closed label', 'disciple_tools')], + 'moved' => ['label' => _x('Moved or relocated', 'Reason Closed label', 'disciple_tools')], + 'gdpr' => ['label' => _x('GDPR request', 'Reason Closed label', 'disciple_tools')], + 'unknown' => ['label' => _x('Unknown', 'Reason Closed label', 'disciple_tools')] ], 'customizable' => 'all', - 'only_for_types' => [ 'access' ] + 'only_for_types' => ['access'] ]; $fields['accepted'] = [ - 'name' => __( 'Accepted', 'disciple_tools' ), - 'type' => 'boolean', - 'default' => false, - 'hidden' => true, - 'only_for_types' => [ 'access' ] + 'name' => __('Accepted', 'disciple_tools'), + 'type' => 'boolean', + 'default' => false, + 'hidden' => true, + 'only_for_types' => ['access'] ]; $sources_default = [ - 'personal' => [ - 'label' => __( 'Personal', 'disciple_tools' ), - 'key' => 'personal', + 'personal' => [ + 'label' => __('Personal', 'disciple_tools'), + 'key' => 'personal', ], - 'web' => [ - 'label' => __( 'Web', 'disciple_tools' ), - 'key' => 'web', + 'web' => [ + 'label' => __('Web', 'disciple_tools'), + 'key' => 'web', ], - 'facebook' => [ - 'label' => __( 'Facebook', 'disciple_tools' ), - 'key' => 'facebook', + 'facebook' => [ + 'label' => __('Facebook', 'disciple_tools'), + 'key' => 'facebook', ], - 'twitter' => [ - 'label' => __( 'Twitter', 'disciple_tools' ), - 'key' => 'twitter', + 'twitter' => [ + 'label' => __('Twitter', 'disciple_tools'), + 'key' => 'twitter', ], 'transfer' => [ - 'label' => __( 'Transfer', 'disciple_tools' ), - 'key' => 'transfer', - 'description' => __( 'Contacts transferred from a partnership with another Disciple.Tools site.', 'disciple_tools' ), + 'label' => __('Transfer', 'disciple_tools'), + 'key' => 'transfer', + 'description' => __('Contacts transferred from a partnership with another Disciple.Tools site.', 'disciple_tools'), ] ]; - foreach ( dt_get_option( 'dt_site_custom_lists' )['sources'] as $key => $value ) { - if ( !isset( $sources_default[$key] ) ) { - if ( isset( $value['enabled'] ) && $value['enabled'] === false ) { + foreach (dt_get_option('dt_site_custom_lists')['sources'] as $key => $value) { + if (!isset($sources_default[$key])) { + if (isset($value['enabled']) && $value['enabled'] === false) { $value['deleted'] = true; } - $sources_default[ $key ] = $value; + $sources_default[$key] = $value; } } $fields['sources'] = [ - 'name' => __( 'Sources', 'disciple_tools' ), - 'description' => _x( 'The website, event or location this contact came from.', 'Optional Documentation', 'disciple_tools' ), - 'type' => 'multi_select', - 'default' => $sources_default, - 'tile' => 'details', + 'name' => __('Sources', 'disciple_tools'), + 'description' => _x('The website, event or location this contact came from.', 'Optional Documentation', 'disciple_tools'), + 'type' => 'multi_select', + 'default' => $sources_default, + 'tile' => 'details', 'customizable' => 'all', 'display' => 'typeahead', 'icon' => get_template_directory_uri() . '/dt-assets/images/arrow-collapse-all.svg?v=2', - 'only_for_types' => [ 'access' ], - 'in_create_form' => [ 'access' ] + 'only_for_types' => ['access'], + 'in_create_form' => ['access'] ]; $fields['campaigns'] = [ - 'name' => __( 'Campaigns', 'disciple_tools' ), - 'description' => _x( 'Marketing campaigns or access activities that this contact interacted with.', 'Optional Documentation', 'disciple_tools' ), + 'name' => __('Campaigns', 'disciple_tools'), + 'description' => _x('Marketing campaigns or access activities that this contact interacted with.', 'Optional Documentation', 'disciple_tools'), 'tile' => 'details', - 'type' => 'tags', - 'default' => [], + 'type' => 'tags', + 'default' => [], 'icon' => get_template_directory_uri() . '/dt-assets/images/megaphone.svg?v=2', - 'only_for_types' => [ 'access' ], + 'only_for_types' => ['access'], ]; - if ( empty( $fields['contact_phone']['in_create_form'] ) ){ - $fields['contact_phone']['in_create_form'] = [ 'access' ]; - } elseif ( is_array( $fields['contact_phone']['in_create_form'] ) ){ + if (empty($fields['contact_phone']['in_create_form'])) { + $fields['contact_phone']['in_create_form'] = ['access']; + } elseif (is_array($fields['contact_phone']['in_create_form'])) { $fields['contact_phone']['in_create_form'][] = 'access'; } - if ( empty( $fields['contact_email']['in_create_form'] ) ){ - $fields['contact_email']['in_create_form'] = [ 'access' ]; - } elseif ( is_array( $fields['contact_email']['in_create_form'] ) ){ + if (empty($fields['contact_email']['in_create_form'])) { + $fields['contact_email']['in_create_form'] = ['access']; + } elseif (is_array($fields['contact_email']['in_create_form'])) { $fields['contact_email']['in_create_form'][] = 'access'; } - if ( empty( $fields['contact_address']['in_create_form'] ) ){ - $fields['contact_address']['in_create_form'] = [ 'access' ]; - } elseif ( is_array( $fields['contact_address']['in_create_form'] ) ){ + if (empty($fields['contact_address']['in_create_form'])) { + $fields['contact_address']['in_create_form'] = ['access']; + } elseif (is_array($fields['contact_address']['in_create_form'])) { $fields['contact_address']['in_create_form'][] = 'access'; } - $declared_fields = dt_array_merge_recursive_distinct( $declared_fields, $fields ); + $declared_fields = dt_array_merge_recursive_distinct($declared_fields, $fields); //order overall status options - uksort( $declared_fields['overall_status']['default'], function ( $a, $b ) use ( $fields ){ - return array_search( $a, array_keys( $fields['overall_status']['default'] ) ) <=> array_search( $b, array_keys( $fields['overall_status']['default'] ) ); - } ); + uksort($declared_fields['overall_status']['default'], function ($a, $b) use ($fields) { + return array_search($a, array_keys($fields['overall_status']['default'])) <=> array_search($b, array_keys($fields['overall_status']['default'])); + }); $fields = $declared_fields; } @@ -380,136 +387,148 @@ public function dt_custom_fields_settings( $fields, $post_type ){ } - public function add_api_routes(){ + public function add_api_routes() + { $namespace = 'dt-posts/v2'; register_rest_route( - $namespace, '/contacts/(?P\d+)/accept', [ - 'methods' => 'POST', - 'callback' => [ $this, 'accept_contact' ], + $namespace, + '/contacts/(?P\d+)/accept', + [ + 'methods' => 'POST', + 'callback' => [$this, 'accept_contact'], 'permission_callback' => '__return_true', ] ); register_rest_route( - $namespace, '/contacts/assignment-list', [ - 'methods' => 'GET', - 'callback' => [ $this, 'get_dispatch_list' ], + $namespace, + '/contacts/assignment-list', + [ + 'methods' => 'GET', + 'callback' => [$this, 'get_dispatch_list'], 'permission_callback' => '__return_true', ] ); } - public function dt_details_additional_tiles( $sections, $post_type = '' ){ - if ( is_singular( 'contacts' ) ) { - $contact = DT_Posts::get_post( 'contacts', get_the_ID() ); - if ( is_wp_error( $contact ) || ( isset( $contact['type']['key'] ) && $contact['type']['key'] !== 'access' ) ) { + public function dt_details_additional_tiles($sections, $post_type = '') + { + if (is_singular('contacts')) { + $contact = DT_Posts::get_post('contacts', get_the_ID()); + if (is_wp_error($contact) || (isset($contact['type']['key']) && $contact['type']['key'] !== 'access')) { return $sections; } } - if ( $post_type === 'contacts' ){ + if ($post_type === 'contacts') { $sections['followup'] = [ - 'label' => __( 'Follow Up', 'disciple_tools' ), + 'label' => __('Follow Up', 'disciple_tools'), 'display_for' => [ - 'type' => [ 'access' ], + 'type' => ['access'], ] ]; - if ( isset( $sections['status']['order'] ) && !in_array( 'overall_status', $sections['status']['order'], true ) ){ - $sections['status']['order'] = array_merge( [ 'overall_status', 'assigned_to' ], $sections['status']['order'] ); + if (isset($sections['status']['order']) && !in_array('overall_status', $sections['status']['order'], true)) { + $sections['status']['order'] = array_merge(['overall_status', 'assigned_to'], $sections['status']['order']); } } return $sections; } - public function dt_render_field_for_display_fields( $fields, $field_key, $post ){ - if ( $post && $post['post_type'] === 'contacts' && $field_key === 'assigned_to' ){ + public function dt_render_field_for_display_fields($fields, $field_key, $post) + { + if ($post && $post['post_type'] === 'contacts' && $field_key === 'assigned_to') { $fields['assigned_to']['custom_display'] = true; } return $fields; } - public function dt_render_field_for_display_template( $post, $field_type, $field_key, $required_tag, $display_field_id, $custom_display = false, $fields = [] ){ - $contact_fields = !empty( $fields ) ? $fields : DT_Posts::get_post_field_settings( 'contacts' ); - if ( isset( $post['post_type'] ) && isset( $post['ID'] ) ) { - $can_update = DT_Posts::can_update( $post['post_type'], $post['ID'] ); + public function dt_render_field_for_display_template($post, $field_type, $field_key, $required_tag, $display_field_id, $custom_display = false, $fields = []) + { + $contact_fields = !empty($fields) ? $fields : DT_Posts::get_post_field_settings('contacts'); + if (isset($post['post_type']) && isset($post['ID'])) { + $can_update = DT_Posts::can_update($post['post_type'], $post['ID']); } else { $can_update = true; } $disabled = 'disabled'; - if ( $can_update || isset( $post['assigned_to']['id'] ) && $post['assigned_to']['id'] == get_current_user_id() ) { + if ($can_update || isset($post['assigned_to']['id']) && $post['assigned_to']['id'] == get_current_user_id()) { $disabled = ''; } - if ( isset( $post['post_type'] ) && $post['post_type'] === 'contacts' && $field_key === 'overall_status' - && isset( $contact_fields[$field_key] ) && $custom_display - && empty( $contact_fields[$field_key]['hidden'] ) - ){ + if ( + isset($post['post_type']) && $post['post_type'] === 'contacts' && $field_key === 'overall_status' + && isset($contact_fields[$field_key]) && $custom_display + && empty($contact_fields[$field_key]['hidden']) + ) { $contact = $post; - if ( !dt_field_enabled_for_record_type( $contact_fields[$field_key], $post ) ){ + if (!dt_field_enabled_for_record_type($contact_fields[$field_key], $post)) { return; } ?> - $key, - 'label' => $value['label'], - 'color' => $value['color'] ?? null, - ]; - }, array_keys( $options_array ), $options_array ); + $key, + 'label' => $value['label'], + 'color' => $value['color'] ?? null, + ]; + }, array_keys($options_array), $options_array); - if ( isset( $contact_fields[$field_key]['icon'] ) && !empty( $contact_fields[$field_key]['icon'] ) ) { - $icon = 'icon=' . esc_attr( $contact_fields[$field_key]['icon'] ); - } - ?> - - options="" - value=""> - - - -

    - - + + options="" + value=""> + + + +

    + + - - -

    + } + ?> + + +

    -

    -

    -

    +

    +

    +

    -
    -

    -

    -

    +

    +

    +

    - -
    -

    -

    -

    +

    +

    +

    -
    @@ -589,29 +611,36 @@ public function dt_render_field_for_display_template( $post, $field_type, $field } - if ( isset( $post['post_type'] ) && $post['post_type'] === 'contacts' && $field_key === 'assigned_to' - && isset( $contact_fields[$field_key] ) && !empty( $contact_fields[$field_key]['custom_display'] ) - && empty( $contact_fields[$field_key]['hidden'] ) ){ - $button_class =( current_user_can( 'dt_all_access_contacts' ) || current_user_can( 'list_users' ) ) ? 'advanced_user_select' : 'search_assigned_to' - ?> + if ( + isset($post['post_type']) && $post['post_type'] === 'contacts' && $field_key === 'assigned_to' + && isset($contact_fields[$field_key]) && !empty($contact_fields[$field_key]['custom_display']) + && empty($contact_fields[$field_key]['hidden']) + ) { + $button_class = (current_user_can('dt_all_access_contacts') || current_user_can('list_users')) ? 'advanced_user_select' : 'search_assigned_to' + ?>
    - - + +
    -
    - -
    +
    + +
    - > + > - @@ -620,77 +649,87 @@ public function dt_render_field_for_display_template( $post, $field_type, $field
    [ - 'label' => __( 'Multipliers', 'disciple_tools' ) + 'label' => __('Multipliers', 'disciple_tools') ], 'dispatcher' => [ - 'label' => __( 'Dispatchers', 'disciple_tools' ) + 'label' => __('Dispatchers', 'disciple_tools') ], 'marketer' => [ - 'label' => __( 'Digital Responders', 'disciple_tools' ) + 'label' => __('Digital Responders', 'disciple_tools') ], ]; - if ( $is_dispatcher ) { ?> -
    -
    -
    -

    -
    -
      - $value ) : ?> -
    • - - - -
    • - -
    -
    + +
    ID ) { ?> + if ( + isset($contact['overall_status']) && $contact['overall_status']['key'] == 'assigned' && + isset($contact['assigned_to']) && $contact['assigned_to']['id'] == $current_user->ID + ) { ?>
    -

    - - +

    + +
    $value ){ - if ( strpos( $field_key, 'quick_button' ) !== false ){ - self::handle_quick_action_button_event( $post_id, [ $field_key => $value ] ); + foreach ($fields as $field_key => $value) { + if (strpos($field_key, 'quick_button') !== false) { + self::handle_quick_action_button_event($post_id, [$field_key => $value]); } } - if ( isset( $fields['overall_status'], $fields['reason_paused'] ) && $fields['overall_status'] === 'paused' ){ + if (isset($fields['overall_status'], $fields['reason_paused']) && $fields['overall_status'] === 'paused') { $fields['requires_update'] = false; } - if ( isset( $fields['overall_status'], $fields['reason_closed'] ) && $fields['overall_status'] === 'closed' ){ + if (isset($fields['overall_status'], $fields['reason_closed']) && $fields['overall_status'] === 'closed') { $fields['requires_update'] = false; } //if a contact type is changed to access - if ( isset( $fields['type'] ) && $fields['type'] === 'access' ){ + if (isset($fields['type']) && $fields['type'] === 'access') { //set the status to active if there is no status - if ( !isset( $existing_post['overall_status'] ) && !isset( $fields['overall_status'] ) ){ + if (!isset($existing_post['overall_status']) && !isset($fields['overall_status'])) { $fields['overall_status'] = 'active'; } //assign the contact to the user - if ( !isset( $existing_post['assigned_to'] ) && !isset( $fields['assigned_to'] ) && get_current_user_id() ){ + if (!isset($existing_post['assigned_to']) && !isset($fields['assigned_to']) && get_current_user_id()) { $fields['assigned_to'] = get_current_user_id(); } } @@ -752,90 +792,94 @@ public function dt_post_update_fields( $fields, $post_type, $post_id, $existing_ return $fields; } - public function dt_comment_created( $post_type, $post_id, $created_comment_id, $comment_type ){ - if ( $post_type === 'contacts' ){ - if ( $comment_type === 'comment' ){ - self::check_requires_update( $post_id ); + public function dt_comment_created($post_type, $post_id, $created_comment_id, $comment_type) + { + if ($post_type === 'contacts') { + if ($comment_type === 'comment') { + self::check_requires_update($post_id); } } } // Runs after post is created and fields are processed. - public function dt_post_created( $post_type, $post_id, $initial_request_fields ){ - if ( $post_type === 'contacts' ){ - $post = DT_Posts::get_post( $post_type, $post_id, true, false ); - if ( !isset( $post['type']['key'] ) || $post['type']['key'] !== 'access' ){ + public function dt_post_created($post_type, $post_id, $initial_request_fields) + { + if ($post_type === 'contacts') { + $post = DT_Posts::get_post($post_type, $post_id, true, false); + if (!isset($post['type']['key']) || $post['type']['key'] !== 'access') { return; } //check for duplicate along other access contacts - $this->check_for_duplicates( $post_type, $post_id ); + $this->check_for_duplicates($post_type, $post_id); } } // Add, remove or modify fields before the fields are processed on post create. - public function dt_post_create_fields( $fields, $post_type ){ - if ( $post_type !== 'contacts' ){ + public function dt_post_create_fields($fields, $post_type) + { + if ($post_type !== 'contacts') { return $fields; } - if ( isset( $fields['additional_meta']['created_from'] ) ){ - $from_post = DT_Posts::get_post( 'contacts', $fields['additional_meta']['created_from'], true, false ); - if ( !is_wp_error( $from_post ) && isset( $from_post['type']['key'] ) && $from_post['type']['key'] === 'access' ){ + if (isset($fields['additional_meta']['created_from'])) { + $from_post = DT_Posts::get_post('contacts', $fields['additional_meta']['created_from'], true, false); + if (!is_wp_error($from_post) && isset($from_post['type']['key']) && $from_post['type']['key'] === 'access') { $fields['type'] = 'access_placeholder'; } } - if ( !isset( $fields['type'] ) && isset( $fields['sources'] ) ){ - if ( !empty( $fields['sources'] ) ){ + if (!isset($fields['type']) && isset($fields['sources'])) { + if (!empty($fields['sources'])) { $fields['type'] = 'access'; } } //If a contact is created via site link or externally without a source, make sure the contact is accessible - if ( !isset( $fields['type'] ) && get_current_user_id() === 0 ){ + if (!isset($fields['type']) && get_current_user_id() === 0) { $fields['type'] = 'access'; } - if ( !isset( $fields['type'] ) || $fields['type'] !== 'access' ){ + if (!isset($fields['type']) || $fields['type'] !== 'access') { return $fields; } - if ( !isset( $fields['seeker_path'] ) ){ + if (!isset($fields['seeker_path'])) { $fields['seeker_path'] = 'none'; } - if ( !isset( $fields['assigned_to'] ) ){ - if ( get_current_user_id() ) { - $fields['assigned_to'] = sprintf( 'user-%d', get_current_user_id() ); + if (!isset($fields['assigned_to'])) { + if (get_current_user_id()) { + $fields['assigned_to'] = sprintf('user-%d', get_current_user_id()); } else { - $base_id = dt_get_base_user( true ); - if ( is_wp_error( $base_id ) ) { // if default editor does not exist, get available administrator - $users = get_users( [ 'role' => 'administrator' ] ); - if ( count( $users ) > 0 ) { - foreach ( $users as $user ) { + $base_id = dt_get_base_user(true); + if (is_wp_error($base_id)) { // if default editor does not exist, get available administrator + $users = get_users(['role' => 'administrator']); + if (count($users) > 0) { + foreach ($users as $user) { $base_id = $user->ID; } } } - if ( !empty( $base_id ) ){ - $fields['assigned_to'] = sprintf( 'user-%d', $base_id ); + if (!empty($base_id)) { + $fields['assigned_to'] = sprintf('user-%d', $base_id); } } } - if ( !isset( $fields['overall_status'] ) ){ - if ( get_current_user_id() ){ + if (!isset($fields['overall_status'])) { + if (get_current_user_id()) { $fields['overall_status'] = 'active'; } else { $fields['overall_status'] = 'new'; } } - if ( !isset( $fields['sources'] ) ) { - $fields['sources'] = [ 'values' => [ [ 'value' => 'personal' ] ] ]; + if (!isset($fields['sources'])) { + $fields['sources'] = ['values' => [['value' => 'personal']]]; } return $fields; } //Runs after fields are processed on update - public function dt_post_updated( $post_type, $post_id, $initial_request_fields, $post_fields_before_update, $contact ){ - if ( $post_type === 'contacts' ){ - if ( !isset( $contact['type']['key'] ) || $contact['type']['key'] !== 'access' ){ + public function dt_post_updated($post_type, $post_id, $initial_request_fields, $post_fields_before_update, $contact) + { + if ($post_type === 'contacts') { + if (!isset($contact['type']['key']) || $contact['type']['key'] !== 'access') { return; } - self::check_seeker_path( $post_id, $contact, $post_fields_before_update ); + self::check_seeker_path($post_id, $contact, $post_fields_before_update); } } @@ -848,78 +892,86 @@ public function dt_post_updated( $post_type, $post_id, $initial_request_fields, * @param $contact * @param $previous_values */ - public function check_seeker_path( $contact_id, $contact, $previous_values ){ - if ( isset( $contact['seeker_path']['key'] ) && $contact['seeker_path']['key'] != 'none' ){ + public function check_seeker_path($contact_id, $contact, $previous_values) + { + if (isset($contact['seeker_path']['key']) && $contact['seeker_path']['key'] != 'none') { $current_key = $contact['seeker_path']['key']; - $prev_key = isset( $previous_values['seeker_path']['key'] ) ? $previous_values['seeker_path']['key'] : 'none'; - $field_settings = DT_Posts::get_post_field_settings( 'contacts' ); + $prev_key = isset($previous_values['seeker_path']['key']) ? $previous_values['seeker_path']['key'] : 'none'; + $field_settings = DT_Posts::get_post_field_settings('contacts'); $seeker_path_options = $field_settings['seeker_path']['default']; - $option_keys = array_keys( $seeker_path_options ); - $current_index = array_search( $current_key, $option_keys ); - $prev_option_key = $option_keys[ $current_index - 1 ]; + $option_keys = array_keys($seeker_path_options); + $current_index = array_search($current_key, $option_keys); + $prev_option_key = $option_keys[$current_index - 1]; - if ( $prev_option_key != $prev_key && $current_index > array_search( $prev_key, $option_keys ) ){ + if ($prev_option_key != $prev_key && $current_index > array_search($prev_key, $option_keys)) { global $wpdb; - $seeker_path_activity = $wpdb->get_results( $wpdb->prepare( " + $seeker_path_activity = $wpdb->get_results($wpdb->prepare(" SELECT meta_value, hist_time, meta_id FROM $wpdb->dt_activity_log WHERE object_id = %s AND meta_key = 'seeker_path' - ", $contact_id), ARRAY_A ); + ", $contact_id), ARRAY_A); $existing_keys = []; $most_recent = 0; $meta_id = 0; - foreach ( $seeker_path_activity as $activity ){ + foreach ($seeker_path_activity as $activity) { $existing_keys[] = $activity['meta_value']; - if ( $activity['hist_time'] > $most_recent ){ + if ($activity['hist_time'] > $most_recent) { $most_recent = $activity['hist_time']; } $meta_id = $activity['meta_id']; } $activity_to_create = []; - for ( $i = $current_index; $i > 0; $i-- ){ - if ( !in_array( $option_keys[$i], $existing_keys ) ){ + for ($i = $current_index; $i > 0; $i--) { + if (!in_array($option_keys[$i], $existing_keys)) { $activity_to_create[] = $option_keys[$i]; } } - foreach ( $activity_to_create as $missing_key ){ - $wpdb->query( $wpdb->prepare(" + foreach ($activity_to_create as $missing_key) { + $wpdb->query($wpdb->prepare( + " INSERT INTO $wpdb->dt_activity_log ( action, object_type, object_subtype, object_id, user_id, hist_time, meta_id, meta_key, meta_value, field_type ) VALUES ( 'field_update', 'contacts', 'seeker_path', %s, %d, %d, %d, 'seeker_path', %s, 'key_select' )", - $contact_id, get_current_user_id(), $most_recent - 1, $meta_id, $missing_key - )); + $contact_id, + get_current_user_id(), + $most_recent - 1, + $meta_id, + $missing_key + ) + ); } } } } //list page filters function - public static function dt_user_list_filters( $filters, $post_type ){ - if ( $post_type === 'contacts' ){ - $performance_mode = get_option( 'dt_performance_mode', false ); - $fields = DT_Posts::get_post_field_settings( $post_type ); + public static function dt_user_list_filters($filters, $post_type) + { + if ($post_type === 'contacts') { + $performance_mode = get_option('dt_performance_mode', false); + $fields = DT_Posts::get_post_field_settings($post_type); /** * Setup my contacts filters */ - if ( !$performance_mode ){ + if (!$performance_mode) { $counts = self::get_my_contacts_status_seeker_path(); $active_counts = []; $update_needed = 0; $status_counts = []; $total_my = 0; - foreach ( $counts as $count ){ + foreach ($counts as $count) { $total_my += $count['count']; - dt_increment( $status_counts[$count['overall_status']], $count['count'] ); - if ( $count['overall_status'] === 'active' ){ - if ( isset( $count['update_needed'] ) ) { + dt_increment($status_counts[$count['overall_status']], $count['count']); + if ($count['overall_status'] === 'active') { + if (isset($count['update_needed'])) { $update_needed += (int) $count['update_needed']; } - dt_increment( $active_counts[$count['seeker_path']], $count['count'] ); + dt_increment($active_counts[$count['seeker_path']], $count['count']); } } - if ( !isset( $status_counts['closed'] ) ) { + if (!isset($status_counts['closed'])) { $status_counts['closed'] = ''; } } @@ -928,88 +980,88 @@ public static function dt_user_list_filters( $filters, $post_type ){ $filters['filters'][] = [ 'ID' => 'my_all', 'tab' => 'default', - 'name' => __( 'My Follow-Up', 'disciple_tools' ), + 'name' => __('My Follow-Up', 'disciple_tools'), 'query' => [ - 'assigned_to' => [ 'me' ], - 'subassigned' => [ 'me' ], - 'combine' => [ 'subassigned' ], - 'overall_status' => [ '-closed' ], - 'type' => [ 'access' ], + 'assigned_to' => ['me'], + 'subassigned' => ['me'], + 'combine' => ['subassigned'], + 'overall_status' => ['-closed'], + 'type' => ['access'], 'sort' => 'overall_status', ], 'labels' => [ - [ 'name' => __( 'My Follow-Up', 'disciple_tools' ), 'field' => 'combine', 'id' => 'subassigned' ], - [ 'name' => __( 'Assigned to me', 'disciple_tools' ), 'field' => 'assigned_to', 'id' => 'me' ], - [ 'name' => __( 'Sub-assigned to me', 'disciple_tools' ), 'field' => 'subassigned', 'id' => 'me' ], + ['name' => __('My Follow-Up', 'disciple_tools'), 'field' => 'combine', 'id' => 'subassigned'], + ['name' => __('Assigned to me', 'disciple_tools'), 'field' => 'assigned_to', 'id' => 'me'], + ['name' => __('Sub-assigned to me', 'disciple_tools'), 'field' => 'subassigned', 'id' => 'me'], ], 'count' => $total_my ?? '', ]; - foreach ( $fields['overall_status']['default'] as $status_key => $status_value ) { - if ( isset( $status_counts[$status_key] ) || $performance_mode ) { + foreach ($fields['overall_status']['default'] as $status_key => $status_value) { + if (isset($status_counts[$status_key]) || $performance_mode) { $filters['filters'][] = [ 'ID' => 'my_' . $status_key, 'tab' => 'default', 'name' => $status_value['label'], 'query' => [ - 'assigned_to' => [ 'me' ], - 'subassigned' => [ 'me' ], - 'combine' => [ 'subassigned' ], - 'type' => [ 'access' ], - 'overall_status' => [ $status_key ], + 'assigned_to' => ['me'], + 'subassigned' => ['me'], + 'combine' => ['subassigned'], + 'type' => ['access'], + 'overall_status' => [$status_key], 'sort' => 'seeker_path' ], 'labels' => [ - [ 'name' => $status_value['label'] ], - [ 'name' => __( 'Assigned to me', 'disciple_tools' ), 'field' => 'assigned_to', 'id' => 'me' ], - [ 'name' => __( 'Sub-assigned to me', 'disciple_tools' ), 'field' => 'subassigned', 'id' => 'me' ], + ['name' => $status_value['label']], + ['name' => __('Assigned to me', 'disciple_tools'), 'field' => 'assigned_to', 'id' => 'me'], + ['name' => __('Sub-assigned to me', 'disciple_tools'), 'field' => 'subassigned', 'id' => 'me'], ], 'count' => $status_counts[$status_key] ?? '', 'subfilter' => 1 ]; - if ( $status_key === 'active' ){ - if ( ( $update_needed ?? 0 ) > 0 ){ + if ($status_key === 'active') { + if (($update_needed ?? 0) > 0) { $filters['filters'][] = [ 'ID' => 'my_update_needed', 'tab' => 'default', 'name' => $fields['requires_update']['name'], 'query' => [ - 'assigned_to' => [ 'me' ], - 'subassigned' => [ 'me' ], - 'combine' => [ 'subassigned' ], - 'overall_status' => [ 'active' ], - 'requires_update' => [ true ], - 'type' => [ 'access' ], + 'assigned_to' => ['me'], + 'subassigned' => ['me'], + 'combine' => ['subassigned'], + 'overall_status' => ['active'], + 'requires_update' => [true], + 'type' => ['access'], 'sort' => 'seeker_path' ], 'labels' => [ - [ 'name' => $fields['requires_update']['name'] ], - [ 'name' => __( 'Assigned to me', 'disciple_tools' ), 'field' => 'assigned_to', 'id' => 'me' ], - [ 'name' => __( 'Sub-assigned to me', 'disciple_tools' ), 'field' => 'subassigned', 'id' => 'me' ], + ['name' => $fields['requires_update']['name']], + ['name' => __('Assigned to me', 'disciple_tools'), 'field' => 'assigned_to', 'id' => 'me'], + ['name' => __('Sub-assigned to me', 'disciple_tools'), 'field' => 'subassigned', 'id' => 'me'], ], 'count' => $update_needed ?? '', 'subfilter' => 2 ]; } - if ( isset( $fields['seeker_path']['default'] ) && is_array( $fields['seeker_path']['default'] ) ){ - foreach ( $fields['seeker_path']['default'] as $seeker_path_key => $seeker_path_value ){ - if ( isset( $active_counts[$seeker_path_key] ) || $performance_mode ){ + if (isset($fields['seeker_path']['default']) && is_array($fields['seeker_path']['default'])) { + foreach ($fields['seeker_path']['default'] as $seeker_path_key => $seeker_path_value) { + if (isset($active_counts[$seeker_path_key]) || $performance_mode) { $filters['filters'][] = [ 'ID' => 'my_' . $seeker_path_key, 'tab' => 'default', 'name' => $seeker_path_value['label'], 'query' => [ - 'assigned_to' => [ 'me' ], - 'subassigned' => [ 'me' ], - 'combine' => [ 'subassigned' ], - 'overall_status' => [ 'active' ], - 'seeker_path' => [ $seeker_path_key ], - 'type' => [ 'access' ], + 'assigned_to' => ['me'], + 'subassigned' => ['me'], + 'combine' => ['subassigned'], + 'overall_status' => ['active'], + 'seeker_path' => [$seeker_path_key], + 'type' => ['access'], 'sort' => 'name' ], 'labels' => [ - [ 'name' => $seeker_path_value['label'] ], - [ 'name' => __( 'Assigned to me', 'disciple_tools' ), 'field' => 'assigned_to', 'id' => 'me' ], - [ 'name' => __( 'Sub-assigned to me', 'disciple_tools' ), 'field' => 'subassigned', 'id' => 'me' ], + ['name' => $seeker_path_value['label']], + ['name' => __('Assigned to me', 'disciple_tools'), 'field' => 'assigned_to', 'id' => 'me'], + ['name' => __('Sub-assigned to me', 'disciple_tools'), 'field' => 'subassigned', 'id' => 'me'], ], 'count' => $active_counts[$seeker_path_key] ?? '', 'subfilter' => 2 @@ -1024,31 +1076,31 @@ public static function dt_user_list_filters( $filters, $post_type ){ /** * Setup dispatcher filters */ - if ( current_user_can( 'dt_all_access_contacts' ) || current_user_can( 'access_specific_sources' ) ) { - if ( !$performance_mode ){ + if (current_user_can('dt_all_access_contacts') || current_user_can('access_specific_sources')) { + if (!$performance_mode) { $counts = self::get_all_contacts_status_seeker_path(); $all_active_counts = []; $all_update_needed = 0; $all_status_counts = []; $total_all = 0; - foreach ( $counts as $count ){ + foreach ($counts as $count) { $total_all += $count['count']; - dt_increment( $all_status_counts[$count['overall_status']], $count['count'] ); - if ( $count['overall_status'] === 'active' ){ - if ( isset( $count['update_needed'] ) ) { + dt_increment($all_status_counts[$count['overall_status']], $count['count']); + if ($count['overall_status'] === 'active') { + if (isset($count['update_needed'])) { $all_update_needed += (int) $count['update_needed']; } - dt_increment( $all_active_counts[$count['seeker_path']], $count['count'] ); + dt_increment($all_active_counts[$count['seeker_path']], $count['count']); } } - if ( !isset( $all_status_counts['closed'] ) ) { + if (!isset($all_status_counts['closed'])) { $all_status_counts['closed'] = ''; } } $filters['tabs'][] = [ 'key' => 'all_dispatch', -// "label" => __( "Follow-Up", 'disciple_tools' ), - 'label' => sprintf( _x( 'Follow-Up %s', 'All records', 'disciple_tools' ), DT_Posts::get_post_settings( $post_type )['label_plural'] ), + // "label" => __( "Follow-Up", 'disciple_tools' ), + 'label' => sprintf(_x('Follow-Up %s', 'All records', 'disciple_tools'), DT_Posts::get_post_settings($post_type)['label_plural']), 'count' => $total_all ?? '', 'order' => 10 ]; @@ -1056,55 +1108,55 @@ public static function dt_user_list_filters( $filters, $post_type ){ $filters['filters'][] = [ 'ID' => 'all_dispatch', 'tab' => 'all_dispatch', - 'name' => __( 'All Follow-Up', 'disciple_tools' ), + 'name' => __('All Follow-Up', 'disciple_tools'), 'query' => [ - 'overall_status' => [ '-closed' ], - 'type' => [ 'access' ], + 'overall_status' => ['-closed'], + 'type' => ['access'], 'sort' => 'overall_status' ], 'count' => $total_all ?? '', ]; - foreach ( $fields['overall_status']['default'] as $status_key => $status_value ) { - if ( isset( $all_status_counts[$status_key] ) || $performance_mode ) { + foreach ($fields['overall_status']['default'] as $status_key => $status_value) { + if (isset($all_status_counts[$status_key]) || $performance_mode) { $filters['filters'][] = [ 'ID' => 'all_' . $status_key, 'tab' => 'all_dispatch', 'name' => $status_value['label'], 'query' => [ - 'overall_status' => [ $status_key ], - 'type' => [ 'access' ], + 'overall_status' => [$status_key], + 'type' => ['access'], 'sort' => 'seeker_path' ], 'count' => $all_status_counts[$status_key] ?? '' ]; - if ( $status_key === 'active' ){ - if ( ( $all_update_needed ?? 0 ) > 0 || $performance_mode ){ + if ($status_key === 'active') { + if (($all_update_needed ?? 0) > 0 || $performance_mode) { $filters['filters'][] = [ 'ID' => 'all_update_needed', 'tab' => 'all_dispatch', 'name' => $fields['requires_update']['name'], 'query' => [ - 'overall_status' => [ 'active' ], - 'requires_update' => [ true ], - 'type' => [ 'access' ], + 'overall_status' => ['active'], + 'requires_update' => [true], + 'type' => ['access'], 'sort' => 'seeker_path' ], 'count' => $all_update_needed ?? '', 'subfilter' => true ]; } - if ( isset( $fields['seeker_path']['default'] ) && is_array( $fields['seeker_path']['default'] ) ) { - foreach ( $fields['seeker_path']['default'] as $seeker_path_key => $seeker_path_value ) { - if ( isset( $all_active_counts[$seeker_path_key] ) || $performance_mode ) { + if (isset($fields['seeker_path']['default']) && is_array($fields['seeker_path']['default'])) { + foreach ($fields['seeker_path']['default'] as $seeker_path_key => $seeker_path_value) { + if (isset($all_active_counts[$seeker_path_key]) || $performance_mode) { $filters['filters'][] = [ 'ID' => 'all_' . $seeker_path_key, 'tab' => 'all_dispatch', 'name' => $seeker_path_value['label'], 'query' => [ - 'overall_status' => [ 'active' ], - 'seeker_path' => [ $seeker_path_key ], - 'type' => [ 'access' ], + 'overall_status' => ['active'], + 'seeker_path' => [$seeker_path_key], + 'type' => ['access'], 'sort' => 'name' ], 'count' => $all_active_counts[$seeker_path_key] ?? '', @@ -1117,14 +1169,15 @@ public static function dt_user_list_filters( $filters, $post_type ){ } } } - $filters['filters'] = self::add_default_custom_list_filters( $filters['filters'] ); + $filters['filters'] = self::add_default_custom_list_filters($filters['filters']); } return $filters; } //list page filters function - private static function add_default_custom_list_filters( $filters ){ - if ( empty( $filters ) ){ + private static function add_default_custom_list_filters($filters) + { + if (empty($filters)) { $filters = []; } $default_filters = [ @@ -1135,7 +1188,7 @@ private static function add_default_custom_list_filters( $filters ){ 'tab' => 'custom', 'name' => 'Subassigned to me', 'query' => [ - 'subassigned' => [ 'me' ], + 'subassigned' => ['me'], 'sort' => 'overall_status', ], 'labels' => [ @@ -1147,38 +1200,39 @@ private static function add_default_custom_list_filters( $filters ){ ], ], ]; - $contact_filter_ids = array_map( function ( $a ){ + $contact_filter_ids = array_map(function ($a) { return $a['ID']; - }, $filters ); - foreach ( $default_filters as $filter ) { - if ( !in_array( $filter['ID'], $contact_filter_ids ) ){ - array_unshift( $filters, $filter ); + }, $filters); + foreach ($default_filters as $filter) { + if (!in_array($filter['ID'], $contact_filter_ids)) { + array_unshift($filters, $filter); } } //translation for default fields - foreach ( $filters as $index => $filter ) { - if ( $filter['name'] === 'Subassigned to me' ) { - $filters[$index]['name'] = __( 'Subassigned only', 'disciple_tools' ); - $filters[$index]['labels'][0]['name'] = __( 'Subassigned only', 'disciple_tools' ); + foreach ($filters as $index => $filter) { + if ($filter['name'] === 'Subassigned to me') { + $filters[$index]['name'] = __('Subassigned only', 'disciple_tools'); + $filters[$index]['labels'][0]['name'] = __('Subassigned only', 'disciple_tools'); } } return $filters; } //list page filters function - private static function get_all_contacts_status_seeker_path(){ + private static function get_all_contacts_status_seeker_path() + { global $wpdb; $results = []; $can_view_all = false; - if ( current_user_can( 'access_specific_sources' ) ) { - $sources = get_user_option( 'allowed_sources', get_current_user_id() ) ?: []; - if ( empty( $sources ) || in_array( 'all', $sources ) ) { + if (current_user_can('access_specific_sources')) { + $sources = get_user_option('allowed_sources', get_current_user_id()) ?: []; + if (empty($sources) || in_array('all', $sources)) { $can_view_all = true; } } - if ( current_user_can( 'dt_all_access_contacts' ) || $can_view_all ) { + if (current_user_can('dt_all_access_contacts') || $can_view_all) { $results = $wpdb->get_results(" SELECT status.meta_value as overall_status, pm.meta_value as seeker_path, count(pm.post_id) as count, count(un.post_id) as update_needed FROM $wpdb->postmeta pm @@ -1189,11 +1243,11 @@ private static function get_all_contacts_status_seeker_path(){ WHERE pm.meta_key = 'seeker_path' GROUP BY status.meta_value, pm.meta_value ", ARRAY_A); - } else if ( current_user_can( 'access_specific_sources' ) ) { - $sources = get_user_option( 'allowed_sources', get_current_user_id() ) ?: []; - $sources_sql = dt_array_to_sql( $sources ); + } else if (current_user_can('access_specific_sources')) { + $sources = get_user_option('allowed_sources', get_current_user_id()) ?: []; + $sources_sql = dt_array_to_sql($sources); // phpcs:disable - $results = $wpdb->get_results( $wpdb->prepare( " + $results = $wpdb->get_results($wpdb->prepare(" SELECT status.meta_value as overall_status, pm.meta_value as seeker_path, count(pm.post_id) as count, count(un.post_id) as update_needed FROM $wpdb->postmeta pm INNER JOIN $wpdb->postmeta status ON( status.post_id = pm.post_id AND status.meta_key = 'overall_status' AND status.meta_value != 'closed' ) @@ -1206,17 +1260,18 @@ private static function get_all_contacts_status_seeker_path(){ OR pm.post_id IN ( SELECT post_id FROM $wpdb->dt_share AS shares where shares.user_id = %s ) ) GROUP BY status.meta_value, pm.meta_value - ", esc_sql( get_current_user_id() ) ) , ARRAY_A ); + ", esc_sql(get_current_user_id())), ARRAY_A); // phpcs:enable } return $results; } //list page filters function - private static function get_my_contacts_status_seeker_path(){ + private static function get_my_contacts_status_seeker_path() + { global $wpdb; - $user_post = Disciple_Tools_Users::get_contact_for_user( get_current_user_id() ) ?? 0; - $results = $wpdb->get_results( $wpdb->prepare( " + $user_post = Disciple_Tools_Users::get_contact_for_user(get_current_user_id()) ?? 0; + $results = $wpdb->get_results($wpdb->prepare(" SELECT status.meta_value as overall_status, pm.meta_value as seeker_path, count(pm.post_id) as count, count(un.post_id) as update_needed FROM $wpdb->postmeta pm INNER JOIN $wpdb->postmeta status ON( status.post_id = pm.post_id AND status.meta_key = 'overall_status' AND status.meta_value != 'closed') @@ -1229,24 +1284,25 @@ private static function get_my_contacts_status_seeker_path(){ OR pm.post_id IN ( SELECT p2p_to from $wpdb->p2p WHERE p2p_from = %s AND p2p_type = 'contacts_to_subassigned' ) ) GROUP BY status.meta_value, pm.meta_value - ", get_current_user_id(), $user_post ), ARRAY_A); + ", get_current_user_id(), $user_post), ARRAY_A); return $results; } - public static function dt_filter_access_permissions( $permissions, $post_type ){ - if ( $post_type === 'contacts' ){ - if ( DT_Posts::can_view_all( $post_type ) ){ - $permissions['type'] = [ 'access', 'user', 'access_placeholder' ]; - } else if ( current_user_can( 'dt_all_access_contacts' ) ){ + public static function dt_filter_access_permissions($permissions, $post_type) + { + if ($post_type === 'contacts') { + if (DT_Posts::can_view_all($post_type)) { + $permissions['type'] = ['access', 'user', 'access_placeholder']; + } else if (current_user_can('dt_all_access_contacts')) { //give user permission to all contacts af type 'access' - $permissions[] = [ 'type' => [ 'access', 'user', 'access_placeholder' ] ]; - } else if ( current_user_can( 'access_specific_sources' ) ){ + $permissions[] = ['type' => ['access', 'user', 'access_placeholder']]; + } else if (current_user_can('access_specific_sources')) { //give user permission to all 'access' that also have a source the user can view. - $allowed_sources = get_user_option( 'allowed_sources', get_current_user_id() ) ?: []; - if ( empty( $allowed_sources ) || in_array( 'all', $allowed_sources, true ) ){ - $permissions['type'] = [ 'access', 'access_placeholder' ]; - } elseif ( !in_array( 'restrict_all_sources', $allowed_sources ) ){ - $permissions[] = [ 'type' => [ 'access' ], 'sources' => $allowed_sources]; + $allowed_sources = get_user_option('allowed_sources', get_current_user_id()) ?: []; + if (empty($allowed_sources) || in_array('all', $allowed_sources, true)) { + $permissions['type'] = ['access', 'access_placeholder']; + } elseif (!in_array('restrict_all_sources', $allowed_sources)) { + $permissions[] = ['type' => ['access'], 'sources' => $allowed_sources]; } } } @@ -1254,25 +1310,26 @@ public static function dt_filter_access_permissions( $permissions, $post_type ){ } // filter for access to a specific record - public function can_view_permission_filter( $has_permission, $post_id, $post_type ){ - if ( $post_type === 'contacts' ){ - if ( current_user_can( 'dt_all_access_contacts' ) ){ - $contact_type = get_post_meta( $post_id, 'type', true ); - if ( $contact_type === 'access' || $contact_type === 'user' || $contact_type === 'access_placeholder' ){ + public function can_view_permission_filter($has_permission, $post_id, $post_type) + { + if ($post_type === 'contacts') { + if (current_user_can('dt_all_access_contacts')) { + $contact_type = get_post_meta($post_id, 'type', true); + if ($contact_type === 'access' || $contact_type === 'user' || $contact_type === 'access_placeholder') { return true; } } //check if the user has access to all posts of a specific source - if ( current_user_can( 'access_specific_sources' ) ){ - $contact_type = get_post_meta( $post_id, 'type', true ); - if ( $contact_type === 'access' || $contact_type === 'access_placeholder' ){ - $sources = get_user_option( 'allowed_sources', get_current_user_id() ) ?: []; - if ( empty( $sources ) || in_array( 'all', $sources ) ) { + if (current_user_can('access_specific_sources')) { + $contact_type = get_post_meta($post_id, 'type', true); + if ($contact_type === 'access' || $contact_type === 'access_placeholder') { + $sources = get_user_option('allowed_sources', get_current_user_id()) ?: []; + if (empty($sources) || in_array('all', $sources)) { return true; } - $post_sources = get_post_meta( $post_id, 'sources' ); - foreach ( $post_sources as $s ){ - if ( in_array( $s, $sources ) ){ + $post_sources = get_post_meta($post_id, 'sources'); + foreach ($post_sources as $s) { + if (in_array($s, $sources)) { return true; } } @@ -1281,24 +1338,25 @@ public function can_view_permission_filter( $has_permission, $post_id, $post_typ } return $has_permission; } - public function can_update_permission_filter( $has_permission, $post_id, $post_type ){ - if ( current_user_can( 'dt_all_access_contacts' ) ){ - $contact_type = get_post_meta( $post_id, 'type', true ); - if ( $contact_type === 'access' || $contact_type === 'user' || $contact_type === 'access_placeholder' ){ + public function can_update_permission_filter($has_permission, $post_id, $post_type) + { + if (current_user_can('dt_all_access_contacts')) { + $contact_type = get_post_meta($post_id, 'type', true); + if ($contact_type === 'access' || $contact_type === 'user' || $contact_type === 'access_placeholder') { return true; } } //check if the user has access to all posts of a specific source - if ( current_user_can( 'access_specific_sources' ) ){ - $contact_type = get_post_meta( $post_id, 'type', true ); - if ( $contact_type === 'access' || $contact_type === 'access_placeholder' ){ - $sources = get_user_option( 'allowed_sources', get_current_user_id() ) ?: []; - if ( empty( $sources ) || in_array( 'all', $sources ) ){ + if (current_user_can('access_specific_sources')) { + $contact_type = get_post_meta($post_id, 'type', true); + if ($contact_type === 'access' || $contact_type === 'access_placeholder') { + $sources = get_user_option('allowed_sources', get_current_user_id()) ?: []; + if (empty($sources) || in_array('all', $sources)) { return true; } - $post_sources = get_post_meta( $post_id, 'sources' ); - foreach ( $post_sources as $s ){ - if ( in_array( $s, $sources ) ){ + $post_sources = get_post_meta($post_id, 'sources'); + foreach ($post_sources as $s) { + if (in_array($s, $sources)) { return true; } } @@ -1307,82 +1365,86 @@ public function can_update_permission_filter( $has_permission, $post_id, $post_t return $has_permission; } - public function scripts(){ - if ( is_singular( 'contacts' ) && get_the_ID() && DT_Posts::can_view( $this->post_type, get_the_ID() ) ){ - wp_enqueue_script( 'dt_contacts_access', get_template_directory_uri() . '/dt-contacts/contacts_access.js', [ + public function scripts() + { + if (is_singular('contacts') && get_the_ID() && DT_Posts::can_view($this->post_type, get_the_ID())) { + wp_enqueue_script('dt_contacts_access', get_template_directory_uri() . '/dt-contacts/contacts_access.js', [ 'jquery', - ], filemtime( get_theme_file_path() . '/dt-contacts/contacts_access.js' ), true ); - wp_localize_script( 'dt_contacts_access', 'dt_contacts_access', [ + ], filemtime(get_theme_file_path() . '/dt-contacts/contacts_access.js'), true); + wp_localize_script('dt_contacts_access', 'dt_contacts_access', [ 'translations' => [ - 'all' => __( 'All', 'disciple_tools' ), - 'ready' => __( 'Ready', 'disciple_tools' ), - 'recent' => __( 'Recent', 'disciple_tools' ), - 'location' => __( 'Location', 'disciple_tools' ), - 'assign' => __( 'Assign', 'disciple_tools' ), - 'language' => __( 'Language', 'disciple_tools' ), - 'gender' => __( 'Gender', 'disciple_tools' ), + 'all' => __('All', 'disciple_tools'), + 'ready' => __('Ready', 'disciple_tools'), + 'recent' => __('Recent', 'disciple_tools'), + 'location' => __('Location', 'disciple_tools'), + 'assign' => __('Assign', 'disciple_tools'), + 'language' => __('Language', 'disciple_tools'), + 'gender' => __('Gender', 'disciple_tools'), ], - ] ); + ]); } } - private static function handle_quick_action_button_event( int $contact_id, array $field, bool $check_permissions = true ) { + private static function handle_quick_action_button_event(int $contact_id, array $field, bool $check_permissions = true) + { $update = []; - $key = key( $field ); + $key = key($field); - if ( $key == 'quick_button_no_answer' ) { + if ($key == 'quick_button_no_answer') { $update['seeker_path'] = 'attempted'; - } elseif ( $key == 'quick_button_phone_off' ) { + } elseif ($key == 'quick_button_phone_off') { $update['seeker_path'] = 'attempted'; - } elseif ( $key == 'quick_button_contact_established' ) { + } elseif ($key == 'quick_button_contact_established') { $update['seeker_path'] = 'established'; - } elseif ( $key == 'quick_button_meeting_scheduled' ) { + } elseif ($key == 'quick_button_meeting_scheduled') { $update['seeker_path'] = 'scheduled'; - } elseif ( $key == 'quick_button_meeting_complete' ) { + } elseif ($key == 'quick_button_meeting_complete') { $update['seeker_path'] = 'met'; } - if ( isset( $update['seeker_path'] ) ) { - self::check_requires_update( $contact_id ); - return self::update_seeker_path( $contact_id, $update['seeker_path'], $check_permissions ); + if (isset($update['seeker_path'])) { + self::check_requires_update($contact_id); + return self::update_seeker_path($contact_id, $update['seeker_path'], $check_permissions); } else { return $contact_id; } } - public static function update_quick_action_buttons( $contact_id, $seeker_path ){ - if ( $seeker_path === 'established' ){ - $quick_button = get_post_meta( $contact_id, 'quick_button_contact_established', true ); - if ( empty( $quick_button ) || $quick_button == '0' ){ - update_post_meta( $contact_id, 'quick_button_contact_established', '1' ); + public static function update_quick_action_buttons($contact_id, $seeker_path) + { + if ($seeker_path === 'established') { + $quick_button = get_post_meta($contact_id, 'quick_button_contact_established', true); + if (empty($quick_button) || $quick_button == '0') { + update_post_meta($contact_id, 'quick_button_contact_established', '1'); } } - if ( $seeker_path === 'scheduled' ){ - $quick_button = get_post_meta( $contact_id, 'quick_button_meeting_scheduled', true ); - if ( empty( $quick_button ) || $quick_button == '0' ){ - update_post_meta( $contact_id, 'quick_button_meeting_scheduled', '1' ); + if ($seeker_path === 'scheduled') { + $quick_button = get_post_meta($contact_id, 'quick_button_meeting_scheduled', true); + if (empty($quick_button) || $quick_button == '0') { + update_post_meta($contact_id, 'quick_button_meeting_scheduled', '1'); } } - if ( $seeker_path === 'met' ){ - $quick_button = get_post_meta( $contact_id, 'quick_button_meeting_complete', true ); - if ( empty( $quick_button ) || $quick_button == '0' ){ - update_post_meta( $contact_id, 'quick_button_meeting_complete', '1' ); + if ($seeker_path === 'met') { + $quick_button = get_post_meta($contact_id, 'quick_button_meeting_complete', true); + if (empty($quick_button) || $quick_button == '0') { + update_post_meta($contact_id, 'quick_button_meeting_complete', '1'); } } - self::check_requires_update( $contact_id ); + self::check_requires_update($contact_id); } - private static function update_seeker_path( int $contact_id, string $path_option, $check_permissions = true ) { - $contact_fields = DT_Posts::get_post_field_settings( 'contacts' ); + private static function update_seeker_path(int $contact_id, string $path_option, $check_permissions = true) + { + $contact_fields = DT_Posts::get_post_field_settings('contacts'); $seeker_path_options = $contact_fields['seeker_path']['default']; - $option_keys = array_keys( $seeker_path_options ); - $current_seeker_path = get_post_meta( $contact_id, 'seeker_path', true ); - $current_index = array_search( $current_seeker_path, $option_keys ); - $new_index = array_search( $path_option, $option_keys ); - if ( $new_index > $current_index ) { + $option_keys = array_keys($seeker_path_options); + $current_seeker_path = get_post_meta($contact_id, 'seeker_path', true); + $current_index = array_search($current_seeker_path, $option_keys); + $new_index = array_search($path_option, $option_keys); + if ($new_index > $current_index) { $current_index = $new_index; - $update = DT_Posts::update_post( 'contacts', $contact_id, [ 'seeker_path' => $path_option ], $check_permissions ); - if ( is_wp_error( $update ) ) { + $update = DT_Posts::update_post('contacts', $contact_id, ['seeker_path' => $path_option], $check_permissions); + if (is_wp_error($update)) { return $update; } $current_seeker_path = $path_option; @@ -1390,69 +1452,71 @@ private static function update_seeker_path( int $contact_id, string $path_option return [ 'currentKey' => $current_seeker_path, - 'current' => $seeker_path_options[ $option_keys[ $current_index ] ], - 'next' => isset( $option_keys[ $current_index + 1 ] ) ? $seeker_path_options[ $option_keys[ $current_index + 1 ] ] : '', + 'current' => $seeker_path_options[$option_keys[$current_index]], + 'next' => isset($option_keys[$current_index + 1]) ? $seeker_path_options[$option_keys[$current_index + 1]] : '', ]; } //check to see if the contact is marked as needing an update //if yes: mark as updated - private static function check_requires_update( $contact_id ){ - if ( get_current_user_id() ){ - $requires_update = get_post_meta( $contact_id, 'requires_update', true ); - if ( $requires_update == 'yes' || $requires_update == true || $requires_update == '1' ){ + private static function check_requires_update($contact_id) + { + if (get_current_user_id()) { + $requires_update = get_post_meta($contact_id, 'requires_update', true); + if ($requires_update == 'yes' || $requires_update == true || $requires_update == '1') { //don't remove update needed if the user is a dispatcher (and not assigned to the contacts.) - if ( current_user_can( 'dt_all_access_contacts' ) ){ - if ( dt_get_user_id_from_assigned_to( get_post_meta( $contact_id, 'assigned_to', true ) ) === get_current_user_id() ){ - update_post_meta( $contact_id, 'requires_update', false ); + if (current_user_can('dt_all_access_contacts')) { + if (dt_get_user_id_from_assigned_to(get_post_meta($contact_id, 'assigned_to', true)) === get_current_user_id()) { + update_post_meta($contact_id, 'requires_update', false); } } else { - update_post_meta( $contact_id, 'requires_update', false ); + update_post_meta($contact_id, 'requires_update', false); } } } } - public static function accept_contact( WP_REST_Request $request ){ + public static function accept_contact(WP_REST_Request $request) + { $params = $request->get_params(); $body = $request->get_json_params() ?? $request->get_body_params(); - if ( !isset( $params['id'] ) ) { - return new WP_Error( 'accept_contact', 'Missing a valid contact id', [ 'status' => 400 ] ); + if (!isset($params['id'])) { + return new WP_Error('accept_contact', 'Missing a valid contact id', ['status' => 400]); } else { $contact_id = $params['id']; $accepted = $body['accept']; - if ( !DT_Posts::can_update( 'contacts', $contact_id ) ) { - return new WP_Error( __FUNCTION__, 'You do not have permission for this', [ 'status' => 403 ] ); + if (!DT_Posts::can_update('contacts', $contact_id)) { + return new WP_Error(__FUNCTION__, 'You do not have permission for this', ['status' => 403]); } - if ( $accepted ) { + if ($accepted) { $update = [ 'overall_status' => 'active', 'accepted' => true ]; dt_activity_insert( [ - 'action' => 'assignment_accepted', - 'object_type' => get_post_type( $contact_id ), + 'action' => 'assignment_accepted', + 'object_type' => get_post_type($contact_id), 'object_subtype' => '', - 'object_name' => get_the_title( $contact_id ), - 'object_id' => $contact_id, - 'meta_id' => '', // id of the comment - 'meta_key' => '', - 'meta_value' => '', - 'meta_parent' => '', - 'object_note' => '', + 'object_name' => get_the_title($contact_id), + 'object_id' => $contact_id, + 'meta_id' => '', // id of the comment + 'meta_key' => '', + 'meta_value' => '', + 'meta_parent' => '', + 'object_note' => '', ] ); - return DT_Posts::update_post( 'contacts', $contact_id, $update, true ); + return DT_Posts::update_post('contacts', $contact_id, $update, true); } else { $assign_to_id = 0; - $last_activity = DT_Posts::get_most_recent_activity_for_field( $contact_id, 'assigned_to' ); - if ( isset( $last_activity->user_id ) ){ + $last_activity = DT_Posts::get_most_recent_activity_for_field($contact_id, 'assigned_to'); + if (isset($last_activity->user_id)) { $assign_to_id = $last_activity->user_id; } else { - $base_user = dt_get_base_user( true ); - if ( $base_user ){ + $base_user = dt_get_base_user(true); + if ($base_user) { $assign_to_id = $base_user; } } @@ -1461,23 +1525,23 @@ public static function accept_contact( WP_REST_Request $request ){ 'assigned_to' => $assign_to_id, 'overall_status' => 'unassigned' ]; - $contact = DT_Posts::update_post( 'contacts', $contact_id, $update, true ); + $contact = DT_Posts::update_post('contacts', $contact_id, $update, true); $current_user = wp_get_current_user(); dt_activity_insert( [ - 'action' => 'assignment_decline', - 'object_type' => get_post_type( $contact_id ), + 'action' => 'assignment_decline', + 'object_type' => get_post_type($contact_id), 'object_subtype' => 'decline', - 'object_name' => get_the_title( $contact_id ), - 'object_id' => $contact_id, - 'meta_id' => '', // id of the comment - 'meta_key' => '', - 'meta_value' => '', - 'meta_parent' => '', - 'object_note' => '' + 'object_name' => get_the_title($contact_id), + 'object_id' => $contact_id, + 'meta_id' => '', // id of the comment + 'meta_key' => '', + 'meta_value' => '', + 'meta_parent' => '', + 'object_note' => '' ] ); - Disciple_Tools_Notifications::insert_notification_for_assignment_declined( $current_user->ID, $assign_to_id, $contact_id ); + Disciple_Tools_Notifications::insert_notification_for_assignment_declined($current_user->ID, $assign_to_id, $contact_id); return $contact; } } @@ -1486,39 +1550,41 @@ public static function accept_contact( WP_REST_Request $request ){ /* * Check other access contacts for possible duplicates */ - private function check_for_duplicates( $post_type, $post_id ){ - if ( get_current_user_id() === 0 ){ + private function check_for_duplicates($post_type, $post_id) + { + if (get_current_user_id() === 0) { $current_user = wp_get_current_user(); - $had_cap = current_user_can( 'dt_all_access_contacts' ); - $current_user->add_cap( 'dt_all_access_contacts' ); - $dup_ids = DT_Duplicate_Checker_And_Merging::ids_of_non_dismissed_duplicates( $post_type, $post_id, true ); - if ( ! is_wp_error( $dup_ids ) && sizeof( $dup_ids['ids'] ) < 10 ){ - $comment = __( 'This record might be a duplicate of: ', 'disciple_tools' ); - foreach ( $dup_ids['ids'] as $id_of_duplicate ){ + $had_cap = current_user_can('dt_all_access_contacts'); + $current_user->add_cap('dt_all_access_contacts'); + $dup_ids = DT_Duplicate_Checker_And_Merging::ids_of_non_dismissed_duplicates($post_type, $post_id, true); + if (!is_wp_error($dup_ids) && sizeof($dup_ids['ids']) < 10) { + $comment = __('This record might be a duplicate of: ', 'disciple_tools'); + foreach ($dup_ids['ids'] as $id_of_duplicate) { $comment .= " \n - [$id_of_duplicate]($id_of_duplicate)"; } $args = [ 'user_id' => 0, - 'comment_author' => __( 'Duplicate Checker', 'disciple_tools' ) + 'comment_author' => __('Duplicate Checker', 'disciple_tools') ]; - DT_Posts::add_post_comment( $post_type, $post_id, $comment, 'duplicate', $args, false, true ); + DT_Posts::add_post_comment($post_type, $post_id, $comment, 'duplicate', $args, false, true); } - if ( !$had_cap ){ - $current_user->remove_cap( 'dt_all_access_contacts' ); + if (!$had_cap) { + $current_user->remove_cap('dt_all_access_contacts'); } } } - public function dt_filter_users_receiving_comment_notification( $users_to_notify, $post_type, $post_id, $comment ){ - if ( $post_type === 'contacts' ){ - $post = DT_Posts::get_post( $post_type, $post_id ); - if ( !is_wp_error( $post ) && isset( $post['type']['key'] ) && $post['type']['key'] === 'access' ){ - $following_all = get_users( [ + public function dt_filter_users_receiving_comment_notification($users_to_notify, $post_type, $post_id, $comment) + { + if ($post_type === 'contacts') { + $post = DT_Posts::get_post($post_type, $post_id); + if (!is_wp_error($post) && isset($post['type']['key']) && $post['type']['key'] === 'access') { + $following_all = get_users([ 'meta_key' => 'dt_follow_all', 'meta_value' => true - ] ); - foreach ( $following_all as $user ){ - if ( !in_array( $user->ID, $users_to_notify ) ){ + ]); + foreach ($following_all as $user) { + if (!in_array($user->ID, $users_to_notify)) { $users_to_notify[] = $user->ID; } } @@ -1528,49 +1594,50 @@ public function dt_filter_users_receiving_comment_notification( $users_to_notify } - public function get_dispatch_list( WP_REST_Request $request ) { - if ( !current_user_can( 'dt_all_access_contacts' ) || !current_user_can( 'list_users' ) ){ - return new WP_Error( __FUNCTION__, __( 'No permission' ), [ 'status' => 403 ] ); + public function get_dispatch_list(WP_REST_Request $request) + { + if (!current_user_can('dt_all_access_contacts') || !current_user_can('list_users')) { + return new WP_Error(__FUNCTION__, __('No permission'), ['status' => 403]); } $params = $request->get_query_params(); - $user_data = DT_User_Management::get_users( true ); + $user_data = DT_User_Management::get_users(true); $last_assignments = $this->get_assignments(); - $location_data = $this->get_location_data( $params['location_ids'] ); + $location_data = $this->get_location_data($params['location_ids']); $gender_data = $this->get_gender_data(); $list = []; $user_fields = Disciple_Tools_Users::get_users_fields(); $workload_status_options = $user_fields['workload_status']['options']; - foreach ( $user_data as $user ) { - $roles = maybe_unserialize( $user['roles'] ); - if ( isset( $roles['multiplier'] ) || isset( $roles['dt_admin'] ) || isset( $roles['dispatcher'] ) || isset( $roles['marketer'] ) ) { + foreach ($user_data as $user) { + $roles = maybe_unserialize($user['roles']); + if (isset($roles['multiplier']) || isset($roles['dt_admin']) || isset($roles['dispatcher']) || isset($roles['marketer'])) { $u = [ - 'name' => wp_specialchars_decode( $user['display_name'] ), + 'name' => wp_specialchars_decode($user['display_name']), 'ID' => $user['ID'], - 'avatar' => get_avatar_url( $user['ID'], [ 'size' => '16' ] ), + 'avatar' => get_avatar_url($user['ID'], ['size' => '16']), 'last_assignment' => $last_assignments[$user['ID']] ?? null, - 'roles' => array_keys( $roles ), + 'roles' => array_keys($roles), 'location' => null, 'languages' => [], 'gender' => null, ]; - $user_languages = get_user_option( 'user_languages', $user['ID'] ); - if ( $user_languages ) { + $user_languages = get_user_option('user_languages', $user['ID']); + if ($user_languages) { $u['languages'] = $user_languages; } //extra information for the dispatcher $workload_status = $user['workload_status'] ?? null; - if ( $workload_status && isset( $workload_status_options[$workload_status]['color'] ) ) { + if ($workload_status && isset($workload_status_options[$workload_status]['color'])) { $u['status'] = $workload_status; $u['status_color'] = $workload_status_options[$workload_status]['color']; } - if ( isset( $location_data[$user['ID']] ) ){ + if (isset($location_data[$user['ID']])) { $u['location'] = $location_data[$user['ID']]['level']; $u['best_location_match'] = $location_data[$user['ID']]['match_name']; } - if ( isset( $gender_data[$user['ID']] ) ) { + if (isset($gender_data[$user['ID']])) { $u['gender'] = $gender_data[$user['ID']]; } @@ -1580,75 +1647,79 @@ public function get_dispatch_list( WP_REST_Request $request ) { } } - return apply_filters( 'dt_get_dispatch_list', $list, $params['post_type'], $params['post_id'] ); + return apply_filters('dt_get_dispatch_list', $list, $params['post_type'], $params['post_id']); } - private function get_assignments() { + private function get_assignments() + { global $wpdb; - $last_assignment_query = $wpdb->get_results( " + $last_assignment_query = $wpdb->get_results( + " SELECT meta_value as user, MAX(hist_time) as assignment_date from $wpdb->dt_activity_log as log WHERE meta_key = 'assigned_to' GROUP by meta_value", - ARRAY_A ); - $last_assignments =[]; - foreach ( $last_assignment_query as $assignment ){ - $user_id = str_replace( 'user-', '', $assignment['user'] ); + ARRAY_A + ); + $last_assignments = []; + foreach ($last_assignment_query as $assignment) { + $user_id = str_replace('user-', '', $assignment['user']); $last_assignments[$user_id] = $assignment['assignment_date']; } return $last_assignments; } - private function get_location_data( $location_ids ) { + private function get_location_data($location_ids) + { global $wpdb; $location_data = []; - if ( isset( $location_ids ) ) { - foreach ( $location_ids as $grid_id ){ - $location = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->dt_location_grid WHERE grid_id = %s", esc_sql( $grid_id ) ), ARRAY_A ); + if (isset($location_ids)) { + foreach ($location_ids as $grid_id) { + $location = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->dt_location_grid WHERE grid_id = %s", esc_sql($grid_id)), ARRAY_A); $levels = []; - if ( $grid_id === '1' ){ + if ($grid_id === '1') { $match_location_ids = '( 1 )'; } else { $match_location_ids = '( '; - for ( $i = 0; $i <= ( (int) $location['level'] ); $i++ ) { - $levels[ $location['admin'. $i . '_grid_id']] = [ 'level' => $i ]; - $match_location_ids .= $location['admin'. $i . '_grid_id'] . ', '; + for ($i = 0; $i <= ((int) $location['level']); $i++) { + $levels[$location['admin' . $i . '_grid_id']] = ['level' => $i]; + $match_location_ids .= $location['admin' . $i . '_grid_id'] . ', '; } $match_location_ids .= ')'; } - $match_location_ids = str_replace( ', )', ' )', $match_location_ids ); + $match_location_ids = str_replace(', )', ' )', $match_location_ids); //phpcs:disable //already sanitized IN value - $location_names = $wpdb->get_results( " + $location_names = $wpdb->get_results(" SELECT alt_name, grid_id FROM $wpdb->dt_location_grid WHERE grid_id IN $match_location_ids ", ARRAY_A); //get users with the same location grid. - $users_in_location = $wpdb->get_results( $wpdb->prepare(" + $users_in_location = $wpdb->get_results($wpdb->prepare(" SELECT user_id, meta_value as grid_id FROM $wpdb->usermeta um WHERE um.meta_key = %s AND um.meta_value IN $match_location_ids - ", "{$wpdb->prefix}location_grid"), ARRAY_A ); + ", "{$wpdb->prefix}location_grid"), ARRAY_A); //phpcs:enable - foreach ( $location_names as $l ){ - if ( isset( $levels[$l['grid_id']] ) ) { + foreach ($location_names as $l) { + if (isset($levels[$l['grid_id']])) { $levels[$l['grid_id']]['name'] = $l['alt_name']; } } //0 if the location is exact match. 1 if the matched location is the parent etc - foreach ( $users_in_location as $l ){ + foreach ($users_in_location as $l) { $level = (int) $location['level'] - $levels[$l['grid_id']]['level']; - if ( !isset( $location_data[$l['user_id']] ) || $location_data[$l['user_id']]['level'] > $level ){ + if (!isset($location_data[$l['user_id']]) || $location_data[$l['user_id']]['level'] > $level) { $location_data[$l['user_id']] = [ 'level' => $level, 'match_name' => $levels[$l['grid_id']]['name'] @@ -1660,17 +1731,20 @@ private function get_location_data( $location_ids ) { return $location_data; } - private function get_gender_data() { + private function get_gender_data() + { global $wpdb; $gender_data = []; - $gender_query = $wpdb->get_results( $wpdb->prepare(" + $gender_query = $wpdb->get_results( + $wpdb->prepare(" SELECT user_id, meta_value as gender from $wpdb->usermeta WHERE meta_key = %s", "{$wpdb->prefix}user_gender"), - ARRAY_A ); + ARRAY_A + ); - foreach ( $gender_query as $data ){ + foreach ($gender_query as $data) { $gender_data[$data['user_id']] = $data['gender']; } @@ -1683,7 +1757,8 @@ private function get_gender_data() { * @param $fields * @return mixed */ - public function dt_users_fields( $fields ){ + public function dt_users_fields($fields) + { $fields['number_new_assigned'] = [ 'label' => 'Accept Needed', 'type' => 'number', diff --git a/dt-core/global-functions.php b/dt-core/global-functions.php index 58bb4a85a4..5abf5e1dea 100755 --- a/dt-core/global-functions.php +++ b/dt-core/global-functions.php @@ -1,7 +1,7 @@ 0 ) { - $elapsed_log = sprintf( '[elapsed:%5dms]', ( $now - $dt_write_log_microtime ) * 1000 ); + $now = microtime(true); + if ($dt_write_log_microtime > 0) { + $elapsed_log = sprintf('[elapsed:%5dms]', ($now - $dt_write_log_microtime) * 1000); } else { $elapsed_log = '[elapsed:-------]'; } $dt_write_log_microtime = $now; - if ( is_array( $log ) || is_object( $log ) ) { - error_log( $elapsed_log . ' ' . print_r( $log, true ) ); + if (is_array($log) || is_object($log)) { + error_log($elapsed_log . ' ' . print_r($log, true)); } else { - error_log( "$elapsed_log $log" ); + error_log("$elapsed_log $log"); } } } } - if ( !function_exists( 'dt_default_email_address' ) ){ - function dt_default_email_address(): string{ - $default_addr = apply_filters( 'wp_mail_from', '' ); + if (!function_exists('dt_default_email_address')) { + function dt_default_email_address(): string + { + $default_addr = apply_filters('wp_mail_from', ''); - if ( empty( $default_addr ) ){ + if (empty($default_addr)) { // Get the site domain and get rid of www. - $sitename = wp_parse_url( network_home_url(), PHP_URL_HOST ); - if ( 'www.' === substr( $sitename, 0, 4 ) ){ - $sitename = substr( $sitename, 4 ); + $sitename = wp_parse_url(network_home_url(), PHP_URL_HOST); + if ('www.' === substr($sitename, 0, 4)) { + $sitename = substr($sitename, 4); } $default_addr = 'wordpress@' . $sitename; @@ -76,11 +78,12 @@ function dt_default_email_address(): string{ } } - if ( !function_exists( 'dt_default_email_name' ) ){ - function dt_default_email_name(): string{ - $default_name = apply_filters( 'wp_mail_from_name', '' ); + if (!function_exists('dt_default_email_name')) { + function dt_default_email_name(): string + { + $default_name = apply_filters('wp_mail_from_name', ''); - if ( empty( $default_name ) ){ + if (empty($default_name)) { $default_name = 'WordPress'; } @@ -88,7 +91,7 @@ function dt_default_email_name(): string{ } } - if ( !function_exists( 'dt_email_template_wrapper' ) ) { + if (!function_exists('dt_email_template_wrapper')) { /** * A function which wraps specified plain text messages within * email template. @@ -96,40 +99,41 @@ function dt_default_email_name(): string{ * @param $message * @param $subject */ - function dt_email_template_wrapper( $message, $subject ) { + function dt_email_template_wrapper($message, $subject) + { // Load email template and replace content placeholder. - $email_template = file_get_contents( trailingslashit( get_template_directory() ) . 'dt-notifications/email-template.html' ); - if ( $email_template ) { + $email_template = file_get_contents(trailingslashit(get_template_directory()) . 'dt-notifications/email-template.html'); + if ($email_template) { // Clean < and > around text links in WP 3.1. - $message = preg_replace( '#<(https?://[^*]+)>#', '$1', $message ); + $message = preg_replace('#<(https?://[^*]+)>#', '$1', $message); // Convert line breaks. - if ( apply_filters( 'dt_email_template_convert_line_breaks', true ) ) { - $message = nl2br( $message ); + if (apply_filters('dt_email_template_convert_line_breaks', true)) { + $message = nl2br($message); } // Convert URLs to links. - if ( apply_filters( 'dt_email_template_convert_urls', true ) ) { - $message = make_clickable( $message ); + if (apply_filters('dt_email_template_convert_urls', true)) { + $message = make_clickable($message); } // Add template to message. - $email_body = str_replace( '{{EMAIL_TEMPLATE_CONTENT}}', $message, $email_template ); + $email_body = str_replace('{{EMAIL_TEMPLATE_CONTENT}}', $message, $email_template); // Add footer to message - $email_body = str_replace( '{{EMAIL_TEMPLATE_FOOTER}}', get_bloginfo( 'name' ), $email_body ); + $email_body = str_replace('{{EMAIL_TEMPLATE_FOOTER}}', get_bloginfo('name'), $email_body); // Replace remaining template variables. - return str_replace( '{{EMAIL_TEMPLATE_TITLE}}', $subject, $email_body ); + return str_replace('{{EMAIL_TEMPLATE_TITLE}}', $subject, $email_body); } return $message; } } - if ( !function_exists( 'dt_is_rest' ) ) { + if (!function_exists('dt_is_rest')) { /** * Checks if the current request is a WP REST API request. * @@ -140,18 +144,21 @@ function dt_email_template_wrapper( $message, $subject ) { * * @returns boolean */ - function dt_is_rest( $namespace = null ) { + function dt_is_rest($namespace = null) + { $prefix = rest_get_url_prefix(); - if ( defined( 'REST_REQUEST' ) && REST_REQUEST - || isset( $_GET['rest_route'] ) - && strpos( trim( sanitize_text_field( wp_unslash( $_GET['rest_route'] ) ), '\\/' ), $prefix, 0 ) === 0 ) { + if ( + defined('REST_REQUEST') && REST_REQUEST + || isset($_GET['rest_route']) + && strpos(trim(sanitize_text_field(wp_unslash($_GET['rest_route'])), '\\/'), $prefix, 0) === 0 + ) { return true; } - $rest_url = wp_parse_url( site_url( $prefix ) ); - $current_url = wp_parse_url( add_query_arg( array() ) ); - $is_rest = strpos( $current_url['path'], $rest_url['path'], 0 ) === 0; - if ( $namespace ){ - return $is_rest && strpos( $current_url['path'], $namespace ) != false; + $rest_url = wp_parse_url(site_url($prefix)); + $current_url = wp_parse_url(add_query_arg(array())); + $is_rest = strpos($current_url['path'], $rest_url['path'], 0) === 0; + if ($namespace) { + return $is_rest && strpos($current_url['path'], $namespace) != false; } else { return $is_rest; } @@ -164,28 +171,29 @@ function dt_is_rest( $namespace = null ) { * will return contacts/3/?param=true * @return string */ - if ( ! function_exists( 'dt_get_url_path' ) ) { - function dt_get_url_path( $ignore_query_parameters = false, $include_host = false ) { - if ( isset( $_SERVER['HTTP_HOST'] ) ) { - $url = ( !isset( $_SERVER['HTTPS'] ) || @( $_SERVER['HTTPS'] != 'on' ) ) ? 'http://'. sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : 'https://'. sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ); - if ( isset( $_SERVER['REQUEST_URI'] ) ) { - $url .= esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ); + if (!function_exists('dt_get_url_path')) { + function dt_get_url_path($ignore_query_parameters = false, $include_host = false) + { + if (isset($_SERVER['HTTP_HOST'])) { + $url = (!isset($_SERVER['HTTPS']) || @($_SERVER['HTTPS'] != 'on')) ? 'http://' . sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])) : 'https://' . sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])); + if (isset($_SERVER['REQUEST_URI'])) { + $url .= esc_url_raw(wp_unslash($_SERVER['REQUEST_URI'])); } //remove query parameters - if ( $ignore_query_parameters ){ - $url = strtok( $url, '?' ); //allow get parameters + if ($ignore_query_parameters) { + $url = strtok($url, '?'); //allow get parameters } //remove the domain part. Ex: https://example.com/ - if ( $include_host === false ) { - $url = trim( str_replace( get_site_url(), '', $url ), '/' ); + if ($include_host === false) { + $url = trim(str_replace(get_site_url(), '', $url), '/'); } //remove trailing '?' - if ( substr( $url, -1 ) === '?' ){ - $url = substr( $url, 0, -1 ); + if (substr($url, -1) === '?') { + $url = substr($url, 0, -1); } // remove trailing '/' - $url = untrailingslashit( $url ); + $url = untrailingslashit($url); return $url; } @@ -193,35 +201,37 @@ function dt_get_url_path( $ignore_query_parameters = false, $include_host = fals } } - if ( ! function_exists( 'dt_get_post_type' ) ) { + if (!function_exists('dt_get_post_type')) { /** * The post type as found in the url returned by dt_get_url_path * https://example.com/sub/contacts/3/?param=true * will return 'contacts' * @return string */ - function dt_get_post_type() { + function dt_get_post_type() + { $url_path = dt_get_url_path(); - $url_path_with_no_query_string = explode( '?', $url_path )[0]; - return explode( '/', $url_path_with_no_query_string )[0]; + $url_path_with_no_query_string = explode('?', $url_path)[0]; + return explode('/', $url_path_with_no_query_string)[0]; } } - if ( ! function_exists( 'dt_array_to_sql' ) ) { - function dt_array_to_sql( $values, $numeric = false ) { - if ( empty( $values ) ) { + if (!function_exists('dt_array_to_sql')) { + function dt_array_to_sql($values, $numeric = false) + { + if (empty($values)) { return 'NULL'; } - foreach ( $values as &$val ) { - if ( '\N' === $val || empty( $val ) ) { + foreach ($values as &$val) { + if ('\N' === $val || empty($val)) { $val = 'NULL'; - } elseif ( $numeric ){ - $val = esc_sql( trim( $val ) ); + } elseif ($numeric) { + $val = esc_sql(trim($val)); } else { - $val = "'" . esc_sql( trim( $val ) ) . "'"; + $val = "'" . esc_sql(trim($val)) . "'"; } } - return implode( ',', $values ); + return implode(',', $values); } } @@ -232,44 +242,48 @@ function dt_array_to_sql( $values, $numeric = false ) { * * @return bool|int|string */ - if ( ! function_exists( 'dt_format_date' ) ) { - function dt_format_date( $date, $format = 'short' ) { - $date_format = get_option( 'date_format' ); - $time_format = get_option( 'time_format' ); - if ( $format === 'short' ) { + if (!function_exists('dt_format_date')) { + function dt_format_date($date, $format = 'short') + { + $date_format = get_option('date_format'); + $time_format = get_option('time_format'); + if ($format === 'short') { // $format = $date_format; // formatting it with internationally understood date, as there was a // struggle getting dates to show in user's selected language and not // in the site language. $format = 'Y-m-d'; - } else if ( $format === 'long' ) { + } else if ($format === 'long') { $format = $date_format . ' ' . $time_format; } - if ( is_numeric( $date ) ) { - $formatted = date_i18n( $format, $date ); + if (is_numeric($date)) { + $formatted = date_i18n($format, $date); } else { - $formatted = mysql2date( $format, $date ); + $formatted = mysql2date($format, $date); } return $formatted; } } - if ( ! function_exists( 'dt_date_start_of_year' ) ) { - function dt_date_start_of_year() { - $this_year = gmdate( 'Y' ); - $timestamp = strtotime( $this_year . '-01-01' ); + if (!function_exists('dt_date_start_of_year')) { + function dt_date_start_of_year() + { + $this_year = gmdate('Y'); + $timestamp = strtotime($this_year . '-01-01'); return $timestamp; } } - if ( ! function_exists( 'dt_date_end_of_year' ) ) { - function dt_date_end_of_year() { - $this_year = (int) gmdate( 'Y' ); - return strtotime( ( $this_year + 1 ) . '-01-01' ); + if (!function_exists('dt_date_end_of_year')) { + function dt_date_end_of_year() + { + $this_year = (int) gmdate('Y'); + return strtotime(($this_year + 1) . '-01-01'); } } - if ( ! function_exists( 'dt_get_year_from_timestamp' ) ) { - function dt_get_year_from_timestamp( int $time ) { - return gmdate( 'Y', $time ); + if (!function_exists('dt_get_year_from_timestamp')) { + function dt_get_year_from_timestamp(int $time) + { + return gmdate('Y', $time); } } @@ -277,23 +291,24 @@ function dt_get_year_from_timestamp( int $time ) { /* * deprecated */ - if ( ! function_exists( 'dt_sanitize_array_html' ) ) { - function dt_sanitize_array_html( $array ) { - array_walk_recursive($array, function ( &$v ) { - $v = filter_var( trim( $v ), FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES ); + if (!function_exists('dt_sanitize_array_html')) { + function dt_sanitize_array_html($array) + { + array_walk_recursive($array, function (&$v) { + $v = filter_var(trim($v), FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES); }); return $array; } } - if ( ! function_exists( 'dt_recursive_sanitize_array' ) ) { - function dt_recursive_sanitize_array( array $array ) : array { - foreach ( $array as $key => &$value ) { - if ( is_array( $value ) ) { - $value = dt_recursive_sanitize_array( $value ); - } - else { - $value = sanitize_text_field( wp_unslash( $value ) ); + if (!function_exists('dt_recursive_sanitize_array')) { + function dt_recursive_sanitize_array(array $array): array + { + foreach ($array as $key => &$value) { + if (is_array($value)) { + $value = dt_recursive_sanitize_array($value); + } else { + $value = sanitize_text_field(wp_unslash($value)); } } return $array; @@ -303,15 +318,16 @@ function dt_recursive_sanitize_array( array $array ) : array { /** * Deprecated function, use dt_get_available_languages() */ - if ( ! function_exists( 'dt_get_translations' ) ) { - function dt_get_translations() { - require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); + if (!function_exists('dt_get_translations')) { + function dt_get_translations() + { + require_once (ABSPATH . 'wp-admin/includes/translation-install.php'); $translations = wp_get_available_translations(); // @todo throwing errors if wp.org connection isn't established return $translations; } } - if ( ! function_exists( 'dt_get_available_languages' ) ) { + if (!function_exists('dt_get_available_languages')) { /** * Return the list of available languages. Defaults to all translations in the theme. * @@ -326,27 +342,28 @@ function dt_get_translations() { * * @return array */ - function dt_get_available_languages( $code_as_key = false, $all = false, $available_language_codes = [] ) { + function dt_get_available_languages($code_as_key = false, $all = false, $available_language_codes = []) + { $translations = dt_get_global_languages_list(); - if ( true === $all ) { + if (true === $all) { return $translations; } - if ( empty( $available_language_codes ) ) { - $available_language_codes = get_available_languages( get_template_directory() .'/dt-assets/translation' ); + if (empty($available_language_codes)) { + $available_language_codes = get_available_languages(get_template_directory() . '/dt-assets/translation'); } - array_unshift( $available_language_codes, 'en_US' ); + array_unshift($available_language_codes, 'en_US'); $available_translations = []; - $site_default_locale = get_option( 'WPLANG' ); + $site_default_locale = get_option('WPLANG'); - foreach ( $available_language_codes as $code ){ - if ( isset( $translations[$code] ) ){ + foreach ($available_language_codes as $code) { + if (isset($translations[$code])) { $translations[$code]['site_default'] = $site_default_locale === $code; $translations[$code]['english_name'] = $translations[$code]['label']; $translations[$code]['language'] = $code; - if ( !$code_as_key ){ + if (!$code_as_key) { $available_translations[] = $translations[$code]; } else { $available_translations[$code] = $translations[$code]; @@ -357,19 +374,20 @@ function dt_get_available_languages( $code_as_key = false, $all = false, $availa } } - if ( !function_exists( 'dt_language_select' ) ){ - function dt_language_select( $user_id = null ){ - if ( $user_id === null ){ + if (!function_exists('dt_language_select')) { + function dt_language_select($user_id = null) + { + if ($user_id === null) { $user_id = get_current_user_id(); } $languages = dt_get_available_languages(); - $dt_user_locale = get_user_locale( $user_id ); + $dt_user_locale = get_user_locale($user_id); ?> @@ -377,48 +395,51 @@ function dt_language_select( $user_id = null ){ } } - if ( !function_exists( 'dt_create_field_key' ) ){ - function dt_create_field_key( $s, $with_hash = false ){ + if (!function_exists('dt_create_field_key')) { + function dt_create_field_key($s, $with_hash = false) + { //note we don't limit to alhpa_numeric because it would strip out all non latin based languages - $s = str_replace( ' ', '_', $s ); // Replaces all spaces with hyphens. - $s = sanitize_key( $s ); - if ( $with_hash === true ){ - $s .= '_' . substr( md5( rand( 10000, 100000 ) ), 0, 3 ); // create a unique 3 digit key + $s = str_replace(' ', '_', $s); // Replaces all spaces with hyphens. + $s = sanitize_key($s); + if ($with_hash === true) { + $s .= '_' . substr(md5(rand(10000, 100000)), 0, 3); // create a unique 3 digit key } - if ( empty( $s ) ){ - $s .= 'key_' . substr( md5( rand( 10000, 100000 ) ), 0, 3 ); + if (empty($s)) { + $s .= 'key_' . substr(md5(rand(10000, 100000)), 0, 3); } return $s; } } - if ( !function_exists( 'dt_render_field_icon' ) ){ - function dt_render_field_icon( $field, $class = 'dt-icon', $default_to_name = false ){ + if (!function_exists('dt_render_field_icon')) { + function dt_render_field_icon($field, $class = 'dt-icon', $default_to_name = false) + { $icon_rendered = false; - if ( !empty( $field['icon'] ) && strpos( $field['icon'], 'undefined' ) === false ){ + if (!empty($field['icon']) && strpos($field['icon'], 'undefined') === false) { $icon_rendered = true; - if ( isset( $field['name'] ) ) { + if (isset($field['name'])) { $alt_tag = $field['name']; - } else if ( isset( $field['label'] ) ) { + } else if (isset($field['label'])) { $alt_tag = $field['label']; } else { $alt_tag = ''; } ?> - <?php echo esc_html( $alt_tag ) ?> + <?php echo esc_html($alt_tag) ?> - + - + 0 ) { - foreach ( $permissions as $permission ){ - if ( current_user_can( $permission ) ){ + if (!function_exists('dt_has_permissions')) { + function dt_has_permissions(array $permissions): bool + { + if (count($permissions) > 0) { + foreach ($permissions as $permission) { + if (current_user_can($permission)) { return true; } } @@ -451,36 +473,38 @@ function dt_has_permissions( array $permissions ) : bool { * @param bool $return * @return string */ - function dt_get_assigned_name( int $contact_id, bool $return = false ) { + function dt_get_assigned_name(int $contact_id, bool $return = false) + { - $metadata = get_post_meta( $contact_id, $key = 'assigned_to', true ); + $metadata = get_post_meta($contact_id, $key = 'assigned_to', true); - if ( !empty( $metadata ) ) { - $meta_array = explode( '-', $metadata ); // Separate the type and id + if (!empty($metadata)) { + $meta_array = explode('-', $metadata); // Separate the type and id $type = $meta_array[0]; $id = $meta_array[1]; - if ( $type == 'user' ) { - $value = get_user_by( 'id', $id ); + if ($type == 'user') { + $value = get_user_by('id', $id); $rv = $value->display_name; } else { - $value = get_term( $id ); + $value = get_term($id); $rv = $value->name; } - if ( $return ) { + if ($return) { return $rv; } else { - echo esc_html( $rv ); + echo esc_html($rv); } } } - function is_associative_array( array $arr ){ - if ( array() === $arr ){ + function is_associative_array(array $arr) + { + if (array() === $arr) { return false; } - return array_keys( $arr ) !== range( 0, count( $arr ) - 1 ); + return array_keys($arr) !== range(0, count($arr) - 1); } /** * Recursively merge array2 on to array1 @@ -489,14 +513,15 @@ function is_associative_array( array $arr ){ * @param array $array2 * @return array */ - function dt_array_merge_recursive_distinct( array &$array1, array &$array2 ){ + function dt_array_merge_recursive_distinct(array &$array1, array &$array2) + { $merged = $array1; - if ( !is_associative_array( $array2 ) && !is_associative_array( $merged ) ){ - return array_unique( array_merge( $merged, $array2 ), SORT_REGULAR ); + if (!is_associative_array($array2) && !is_associative_array($merged)) { + return array_unique(array_merge($merged, $array2), SORT_REGULAR); } - foreach ( $array2 as $key => &$value ){ - if ( is_array( $value ) && isset( $merged[$key] ) && is_array( $merged[$key] ) ){ - $merged[$key] = dt_array_merge_recursive_distinct( $merged[$key], $value ); + foreach ($array2 as $key => &$value) { + if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { + $merged[$key] = dt_array_merge_recursive_distinct($merged[$key], $value); } else { $merged[$key] = $value; } @@ -504,49 +529,51 @@ function dt_array_merge_recursive_distinct( array &$array1, array &$array2 ){ return $merged; } - function dt_field_enabled_for_record_type( $field, $post ){ - if ( !isset( $post['type']['key'] ) ){ + function dt_field_enabled_for_record_type($field, $post) + { + if (!isset($post['type']['key'])) { return true; } // if only_for_type is not set, then the field is available on all types - if ( !isset( $field['only_for_types'] ) ){ + if (!isset($field['only_for_types'])) { return true; - } else if ( $field['only_for_types'] === true ){ + } else if ($field['only_for_types'] === true) { return true; - } else if ( is_array( $field['only_for_types'] ) && in_array( $post['type']['key'], $field['only_for_types'], true ) ){ + } else if (is_array($field['only_for_types']) && in_array($post['type']['key'], $field['only_for_types'], true)) { //if the type is in the "only_for_types" return true; } return false; } - function render_new_bulk_record_fields( $dt_post_type ) { - $post_settings = DT_Posts::get_post_settings( $dt_post_type ); + function render_new_bulk_record_fields($dt_post_type) + { + $post_settings = DT_Posts::get_post_settings($dt_post_type); $selected_type = null; - foreach ( $post_settings['fields'] as $field_key => $field_settings ) { - if ( ! empty( $field_settings['hidden'] ) && empty( $field_settings['custom_display'] ) ) { + foreach ($post_settings['fields'] as $field_key => $field_settings) { + if (!empty($field_settings['hidden']) && empty($field_settings['custom_display'])) { continue; } - if ( isset( $field_settings['in_create_form'] ) && $field_settings['in_create_form'] === false ) { + if (isset($field_settings['in_create_form']) && $field_settings['in_create_form'] === false) { continue; } - if ( ! isset( $field_settings['tile'] ) ) { + if (!isset($field_settings['tile'])) { continue; } - $classes = ''; + $classes = ''; $show_field = false; //add types the field should show up on as classes - if ( ! empty( $field_settings['in_create_form'] ) ) { - if ( is_array( $field_settings['in_create_form'] ) ) { - foreach ( $field_settings['in_create_form'] as $type_key ) { + if (!empty($field_settings['in_create_form'])) { + if (is_array($field_settings['in_create_form'])) { + foreach ($field_settings['in_create_form'] as $type_key) { $classes .= $type_key . ' '; - if ( $type_key === $selected_type ) { + if ($type_key === $selected_type) { $show_field = true; } } - } elseif ( $field_settings['in_create_form'] === true ) { - $classes = 'all'; + } elseif ($field_settings['in_create_form'] === true) { + $classes = 'all'; $show_field = true; } } else { @@ -555,23 +582,23 @@ function render_new_bulk_record_fields( $dt_post_type ) { ?> -
    - class="form-field "> +
    + class="form-field "> -

    + render_field_for_display($field_key, $post_settings['fields'], []); + if (isset($field_settings['required']) && $field_settings['required'] === true) { ?> +

    + function dt_render_icon_slot($field) + { + if (isset($field['font-icon']) && !empty($field['font-icon'])): ?> - + - - - requiredmessage="" icon="https://cdn-icons-png.flaticon.com/512/1077/1077114.png" iconalttext="Icon Alt Text" privatelabel="" error="" onchange="" - > - + + + + value="" requiredmessage="" + icon="https://cdn-icons-png.flaticon.com/512/1077/1077114.png" iconalttext="Icon Alt Text" privatelabel="" error="" + onchange=""> + + + + + value="" requiredmessage="" + icon="https://cdn-icons-png.flaticon.com/512/1077/1077114.png" iconalttext="Icon Alt Text" privatelabel="" error="" + onchange=""> + - > + + - $key, - 'label' => $value['label'], - 'color' => $value['color'] ?? null, - ]; - }, array_keys( $options_array ), $options_array ); - ?> - - options="" - value=""> - - - - + $key, + 'label' => $value['label'], + 'color' => $value['color'] ?? null, + ]; + }, array_keys($options_array), $options_array); + ?> + + options="" + value=""> + + + + $value, 'label' => $value, ]; }, $post[$field_key] ?? []); ?> - - value="" - placeholder="" - allowAdd - > - - - - value="" + placeholder="" + allowAdd> + + + + $key, 'label' => $value['label'], 'color' => $value['color'] ?? null, ]; - }, array_keys( $options_array ), $options_array ); - ?> - - options="" - value="" - > - - + }, array_keys($options_array), $options_array); + ?> + + options="" + value=""> + + -
    - $option_value ): ?> - - + $haystack = $post[$field_key] ?? []; + if (!is_array($haystack)) { + $haystack = explode(' ', $haystack); + } + $class = (in_array($option_key, $haystack)) ? + 'selected-select-button' : 'empty-select-button'; ?> + -
    +
    - - - value="" - > - - - - - - - class="text-input" - value="" - min="" - max="" - onwheel="return false;" - /> - - - - - timestamp=""> - - - + + + timestamp=""> + + + -
    - - value="" > +
    + value="" > - + -
    - +
    + +
    -
    - - + $value['ID'], 'label' => $value['post_title'], @@ -838,114 +866,111 @@ class="text-input" ]; }, $post[$field_key] ?? []); ?> - - value="" - allowAdd - > - - - - -
    - /> -
    - - + options="" + value="" allowAdd> + + + + +
    + /> +
    + + +
    +
    -
    -
    - - -
    + + +
    - -
    - -
    -
    -
    - - " - autocomplete="off" /> - + +
    + +
    +
    +
    + + " + autocomplete="off" /> + +
    -
    - -
    - -
    - /> -
    - + +
    + +
    + /> +
    + +
    -
    + if (empty($post[$field_key]) ?? []): ?> -
    - -
    - -
    -
    -
    - - > - - - - +
    + +
    + +
    +
    +
    + + > + + + + +
    -
    - - - > + >
    -
    @@ -954,34 +979,37 @@ class="button alert delete-button-style input-height link-delete-button delete-b format( $format ) === $date ){ + if (!function_exists('dt_validate_date')) { + function dt_validate_date(string $date): bool + { + $formats = ['Y-m-d', 'Y-m-d H:i:s', 'Y-m-d H:i:s.u', DateTimeInterface::ISO8601, DateTimeInterface::RFC3339]; + foreach ($formats as $format) { + $date_time = DateTime::createFromFormat($format, $date); + if ($date_time && $date_time->format($format) === $date) { return true; } } @@ -1052,10 +1084,11 @@ function dt_validate_date( string $date ): bool{ /** * Dump and die */ - if ( !function_exists( 'dd' ) ) { - function dd( ...$params ) { - foreach ( $params as $param ) { - var_dump( $param ); + if (!function_exists('dd')) { + function dd(...$params) + { + foreach ($params as $param) { + var_dump($param); } exit; @@ -1065,10 +1098,11 @@ function dd( ...$params ) { /** * Convert a slug like 'name_or_title' to a label like 'Name or Title' */ - if ( !function_exists( 'dt_label_from_slug' ) ) { - function dt_label_from_slug( $slug ) { - $string = preg_replace( '/^' . preg_quote( 'dt_', '/' ) . '/', '', $slug ); - $string = str_replace( '_', ' ', $string ); + if (!function_exists('dt_label_from_slug')) { + function dt_label_from_slug($slug) + { + $string = preg_replace('/^' . preg_quote('dt_', '/') . '/', '', $slug); + $string = str_replace('_', ' ', $string); /* Words that should be entirely lower-case */ $articles_conjunctions_prepositions = [ @@ -1104,485 +1138,486 @@ function dt_label_from_slug( $slug ) { 'dt' ]; /* split title string into array of words */ - $words = explode( ' ', strtolower( $string ) ); + $words = explode(' ', strtolower($string)); /* iterate over words */ - foreach ( $words as $position => $word ) { + foreach ($words as $position => $word) { /* re-capitalize acronyms */ - if ( in_array( $word, $acronyms_and_such ) ) { - $words[ $position ] = strtoupper( $word ); + if (in_array($word, $acronyms_and_such)) { + $words[$position] = strtoupper($word); /* capitalize first letter of all other words, if... */ } elseif ( /* ...first word of the title string... */ 0 === $position || /* ...or not in above lower-case list*/ - !in_array( $word, $articles_conjunctions_prepositions ) + !in_array($word, $articles_conjunctions_prepositions) ) { - $words[ $position ] = ucwords( $word ); + $words[$position] = ucwords($word); } } /* re-combine word array */ - $string = implode( ' ', $words ); + $string = implode(' ', $words); /* return title string in title case */ return $string; } } - if ( !function_exists( 'dt_get_global_languages_list' ) ){ - function dt_get_global_languages_list(){ + if (!function_exists('dt_get_global_languages_list')) { + function dt_get_global_languages_list() + { /* You can find flags with country codes here https://unpkg.com/country-flag-emoji@1.0.3/dist/country-flag-emoji.umd.js */ /* Then you should be able to search for the country code e.g. af_NA NA -> Namibia to get the necessary flags */ $global_languages_list = [ - 'af' => [ 'label' => 'Afrikaans', 'native_name' => 'Afrikaans', 'flag' => '🇿🇦', 'rtl' => false ], - 'af_NA' => [ 'label' => 'Afrikaans (Namibia)', 'native_name' => 'Afrikáans Namibië', 'flag' => '🇳🇦', 'rtl' => false ], - 'af_ZA' => [ 'label' => 'Afrikaans (South Africa)', 'native_name' => 'Afrikaans Suid-Afrika', 'flag' => '🇿🇦', 'rtl' => false ], - 'ak' => [ 'label' => 'Akan', 'native_name' => 'Akan', 'flag' => '🇬🇭', 'rtl' => false ], - 'ak_GH' => [ 'label' => 'Akan (Ghana)', 'native_name' => 'Akan (Ghana)', 'flag' => '🇬🇭', 'rtl' => false ], - 'am' => [ 'label' => 'Amharic', 'native_name' => 'አማርኛ (AmarəÑña)', 'flag' => '🇪🇹', 'rtl' => false ], - 'am_ET' => [ 'label' => 'Amharic (Ethiopia)', 'native_name' => 'አማርኛ (AmarəÑña)', 'flag' => '🇪🇹', 'rtl' => false ], - 'ar' => [ 'label' => 'Arabic', 'native_name' => 'العربية', 'flag' => '🇦🇪', 'rtl' => true ], - 'ar_AE' => [ 'label' => 'Arabic (United Arab Emirates)', 'native_name' => 'العربية‎ / Al-ʻArabiyyah, ʻArabī الإمارات العربية المتحدة', 'flag' => '🇦🇪', 'rtl' => true ], - 'ar_BH' => [ 'label' => 'Arabic (Bahrain)', 'native_name' => 'العربية البحرانية', 'flag' => '🇧🇭', 'rtl' => true ], - 'ar_DZ' => [ 'label' => 'Arabic (Algeria)', 'native_name' => 'دزيريةالجزائر', 'flag' => '🇩🇿', 'rtl' => true ], - 'ar_EG' => [ 'label' => 'Arabic (Egypt)', 'native_name' => 'مصرى', 'flag' => '🇪🇬', 'rtl' => true ], - 'ar_IQ' => [ 'label' => 'Arabic (Iraq)', 'native_name' => 'اللهجة العراقية', 'flag' => '🇮🇶', 'rtl' => true ], - 'ar_JO' => [ 'label' => 'Arabic (Jordan)', 'native_name' => 'اللهجة الأردنية', 'flag' => '🇯🇴', 'rtl' => true ], - 'ar_KW' => [ 'label' => 'Arabic (Kuwait)', 'native_name' => 'كويتي', 'flag' => '🇰🇼', 'rtl' => true ], - 'ar_LB' => [ 'label' => 'Arabic (Lebanon)', 'native_name' => 'اللهجة اللبنانية', 'flag' => '🇱🇧', 'rtl' => true ], - 'ar_LY' => [ 'label' => 'Arabic (Libya)', 'native_name' => 'ليبي', 'flag' => '🇱🇾', 'rtl' => true ], - 'ar_MA' => [ 'label' => 'Arabic (Morocco)', 'native_name' => 'الدارجة اللهجة المغربية', 'flag' => '🇲🇦', 'rtl' => true ], - 'ar_OM' => [ 'label' => 'Arabic (Oman)', 'native_name' => 'اللهجة العمانية', 'flag' => '🇴🇲', 'rtl' => true ], - 'ar_QA' => [ 'label' => 'Arabic (Qatar)', 'native_name' => 'العربية (قطر)', 'flag' => '🇶🇦', 'rtl' => true ], - 'ar_SA' => [ 'label' => 'Arabic (Saudi Arabia)', 'native_name' => "شبه جزيرة 'العربية", 'flag' => '🇸🇦', 'rtl' => true ], - 'ar_SD' => [ 'label' => 'Arabic (Sudan)', 'native_name' => 'لهجة سودانية', 'flag' => '🇸🇩', 'rtl' => true ], - 'ar_SY' => [ 'label' => 'Arabic (Syria)', 'native_name' => 'شامي', 'flag' => '🇸🇾', 'rtl' => true ], - 'ar_TN' => [ 'label' => 'Arabic (Tunisia)', 'native_name' => 'تونسي', 'flag' => '🇹🇳', 'rtl' => true ], - 'ar_YE' => [ 'label' => 'Arabic (Yemen)', 'native_name' => 'لهجة يمنية', 'flag' => '🇾🇪', 'rtl' => true ], - 'as' => [ 'label' => 'Assamese', 'native_name' => 'অসমীয়া / Ôxômiya', 'flag' => '🇮🇳', 'rtl' => false ], - 'as_IN' => [ 'label' => 'Assamese (India)', 'native_name' => 'অসমীয়া / Ôxômiya (India)', 'flag' => '🇮🇳', 'rtl' => false ], - 'asa' => [ 'label' => 'Asu', 'native_name' => 'Kipare, Casu', 'flag' => '🇹🇿', 'rtl' => false ], - 'asa_TZ' => [ 'label' => 'Asu (Tanzania)', 'native_name' => 'Kipare, Casu (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false ], - 'az' => [ 'label' => 'Azerbaijani', 'native_name' => 'AzəRbaycan Dili', 'flag' => '🇦🇿', 'rtl' => true ], - 'az_Cyrl' => [ 'label' => 'Azerbaijani (Cyrillic)', 'native_name' => 'Азәрбајҹан Дили (Kiril)', 'flag' => '🇷🇺', 'rtl' => false ], - 'az_Cyrl_AZ' => [ 'label' => 'Azerbaijani (Cyrillic, Azerbaijan)', 'native_name' => 'Азәрбајҹан Дили (Kiril)', 'flag' => '🇦🇿', 'rtl' => false ], - 'az_Latn' => [ 'label' => 'Azerbaijani (Latin)', 'native_name' => 'AzəRbaycan (Latın) (Latın Dili)', 'flag' => '🇦🇿', 'rtl' => false ], - 'az_Latn_AZ' => [ 'label' => 'Azerbaijani (Latin, Azerbaijan)', 'native_name' => 'AzəRbaycan (Latın, AzəRbaycan) ()', 'flag' => '🇦🇿', 'rtl' => false ], - 'be' => [ 'label' => 'Belarusian', 'native_name' => 'Беларуская Мова', 'flag' => '🇧🇾', 'rtl' => false ], - 'be_BY' => [ 'label' => 'Belarusian (Belarus)', 'native_name' => 'Беларуская (Беларусь) (Беларус)', 'flag' => '🇧🇾', 'rtl' => false ], - 'bem' => [ 'label' => 'Bemba', 'native_name' => 'Βemba', 'flag' => '🇿🇲', 'rtl' => false ], - 'bem_ZM' => [ 'label' => 'Bemba (Zambia)', 'native_name' => 'Βemba (Zambia)', 'flag' => '🇿🇲', 'rtl' => false ], - 'bez' => [ 'label' => 'Bena', 'native_name' => 'Ekibena', 'flag' => '🇹🇿', 'rtl' => false ], - 'bez_TZ' => [ 'label' => 'Bena (Tanzania)', 'native_name' => 'Ekibena (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false ], - 'bg' => [ 'label' => 'Bulgarian', 'native_name' => 'Български', 'flag' => '🇧🇬', 'rtl' => false ], - 'bg_BG' => [ 'label' => 'Bulgarian (Bulgaria)', 'native_name' => 'Български (България)', 'flag' => '🇧🇬', 'rtl' => false ], - 'bm' => [ 'label' => 'Bambara', 'native_name' => 'Bamanankan', 'flag' => '🇲🇱', 'rtl' => false ], - 'bm_ML' => [ 'label' => 'Bambara (Mali)', 'native_name' => 'Bamanankan (Mali)', 'flag' => '🇲🇱', 'rtl' => false ], - 'bn' => [ 'label' => 'Bengali', 'native_name' => 'বাংলা, Bangla', 'flag' => '🇧🇩', 'rtl' => false ], - 'bn_BD' => [ 'label' => 'Bengali (Bangladesh)', 'native_name' => 'বাংলা, Bangla (বাংলাদেশ)', 'flag' => '🇧🇩', 'rtl' => false ], - 'bn_IN' => [ 'label' => 'Bengali (India)', 'native_name' => 'বাংলা Bānlā (ভারত)', 'flag' => '🇮🇳', 'rtl' => false ], - 'bo' => [ 'label' => 'Tibetan', 'native_name' => 'བོད་སྐད་', 'flag' => '🏳️', 'rtl' => false ], - 'bo_CN' => [ 'label' => 'Tibetan (China)', 'native_name' => 'བོད་སྐད (China)', 'flag' => '🇨🇳', 'rtl' => false ], - 'bo_IN' => [ 'label' => 'Tibetan (India)', 'native_name' => 'བོད་སྐད་ (India)', 'flag' => '🇮🇳', 'rtl' => false ], - 'bs' => [ 'label' => 'Bosnian', 'native_name' => 'Bosanski', 'flag' => '🇧🇦', 'rtl' => false ], - 'bs_BA' => [ 'label' => 'Bosnian (Bosnia and Herzegovina)', 'native_name' => 'Bosanski (Bosna I Hercegovina)', 'flag' => '🇧🇦', 'rtl' => false ], - 'ca' => [ 'label' => 'Catalan', 'native_name' => 'Català', 'flag' => '🇪🇸', 'rtl' => false ], - 'ca_ES' => [ 'label' => 'Catalan (Spain)', 'native_name' => 'Català (Espanyola)', 'flag' => '🇪🇸', 'rtl' => false ], - 'cgg' => [ 'label' => 'Chiga', 'native_name' => 'Orukiga', 'flag' => '🇺🇬', 'rtl' => false ], - 'cgg_UG' => [ 'label' => 'Chiga (Uganda)', 'native_name' => 'Orukiga (Uganda)', 'flag' => '🇺🇬', 'rtl' => false ], - 'chr' => [ 'label' => 'Cherokee', 'native_name' => 'ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ', 'flag' => '🇺🇸', 'rtl' => false ], - 'chr_US' => [ 'label' => 'Cherokee (United States)', 'native_name' => 'ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ (United States)', 'flag' => '🇺🇸', 'rtl' => false ], - 'ckb_IR' => [ 'label' => 'Sorani (Iran)', 'native_name' => 'سۆرانی', 'flag' => '🇮🇷', 'rtl' => true, ], - 'ckb_IQ' => [ 'label' => 'Sorani (Iraq)', 'native_name' => 'سۆرانی', 'flag' => '🇮🇶', 'rtl' => true, ], - 'cs' => [ 'label' => 'Czech', 'native_name' => 'Český Jazyk', 'flag' => '🇨🇿', 'rtl' => false ], - 'cs_CZ' => [ 'label' => 'Czech (Czech Republic)', 'native_name' => 'Čeština (Česká Republika)', 'flag' => '🇨🇿', 'rtl' => false ], - 'cy' => [ 'label' => 'Welsh', 'native_name' => 'Gymraeg', 'flag' => '🏴󠁧󠁢󠁥󠁮󠁧󠁿', 'rtl' => false ], - 'cy_GB' => [ 'label' => 'Welsh (United Kingdom)', 'native_name' => 'Gymraeg (Y Deyrnas Unedig)', 'flag' => '🇬🇧', 'rtl' => false ], - 'da' => [ 'label' => 'Danish', 'native_name' => 'Dansk', 'flag' => '🇩🇰', 'rtl' => false ], - 'da_DK' => [ 'label' => 'Danish (Denmark)', 'native_name' => 'Dansk (Danmark)', 'flag' => '🇩🇰', 'rtl' => false ], - 'dav' => [ 'label' => 'Taita', 'native_name' => 'Taita', 'flag' => '🇰🇪', 'rtl' => false ], - 'dav_KE' => [ 'label' => 'Taita (Kenya)', 'native_name' => 'Taita (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'de' => [ 'label' => 'German', 'native_name' => 'Deutsch', 'flag' => '🇩🇪', 'rtl' => false ], - 'de_AT' => [ 'label' => 'German (Austria)', 'native_name' => 'Österreichisches (Österreich)', 'flag' => '🇦🇹', 'rtl' => false ], - 'de_BE' => [ 'label' => 'German (Belgium)', 'native_name' => 'Deutschsprachige (Belgien)', 'flag' => '🇧🇪', 'rtl' => false ], - 'de_CH' => [ 'label' => 'German (Switzerland)', 'native_name' => 'Schwiizerdütsch (Schweiz)', 'flag' => '🇨🇭', 'rtl' => false ], - 'de_DE' => [ 'label' => 'German (Germany)', 'native_name' => 'Deutsch (Deutschland)', 'flag' => '🇩🇪', 'rtl' => false ], - 'de_LI' => [ 'label' => 'German (Liechtenstein)', 'native_name' => 'Alemannisch (Liechtenstein)', 'flag' => '🇱🇮', 'rtl' => false ], - 'de_LU' => [ 'label' => 'German (Luxembourg)', 'native_name' => 'Lëtzebuergesch (Luxemburg)', 'flag' => '🇱🇺', 'rtl' => false ], - 'ebu' => [ 'label' => 'Embu', 'native_name' => 'Kiembu', 'flag' => '🇰🇪', 'rtl' => false ], - 'ebu_KE' => [ 'label' => 'Embu (Kenya)', 'native_name' => 'Kiembu (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'ee' => [ 'label' => 'Ewe', 'native_name' => 'EʋEgbe', 'flag' => '🇹🇬', 'rtl' => false ], - 'ee_GH' => [ 'label' => 'Ewe (Ghana)', 'native_name' => 'EʋEgbe (Ghana)', 'flag' => '🇬🇭', 'rtl' => false ], - 'ee_TG' => [ 'label' => 'Ewe (Togo)', 'native_name' => 'EʋEgbe (Togo)', 'flag' => '🇹🇬', 'rtl' => false ], - 'el' => [ 'label' => 'Greek', 'native_name' => 'Ελληνικά', 'flag' => '🇬🇷', 'rtl' => false ], - 'el_CY' => [ 'label' => 'Greek (Cyprus)', 'native_name' => 'Ελληνοκύπριοι (Κύπρος)', 'flag' => '🇨🇾', 'rtl' => false ], - 'el_GR' => [ 'label' => 'Greek (Greece)', 'native_name' => 'Ελληνικά (Ελλάδα) (Ελλάδα)', 'flag' => '🇬🇷', 'rtl' => false ], - 'en' => [ 'label' => 'English', 'native_name' => 'English', 'flag' => '🇺🇸', 'rtl' => false ], - 'en_AS' => [ 'label' => 'English (American Samoa)', 'native_name' => 'English (American Samoa)', 'flag' => '🇦🇸', 'rtl' => false ], - 'en_AU' => [ 'label' => 'English (Australia)', 'native_name' => 'English (Australia)', 'flag' => '🇦🇺', 'rtl' => false ], - 'en_BE' => [ 'label' => 'English (Belgium)', 'native_name' => 'English (Belgium)', 'flag' => '🇧🇪', 'rtl' => false ], - 'en_BW' => [ 'label' => 'English (Botswana)', 'native_name' => 'English (Botswana)', 'flag' => '🇧🇼', 'rtl' => false ], - 'en_BZ' => [ 'label' => 'English (Belize)', 'native_name' => 'English (Belize)', 'flag' => '🇧🇿', 'rtl' => false ], - 'en_CA' => [ 'label' => 'English (Canada)', 'native_name' => 'English (Canada)', 'flag' => '🇨🇦', 'rtl' => false ], - 'en_GB' => [ 'label' => 'English (United Kingdom)', 'native_name' => 'English (United Kingdom)', 'flag' => '🇬🇧', 'rtl' => false ], - 'en_GU' => [ 'label' => 'English (Guam)', 'native_name' => 'English (Guam)', 'flag' => '🇬🇺', 'rtl' => false ], - 'en_HK' => [ 'label' => 'English (Hong Kong SAR China)', 'native_name' => 'English (Hong Kong Sar China)', 'flag' => '🇭🇰', 'rtl' => false ], - 'en_IE' => [ 'label' => 'English (Ireland)', 'native_name' => 'English (Ireland)', 'flag' => '🇮🇪', 'rtl' => false ], - 'en_IL' => [ 'label' => 'English (Israel)', 'native_name' => 'English (Israel)', 'flag' => '🇮🇱', 'rtl' => false ], - 'en_IN' => [ 'label' => 'English (India)', 'native_name' => 'English (India)', 'flag' => '🇮🇳', 'rtl' => false ], - 'en_JM' => [ 'label' => 'English (Jamaica)', 'native_name' => 'English (Jamaica)', 'flag' => '🇯🇲', 'rtl' => false ], - 'en_MH' => [ 'label' => 'English (Marshall Islands)', 'native_name' => 'English (Marshall Islands)', 'flag' => '🇲🇭', 'rtl' => false ], - 'en_MP' => [ 'label' => 'English (Northern Mariana Islands)', 'native_name' => 'English (Northern Mariana Islands)', 'flag' => '🇲🇵', 'rtl' => false ], - 'en_MT' => [ 'label' => 'English (Malta)', 'native_name' => 'English (Malta)', 'flag' => '🇲🇹', 'rtl' => false ], - 'en_MU' => [ 'label' => 'English (Mauritius)', 'native_name' => 'English (Mauritius)', 'flag' => '🇲🇺', 'rtl' => false ], - 'en_NA' => [ 'label' => 'English (Namibia)', 'native_name' => 'English (Namibia)', 'flag' => '🇳🇦', 'rtl' => false ], - 'en_NZ' => [ 'label' => 'English (New Zealand)', 'native_name' => 'English (New Zealand)', 'flag' => '🇳🇿', 'rtl' => false ], - 'en_PH' => [ 'label' => 'English (Philippines)', 'native_name' => 'English (Philippines)', 'flag' => '🇵🇭', 'rtl' => false ], - 'en_PK' => [ 'label' => 'English (Pakistan)', 'native_name' => 'English (Pakistan)', 'flag' => '🇵🇰', 'rtl' => false ], - 'en_SG' => [ 'label' => 'English (Singapore)', 'native_name' => 'English (Singapore)', 'flag' => '🇸🇬', 'rtl' => false ], - 'en_TT' => [ 'label' => 'English (Trinidad and Tobago)', 'native_name' => 'English (Trinidad And Tobago)', 'flag' => '🇹🇹', 'rtl' => false ], - 'en_UM' => [ 'label' => 'English (U.S. Minor Outlying Islands)', 'native_name' => 'English (U.S. Minor Outlying Islands)', 'flag' => '🇺🇸', 'rtl' => false ], - 'en_US' => [ 'label' => 'English (United States)', 'native_name' => 'English (United States)', 'flag' => '🇺🇸', 'rtl' => false ], - 'en_VI' => [ 'label' => 'English (U.S. Virgin Islands)', 'native_name' => 'English (U.S. Virgin Islands)', 'flag' => '🇻🇮', 'rtl' => false ], - 'en_ZA' => [ 'label' => 'English (South Africa)', 'native_name' => 'English (South Africa)', 'flag' => '🇿🇦', 'rtl' => false ], - 'en_ZW' => [ 'label' => 'English (Zimbabwe)', 'native_name' => 'English (Zimbabwe)', 'flag' => '🇿🇼', 'rtl' => false ], - 'eo' => [ 'label' => 'Esperanto', 'native_name' => 'Esperanto', 'flag' => '🇪🇺', 'rtl' => false ], - 'es' => [ 'label' => 'Spanish', 'native_name' => 'Español', 'flag' => '🇪🇸', 'rtl' => false ], - 'es_419' => [ 'label' => 'Spanish (Latin America)', 'native_name' => 'Español (America Latina)', 'flag' => '🇨🇴', 'rtl' => false ], - 'es_AR' => [ 'label' => 'Spanish (Argentina)', 'native_name' => 'Español (Argentina)', 'flag' => '🇦🇷', 'rtl' => false ], - 'es_BO' => [ 'label' => 'Spanish (Bolivia)', 'native_name' => 'Español (Bolivia)', 'flag' => '🇧🇴', 'rtl' => false ], - 'es_CL' => [ 'label' => 'Spanish (Chile)', 'native_name' => 'Español (Chile)', 'flag' => '🇨🇱', 'rtl' => false ], - 'es_CO' => [ 'label' => 'Spanish (Colombia)', 'native_name' => 'Español (Colombia)', 'flag' => '🇨🇴', 'rtl' => false ], - 'es_CR' => [ 'label' => 'Spanish (Costa Rica)', 'native_name' => 'Español (Costa Rica)', 'flag' => '🇨🇷', 'rtl' => false ], - 'es_DO' => [ 'label' => 'Spanish (Dominican Republic)', 'native_name' => 'Español (República Dominicana)', 'flag' => '🇩🇴', 'rtl' => false ], - 'es_EC' => [ 'label' => 'Spanish (Ecuador)', 'native_name' => 'Español (Ecuador)', 'flag' => '🇪🇨', 'rtl' => false ], - 'es_ES' => [ 'label' => 'Spanish (Spain)', 'native_name' => 'Español (España)', 'flag' => '🇪🇸', 'rtl' => false ], - 'es_GQ' => [ 'label' => 'Spanish (Equatorial Guinea)', 'native_name' => 'Español (Guinea Ecuatorial)', 'flag' => '🇬🇶', 'rtl' => false ], - 'es_GT' => [ 'label' => 'Spanish (Guatemala)', 'native_name' => 'Español (Guatemala)', 'flag' => '🇬🇹', 'rtl' => false ], - 'es_HN' => [ 'label' => 'Spanish (Honduras)', 'native_name' => 'Español (Honduras)', 'flag' => '🇭🇳', 'rtl' => false ], - 'es_MX' => [ 'label' => 'Spanish (Mexico)', 'native_name' => 'Español (México)', 'flag' => '🇲🇽', 'rtl' => false ], - 'es_NI' => [ 'label' => 'Spanish (Nicaragua)', 'native_name' => 'Español (Nicaragua)', 'flag' => '🇳🇮', 'rtl' => false ], - 'es_PA' => [ 'label' => 'Spanish (Panama)', 'native_name' => 'Español (Panamá)', 'flag' => '🇵🇦', 'rtl' => false ], - 'es_PE' => [ 'label' => 'Spanish (Peru)', 'native_name' => 'Español (Perú)', 'flag' => '🇵🇪', 'rtl' => false ], - 'es_PR' => [ 'label' => 'Spanish (Puerto Rico)', 'native_name' => 'Español (Puerto Rico)', 'flag' => '🇵🇷', 'rtl' => false ], - 'es_PY' => [ 'label' => 'Spanish (Paraguay)', 'native_name' => 'Español (Paraguay)', 'flag' => '🇵🇾', 'rtl' => false ], - 'es_SV' => [ 'label' => 'Spanish (El Salvador)', 'native_name' => 'Español (El Salvador)', 'flag' => '🇸🇻', 'rtl' => false ], - 'es_US' => [ 'label' => 'Spanish (United States)', 'native_name' => 'Español (Estados Unidos)', 'flag' => '🇺🇸', 'rtl' => false ], - 'es_UY' => [ 'label' => 'Spanish (Uruguay)', 'native_name' => 'Español (Uruguay)', 'flag' => '🇺🇾', 'rtl' => false ], - 'es_VE' => [ 'label' => 'Spanish (Venezuela)', 'native_name' => 'Español (Venezuela)', 'flag' => '🇻🇪', 'rtl' => false ], - 'et' => [ 'label' => 'Estonian', 'native_name' => 'Eesti Keel', 'flag' => '🇪🇪', 'rtl' => false ], - 'et_EE' => [ 'label' => 'Estonian (Estonia)', 'native_name' => 'Eesti Keel (Eesti)', 'flag' => '🇪🇪', 'rtl' => false ], - 'eu' => [ 'label' => 'Basque', 'native_name' => 'Euskara', 'flag' => '🏳️', 'rtl' => false ], - 'eu_ES' => [ 'label' => 'Basque (Spain)', 'native_name' => 'Euskara (Jaio)', 'flag' => '🏳️', 'rtl' => false ], - 'fa' => [ 'label' => 'Persian', 'native_name' => 'فارسی (Fārsi)', 'flag' => '🇮🇷', 'rtl' => true ], - 'fa_AF' => [ 'label' => 'Persian (Afghanistan)', 'native_name' => 'فارسی دری (افغانستان)', 'flag' => '🇦🇫', 'rtl' => true ], - 'fa_IR' => [ 'label' => 'Persian (Iran)', 'native_name' => 'فارسی (Fārsi) (ایران)', 'flag' => '🇮🇷', 'rtl' => true ], - 'ff' => [ 'label' => 'Fulah', 'native_name' => 'الفولاني', 'flag' => '🇸🇳', 'rtl' => true ], - 'ff_SN' => [ 'label' => 'Fulah (Senegal)', 'native_name' => '𞤆𞤵𞥄𞤼𞤢', 'flag' => '🇸🇳', 'rtl' => true ], - 'fi' => [ 'label' => 'Finnish', 'native_name' => 'Suomen Kieli', 'flag' => '🇫🇮', 'rtl' => false ], - 'fi_FI' => [ 'label' => 'Finnish (Finland)', 'native_name' => 'Suomen Kieli (Suomi)', 'flag' => '🇫🇮', 'rtl' => false ], - 'fil' => [ 'label' => 'Filipino', 'native_name' => 'Wikang Filipino', 'flag' => '🇵🇭', 'rtl' => false ], - 'fil_PH' => [ 'label' => 'Filipino (Philippines)', 'native_name' => 'Wikang Filipino (Pilipinas)', 'flag' => '🇵🇭', 'rtl' => false ], - 'fo' => [ 'label' => 'Faroese', 'native_name' => 'Føroyskt Mál', 'flag' => '🇫🇴', 'rtl' => false ], - 'fo_FO' => [ 'label' => 'Faroese (Faroe Islands)', 'native_name' => 'Føroyskt Mál (Faroe Islands)', 'flag' => '🇫🇴', 'rtl' => false ], - 'fr' => [ 'label' => 'French', 'native_name' => 'Français', 'flag' => '🇫🇷', 'rtl' => false ], - 'fr_BE' => [ 'label' => 'French (Belgium)', 'native_name' => 'Français (Belgique)', 'flag' => '🇧🇪', 'rtl' => false ], - 'fr_BF' => [ 'label' => 'French (Burkina Faso)', 'native_name' => 'Français (Burkina Faso)', 'flag' => '🇧🇫', 'rtl' => false ], - 'fr_BI' => [ 'label' => 'French (Burundi)', 'native_name' => 'Français (Burundi)', 'flag' => '🇧🇮', 'rtl' => false ], - 'fr_BJ' => [ 'label' => 'French (Benin)', 'native_name' => 'Français (Bénin)', 'flag' => '🇧🇯', 'rtl' => false ], - 'fr_BL' => [ 'label' => 'French (Saint Barthélemy)', 'native_name' => 'Français (Saint Barthélemy)', 'flag' => '🇧🇱', 'rtl' => false ], - 'fr_CA' => [ 'label' => 'French (Canada)', 'native_name' => 'Français (Canada)', 'flag' => '🇨🇦', 'rtl' => false ], - 'fr_CD' => [ 'label' => 'French (Congo - Kinshasa)', 'native_name' => 'Français (Congo - Kinshasa)', 'flag' => '🇨🇩', 'rtl' => false ], - 'fr_CF' => [ 'label' => 'French (Central African Republic)', 'native_name' => 'Français (République Centrafricaine)', 'flag' => '🇨🇫', 'rtl' => false ], - 'fr_CG' => [ 'label' => 'French (Congo - Brazzaville)', 'native_name' => 'Français (Congo - Brazzaville)', 'flag' => '🇨🇬', 'rtl' => false ], - 'fr_CH' => [ 'label' => 'French (Switzerland)', 'native_name' => 'Français (Suisse)', 'flag' => '🇨🇭', 'rtl' => false ], - 'fr_CI' => [ 'label' => "French (Côte d'Ivoire)", 'native_name' => "Français (Côte D'Ivoire)", 'flag' => '🇨🇮', 'rtl' => false ], - 'fr_CM' => [ 'label' => 'French (Cameroon)', 'native_name' => 'Français (Cameroun)', 'flag' => '🇨🇲', 'rtl' => false ], - 'fr_DJ' => [ 'label' => 'French (Djibouti)', 'native_name' => 'Français (Djibouti)', 'flag' => '🇩🇯', 'rtl' => false ], - 'fr_FR' => [ 'label' => 'French (France)', 'native_name' => 'Français (France)', 'flag' => '🇫🇷', 'rtl' => false ], - 'fr_GA' => [ 'label' => 'French (Gabon)', 'native_name' => 'Français (Gabon)', 'flag' => '🇬🇦', 'rtl' => false ], - 'fr_GN' => [ 'label' => 'French (Guinea)', 'native_name' => 'Français (Guinée)', 'flag' => '🇬🇳', 'rtl' => false ], - 'fr_GP' => [ 'label' => 'French (Guadeloupe)', 'native_name' => 'Français (Guadeloup)', 'flag' => '🇬🇵', 'rtl' => false ], - 'fr_GQ' => [ 'label' => 'French (Equatorial Guinea)', 'native_name' => 'Français (Guinée Équatoriale)', 'flag' => '🇬🇶', 'rtl' => false ], - 'fr_KM' => [ 'label' => 'French (Comoros)', 'native_name' => 'Français (Comores)', 'flag' => '🇰🇲', 'rtl' => false ], - 'fr_LU' => [ 'label' => 'French (Luxembourg)', 'native_name' => 'Français (Luxembourg)', 'flag' => '🇱🇺', 'rtl' => false ], - 'fr_MC' => [ 'label' => 'French (Monaco)', 'native_name' => 'Français (Monaco)', 'flag' => '🇲🇨', 'rtl' => false ], - 'fr_MF' => [ 'label' => 'French (Saint Martin)', 'native_name' => 'Français (Saint Martin)', 'flag' => '🇲🇫', 'rtl' => false ], - 'fr_MG' => [ 'label' => 'French (Madagascar)', 'native_name' => 'Français (Madagascar)', 'flag' => '🇲🇬', 'rtl' => false ], - 'fr_ML' => [ 'label' => 'French (Mali)', 'native_name' => 'Français (Mali)', 'flag' => '🇲🇱', 'rtl' => false ], - 'fr_MQ' => [ 'label' => 'French (Martinique)', 'native_name' => 'Français (Martinique)', 'flag' => '🇲🇶', 'rtl' => false ], - 'fr_NE' => [ 'label' => 'French (Niger)', 'native_name' => 'Français (Niger)', 'flag' => '🇳🇪', 'rtl' => false ], - 'fr_RE' => [ 'label' => 'French (Réunion)', 'native_name' => 'Français (Réunion)', 'flag' => '🇷🇪', 'rtl' => false ], - 'fr_RW' => [ 'label' => 'French (Rwanda)', 'native_name' => 'Français (Rwanda)', 'flag' => '🇷🇼', 'rtl' => false ], - 'fr_SN' => [ 'label' => 'French (Senegal)', 'native_name' => 'Français (Sénégal)', 'flag' => '🇸🇳', 'rtl' => false ], - 'fr_TD' => [ 'label' => 'French (Chad)', 'native_name' => 'Français (Tchad)', 'flag' => '🇹🇩', 'rtl' => false ], - 'fr_TG' => [ 'label' => 'French (Togo)', 'native_name' => 'Français (Aller)', 'flag' => '🇹🇬', 'rtl' => false ], - 'ga' => [ 'label' => 'Irish', 'native_name' => 'Gaeilge', 'flag' => '🇮🇪', 'rtl' => false ], - 'ga_IE' => [ 'label' => 'Irish (Ireland)', 'native_name' => 'Gaeilge (Éireann)', 'flag' => '🇮🇪', 'rtl' => false ], - 'gl' => [ 'label' => 'Galician', 'native_name' => 'Galego', 'flag' => '🇪🇸', 'rtl' => false ], - 'gl_ES' => [ 'label' => 'Galician (Spain)', 'native_name' => 'Galego (España)', 'flag' => '🇪🇸', 'rtl' => false ], - 'gsw' => [ 'label' => 'Swiss German', 'native_name' => 'Schwiizerdütsch', 'flag' => '🇨🇭', 'rtl' => false ], - 'gsw_CH' => [ 'label' => 'Swiss German (Switzerland)', 'native_name' => 'Schwiizerdütsch', 'flag' => '🇨🇭', 'rtl' => false ], - 'gu' => [ 'label' => 'Gujarati', 'native_name' => 'ગુજરાતી', 'flag' => '🇮🇳', 'rtl' => false ], - 'gu_IN' => [ 'label' => 'Gujarati (India)', 'native_name' => 'ગુજરાતી (ભારત)', 'flag' => '🇮🇳', 'rtl' => false ], - 'guz' => [ 'label' => 'Gusii', 'native_name' => 'Ekegusii', 'flag' => '🇰🇪', 'rtl' => false ], - 'guz_KE' => [ 'label' => 'Gusii (Kenya)', 'native_name' => 'Ekegusii (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'gv' => [ 'label' => 'Manx', 'native_name' => 'Gaelg, Gailck', 'flag' => '🇮🇲', 'rtl' => false ], - 'gv_GB' => [ 'label' => 'Manx (United Kingdom)', 'native_name' => 'Gaelg, Gailck (United Kingdom)', 'flag' => '🇬🇧', 'rtl' => false ], - 'ha' => [ 'label' => 'Hausa', 'native_name' => 'هَرْشَن هَوْسَ', 'flag' => '🇳🇬', 'rtl' => true ], - 'ha_Latn' => [ 'label' => 'Hausa (Latin)', 'native_name' => 'Halshen Hausa (Na Latin)', 'flag' => '🇳🇬', 'rtl' => false ], - 'ha_Latn_GH' => [ 'label' => 'Hausa (Latin, Ghana)', 'native_name' => 'Halshen Hausa (Latin Ghana)', 'flag' => '🇬🇭', 'rtl' => false ], - 'ha_Latn_NE' => [ 'label' => 'Hausa (Latin, Niger)', 'native_name' => 'Halshen Hausa (Latin Niger)', 'flag' => '🇳🇪', 'rtl' => false ], - 'ha_Latn_NG' => [ 'label' => 'Hausa (Latin, Nigeria)', 'native_name' => 'Halshen Hausa (Latin Nigeria)', 'flag' => '🇳🇬', 'rtl' => false ], - 'haw' => [ 'label' => 'Hawaiian', 'native_name' => 'ʻŌlelo HawaiʻI', 'flag' => '🇺🇸', 'rtl' => false ], - 'haw_US' => [ 'label' => 'Hawaiian (United States)', 'native_name' => 'ʻŌlelo HawaiʻI (ʻAmelika Hui Pū ʻIa)', 'flag' => '🇺🇸', 'rtl' => false ], - 'he' => [ 'label' => 'Hebrew', 'native_name' => 'עִבְרִית', 'flag' => '🇮🇱', 'rtl' => true ], - 'he_IL' => [ 'label' => 'Hebrew (Israel)', 'native_name' => 'עברית (ישראל)', 'flag' => '🇮🇱', 'rtl' => true ], - 'hi' => [ 'label' => 'Hindi', 'native_name' => 'हिन्दी', 'flag' => '🇮🇳', 'rtl' => false ], - 'hi_IN' => [ 'label' => 'Hindi (India)', 'native_name' => 'हिन्दी (भारत)', 'flag' => '🇮🇳', 'rtl' => false ], - 'hr' => [ 'label' => 'Croatian', 'native_name' => 'Hrvatski', 'flag' => '🇭🇷', 'rtl' => false ], - 'hr_HR' => [ 'label' => 'Croatian (Croatia)', 'native_name' => 'Hrvatski (Hrvatska)', 'flag' => '🇭🇷', 'rtl' => false ], - 'hu' => [ 'label' => 'Hungarian', 'native_name' => 'Magyar Nyelv', 'flag' => '🇭🇺', 'rtl' => false ], - 'hu_HU' => [ 'label' => 'Hungarian (Hungary)', 'native_name' => 'Magyar Nyelv (Magyarország)', 'flag' => '🇭🇺', 'rtl' => false ], - 'hy' => [ 'label' => 'Armenian', 'native_name' => 'Հայերէն/Հայերեն', 'flag' => '🇦🇲', 'rtl' => false ], - 'hy_AM' => [ 'label' => 'Armenian (Armenia)', 'native_name' => 'Հայերէն/Հայերեն (Հայաստան)', 'flag' => '🇦🇲', 'rtl' => false ], - 'id' => [ 'label' => 'Indonesian', 'native_name' => 'Bahasa Indonesia', 'flag' => '🇮🇩', 'rtl' => false ], - 'id_ID' => [ 'label' => 'Indonesian (Indonesia)', 'native_name' => 'Bahasa Indonesia (Indonesia)', 'flag' => '🇮🇩', 'rtl' => false ], - 'ig' => [ 'label' => 'Igbo', 'native_name' => 'Ásụ̀Sụ́ Ìgbò', 'flag' => '🇳🇬', 'rtl' => false ], - 'ig_NG' => [ 'label' => 'Igbo (Nigeria)', 'native_name' => 'Ásụ̀Sụ́ Ìgbò (Nigeria)', 'flag' => '🇳🇬', 'rtl' => false ], - 'ii' => [ 'label' => 'Sichuan Yi', 'native_name' => 'ꆈꌠꉙ', 'flag' => '🇨🇳', 'rtl' => false ], - 'ii_CN' => [ 'label' => 'Sichuan Yi (China)', 'native_name' => 'ꆈꌠꉙ (China)', 'flag' => '🇨🇳', 'rtl' => false ], - 'is' => [ 'label' => 'Icelandic', 'native_name' => 'Íslenska', 'flag' => '🇮🇸', 'rtl' => false ], - 'is_IS' => [ 'label' => 'Icelandic (Iceland)', 'native_name' => 'Íslenska (Ísland)', 'flag' => '🇮🇸', 'rtl' => false ], - 'it' => [ 'label' => 'Italian', 'native_name' => 'Italiano', 'flag' => '🇮🇹', 'rtl' => false ], - 'it_CH' => [ 'label' => 'Italian (Switzerland)', 'native_name' => 'Italiano (Svizzera)', 'flag' => '🇨🇭', 'rtl' => false ], - 'it_IT' => [ 'label' => 'Italian (Italy)', 'native_name' => 'Italiano (Italia)', 'flag' => '🇮🇹', 'rtl' => false ], - 'ja' => [ 'label' => 'Japanese', 'native_name' => '日本語', 'flag' => '🇯🇵', 'rtl' => false ], - 'ja_JP' => [ 'label' => 'Japanese (Japan)', 'native_name' => '日本語 (日本)', 'flag' => '🇯🇵', 'rtl' => false ], - 'jmc' => [ 'label' => 'Machame', 'native_name' => 'West Chaga', 'flag' => '🇹🇿', 'rtl' => false ], - 'jmc_TZ' => [ 'label' => 'Machame (Tanzania)', 'native_name' => 'West Chaga (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false ], - 'ka' => [ 'label' => 'Georgian', 'native_name' => 'ᲥᲐᲠᲗᲣᲚᲘ ᲔᲜᲐ', 'flag' => '🇬🇪', 'rtl' => false ], - 'ka_GE' => [ 'label' => 'Georgian (Georgia)', 'native_name' => 'ᲥᲐᲠᲗᲣᲚᲘ ᲔᲜᲐ (ᲡᲐᲥᲐᲠᲗᲕᲔᲚᲝ)', 'flag' => '🇬🇪', 'rtl' => false ], - 'kab' => [ 'label' => 'Kabyle', 'native_name' => 'ⵜⴰⵇⴱⴰⵢⵍⵉⵜ', 'flag' => '🇩🇿', 'rtl' => false ], - 'kab_DZ' => [ 'label' => 'Kabyle (Algeria)', 'native_name' => 'ⵜⴰⵇⴱⴰⵢⵍⵉⵜ (Algeria)', 'flag' => '🇩🇿', 'rtl' => false ], - 'kam' => [ 'label' => 'Kamba', 'native_name' => 'Kikamba', 'flag' => '🇰🇪', 'rtl' => false ], - 'kam_KE' => [ 'label' => 'Kamba (Kenya)', 'native_name' => 'Kikamba (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'kde' => [ 'label' => 'Makonde', 'native_name' => 'Chi(Ni)Makonde', 'flag' => '🇹🇿', 'rtl' => false ], - 'kde_TZ' => [ 'label' => 'Makonde (Tanzania)', 'native_name' => 'Chi(Ni)Makonde (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false ], - 'kea' => [ 'label' => 'Kabuverdianu', 'native_name' => 'Kriolu, Kriol', 'flag' => '🇨🇻', 'rtl' => false ], - 'kea_CV' => [ 'label' => 'Kabuverdianu (Cape Verde)', 'native_name' => 'Kriolu, Kriol (Cape Verde)', 'flag' => '🇨🇻', 'rtl' => false ], - 'khq' => [ 'label' => 'Koyra Chiini', 'native_name' => 'Koyra Chiini', 'flag' => '🇲🇱', 'rtl' => false ], - 'khq_ML' => [ 'label' => 'Koyra Chiini (Mali)', 'native_name' => 'Koyra Chiini (Mali)', 'flag' => '🇲🇱', 'rtl' => false ], - 'ki' => [ 'label' => 'Kikuyu', 'native_name' => 'Gĩkũyũ', 'flag' => '🇰🇪', 'rtl' => false ], - 'ki_KE' => [ 'label' => 'Kikuyu (Kenya)', 'native_name' => 'Gĩkũyũ (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'kk' => [ 'label' => 'Kazakh', 'native_name' => 'قازاقشا Or قازاق ٴتىلى', 'flag' => '🇰🇿', 'rtl' => true ], - 'kk_Cyrl' => [ 'label' => 'Kazakh (Cyrillic)', 'native_name' => 'Қазақша Or Қазақ Тілі (Кириллица)', 'flag' => '🇷🇺', 'rtl' => false ], - 'kk_Cyrl_KZ' => [ 'label' => 'Kazakh (Cyrillic, Kazakhstan)', 'native_name' => 'Қазақша Or Қазақ Тілі (Кириллица)', 'flag' => '🇰🇿', 'rtl' => false ], - 'kl' => [ 'label' => 'Kalaallisut', 'native_name' => 'Kalaallisut', 'flag' => '🇬🇱', 'rtl' => false ], - 'kl_GL' => [ 'label' => 'Kalaallisut (Greenland)', 'native_name' => 'Kalaallisut (Greenland)', 'flag' => '🇬🇱', 'rtl' => false ], - 'kln' => [ 'label' => 'Kalenjin', 'native_name' => 'Kalenjin', 'flag' => '🇰🇪', 'rtl' => false ], - 'kln_KE' => [ 'label' => 'Kalenjin (Kenya)', 'native_name' => 'Kalenjin (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'km' => [ 'label' => 'Khmer', 'native_name' => 'ភាសាខ្មែរ', 'flag' => '🇰🇭', 'rtl' => false ], - 'km_KH' => [ 'label' => 'Khmer (Cambodia)', 'native_name' => 'ភាសាខ្មែរ (ខេសកម្ពុជា)', 'flag' => '🇰🇭', 'rtl' => false ], - 'kn' => [ 'label' => 'Kannada', 'native_name' => 'ಕನ್ನಡ', 'flag' => '🇮🇳', 'rtl' => false ], - 'kn_IN' => [ 'label' => 'Kannada (India)', 'native_name' => 'ಕನ್ನಡ (ಭಾರತ)', 'flag' => '🇮🇳', 'rtl' => false ], - 'ko' => [ 'label' => 'Korean', 'native_name' => '한국어', 'flag' => '🇰🇷', 'rtl' => false ], - 'ko_KR' => [ 'label' => 'Korean (South Korea)', 'native_name' => '한국어 (대한민국)', 'flag' => '🇰🇷', 'rtl' => false ], - 'kok' => [ 'label' => 'Konkani', 'native_name' => 'कोंकणी', 'flag' => '🇮🇳', 'rtl' => false ], - 'kok_IN' => [ 'label' => 'Konkani (India)', 'native_name' => 'कोंकणी (India)', 'flag' => '🇮🇳', 'rtl' => false ], - 'ku' => [ 'label' => 'Kurdish (Kurmanji)', 'native_name' => 'کورمانجی', 'flag' => '🏳️', 'rtl' => true, ], - 'kw' => [ 'label' => 'Cornish', 'native_name' => 'Kernewek, Kernowek', 'flag' => '🇬🇧', 'rtl' => false ], - 'kw_GB' => [ 'label' => 'Cornish (United Kingdom)', 'native_name' => 'Kernewek, Kernowek (United Kingdom)', 'flag' => '🇬🇧', 'rtl' => false ], - 'lag' => [ 'label' => 'Langi', 'native_name' => 'Lëblaŋo', 'flag' => '🇺🇬', 'rtl' => false ], - 'lag_TZ' => [ 'label' => 'Langi (Tanzania)', 'native_name' => 'Kilaangi (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false ], - 'lg' => [ 'label' => 'Ganda', 'native_name' => 'Ganda', 'flag' => '🇺🇬', 'rtl' => false ], - 'lg_UG' => [ 'label' => 'Ganda (Uganda)', 'native_name' => 'Ganda (Uganda)', 'flag' => '🇺🇬', 'rtl' => false ], - 'lki_IR' => [ 'label' => 'Laki (Iran)', 'native_name' => 'له‌کی', 'flag' => '🇮🇷', 'rtl' => true, ], - 'lki_TR' => [ 'label' => 'Laki (Turkey)', 'native_name' => 'له‌کی', 'flag' => '🇹🇷', 'rtl' => true, ], - 'lt' => [ 'label' => 'Lithuanian', 'native_name' => 'Lietuvių Kalba', 'flag' => '🇱🇹', 'rtl' => false ], - 'lt_LT' => [ 'label' => 'Lithuanian (Lithuania)', 'native_name' => 'Lietuvių Kalba (Lietuva)', 'flag' => '🇱🇹', 'rtl' => false ], - 'luo' => [ 'label' => 'Luo', 'native_name' => 'Lwo', 'flag' => '🇰🇪', 'rtl' => false ], - 'luo_KE' => [ 'label' => 'Luo (Kenya)', 'native_name' => 'Dholuo (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'luy' => [ 'label' => 'Luyia', 'native_name' => 'Oluluhya', 'flag' => '🇰🇪', 'rtl' => false ], - 'luy_KE' => [ 'label' => 'Luyia (Kenya)', 'native_name' => 'Oluluhya (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'lv' => [ 'label' => 'Latvian', 'native_name' => 'Latviešu Valoda', 'flag' => '🇱🇻', 'rtl' => false ], - 'lv_LV' => [ 'label' => 'Latvian (Latvia)', 'native_name' => 'Latviešu Valoda (Latvija)', 'flag' => '🇱🇻', 'rtl' => false ], - 'mas' => [ 'label' => 'Masai', 'native_name' => 'ƆL Maa', 'flag' => '🇰🇪', 'rtl' => false ], - 'mas_KE' => [ 'label' => 'Masai (Kenya)', 'native_name' => 'ƆL Maa (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'mas_TZ' => [ 'label' => 'Masai (Tanzania)', 'native_name' => 'ƆL Maa (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false ], - 'mer' => [ 'label' => 'Meru', 'native_name' => 'Kĩmĩĩrũ', 'flag' => '🇰🇪', 'rtl' => false ], - 'mer_KE' => [ 'label' => 'Meru (Kenya)', 'native_name' => 'Kĩmĩĩrũ (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'mfe' => [ 'label' => 'Morisyen', 'native_name' => 'Kreol Morisien', 'flag' => '🇲🇺', 'rtl' => false ], - 'mfe_MU' => [ 'label' => 'Morisyen (Mauritius)', 'native_name' => 'Kreol Morisien (Mauritius)', 'flag' => '🇲🇺', 'rtl' => false ], - 'mg' => [ 'label' => 'Malagasy', 'native_name' => 'Malagasy', 'flag' => '🇲🇬', 'rtl' => false ], - 'mg_MG' => [ 'label' => 'Malagasy (Madagascar)', 'native_name' => 'Malagasy (Madagaskar)', 'flag' => '🇲🇬', 'rtl' => false ], - 'mk' => [ 'label' => 'Macedonian', 'native_name' => 'Македонски', 'flag' => '🇲🇰', 'rtl' => false ], - 'mk_MK' => [ 'label' => 'Macedonian (Macedonia)', 'native_name' => 'Македонски, Makedonski (Македонија)', 'flag' => '🇲🇰', 'rtl' => false ], - 'ml' => [ 'label' => 'Malayalam', 'native_name' => 'മലയാളം', 'flag' => '🇮🇳', 'rtl' => false ], - 'ml_IN' => [ 'label' => 'Malayalam (India)', 'native_name' => 'മലയാളം (ഇന്ത്യ)', 'flag' => '🇮🇳', 'rtl' => false ], - 'mr' => [ 'label' => 'Marathi', 'native_name' => 'मराठी', 'flag' => '🇮🇳', 'rtl' => false ], - 'mr_IN' => [ 'label' => 'Marathi (India)', 'native_name' => 'मराठी (भारत)', 'flag' => '🇮🇳', 'rtl' => false ], - 'ms' => [ 'label' => 'Malay', 'native_name' => 'Bahasa Melayu', 'flag' => '🇲🇾', 'rtl' => false ], - 'ms_BN' => [ 'label' => 'Malay (Brunei)', 'native_name' => 'Bahasa Melayu Brunei', 'flag' => '🇧🇳', 'rtl' => false ], - 'ms_MY' => [ 'label' => 'Malay (Malaysia)', 'native_name' => 'Bahasa Melayu (Malaysia)', 'flag' => '🇲🇾', 'rtl' => false ], - 'mt' => [ 'label' => 'Maltese', 'native_name' => 'Malti', 'flag' => '🇲🇹', 'rtl' => false ], - 'mt_MT' => [ 'label' => 'Maltese (Malta)', 'native_name' => 'Malti (Malta)', 'flag' => '🇲🇹', 'rtl' => false ], - 'my' => [ 'label' => 'Burmese', 'native_name' => 'မြန်မာစာ', 'flag' => '🇲🇲', 'rtl' => false ], - 'my_MM' => [ 'label' => 'Burmese (Myanmar [Burma])', 'native_name' => 'မြန်မာစာ (မြန်မာ [Burma])', 'flag' => '🇲🇲', 'rtl' => false ], - 'naq' => [ 'label' => 'Nama', 'native_name' => 'Khoekhoegowab', 'flag' => '🇳🇦', 'rtl' => false ], - 'naq_NA' => [ 'label' => 'Nama (Namibia)', 'native_name' => 'Khoekhoegowab (Nambia)', 'flag' => '🇳🇦', 'rtl' => false ], - 'nb' => [ 'label' => 'Norwegian Bokmål', 'native_name' => 'Bokmål', 'flag' => '🇳🇴', 'rtl' => false ], - 'nb_NO' => [ 'label' => 'Norwegian Bokmål (Norway)', 'native_name' => 'Bokmål (Norge)', 'flag' => '🇳🇴', 'rtl' => false ], - 'nd' => [ 'label' => 'North Ndebele', 'native_name' => 'Isindebele Sasenyakatho', 'flag' => '🇿🇼', 'rtl' => false ], - 'nd_ZW' => [ 'label' => 'North Ndebele (Zimbabwe)', 'native_name' => 'Isindebele Sasenyakatho (Zimbawe)', 'flag' => '🇿🇼', 'rtl' => false ], - 'ne' => [ 'label' => 'Nepali', 'native_name' => 'नेपाली', 'flag' => '🇳🇵', 'rtl' => false ], - 'ne_IN' => [ 'label' => 'Nepali (India)', 'native_name' => 'नेपाली (भारत)', 'flag' => '🇮🇳', 'rtl' => false ], - 'ne_NP' => [ 'label' => 'Nepali (Nepal)', 'native_name' => 'नेपाली (नेपाल)', 'flag' => '🇳🇵', 'rtl' => false ], - 'nl' => [ 'label' => 'Dutch', 'native_name' => 'Nederlands', 'flag' => '🇧🇶', 'rtl' => false ], - 'nl_BE' => [ 'label' => 'Dutch (Belgium)', 'native_name' => 'Nederlands (België)', 'flag' => '🇧🇪', 'rtl' => false ], - 'nl_NL' => [ 'label' => 'Dutch (Netherlands)', 'native_name' => 'Nederlands (Nederland)', 'flag' => '🇧🇶', 'rtl' => false ], - 'nn' => [ 'label' => 'Norwegian Nynorsk', 'native_name' => 'Norsk', 'flag' => '🇳🇴', 'rtl' => false ], - 'nn_NO' => [ 'label' => 'Norwegian Nynorsk (Norway)', 'native_name' => 'Norsk (Norway)', 'flag' => '🇳🇴', 'rtl' => false ], - 'nyn' => [ 'label' => 'Nyankole', 'native_name' => 'Orunyankore', 'flag' => '🇺🇬', 'rtl' => false ], - 'nyn_UG' => [ 'label' => 'Nyankole (Uganda)', 'native_name' => 'Orunyankore (Uganda)', 'flag' => '🇺🇬', 'rtl' => false ], - 'om' => [ 'label' => 'Oromo', 'native_name' => 'Afaan Oromoo', 'flag' => '🇪🇹', 'rtl' => false ], - 'om_ET' => [ 'label' => 'Oromo (Ethiopia)', 'native_name' => 'Afaan Oromoo (Ethiopia)', 'flag' => '🇪🇹', 'rtl' => false ], - 'om_KE' => [ 'label' => 'Oromo (Kenya)', 'native_name' => 'Afaan Oromoo (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'or' => [ 'label' => 'Oriya', 'native_name' => 'ଓଡ଼ିଆ', 'flag' => '🇮🇳', 'rtl' => false ], - 'or_IN' => [ 'label' => 'Oriya (India)', 'native_name' => 'ଓଡ଼ିଆ (ଭାରତ)', 'flag' => '🇮🇳', 'rtl' => false ], - 'pa' => [ 'label' => 'Punjabi', 'native_name' => 'ਪੰਜਾਬੀ', 'flag' => '🇮🇳', 'rtl' => true ], - 'pa_Arab' => [ 'label' => 'Punjabi (Arabic)', 'native_name' => 'پن٘جابی (ਅਰਬੀ)', 'flag' => '🇶🇦', 'rtl' => true ], - 'pa_Arab_PK' => [ 'label' => 'Punjabi (Arabic, Pakistan)', 'native_name' => 'پن٘جابی(Arabic, Pakistan)', 'flag' => '🇵🇰', 'rtl' => true ], - 'pa_Guru' => [ 'label' => 'Punjabi (Gurmukhi)', 'native_name' => 'ਪੰਜਾਬੀ (ਗੁਰਮੁਖੀ)', 'flag' => '🇵🇰', 'rtl' => false ], - 'pa_Guru_IN' => [ 'label' => 'Punjabi (Gurmukhi, India)', 'native_name' => 'ਪੰਜਾਬੀ (Gurmukhi, India)', 'flag' => '🇮🇳', 'rtl' => false ], - 'pa_IN' => [ 'label' => 'Punjabi (India)', 'native_name' => 'ਪੰਜਾਬੀ (India)', 'flag' => '🇮🇳', 'rtl' => false ], - 'pl' => [ 'label' => 'Polish', 'native_name' => 'Polski', 'flag' => '🇵🇱', 'rtl' => false ], - 'pl_PL' => [ 'label' => 'Polish (Poland)', 'native_name' => 'Polski (Polska)', 'flag' => '🇵🇱', 'rtl' => false ], - 'ps' => [ 'label' => 'Pashto', 'native_name' => 'پښتو', 'flag' => '🇦🇫', 'rtl' => true ], - 'ps_AF' => [ 'label' => 'Pashto (Afghanistan)', 'native_name' => 'پښتو (افغانستان)', 'flag' => '🇦🇫', 'rtl' => true ], - 'pt' => [ 'label' => 'Portuguese', 'native_name' => 'Português', 'flag' => '🇧🇷', 'rtl' => false ], - 'pt_BR' => [ 'label' => 'Portuguese (Brazil)', 'native_name' => 'Português (Brasil)', 'flag' => '🇧🇷', 'rtl' => false ], - 'pt_GW' => [ 'label' => 'Portuguese (Guinea-Bissau)', 'native_name' => 'Português (Guiné-Bissau)', 'flag' => '🇬🇼', 'rtl' => false ], - 'pt_MZ' => [ 'label' => 'Portuguese (Mozambique)', 'native_name' => 'Português (Moçambique)', 'flag' => '🇲🇿', 'rtl' => false ], - 'pt_PT' => [ 'label' => 'Portuguese (Portugal)', 'native_name' => 'Português (Portugal)', 'flag' => '🇵🇹', 'rtl' => false ], - 'rm' => [ 'label' => 'Romansh', 'native_name' => 'Romontsch', 'flag' => '🇨🇭', 'rtl' => false ], - 'rm_CH' => [ 'label' => 'Romansh (Switzerland)', 'native_name' => 'Romontsch (Switzerland)', 'flag' => '🇨🇭', 'rtl' => false ], - 'ro' => [ 'label' => 'Romanian', 'native_name' => 'Limba Română', 'flag' => '🇷🇴', 'rtl' => false ], - 'ro_MD' => [ 'label' => 'Romanian (Moldova)', 'native_name' => 'Лимба Молдовеняскэ (Moldova)', 'flag' => '🇲🇩', 'rtl' => false ], - 'ro_RO' => [ 'label' => 'Romanian (Romania)', 'native_name' => 'Română', 'flag' => '🇷🇴', 'rtl' => false ], - 'rof' => [ 'label' => 'Rombo', 'native_name' => 'Kirombo', 'flag' => '🇹🇿', 'rtl' => false ], - 'rof_TZ' => [ 'label' => 'Rombo (Tanzania)', 'native_name' => 'Kirombo (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false ], - 'ru' => [ 'label' => 'Russian', 'native_name' => 'Русский Язык', 'flag' => '🇷🇺', 'rtl' => false ], - 'ru_MD' => [ 'label' => 'Russian (Moldova)', 'native_name' => 'Русский Язык (Молдова)', 'flag' => '🇲🇩', 'rtl' => false ], - 'ru_RU' => [ 'label' => 'Russian (Russia)', 'native_name' => 'Русский Язык (Россия)', 'flag' => '🇷🇺', 'rtl' => false ], - 'ru_UA' => [ 'label' => 'Russian (Ukraine)', 'native_name' => 'Російська Мова (Украина)', 'flag' => '🇺🇦', 'rtl' => false ], - 'rw' => [ 'label' => 'Kinyarwanda', 'native_name' => 'Ikinyarwanda', 'flag' => '🇷🇼', 'rtl' => false ], - 'rw_RW' => [ 'label' => 'Kinyarwanda (Rwanda)', 'native_name' => 'Ikinyarwanda (U Rwanda)', 'flag' => '🇷🇼', 'rtl' => false ], - 'rwk' => [ 'label' => 'Rwa', 'native_name' => 'Rwa', 'flag' => '🇷🇼', 'rtl' => false ], - 'rwk_TZ' => [ 'label' => 'Rwa (Tanzania)', 'native_name' => 'Rwa', 'flag' => '🇹🇿', 'rtl' => false ], - 'saq' => [ 'label' => 'Samburu', 'native_name' => 'Sampur, ƆL Maa', 'flag' => '🇰🇪', 'rtl' => false ], - 'saq_KE' => [ 'label' => 'Samburu (Kenya)', 'native_name' => 'Sampur, ƆL Maa (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'sdh_IR' => [ 'label' => 'Southern Kurdish (Iran)', 'native_name' => 'کوردی خوارگ', 'flag' => '🇮🇷', 'rtl' => true, ], - 'sdh_IQ' => [ 'label' => 'Southern Kurdish (Iran)', 'native_name' => 'کوردی خوارگ', 'flag' => '🇮🇶', 'rtl' => true, ], - 'seh' => [ 'label' => 'Sena', 'native_name' => 'Sena', 'flag' => '🇲🇿', 'rtl' => false ], - 'seh_MZ' => [ 'label' => 'Sena (Mozambique)', 'native_name' => 'Sena (Mozambique)', 'flag' => '🇲🇿', 'rtl' => false ], - 'ses' => [ 'label' => 'Koyraboro Senni', 'native_name' => 'Koyraboro Senni', 'flag' => '🇲🇱', 'rtl' => false ], - 'ses_ML' => [ 'label' => 'Koyraboro Senni (Mali)', 'native_name' => 'Koyraboro Senni (Mali)', 'flag' => '🇲🇱', 'rtl' => false ], - 'sg' => [ 'label' => 'Sango', 'native_name' => 'Yângâ Tî Sängö', 'flag' => '🇨🇫', 'rtl' => false ], - 'sg_CF' => [ 'label' => 'Sango (Central African Republic)', 'native_name' => 'Yângâ Tî Sängö (Central African Republic)', 'flag' => '🇨🇫', 'rtl' => false ], - 'shi' => [ 'label' => 'Tachelhit', 'native_name' => 'TacelḥIt', 'flag' => '🇲🇦', 'rtl' => false ], - 'shi_Latn' => [ 'label' => 'Tachelhit (Latin)', 'native_name' => 'TacelḥIt (Latin)', 'flag' => '🇲🇦', 'rtl' => false ], - 'shi_Latn_MA' => [ 'label' => 'Tachelhit (Latin, Morocco)', 'native_name' => 'TaclḥIyt (Latin, Morocco)', 'flag' => '🇲🇦', 'rtl' => false ], - 'shi_Tfng' => [ 'label' => 'Tachelhit (Tifinagh)', 'native_name' => 'ⵜⴰⵛⵍⵃⵉⵜ (Tifinagh)', 'flag' => '🇲🇦', 'rtl' => false ], - 'shi_Tfng_MA' => [ 'label' => 'Tachelhit (Tifinagh, Morocco)', 'native_name' => 'ⵜⴰⵛⵍⵃⵉⵜ (Tifinagh, Morocco)', 'flag' => '🇲🇦', 'rtl' => false ], - 'si' => [ 'label' => 'Sinhala', 'native_name' => 'සිංහල', 'flag' => '🇱🇰', 'rtl' => false ], - 'si_LK' => [ 'label' => 'Sinhala (Sri Lanka)', 'native_name' => 'සිංහල (ශ්රී ලංකාව)', 'flag' => '🇱🇰', 'rtl' => false ], - 'sk' => [ 'label' => 'Slovak', 'native_name' => 'Slovenčina, Slovenský Jazyk', 'flag' => '🇸🇰', 'rtl' => false ], - 'sk_SK' => [ 'label' => 'Slovak (Slovakia)', 'native_name' => 'Slovenčina, Slovenský Jazyk (Slovensko)', 'flag' => '🇸🇰', 'rtl' => false ], - 'sl' => [ 'label' => 'Slovenian', 'native_name' => 'Slovenščina', 'flag' => '🇸🇮', 'rtl' => false ], - 'sl_SI' => [ 'label' => 'Slovenian (Slovenia)', 'native_name' => 'Slovenščina (Slovenija)', 'flag' => '🇸🇮', 'rtl' => false ], - 'sn' => [ 'label' => 'Shona', 'native_name' => 'Chishona', 'flag' => '🇿🇼', 'rtl' => false ], - 'sn_ZW' => [ 'label' => 'Shona (Zimbabwe)', 'native_name' => 'Chishona (Zimbabwe)', 'flag' => '🇿🇼', 'rtl' => false ], - 'so' => [ 'label' => 'Somali', 'native_name' => 'Af Soomaali', 'flag' => '🇸🇴', 'rtl' => false ], - 'so_DJ' => [ 'label' => 'Somali (Djibouti)', 'native_name' => 'اف صومالي (Jabuuti)', 'flag' => '🇩🇯', 'rtl' => true ], - 'so_ET' => [ 'label' => 'Somali (Ethiopia)', 'native_name' => '𐒖𐒍 𐒈𐒝𐒑𐒛𐒐𐒘, 𐒈𐒝𐒑𐒛𐒐𐒘 (Ethiopia)', 'flag' => '🇪🇹', 'rtl' => false ], - 'so_KE' => [ 'label' => 'Somali (Kenya)', 'native_name' => 'Af Soomaali (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'so_SO' => [ 'label' => 'Somali (Somalia)', 'native_name' => 'Af Soomaali (Soomaaliya)', 'flag' => '🇸🇴', 'rtl' => false ], - 'sq' => [ 'label' => 'Albanian', 'native_name' => 'Gjuha Shqipe', 'flag' => '🇦🇱', 'rtl' => false ], - 'sq_AL' => [ 'label' => 'Albanian (Albania)', 'native_name' => 'Gjuha Shqipe (Shqipëri)', 'flag' => '🇦🇱', 'rtl' => false ], - 'sr' => [ 'label' => 'Serbian', 'native_name' => 'Srpski Jezik', 'flag' => '🇷🇸', 'rtl' => false ], - 'sr_BA' => [ 'label' => 'Serbian (Cyrillic)', 'native_name' => 'Cрпски Језик (Ћирилица)', 'flag' => '🇷🇸', 'rtl' => false ], - 'sr_Cyrl' => [ 'label' => 'Serbian (Cyrillic)', 'native_name' => 'Cрпски Језик (Ћирилица)', 'flag' => '🇷🇺', 'rtl' => false ], - 'sr_Cyrl_BA' => [ 'label' => 'Serbian (Cyrillic, Bosnia and Herzegovina)', 'native_name' => 'Cрпски Језик (Cyrillic, Bosnia And Herzegovina)', 'flag' => '🇧🇦', 'rtl' => false ], - 'sr_Cyrl_ME' => [ 'label' => 'Serbian (Cyrillic, Montenegro)', 'native_name' => 'Cрпски Језик (Cyrillic, Montenegro)', 'flag' => '🇲🇪', 'rtl' => false ], - 'sr_Cyrl_RS' => [ 'label' => 'Serbian (Cyrillic, Serbia)', 'native_name' => 'Cрпски Језик (Cyrillic, Serbia)', 'flag' => '🇷🇸', 'rtl' => false ], - 'sr_Latn' => [ 'label' => 'Serbian (Latin)', 'native_name' => 'Srpski Jezik (Латински Језик)', 'flag' => '🇷🇸', 'rtl' => false ], - 'sr_Latn_BA' => [ 'label' => 'Serbian (Latin, Bosnia and Herzegovina)', 'native_name' => 'Srpski Jezik (Latin, Bosnia And Herzegovina)', 'flag' => '🇧🇦', 'rtl' => false ], - 'sr_Latn_ME' => [ 'label' => 'Serbian (Latin, Montenegro)', 'native_name' => 'Srpski Jezik (Latin, Montenegro)', 'flag' => '🇲🇪', 'rtl' => false ], - 'sr_Latn_RS' => [ 'label' => 'Serbian (Latin, Serbia)', 'native_name' => 'Srpski Jezik (Latin, Serbia)', 'flag' => '🇷🇸', 'rtl' => false ], - 'sv' => [ 'label' => 'Swedish', 'native_name' => 'Svenska', 'flag' => '🇸🇪', 'rtl' => false ], - 'sv_FI' => [ 'label' => 'Swedish (Finland)', 'native_name' => 'Finlandssvenska (Finland)', 'flag' => '🇫🇮', 'rtl' => false ], - 'sv_SE' => [ 'label' => 'Swedish (Sweden)', 'native_name' => 'Svenska (Sverige)', 'flag' => '🇸🇪', 'rtl' => false ], - 'sw' => [ 'label' => 'Swahili', 'native_name' => 'Kiswahili', 'flag' => '🇹🇿', 'rtl' => false ], - 'sw_KE' => [ 'label' => 'Swahili (Kenya)', 'native_name' => 'Kiswahili (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'sw_TZ' => [ 'label' => 'Swahili (Tanzania)', 'native_name' => 'Kiswahili (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false ], - 'ta' => [ 'label' => 'Tamil', 'native_name' => 'தமிழ்', 'flag' => '🇮🇳', 'rtl' => false ], - 'ta_IN' => [ 'label' => 'Tamil (India)', 'native_name' => 'தமிழ் (இந்தியா)', 'flag' => '🇮🇳', 'rtl' => false ], - 'ta_LK' => [ 'label' => 'Tamil (Sri Lanka)', 'native_name' => 'ஈழத் தமிழ் (இலங்கை)', 'flag' => '🇱🇰', 'rtl' => false ], - 'te' => [ 'label' => 'Telugu', 'native_name' => 'తెలుగు', 'flag' => '🇮🇳', 'rtl' => false ], - 'te_IN' => [ 'label' => 'Telugu (India)', 'native_name' => 'తెలుగు (భారతదేశం)', 'flag' => '🇮🇳', 'rtl' => false ], - 'teo' => [ 'label' => 'Teso', 'native_name' => 'Ateso', 'flag' => '🇺🇬', 'rtl' => false ], - 'teo_KE' => [ 'label' => 'Teso (Kenya)', 'native_name' => 'Ateso (Kenya)', 'flag' => '🇰🇪', 'rtl' => false ], - 'teo_UG' => [ 'label' => 'Teso (Uganda)', 'native_name' => 'Ateso (Uganda)', 'flag' => '🇺🇬', 'rtl' => false ], - 'th' => [ 'label' => 'Thai', 'native_name' => 'ภาษาไทย', 'flag' => '🇹🇭', 'rtl' => false ], - 'th_TH' => [ 'label' => 'Thai (Thailand)', 'native_name' => 'ภาษาไทย (ประเทศไทย)', 'flag' => '🇹🇭', 'rtl' => false ], - 'ti' => [ 'label' => 'Tigrinya', 'native_name' => 'ትግርኛ', 'flag' => '🇪🇹', 'rtl' => false ], - 'ti_ER' => [ 'label' => 'Tigrinya (Eritrea)', 'native_name' => 'ትግርኛ (Eritrea)', 'flag' => '🇪🇷', 'rtl' => false ], - 'ti_ET' => [ 'label' => 'Tigrinya (Ethiopia)', 'native_name' => 'ትግርኛ (Ethiopia)', 'flag' => '🇪🇹', 'rtl' => false ], - 'tl' => [ 'label' => 'Tagalog', 'native_name' => 'Tagalog', 'flag' => '🇵🇭', 'rtl' => false ], - 'to' => [ 'label' => 'Tonga', 'native_name' => 'Lea Faka', 'flag' => '🇹🇴', 'rtl' => false ], - 'to_TO' => [ 'label' => 'Tonga (Tonga)', 'native_name' => 'Lea Faka (Tonga)', 'flag' => '🇹🇴', 'rtl' => false ], - 'tr' => [ 'label' => 'Turkish', 'native_name' => 'Türkçe', 'flag' => '🇹🇷', 'rtl' => false ], - 'tr_TR' => [ 'label' => 'Turkish (Türkiye)', 'native_name' => 'Türkçe (Türkiye)', 'flag' => '🇹🇷', 'rtl' => false ], - 'tzm' => [ 'label' => 'Central Morocco Tamazight', 'native_name' => 'ⵜⴰⵎⴰⵣⵉⵖⵜ', 'flag' => '🇲🇦', 'rtl' => false ], - 'tzm_Latn' => [ 'label' => 'Central Morocco Tamazight (Latin)', 'native_name' => 'TamaziɣT (Latin)', 'flag' => '🇲🇦', 'rtl' => false ], - 'tzm_Latn_MA' => [ 'label' => 'Central Morocco Tamazight (Latin, Morocco)', 'native_name' => 'TamaziɣT (Latin, Morocco)', 'flag' => '🇲🇦', 'rtl' => false ], - 'uk' => [ 'label' => 'Ukrainian', 'native_name' => 'Українська Мова', 'flag' => '🇺🇦', 'rtl' => false ], - 'uk_UA' => [ 'label' => 'Ukrainian (Ukraine)', 'native_name' => 'Українська Мова (Україна)', 'flag' => '🇺🇦', 'rtl' => false ], - 'ur' => [ 'label' => 'Urdu', 'native_name' => 'اُردُو', 'flag' => '🇵🇰', 'rtl' => true ], - 'ur_IN' => [ 'label' => 'Urdu (India)', 'native_name' => 'اُردُو (ہندوستان)', 'flag' => '🇮🇳', 'rtl' => true ], - 'ur_PK' => [ 'label' => 'Urdu (Pakistan)', 'native_name' => 'اُردُو (پاکستان)', 'flag' => '🇵🇰', 'rtl' => true ], - 'uz' => [ 'label' => 'Uzbek', 'native_name' => 'اۉزبېکچه, اۉزبېک تیلی', 'flag' => '🇺🇿', 'rtl' => true ], - 'uz_Arab' => [ 'label' => 'Uzbek (Arabic)', 'native_name' => 'اۉزبېکچه, اۉزبېک تیلی (Arabparast)', 'flag' => '🇶🇦', 'rtl' => true ], - 'uz_Arab_AF' => [ 'label' => 'Uzbek (Arabic, Afghanistan)', 'native_name' => 'اۉزبېکچه, اۉزبېک تیلی (Arabic, Afghanistan)', 'flag' => '🇦🇫', 'rtl' => true ], - 'uz_Cyrl' => [ 'label' => 'Uzbek (Cyrillic)', 'native_name' => 'Ўзбекча, Ўзбек Тили (Kirillcha)', 'flag' => '🇷🇺', 'rtl' => false ], - 'uz_Cyrl_UZ' => [ 'label' => 'Uzbek (Cyrillic, Uzbekistan)', 'native_name' => 'Ўзбекча, Ўзбек Тили (Kirillcha Uzbekistan)', 'flag' => '🇺🇿', 'rtl' => false ], - 'uz_Latn' => [ 'label' => 'Uzbek (Latin)', 'native_name' => 'OʻZbekcha, OʻZbek Tili, (Lotin)', 'flag' => '🇺🇿', 'rtl' => false ], - 'uz_Latn_UZ' => [ 'label' => 'Uzbek (Latin, Uzbekistan)', 'native_name' => 'OʻZbekcha, OʻZbek Tili, (Lotin Uzbekistan)', 'flag' => '🇺🇿', 'rtl' => false ], - 'vi' => [ 'label' => 'Vietlabelse', 'native_name' => 'OʻZbekcha, OʻZbek Tili,', 'flag' => '🇻🇳', 'rtl' => false ], - 'vi_VN' => [ 'label' => 'Vietlabelse (Vietnam)', 'native_name' => 'TiếNg ViệT (ViệT Nam)', 'flag' => '🇻🇳', 'rtl' => false ], - 'vun' => [ 'label' => 'Vunjo', 'native_name' => 'Wunjo', 'flag' => '🇹🇿', 'rtl' => false ], - 'vun_TZ' => [ 'label' => 'Vunjo (Tanzania)', 'native_name' => 'Wunjo (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false ], - 'wo' => [ 'label' => 'Wolof', 'native_name' => 'Wolof', 'flag' => '🇸🇳', 'rtl' => false ], - 'xog' => [ 'label' => 'Soga', 'native_name' => 'Lusoga', 'flag' => '🇺🇬', 'rtl' => false ], - 'xog_UG' => [ 'label' => 'Soga (Uganda)', 'native_name' => 'Lusoga (Uganda)', 'flag' => '🇺🇬', 'rtl' => false ], - 'yo' => [ 'label' => 'Yoruba', 'native_name' => 'Èdè Yorùbá', 'flag' => '🇳🇬', 'rtl' => false ], - 'yo_NG' => [ 'label' => 'Yoruba (Nigeria)', 'native_name' => 'Èdè Yorùbá (Orilẹ-Ede Nigeria)', 'flag' => '🇳🇬', 'rtl' => false ], - 'yue_Hant_HK' => [ 'label' => 'Cantonese (Traditional, Hong Kong SAR China)', 'native_name' => '香港粵語', 'flag' => '🇭🇰', 'rtl' => false ], - 'zh' => [ 'label' => 'Chinese', 'native_name' => '中文简体', 'flag' => '🇨🇳', 'rtl' => false ], - 'zh_Hans' => [ 'label' => 'Chinese (Simplified Han)', 'native_name' => '中文简体 (简化的汉)', 'flag' => '🇨🇳', 'rtl' => false ], - 'zh_CN' => [ 'label' => 'Chinese (Simplified Han, China)', 'native_name' => '中文简体 (简化的汉,中国)', 'flag' => '🇨🇳', 'rtl' => false ], - 'zh_Hans_CN' => [ 'label' => 'Chinese (Simplified Han, China)', 'native_name' => '中文简体 (简化的汉,中国)', 'flag' => '🇨🇳', 'rtl' => false ], - 'zh_Hans_HK' => [ 'label' => 'Chinese (Simplified Han, Hong Kong SAR China)', 'native_name' => '簡體中文(香港) (简化的汉,香港中国)', 'flag' => '🇭🇰', 'rtl' => false ], - 'zh_Hans_MO' => [ 'label' => 'Chinese (Simplified Han, Macau SAR China)', 'native_name' => '简体中文 (澳门) (简化的汉,澳门)', 'flag' => '🇲🇴', 'rtl' => false ], - 'zh_Hans_SG' => [ 'label' => 'Chinese (Simplified Han, Singapore)', 'native_name' => '简体中文(新加坡) (简化的汉,新加坡)', 'flag' => '🇸🇬', 'rtl' => false ], - 'zh_Hant' => [ 'label' => 'Chinese (Traditional Han)', 'native_name' => '中文(繁體) (传统汉)', 'flag' => '🇹🇼', 'rtl' => false ], - 'zh_Hant_HK' => [ 'label' => 'Chinese (Traditional Han, Hong Kong SAR China)', 'native_name' => '中國繁體漢,(香港) (傳統的漢,香港中國)', 'flag' => '🇭🇰', 'rtl' => false ], - 'zh_Hant_MO' => [ 'label' => 'Chinese (Traditional Han, Macau SAR China)', 'native_name' => '中文(繁體漢、澳門) (傳統漢,澳門)', 'flag' => '🇲🇴', 'rtl' => false ], - 'zh_TW' => [ 'label' => 'Chinese (Traditional Han, Taiwan)', 'native_name' => '中文(繁體漢,台灣) (台灣傳統漢)', 'flag' => '🇹🇼', 'rtl' => false ], - 'zh_Hant_TW' => [ 'label' => 'Chinese (Traditional Han, Taiwan)', 'native_name' => '中文(繁體漢,台灣) (台灣傳統漢)', 'flag' => '🇹🇼', 'rtl' => false ], - 'zu' => [ 'label' => 'Zulu', 'native_name' => 'Isizulu', 'flag' => '🇿🇦', 'rtl' => false ], - 'zu_ZA' => [ 'label' => 'Zulu (South Africa)', 'native_name' => 'Isizulu (Iningizimu Afrika)', 'flag' => '🇿🇦', 'rtl' => false ], + 'af' => ['label' => 'Afrikaans', 'native_name' => 'Afrikaans', 'flag' => '🇿🇦', 'rtl' => false], + 'af_NA' => ['label' => 'Afrikaans (Namibia)', 'native_name' => 'Afrikáans Namibië', 'flag' => '🇳🇦', 'rtl' => false], + 'af_ZA' => ['label' => 'Afrikaans (South Africa)', 'native_name' => 'Afrikaans Suid-Afrika', 'flag' => '🇿🇦', 'rtl' => false], + 'ak' => ['label' => 'Akan', 'native_name' => 'Akan', 'flag' => '🇬🇭', 'rtl' => false], + 'ak_GH' => ['label' => 'Akan (Ghana)', 'native_name' => 'Akan (Ghana)', 'flag' => '🇬🇭', 'rtl' => false], + 'am' => ['label' => 'Amharic', 'native_name' => 'አማርኛ (AmarəÑña)', 'flag' => '🇪🇹', 'rtl' => false], + 'am_ET' => ['label' => 'Amharic (Ethiopia)', 'native_name' => 'አማርኛ (AmarəÑña)', 'flag' => '🇪🇹', 'rtl' => false], + 'ar' => ['label' => 'Arabic', 'native_name' => 'العربية', 'flag' => '🇦🇪', 'rtl' => true], + 'ar_AE' => ['label' => 'Arabic (United Arab Emirates)', 'native_name' => 'العربية‎ / Al-ʻArabiyyah, ʻArabī الإمارات العربية المتحدة', 'flag' => '🇦🇪', 'rtl' => true], + 'ar_BH' => ['label' => 'Arabic (Bahrain)', 'native_name' => 'العربية البحرانية', 'flag' => '🇧🇭', 'rtl' => true], + 'ar_DZ' => ['label' => 'Arabic (Algeria)', 'native_name' => 'دزيريةالجزائر', 'flag' => '🇩🇿', 'rtl' => true], + 'ar_EG' => ['label' => 'Arabic (Egypt)', 'native_name' => 'مصرى', 'flag' => '🇪🇬', 'rtl' => true], + 'ar_IQ' => ['label' => 'Arabic (Iraq)', 'native_name' => 'اللهجة العراقية', 'flag' => '🇮🇶', 'rtl' => true], + 'ar_JO' => ['label' => 'Arabic (Jordan)', 'native_name' => 'اللهجة الأردنية', 'flag' => '🇯🇴', 'rtl' => true], + 'ar_KW' => ['label' => 'Arabic (Kuwait)', 'native_name' => 'كويتي', 'flag' => '🇰🇼', 'rtl' => true], + 'ar_LB' => ['label' => 'Arabic (Lebanon)', 'native_name' => 'اللهجة اللبنانية', 'flag' => '🇱🇧', 'rtl' => true], + 'ar_LY' => ['label' => 'Arabic (Libya)', 'native_name' => 'ليبي', 'flag' => '🇱🇾', 'rtl' => true], + 'ar_MA' => ['label' => 'Arabic (Morocco)', 'native_name' => 'الدارجة اللهجة المغربية', 'flag' => '🇲🇦', 'rtl' => true], + 'ar_OM' => ['label' => 'Arabic (Oman)', 'native_name' => 'اللهجة العمانية', 'flag' => '🇴🇲', 'rtl' => true], + 'ar_QA' => ['label' => 'Arabic (Qatar)', 'native_name' => 'العربية (قطر)', 'flag' => '🇶🇦', 'rtl' => true], + 'ar_SA' => ['label' => 'Arabic (Saudi Arabia)', 'native_name' => "شبه جزيرة 'العربية", 'flag' => '🇸🇦', 'rtl' => true], + 'ar_SD' => ['label' => 'Arabic (Sudan)', 'native_name' => 'لهجة سودانية', 'flag' => '🇸🇩', 'rtl' => true], + 'ar_SY' => ['label' => 'Arabic (Syria)', 'native_name' => 'شامي', 'flag' => '🇸🇾', 'rtl' => true], + 'ar_TN' => ['label' => 'Arabic (Tunisia)', 'native_name' => 'تونسي', 'flag' => '🇹🇳', 'rtl' => true], + 'ar_YE' => ['label' => 'Arabic (Yemen)', 'native_name' => 'لهجة يمنية', 'flag' => '🇾🇪', 'rtl' => true], + 'as' => ['label' => 'Assamese', 'native_name' => 'অসমীয়া / Ôxômiya', 'flag' => '🇮🇳', 'rtl' => false], + 'as_IN' => ['label' => 'Assamese (India)', 'native_name' => 'অসমীয়া / Ôxômiya (India)', 'flag' => '🇮🇳', 'rtl' => false], + 'asa' => ['label' => 'Asu', 'native_name' => 'Kipare, Casu', 'flag' => '🇹🇿', 'rtl' => false], + 'asa_TZ' => ['label' => 'Asu (Tanzania)', 'native_name' => 'Kipare, Casu (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false], + 'az' => ['label' => 'Azerbaijani', 'native_name' => 'AzəRbaycan Dili', 'flag' => '🇦🇿', 'rtl' => true], + 'az_Cyrl' => ['label' => 'Azerbaijani (Cyrillic)', 'native_name' => 'Азәрбајҹан Дили (Kiril)', 'flag' => '🇷🇺', 'rtl' => false], + 'az_Cyrl_AZ' => ['label' => 'Azerbaijani (Cyrillic, Azerbaijan)', 'native_name' => 'Азәрбајҹан Дили (Kiril)', 'flag' => '🇦🇿', 'rtl' => false], + 'az_Latn' => ['label' => 'Azerbaijani (Latin)', 'native_name' => 'AzəRbaycan (Latın) (Latın Dili)', 'flag' => '🇦🇿', 'rtl' => false], + 'az_Latn_AZ' => ['label' => 'Azerbaijani (Latin, Azerbaijan)', 'native_name' => 'AzəRbaycan (Latın, AzəRbaycan) ()', 'flag' => '🇦🇿', 'rtl' => false], + 'be' => ['label' => 'Belarusian', 'native_name' => 'Беларуская Мова', 'flag' => '🇧🇾', 'rtl' => false], + 'be_BY' => ['label' => 'Belarusian (Belarus)', 'native_name' => 'Беларуская (Беларусь) (Беларус)', 'flag' => '🇧🇾', 'rtl' => false], + 'bem' => ['label' => 'Bemba', 'native_name' => 'Βemba', 'flag' => '🇿🇲', 'rtl' => false], + 'bem_ZM' => ['label' => 'Bemba (Zambia)', 'native_name' => 'Βemba (Zambia)', 'flag' => '🇿🇲', 'rtl' => false], + 'bez' => ['label' => 'Bena', 'native_name' => 'Ekibena', 'flag' => '🇹🇿', 'rtl' => false], + 'bez_TZ' => ['label' => 'Bena (Tanzania)', 'native_name' => 'Ekibena (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false], + 'bg' => ['label' => 'Bulgarian', 'native_name' => 'Български', 'flag' => '🇧🇬', 'rtl' => false], + 'bg_BG' => ['label' => 'Bulgarian (Bulgaria)', 'native_name' => 'Български (България)', 'flag' => '🇧🇬', 'rtl' => false], + 'bm' => ['label' => 'Bambara', 'native_name' => 'Bamanankan', 'flag' => '🇲🇱', 'rtl' => false], + 'bm_ML' => ['label' => 'Bambara (Mali)', 'native_name' => 'Bamanankan (Mali)', 'flag' => '🇲🇱', 'rtl' => false], + 'bn' => ['label' => 'Bengali', 'native_name' => 'বাংলা, Bangla', 'flag' => '🇧🇩', 'rtl' => false], + 'bn_BD' => ['label' => 'Bengali (Bangladesh)', 'native_name' => 'বাংলা, Bangla (বাংলাদেশ)', 'flag' => '🇧🇩', 'rtl' => false], + 'bn_IN' => ['label' => 'Bengali (India)', 'native_name' => 'বাংলা Bānlā (ভারত)', 'flag' => '🇮🇳', 'rtl' => false], + 'bo' => ['label' => 'Tibetan', 'native_name' => 'བོད་སྐད་', 'flag' => '🏳️', 'rtl' => false], + 'bo_CN' => ['label' => 'Tibetan (China)', 'native_name' => 'བོད་སྐད (China)', 'flag' => '🇨🇳', 'rtl' => false], + 'bo_IN' => ['label' => 'Tibetan (India)', 'native_name' => 'བོད་སྐད་ (India)', 'flag' => '🇮🇳', 'rtl' => false], + 'bs' => ['label' => 'Bosnian', 'native_name' => 'Bosanski', 'flag' => '🇧🇦', 'rtl' => false], + 'bs_BA' => ['label' => 'Bosnian (Bosnia and Herzegovina)', 'native_name' => 'Bosanski (Bosna I Hercegovina)', 'flag' => '🇧🇦', 'rtl' => false], + 'ca' => ['label' => 'Catalan', 'native_name' => 'Català', 'flag' => '🇪🇸', 'rtl' => false], + 'ca_ES' => ['label' => 'Catalan (Spain)', 'native_name' => 'Català (Espanyola)', 'flag' => '🇪🇸', 'rtl' => false], + 'cgg' => ['label' => 'Chiga', 'native_name' => 'Orukiga', 'flag' => '🇺🇬', 'rtl' => false], + 'cgg_UG' => ['label' => 'Chiga (Uganda)', 'native_name' => 'Orukiga (Uganda)', 'flag' => '🇺🇬', 'rtl' => false], + 'chr' => ['label' => 'Cherokee', 'native_name' => 'ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ', 'flag' => '🇺🇸', 'rtl' => false], + 'chr_US' => ['label' => 'Cherokee (United States)', 'native_name' => 'ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ (United States)', 'flag' => '🇺🇸', 'rtl' => false], + 'ckb_IR' => ['label' => 'Sorani (Iran)', 'native_name' => 'سۆرانی', 'flag' => '🇮🇷', 'rtl' => true,], + 'ckb_IQ' => ['label' => 'Sorani (Iraq)', 'native_name' => 'سۆرانی', 'flag' => '🇮🇶', 'rtl' => true,], + 'cs' => ['label' => 'Czech', 'native_name' => 'Český Jazyk', 'flag' => '🇨🇿', 'rtl' => false], + 'cs_CZ' => ['label' => 'Czech (Czech Republic)', 'native_name' => 'Čeština (Česká Republika)', 'flag' => '🇨🇿', 'rtl' => false], + 'cy' => ['label' => 'Welsh', 'native_name' => 'Gymraeg', 'flag' => '🏴󠁧󠁢󠁥󠁮󠁧󠁿', 'rtl' => false], + 'cy_GB' => ['label' => 'Welsh (United Kingdom)', 'native_name' => 'Gymraeg (Y Deyrnas Unedig)', 'flag' => '🇬🇧', 'rtl' => false], + 'da' => ['label' => 'Danish', 'native_name' => 'Dansk', 'flag' => '🇩🇰', 'rtl' => false], + 'da_DK' => ['label' => 'Danish (Denmark)', 'native_name' => 'Dansk (Danmark)', 'flag' => '🇩🇰', 'rtl' => false], + 'dav' => ['label' => 'Taita', 'native_name' => 'Taita', 'flag' => '🇰🇪', 'rtl' => false], + 'dav_KE' => ['label' => 'Taita (Kenya)', 'native_name' => 'Taita (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'de' => ['label' => 'German', 'native_name' => 'Deutsch', 'flag' => '🇩🇪', 'rtl' => false], + 'de_AT' => ['label' => 'German (Austria)', 'native_name' => 'Österreichisches (Österreich)', 'flag' => '🇦🇹', 'rtl' => false], + 'de_BE' => ['label' => 'German (Belgium)', 'native_name' => 'Deutschsprachige (Belgien)', 'flag' => '🇧🇪', 'rtl' => false], + 'de_CH' => ['label' => 'German (Switzerland)', 'native_name' => 'Schwiizerdütsch (Schweiz)', 'flag' => '🇨🇭', 'rtl' => false], + 'de_DE' => ['label' => 'German (Germany)', 'native_name' => 'Deutsch (Deutschland)', 'flag' => '🇩🇪', 'rtl' => false], + 'de_LI' => ['label' => 'German (Liechtenstein)', 'native_name' => 'Alemannisch (Liechtenstein)', 'flag' => '🇱🇮', 'rtl' => false], + 'de_LU' => ['label' => 'German (Luxembourg)', 'native_name' => 'Lëtzebuergesch (Luxemburg)', 'flag' => '🇱🇺', 'rtl' => false], + 'ebu' => ['label' => 'Embu', 'native_name' => 'Kiembu', 'flag' => '🇰🇪', 'rtl' => false], + 'ebu_KE' => ['label' => 'Embu (Kenya)', 'native_name' => 'Kiembu (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'ee' => ['label' => 'Ewe', 'native_name' => 'EʋEgbe', 'flag' => '🇹🇬', 'rtl' => false], + 'ee_GH' => ['label' => 'Ewe (Ghana)', 'native_name' => 'EʋEgbe (Ghana)', 'flag' => '🇬🇭', 'rtl' => false], + 'ee_TG' => ['label' => 'Ewe (Togo)', 'native_name' => 'EʋEgbe (Togo)', 'flag' => '🇹🇬', 'rtl' => false], + 'el' => ['label' => 'Greek', 'native_name' => 'Ελληνικά', 'flag' => '🇬🇷', 'rtl' => false], + 'el_CY' => ['label' => 'Greek (Cyprus)', 'native_name' => 'Ελληνοκύπριοι (Κύπρος)', 'flag' => '🇨🇾', 'rtl' => false], + 'el_GR' => ['label' => 'Greek (Greece)', 'native_name' => 'Ελληνικά (Ελλάδα) (Ελλάδα)', 'flag' => '🇬🇷', 'rtl' => false], + 'en' => ['label' => 'English', 'native_name' => 'English', 'flag' => '🇺🇸', 'rtl' => false], + 'en_AS' => ['label' => 'English (American Samoa)', 'native_name' => 'English (American Samoa)', 'flag' => '🇦🇸', 'rtl' => false], + 'en_AU' => ['label' => 'English (Australia)', 'native_name' => 'English (Australia)', 'flag' => '🇦🇺', 'rtl' => false], + 'en_BE' => ['label' => 'English (Belgium)', 'native_name' => 'English (Belgium)', 'flag' => '🇧🇪', 'rtl' => false], + 'en_BW' => ['label' => 'English (Botswana)', 'native_name' => 'English (Botswana)', 'flag' => '🇧🇼', 'rtl' => false], + 'en_BZ' => ['label' => 'English (Belize)', 'native_name' => 'English (Belize)', 'flag' => '🇧🇿', 'rtl' => false], + 'en_CA' => ['label' => 'English (Canada)', 'native_name' => 'English (Canada)', 'flag' => '🇨🇦', 'rtl' => false], + 'en_GB' => ['label' => 'English (United Kingdom)', 'native_name' => 'English (United Kingdom)', 'flag' => '🇬🇧', 'rtl' => false], + 'en_GU' => ['label' => 'English (Guam)', 'native_name' => 'English (Guam)', 'flag' => '🇬🇺', 'rtl' => false], + 'en_HK' => ['label' => 'English (Hong Kong SAR China)', 'native_name' => 'English (Hong Kong Sar China)', 'flag' => '🇭🇰', 'rtl' => false], + 'en_IE' => ['label' => 'English (Ireland)', 'native_name' => 'English (Ireland)', 'flag' => '🇮🇪', 'rtl' => false], + 'en_IL' => ['label' => 'English (Israel)', 'native_name' => 'English (Israel)', 'flag' => '🇮🇱', 'rtl' => false], + 'en_IN' => ['label' => 'English (India)', 'native_name' => 'English (India)', 'flag' => '🇮🇳', 'rtl' => false], + 'en_JM' => ['label' => 'English (Jamaica)', 'native_name' => 'English (Jamaica)', 'flag' => '🇯🇲', 'rtl' => false], + 'en_MH' => ['label' => 'English (Marshall Islands)', 'native_name' => 'English (Marshall Islands)', 'flag' => '🇲🇭', 'rtl' => false], + 'en_MP' => ['label' => 'English (Northern Mariana Islands)', 'native_name' => 'English (Northern Mariana Islands)', 'flag' => '🇲🇵', 'rtl' => false], + 'en_MT' => ['label' => 'English (Malta)', 'native_name' => 'English (Malta)', 'flag' => '🇲🇹', 'rtl' => false], + 'en_MU' => ['label' => 'English (Mauritius)', 'native_name' => 'English (Mauritius)', 'flag' => '🇲🇺', 'rtl' => false], + 'en_NA' => ['label' => 'English (Namibia)', 'native_name' => 'English (Namibia)', 'flag' => '🇳🇦', 'rtl' => false], + 'en_NZ' => ['label' => 'English (New Zealand)', 'native_name' => 'English (New Zealand)', 'flag' => '🇳🇿', 'rtl' => false], + 'en_PH' => ['label' => 'English (Philippines)', 'native_name' => 'English (Philippines)', 'flag' => '🇵🇭', 'rtl' => false], + 'en_PK' => ['label' => 'English (Pakistan)', 'native_name' => 'English (Pakistan)', 'flag' => '🇵🇰', 'rtl' => false], + 'en_SG' => ['label' => 'English (Singapore)', 'native_name' => 'English (Singapore)', 'flag' => '🇸🇬', 'rtl' => false], + 'en_TT' => ['label' => 'English (Trinidad and Tobago)', 'native_name' => 'English (Trinidad And Tobago)', 'flag' => '🇹🇹', 'rtl' => false], + 'en_UM' => ['label' => 'English (U.S. Minor Outlying Islands)', 'native_name' => 'English (U.S. Minor Outlying Islands)', 'flag' => '🇺🇸', 'rtl' => false], + 'en_US' => ['label' => 'English (United States)', 'native_name' => 'English (United States)', 'flag' => '🇺🇸', 'rtl' => false], + 'en_VI' => ['label' => 'English (U.S. Virgin Islands)', 'native_name' => 'English (U.S. Virgin Islands)', 'flag' => '🇻🇮', 'rtl' => false], + 'en_ZA' => ['label' => 'English (South Africa)', 'native_name' => 'English (South Africa)', 'flag' => '🇿🇦', 'rtl' => false], + 'en_ZW' => ['label' => 'English (Zimbabwe)', 'native_name' => 'English (Zimbabwe)', 'flag' => '🇿🇼', 'rtl' => false], + 'eo' => ['label' => 'Esperanto', 'native_name' => 'Esperanto', 'flag' => '🇪🇺', 'rtl' => false], + 'es' => ['label' => 'Spanish', 'native_name' => 'Español', 'flag' => '🇪🇸', 'rtl' => false], + 'es_419' => ['label' => 'Spanish (Latin America)', 'native_name' => 'Español (America Latina)', 'flag' => '🇨🇴', 'rtl' => false], + 'es_AR' => ['label' => 'Spanish (Argentina)', 'native_name' => 'Español (Argentina)', 'flag' => '🇦🇷', 'rtl' => false], + 'es_BO' => ['label' => 'Spanish (Bolivia)', 'native_name' => 'Español (Bolivia)', 'flag' => '🇧🇴', 'rtl' => false], + 'es_CL' => ['label' => 'Spanish (Chile)', 'native_name' => 'Español (Chile)', 'flag' => '🇨🇱', 'rtl' => false], + 'es_CO' => ['label' => 'Spanish (Colombia)', 'native_name' => 'Español (Colombia)', 'flag' => '🇨🇴', 'rtl' => false], + 'es_CR' => ['label' => 'Spanish (Costa Rica)', 'native_name' => 'Español (Costa Rica)', 'flag' => '🇨🇷', 'rtl' => false], + 'es_DO' => ['label' => 'Spanish (Dominican Republic)', 'native_name' => 'Español (República Dominicana)', 'flag' => '🇩🇴', 'rtl' => false], + 'es_EC' => ['label' => 'Spanish (Ecuador)', 'native_name' => 'Español (Ecuador)', 'flag' => '🇪🇨', 'rtl' => false], + 'es_ES' => ['label' => 'Spanish (Spain)', 'native_name' => 'Español (España)', 'flag' => '🇪🇸', 'rtl' => false], + 'es_GQ' => ['label' => 'Spanish (Equatorial Guinea)', 'native_name' => 'Español (Guinea Ecuatorial)', 'flag' => '🇬🇶', 'rtl' => false], + 'es_GT' => ['label' => 'Spanish (Guatemala)', 'native_name' => 'Español (Guatemala)', 'flag' => '🇬🇹', 'rtl' => false], + 'es_HN' => ['label' => 'Spanish (Honduras)', 'native_name' => 'Español (Honduras)', 'flag' => '🇭🇳', 'rtl' => false], + 'es_MX' => ['label' => 'Spanish (Mexico)', 'native_name' => 'Español (México)', 'flag' => '🇲🇽', 'rtl' => false], + 'es_NI' => ['label' => 'Spanish (Nicaragua)', 'native_name' => 'Español (Nicaragua)', 'flag' => '🇳🇮', 'rtl' => false], + 'es_PA' => ['label' => 'Spanish (Panama)', 'native_name' => 'Español (Panamá)', 'flag' => '🇵🇦', 'rtl' => false], + 'es_PE' => ['label' => 'Spanish (Peru)', 'native_name' => 'Español (Perú)', 'flag' => '🇵🇪', 'rtl' => false], + 'es_PR' => ['label' => 'Spanish (Puerto Rico)', 'native_name' => 'Español (Puerto Rico)', 'flag' => '🇵🇷', 'rtl' => false], + 'es_PY' => ['label' => 'Spanish (Paraguay)', 'native_name' => 'Español (Paraguay)', 'flag' => '🇵🇾', 'rtl' => false], + 'es_SV' => ['label' => 'Spanish (El Salvador)', 'native_name' => 'Español (El Salvador)', 'flag' => '🇸🇻', 'rtl' => false], + 'es_US' => ['label' => 'Spanish (United States)', 'native_name' => 'Español (Estados Unidos)', 'flag' => '🇺🇸', 'rtl' => false], + 'es_UY' => ['label' => 'Spanish (Uruguay)', 'native_name' => 'Español (Uruguay)', 'flag' => '🇺🇾', 'rtl' => false], + 'es_VE' => ['label' => 'Spanish (Venezuela)', 'native_name' => 'Español (Venezuela)', 'flag' => '🇻🇪', 'rtl' => false], + 'et' => ['label' => 'Estonian', 'native_name' => 'Eesti Keel', 'flag' => '🇪🇪', 'rtl' => false], + 'et_EE' => ['label' => 'Estonian (Estonia)', 'native_name' => 'Eesti Keel (Eesti)', 'flag' => '🇪🇪', 'rtl' => false], + 'eu' => ['label' => 'Basque', 'native_name' => 'Euskara', 'flag' => '🏳️', 'rtl' => false], + 'eu_ES' => ['label' => 'Basque (Spain)', 'native_name' => 'Euskara (Jaio)', 'flag' => '🏳️', 'rtl' => false], + 'fa' => ['label' => 'Persian', 'native_name' => 'فارسی (Fārsi)', 'flag' => '🇮🇷', 'rtl' => true], + 'fa_AF' => ['label' => 'Persian (Afghanistan)', 'native_name' => 'فارسی دری (افغانستان)', 'flag' => '🇦🇫', 'rtl' => true], + 'fa_IR' => ['label' => 'Persian (Iran)', 'native_name' => 'فارسی (Fārsi) (ایران)', 'flag' => '🇮🇷', 'rtl' => true], + 'ff' => ['label' => 'Fulah', 'native_name' => 'الفولاني', 'flag' => '🇸🇳', 'rtl' => true], + 'ff_SN' => ['label' => 'Fulah (Senegal)', 'native_name' => '𞤆𞤵𞥄𞤼𞤢', 'flag' => '🇸🇳', 'rtl' => true], + 'fi' => ['label' => 'Finnish', 'native_name' => 'Suomen Kieli', 'flag' => '🇫🇮', 'rtl' => false], + 'fi_FI' => ['label' => 'Finnish (Finland)', 'native_name' => 'Suomen Kieli (Suomi)', 'flag' => '🇫🇮', 'rtl' => false], + 'fil' => ['label' => 'Filipino', 'native_name' => 'Wikang Filipino', 'flag' => '🇵🇭', 'rtl' => false], + 'fil_PH' => ['label' => 'Filipino (Philippines)', 'native_name' => 'Wikang Filipino (Pilipinas)', 'flag' => '🇵🇭', 'rtl' => false], + 'fo' => ['label' => 'Faroese', 'native_name' => 'Føroyskt Mál', 'flag' => '🇫🇴', 'rtl' => false], + 'fo_FO' => ['label' => 'Faroese (Faroe Islands)', 'native_name' => 'Føroyskt Mál (Faroe Islands)', 'flag' => '🇫🇴', 'rtl' => false], + 'fr' => ['label' => 'French', 'native_name' => 'Français', 'flag' => '🇫🇷', 'rtl' => false], + 'fr_BE' => ['label' => 'French (Belgium)', 'native_name' => 'Français (Belgique)', 'flag' => '🇧🇪', 'rtl' => false], + 'fr_BF' => ['label' => 'French (Burkina Faso)', 'native_name' => 'Français (Burkina Faso)', 'flag' => '🇧🇫', 'rtl' => false], + 'fr_BI' => ['label' => 'French (Burundi)', 'native_name' => 'Français (Burundi)', 'flag' => '🇧🇮', 'rtl' => false], + 'fr_BJ' => ['label' => 'French (Benin)', 'native_name' => 'Français (Bénin)', 'flag' => '🇧🇯', 'rtl' => false], + 'fr_BL' => ['label' => 'French (Saint Barthélemy)', 'native_name' => 'Français (Saint Barthélemy)', 'flag' => '🇧🇱', 'rtl' => false], + 'fr_CA' => ['label' => 'French (Canada)', 'native_name' => 'Français (Canada)', 'flag' => '🇨🇦', 'rtl' => false], + 'fr_CD' => ['label' => 'French (Congo - Kinshasa)', 'native_name' => 'Français (Congo - Kinshasa)', 'flag' => '🇨🇩', 'rtl' => false], + 'fr_CF' => ['label' => 'French (Central African Republic)', 'native_name' => 'Français (République Centrafricaine)', 'flag' => '🇨🇫', 'rtl' => false], + 'fr_CG' => ['label' => 'French (Congo - Brazzaville)', 'native_name' => 'Français (Congo - Brazzaville)', 'flag' => '🇨🇬', 'rtl' => false], + 'fr_CH' => ['label' => 'French (Switzerland)', 'native_name' => 'Français (Suisse)', 'flag' => '🇨🇭', 'rtl' => false], + 'fr_CI' => ['label' => "French (Côte d'Ivoire)", 'native_name' => "Français (Côte D'Ivoire)", 'flag' => '🇨🇮', 'rtl' => false], + 'fr_CM' => ['label' => 'French (Cameroon)', 'native_name' => 'Français (Cameroun)', 'flag' => '🇨🇲', 'rtl' => false], + 'fr_DJ' => ['label' => 'French (Djibouti)', 'native_name' => 'Français (Djibouti)', 'flag' => '🇩🇯', 'rtl' => false], + 'fr_FR' => ['label' => 'French (France)', 'native_name' => 'Français (France)', 'flag' => '🇫🇷', 'rtl' => false], + 'fr_GA' => ['label' => 'French (Gabon)', 'native_name' => 'Français (Gabon)', 'flag' => '🇬🇦', 'rtl' => false], + 'fr_GN' => ['label' => 'French (Guinea)', 'native_name' => 'Français (Guinée)', 'flag' => '🇬🇳', 'rtl' => false], + 'fr_GP' => ['label' => 'French (Guadeloupe)', 'native_name' => 'Français (Guadeloup)', 'flag' => '🇬🇵', 'rtl' => false], + 'fr_GQ' => ['label' => 'French (Equatorial Guinea)', 'native_name' => 'Français (Guinée Équatoriale)', 'flag' => '🇬🇶', 'rtl' => false], + 'fr_KM' => ['label' => 'French (Comoros)', 'native_name' => 'Français (Comores)', 'flag' => '🇰🇲', 'rtl' => false], + 'fr_LU' => ['label' => 'French (Luxembourg)', 'native_name' => 'Français (Luxembourg)', 'flag' => '🇱🇺', 'rtl' => false], + 'fr_MC' => ['label' => 'French (Monaco)', 'native_name' => 'Français (Monaco)', 'flag' => '🇲🇨', 'rtl' => false], + 'fr_MF' => ['label' => 'French (Saint Martin)', 'native_name' => 'Français (Saint Martin)', 'flag' => '🇲🇫', 'rtl' => false], + 'fr_MG' => ['label' => 'French (Madagascar)', 'native_name' => 'Français (Madagascar)', 'flag' => '🇲🇬', 'rtl' => false], + 'fr_ML' => ['label' => 'French (Mali)', 'native_name' => 'Français (Mali)', 'flag' => '🇲🇱', 'rtl' => false], + 'fr_MQ' => ['label' => 'French (Martinique)', 'native_name' => 'Français (Martinique)', 'flag' => '🇲🇶', 'rtl' => false], + 'fr_NE' => ['label' => 'French (Niger)', 'native_name' => 'Français (Niger)', 'flag' => '🇳🇪', 'rtl' => false], + 'fr_RE' => ['label' => 'French (Réunion)', 'native_name' => 'Français (Réunion)', 'flag' => '🇷🇪', 'rtl' => false], + 'fr_RW' => ['label' => 'French (Rwanda)', 'native_name' => 'Français (Rwanda)', 'flag' => '🇷🇼', 'rtl' => false], + 'fr_SN' => ['label' => 'French (Senegal)', 'native_name' => 'Français (Sénégal)', 'flag' => '🇸🇳', 'rtl' => false], + 'fr_TD' => ['label' => 'French (Chad)', 'native_name' => 'Français (Tchad)', 'flag' => '🇹🇩', 'rtl' => false], + 'fr_TG' => ['label' => 'French (Togo)', 'native_name' => 'Français (Aller)', 'flag' => '🇹🇬', 'rtl' => false], + 'ga' => ['label' => 'Irish', 'native_name' => 'Gaeilge', 'flag' => '🇮🇪', 'rtl' => false], + 'ga_IE' => ['label' => 'Irish (Ireland)', 'native_name' => 'Gaeilge (Éireann)', 'flag' => '🇮🇪', 'rtl' => false], + 'gl' => ['label' => 'Galician', 'native_name' => 'Galego', 'flag' => '🇪🇸', 'rtl' => false], + 'gl_ES' => ['label' => 'Galician (Spain)', 'native_name' => 'Galego (España)', 'flag' => '🇪🇸', 'rtl' => false], + 'gsw' => ['label' => 'Swiss German', 'native_name' => 'Schwiizerdütsch', 'flag' => '🇨🇭', 'rtl' => false], + 'gsw_CH' => ['label' => 'Swiss German (Switzerland)', 'native_name' => 'Schwiizerdütsch', 'flag' => '🇨🇭', 'rtl' => false], + 'gu' => ['label' => 'Gujarati', 'native_name' => 'ગુજરાતી', 'flag' => '🇮🇳', 'rtl' => false], + 'gu_IN' => ['label' => 'Gujarati (India)', 'native_name' => 'ગુજરાતી (ભારત)', 'flag' => '🇮🇳', 'rtl' => false], + 'guz' => ['label' => 'Gusii', 'native_name' => 'Ekegusii', 'flag' => '🇰🇪', 'rtl' => false], + 'guz_KE' => ['label' => 'Gusii (Kenya)', 'native_name' => 'Ekegusii (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'gv' => ['label' => 'Manx', 'native_name' => 'Gaelg, Gailck', 'flag' => '🇮🇲', 'rtl' => false], + 'gv_GB' => ['label' => 'Manx (United Kingdom)', 'native_name' => 'Gaelg, Gailck (United Kingdom)', 'flag' => '🇬🇧', 'rtl' => false], + 'ha' => ['label' => 'Hausa', 'native_name' => 'هَرْشَن هَوْسَ', 'flag' => '🇳🇬', 'rtl' => true], + 'ha_Latn' => ['label' => 'Hausa (Latin)', 'native_name' => 'Halshen Hausa (Na Latin)', 'flag' => '🇳🇬', 'rtl' => false], + 'ha_Latn_GH' => ['label' => 'Hausa (Latin, Ghana)', 'native_name' => 'Halshen Hausa (Latin Ghana)', 'flag' => '🇬🇭', 'rtl' => false], + 'ha_Latn_NE' => ['label' => 'Hausa (Latin, Niger)', 'native_name' => 'Halshen Hausa (Latin Niger)', 'flag' => '🇳🇪', 'rtl' => false], + 'ha_Latn_NG' => ['label' => 'Hausa (Latin, Nigeria)', 'native_name' => 'Halshen Hausa (Latin Nigeria)', 'flag' => '🇳🇬', 'rtl' => false], + 'haw' => ['label' => 'Hawaiian', 'native_name' => 'ʻŌlelo HawaiʻI', 'flag' => '🇺🇸', 'rtl' => false], + 'haw_US' => ['label' => 'Hawaiian (United States)', 'native_name' => 'ʻŌlelo HawaiʻI (ʻAmelika Hui Pū ʻIa)', 'flag' => '🇺🇸', 'rtl' => false], + 'he' => ['label' => 'Hebrew', 'native_name' => 'עִבְרִית', 'flag' => '🇮🇱', 'rtl' => true], + 'he_IL' => ['label' => 'Hebrew (Israel)', 'native_name' => 'עברית (ישראל)', 'flag' => '🇮🇱', 'rtl' => true], + 'hi' => ['label' => 'Hindi', 'native_name' => 'हिन्दी', 'flag' => '🇮🇳', 'rtl' => false], + 'hi_IN' => ['label' => 'Hindi (India)', 'native_name' => 'हिन्दी (भारत)', 'flag' => '🇮🇳', 'rtl' => false], + 'hr' => ['label' => 'Croatian', 'native_name' => 'Hrvatski', 'flag' => '🇭🇷', 'rtl' => false], + 'hr_HR' => ['label' => 'Croatian (Croatia)', 'native_name' => 'Hrvatski (Hrvatska)', 'flag' => '🇭🇷', 'rtl' => false], + 'hu' => ['label' => 'Hungarian', 'native_name' => 'Magyar Nyelv', 'flag' => '🇭🇺', 'rtl' => false], + 'hu_HU' => ['label' => 'Hungarian (Hungary)', 'native_name' => 'Magyar Nyelv (Magyarország)', 'flag' => '🇭🇺', 'rtl' => false], + 'hy' => ['label' => 'Armenian', 'native_name' => 'Հայերէն/Հայերեն', 'flag' => '🇦🇲', 'rtl' => false], + 'hy_AM' => ['label' => 'Armenian (Armenia)', 'native_name' => 'Հայերէն/Հայերեն (Հայաստան)', 'flag' => '🇦🇲', 'rtl' => false], + 'id' => ['label' => 'Indonesian', 'native_name' => 'Bahasa Indonesia', 'flag' => '🇮🇩', 'rtl' => false], + 'id_ID' => ['label' => 'Indonesian (Indonesia)', 'native_name' => 'Bahasa Indonesia (Indonesia)', 'flag' => '🇮🇩', 'rtl' => false], + 'ig' => ['label' => 'Igbo', 'native_name' => 'Ásụ̀Sụ́ Ìgbò', 'flag' => '🇳🇬', 'rtl' => false], + 'ig_NG' => ['label' => 'Igbo (Nigeria)', 'native_name' => 'Ásụ̀Sụ́ Ìgbò (Nigeria)', 'flag' => '🇳🇬', 'rtl' => false], + 'ii' => ['label' => 'Sichuan Yi', 'native_name' => 'ꆈꌠꉙ', 'flag' => '🇨🇳', 'rtl' => false], + 'ii_CN' => ['label' => 'Sichuan Yi (China)', 'native_name' => 'ꆈꌠꉙ (China)', 'flag' => '🇨🇳', 'rtl' => false], + 'is' => ['label' => 'Icelandic', 'native_name' => 'Íslenska', 'flag' => '🇮🇸', 'rtl' => false], + 'is_IS' => ['label' => 'Icelandic (Iceland)', 'native_name' => 'Íslenska (Ísland)', 'flag' => '🇮🇸', 'rtl' => false], + 'it' => ['label' => 'Italian', 'native_name' => 'Italiano', 'flag' => '🇮🇹', 'rtl' => false], + 'it_CH' => ['label' => 'Italian (Switzerland)', 'native_name' => 'Italiano (Svizzera)', 'flag' => '🇨🇭', 'rtl' => false], + 'it_IT' => ['label' => 'Italian (Italy)', 'native_name' => 'Italiano (Italia)', 'flag' => '🇮🇹', 'rtl' => false], + 'ja' => ['label' => 'Japanese', 'native_name' => '日本語', 'flag' => '🇯🇵', 'rtl' => false], + 'ja_JP' => ['label' => 'Japanese (Japan)', 'native_name' => '日本語 (日本)', 'flag' => '🇯🇵', 'rtl' => false], + 'jmc' => ['label' => 'Machame', 'native_name' => 'West Chaga', 'flag' => '🇹🇿', 'rtl' => false], + 'jmc_TZ' => ['label' => 'Machame (Tanzania)', 'native_name' => 'West Chaga (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false], + 'ka' => ['label' => 'Georgian', 'native_name' => 'ᲥᲐᲠᲗᲣᲚᲘ ᲔᲜᲐ', 'flag' => '🇬🇪', 'rtl' => false], + 'ka_GE' => ['label' => 'Georgian (Georgia)', 'native_name' => 'ᲥᲐᲠᲗᲣᲚᲘ ᲔᲜᲐ (ᲡᲐᲥᲐᲠᲗᲕᲔᲚᲝ)', 'flag' => '🇬🇪', 'rtl' => false], + 'kab' => ['label' => 'Kabyle', 'native_name' => 'ⵜⴰⵇⴱⴰⵢⵍⵉⵜ', 'flag' => '🇩🇿', 'rtl' => false], + 'kab_DZ' => ['label' => 'Kabyle (Algeria)', 'native_name' => 'ⵜⴰⵇⴱⴰⵢⵍⵉⵜ (Algeria)', 'flag' => '🇩🇿', 'rtl' => false], + 'kam' => ['label' => 'Kamba', 'native_name' => 'Kikamba', 'flag' => '🇰🇪', 'rtl' => false], + 'kam_KE' => ['label' => 'Kamba (Kenya)', 'native_name' => 'Kikamba (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'kde' => ['label' => 'Makonde', 'native_name' => 'Chi(Ni)Makonde', 'flag' => '🇹🇿', 'rtl' => false], + 'kde_TZ' => ['label' => 'Makonde (Tanzania)', 'native_name' => 'Chi(Ni)Makonde (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false], + 'kea' => ['label' => 'Kabuverdianu', 'native_name' => 'Kriolu, Kriol', 'flag' => '🇨🇻', 'rtl' => false], + 'kea_CV' => ['label' => 'Kabuverdianu (Cape Verde)', 'native_name' => 'Kriolu, Kriol (Cape Verde)', 'flag' => '🇨🇻', 'rtl' => false], + 'khq' => ['label' => 'Koyra Chiini', 'native_name' => 'Koyra Chiini', 'flag' => '🇲🇱', 'rtl' => false], + 'khq_ML' => ['label' => 'Koyra Chiini (Mali)', 'native_name' => 'Koyra Chiini (Mali)', 'flag' => '🇲🇱', 'rtl' => false], + 'ki' => ['label' => 'Kikuyu', 'native_name' => 'Gĩkũyũ', 'flag' => '🇰🇪', 'rtl' => false], + 'ki_KE' => ['label' => 'Kikuyu (Kenya)', 'native_name' => 'Gĩkũyũ (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'kk' => ['label' => 'Kazakh', 'native_name' => 'قازاقشا Or قازاق ٴتىلى', 'flag' => '🇰🇿', 'rtl' => true], + 'kk_Cyrl' => ['label' => 'Kazakh (Cyrillic)', 'native_name' => 'Қазақша Or Қазақ Тілі (Кириллица)', 'flag' => '🇷🇺', 'rtl' => false], + 'kk_Cyrl_KZ' => ['label' => 'Kazakh (Cyrillic, Kazakhstan)', 'native_name' => 'Қазақша Or Қазақ Тілі (Кириллица)', 'flag' => '🇰🇿', 'rtl' => false], + 'kl' => ['label' => 'Kalaallisut', 'native_name' => 'Kalaallisut', 'flag' => '🇬🇱', 'rtl' => false], + 'kl_GL' => ['label' => 'Kalaallisut (Greenland)', 'native_name' => 'Kalaallisut (Greenland)', 'flag' => '🇬🇱', 'rtl' => false], + 'kln' => ['label' => 'Kalenjin', 'native_name' => 'Kalenjin', 'flag' => '🇰🇪', 'rtl' => false], + 'kln_KE' => ['label' => 'Kalenjin (Kenya)', 'native_name' => 'Kalenjin (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'km' => ['label' => 'Khmer', 'native_name' => 'ភាសាខ្មែរ', 'flag' => '🇰🇭', 'rtl' => false], + 'km_KH' => ['label' => 'Khmer (Cambodia)', 'native_name' => 'ភាសាខ្មែរ (ខេសកម្ពុជា)', 'flag' => '🇰🇭', 'rtl' => false], + 'kn' => ['label' => 'Kannada', 'native_name' => 'ಕನ್ನಡ', 'flag' => '🇮🇳', 'rtl' => false], + 'kn_IN' => ['label' => 'Kannada (India)', 'native_name' => 'ಕನ್ನಡ (ಭಾರತ)', 'flag' => '🇮🇳', 'rtl' => false], + 'ko' => ['label' => 'Korean', 'native_name' => '한국어', 'flag' => '🇰🇷', 'rtl' => false], + 'ko_KR' => ['label' => 'Korean (South Korea)', 'native_name' => '한국어 (대한민국)', 'flag' => '🇰🇷', 'rtl' => false], + 'kok' => ['label' => 'Konkani', 'native_name' => 'कोंकणी', 'flag' => '🇮🇳', 'rtl' => false], + 'kok_IN' => ['label' => 'Konkani (India)', 'native_name' => 'कोंकणी (India)', 'flag' => '🇮🇳', 'rtl' => false], + 'ku' => ['label' => 'Kurdish (Kurmanji)', 'native_name' => 'کورمانجی', 'flag' => '🏳️', 'rtl' => true,], + 'kw' => ['label' => 'Cornish', 'native_name' => 'Kernewek, Kernowek', 'flag' => '🇬🇧', 'rtl' => false], + 'kw_GB' => ['label' => 'Cornish (United Kingdom)', 'native_name' => 'Kernewek, Kernowek (United Kingdom)', 'flag' => '🇬🇧', 'rtl' => false], + 'lag' => ['label' => 'Langi', 'native_name' => 'Lëblaŋo', 'flag' => '🇺🇬', 'rtl' => false], + 'lag_TZ' => ['label' => 'Langi (Tanzania)', 'native_name' => 'Kilaangi (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false], + 'lg' => ['label' => 'Ganda', 'native_name' => 'Ganda', 'flag' => '🇺🇬', 'rtl' => false], + 'lg_UG' => ['label' => 'Ganda (Uganda)', 'native_name' => 'Ganda (Uganda)', 'flag' => '🇺🇬', 'rtl' => false], + 'lki_IR' => ['label' => 'Laki (Iran)', 'native_name' => 'له‌کی', 'flag' => '🇮🇷', 'rtl' => true,], + 'lki_TR' => ['label' => 'Laki (Turkey)', 'native_name' => 'له‌کی', 'flag' => '🇹🇷', 'rtl' => true,], + 'lt' => ['label' => 'Lithuanian', 'native_name' => 'Lietuvių Kalba', 'flag' => '🇱🇹', 'rtl' => false], + 'lt_LT' => ['label' => 'Lithuanian (Lithuania)', 'native_name' => 'Lietuvių Kalba (Lietuva)', 'flag' => '🇱🇹', 'rtl' => false], + 'luo' => ['label' => 'Luo', 'native_name' => 'Lwo', 'flag' => '🇰🇪', 'rtl' => false], + 'luo_KE' => ['label' => 'Luo (Kenya)', 'native_name' => 'Dholuo (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'luy' => ['label' => 'Luyia', 'native_name' => 'Oluluhya', 'flag' => '🇰🇪', 'rtl' => false], + 'luy_KE' => ['label' => 'Luyia (Kenya)', 'native_name' => 'Oluluhya (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'lv' => ['label' => 'Latvian', 'native_name' => 'Latviešu Valoda', 'flag' => '🇱🇻', 'rtl' => false], + 'lv_LV' => ['label' => 'Latvian (Latvia)', 'native_name' => 'Latviešu Valoda (Latvija)', 'flag' => '🇱🇻', 'rtl' => false], + 'mas' => ['label' => 'Masai', 'native_name' => 'ƆL Maa', 'flag' => '🇰🇪', 'rtl' => false], + 'mas_KE' => ['label' => 'Masai (Kenya)', 'native_name' => 'ƆL Maa (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'mas_TZ' => ['label' => 'Masai (Tanzania)', 'native_name' => 'ƆL Maa (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false], + 'mer' => ['label' => 'Meru', 'native_name' => 'Kĩmĩĩrũ', 'flag' => '🇰🇪', 'rtl' => false], + 'mer_KE' => ['label' => 'Meru (Kenya)', 'native_name' => 'Kĩmĩĩrũ (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'mfe' => ['label' => 'Morisyen', 'native_name' => 'Kreol Morisien', 'flag' => '🇲🇺', 'rtl' => false], + 'mfe_MU' => ['label' => 'Morisyen (Mauritius)', 'native_name' => 'Kreol Morisien (Mauritius)', 'flag' => '🇲🇺', 'rtl' => false], + 'mg' => ['label' => 'Malagasy', 'native_name' => 'Malagasy', 'flag' => '🇲🇬', 'rtl' => false], + 'mg_MG' => ['label' => 'Malagasy (Madagascar)', 'native_name' => 'Malagasy (Madagaskar)', 'flag' => '🇲🇬', 'rtl' => false], + 'mk' => ['label' => 'Macedonian', 'native_name' => 'Македонски', 'flag' => '🇲🇰', 'rtl' => false], + 'mk_MK' => ['label' => 'Macedonian (Macedonia)', 'native_name' => 'Македонски, Makedonski (Македонија)', 'flag' => '🇲🇰', 'rtl' => false], + 'ml' => ['label' => 'Malayalam', 'native_name' => 'മലയാളം', 'flag' => '🇮🇳', 'rtl' => false], + 'ml_IN' => ['label' => 'Malayalam (India)', 'native_name' => 'മലയാളം (ഇന്ത്യ)', 'flag' => '🇮🇳', 'rtl' => false], + 'mr' => ['label' => 'Marathi', 'native_name' => 'मराठी', 'flag' => '🇮🇳', 'rtl' => false], + 'mr_IN' => ['label' => 'Marathi (India)', 'native_name' => 'मराठी (भारत)', 'flag' => '🇮🇳', 'rtl' => false], + 'ms' => ['label' => 'Malay', 'native_name' => 'Bahasa Melayu', 'flag' => '🇲🇾', 'rtl' => false], + 'ms_BN' => ['label' => 'Malay (Brunei)', 'native_name' => 'Bahasa Melayu Brunei', 'flag' => '🇧🇳', 'rtl' => false], + 'ms_MY' => ['label' => 'Malay (Malaysia)', 'native_name' => 'Bahasa Melayu (Malaysia)', 'flag' => '🇲🇾', 'rtl' => false], + 'mt' => ['label' => 'Maltese', 'native_name' => 'Malti', 'flag' => '🇲🇹', 'rtl' => false], + 'mt_MT' => ['label' => 'Maltese (Malta)', 'native_name' => 'Malti (Malta)', 'flag' => '🇲🇹', 'rtl' => false], + 'my' => ['label' => 'Burmese', 'native_name' => 'မြန်မာစာ', 'flag' => '🇲🇲', 'rtl' => false], + 'my_MM' => ['label' => 'Burmese (Myanmar [Burma])', 'native_name' => 'မြန်မာစာ (မြန်မာ [Burma])', 'flag' => '🇲🇲', 'rtl' => false], + 'naq' => ['label' => 'Nama', 'native_name' => 'Khoekhoegowab', 'flag' => '🇳🇦', 'rtl' => false], + 'naq_NA' => ['label' => 'Nama (Namibia)', 'native_name' => 'Khoekhoegowab (Nambia)', 'flag' => '🇳🇦', 'rtl' => false], + 'nb' => ['label' => 'Norwegian Bokmål', 'native_name' => 'Bokmål', 'flag' => '🇳🇴', 'rtl' => false], + 'nb_NO' => ['label' => 'Norwegian Bokmål (Norway)', 'native_name' => 'Bokmål (Norge)', 'flag' => '🇳🇴', 'rtl' => false], + 'nd' => ['label' => 'North Ndebele', 'native_name' => 'Isindebele Sasenyakatho', 'flag' => '🇿🇼', 'rtl' => false], + 'nd_ZW' => ['label' => 'North Ndebele (Zimbabwe)', 'native_name' => 'Isindebele Sasenyakatho (Zimbawe)', 'flag' => '🇿🇼', 'rtl' => false], + 'ne' => ['label' => 'Nepali', 'native_name' => 'नेपाली', 'flag' => '🇳🇵', 'rtl' => false], + 'ne_IN' => ['label' => 'Nepali (India)', 'native_name' => 'नेपाली (भारत)', 'flag' => '🇮🇳', 'rtl' => false], + 'ne_NP' => ['label' => 'Nepali (Nepal)', 'native_name' => 'नेपाली (नेपाल)', 'flag' => '🇳🇵', 'rtl' => false], + 'nl' => ['label' => 'Dutch', 'native_name' => 'Nederlands', 'flag' => '🇧🇶', 'rtl' => false], + 'nl_BE' => ['label' => 'Dutch (Belgium)', 'native_name' => 'Nederlands (België)', 'flag' => '🇧🇪', 'rtl' => false], + 'nl_NL' => ['label' => 'Dutch (Netherlands)', 'native_name' => 'Nederlands (Nederland)', 'flag' => '🇧🇶', 'rtl' => false], + 'nn' => ['label' => 'Norwegian Nynorsk', 'native_name' => 'Norsk', 'flag' => '🇳🇴', 'rtl' => false], + 'nn_NO' => ['label' => 'Norwegian Nynorsk (Norway)', 'native_name' => 'Norsk (Norway)', 'flag' => '🇳🇴', 'rtl' => false], + 'nyn' => ['label' => 'Nyankole', 'native_name' => 'Orunyankore', 'flag' => '🇺🇬', 'rtl' => false], + 'nyn_UG' => ['label' => 'Nyankole (Uganda)', 'native_name' => 'Orunyankore (Uganda)', 'flag' => '🇺🇬', 'rtl' => false], + 'om' => ['label' => 'Oromo', 'native_name' => 'Afaan Oromoo', 'flag' => '🇪🇹', 'rtl' => false], + 'om_ET' => ['label' => 'Oromo (Ethiopia)', 'native_name' => 'Afaan Oromoo (Ethiopia)', 'flag' => '🇪🇹', 'rtl' => false], + 'om_KE' => ['label' => 'Oromo (Kenya)', 'native_name' => 'Afaan Oromoo (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'or' => ['label' => 'Oriya', 'native_name' => 'ଓଡ଼ିଆ', 'flag' => '🇮🇳', 'rtl' => false], + 'or_IN' => ['label' => 'Oriya (India)', 'native_name' => 'ଓଡ଼ିଆ (ଭାରତ)', 'flag' => '🇮🇳', 'rtl' => false], + 'pa' => ['label' => 'Punjabi', 'native_name' => 'ਪੰਜਾਬੀ', 'flag' => '🇮🇳', 'rtl' => true], + 'pa_Arab' => ['label' => 'Punjabi (Arabic)', 'native_name' => 'پن٘جابی (ਅਰਬੀ)', 'flag' => '🇶🇦', 'rtl' => true], + 'pa_Arab_PK' => ['label' => 'Punjabi (Arabic, Pakistan)', 'native_name' => 'پن٘جابی(Arabic, Pakistan)', 'flag' => '🇵🇰', 'rtl' => true], + 'pa_Guru' => ['label' => 'Punjabi (Gurmukhi)', 'native_name' => 'ਪੰਜਾਬੀ (ਗੁਰਮੁਖੀ)', 'flag' => '🇵🇰', 'rtl' => false], + 'pa_Guru_IN' => ['label' => 'Punjabi (Gurmukhi, India)', 'native_name' => 'ਪੰਜਾਬੀ (Gurmukhi, India)', 'flag' => '🇮🇳', 'rtl' => false], + 'pa_IN' => ['label' => 'Punjabi (India)', 'native_name' => 'ਪੰਜਾਬੀ (India)', 'flag' => '🇮🇳', 'rtl' => false], + 'pl' => ['label' => 'Polish', 'native_name' => 'Polski', 'flag' => '🇵🇱', 'rtl' => false], + 'pl_PL' => ['label' => 'Polish (Poland)', 'native_name' => 'Polski (Polska)', 'flag' => '🇵🇱', 'rtl' => false], + 'ps' => ['label' => 'Pashto', 'native_name' => 'پښتو', 'flag' => '🇦🇫', 'rtl' => true], + 'ps_AF' => ['label' => 'Pashto (Afghanistan)', 'native_name' => 'پښتو (افغانستان)', 'flag' => '🇦🇫', 'rtl' => true], + 'pt' => ['label' => 'Portuguese', 'native_name' => 'Português', 'flag' => '🇧🇷', 'rtl' => false], + 'pt_BR' => ['label' => 'Portuguese (Brazil)', 'native_name' => 'Português (Brasil)', 'flag' => '🇧🇷', 'rtl' => false], + 'pt_GW' => ['label' => 'Portuguese (Guinea-Bissau)', 'native_name' => 'Português (Guiné-Bissau)', 'flag' => '🇬🇼', 'rtl' => false], + 'pt_MZ' => ['label' => 'Portuguese (Mozambique)', 'native_name' => 'Português (Moçambique)', 'flag' => '🇲🇿', 'rtl' => false], + 'pt_PT' => ['label' => 'Portuguese (Portugal)', 'native_name' => 'Português (Portugal)', 'flag' => '🇵🇹', 'rtl' => false], + 'rm' => ['label' => 'Romansh', 'native_name' => 'Romontsch', 'flag' => '🇨🇭', 'rtl' => false], + 'rm_CH' => ['label' => 'Romansh (Switzerland)', 'native_name' => 'Romontsch (Switzerland)', 'flag' => '🇨🇭', 'rtl' => false], + 'ro' => ['label' => 'Romanian', 'native_name' => 'Limba Română', 'flag' => '🇷🇴', 'rtl' => false], + 'ro_MD' => ['label' => 'Romanian (Moldova)', 'native_name' => 'Лимба Молдовеняскэ (Moldova)', 'flag' => '🇲🇩', 'rtl' => false], + 'ro_RO' => ['label' => 'Romanian (Romania)', 'native_name' => 'Română', 'flag' => '🇷🇴', 'rtl' => false], + 'rof' => ['label' => 'Rombo', 'native_name' => 'Kirombo', 'flag' => '🇹🇿', 'rtl' => false], + 'rof_TZ' => ['label' => 'Rombo (Tanzania)', 'native_name' => 'Kirombo (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false], + 'ru' => ['label' => 'Russian', 'native_name' => 'Русский Язык', 'flag' => '🇷🇺', 'rtl' => false], + 'ru_MD' => ['label' => 'Russian (Moldova)', 'native_name' => 'Русский Язык (Молдова)', 'flag' => '🇲🇩', 'rtl' => false], + 'ru_RU' => ['label' => 'Russian (Russia)', 'native_name' => 'Русский Язык (Россия)', 'flag' => '🇷🇺', 'rtl' => false], + 'ru_UA' => ['label' => 'Russian (Ukraine)', 'native_name' => 'Російська Мова (Украина)', 'flag' => '🇺🇦', 'rtl' => false], + 'rw' => ['label' => 'Kinyarwanda', 'native_name' => 'Ikinyarwanda', 'flag' => '🇷🇼', 'rtl' => false], + 'rw_RW' => ['label' => 'Kinyarwanda (Rwanda)', 'native_name' => 'Ikinyarwanda (U Rwanda)', 'flag' => '🇷🇼', 'rtl' => false], + 'rwk' => ['label' => 'Rwa', 'native_name' => 'Rwa', 'flag' => '🇷🇼', 'rtl' => false], + 'rwk_TZ' => ['label' => 'Rwa (Tanzania)', 'native_name' => 'Rwa', 'flag' => '🇹🇿', 'rtl' => false], + 'saq' => ['label' => 'Samburu', 'native_name' => 'Sampur, ƆL Maa', 'flag' => '🇰🇪', 'rtl' => false], + 'saq_KE' => ['label' => 'Samburu (Kenya)', 'native_name' => 'Sampur, ƆL Maa (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'sdh_IR' => ['label' => 'Southern Kurdish (Iran)', 'native_name' => 'کوردی خوارگ', 'flag' => '🇮🇷', 'rtl' => true,], + 'sdh_IQ' => ['label' => 'Southern Kurdish (Iran)', 'native_name' => 'کوردی خوارگ', 'flag' => '🇮🇶', 'rtl' => true,], + 'seh' => ['label' => 'Sena', 'native_name' => 'Sena', 'flag' => '🇲🇿', 'rtl' => false], + 'seh_MZ' => ['label' => 'Sena (Mozambique)', 'native_name' => 'Sena (Mozambique)', 'flag' => '🇲🇿', 'rtl' => false], + 'ses' => ['label' => 'Koyraboro Senni', 'native_name' => 'Koyraboro Senni', 'flag' => '🇲🇱', 'rtl' => false], + 'ses_ML' => ['label' => 'Koyraboro Senni (Mali)', 'native_name' => 'Koyraboro Senni (Mali)', 'flag' => '🇲🇱', 'rtl' => false], + 'sg' => ['label' => 'Sango', 'native_name' => 'Yângâ Tî Sängö', 'flag' => '🇨🇫', 'rtl' => false], + 'sg_CF' => ['label' => 'Sango (Central African Republic)', 'native_name' => 'Yângâ Tî Sängö (Central African Republic)', 'flag' => '🇨🇫', 'rtl' => false], + 'shi' => ['label' => 'Tachelhit', 'native_name' => 'TacelḥIt', 'flag' => '🇲🇦', 'rtl' => false], + 'shi_Latn' => ['label' => 'Tachelhit (Latin)', 'native_name' => 'TacelḥIt (Latin)', 'flag' => '🇲🇦', 'rtl' => false], + 'shi_Latn_MA' => ['label' => 'Tachelhit (Latin, Morocco)', 'native_name' => 'TaclḥIyt (Latin, Morocco)', 'flag' => '🇲🇦', 'rtl' => false], + 'shi_Tfng' => ['label' => 'Tachelhit (Tifinagh)', 'native_name' => 'ⵜⴰⵛⵍⵃⵉⵜ (Tifinagh)', 'flag' => '🇲🇦', 'rtl' => false], + 'shi_Tfng_MA' => ['label' => 'Tachelhit (Tifinagh, Morocco)', 'native_name' => 'ⵜⴰⵛⵍⵃⵉⵜ (Tifinagh, Morocco)', 'flag' => '🇲🇦', 'rtl' => false], + 'si' => ['label' => 'Sinhala', 'native_name' => 'සිංහල', 'flag' => '🇱🇰', 'rtl' => false], + 'si_LK' => ['label' => 'Sinhala (Sri Lanka)', 'native_name' => 'සිංහල (ශ්රී ලංකාව)', 'flag' => '🇱🇰', 'rtl' => false], + 'sk' => ['label' => 'Slovak', 'native_name' => 'Slovenčina, Slovenský Jazyk', 'flag' => '🇸🇰', 'rtl' => false], + 'sk_SK' => ['label' => 'Slovak (Slovakia)', 'native_name' => 'Slovenčina, Slovenský Jazyk (Slovensko)', 'flag' => '🇸🇰', 'rtl' => false], + 'sl' => ['label' => 'Slovenian', 'native_name' => 'Slovenščina', 'flag' => '🇸🇮', 'rtl' => false], + 'sl_SI' => ['label' => 'Slovenian (Slovenia)', 'native_name' => 'Slovenščina (Slovenija)', 'flag' => '🇸🇮', 'rtl' => false], + 'sn' => ['label' => 'Shona', 'native_name' => 'Chishona', 'flag' => '🇿🇼', 'rtl' => false], + 'sn_ZW' => ['label' => 'Shona (Zimbabwe)', 'native_name' => 'Chishona (Zimbabwe)', 'flag' => '🇿🇼', 'rtl' => false], + 'so' => ['label' => 'Somali', 'native_name' => 'Af Soomaali', 'flag' => '🇸🇴', 'rtl' => false], + 'so_DJ' => ['label' => 'Somali (Djibouti)', 'native_name' => 'اف صومالي (Jabuuti)', 'flag' => '🇩🇯', 'rtl' => true], + 'so_ET' => ['label' => 'Somali (Ethiopia)', 'native_name' => '𐒖𐒍 𐒈𐒝𐒑𐒛𐒐𐒘, 𐒈𐒝𐒑𐒛𐒐𐒘 (Ethiopia)', 'flag' => '🇪🇹', 'rtl' => false], + 'so_KE' => ['label' => 'Somali (Kenya)', 'native_name' => 'Af Soomaali (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'so_SO' => ['label' => 'Somali (Somalia)', 'native_name' => 'Af Soomaali (Soomaaliya)', 'flag' => '🇸🇴', 'rtl' => false], + 'sq' => ['label' => 'Albanian', 'native_name' => 'Gjuha Shqipe', 'flag' => '🇦🇱', 'rtl' => false], + 'sq_AL' => ['label' => 'Albanian (Albania)', 'native_name' => 'Gjuha Shqipe (Shqipëri)', 'flag' => '🇦🇱', 'rtl' => false], + 'sr' => ['label' => 'Serbian', 'native_name' => 'Srpski Jezik', 'flag' => '🇷🇸', 'rtl' => false], + 'sr_BA' => ['label' => 'Serbian (Cyrillic)', 'native_name' => 'Cрпски Језик (Ћирилица)', 'flag' => '🇷🇸', 'rtl' => false], + 'sr_Cyrl' => ['label' => 'Serbian (Cyrillic)', 'native_name' => 'Cрпски Језик (Ћирилица)', 'flag' => '🇷🇺', 'rtl' => false], + 'sr_Cyrl_BA' => ['label' => 'Serbian (Cyrillic, Bosnia and Herzegovina)', 'native_name' => 'Cрпски Језик (Cyrillic, Bosnia And Herzegovina)', 'flag' => '🇧🇦', 'rtl' => false], + 'sr_Cyrl_ME' => ['label' => 'Serbian (Cyrillic, Montenegro)', 'native_name' => 'Cрпски Језик (Cyrillic, Montenegro)', 'flag' => '🇲🇪', 'rtl' => false], + 'sr_Cyrl_RS' => ['label' => 'Serbian (Cyrillic, Serbia)', 'native_name' => 'Cрпски Језик (Cyrillic, Serbia)', 'flag' => '🇷🇸', 'rtl' => false], + 'sr_Latn' => ['label' => 'Serbian (Latin)', 'native_name' => 'Srpski Jezik (Латински Језик)', 'flag' => '🇷🇸', 'rtl' => false], + 'sr_Latn_BA' => ['label' => 'Serbian (Latin, Bosnia and Herzegovina)', 'native_name' => 'Srpski Jezik (Latin, Bosnia And Herzegovina)', 'flag' => '🇧🇦', 'rtl' => false], + 'sr_Latn_ME' => ['label' => 'Serbian (Latin, Montenegro)', 'native_name' => 'Srpski Jezik (Latin, Montenegro)', 'flag' => '🇲🇪', 'rtl' => false], + 'sr_Latn_RS' => ['label' => 'Serbian (Latin, Serbia)', 'native_name' => 'Srpski Jezik (Latin, Serbia)', 'flag' => '🇷🇸', 'rtl' => false], + 'sv' => ['label' => 'Swedish', 'native_name' => 'Svenska', 'flag' => '🇸🇪', 'rtl' => false], + 'sv_FI' => ['label' => 'Swedish (Finland)', 'native_name' => 'Finlandssvenska (Finland)', 'flag' => '🇫🇮', 'rtl' => false], + 'sv_SE' => ['label' => 'Swedish (Sweden)', 'native_name' => 'Svenska (Sverige)', 'flag' => '🇸🇪', 'rtl' => false], + 'sw' => ['label' => 'Swahili', 'native_name' => 'Kiswahili', 'flag' => '🇹🇿', 'rtl' => false], + 'sw_KE' => ['label' => 'Swahili (Kenya)', 'native_name' => 'Kiswahili (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'sw_TZ' => ['label' => 'Swahili (Tanzania)', 'native_name' => 'Kiswahili (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false], + 'ta' => ['label' => 'Tamil', 'native_name' => 'தமிழ்', 'flag' => '🇮🇳', 'rtl' => false], + 'ta_IN' => ['label' => 'Tamil (India)', 'native_name' => 'தமிழ் (இந்தியா)', 'flag' => '🇮🇳', 'rtl' => false], + 'ta_LK' => ['label' => 'Tamil (Sri Lanka)', 'native_name' => 'ஈழத் தமிழ் (இலங்கை)', 'flag' => '🇱🇰', 'rtl' => false], + 'te' => ['label' => 'Telugu', 'native_name' => 'తెలుగు', 'flag' => '🇮🇳', 'rtl' => false], + 'te_IN' => ['label' => 'Telugu (India)', 'native_name' => 'తెలుగు (భారతదేశం)', 'flag' => '🇮🇳', 'rtl' => false], + 'teo' => ['label' => 'Teso', 'native_name' => 'Ateso', 'flag' => '🇺🇬', 'rtl' => false], + 'teo_KE' => ['label' => 'Teso (Kenya)', 'native_name' => 'Ateso (Kenya)', 'flag' => '🇰🇪', 'rtl' => false], + 'teo_UG' => ['label' => 'Teso (Uganda)', 'native_name' => 'Ateso (Uganda)', 'flag' => '🇺🇬', 'rtl' => false], + 'th' => ['label' => 'Thai', 'native_name' => 'ภาษาไทย', 'flag' => '🇹🇭', 'rtl' => false], + 'th_TH' => ['label' => 'Thai (Thailand)', 'native_name' => 'ภาษาไทย (ประเทศไทย)', 'flag' => '🇹🇭', 'rtl' => false], + 'ti' => ['label' => 'Tigrinya', 'native_name' => 'ትግርኛ', 'flag' => '🇪🇹', 'rtl' => false], + 'ti_ER' => ['label' => 'Tigrinya (Eritrea)', 'native_name' => 'ትግርኛ (Eritrea)', 'flag' => '🇪🇷', 'rtl' => false], + 'ti_ET' => ['label' => 'Tigrinya (Ethiopia)', 'native_name' => 'ትግርኛ (Ethiopia)', 'flag' => '🇪🇹', 'rtl' => false], + 'tl' => ['label' => 'Tagalog', 'native_name' => 'Tagalog', 'flag' => '🇵🇭', 'rtl' => false], + 'to' => ['label' => 'Tonga', 'native_name' => 'Lea Faka', 'flag' => '🇹🇴', 'rtl' => false], + 'to_TO' => ['label' => 'Tonga (Tonga)', 'native_name' => 'Lea Faka (Tonga)', 'flag' => '🇹🇴', 'rtl' => false], + 'tr' => ['label' => 'Turkish', 'native_name' => 'Türkçe', 'flag' => '🇹🇷', 'rtl' => false], + 'tr_TR' => ['label' => 'Turkish (Türkiye)', 'native_name' => 'Türkçe (Türkiye)', 'flag' => '🇹🇷', 'rtl' => false], + 'tzm' => ['label' => 'Central Morocco Tamazight', 'native_name' => 'ⵜⴰⵎⴰⵣⵉⵖⵜ', 'flag' => '🇲🇦', 'rtl' => false], + 'tzm_Latn' => ['label' => 'Central Morocco Tamazight (Latin)', 'native_name' => 'TamaziɣT (Latin)', 'flag' => '🇲🇦', 'rtl' => false], + 'tzm_Latn_MA' => ['label' => 'Central Morocco Tamazight (Latin, Morocco)', 'native_name' => 'TamaziɣT (Latin, Morocco)', 'flag' => '🇲🇦', 'rtl' => false], + 'uk' => ['label' => 'Ukrainian', 'native_name' => 'Українська Мова', 'flag' => '🇺🇦', 'rtl' => false], + 'uk_UA' => ['label' => 'Ukrainian (Ukraine)', 'native_name' => 'Українська Мова (Україна)', 'flag' => '🇺🇦', 'rtl' => false], + 'ur' => ['label' => 'Urdu', 'native_name' => 'اُردُو', 'flag' => '🇵🇰', 'rtl' => true], + 'ur_IN' => ['label' => 'Urdu (India)', 'native_name' => 'اُردُو (ہندوستان)', 'flag' => '🇮🇳', 'rtl' => true], + 'ur_PK' => ['label' => 'Urdu (Pakistan)', 'native_name' => 'اُردُو (پاکستان)', 'flag' => '🇵🇰', 'rtl' => true], + 'uz' => ['label' => 'Uzbek', 'native_name' => 'اۉزبېکچه, اۉزبېک تیلی', 'flag' => '🇺🇿', 'rtl' => true], + 'uz_Arab' => ['label' => 'Uzbek (Arabic)', 'native_name' => 'اۉزبېکچه, اۉزبېک تیلی (Arabparast)', 'flag' => '🇶🇦', 'rtl' => true], + 'uz_Arab_AF' => ['label' => 'Uzbek (Arabic, Afghanistan)', 'native_name' => 'اۉزبېکچه, اۉزبېک تیلی (Arabic, Afghanistan)', 'flag' => '🇦🇫', 'rtl' => true], + 'uz_Cyrl' => ['label' => 'Uzbek (Cyrillic)', 'native_name' => 'Ўзбекча, Ўзбек Тили (Kirillcha)', 'flag' => '🇷🇺', 'rtl' => false], + 'uz_Cyrl_UZ' => ['label' => 'Uzbek (Cyrillic, Uzbekistan)', 'native_name' => 'Ўзбекча, Ўзбек Тили (Kirillcha Uzbekistan)', 'flag' => '🇺🇿', 'rtl' => false], + 'uz_Latn' => ['label' => 'Uzbek (Latin)', 'native_name' => 'OʻZbekcha, OʻZbek Tili, (Lotin)', 'flag' => '🇺🇿', 'rtl' => false], + 'uz_Latn_UZ' => ['label' => 'Uzbek (Latin, Uzbekistan)', 'native_name' => 'OʻZbekcha, OʻZbek Tili, (Lotin Uzbekistan)', 'flag' => '🇺🇿', 'rtl' => false], + 'vi' => ['label' => 'Vietlabelse', 'native_name' => 'OʻZbekcha, OʻZbek Tili,', 'flag' => '🇻🇳', 'rtl' => false], + 'vi_VN' => ['label' => 'Vietlabelse (Vietnam)', 'native_name' => 'TiếNg ViệT (ViệT Nam)', 'flag' => '🇻🇳', 'rtl' => false], + 'vun' => ['label' => 'Vunjo', 'native_name' => 'Wunjo', 'flag' => '🇹🇿', 'rtl' => false], + 'vun_TZ' => ['label' => 'Vunjo (Tanzania)', 'native_name' => 'Wunjo (Tanzania)', 'flag' => '🇹🇿', 'rtl' => false], + 'wo' => ['label' => 'Wolof', 'native_name' => 'Wolof', 'flag' => '🇸🇳', 'rtl' => false], + 'xog' => ['label' => 'Soga', 'native_name' => 'Lusoga', 'flag' => '🇺🇬', 'rtl' => false], + 'xog_UG' => ['label' => 'Soga (Uganda)', 'native_name' => 'Lusoga (Uganda)', 'flag' => '🇺🇬', 'rtl' => false], + 'yo' => ['label' => 'Yoruba', 'native_name' => 'Èdè Yorùbá', 'flag' => '🇳🇬', 'rtl' => false], + 'yo_NG' => ['label' => 'Yoruba (Nigeria)', 'native_name' => 'Èdè Yorùbá (Orilẹ-Ede Nigeria)', 'flag' => '🇳🇬', 'rtl' => false], + 'yue_Hant_HK' => ['label' => 'Cantonese (Traditional, Hong Kong SAR China)', 'native_name' => '香港粵語', 'flag' => '🇭🇰', 'rtl' => false], + 'zh' => ['label' => 'Chinese', 'native_name' => '中文简体', 'flag' => '🇨🇳', 'rtl' => false], + 'zh_Hans' => ['label' => 'Chinese (Simplified Han)', 'native_name' => '中文简体 (简化的汉)', 'flag' => '🇨🇳', 'rtl' => false], + 'zh_CN' => ['label' => 'Chinese (Simplified Han, China)', 'native_name' => '中文简体 (简化的汉,中国)', 'flag' => '🇨🇳', 'rtl' => false], + 'zh_Hans_CN' => ['label' => 'Chinese (Simplified Han, China)', 'native_name' => '中文简体 (简化的汉,中国)', 'flag' => '🇨🇳', 'rtl' => false], + 'zh_Hans_HK' => ['label' => 'Chinese (Simplified Han, Hong Kong SAR China)', 'native_name' => '簡體中文(香港) (简化的汉,香港中国)', 'flag' => '🇭🇰', 'rtl' => false], + 'zh_Hans_MO' => ['label' => 'Chinese (Simplified Han, Macau SAR China)', 'native_name' => '简体中文 (澳门) (简化的汉,澳门)', 'flag' => '🇲🇴', 'rtl' => false], + 'zh_Hans_SG' => ['label' => 'Chinese (Simplified Han, Singapore)', 'native_name' => '简体中文(新加坡) (简化的汉,新加坡)', 'flag' => '🇸🇬', 'rtl' => false], + 'zh_Hant' => ['label' => 'Chinese (Traditional Han)', 'native_name' => '中文(繁體) (传统汉)', 'flag' => '🇹🇼', 'rtl' => false], + 'zh_Hant_HK' => ['label' => 'Chinese (Traditional Han, Hong Kong SAR China)', 'native_name' => '中國繁體漢,(香港) (傳統的漢,香港中國)', 'flag' => '🇭🇰', 'rtl' => false], + 'zh_Hant_MO' => ['label' => 'Chinese (Traditional Han, Macau SAR China)', 'native_name' => '中文(繁體漢、澳門) (傳統漢,澳門)', 'flag' => '🇲🇴', 'rtl' => false], + 'zh_TW' => ['label' => 'Chinese (Traditional Han, Taiwan)', 'native_name' => '中文(繁體漢,台灣) (台灣傳統漢)', 'flag' => '🇹🇼', 'rtl' => false], + 'zh_Hant_TW' => ['label' => 'Chinese (Traditional Han, Taiwan)', 'native_name' => '中文(繁體漢,台灣) (台灣傳統漢)', 'flag' => '🇹🇼', 'rtl' => false], + 'zu' => ['label' => 'Zulu', 'native_name' => 'Isizulu', 'flag' => '🇿🇦', 'rtl' => false], + 'zu_ZA' => ['label' => 'Zulu (South Africa)', 'native_name' => 'Isizulu (Iningizimu Afrika)', 'flag' => '🇿🇦', 'rtl' => false], ]; - return apply_filters( 'dt_global_languages_list', $global_languages_list ); + return apply_filters('dt_global_languages_list', $global_languages_list); } } From 83fe8784be3b97668b5a21f4a88976bd6da7768e Mon Sep 17 00:00:00 2001 From: Ashima-Arora <117061227+Ashima-Arora@users.noreply.github.com> Date: Wed, 15 May 2024 18:22:57 +0530 Subject: [PATCH 4/8] commented code removed --- dt-assets/js/new-record.js | 149 +------------------------------------ 1 file changed, 1 insertion(+), 148 deletions(-) diff --git a/dt-assets/js/new-record.js b/dt-assets/js/new-record.js index e5ed4a667d..0b51c32518 100644 --- a/dt-assets/js/new-record.js +++ b/dt-assets/js/new-record.js @@ -74,8 +74,7 @@ if ( }); // Call the createPost method of initApiService to create a post with the collected data initApiService.createPost("contacts", data.el).then(function (response) { - // window.location = response.permalink - console.log("response", response); + window.location = response.permalink }); }); @@ -251,103 +250,6 @@ jQuery(function ($) { $(this).parent().remove(); }); - /* breadcrumb: new-field-type Add the new link type data to the new_post array */ - // $(".js-create-post").on("submit", function(e) { - // $(".js-create-post-button") - // .attr("disabled", true) - // .addClass("loading"); - // e.preventDefault(); - // new_post.title = $(".js-create-post [name=name]").val() - - // $('.text-input').each((index, entry)=>{ - // if ( $(entry).val() ){ - // new_post[$(entry).attr('id')] = $(entry).val() - // } - // }) - - // $('dt-text').each((index, entry)=>{ - // if ( $(entry).val() ){ - // new_post[$(entry).attr('id')] = $(entry).attr('value') - // } - // }) - - // $('dt-comm-channel').each((index, entry)=>{ - // let channel = $(entry).attr('id'); - // console.log('channel', channel) - // console.log('typeof new_post[channel]', typeof(commChannelComponentValue)) - // if (typeof new_post[channel] === 'undefined') { - // new_post[channel] = []; - // } - // console.log('$(entry)', entry) - // if($(entry).attr('value')) { - // console.log('here') - // const commChannelComponentValue = JSON.parse($(entry).attr('value')) - // commChannelComponentValue && commChannelComponentValue.map(currentItem => { - // new_post[channel].push({value: currentItem.value}); - // }) - - // } - // console.log('newpost', new_post) - - // }) - - // $('dt-single-select').each((entry) => { - // new_post[$(entry).attr('id')] = $(entry).attr('value') - // }) - - // $('.link-input').each(( entry) => { - // let fieldKey = $(entry).data('field-key') - // let type = $(entry).data('type') - // if ( $(entry).val() ){ - // if ( !Object.prototype.hasOwnProperty.call( new_post, fieldKey ) ) { - // new_post[fieldKey] = { values: [] } - // } - // new_post[fieldKey].values.push( { - // value: $(entry).val(), - // type: type, - // } ) - // } - // }) - - // $('.dt_textarea').each((index, entry)=>{ - // if ( $(entry).val() ){ - // new_post[$(entry).attr('id')] = $(entry).val() - // } - // }); - - // $('dt-connection').each((index, entry)=>{ - // let channel = $(entry).attr('id'); - // const dtConnectionValues = JSON.parse($(entry).attr('value')) - // dtConnectionValues.map(currentItem => { - // new_post[channel].push({value: currentItem.value}); - // }) - // }); - - // $('.selected-select-button').each((index, entry)=>{ - // let optionKey = $(entry).attr('id') - // let fieldKey = $(entry).data("field-key") - // if ( !new_post[fieldKey]){ - // new_post[fieldKey] = {values:[]}; - // } - // new_post[fieldKey].values.push({ - // "value": optionKey - // }) - // }) - - // if ( typeof window.selected_location_grid_meta !== 'undefined' ){ - // new_post['location_grid_meta'] = window.selected_location_grid_meta.location_grid_meta - // } - - // window.API.create_post( window.new_record_localized.post_type, new_post).promise().then(function(data) { - // window.location = data.permalink; - // }).catch(function(error) { - // const message = error.responseJSON?.message || error.responseText - // $(".js-create-post-button").removeClass("loading").addClass("alert").attr("disabled", false) - // $(".error-text").html(message); - // }); - // return false; - // }); - let field_settings = window.new_record_localized.post_type_settings.fields; function date_picker_init(is_bulk = false, bulk_id = 0) { @@ -1921,55 +1823,6 @@ jQuery(function ($) { } }); - // function check_field_value_exists(field_type, element_index) { - // var email = $(`input[data-${field_type}-index="${element_index}"]`).val(); - // console.log(email); - // $(`.loading-spinner[data-${field_type}-index="${element_index}"]`).attr('class','loading-spinner active'); - // if (!email) { - // $(`.communication-channel-error[data-${field_type}-index="${element_index}"]`).hide(); - // $(`.loading-spinner[data-${field_type}-index="${element_index}"]`).attr('class','loading-spinner'); - // return; - // } - // var post_type = window.wpApiShare.post_type; - // var data = {"communication_channel": `${field_type}`, "field_value": email,} - // jQuery.ajax({ - // type: "POST", - // data: JSON.stringify(data), - // contentType: "application/json; charset=utf-8", - // dataType: "json", - // url: window.wpApiShare.root + `dt-posts/v2/${post_type}/check_field_value_exists`, - // beforeSend: (xhr) => { - // xhr.setRequestHeader("X-WP-Nonce", window.wpApiShare.nonce); - // }, - // }).then(result => { - // if (!$.isEmptyObject(result)) { - // var duplicate_ids_html = ''; - // $.each(result, function(k,v) { - // if ( k > 0 ) { - // duplicate_ids_html += ', '; - // } - // duplicate_ids_html += `${window.new_record_localized.translations.contact} #${v.post_id}`; - // }); - // $(`.duplicate-ids[data-${field_type}-index="${element_index}"]`).html(duplicate_ids_html); - // $(`.communication-channel-error[data-${field_type}-index="${element_index}"]`).show(); - // } else { - // $(`.communication-channel-error[data-${field_type}-index="${element_index}"]`).hide(); - // $(`.duplicate-ids[data-${field_type}-index="${element_index}"]`).html(''); - // } - // $(`.loading-spinner[data-${field_type}-index="${element_index}"]`).attr('class','loading-spinner'); - // }); - // } - - // $('.form-fields dt-comm-channel').on('change', function(e) { - // // $('#contact_').on('change', function() { - // console.log('cnjdcjdncjd'); - // var post_type = $(this).attr('posttype'); - // console.log(post_type); - // var element_index = $(this).attr('id');; - // console.log(element_index); - // check_field_value_exists(post_type, element_index) - // }); - /** * ============== [ BULK RECORD ADDING FUNCTIONALITY ] ============== */ From 532cfbb9af7731f4304bc4276afebe3c4395f9d0 Mon Sep 17 00:00:00 2001 From: Micah Mills Date: Wed, 22 May 2024 12:16:14 +0300 Subject: [PATCH 5/8] reverting php code styling changes so the test pass --- dt-contacts/access-module.php | 1553 ++++++++++++++++----------------- dt-core/global-functions.php | 813 +++++++++-------- template-new-post.php | 2 +- 3 files changed, 1131 insertions(+), 1237 deletions(-) diff --git a/dt-contacts/access-module.php b/dt-contacts/access-module.php index 376b6c1745..5db26307a5 100644 --- a/dt-contacts/access-module.php +++ b/dt-contacts/access-module.php @@ -1,85 +1,79 @@ true, 'create_contacts' => true]; + public function dt_set_roles_and_permissions( $expected_roles ){ + $base_contacts_permissions = [ 'access_contacts' => true, 'create_contacts' => true ]; $all_user_caps = Disciple_Tools_Roles::default_user_caps(); $metrics_caps = Disciple_Tools_Roles::default_all_metrics_caps(); $expected_roles['dispatcher'] = [ - 'label' => __('Dispatcher', 'disciple_tools'), + 'label' => __( 'Dispatcher', 'disciple_tools' ), 'description' => 'Monitor new D.T contacts and assign them to waiting Multipliers', - 'permissions' => array_merge($base_contacts_permissions, $all_user_caps, $metrics_caps), - 'type' => ['base', 'access'], + 'permissions' => array_merge( $base_contacts_permissions, $all_user_caps, $metrics_caps ), + 'type' => [ 'base', 'access' ], 'order' => 20 ]; $expected_roles['partner'] = [ - 'label' => __('Partner', 'disciple_tools'), + 'label' => __( 'Partner', 'disciple_tools' ), 'description' => 'Allow access to a specific contact source so a partner can see progress', - 'permissions' => array_merge($base_contacts_permissions, $all_user_caps), - 'type' => ['base', 'access'], + 'permissions' => array_merge( $base_contacts_permissions, $all_user_caps ), + 'type' => [ 'base', 'access' ], 'order' => 35 ]; $expected_roles['marketer'] = [ - 'label' => __('Digital Responder', 'disciple_tools'), + 'label' => __( 'Digital Responder', 'disciple_tools' ), 'description' => 'Talk to leads online and report in D.T when Contacts are ready for follow-up', - 'permissions' => array_merge($base_contacts_permissions, $all_user_caps, $metrics_caps), - 'type' => ['base', 'access'], + 'permissions' => array_merge( $base_contacts_permissions, $all_user_caps, $metrics_caps ), + 'type' => [ 'base', 'access' ], 'order' => 50 ]; @@ -100,285 +94,284 @@ public function dt_set_roles_and_permissions($expected_roles) return $expected_roles; } - public function dt_custom_fields_settings($fields, $post_type) - { + public function dt_custom_fields_settings( $fields, $post_type ){ $declared_fields = $fields; - if ($post_type === 'contacts') { - if (isset($fields['type']['default']['personal'])) { + if ( $post_type === 'contacts' ){ + if ( isset( $fields['type']['default']['personal'] ) ){ $fields['type']['default']['personal']['default'] = false; } $fields['type']['default']['access'] = [ - 'label' => __('Standard Contact', 'disciple_tools'), + 'label' => __( 'Standard Contact', 'disciple_tools' ), 'color' => '#2196F3', - 'description' => __('A contact to collaborate on', 'disciple_tools'), - 'visibility' => __('Me and project leadership', 'disciple_tools'), + 'description' => __( 'A contact to collaborate on', 'disciple_tools' ), + 'visibility' => __( 'Me and project leadership', 'disciple_tools' ), 'icon' => get_template_directory_uri() . '/dt-assets/images/share.svg?v=2', 'order' => 20, 'default' => true, ]; $fields['type']['default']['access_placeholder'] = [ - 'label' => __('Connection', 'disciple_tools'), + 'label' => __( 'Connection', 'disciple_tools' ), 'color' => '#FF9800', - 'description' => __('Connected to a contact, or generational fruit', 'disciple_tools'), + 'description' => __( 'Connected to a contact, or generational fruit', 'disciple_tools' ), 'icon' => get_template_directory_uri() . '/dt-assets/images/share.svg?v=2', 'order' => 40, - 'visibility' => __('Collaborators', 'disciple_tools'), + 'visibility' => __( 'Collaborators', 'disciple_tools' ), 'in_create_form' => false, ]; $fields['assigned_to'] = [ - 'name' => __('Assigned To', 'disciple_tools'), - 'description' => __('Select the main person who is responsible for reporting on this contact.', 'disciple_tools'), - 'type' => 'user_select', - 'default' => '', - 'tile' => 'status', + 'name' => __( 'Assigned To', 'disciple_tools' ), + 'description' => __( 'Select the main person who is responsible for reporting on this contact.', 'disciple_tools' ), + 'type' => 'user_select', + 'default' => '', + 'tile' => 'status', 'icon' => get_template_directory_uri() . '/dt-assets/images/assigned-to.svg?v=2', 'show_in_table' => 25, - 'only_for_types' => ['access', 'user'], + 'only_for_types' => [ 'access', 'user' ], 'custom_display' => false ]; $fields['seeker_path'] = [ - 'name' => __('Seeker Path', 'disciple_tools'), - 'description' => _x('Set the status of your progression with the contact. These are the steps that happen in a specific order to help a contact move forward.', 'Seeker Path field description', 'disciple_tools'), - 'type' => 'key_select', - 'default' => [ - 'none' => [ - 'label' => __('Contact Attempt Needed', 'disciple_tools'), - 'description' => '' + 'name' => __( 'Seeker Path', 'disciple_tools' ), + 'description' => _x( 'Set the status of your progression with the contact. These are the steps that happen in a specific order to help a contact move forward.', 'Seeker Path field description', 'disciple_tools' ), + 'type' => 'key_select', + 'default' => [ + 'none' => [ + 'label' => __( 'Contact Attempt Needed', 'disciple_tools' ), + 'description' => '' ], - 'attempted' => [ - 'label' => __('Contact Attempted', 'disciple_tools'), - 'description' => '' + 'attempted' => [ + 'label' => __( 'Contact Attempted', 'disciple_tools' ), + 'description' => '' ], 'established' => [ - 'label' => __('Contact Established', 'disciple_tools'), - 'description' => '' + 'label' => __( 'Contact Established', 'disciple_tools' ), + 'description' => '' ], - 'scheduled' => [ - 'label' => __('First Meeting Scheduled', 'disciple_tools'), - 'description' => '' + 'scheduled' => [ + 'label' => __( 'First Meeting Scheduled', 'disciple_tools' ), + 'description' => '' ], - 'met' => [ - 'label' => __('First Meeting Complete', 'disciple_tools'), - 'description' => '' + 'met' => [ + 'label' => __( 'First Meeting Complete', 'disciple_tools' ), + 'description' => '' ], - 'ongoing' => [ - 'label' => __('Ongoing Meetings', 'disciple_tools'), - 'description' => '' + 'ongoing' => [ + 'label' => __( 'Ongoing Meetings', 'disciple_tools' ), + 'description' => '' ], - 'coaching' => [ - 'label' => __('Being Coached', 'disciple_tools'), - 'description' => '' + 'coaching' => [ + 'label' => __( 'Being Coached', 'disciple_tools' ), + 'description' => '' ], ], 'customizable' => 'add_only', 'tile' => 'followup', 'show_in_table' => 15, - 'only_for_types' => ['access'], + 'only_for_types' => [ 'access' ], 'icon' => get_template_directory_uri() . '/dt-assets/images/sign-post.svg?v=2', ]; $fields['overall_status'] = [ - 'name' => __('Contact Status', 'disciple_tools'), - 'type' => 'key_select', + 'name' => __( 'Contact Status', 'disciple_tools' ), + 'type' => 'key_select', 'default_color' => '#366184', - 'default' => [ - 'new' => [ - 'label' => __('New Contact', 'disciple_tools'), - 'description' => _x('The contact is new in the system.', 'Contact Status field description', 'disciple_tools'), + 'default' => [ + 'new' => [ + 'label' => __( 'New Contact', 'disciple_tools' ), + 'description' => _x( 'The contact is new in the system.', 'Contact Status field description', 'disciple_tools' ), 'color' => '#F43636', ], 'unassignable' => [ - 'label' => __('Not Ready', 'disciple_tools'), - 'description' => _x('There is not enough information to move forward with the contact at this time.', 'Contact Status field description', 'disciple_tools'), + 'label' => __( 'Not Ready', 'disciple_tools' ), + 'description' => _x( 'There is not enough information to move forward with the contact at this time.', 'Contact Status field description', 'disciple_tools' ), 'color' => '#FF9800', ], - 'unassigned' => [ - 'label' => __('Dispatch Needed', 'disciple_tools'), - 'description' => _x('This contact needs to be assigned to a multiplier.', 'Contact Status field description', 'disciple_tools'), + 'unassigned' => [ + 'label' => __( 'Dispatch Needed', 'disciple_tools' ), + 'description' => _x( 'This contact needs to be assigned to a multiplier.', 'Contact Status field description', 'disciple_tools' ), 'color' => '#F43636', ], - 'assigned' => [ - 'label' => __('Waiting to be accepted', 'disciple_tools'), - 'description' => _x('The contact has been assigned to someone, but has not yet been accepted by that person.', 'Contact Status field description', 'disciple_tools'), + 'assigned' => [ + 'label' => __( 'Waiting to be accepted', 'disciple_tools' ), + 'description' => _x( 'The contact has been assigned to someone, but has not yet been accepted by that person.', 'Contact Status field description', 'disciple_tools' ), 'color' => '#FF9800', ], - 'active' => [], //already declared. Here to indicate order - 'paused' => [ - 'label' => __('Paused', 'disciple_tools'), - 'description' => _x('This contact is currently on hold (i.e. on vacation or not responding).', 'Contact Status field description', 'disciple_tools'), + 'active' => [], //already declared. Here to indicate order + 'paused' => [ + 'label' => __( 'Paused', 'disciple_tools' ), + 'description' => _x( 'This contact is currently on hold (i.e. on vacation or not responding).', 'Contact Status field description', 'disciple_tools' ), 'color' => '#FF9800', ], 'closed' => [] //already declared. Here to indicate order ], - 'tile' => 'status', + 'tile' => 'status', 'customizable' => 'add_only', 'custom_display' => true, 'icon' => get_template_directory_uri() . '/dt-assets/images/status.svg?v=2', 'show_in_table' => 10, - 'only_for_types' => ['access'], + 'only_for_types' => [ 'access' ], 'select_cannot_be_empty' => true ]; $fields['reason_unassignable'] = [ - 'name' => __('Reason Not Ready', 'disciple_tools'), - 'description' => _x('The main reason the contact is not ready to be assigned to a user.', 'Optional Documentation', 'disciple_tools'), - 'type' => 'key_select', - 'default' => [ - 'none' => [ + 'name' => __( 'Reason Not Ready', 'disciple_tools' ), + 'description' => _x( 'The main reason the contact is not ready to be assigned to a user.', 'Optional Documentation', 'disciple_tools' ), + 'type' => 'key_select', + 'default' => [ + 'none' => [ 'label' => '', ], 'insufficient' => [ - 'label' => __('Insufficient Contact Information', 'disciple_tools') + 'label' => __( 'Insufficient Contact Information', 'disciple_tools' ) ], - 'location' => [ - 'label' => __('Unknown Location', 'disciple_tools') + 'location' => [ + 'label' => __( 'Unknown Location', 'disciple_tools' ) ], - 'media' => [ - 'label' => __('Only wants media', 'disciple_tools') + 'media' => [ + 'label' => __( 'Only wants media', 'disciple_tools' ) ], 'outside_area' => [ - 'label' => __('Outside Area', 'disciple_tools') + 'label' => __( 'Outside Area', 'disciple_tools' ) ], 'needs_review' => [ - 'label' => __('Needs Review', 'disciple_tools') + 'label' => __( 'Needs Review', 'disciple_tools' ) ], 'awaiting_confirmation' => [ - 'label' => __('Waiting for Confirmation', 'disciple_tools') + 'label' => __( 'Waiting for Confirmation', 'disciple_tools' ) ], ], 'customizable' => 'all', - 'only_for_types' => ['access'] + 'only_for_types' => [ 'access' ] ]; $fields['reason_paused'] = [ - 'name' => __('Reason Paused', 'disciple_tools'), - 'description' => _x('A paused contact is one you are not currently interacting with but expect to in the future.', 'Optional Documentation', 'disciple_tools'), - 'type' => 'key_select', + 'name' => __( 'Reason Paused', 'disciple_tools' ), + 'description' => _x( 'A paused contact is one you are not currently interacting with but expect to in the future.', 'Optional Documentation', 'disciple_tools' ), + 'type' => 'key_select', 'default' => [ - 'none' => ['label' => ''], - 'vacation' => ['label' => _x('Contact on vacation', 'Reason Paused label', 'disciple_tools')], - 'not_responding' => ['label' => _x('Contact not responding', 'Reason Paused label', 'disciple_tools')], - 'not_available' => ['label' => _x('Contact not available', 'Reason Paused label', 'disciple_tools')], - 'little_interest' => ['label' => _x('Contact has little interest/hunger', 'Reason Paused label', 'disciple_tools')], - 'no_initiative' => ['label' => _x('Contact shows no initiative', 'Reason Paused label', 'disciple_tools')], - 'questionable_motives' => ['label' => _x('Contact has questionable motives', 'Reason Paused label', 'disciple_tools')], - 'ball_in_their_court' => ['label' => _x('Ball is in the contact\'s court', 'Reason Paused label', 'disciple_tools')], - 'wait_and_see' => ['label' => _x('We want to see if/how the contact responds to automated text messages', 'Reason Paused label', 'disciple_tools')], + 'none' => [ 'label' => '' ], + 'vacation' => [ 'label' => _x( 'Contact on vacation', 'Reason Paused label', 'disciple_tools' ) ], + 'not_responding' => [ 'label' => _x( 'Contact not responding', 'Reason Paused label', 'disciple_tools' ) ], + 'not_available' => [ 'label' => _x( 'Contact not available', 'Reason Paused label', 'disciple_tools' ) ], + 'little_interest' => [ 'label' => _x( 'Contact has little interest/hunger', 'Reason Paused label', 'disciple_tools' ) ], + 'no_initiative' => [ 'label' => _x( 'Contact shows no initiative', 'Reason Paused label', 'disciple_tools' ) ], + 'questionable_motives' => [ 'label' => _x( 'Contact has questionable motives', 'Reason Paused label', 'disciple_tools' ) ], + 'ball_in_their_court' => [ 'label' => _x( 'Ball is in the contact\'s court', 'Reason Paused label', 'disciple_tools' ) ], + 'wait_and_see' => [ 'label' => _x( 'We want to see if/how the contact responds to automated text messages', 'Reason Paused label', 'disciple_tools' ) ], ], 'customizable' => 'all', - 'only_for_types' => ['access'] + 'only_for_types' => [ 'access' ] ]; $fields['reason_closed'] = [ - 'name' => __('Reason Archived', 'disciple_tools'), - 'description' => _x("A closed contact is one you can't or don't wish to interact with.", 'Optional Documentation', 'disciple_tools'), - 'type' => 'key_select', - 'default' => [ - 'none' => ['label' => ''], - 'duplicate' => ['label' => _x('Duplicate', 'Reason Closed label', 'disciple_tools')], - 'insufficient' => ['label' => _x('Insufficient contact info', 'Reason Closed label', 'disciple_tools')], - 'denies_submission' => ['label' => _x('Denies submitting contact request', 'Reason Closed label', 'disciple_tools')], - 'hostile_self_gain' => ['label' => _x('Hostile, playing games or self gain', 'Reason Closed label', 'disciple_tools')], - 'apologetics' => ['label' => _x('Only wants to argue or debate', 'Reason Closed label', 'disciple_tools')], - 'media_only' => ['label' => _x('Just wanted media or book', 'Reason Closed label', 'disciple_tools')], - 'no_longer_interested' => ['label' => _x('No longer interested', 'Reason Closed label', 'disciple_tools')], - 'no_longer_responding' => ['label' => _x('No longer responding', 'Reason Closed label', 'disciple_tools')], - 'already_connected' => ['label' => _x('Already in church or connected with others', 'Reason Closed label', 'disciple_tools')], - 'transfer' => ['label' => _x('Transferred contact to partner', 'Reason Closed label', 'disciple_tools')], - 'martyred' => ['label' => _x('Martyred', 'Reason Closed label', 'disciple_tools')], - 'moved' => ['label' => _x('Moved or relocated', 'Reason Closed label', 'disciple_tools')], - 'gdpr' => ['label' => _x('GDPR request', 'Reason Closed label', 'disciple_tools')], - 'unknown' => ['label' => _x('Unknown', 'Reason Closed label', 'disciple_tools')] + 'name' => __( 'Reason Archived', 'disciple_tools' ), + 'description' => _x( "A closed contact is one you can't or don't wish to interact with.", 'Optional Documentation', 'disciple_tools' ), + 'type' => 'key_select', + 'default' => [ + 'none' => [ 'label' => '' ], + 'duplicate' => [ 'label' => _x( 'Duplicate', 'Reason Closed label', 'disciple_tools' ) ], + 'insufficient' => [ 'label' => _x( 'Insufficient contact info', 'Reason Closed label', 'disciple_tools' ) ], + 'denies_submission' => [ 'label' => _x( 'Denies submitting contact request', 'Reason Closed label', 'disciple_tools' ) ], + 'hostile_self_gain' => [ 'label' => _x( 'Hostile, playing games or self gain', 'Reason Closed label', 'disciple_tools' ) ], + 'apologetics' => [ 'label' => _x( 'Only wants to argue or debate', 'Reason Closed label', 'disciple_tools' ) ], + 'media_only' => [ 'label' => _x( 'Just wanted media or book', 'Reason Closed label', 'disciple_tools' ) ], + 'no_longer_interested' => [ 'label' => _x( 'No longer interested', 'Reason Closed label', 'disciple_tools' ) ], + 'no_longer_responding' => [ 'label' => _x( 'No longer responding', 'Reason Closed label', 'disciple_tools' ) ], + 'already_connected' => [ 'label' => _x( 'Already in church or connected with others', 'Reason Closed label', 'disciple_tools' ) ], + 'transfer' => [ 'label' => _x( 'Transferred contact to partner', 'Reason Closed label', 'disciple_tools' ) ], + 'martyred' => [ 'label' => _x( 'Martyred', 'Reason Closed label', 'disciple_tools' ) ], + 'moved' => [ 'label' => _x( 'Moved or relocated', 'Reason Closed label', 'disciple_tools' ) ], + 'gdpr' => [ 'label' => _x( 'GDPR request', 'Reason Closed label', 'disciple_tools' ) ], + 'unknown' => [ 'label' => _x( 'Unknown', 'Reason Closed label', 'disciple_tools' ) ] ], 'customizable' => 'all', - 'only_for_types' => ['access'] + 'only_for_types' => [ 'access' ] ]; $fields['accepted'] = [ - 'name' => __('Accepted', 'disciple_tools'), - 'type' => 'boolean', - 'default' => false, - 'hidden' => true, - 'only_for_types' => ['access'] + 'name' => __( 'Accepted', 'disciple_tools' ), + 'type' => 'boolean', + 'default' => false, + 'hidden' => true, + 'only_for_types' => [ 'access' ] ]; $sources_default = [ - 'personal' => [ - 'label' => __('Personal', 'disciple_tools'), - 'key' => 'personal', + 'personal' => [ + 'label' => __( 'Personal', 'disciple_tools' ), + 'key' => 'personal', ], - 'web' => [ - 'label' => __('Web', 'disciple_tools'), - 'key' => 'web', + 'web' => [ + 'label' => __( 'Web', 'disciple_tools' ), + 'key' => 'web', ], - 'facebook' => [ - 'label' => __('Facebook', 'disciple_tools'), - 'key' => 'facebook', + 'facebook' => [ + 'label' => __( 'Facebook', 'disciple_tools' ), + 'key' => 'facebook', ], - 'twitter' => [ - 'label' => __('Twitter', 'disciple_tools'), - 'key' => 'twitter', + 'twitter' => [ + 'label' => __( 'Twitter', 'disciple_tools' ), + 'key' => 'twitter', ], 'transfer' => [ - 'label' => __('Transfer', 'disciple_tools'), - 'key' => 'transfer', - 'description' => __('Contacts transferred from a partnership with another Disciple.Tools site.', 'disciple_tools'), + 'label' => __( 'Transfer', 'disciple_tools' ), + 'key' => 'transfer', + 'description' => __( 'Contacts transferred from a partnership with another Disciple.Tools site.', 'disciple_tools' ), ] ]; - foreach (dt_get_option('dt_site_custom_lists')['sources'] as $key => $value) { - if (!isset($sources_default[$key])) { - if (isset($value['enabled']) && $value['enabled'] === false) { + foreach ( dt_get_option( 'dt_site_custom_lists' )['sources'] as $key => $value ) { + if ( !isset( $sources_default[$key] ) ) { + if ( isset( $value['enabled'] ) && $value['enabled'] === false ) { $value['deleted'] = true; } - $sources_default[$key] = $value; + $sources_default[ $key ] = $value; } } $fields['sources'] = [ - 'name' => __('Sources', 'disciple_tools'), - 'description' => _x('The website, event or location this contact came from.', 'Optional Documentation', 'disciple_tools'), - 'type' => 'multi_select', - 'default' => $sources_default, - 'tile' => 'details', + 'name' => __( 'Sources', 'disciple_tools' ), + 'description' => _x( 'The website, event or location this contact came from.', 'Optional Documentation', 'disciple_tools' ), + 'type' => 'multi_select', + 'default' => $sources_default, + 'tile' => 'details', 'customizable' => 'all', 'display' => 'typeahead', 'icon' => get_template_directory_uri() . '/dt-assets/images/arrow-collapse-all.svg?v=2', - 'only_for_types' => ['access'], - 'in_create_form' => ['access'] + 'only_for_types' => [ 'access' ], + 'in_create_form' => [ 'access' ] ]; $fields['campaigns'] = [ - 'name' => __('Campaigns', 'disciple_tools'), - 'description' => _x('Marketing campaigns or access activities that this contact interacted with.', 'Optional Documentation', 'disciple_tools'), + 'name' => __( 'Campaigns', 'disciple_tools' ), + 'description' => _x( 'Marketing campaigns or access activities that this contact interacted with.', 'Optional Documentation', 'disciple_tools' ), 'tile' => 'details', - 'type' => 'tags', - 'default' => [], + 'type' => 'tags', + 'default' => [], 'icon' => get_template_directory_uri() . '/dt-assets/images/megaphone.svg?v=2', - 'only_for_types' => ['access'], + 'only_for_types' => [ 'access' ], ]; - if (empty($fields['contact_phone']['in_create_form'])) { - $fields['contact_phone']['in_create_form'] = ['access']; - } elseif (is_array($fields['contact_phone']['in_create_form'])) { + if ( empty( $fields['contact_phone']['in_create_form'] ) ){ + $fields['contact_phone']['in_create_form'] = [ 'access' ]; + } elseif ( is_array( $fields['contact_phone']['in_create_form'] ) ){ $fields['contact_phone']['in_create_form'][] = 'access'; } - if (empty($fields['contact_email']['in_create_form'])) { - $fields['contact_email']['in_create_form'] = ['access']; - } elseif (is_array($fields['contact_email']['in_create_form'])) { + if ( empty( $fields['contact_email']['in_create_form'] ) ){ + $fields['contact_email']['in_create_form'] = [ 'access' ]; + } elseif ( is_array( $fields['contact_email']['in_create_form'] ) ){ $fields['contact_email']['in_create_form'][] = 'access'; } - if (empty($fields['contact_address']['in_create_form'])) { - $fields['contact_address']['in_create_form'] = ['access']; - } elseif (is_array($fields['contact_address']['in_create_form'])) { + if ( empty( $fields['contact_address']['in_create_form'] ) ){ + $fields['contact_address']['in_create_form'] = [ 'access' ]; + } elseif ( is_array( $fields['contact_address']['in_create_form'] ) ){ $fields['contact_address']['in_create_form'][] = 'access'; } - $declared_fields = dt_array_merge_recursive_distinct($declared_fields, $fields); + $declared_fields = dt_array_merge_recursive_distinct( $declared_fields, $fields ); //order overall status options - uksort($declared_fields['overall_status']['default'], function ($a, $b) use ($fields) { - return array_search($a, array_keys($fields['overall_status']['default'])) <=> array_search($b, array_keys($fields['overall_status']['default'])); - }); + uksort( $declared_fields['overall_status']['default'], function ( $a, $b ) use ( $fields ){ + return array_search( $a, array_keys( $fields['overall_status']['default'] ) ) <=> array_search( $b, array_keys( $fields['overall_status']['default'] ) ); + } ); $fields = $declared_fields; } @@ -387,148 +380,136 @@ public function dt_custom_fields_settings($fields, $post_type) } - public function add_api_routes() - { + public function add_api_routes(){ $namespace = 'dt-posts/v2'; register_rest_route( - $namespace, - '/contacts/(?P\d+)/accept', - [ - 'methods' => 'POST', - 'callback' => [$this, 'accept_contact'], + $namespace, '/contacts/(?P\d+)/accept', [ + 'methods' => 'POST', + 'callback' => [ $this, 'accept_contact' ], 'permission_callback' => '__return_true', ] ); register_rest_route( - $namespace, - '/contacts/assignment-list', - [ - 'methods' => 'GET', - 'callback' => [$this, 'get_dispatch_list'], + $namespace, '/contacts/assignment-list', [ + 'methods' => 'GET', + 'callback' => [ $this, 'get_dispatch_list' ], 'permission_callback' => '__return_true', ] ); } - public function dt_details_additional_tiles($sections, $post_type = '') - { - if (is_singular('contacts')) { - $contact = DT_Posts::get_post('contacts', get_the_ID()); - if (is_wp_error($contact) || (isset($contact['type']['key']) && $contact['type']['key'] !== 'access')) { + public function dt_details_additional_tiles( $sections, $post_type = '' ){ + if ( is_singular( 'contacts' ) ) { + $contact = DT_Posts::get_post( 'contacts', get_the_ID() ); + if ( is_wp_error( $contact ) || ( isset( $contact['type']['key'] ) && $contact['type']['key'] !== 'access' ) ) { return $sections; } } - if ($post_type === 'contacts') { + if ( $post_type === 'contacts' ){ $sections['followup'] = [ - 'label' => __('Follow Up', 'disciple_tools'), + 'label' => __( 'Follow Up', 'disciple_tools' ), 'display_for' => [ - 'type' => ['access'], + 'type' => [ 'access' ], ] ]; - if (isset($sections['status']['order']) && !in_array('overall_status', $sections['status']['order'], true)) { - $sections['status']['order'] = array_merge(['overall_status', 'assigned_to'], $sections['status']['order']); + if ( isset( $sections['status']['order'] ) && !in_array( 'overall_status', $sections['status']['order'], true ) ){ + $sections['status']['order'] = array_merge( [ 'overall_status', 'assigned_to' ], $sections['status']['order'] ); } } return $sections; } - public function dt_render_field_for_display_fields($fields, $field_key, $post) - { - if ($post && $post['post_type'] === 'contacts' && $field_key === 'assigned_to') { + public function dt_render_field_for_display_fields( $fields, $field_key, $post ){ + if ( $post && $post['post_type'] === 'contacts' && $field_key === 'assigned_to' ){ $fields['assigned_to']['custom_display'] = true; } return $fields; } - public function dt_render_field_for_display_template($post, $field_type, $field_key, $required_tag, $display_field_id, $custom_display = false, $fields = []) - { - $contact_fields = !empty($fields) ? $fields : DT_Posts::get_post_field_settings('contacts'); - if (isset($post['post_type']) && isset($post['ID'])) { - $can_update = DT_Posts::can_update($post['post_type'], $post['ID']); + public function dt_render_field_for_display_template( $post, $field_type, $field_key, $required_tag, $display_field_id, $custom_display = false, $fields = [] ){ + $contact_fields = !empty( $fields ) ? $fields : DT_Posts::get_post_field_settings( 'contacts' ); + if ( isset( $post['post_type'] ) && isset( $post['ID'] ) ) { + $can_update = DT_Posts::can_update( $post['post_type'], $post['ID'] ); } else { $can_update = true; } $disabled = 'disabled'; - if ($can_update || isset($post['assigned_to']['id']) && $post['assigned_to']['id'] == get_current_user_id()) { + if ( $can_update || isset( $post['assigned_to']['id'] ) && $post['assigned_to']['id'] == get_current_user_id() ) { $disabled = ''; } - if ( - isset($post['post_type']) && $post['post_type'] === 'contacts' && $field_key === 'overall_status' - && isset($contact_fields[$field_key]) && $custom_display - && empty($contact_fields[$field_key]['hidden']) - ) { + if ( isset( $post['post_type'] ) && $post['post_type'] === 'contacts' && $field_key === 'overall_status' + && isset( $contact_fields[$field_key] ) && $custom_display + && empty( $contact_fields[$field_key]['hidden'] ) + ){ $contact = $post; - if (!dt_field_enabled_for_record_type($contact_fields[$field_key], $post)) { + if ( !dt_field_enabled_for_record_type( $contact_fields[$field_key], $post ) ){ return; } ?> - $key, - 'label' => $value['label'], - 'color' => $value['color'] ?? null, - ]; - }, array_keys($options_array), $options_array); + $key, + 'label' => $value['label'], + 'color' => $value['color'] ?? null, + ]; + }, array_keys( $options_array ), $options_array ); - if (isset($contact_fields[$field_key]['icon']) && !empty($contact_fields[$field_key]['icon'])) { - $icon = 'icon=' . esc_attr($contact_fields[$field_key]['icon']); - } - ?> - - options="" - value=""> - - - -

    - - + + options="" + value=""> + + + +

    + + - - -

    + ?> + + +

    -

    -

    -

    +

    +

    +

    -
    -

    -

    -

    +

    +

    +

    - -
    -

    -

    -

    +

    +

    +

    -
    @@ -611,36 +589,29 @@ class="fi-pencil"> } - if ( - isset($post['post_type']) && $post['post_type'] === 'contacts' && $field_key === 'assigned_to' - && isset($contact_fields[$field_key]) && !empty($contact_fields[$field_key]['custom_display']) - && empty($contact_fields[$field_key]['hidden']) - ) { - $button_class = (current_user_can('dt_all_access_contacts') || current_user_can('list_users')) ? 'advanced_user_select' : 'search_assigned_to' - ?> + if ( isset( $post['post_type'] ) && $post['post_type'] === 'contacts' && $field_key === 'assigned_to' + && isset( $contact_fields[$field_key] ) && !empty( $contact_fields[$field_key]['custom_display'] ) + && empty( $contact_fields[$field_key]['hidden'] ) ){ + $button_class =( current_user_can( 'dt_all_access_contacts' ) || current_user_can( 'list_users' ) ) ? 'advanced_user_select' : 'search_assigned_to' + ?>
    - - + +
    -
    - -
    +
    + +
    - > + > - @@ -649,87 +620,77 @@ class=" typeahead__image_button input-heig
    [ - 'label' => __('Multipliers', 'disciple_tools') + 'label' => __( 'Multipliers', 'disciple_tools' ) ], 'dispatcher' => [ - 'label' => __('Dispatchers', 'disciple_tools') + 'label' => __( 'Dispatchers', 'disciple_tools' ) ], 'marketer' => [ - 'label' => __('Digital Responders', 'disciple_tools') + 'label' => __( 'Digital Responders', 'disciple_tools' ) ], ]; - if ($is_dispatcher) { ?> -
    -
    -
    -

    -
    -
      - $value): ?> -
    • - - - -
    • - -
    -
    + +
    ID - ) { ?> + if ( isset( $contact['overall_status'] ) && $contact['overall_status']['key'] == 'assigned' && + isset( $contact['assigned_to'] ) && $contact['assigned_to']['id'] == $current_user->ID ) { ?>
    -

    - - +

    + +
    $value) { - if (strpos($field_key, 'quick_button') !== false) { - self::handle_quick_action_button_event($post_id, [$field_key => $value]); + foreach ( $fields as $field_key => $value ){ + if ( strpos( $field_key, 'quick_button' ) !== false ){ + self::handle_quick_action_button_event( $post_id, [ $field_key => $value ] ); } } - if (isset($fields['overall_status'], $fields['reason_paused']) && $fields['overall_status'] === 'paused') { + if ( isset( $fields['overall_status'], $fields['reason_paused'] ) && $fields['overall_status'] === 'paused' ){ $fields['requires_update'] = false; } - if (isset($fields['overall_status'], $fields['reason_closed']) && $fields['overall_status'] === 'closed') { + if ( isset( $fields['overall_status'], $fields['reason_closed'] ) && $fields['overall_status'] === 'closed' ){ $fields['requires_update'] = false; } //if a contact type is changed to access - if (isset($fields['type']) && $fields['type'] === 'access') { + if ( isset( $fields['type'] ) && $fields['type'] === 'access' ){ //set the status to active if there is no status - if (!isset($existing_post['overall_status']) && !isset($fields['overall_status'])) { + if ( !isset( $existing_post['overall_status'] ) && !isset( $fields['overall_status'] ) ){ $fields['overall_status'] = 'active'; } //assign the contact to the user - if (!isset($existing_post['assigned_to']) && !isset($fields['assigned_to']) && get_current_user_id()) { + if ( !isset( $existing_post['assigned_to'] ) && !isset( $fields['assigned_to'] ) && get_current_user_id() ){ $fields['assigned_to'] = get_current_user_id(); } } @@ -792,94 +752,90 @@ public function dt_post_update_fields($fields, $post_type, $post_id, $existing_p return $fields; } - public function dt_comment_created($post_type, $post_id, $created_comment_id, $comment_type) - { - if ($post_type === 'contacts') { - if ($comment_type === 'comment') { - self::check_requires_update($post_id); + public function dt_comment_created( $post_type, $post_id, $created_comment_id, $comment_type ){ + if ( $post_type === 'contacts' ){ + if ( $comment_type === 'comment' ){ + self::check_requires_update( $post_id ); } } } // Runs after post is created and fields are processed. - public function dt_post_created($post_type, $post_id, $initial_request_fields) - { - if ($post_type === 'contacts') { - $post = DT_Posts::get_post($post_type, $post_id, true, false); - if (!isset($post['type']['key']) || $post['type']['key'] !== 'access') { + public function dt_post_created( $post_type, $post_id, $initial_request_fields ){ + if ( $post_type === 'contacts' ){ + $post = DT_Posts::get_post( $post_type, $post_id, true, false ); + if ( !isset( $post['type']['key'] ) || $post['type']['key'] !== 'access' ){ return; } //check for duplicate along other access contacts - $this->check_for_duplicates($post_type, $post_id); + $this->check_for_duplicates( $post_type, $post_id ); } } // Add, remove or modify fields before the fields are processed on post create. - public function dt_post_create_fields($fields, $post_type) - { - if ($post_type !== 'contacts') { + public function dt_post_create_fields( $fields, $post_type ){ + if ( $post_type !== 'contacts' ){ return $fields; } - if (isset($fields['additional_meta']['created_from'])) { - $from_post = DT_Posts::get_post('contacts', $fields['additional_meta']['created_from'], true, false); - if (!is_wp_error($from_post) && isset($from_post['type']['key']) && $from_post['type']['key'] === 'access') { + if ( isset( $fields['additional_meta']['created_from'] ) ){ + $from_post = DT_Posts::get_post( 'contacts', $fields['additional_meta']['created_from'], true, false ); + if ( !is_wp_error( $from_post ) && isset( $from_post['type']['key'] ) && $from_post['type']['key'] === 'access' ){ $fields['type'] = 'access_placeholder'; } } - if (!isset($fields['type']) && isset($fields['sources'])) { - if (!empty($fields['sources'])) { + if ( !isset( $fields['type'] ) && isset( $fields['sources'] ) ){ + if ( !empty( $fields['sources'] ) ){ $fields['type'] = 'access'; } } //If a contact is created via site link or externally without a source, make sure the contact is accessible - if (!isset($fields['type']) && get_current_user_id() === 0) { + if ( !isset( $fields['type'] ) && get_current_user_id() === 0 ){ $fields['type'] = 'access'; } - if (!isset($fields['type']) || $fields['type'] !== 'access') { + if ( !isset( $fields['type'] ) || $fields['type'] !== 'access' ){ return $fields; } - if (!isset($fields['seeker_path'])) { + if ( !isset( $fields['seeker_path'] ) ){ $fields['seeker_path'] = 'none'; } - if (!isset($fields['assigned_to'])) { - if (get_current_user_id()) { - $fields['assigned_to'] = sprintf('user-%d', get_current_user_id()); + if ( !isset( $fields['assigned_to'] ) ){ + if ( get_current_user_id() ) { + $fields['assigned_to'] = sprintf( 'user-%d', get_current_user_id() ); } else { - $base_id = dt_get_base_user(true); - if (is_wp_error($base_id)) { // if default editor does not exist, get available administrator - $users = get_users(['role' => 'administrator']); - if (count($users) > 0) { - foreach ($users as $user) { + $base_id = dt_get_base_user( true ); + if ( is_wp_error( $base_id ) ) { // if default editor does not exist, get available administrator + $users = get_users( [ 'role' => 'administrator' ] ); + if ( count( $users ) > 0 ) { + foreach ( $users as $user ) { $base_id = $user->ID; } } } - if (!empty($base_id)) { - $fields['assigned_to'] = sprintf('user-%d', $base_id); + if ( !empty( $base_id ) ){ + $fields['assigned_to'] = sprintf( 'user-%d', $base_id ); } } } - if (!isset($fields['overall_status'])) { - if (get_current_user_id()) { + if ( !isset( $fields['overall_status'] ) ){ + if ( get_current_user_id() ){ $fields['overall_status'] = 'active'; } else { $fields['overall_status'] = 'new'; } } - if (!isset($fields['sources'])) { - $fields['sources'] = ['values' => [['value' => 'personal']]]; + if ( !isset( $fields['sources'] ) ) { + $fields['sources'] = [ 'values' => [ [ 'value' => 'personal' ] ] ]; } return $fields; } //Runs after fields are processed on update - public function dt_post_updated($post_type, $post_id, $initial_request_fields, $post_fields_before_update, $contact) - { - if ($post_type === 'contacts') { - if (!isset($contact['type']['key']) || $contact['type']['key'] !== 'access') { + public function dt_post_updated( $post_type, $post_id, $initial_request_fields, $post_fields_before_update, $contact ){ + if ( $post_type === 'contacts' ){ + if ( !isset( $contact['type']['key'] ) || $contact['type']['key'] !== 'access' ){ return; } - self::check_seeker_path($post_id, $contact, $post_fields_before_update); + self::check_seeker_path( $post_id, $contact, $post_fields_before_update ); } } @@ -892,86 +848,78 @@ public function dt_post_updated($post_type, $post_id, $initial_request_fields, $ * @param $contact * @param $previous_values */ - public function check_seeker_path($contact_id, $contact, $previous_values) - { - if (isset($contact['seeker_path']['key']) && $contact['seeker_path']['key'] != 'none') { + public function check_seeker_path( $contact_id, $contact, $previous_values ){ + if ( isset( $contact['seeker_path']['key'] ) && $contact['seeker_path']['key'] != 'none' ){ $current_key = $contact['seeker_path']['key']; - $prev_key = isset($previous_values['seeker_path']['key']) ? $previous_values['seeker_path']['key'] : 'none'; - $field_settings = DT_Posts::get_post_field_settings('contacts'); + $prev_key = isset( $previous_values['seeker_path']['key'] ) ? $previous_values['seeker_path']['key'] : 'none'; + $field_settings = DT_Posts::get_post_field_settings( 'contacts' ); $seeker_path_options = $field_settings['seeker_path']['default']; - $option_keys = array_keys($seeker_path_options); - $current_index = array_search($current_key, $option_keys); - $prev_option_key = $option_keys[$current_index - 1]; + $option_keys = array_keys( $seeker_path_options ); + $current_index = array_search( $current_key, $option_keys ); + $prev_option_key = $option_keys[ $current_index - 1 ]; - if ($prev_option_key != $prev_key && $current_index > array_search($prev_key, $option_keys)) { + if ( $prev_option_key != $prev_key && $current_index > array_search( $prev_key, $option_keys ) ){ global $wpdb; - $seeker_path_activity = $wpdb->get_results($wpdb->prepare(" + $seeker_path_activity = $wpdb->get_results( $wpdb->prepare( " SELECT meta_value, hist_time, meta_id FROM $wpdb->dt_activity_log WHERE object_id = %s AND meta_key = 'seeker_path' - ", $contact_id), ARRAY_A); + ", $contact_id), ARRAY_A ); $existing_keys = []; $most_recent = 0; $meta_id = 0; - foreach ($seeker_path_activity as $activity) { + foreach ( $seeker_path_activity as $activity ){ $existing_keys[] = $activity['meta_value']; - if ($activity['hist_time'] > $most_recent) { + if ( $activity['hist_time'] > $most_recent ){ $most_recent = $activity['hist_time']; } $meta_id = $activity['meta_id']; } $activity_to_create = []; - for ($i = $current_index; $i > 0; $i--) { - if (!in_array($option_keys[$i], $existing_keys)) { + for ( $i = $current_index; $i > 0; $i-- ){ + if ( !in_array( $option_keys[$i], $existing_keys ) ){ $activity_to_create[] = $option_keys[$i]; } } - foreach ($activity_to_create as $missing_key) { - $wpdb->query($wpdb->prepare( - " + foreach ( $activity_to_create as $missing_key ){ + $wpdb->query( $wpdb->prepare(" INSERT INTO $wpdb->dt_activity_log ( action, object_type, object_subtype, object_id, user_id, hist_time, meta_id, meta_key, meta_value, field_type ) VALUES ( 'field_update', 'contacts', 'seeker_path', %s, %d, %d, %d, 'seeker_path', %s, 'key_select' )", - $contact_id, - get_current_user_id(), - $most_recent - 1, - $meta_id, - $missing_key - ) - ); + $contact_id, get_current_user_id(), $most_recent - 1, $meta_id, $missing_key + )); } } } } //list page filters function - public static function dt_user_list_filters($filters, $post_type) - { - if ($post_type === 'contacts') { - $performance_mode = get_option('dt_performance_mode', false); - $fields = DT_Posts::get_post_field_settings($post_type); + public static function dt_user_list_filters( $filters, $post_type ){ + if ( $post_type === 'contacts' ){ + $performance_mode = get_option( 'dt_performance_mode', false ); + $fields = DT_Posts::get_post_field_settings( $post_type ); /** * Setup my contacts filters */ - if (!$performance_mode) { + if ( !$performance_mode ){ $counts = self::get_my_contacts_status_seeker_path(); $active_counts = []; $update_needed = 0; $status_counts = []; $total_my = 0; - foreach ($counts as $count) { + foreach ( $counts as $count ){ $total_my += $count['count']; - dt_increment($status_counts[$count['overall_status']], $count['count']); - if ($count['overall_status'] === 'active') { - if (isset($count['update_needed'])) { + dt_increment( $status_counts[$count['overall_status']], $count['count'] ); + if ( $count['overall_status'] === 'active' ){ + if ( isset( $count['update_needed'] ) ) { $update_needed += (int) $count['update_needed']; } - dt_increment($active_counts[$count['seeker_path']], $count['count']); + dt_increment( $active_counts[$count['seeker_path']], $count['count'] ); } } - if (!isset($status_counts['closed'])) { + if ( !isset( $status_counts['closed'] ) ) { $status_counts['closed'] = ''; } } @@ -980,88 +928,88 @@ public static function dt_user_list_filters($filters, $post_type) $filters['filters'][] = [ 'ID' => 'my_all', 'tab' => 'default', - 'name' => __('My Follow-Up', 'disciple_tools'), + 'name' => __( 'My Follow-Up', 'disciple_tools' ), 'query' => [ - 'assigned_to' => ['me'], - 'subassigned' => ['me'], - 'combine' => ['subassigned'], - 'overall_status' => ['-closed'], - 'type' => ['access'], + 'assigned_to' => [ 'me' ], + 'subassigned' => [ 'me' ], + 'combine' => [ 'subassigned' ], + 'overall_status' => [ '-closed' ], + 'type' => [ 'access' ], 'sort' => 'overall_status', ], 'labels' => [ - ['name' => __('My Follow-Up', 'disciple_tools'), 'field' => 'combine', 'id' => 'subassigned'], - ['name' => __('Assigned to me', 'disciple_tools'), 'field' => 'assigned_to', 'id' => 'me'], - ['name' => __('Sub-assigned to me', 'disciple_tools'), 'field' => 'subassigned', 'id' => 'me'], + [ 'name' => __( 'My Follow-Up', 'disciple_tools' ), 'field' => 'combine', 'id' => 'subassigned' ], + [ 'name' => __( 'Assigned to me', 'disciple_tools' ), 'field' => 'assigned_to', 'id' => 'me' ], + [ 'name' => __( 'Sub-assigned to me', 'disciple_tools' ), 'field' => 'subassigned', 'id' => 'me' ], ], 'count' => $total_my ?? '', ]; - foreach ($fields['overall_status']['default'] as $status_key => $status_value) { - if (isset($status_counts[$status_key]) || $performance_mode) { + foreach ( $fields['overall_status']['default'] as $status_key => $status_value ) { + if ( isset( $status_counts[$status_key] ) || $performance_mode ) { $filters['filters'][] = [ 'ID' => 'my_' . $status_key, 'tab' => 'default', 'name' => $status_value['label'], 'query' => [ - 'assigned_to' => ['me'], - 'subassigned' => ['me'], - 'combine' => ['subassigned'], - 'type' => ['access'], - 'overall_status' => [$status_key], + 'assigned_to' => [ 'me' ], + 'subassigned' => [ 'me' ], + 'combine' => [ 'subassigned' ], + 'type' => [ 'access' ], + 'overall_status' => [ $status_key ], 'sort' => 'seeker_path' ], 'labels' => [ - ['name' => $status_value['label']], - ['name' => __('Assigned to me', 'disciple_tools'), 'field' => 'assigned_to', 'id' => 'me'], - ['name' => __('Sub-assigned to me', 'disciple_tools'), 'field' => 'subassigned', 'id' => 'me'], + [ 'name' => $status_value['label'] ], + [ 'name' => __( 'Assigned to me', 'disciple_tools' ), 'field' => 'assigned_to', 'id' => 'me' ], + [ 'name' => __( 'Sub-assigned to me', 'disciple_tools' ), 'field' => 'subassigned', 'id' => 'me' ], ], 'count' => $status_counts[$status_key] ?? '', 'subfilter' => 1 ]; - if ($status_key === 'active') { - if (($update_needed ?? 0) > 0) { + if ( $status_key === 'active' ){ + if ( ( $update_needed ?? 0 ) > 0 ){ $filters['filters'][] = [ 'ID' => 'my_update_needed', 'tab' => 'default', 'name' => $fields['requires_update']['name'], 'query' => [ - 'assigned_to' => ['me'], - 'subassigned' => ['me'], - 'combine' => ['subassigned'], - 'overall_status' => ['active'], - 'requires_update' => [true], - 'type' => ['access'], + 'assigned_to' => [ 'me' ], + 'subassigned' => [ 'me' ], + 'combine' => [ 'subassigned' ], + 'overall_status' => [ 'active' ], + 'requires_update' => [ true ], + 'type' => [ 'access' ], 'sort' => 'seeker_path' ], 'labels' => [ - ['name' => $fields['requires_update']['name']], - ['name' => __('Assigned to me', 'disciple_tools'), 'field' => 'assigned_to', 'id' => 'me'], - ['name' => __('Sub-assigned to me', 'disciple_tools'), 'field' => 'subassigned', 'id' => 'me'], + [ 'name' => $fields['requires_update']['name'] ], + [ 'name' => __( 'Assigned to me', 'disciple_tools' ), 'field' => 'assigned_to', 'id' => 'me' ], + [ 'name' => __( 'Sub-assigned to me', 'disciple_tools' ), 'field' => 'subassigned', 'id' => 'me' ], ], 'count' => $update_needed ?? '', 'subfilter' => 2 ]; } - if (isset($fields['seeker_path']['default']) && is_array($fields['seeker_path']['default'])) { - foreach ($fields['seeker_path']['default'] as $seeker_path_key => $seeker_path_value) { - if (isset($active_counts[$seeker_path_key]) || $performance_mode) { + if ( isset( $fields['seeker_path']['default'] ) && is_array( $fields['seeker_path']['default'] ) ){ + foreach ( $fields['seeker_path']['default'] as $seeker_path_key => $seeker_path_value ){ + if ( isset( $active_counts[$seeker_path_key] ) || $performance_mode ){ $filters['filters'][] = [ 'ID' => 'my_' . $seeker_path_key, 'tab' => 'default', 'name' => $seeker_path_value['label'], 'query' => [ - 'assigned_to' => ['me'], - 'subassigned' => ['me'], - 'combine' => ['subassigned'], - 'overall_status' => ['active'], - 'seeker_path' => [$seeker_path_key], - 'type' => ['access'], + 'assigned_to' => [ 'me' ], + 'subassigned' => [ 'me' ], + 'combine' => [ 'subassigned' ], + 'overall_status' => [ 'active' ], + 'seeker_path' => [ $seeker_path_key ], + 'type' => [ 'access' ], 'sort' => 'name' ], 'labels' => [ - ['name' => $seeker_path_value['label']], - ['name' => __('Assigned to me', 'disciple_tools'), 'field' => 'assigned_to', 'id' => 'me'], - ['name' => __('Sub-assigned to me', 'disciple_tools'), 'field' => 'subassigned', 'id' => 'me'], + [ 'name' => $seeker_path_value['label'] ], + [ 'name' => __( 'Assigned to me', 'disciple_tools' ), 'field' => 'assigned_to', 'id' => 'me' ], + [ 'name' => __( 'Sub-assigned to me', 'disciple_tools' ), 'field' => 'subassigned', 'id' => 'me' ], ], 'count' => $active_counts[$seeker_path_key] ?? '', 'subfilter' => 2 @@ -1076,31 +1024,31 @@ public static function dt_user_list_filters($filters, $post_type) /** * Setup dispatcher filters */ - if (current_user_can('dt_all_access_contacts') || current_user_can('access_specific_sources')) { - if (!$performance_mode) { + if ( current_user_can( 'dt_all_access_contacts' ) || current_user_can( 'access_specific_sources' ) ) { + if ( !$performance_mode ){ $counts = self::get_all_contacts_status_seeker_path(); $all_active_counts = []; $all_update_needed = 0; $all_status_counts = []; $total_all = 0; - foreach ($counts as $count) { + foreach ( $counts as $count ){ $total_all += $count['count']; - dt_increment($all_status_counts[$count['overall_status']], $count['count']); - if ($count['overall_status'] === 'active') { - if (isset($count['update_needed'])) { + dt_increment( $all_status_counts[$count['overall_status']], $count['count'] ); + if ( $count['overall_status'] === 'active' ){ + if ( isset( $count['update_needed'] ) ) { $all_update_needed += (int) $count['update_needed']; } - dt_increment($all_active_counts[$count['seeker_path']], $count['count']); + dt_increment( $all_active_counts[$count['seeker_path']], $count['count'] ); } } - if (!isset($all_status_counts['closed'])) { + if ( !isset( $all_status_counts['closed'] ) ) { $all_status_counts['closed'] = ''; } } $filters['tabs'][] = [ 'key' => 'all_dispatch', - // "label" => __( "Follow-Up", 'disciple_tools' ), - 'label' => sprintf(_x('Follow-Up %s', 'All records', 'disciple_tools'), DT_Posts::get_post_settings($post_type)['label_plural']), +// "label" => __( "Follow-Up", 'disciple_tools' ), + 'label' => sprintf( _x( 'Follow-Up %s', 'All records', 'disciple_tools' ), DT_Posts::get_post_settings( $post_type )['label_plural'] ), 'count' => $total_all ?? '', 'order' => 10 ]; @@ -1108,55 +1056,55 @@ public static function dt_user_list_filters($filters, $post_type) $filters['filters'][] = [ 'ID' => 'all_dispatch', 'tab' => 'all_dispatch', - 'name' => __('All Follow-Up', 'disciple_tools'), + 'name' => __( 'All Follow-Up', 'disciple_tools' ), 'query' => [ - 'overall_status' => ['-closed'], - 'type' => ['access'], + 'overall_status' => [ '-closed' ], + 'type' => [ 'access' ], 'sort' => 'overall_status' ], 'count' => $total_all ?? '', ]; - foreach ($fields['overall_status']['default'] as $status_key => $status_value) { - if (isset($all_status_counts[$status_key]) || $performance_mode) { + foreach ( $fields['overall_status']['default'] as $status_key => $status_value ) { + if ( isset( $all_status_counts[$status_key] ) || $performance_mode ) { $filters['filters'][] = [ 'ID' => 'all_' . $status_key, 'tab' => 'all_dispatch', 'name' => $status_value['label'], 'query' => [ - 'overall_status' => [$status_key], - 'type' => ['access'], + 'overall_status' => [ $status_key ], + 'type' => [ 'access' ], 'sort' => 'seeker_path' ], 'count' => $all_status_counts[$status_key] ?? '' ]; - if ($status_key === 'active') { - if (($all_update_needed ?? 0) > 0 || $performance_mode) { + if ( $status_key === 'active' ){ + if ( ( $all_update_needed ?? 0 ) > 0 || $performance_mode ){ $filters['filters'][] = [ 'ID' => 'all_update_needed', 'tab' => 'all_dispatch', 'name' => $fields['requires_update']['name'], 'query' => [ - 'overall_status' => ['active'], - 'requires_update' => [true], - 'type' => ['access'], + 'overall_status' => [ 'active' ], + 'requires_update' => [ true ], + 'type' => [ 'access' ], 'sort' => 'seeker_path' ], 'count' => $all_update_needed ?? '', 'subfilter' => true ]; } - if (isset($fields['seeker_path']['default']) && is_array($fields['seeker_path']['default'])) { - foreach ($fields['seeker_path']['default'] as $seeker_path_key => $seeker_path_value) { - if (isset($all_active_counts[$seeker_path_key]) || $performance_mode) { + if ( isset( $fields['seeker_path']['default'] ) && is_array( $fields['seeker_path']['default'] ) ) { + foreach ( $fields['seeker_path']['default'] as $seeker_path_key => $seeker_path_value ) { + if ( isset( $all_active_counts[$seeker_path_key] ) || $performance_mode ) { $filters['filters'][] = [ 'ID' => 'all_' . $seeker_path_key, 'tab' => 'all_dispatch', 'name' => $seeker_path_value['label'], 'query' => [ - 'overall_status' => ['active'], - 'seeker_path' => [$seeker_path_key], - 'type' => ['access'], + 'overall_status' => [ 'active' ], + 'seeker_path' => [ $seeker_path_key ], + 'type' => [ 'access' ], 'sort' => 'name' ], 'count' => $all_active_counts[$seeker_path_key] ?? '', @@ -1169,15 +1117,14 @@ public static function dt_user_list_filters($filters, $post_type) } } } - $filters['filters'] = self::add_default_custom_list_filters($filters['filters']); + $filters['filters'] = self::add_default_custom_list_filters( $filters['filters'] ); } return $filters; } //list page filters function - private static function add_default_custom_list_filters($filters) - { - if (empty($filters)) { + private static function add_default_custom_list_filters( $filters ){ + if ( empty( $filters ) ){ $filters = []; } $default_filters = [ @@ -1188,7 +1135,7 @@ private static function add_default_custom_list_filters($filters) 'tab' => 'custom', 'name' => 'Subassigned to me', 'query' => [ - 'subassigned' => ['me'], + 'subassigned' => [ 'me' ], 'sort' => 'overall_status', ], 'labels' => [ @@ -1200,39 +1147,38 @@ private static function add_default_custom_list_filters($filters) ], ], ]; - $contact_filter_ids = array_map(function ($a) { + $contact_filter_ids = array_map( function ( $a ){ return $a['ID']; - }, $filters); - foreach ($default_filters as $filter) { - if (!in_array($filter['ID'], $contact_filter_ids)) { - array_unshift($filters, $filter); + }, $filters ); + foreach ( $default_filters as $filter ) { + if ( !in_array( $filter['ID'], $contact_filter_ids ) ){ + array_unshift( $filters, $filter ); } } //translation for default fields - foreach ($filters as $index => $filter) { - if ($filter['name'] === 'Subassigned to me') { - $filters[$index]['name'] = __('Subassigned only', 'disciple_tools'); - $filters[$index]['labels'][0]['name'] = __('Subassigned only', 'disciple_tools'); + foreach ( $filters as $index => $filter ) { + if ( $filter['name'] === 'Subassigned to me' ) { + $filters[$index]['name'] = __( 'Subassigned only', 'disciple_tools' ); + $filters[$index]['labels'][0]['name'] = __( 'Subassigned only', 'disciple_tools' ); } } return $filters; } //list page filters function - private static function get_all_contacts_status_seeker_path() - { + private static function get_all_contacts_status_seeker_path(){ global $wpdb; $results = []; $can_view_all = false; - if (current_user_can('access_specific_sources')) { - $sources = get_user_option('allowed_sources', get_current_user_id()) ?: []; - if (empty($sources) || in_array('all', $sources)) { + if ( current_user_can( 'access_specific_sources' ) ) { + $sources = get_user_option( 'allowed_sources', get_current_user_id() ) ?: []; + if ( empty( $sources ) || in_array( 'all', $sources ) ) { $can_view_all = true; } } - if (current_user_can('dt_all_access_contacts') || $can_view_all) { + if ( current_user_can( 'dt_all_access_contacts' ) || $can_view_all ) { $results = $wpdb->get_results(" SELECT status.meta_value as overall_status, pm.meta_value as seeker_path, count(pm.post_id) as count, count(un.post_id) as update_needed FROM $wpdb->postmeta pm @@ -1243,11 +1189,11 @@ private static function get_all_contacts_status_seeker_path() WHERE pm.meta_key = 'seeker_path' GROUP BY status.meta_value, pm.meta_value ", ARRAY_A); - } else if (current_user_can('access_specific_sources')) { - $sources = get_user_option('allowed_sources', get_current_user_id()) ?: []; - $sources_sql = dt_array_to_sql($sources); + } else if ( current_user_can( 'access_specific_sources' ) ) { + $sources = get_user_option( 'allowed_sources', get_current_user_id() ) ?: []; + $sources_sql = dt_array_to_sql( $sources ); // phpcs:disable - $results = $wpdb->get_results($wpdb->prepare(" + $results = $wpdb->get_results( $wpdb->prepare( " SELECT status.meta_value as overall_status, pm.meta_value as seeker_path, count(pm.post_id) as count, count(un.post_id) as update_needed FROM $wpdb->postmeta pm INNER JOIN $wpdb->postmeta status ON( status.post_id = pm.post_id AND status.meta_key = 'overall_status' AND status.meta_value != 'closed' ) @@ -1260,18 +1206,17 @@ private static function get_all_contacts_status_seeker_path() OR pm.post_id IN ( SELECT post_id FROM $wpdb->dt_share AS shares where shares.user_id = %s ) ) GROUP BY status.meta_value, pm.meta_value - ", esc_sql(get_current_user_id())), ARRAY_A); + ", esc_sql( get_current_user_id() ) ) , ARRAY_A ); // phpcs:enable } return $results; } //list page filters function - private static function get_my_contacts_status_seeker_path() - { + private static function get_my_contacts_status_seeker_path(){ global $wpdb; - $user_post = Disciple_Tools_Users::get_contact_for_user(get_current_user_id()) ?? 0; - $results = $wpdb->get_results($wpdb->prepare(" + $user_post = Disciple_Tools_Users::get_contact_for_user( get_current_user_id() ) ?? 0; + $results = $wpdb->get_results( $wpdb->prepare( " SELECT status.meta_value as overall_status, pm.meta_value as seeker_path, count(pm.post_id) as count, count(un.post_id) as update_needed FROM $wpdb->postmeta pm INNER JOIN $wpdb->postmeta status ON( status.post_id = pm.post_id AND status.meta_key = 'overall_status' AND status.meta_value != 'closed') @@ -1284,25 +1229,24 @@ private static function get_my_contacts_status_seeker_path() OR pm.post_id IN ( SELECT p2p_to from $wpdb->p2p WHERE p2p_from = %s AND p2p_type = 'contacts_to_subassigned' ) ) GROUP BY status.meta_value, pm.meta_value - ", get_current_user_id(), $user_post), ARRAY_A); + ", get_current_user_id(), $user_post ), ARRAY_A); return $results; } - public static function dt_filter_access_permissions($permissions, $post_type) - { - if ($post_type === 'contacts') { - if (DT_Posts::can_view_all($post_type)) { - $permissions['type'] = ['access', 'user', 'access_placeholder']; - } else if (current_user_can('dt_all_access_contacts')) { + public static function dt_filter_access_permissions( $permissions, $post_type ){ + if ( $post_type === 'contacts' ){ + if ( DT_Posts::can_view_all( $post_type ) ){ + $permissions['type'] = [ 'access', 'user', 'access_placeholder' ]; + } else if ( current_user_can( 'dt_all_access_contacts' ) ){ //give user permission to all contacts af type 'access' - $permissions[] = ['type' => ['access', 'user', 'access_placeholder']]; - } else if (current_user_can('access_specific_sources')) { + $permissions[] = [ 'type' => [ 'access', 'user', 'access_placeholder' ] ]; + } else if ( current_user_can( 'access_specific_sources' ) ){ //give user permission to all 'access' that also have a source the user can view. - $allowed_sources = get_user_option('allowed_sources', get_current_user_id()) ?: []; - if (empty($allowed_sources) || in_array('all', $allowed_sources, true)) { - $permissions['type'] = ['access', 'access_placeholder']; - } elseif (!in_array('restrict_all_sources', $allowed_sources)) { - $permissions[] = ['type' => ['access'], 'sources' => $allowed_sources]; + $allowed_sources = get_user_option( 'allowed_sources', get_current_user_id() ) ?: []; + if ( empty( $allowed_sources ) || in_array( 'all', $allowed_sources, true ) ){ + $permissions['type'] = [ 'access', 'access_placeholder' ]; + } elseif ( !in_array( 'restrict_all_sources', $allowed_sources ) ){ + $permissions[] = [ 'type' => [ 'access' ], 'sources' => $allowed_sources]; } } } @@ -1310,26 +1254,25 @@ public static function dt_filter_access_permissions($permissions, $post_type) } // filter for access to a specific record - public function can_view_permission_filter($has_permission, $post_id, $post_type) - { - if ($post_type === 'contacts') { - if (current_user_can('dt_all_access_contacts')) { - $contact_type = get_post_meta($post_id, 'type', true); - if ($contact_type === 'access' || $contact_type === 'user' || $contact_type === 'access_placeholder') { + public function can_view_permission_filter( $has_permission, $post_id, $post_type ){ + if ( $post_type === 'contacts' ){ + if ( current_user_can( 'dt_all_access_contacts' ) ){ + $contact_type = get_post_meta( $post_id, 'type', true ); + if ( $contact_type === 'access' || $contact_type === 'user' || $contact_type === 'access_placeholder' ){ return true; } } //check if the user has access to all posts of a specific source - if (current_user_can('access_specific_sources')) { - $contact_type = get_post_meta($post_id, 'type', true); - if ($contact_type === 'access' || $contact_type === 'access_placeholder') { - $sources = get_user_option('allowed_sources', get_current_user_id()) ?: []; - if (empty($sources) || in_array('all', $sources)) { + if ( current_user_can( 'access_specific_sources' ) ){ + $contact_type = get_post_meta( $post_id, 'type', true ); + if ( $contact_type === 'access' || $contact_type === 'access_placeholder' ){ + $sources = get_user_option( 'allowed_sources', get_current_user_id() ) ?: []; + if ( empty( $sources ) || in_array( 'all', $sources ) ) { return true; } - $post_sources = get_post_meta($post_id, 'sources'); - foreach ($post_sources as $s) { - if (in_array($s, $sources)) { + $post_sources = get_post_meta( $post_id, 'sources' ); + foreach ( $post_sources as $s ){ + if ( in_array( $s, $sources ) ){ return true; } } @@ -1338,25 +1281,24 @@ public function can_view_permission_filter($has_permission, $post_id, $post_type } return $has_permission; } - public function can_update_permission_filter($has_permission, $post_id, $post_type) - { - if (current_user_can('dt_all_access_contacts')) { - $contact_type = get_post_meta($post_id, 'type', true); - if ($contact_type === 'access' || $contact_type === 'user' || $contact_type === 'access_placeholder') { + public function can_update_permission_filter( $has_permission, $post_id, $post_type ){ + if ( current_user_can( 'dt_all_access_contacts' ) ){ + $contact_type = get_post_meta( $post_id, 'type', true ); + if ( $contact_type === 'access' || $contact_type === 'user' || $contact_type === 'access_placeholder' ){ return true; } } //check if the user has access to all posts of a specific source - if (current_user_can('access_specific_sources')) { - $contact_type = get_post_meta($post_id, 'type', true); - if ($contact_type === 'access' || $contact_type === 'access_placeholder') { - $sources = get_user_option('allowed_sources', get_current_user_id()) ?: []; - if (empty($sources) || in_array('all', $sources)) { + if ( current_user_can( 'access_specific_sources' ) ){ + $contact_type = get_post_meta( $post_id, 'type', true ); + if ( $contact_type === 'access' || $contact_type === 'access_placeholder' ){ + $sources = get_user_option( 'allowed_sources', get_current_user_id() ) ?: []; + if ( empty( $sources ) || in_array( 'all', $sources ) ){ return true; } - $post_sources = get_post_meta($post_id, 'sources'); - foreach ($post_sources as $s) { - if (in_array($s, $sources)) { + $post_sources = get_post_meta( $post_id, 'sources' ); + foreach ( $post_sources as $s ){ + if ( in_array( $s, $sources ) ){ return true; } } @@ -1365,86 +1307,82 @@ public function can_update_permission_filter($has_permission, $post_id, $post_ty return $has_permission; } - public function scripts() - { - if (is_singular('contacts') && get_the_ID() && DT_Posts::can_view($this->post_type, get_the_ID())) { - wp_enqueue_script('dt_contacts_access', get_template_directory_uri() . '/dt-contacts/contacts_access.js', [ + public function scripts(){ + if ( is_singular( 'contacts' ) && get_the_ID() && DT_Posts::can_view( $this->post_type, get_the_ID() ) ){ + wp_enqueue_script( 'dt_contacts_access', get_template_directory_uri() . '/dt-contacts/contacts_access.js', [ 'jquery', - ], filemtime(get_theme_file_path() . '/dt-contacts/contacts_access.js'), true); - wp_localize_script('dt_contacts_access', 'dt_contacts_access', [ + ], filemtime( get_theme_file_path() . '/dt-contacts/contacts_access.js' ), true ); + wp_localize_script( 'dt_contacts_access', 'dt_contacts_access', [ 'translations' => [ - 'all' => __('All', 'disciple_tools'), - 'ready' => __('Ready', 'disciple_tools'), - 'recent' => __('Recent', 'disciple_tools'), - 'location' => __('Location', 'disciple_tools'), - 'assign' => __('Assign', 'disciple_tools'), - 'language' => __('Language', 'disciple_tools'), - 'gender' => __('Gender', 'disciple_tools'), + 'all' => __( 'All', 'disciple_tools' ), + 'ready' => __( 'Ready', 'disciple_tools' ), + 'recent' => __( 'Recent', 'disciple_tools' ), + 'location' => __( 'Location', 'disciple_tools' ), + 'assign' => __( 'Assign', 'disciple_tools' ), + 'language' => __( 'Language', 'disciple_tools' ), + 'gender' => __( 'Gender', 'disciple_tools' ), ], - ]); + ] ); } } - private static function handle_quick_action_button_event(int $contact_id, array $field, bool $check_permissions = true) - { + private static function handle_quick_action_button_event( int $contact_id, array $field, bool $check_permissions = true ) { $update = []; - $key = key($field); + $key = key( $field ); - if ($key == 'quick_button_no_answer') { + if ( $key == 'quick_button_no_answer' ) { $update['seeker_path'] = 'attempted'; - } elseif ($key == 'quick_button_phone_off') { + } elseif ( $key == 'quick_button_phone_off' ) { $update['seeker_path'] = 'attempted'; - } elseif ($key == 'quick_button_contact_established') { + } elseif ( $key == 'quick_button_contact_established' ) { $update['seeker_path'] = 'established'; - } elseif ($key == 'quick_button_meeting_scheduled') { + } elseif ( $key == 'quick_button_meeting_scheduled' ) { $update['seeker_path'] = 'scheduled'; - } elseif ($key == 'quick_button_meeting_complete') { + } elseif ( $key == 'quick_button_meeting_complete' ) { $update['seeker_path'] = 'met'; } - if (isset($update['seeker_path'])) { - self::check_requires_update($contact_id); - return self::update_seeker_path($contact_id, $update['seeker_path'], $check_permissions); + if ( isset( $update['seeker_path'] ) ) { + self::check_requires_update( $contact_id ); + return self::update_seeker_path( $contact_id, $update['seeker_path'], $check_permissions ); } else { return $contact_id; } } - public static function update_quick_action_buttons($contact_id, $seeker_path) - { - if ($seeker_path === 'established') { - $quick_button = get_post_meta($contact_id, 'quick_button_contact_established', true); - if (empty($quick_button) || $quick_button == '0') { - update_post_meta($contact_id, 'quick_button_contact_established', '1'); + public static function update_quick_action_buttons( $contact_id, $seeker_path ){ + if ( $seeker_path === 'established' ){ + $quick_button = get_post_meta( $contact_id, 'quick_button_contact_established', true ); + if ( empty( $quick_button ) || $quick_button == '0' ){ + update_post_meta( $contact_id, 'quick_button_contact_established', '1' ); } } - if ($seeker_path === 'scheduled') { - $quick_button = get_post_meta($contact_id, 'quick_button_meeting_scheduled', true); - if (empty($quick_button) || $quick_button == '0') { - update_post_meta($contact_id, 'quick_button_meeting_scheduled', '1'); + if ( $seeker_path === 'scheduled' ){ + $quick_button = get_post_meta( $contact_id, 'quick_button_meeting_scheduled', true ); + if ( empty( $quick_button ) || $quick_button == '0' ){ + update_post_meta( $contact_id, 'quick_button_meeting_scheduled', '1' ); } } - if ($seeker_path === 'met') { - $quick_button = get_post_meta($contact_id, 'quick_button_meeting_complete', true); - if (empty($quick_button) || $quick_button == '0') { - update_post_meta($contact_id, 'quick_button_meeting_complete', '1'); + if ( $seeker_path === 'met' ){ + $quick_button = get_post_meta( $contact_id, 'quick_button_meeting_complete', true ); + if ( empty( $quick_button ) || $quick_button == '0' ){ + update_post_meta( $contact_id, 'quick_button_meeting_complete', '1' ); } } - self::check_requires_update($contact_id); + self::check_requires_update( $contact_id ); } - private static function update_seeker_path(int $contact_id, string $path_option, $check_permissions = true) - { - $contact_fields = DT_Posts::get_post_field_settings('contacts'); + private static function update_seeker_path( int $contact_id, string $path_option, $check_permissions = true ) { + $contact_fields = DT_Posts::get_post_field_settings( 'contacts' ); $seeker_path_options = $contact_fields['seeker_path']['default']; - $option_keys = array_keys($seeker_path_options); - $current_seeker_path = get_post_meta($contact_id, 'seeker_path', true); - $current_index = array_search($current_seeker_path, $option_keys); - $new_index = array_search($path_option, $option_keys); - if ($new_index > $current_index) { + $option_keys = array_keys( $seeker_path_options ); + $current_seeker_path = get_post_meta( $contact_id, 'seeker_path', true ); + $current_index = array_search( $current_seeker_path, $option_keys ); + $new_index = array_search( $path_option, $option_keys ); + if ( $new_index > $current_index ) { $current_index = $new_index; - $update = DT_Posts::update_post('contacts', $contact_id, ['seeker_path' => $path_option], $check_permissions); - if (is_wp_error($update)) { + $update = DT_Posts::update_post( 'contacts', $contact_id, [ 'seeker_path' => $path_option ], $check_permissions ); + if ( is_wp_error( $update ) ) { return $update; } $current_seeker_path = $path_option; @@ -1452,71 +1390,69 @@ private static function update_seeker_path(int $contact_id, string $path_option, return [ 'currentKey' => $current_seeker_path, - 'current' => $seeker_path_options[$option_keys[$current_index]], - 'next' => isset($option_keys[$current_index + 1]) ? $seeker_path_options[$option_keys[$current_index + 1]] : '', + 'current' => $seeker_path_options[ $option_keys[ $current_index ] ], + 'next' => isset( $option_keys[ $current_index + 1 ] ) ? $seeker_path_options[ $option_keys[ $current_index + 1 ] ] : '', ]; } //check to see if the contact is marked as needing an update //if yes: mark as updated - private static function check_requires_update($contact_id) - { - if (get_current_user_id()) { - $requires_update = get_post_meta($contact_id, 'requires_update', true); - if ($requires_update == 'yes' || $requires_update == true || $requires_update == '1') { + private static function check_requires_update( $contact_id ){ + if ( get_current_user_id() ){ + $requires_update = get_post_meta( $contact_id, 'requires_update', true ); + if ( $requires_update == 'yes' || $requires_update == true || $requires_update == '1' ){ //don't remove update needed if the user is a dispatcher (and not assigned to the contacts.) - if (current_user_can('dt_all_access_contacts')) { - if (dt_get_user_id_from_assigned_to(get_post_meta($contact_id, 'assigned_to', true)) === get_current_user_id()) { - update_post_meta($contact_id, 'requires_update', false); + if ( current_user_can( 'dt_all_access_contacts' ) ){ + if ( dt_get_user_id_from_assigned_to( get_post_meta( $contact_id, 'assigned_to', true ) ) === get_current_user_id() ){ + update_post_meta( $contact_id, 'requires_update', false ); } } else { - update_post_meta($contact_id, 'requires_update', false); + update_post_meta( $contact_id, 'requires_update', false ); } } } } - public static function accept_contact(WP_REST_Request $request) - { + public static function accept_contact( WP_REST_Request $request ){ $params = $request->get_params(); $body = $request->get_json_params() ?? $request->get_body_params(); - if (!isset($params['id'])) { - return new WP_Error('accept_contact', 'Missing a valid contact id', ['status' => 400]); + if ( !isset( $params['id'] ) ) { + return new WP_Error( 'accept_contact', 'Missing a valid contact id', [ 'status' => 400 ] ); } else { $contact_id = $params['id']; $accepted = $body['accept']; - if (!DT_Posts::can_update('contacts', $contact_id)) { - return new WP_Error(__FUNCTION__, 'You do not have permission for this', ['status' => 403]); + if ( !DT_Posts::can_update( 'contacts', $contact_id ) ) { + return new WP_Error( __FUNCTION__, 'You do not have permission for this', [ 'status' => 403 ] ); } - if ($accepted) { + if ( $accepted ) { $update = [ 'overall_status' => 'active', 'accepted' => true ]; dt_activity_insert( [ - 'action' => 'assignment_accepted', - 'object_type' => get_post_type($contact_id), + 'action' => 'assignment_accepted', + 'object_type' => get_post_type( $contact_id ), 'object_subtype' => '', - 'object_name' => get_the_title($contact_id), - 'object_id' => $contact_id, - 'meta_id' => '', // id of the comment - 'meta_key' => '', - 'meta_value' => '', - 'meta_parent' => '', - 'object_note' => '', + 'object_name' => get_the_title( $contact_id ), + 'object_id' => $contact_id, + 'meta_id' => '', // id of the comment + 'meta_key' => '', + 'meta_value' => '', + 'meta_parent' => '', + 'object_note' => '', ] ); - return DT_Posts::update_post('contacts', $contact_id, $update, true); + return DT_Posts::update_post( 'contacts', $contact_id, $update, true ); } else { $assign_to_id = 0; - $last_activity = DT_Posts::get_most_recent_activity_for_field($contact_id, 'assigned_to'); - if (isset($last_activity->user_id)) { + $last_activity = DT_Posts::get_most_recent_activity_for_field( $contact_id, 'assigned_to' ); + if ( isset( $last_activity->user_id ) ){ $assign_to_id = $last_activity->user_id; } else { - $base_user = dt_get_base_user(true); - if ($base_user) { + $base_user = dt_get_base_user( true ); + if ( $base_user ){ $assign_to_id = $base_user; } } @@ -1525,23 +1461,23 @@ public static function accept_contact(WP_REST_Request $request) 'assigned_to' => $assign_to_id, 'overall_status' => 'unassigned' ]; - $contact = DT_Posts::update_post('contacts', $contact_id, $update, true); + $contact = DT_Posts::update_post( 'contacts', $contact_id, $update, true ); $current_user = wp_get_current_user(); dt_activity_insert( [ - 'action' => 'assignment_decline', - 'object_type' => get_post_type($contact_id), + 'action' => 'assignment_decline', + 'object_type' => get_post_type( $contact_id ), 'object_subtype' => 'decline', - 'object_name' => get_the_title($contact_id), - 'object_id' => $contact_id, - 'meta_id' => '', // id of the comment - 'meta_key' => '', - 'meta_value' => '', - 'meta_parent' => '', - 'object_note' => '' + 'object_name' => get_the_title( $contact_id ), + 'object_id' => $contact_id, + 'meta_id' => '', // id of the comment + 'meta_key' => '', + 'meta_value' => '', + 'meta_parent' => '', + 'object_note' => '' ] ); - Disciple_Tools_Notifications::insert_notification_for_assignment_declined($current_user->ID, $assign_to_id, $contact_id); + Disciple_Tools_Notifications::insert_notification_for_assignment_declined( $current_user->ID, $assign_to_id, $contact_id ); return $contact; } } @@ -1550,41 +1486,39 @@ public static function accept_contact(WP_REST_Request $request) /* * Check other access contacts for possible duplicates */ - private function check_for_duplicates($post_type, $post_id) - { - if (get_current_user_id() === 0) { + private function check_for_duplicates( $post_type, $post_id ){ + if ( get_current_user_id() === 0 ){ $current_user = wp_get_current_user(); - $had_cap = current_user_can('dt_all_access_contacts'); - $current_user->add_cap('dt_all_access_contacts'); - $dup_ids = DT_Duplicate_Checker_And_Merging::ids_of_non_dismissed_duplicates($post_type, $post_id, true); - if (!is_wp_error($dup_ids) && sizeof($dup_ids['ids']) < 10) { - $comment = __('This record might be a duplicate of: ', 'disciple_tools'); - foreach ($dup_ids['ids'] as $id_of_duplicate) { + $had_cap = current_user_can( 'dt_all_access_contacts' ); + $current_user->add_cap( 'dt_all_access_contacts' ); + $dup_ids = DT_Duplicate_Checker_And_Merging::ids_of_non_dismissed_duplicates( $post_type, $post_id, true ); + if ( ! is_wp_error( $dup_ids ) && sizeof( $dup_ids['ids'] ) < 10 ){ + $comment = __( 'This record might be a duplicate of: ', 'disciple_tools' ); + foreach ( $dup_ids['ids'] as $id_of_duplicate ){ $comment .= " \n - [$id_of_duplicate]($id_of_duplicate)"; } $args = [ 'user_id' => 0, - 'comment_author' => __('Duplicate Checker', 'disciple_tools') + 'comment_author' => __( 'Duplicate Checker', 'disciple_tools' ) ]; - DT_Posts::add_post_comment($post_type, $post_id, $comment, 'duplicate', $args, false, true); + DT_Posts::add_post_comment( $post_type, $post_id, $comment, 'duplicate', $args, false, true ); } - if (!$had_cap) { - $current_user->remove_cap('dt_all_access_contacts'); + if ( !$had_cap ){ + $current_user->remove_cap( 'dt_all_access_contacts' ); } } } - public function dt_filter_users_receiving_comment_notification($users_to_notify, $post_type, $post_id, $comment) - { - if ($post_type === 'contacts') { - $post = DT_Posts::get_post($post_type, $post_id); - if (!is_wp_error($post) && isset($post['type']['key']) && $post['type']['key'] === 'access') { - $following_all = get_users([ + public function dt_filter_users_receiving_comment_notification( $users_to_notify, $post_type, $post_id, $comment ){ + if ( $post_type === 'contacts' ){ + $post = DT_Posts::get_post( $post_type, $post_id ); + if ( !is_wp_error( $post ) && isset( $post['type']['key'] ) && $post['type']['key'] === 'access' ){ + $following_all = get_users( [ 'meta_key' => 'dt_follow_all', 'meta_value' => true - ]); - foreach ($following_all as $user) { - if (!in_array($user->ID, $users_to_notify)) { + ] ); + foreach ( $following_all as $user ){ + if ( !in_array( $user->ID, $users_to_notify ) ){ $users_to_notify[] = $user->ID; } } @@ -1594,50 +1528,49 @@ public function dt_filter_users_receiving_comment_notification($users_to_notify, } - public function get_dispatch_list(WP_REST_Request $request) - { - if (!current_user_can('dt_all_access_contacts') || !current_user_can('list_users')) { - return new WP_Error(__FUNCTION__, __('No permission'), ['status' => 403]); + public function get_dispatch_list( WP_REST_Request $request ) { + if ( !current_user_can( 'dt_all_access_contacts' ) || !current_user_can( 'list_users' ) ){ + return new WP_Error( __FUNCTION__, __( 'No permission' ), [ 'status' => 403 ] ); } $params = $request->get_query_params(); - $user_data = DT_User_Management::get_users(true); + $user_data = DT_User_Management::get_users( true ); $last_assignments = $this->get_assignments(); - $location_data = $this->get_location_data($params['location_ids']); + $location_data = $this->get_location_data( $params['location_ids'] ); $gender_data = $this->get_gender_data(); $list = []; $user_fields = Disciple_Tools_Users::get_users_fields(); $workload_status_options = $user_fields['workload_status']['options']; - foreach ($user_data as $user) { - $roles = maybe_unserialize($user['roles']); - if (isset($roles['multiplier']) || isset($roles['dt_admin']) || isset($roles['dispatcher']) || isset($roles['marketer'])) { + foreach ( $user_data as $user ) { + $roles = maybe_unserialize( $user['roles'] ); + if ( isset( $roles['multiplier'] ) || isset( $roles['dt_admin'] ) || isset( $roles['dispatcher'] ) || isset( $roles['marketer'] ) ) { $u = [ - 'name' => wp_specialchars_decode($user['display_name']), + 'name' => wp_specialchars_decode( $user['display_name'] ), 'ID' => $user['ID'], - 'avatar' => get_avatar_url($user['ID'], ['size' => '16']), + 'avatar' => get_avatar_url( $user['ID'], [ 'size' => '16' ] ), 'last_assignment' => $last_assignments[$user['ID']] ?? null, - 'roles' => array_keys($roles), + 'roles' => array_keys( $roles ), 'location' => null, 'languages' => [], 'gender' => null, ]; - $user_languages = get_user_option('user_languages', $user['ID']); - if ($user_languages) { + $user_languages = get_user_option( 'user_languages', $user['ID'] ); + if ( $user_languages ) { $u['languages'] = $user_languages; } //extra information for the dispatcher $workload_status = $user['workload_status'] ?? null; - if ($workload_status && isset($workload_status_options[$workload_status]['color'])) { + if ( $workload_status && isset( $workload_status_options[$workload_status]['color'] ) ) { $u['status'] = $workload_status; $u['status_color'] = $workload_status_options[$workload_status]['color']; } - if (isset($location_data[$user['ID']])) { + if ( isset( $location_data[$user['ID']] ) ){ $u['location'] = $location_data[$user['ID']]['level']; $u['best_location_match'] = $location_data[$user['ID']]['match_name']; } - if (isset($gender_data[$user['ID']])) { + if ( isset( $gender_data[$user['ID']] ) ) { $u['gender'] = $gender_data[$user['ID']]; } @@ -1647,79 +1580,75 @@ public function get_dispatch_list(WP_REST_Request $request) } } - return apply_filters('dt_get_dispatch_list', $list, $params['post_type'], $params['post_id']); + return apply_filters( 'dt_get_dispatch_list', $list, $params['post_type'], $params['post_id'] ); } - private function get_assignments() - { + private function get_assignments() { global $wpdb; - $last_assignment_query = $wpdb->get_results( - " + $last_assignment_query = $wpdb->get_results( " SELECT meta_value as user, MAX(hist_time) as assignment_date from $wpdb->dt_activity_log as log WHERE meta_key = 'assigned_to' GROUP by meta_value", - ARRAY_A - ); - $last_assignments = []; - foreach ($last_assignment_query as $assignment) { - $user_id = str_replace('user-', '', $assignment['user']); + ARRAY_A ); + $last_assignments =[]; + foreach ( $last_assignment_query as $assignment ){ + $user_id = str_replace( 'user-', '', $assignment['user'] ); $last_assignments[$user_id] = $assignment['assignment_date']; } return $last_assignments; } - private function get_location_data($location_ids) - { + private function get_location_data( $location_ids ) { global $wpdb; $location_data = []; - if (isset($location_ids)) { - foreach ($location_ids as $grid_id) { - $location = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->dt_location_grid WHERE grid_id = %s", esc_sql($grid_id)), ARRAY_A); + if ( isset( $location_ids ) ) { + foreach ( $location_ids as $grid_id ){ + $location = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->dt_location_grid WHERE grid_id = %s", esc_sql( $grid_id ) ), ARRAY_A ); $levels = []; - if ($grid_id === '1') { + if ( $grid_id === '1' ){ $match_location_ids = '( 1 )'; } else { $match_location_ids = '( '; - for ($i = 0; $i <= ((int) $location['level']); $i++) { - $levels[$location['admin' . $i . '_grid_id']] = ['level' => $i]; - $match_location_ids .= $location['admin' . $i . '_grid_id'] . ', '; + for ( $i = 0; $i <= ( (int) $location['level'] ); $i++ ) { + $levels[ $location['admin'. $i . '_grid_id']] = [ 'level' => $i ]; + $match_location_ids .= $location['admin'. $i . '_grid_id'] . ', '; } $match_location_ids .= ')'; } - $match_location_ids = str_replace(', )', ' )', $match_location_ids); + $match_location_ids = str_replace( ', )', ' )', $match_location_ids ); //phpcs:disable //already sanitized IN value - $location_names = $wpdb->get_results(" + $location_names = $wpdb->get_results( " SELECT alt_name, grid_id FROM $wpdb->dt_location_grid WHERE grid_id IN $match_location_ids ", ARRAY_A); //get users with the same location grid. - $users_in_location = $wpdb->get_results($wpdb->prepare(" + $users_in_location = $wpdb->get_results( $wpdb->prepare(" SELECT user_id, meta_value as grid_id FROM $wpdb->usermeta um WHERE um.meta_key = %s AND um.meta_value IN $match_location_ids - ", "{$wpdb->prefix}location_grid"), ARRAY_A); + ", "{$wpdb->prefix}location_grid"), ARRAY_A ); //phpcs:enable - foreach ($location_names as $l) { - if (isset($levels[$l['grid_id']])) { + foreach ( $location_names as $l ){ + if ( isset( $levels[$l['grid_id']] ) ) { $levels[$l['grid_id']]['name'] = $l['alt_name']; } } //0 if the location is exact match. 1 if the matched location is the parent etc - foreach ($users_in_location as $l) { + foreach ( $users_in_location as $l ){ $level = (int) $location['level'] - $levels[$l['grid_id']]['level']; - if (!isset($location_data[$l['user_id']]) || $location_data[$l['user_id']]['level'] > $level) { + if ( !isset( $location_data[$l['user_id']] ) || $location_data[$l['user_id']]['level'] > $level ){ $location_data[$l['user_id']] = [ 'level' => $level, 'match_name' => $levels[$l['grid_id']]['name'] @@ -1731,20 +1660,17 @@ private function get_location_data($location_ids) return $location_data; } - private function get_gender_data() - { + private function get_gender_data() { global $wpdb; $gender_data = []; - $gender_query = $wpdb->get_results( - $wpdb->prepare(" + $gender_query = $wpdb->get_results( $wpdb->prepare(" SELECT user_id, meta_value as gender from $wpdb->usermeta WHERE meta_key = %s", "{$wpdb->prefix}user_gender"), - ARRAY_A - ); + ARRAY_A ); - foreach ($gender_query as $data) { + foreach ( $gender_query as $data ){ $gender_data[$data['user_id']] = $data['gender']; } @@ -1757,8 +1683,7 @@ private function get_gender_data() * @param $fields * @return mixed */ - public function dt_users_fields($fields) - { + public function dt_users_fields( $fields ){ $fields['number_new_assigned'] = [ 'label' => 'Accept Needed', 'type' => 'number', diff --git a/dt-core/global-functions.php b/dt-core/global-functions.php index 5abf5e1dea..29bef845f9 100755 --- a/dt-core/global-functions.php +++ b/dt-core/global-functions.php @@ -1,7 +1,7 @@ 0) { - $elapsed_log = sprintf('[elapsed:%5dms]', ($now - $dt_write_log_microtime) * 1000); + $now = microtime( true ); + if ( $dt_write_log_microtime > 0 ) { + $elapsed_log = sprintf( '[elapsed:%5dms]', ( $now - $dt_write_log_microtime ) * 1000 ); } else { $elapsed_log = '[elapsed:-------]'; } $dt_write_log_microtime = $now; - if (is_array($log) || is_object($log)) { - error_log($elapsed_log . ' ' . print_r($log, true)); + if ( is_array( $log ) || is_object( $log ) ) { + error_log( $elapsed_log . ' ' . print_r( $log, true ) ); } else { - error_log("$elapsed_log $log"); + error_log( "$elapsed_log $log" ); } } } } - if (!function_exists('dt_default_email_address')) { + if ( !function_exists( 'dt_default_email_address' ) ) { function dt_default_email_address(): string { - $default_addr = apply_filters('wp_mail_from', ''); + $default_addr = apply_filters( 'wp_mail_from', '' ); - if (empty($default_addr)) { + if ( empty( $default_addr ) ) { // Get the site domain and get rid of www. - $sitename = wp_parse_url(network_home_url(), PHP_URL_HOST); - if ('www.' === substr($sitename, 0, 4)) { - $sitename = substr($sitename, 4); + $sitename = wp_parse_url( network_home_url(), PHP_URL_HOST ); + if ( 'www.' === substr( $sitename, 0, 4 ) ) { + $sitename = substr( $sitename, 4 ); } $default_addr = 'wordpress@' . $sitename; @@ -78,12 +77,12 @@ function dt_default_email_address(): string } } - if (!function_exists('dt_default_email_name')) { + if ( !function_exists( 'dt_default_email_name' ) ) { function dt_default_email_name(): string { - $default_name = apply_filters('wp_mail_from_name', ''); + $default_name = apply_filters( 'wp_mail_from_name', '' ); - if (empty($default_name)) { + if ( empty( $default_name ) ) { $default_name = 'WordPress'; } @@ -91,7 +90,7 @@ function dt_default_email_name(): string } } - if (!function_exists('dt_email_template_wrapper')) { + if ( !function_exists( 'dt_email_template_wrapper' ) ) { /** * A function which wraps specified plain text messages within * email template. @@ -99,41 +98,40 @@ function dt_default_email_name(): string * @param $message * @param $subject */ - function dt_email_template_wrapper($message, $subject) - { + function dt_email_template_wrapper( $message, $subject ) { // Load email template and replace content placeholder. - $email_template = file_get_contents(trailingslashit(get_template_directory()) . 'dt-notifications/email-template.html'); - if ($email_template) { + $email_template = file_get_contents( trailingslashit( get_template_directory() ) . 'dt-notifications/email-template.html' ); + if ( $email_template ) { // Clean < and > around text links in WP 3.1. - $message = preg_replace('#<(https?://[^*]+)>#', '$1', $message); + $message = preg_replace( '#<(https?://[^*]+)>#', '$1', $message ); // Convert line breaks. - if (apply_filters('dt_email_template_convert_line_breaks', true)) { - $message = nl2br($message); + if ( apply_filters( 'dt_email_template_convert_line_breaks', true ) ) { + $message = nl2br( $message ); } // Convert URLs to links. - if (apply_filters('dt_email_template_convert_urls', true)) { - $message = make_clickable($message); + if ( apply_filters( 'dt_email_template_convert_urls', true ) ) { + $message = make_clickable( $message ); } // Add template to message. - $email_body = str_replace('{{EMAIL_TEMPLATE_CONTENT}}', $message, $email_template); + $email_body = str_replace( '{{EMAIL_TEMPLATE_CONTENT}}', $message, $email_template ); // Add footer to message - $email_body = str_replace('{{EMAIL_TEMPLATE_FOOTER}}', get_bloginfo('name'), $email_body); + $email_body = str_replace( '{{EMAIL_TEMPLATE_FOOTER}}', get_bloginfo( 'name' ), $email_body ); // Replace remaining template variables. - return str_replace('{{EMAIL_TEMPLATE_TITLE}}', $subject, $email_body); + return str_replace( '{{EMAIL_TEMPLATE_TITLE}}', $subject, $email_body ); } return $message; } } - if (!function_exists('dt_is_rest')) { + if ( !function_exists( 'dt_is_rest' ) ) { /** * Checks if the current request is a WP REST API request. * @@ -144,21 +142,20 @@ function dt_email_template_wrapper($message, $subject) * * @returns boolean */ - function dt_is_rest($namespace = null) - { + function dt_is_rest( $namespace = null ) { $prefix = rest_get_url_prefix(); if ( - defined('REST_REQUEST') && REST_REQUEST - || isset($_GET['rest_route']) - && strpos(trim(sanitize_text_field(wp_unslash($_GET['rest_route'])), '\\/'), $prefix, 0) === 0 + defined( 'REST_REQUEST' ) && REST_REQUEST + || isset( $_GET['rest_route'] ) + && strpos( trim( sanitize_text_field( wp_unslash( $_GET['rest_route'] ) ), '\\/' ), $prefix, 0 ) === 0 ) { return true; } - $rest_url = wp_parse_url(site_url($prefix)); - $current_url = wp_parse_url(add_query_arg(array())); - $is_rest = strpos($current_url['path'], $rest_url['path'], 0) === 0; - if ($namespace) { - return $is_rest && strpos($current_url['path'], $namespace) != false; + $rest_url = wp_parse_url( site_url( $prefix ) ); + $current_url = wp_parse_url( add_query_arg( array() ) ); + $is_rest = strpos( $current_url['path'], $rest_url['path'], 0 ) === 0; + if ( $namespace ) { + return $is_rest && strpos( $current_url['path'], $namespace ) != false; } else { return $is_rest; } @@ -171,29 +168,28 @@ function dt_is_rest($namespace = null) * will return contacts/3/?param=true * @return string */ - if (!function_exists('dt_get_url_path')) { - function dt_get_url_path($ignore_query_parameters = false, $include_host = false) - { - if (isset($_SERVER['HTTP_HOST'])) { - $url = (!isset($_SERVER['HTTPS']) || @($_SERVER['HTTPS'] != 'on')) ? 'http://' . sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])) : 'https://' . sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])); - if (isset($_SERVER['REQUEST_URI'])) { - $url .= esc_url_raw(wp_unslash($_SERVER['REQUEST_URI'])); + if ( !function_exists( 'dt_get_url_path' ) ) { + function dt_get_url_path( $ignore_query_parameters = false, $include_host = false ) { + if ( isset( $_SERVER['HTTP_HOST'] ) ) { + $url = ( !isset( $_SERVER['HTTPS'] ) || @( $_SERVER['HTTPS'] != 'on' ) ) ? 'http://' . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : 'https://' . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ); + if ( isset( $_SERVER['REQUEST_URI'] ) ) { + $url .= esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ); } //remove query parameters - if ($ignore_query_parameters) { - $url = strtok($url, '?'); //allow get parameters + if ( $ignore_query_parameters ) { + $url = strtok( $url, '?' ); //allow get parameters } //remove the domain part. Ex: https://example.com/ - if ($include_host === false) { - $url = trim(str_replace(get_site_url(), '', $url), '/'); + if ( $include_host === false ) { + $url = trim( str_replace( get_site_url(), '', $url ), '/' ); } //remove trailing '?' - if (substr($url, -1) === '?') { - $url = substr($url, 0, -1); + if ( substr( $url, -1 ) === '?' ) { + $url = substr( $url, 0, -1 ); } // remove trailing '/' - $url = untrailingslashit($url); + $url = untrailingslashit( $url ); return $url; } @@ -201,37 +197,35 @@ function dt_get_url_path($ignore_query_parameters = false, $include_host = false } } - if (!function_exists('dt_get_post_type')) { + if ( !function_exists( 'dt_get_post_type' ) ) { /** * The post type as found in the url returned by dt_get_url_path * https://example.com/sub/contacts/3/?param=true * will return 'contacts' * @return string */ - function dt_get_post_type() - { + function dt_get_post_type() { $url_path = dt_get_url_path(); - $url_path_with_no_query_string = explode('?', $url_path)[0]; - return explode('/', $url_path_with_no_query_string)[0]; + $url_path_with_no_query_string = explode( '?', $url_path )[0]; + return explode( '/', $url_path_with_no_query_string )[0]; } } - if (!function_exists('dt_array_to_sql')) { - function dt_array_to_sql($values, $numeric = false) - { - if (empty($values)) { + if ( !function_exists( 'dt_array_to_sql' ) ) { + function dt_array_to_sql( $values, $numeric = false ) { + if ( empty( $values ) ) { return 'NULL'; } - foreach ($values as &$val) { - if ('\N' === $val || empty($val)) { + foreach ( $values as &$val ) { + if ( '\N' === $val || empty( $val ) ) { $val = 'NULL'; - } elseif ($numeric) { - $val = esc_sql(trim($val)); + } elseif ( $numeric ) { + $val = esc_sql( trim( $val ) ); } else { - $val = "'" . esc_sql(trim($val)) . "'"; + $val = "'" . esc_sql( trim( $val ) ) . "'"; } } - return implode(',', $values); + return implode( ',', $values ); } } @@ -242,48 +236,44 @@ function dt_array_to_sql($values, $numeric = false) * * @return bool|int|string */ - if (!function_exists('dt_format_date')) { - function dt_format_date($date, $format = 'short') - { - $date_format = get_option('date_format'); - $time_format = get_option('time_format'); - if ($format === 'short') { + if ( !function_exists( 'dt_format_date' ) ) { + function dt_format_date( $date, $format = 'short' ) { + $date_format = get_option( 'date_format' ); + $time_format = get_option( 'time_format' ); + if ( $format === 'short' ) { // $format = $date_format; // formatting it with internationally understood date, as there was a // struggle getting dates to show in user's selected language and not // in the site language. $format = 'Y-m-d'; - } else if ($format === 'long') { + } else if ( $format === 'long' ) { $format = $date_format . ' ' . $time_format; } - if (is_numeric($date)) { - $formatted = date_i18n($format, $date); + if ( is_numeric( $date ) ) { + $formatted = date_i18n( $format, $date ); } else { - $formatted = mysql2date($format, $date); + $formatted = mysql2date( $format, $date ); } return $formatted; } } - if (!function_exists('dt_date_start_of_year')) { - function dt_date_start_of_year() - { - $this_year = gmdate('Y'); - $timestamp = strtotime($this_year . '-01-01'); + if ( !function_exists( 'dt_date_start_of_year' ) ) { + function dt_date_start_of_year() { + $this_year = gmdate( 'Y' ); + $timestamp = strtotime( $this_year . '-01-01' ); return $timestamp; } } - if (!function_exists('dt_date_end_of_year')) { - function dt_date_end_of_year() - { - $this_year = (int) gmdate('Y'); - return strtotime(($this_year + 1) . '-01-01'); + if ( !function_exists( 'dt_date_end_of_year' ) ) { + function dt_date_end_of_year() { + $this_year = (int) gmdate( 'Y' ); + return strtotime( ( $this_year + 1 ) . '-01-01' ); } } - if (!function_exists('dt_get_year_from_timestamp')) { - function dt_get_year_from_timestamp(int $time) - { - return gmdate('Y', $time); + if ( !function_exists( 'dt_get_year_from_timestamp' ) ) { + function dt_get_year_from_timestamp( int $time ) { + return gmdate( 'Y', $time ); } } @@ -291,24 +281,23 @@ function dt_get_year_from_timestamp(int $time) /* * deprecated */ - if (!function_exists('dt_sanitize_array_html')) { - function dt_sanitize_array_html($array) - { - array_walk_recursive($array, function (&$v) { - $v = filter_var(trim($v), FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES); + if ( !function_exists( 'dt_sanitize_array_html' ) ) { + function dt_sanitize_array_html( $array ) { + array_walk_recursive($array, function ( &$v ) { + $v = filter_var( trim( $v ), FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES ); }); return $array; } } - if (!function_exists('dt_recursive_sanitize_array')) { - function dt_recursive_sanitize_array(array $array): array + if ( !function_exists( 'dt_recursive_sanitize_array' ) ) { + function dt_recursive_sanitize_array( array $array ): array { - foreach ($array as $key => &$value) { - if (is_array($value)) { - $value = dt_recursive_sanitize_array($value); + foreach ( $array as $key => &$value ) { + if ( is_array( $value ) ) { + $value = dt_recursive_sanitize_array( $value ); } else { - $value = sanitize_text_field(wp_unslash($value)); + $value = sanitize_text_field( wp_unslash( $value ) ); } } return $array; @@ -318,16 +307,15 @@ function dt_recursive_sanitize_array(array $array): array /** * Deprecated function, use dt_get_available_languages() */ - if (!function_exists('dt_get_translations')) { - function dt_get_translations() - { - require_once (ABSPATH . 'wp-admin/includes/translation-install.php'); + if ( !function_exists( 'dt_get_translations' ) ) { + function dt_get_translations() { + require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); $translations = wp_get_available_translations(); // @todo throwing errors if wp.org connection isn't established return $translations; } } - if (!function_exists('dt_get_available_languages')) { + if ( !function_exists( 'dt_get_available_languages' ) ) { /** * Return the list of available languages. Defaults to all translations in the theme. * @@ -342,28 +330,27 @@ function dt_get_translations() * * @return array */ - function dt_get_available_languages($code_as_key = false, $all = false, $available_language_codes = []) - { + function dt_get_available_languages( $code_as_key = false, $all = false, $available_language_codes = [] ) { $translations = dt_get_global_languages_list(); - if (true === $all) { + if ( true === $all ) { return $translations; } - if (empty($available_language_codes)) { - $available_language_codes = get_available_languages(get_template_directory() . '/dt-assets/translation'); + if ( empty( $available_language_codes ) ) { + $available_language_codes = get_available_languages( get_template_directory() . '/dt-assets/translation' ); } - array_unshift($available_language_codes, 'en_US'); + array_unshift( $available_language_codes, 'en_US' ); $available_translations = []; - $site_default_locale = get_option('WPLANG'); + $site_default_locale = get_option( 'WPLANG' ); - foreach ($available_language_codes as $code) { - if (isset($translations[$code])) { + foreach ( $available_language_codes as $code ) { + if ( isset( $translations[$code] ) ) { $translations[$code]['site_default'] = $site_default_locale === $code; $translations[$code]['english_name'] = $translations[$code]['label']; $translations[$code]['language'] = $code; - if (!$code_as_key) { + if ( !$code_as_key ) { $available_translations[] = $translations[$code]; } else { $available_translations[$code] = $translations[$code]; @@ -374,20 +361,19 @@ function dt_get_available_languages($code_as_key = false, $all = false, $availab } } - if (!function_exists('dt_language_select')) { - function dt_language_select($user_id = null) - { - if ($user_id === null) { + if ( !function_exists( 'dt_language_select' ) ) { + function dt_language_select( $user_id = null ) { + if ( $user_id === null ) { $user_id = get_current_user_id(); } $languages = dt_get_available_languages(); - $dt_user_locale = get_user_locale($user_id); + $dt_user_locale = get_user_locale( $user_id ); ?> @@ -395,51 +381,49 @@ function dt_language_select($user_id = null) } } - if (!function_exists('dt_create_field_key')) { - function dt_create_field_key($s, $with_hash = false) - { + if ( !function_exists( 'dt_create_field_key' ) ) { + function dt_create_field_key( $s, $with_hash = false ) { //note we don't limit to alhpa_numeric because it would strip out all non latin based languages - $s = str_replace(' ', '_', $s); // Replaces all spaces with hyphens. - $s = sanitize_key($s); - if ($with_hash === true) { - $s .= '_' . substr(md5(rand(10000, 100000)), 0, 3); // create a unique 3 digit key + $s = str_replace( ' ', '_', $s ); // Replaces all spaces with hyphens. + $s = sanitize_key( $s ); + if ( $with_hash === true ) { + $s .= '_' . substr( md5( rand( 10000, 100000 ) ), 0, 3 ); // create a unique 3 digit key } - if (empty($s)) { - $s .= 'key_' . substr(md5(rand(10000, 100000)), 0, 3); + if ( empty( $s ) ) { + $s .= 'key_' . substr( md5( rand( 10000, 100000 ) ), 0, 3 ); } return $s; } } - if (!function_exists('dt_render_field_icon')) { - function dt_render_field_icon($field, $class = 'dt-icon', $default_to_name = false) - { + if ( !function_exists( 'dt_render_field_icon' ) ) { + function dt_render_field_icon( $field, $class = 'dt-icon', $default_to_name = false ) { $icon_rendered = false; - if (!empty($field['icon']) && strpos($field['icon'], 'undefined') === false) { + if ( !empty( $field['icon'] ) && strpos( $field['icon'], 'undefined' ) === false ) { $icon_rendered = true; - if (isset($field['name'])) { + if ( isset( $field['name'] ) ) { $alt_tag = $field['name']; - } else if (isset($field['label'])) { + } else if ( isset( $field['label'] ) ) { $alt_tag = $field['label']; } else { $alt_tag = ''; } ?> - <?php echo esc_html($alt_tag) ?> + <?php echo esc_html( $alt_tag ) ?> - + - + 0) { - foreach ($permissions as $permission) { - if (current_user_can($permission)) { + if ( count( $permissions ) > 0 ) { + foreach ( $permissions as $permission ) { + if ( current_user_can( $permission ) ) { return true; } } @@ -473,38 +457,36 @@ function dt_has_permissions(array $permissions): bool * @param bool $return * @return string */ - function dt_get_assigned_name(int $contact_id, bool $return = false) - { + function dt_get_assigned_name( int $contact_id, bool $return = false ) { - $metadata = get_post_meta($contact_id, $key = 'assigned_to', true); + $metadata = get_post_meta( $contact_id, $key = 'assigned_to', true ); - if (!empty($metadata)) { - $meta_array = explode('-', $metadata); // Separate the type and id + if ( !empty( $metadata ) ) { + $meta_array = explode( '-', $metadata ); // Separate the type and id $type = $meta_array[0]; $id = $meta_array[1]; - if ($type == 'user') { - $value = get_user_by('id', $id); + if ( $type == 'user' ) { + $value = get_user_by( 'id', $id ); $rv = $value->display_name; } else { - $value = get_term($id); + $value = get_term( $id ); $rv = $value->name; } - if ($return) { + if ( $return ) { return $rv; } else { - echo esc_html($rv); + echo esc_html( $rv ); } } } - function is_associative_array(array $arr) - { - if (array() === $arr) { + function is_associative_array( array $arr ) { + if ( array() === $arr ) { return false; } - return array_keys($arr) !== range(0, count($arr) - 1); + return array_keys( $arr ) !== range( 0, count( $arr ) - 1 ); } /** * Recursively merge array2 on to array1 @@ -513,15 +495,14 @@ function is_associative_array(array $arr) * @param array $array2 * @return array */ - function dt_array_merge_recursive_distinct(array &$array1, array &$array2) - { + function dt_array_merge_recursive_distinct( array &$array1, array &$array2 ) { $merged = $array1; - if (!is_associative_array($array2) && !is_associative_array($merged)) { - return array_unique(array_merge($merged, $array2), SORT_REGULAR); + if ( !is_associative_array( $array2 ) && !is_associative_array( $merged ) ) { + return array_unique( array_merge( $merged, $array2 ), SORT_REGULAR ); } - foreach ($array2 as $key => &$value) { - if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { - $merged[$key] = dt_array_merge_recursive_distinct($merged[$key], $value); + foreach ( $array2 as $key => &$value ) { + if ( is_array( $value ) && isset( $merged[$key] ) && is_array( $merged[$key] ) ) { + $merged[$key] = dt_array_merge_recursive_distinct( $merged[$key], $value ); } else { $merged[$key] = $value; } @@ -529,50 +510,48 @@ function dt_array_merge_recursive_distinct(array &$array1, array &$array2) return $merged; } - function dt_field_enabled_for_record_type($field, $post) - { - if (!isset($post['type']['key'])) { + function dt_field_enabled_for_record_type( $field, $post ) { + if ( !isset( $post['type']['key'] ) ) { return true; } // if only_for_type is not set, then the field is available on all types - if (!isset($field['only_for_types'])) { + if ( !isset( $field['only_for_types'] ) ) { return true; - } else if ($field['only_for_types'] === true) { + } else if ( $field['only_for_types'] === true ) { return true; - } else if (is_array($field['only_for_types']) && in_array($post['type']['key'], $field['only_for_types'], true)) { + } else if ( is_array( $field['only_for_types'] ) && in_array( $post['type']['key'], $field['only_for_types'], true ) ) { //if the type is in the "only_for_types" return true; } return false; } - function render_new_bulk_record_fields($dt_post_type) - { - $post_settings = DT_Posts::get_post_settings($dt_post_type); + function render_new_bulk_record_fields( $dt_post_type ) { + $post_settings = DT_Posts::get_post_settings( $dt_post_type ); $selected_type = null; - foreach ($post_settings['fields'] as $field_key => $field_settings) { - if (!empty($field_settings['hidden']) && empty($field_settings['custom_display'])) { + foreach ( $post_settings['fields'] as $field_key => $field_settings ) { + if ( !empty( $field_settings['hidden'] ) && empty( $field_settings['custom_display'] ) ) { continue; } - if (isset($field_settings['in_create_form']) && $field_settings['in_create_form'] === false) { + if ( isset( $field_settings['in_create_form'] ) && $field_settings['in_create_form'] === false ) { continue; } - if (!isset($field_settings['tile'])) { + if ( !isset( $field_settings['tile'] ) ) { continue; } $classes = ''; $show_field = false; //add types the field should show up on as classes - if (!empty($field_settings['in_create_form'])) { - if (is_array($field_settings['in_create_form'])) { - foreach ($field_settings['in_create_form'] as $type_key) { + if ( !empty( $field_settings['in_create_form'] ) ) { + if ( is_array( $field_settings['in_create_form'] ) ) { + foreach ( $field_settings['in_create_form'] as $type_key ) { $classes .= $type_key . ' '; - if ($type_key === $selected_type) { + if ( $type_key === $selected_type ) { $show_field = true; } } - } elseif ($field_settings['in_create_form'] === true) { + } elseif ( $field_settings['in_create_form'] === true ) { $classes = 'all'; $show_field = true; } @@ -582,23 +561,22 @@ function render_new_bulk_record_fields($dt_post_type) ?> -
    - class="form-field "> +
    + class="form-field "> -

    + render_field_for_display( $field_key, $post_settings['fields'], [] ); + if ( isset( $field_settings['required'] ) && $field_settings['required'] === true ) { ?> +

    + function dt_render_icon_slot( $field ) { + if ( isset( $field['font-icon'] ) && !empty( $field['font-icon'] ) ): ?> - + - - - value="" requiredmessage="" + + + value="" requiredmessage="" icon="https://cdn-icons-png.flaticon.com/512/1077/1077114.png" iconalttext="Icon Alt Text" privatelabel="" error="" onchange=""> - - - value="" requiredmessage="" + + + value="" requiredmessage="" icon="https://cdn-icons-png.flaticon.com/512/1077/1077114.png" iconalttext="Icon Alt Text" privatelabel="" error="" onchange=""> @@ -686,130 +663,130 @@ function render_field_for_display($field_key, $fields, $post, $show_extra_contro - > + + + } else if ( $field_type === 'key_select' ): ?> $key, 'label' => $value['label'], 'color' => $value['color'] ?? null, ]; - }, array_keys($options_array), $options_array); + }, array_keys( $options_array ), $options_array); ?> - - options="" - value=""> - + + options="" + value=""> + - - + $value, 'label' => $value, ]; }, $post[$field_key] ?? []); ?> - value="" - placeholder="" + value="" + placeholder="" allowAdd> - + - + $key, 'label' => $value['label'], 'color' => $value['color'] ?? null, ]; - }, array_keys($options_array), $options_array); + }, array_keys( $options_array ), $options_array); ?> - - options="" - value=""> - + + options="" + value=""> +
    - $option_value): ?> + $option_value ): ?> -
    - - value=""> - + + value=""> + - - - - - class="text-input" value="" - min="" - max="" onwheel="return false;" /> - + + + + + class="text-input" value="" + min="" + max="" onwheel="return false;" /> +
  • `}}); +import { i as t, y as e } from '../../lit-element-2409d5fe.js'; +import { D as i } from '../dt-tags/dt-tags.js'; +import '../dt-multi-select/dt-multi-select.js'; +import '../../style-map-ac85d91b.js'; +import '../../directive-de55b00a.js'; +import '../../lit-localize-763e4978.js'; +import '../dt-form-base.js'; +import '../../dt-base.js'; +import '../dt-label/dt-label.js'; +import '../mixins/hasOptionsList.js'; +import '../../icons/dt-spinner.js'; +import '../../icons/dt-checkmark.js'; +window.customElements.define( + 'dt-connection', + class extends i { + static get styles() { + return [ + ...super.styles, + t`.selected-option a{border-inline-start:solid 3px transparent}li button *{pointer-events:none}li{border-inline-start:solid 5px transparent}li button .status{font-style:italic;opacity:.6}li button .status:before{content:'[';font-style:normal}li button .status:after{content:']';font-style:normal}li button svg{width:20px;height:auto;margin-bottom:-4px}li button svg use{fill:var(--dt-connection-icon-fill,var(--primary-color))}`, + ]; + } + _clickOption(t) { + if (t.target && t.target.value) { + const e = parseInt(t.target.value, 10), + i = this.filteredOptions.reduce( + (t, i) => (t || i.id != e ? t : i), + null, + ); + i && this._select(i), this._clearSearch(); + } + } + _clickAddNew(t) { + if (t.target) { + this._select({ + id: t.target.dataset?.label, + label: t.target.dataset?.label, + isNew: !0, + }); + const e = this.shadowRoot.querySelector('input'); + e && (e.value = ''); + } + } + _keyboardSelectOption() { + this.activeIndex > -1 && + (this.activeIndex + 1 > this.filteredOptions.length + ? this._select({ id: this.query, label: this.query, isNew: !0 }) + : this._select(this.filteredOptions[this.activeIndex]), + this._clearSearch()); + } + _remove(t) { + if (t.target && t.target.dataset && t.target.dataset.value) { + const e = new CustomEvent('change', { + detail: { field: this.name, oldValue: this.value }, + }); + (this.value = (this.value || []).map((e) => { + const i = { ...e }; + return e.id === t.target.dataset.value && (i.delete = !0), i; + })), + (e.detail.newValue = this.value), + this.dispatchEvent(e), + this.open && this.shadowRoot.querySelector('input').focus(); + } + } + _filterOptions() { + const t = (this.value || []).filter((t) => !t.delete).map((t) => t?.id); + if (this.options?.length) + this.filteredOptions = (this.options || []).filter( + (e) => + !t.includes(e.id) && + (!this.query || + e.label + .toLocaleLowerCase() + .includes(this.query.toLocaleLowerCase())), + ); + else if (this.open) { + (this.loading = !0), (this.filteredOptions = []); + const e = this, + i = new CustomEvent('load', { + bubbles: !0, + detail: { + field: this.name, + postType: this.postType, + query: this.query, + onSuccess: (i) => { + (e.loading = !1), + (e.filteredOptions = i.filter((e) => !t.includes(e.id))); + }, + onError: (t) => { + console.warn(t), (e.loading = !1); + }, + }, + }); + this.dispatchEvent(i); + } + return this.filteredOptions; + } + _renderSelectedOptions() { + return (this.value || []) + .filter((t) => !t.delete) + .map( + (t) => + e`
    ${t.label}
    `, + ); + } + _renderOption(t, i) { + const s = e`circle-08 2Created using Figma`, + l = t.status || { key: '', label: '', color: '' }; + return e`
  • `; + } + }, +); +//# sourceMappingURL=dt-connection.js.map diff --git a/dt-assets/build/components/form/dt-connection/dt-connection.js.map b/dt-assets/build/components/form/dt-connection/dt-connection.js.map new file mode 100644 index 0000000000..9a8ad4f676 --- /dev/null +++ b/dt-assets/build/components/form/dt-connection/dt-connection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-connection.js","sources":["../../../src/components/form/dt-connection/dt-connection.js"],"sourcesContent":["import { css, html } from 'lit';\nimport { DtTags } from '../dt-tags/dt-tags.js';\n\nexport class DtConnection extends DtTags {\n static get styles() {\n return [\n ...super.styles,\n css`\n .selected-option a {\n border-inline-start: solid 3px transparent;\n }\n\n li button * {\n pointer-events: none;\n }\n\n li {\n border-inline-start: solid 5px transparent;\n }\n\n li button .status {\n font-style: italic;\n opacity: 0.6;\n }\n li button .status:before {\n content: '[';\n font-style: normal;\n }\n li button .status:after {\n content: ']';\n font-style: normal;\n }\n\n li button svg {\n width: 20px;\n height: auto;\n margin-bottom: -4px;\n }\n li button svg use {\n fill: var(--dt-connection-icon-fill, var(--primary-color));\n }\n `,\n ];\n }\n\n _clickOption(e) {\n if (e.target && e.target.value) {\n const id = parseInt(e.target.value, 10);\n const option = this.filteredOptions.reduce((result, opt) => {\n if (!result && opt.id == id) {\n return opt;\n }\n return result;\n }, null);\n if (option) {\n this._select(option);\n }\n this._clearSearch();\n }\n }\n\n _clickAddNew(e) {\n if (e.target) {\n this._select({\n id: e.target.dataset?.label,\n label: e.target.dataset?.label,\n isNew: true,\n });\n // clear search field if clicked with mouse, since field will lose focus\n const input = this.shadowRoot.querySelector('input');\n if (input) {\n input.value = '';\n }\n }\n }\n\n _keyboardSelectOption() {\n if (this.activeIndex > -1) {\n if (this.activeIndex + 1 > this.filteredOptions.length) {\n this._select({\n id: this.query,\n label: this.query,\n isNew: true,\n });\n } else {\n this._select(this.filteredOptions[this.activeIndex]);\n }\n this._clearSearch();\n }\n }\n\n _remove(e) {\n if (e.target && e.target.dataset && e.target.dataset.value) {\n const event = new CustomEvent('change', {\n detail: {\n field: this.name,\n oldValue: this.value,\n },\n });\n this.value = (this.value || []).map(i => {\n const val = {\n ...i,\n };\n if (i.id === e.target.dataset.value) {\n val.delete = true;\n }\n return val;\n });\n event.detail.newValue = this.value;\n\n // dispatch event for use with addEventListener from javascript\n this.dispatchEvent(event);\n\n // If option was de-selected while list was open, re-focus input\n if (this.open) {\n this.shadowRoot.querySelector('input').focus();\n }\n }\n }\n\n /**\n * Filter to options that:\n * 1: are not selected\n * 2: match the search query\n * @private\n */\n _filterOptions() {\n const selectedValues = (this.value || [])\n .filter(i => !i.delete)\n .map(v => v?.id);\n\n if (this.options?.length) {\n this.filteredOptions = (this.options || []).filter(\n opt =>\n !selectedValues.includes(opt.id) &&\n (!this.query ||\n opt.label\n .toLocaleLowerCase()\n .includes(this.query.toLocaleLowerCase()))\n );\n } else if (this.open) {\n // Only run this filtering if the list is open.\n // This prevents it from running on initial load before a `load` event is attached.\n this.loading = true;\n this.filteredOptions = [];\n\n // need to fetch data via API request\n const self = this;\n const event = new CustomEvent('load', {\n bubbles: true,\n detail: {\n field: this.name,\n postType: this.postType,\n query: this.query,\n onSuccess: result => {\n self.loading = false;\n\n // filter out selected values from list\n self.filteredOptions = result.filter(\n opt => !selectedValues.includes(opt.id)\n );\n },\n onError: error => {\n console.warn(error);\n self.loading = false;\n },\n },\n });\n this.dispatchEvent(event);\n }\n return this.filteredOptions;\n }\n\n _renderSelectedOptions() {\n return (this.value || [])\n .filter(i => !i.delete)\n .map(\n opt => html`\n
    \n ${opt.label}\n \n x\n \n
    \n `\n );\n }\n\n _renderOption(opt, idx) {\n // prettier-ignore\n const svg = html`circle-08 2Created using Figma`\n\n const status = opt.status || {\n key: '',\n label: '',\n color: '',\n };\n return html`\n
  • \n -1 && this.activeIndex === idx\n ? 'active'\n : ''}\"\n >\n ${opt.label}\n (#${opt.id})\n ${status.label\n ? html`${status.label}`\n : null}\n ${opt.user ? svg : null}\n \n
  • \n `;\n }\n}\n\nwindow.customElements.define('dt-connection', DtConnection);\n"],"names":["window","customElements","define","DtTags","styles","super","css","_clickOption","e","target","value","id","parseInt","option","this","filteredOptions","reduce","result","opt","_select","_clearSearch","_clickAddNew","dataset","label","isNew","input","shadowRoot","querySelector","_keyboardSelectOption","activeIndex","length","query","_remove","event","CustomEvent","detail","field","name","oldValue","map","i","val","delete","newValue","dispatchEvent","open","focus","_filterOptions","selectedValues","filter","v","options","includes","toLocaleLowerCase","loading","self","bubbles","postType","onSuccess","onError","error","console","warn","_renderSelectedOptions","html","link","status","color","disabled","_renderOption","idx","svg","key","_touchStart","_touchMove","_touchEnd","user"],"mappings":"8bA4OAA,OAAOC,eAAeC,OAAO,gBAzOtB,cAA2BC,EACrBC,oBACT,MAAO,IACFC,MAAMD,OACTE,CAAG,4aAoCN,CAEDC,aAAaC,GACX,GAAIA,EAAEC,QAAUD,EAAE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AET7D,KAAKe,aAAe,GAAKf,KAAKe,cAAgByC,EACnD,SACA,2BAEkBpD,EAAIK,8CACML,EAAIP,cAClCuD,EAAO3C,MACLyC,CAAI,wBAAwBE,EAAO3C,eACnC,QACFL,EAAI0D,KAAOL,EAAM,oBAI1B"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-copy-text/dt-copy-text.js b/dt-assets/build/components/form/dt-copy-text/dt-copy-text.js index e854100a04..b5a579fd0f 100644 --- a/dt-assets/build/components/form/dt-copy-text/dt-copy-text.js +++ b/dt-assets/build/components/form/dt-copy-text/dt-copy-text.js @@ -1 +1,57 @@ -import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{i as o}from"../../style-map-ac85d91b.js";import{D as r}from"../../dt-base.js";import"../dt-label/dt-label.js";import"../../directive-de55b00a.js";import"../../lit-localize-763e4978.js";window.customElements.define("dt-copy-text",class extends r{static get styles(){return t`:root{font-size:inherit}.copy-text{--dt-form-text-color:#575757;display:flex;align-items:center;position:relative;width:calc(100% + 20px)}.copy-text__input{flex:1}.copy_icon{cursor:copy;font-size:16px;display:block;transform:translate(-24px,-5px);width:20px}:host([dir=rtl]) .copy_icon{transform:translate(24px,-5px)}`}static get properties(){return{value:{type:String},success:{type:Boolean},error:{type:Boolean}}}get inputStyles(){return this.success?{"--dt-text-border-color":"var(--copy-text-success-color, var(--success-color))","--dt-form-text-color":"var( --copy-text-success-color, var(--success-color))",color:"var( --copy-text-success-color, var(--success-color))"}:this.error?{"---dt-text-border-color":"var(--copy-text-alert-color, var(--alert-color))","--dt-form-text-color":"var(--copy-text-alert-color, var(--alert-color))"}:{}}get icon(){return this.success?"ic:round-check":"ic:round-content-copy"}async copy(){try{this.success=!1,this.error=!1,await navigator.clipboard.writeText(this.value),this.success=!0,this.error=!1}catch(t){console.log(t),this.success=!1,this.error=!0}}render(){return e`
    `}}); +import { i as t, y as e } from '../../lit-element-2409d5fe.js'; +import { i as o } from '../../style-map-ac85d91b.js'; +import { D as r } from '../../dt-base.js'; +import '../dt-label/dt-label.js'; +import '../../directive-de55b00a.js'; +import '../../lit-localize-763e4978.js'; +window.customElements.define( + 'dt-copy-text', + class extends r { + static get styles() { + return t`:root{font-size:inherit}.copy-text{--dt-form-text-color:#575757;display:flex;align-items:center;position:relative;width:calc(100% + 20px)}.copy-text__input{flex:1}.copy_icon{cursor:copy;font-size:16px;display:block;transform:translate(-24px,-5px);width:20px}:host([dir=rtl]) .copy_icon{transform:translate(24px,-5px)}`; + } + static get properties() { + return { + value: { type: String }, + success: { type: Boolean }, + error: { type: Boolean }, + }; + } + get inputStyles() { + return this.success + ? { + '--dt-text-border-color': + 'var(--copy-text-success-color, var(--success-color))', + '--dt-form-text-color': + 'var( --copy-text-success-color, var(--success-color))', + color: 'var( --copy-text-success-color, var(--success-color))', + } + : this.error + ? { + '---dt-text-border-color': + 'var(--copy-text-alert-color, var(--alert-color))', + '--dt-form-text-color': + 'var(--copy-text-alert-color, var(--alert-color))', + } + : {}; + } + get icon() { + return this.success ? 'ic:round-check' : 'ic:round-content-copy'; + } + async copy() { + try { + (this.success = !1), + (this.error = !1), + await navigator.clipboard.writeText(this.value), + (this.success = !0), + (this.error = !1); + } catch (t) { + console.log(t), (this.success = !1), (this.error = !0); + } + } + render() { + return e`
    `; + } + }, +); +//# sourceMappingURL=dt-copy-text.js.map diff --git a/dt-assets/build/components/form/dt-copy-text/dt-copy-text.js.map b/dt-assets/build/components/form/dt-copy-text/dt-copy-text.js.map new file mode 100644 index 0000000000..fe8e456df9 --- /dev/null +++ b/dt-assets/build/components/form/dt-copy-text/dt-copy-text.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-copy-text.js","sources":["../../../src/components/form/dt-copy-text/dt-copy-text.js"],"sourcesContent":["import { css, html } from 'lit';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport DtBase from '../../dt-base.js';\nimport DtFormBase from '../dt-form-base.js';\n\nexport class DtCopyText extends DtBase {\n static get styles() {\n return css`\n :root {\n font-size: inherit;\n }\n\n .copy-text {\n --dt-form-text-color: #575757;\n display: flex;\n align-items: center;\n position: relative;\n width: calc(100% + 20px);\n }\n\n .copy-text__input {\n flex: 1;\n }\n\n .copy_icon {\n cursor: copy;\n font-size: 16px;\n display: block;\n transform: translate(-24px, -5px);\n width: 20px;\n }\n\n :host([dir='rtl']) .copy_icon {\n transform: translate(24px, -5px);\n }\n `;\n }\n\n static get properties() {\n return {\n value: { type: String },\n success: { type: Boolean },\n error: { type: Boolean },\n };\n }\n\n get inputStyles() {\n if (this.success) {\n return {\n '--dt-text-border-color':\n 'var(--copy-text-success-color, var(--success-color))',\n '--dt-form-text-color':\n 'var( --copy-text-success-color, var(--success-color))',\n color: 'var( --copy-text-success-color, var(--success-color))',\n };\n }\n if (this.error) {\n return {\n '---dt-text-border-color':\n 'var(--copy-text-alert-color, var(--alert-color))',\n '--dt-form-text-color':\n 'var(--copy-text-alert-color, var(--alert-color))',\n };\n }\n\n return {};\n }\n\n get icon() {\n return this.success ? 'ic:round-check' : 'ic:round-content-copy';\n }\n\n async copy() {\n try {\n this.success = false;\n this.error = false;\n await navigator.clipboard.writeText(this.value);\n this.success = true;\n this.error = false;\n } catch (err) {\n console.log(err);\n this.success = false;\n this.error = true;\n }\n }\n\n render() {\n return html`\n
    \n \n \n
    \n `;\n }\n}\n\nwindow.customElements.define('dt-copy-text', DtCopyText);\n"],"names":["window","customElements","define","DtBase","styles","css","properties","value","type","String","success","Boolean","error","inputStyles","this","color","icon","async","navigator","clipboard","writeText","err","console","log","render","html","styleMap","copy"],"mappings":"yPAwGAA,OAAOC,eAAeC,OAAO,eAnGtB,cAAyBC,EACnBC,oBACT,OAAOC,CAAG,+TA6BX,CAEUC,wBACT,MAAO,CACLC,MAAO,CAAEC,KAAMC,QACfC,QAAS,CAAEF,KAAMG,SACjBC,MAAO,CAAEJ,KAAMG,SAElB,CAEGE,kBACF,OAAIC,KAAKJ,QACA,CACL,yBACE,uDACF,uBACE,wDACFK,MAAO,yDAGPD,KAAKF,MACA,CACL,0BACE,mDACF,uBACE,oDAIC,EACR,CAEGI,WACF,OAAOF,KAAKJ,QAAU,iBAAmB,uBAC1C,CAEDO,aACE,IACEH,KAAKJ,SAAU,EACfI,KAAKF,OAAQ,QACPM,UAAUC,UAAUC,UAAUN,KAAKP,OACzCO,KAAKJ,SAAU,EACfI,KAAKF,OAAQ,CAKd,CAJC,MAAOS,GACPC,QAAQC,IAAIF,GACZP,KAAKJ,SAAU,EACfI,KAAKF,OAAQ,CACd,CACF,CAEDY,SACE,OAAOC,CAAI,iCACsBC,EAASZ,KAAKD,0DAGhCC,KAAKP,yEAKNO,KAAKE,iBACHF,KAAKa,wBAItB"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-date/dt-date.js b/dt-assets/build/components/form/dt-date/dt-date.js index c5d47e7eaf..042de01a07 100644 --- a/dt-assets/build/components/form/dt-date/dt-date.js +++ b/dt-assets/build/components/form/dt-date/dt-date.js @@ -1 +1,59 @@ -import{i as e,y as t}from"../../lit-element-2409d5fe.js";import{D as i}from"../dt-form-base.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";class r extends i{static get styles(){return[...super.styles,e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-form-background-color,#cecece);border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;box-shadow:var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:inline-flex;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);width:100%}.input-group button:disabled,input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-form-disabled-background-color,#e6e6e6);cursor:not-allowed}input::-webkit-calendar-picker-indicator{color:red}.input-group{position:relative;display:inline-flex;margin:0 0 1.0666666667rem;width:100%}.input-group .input-group-button{font-size:.75rem;line-height:1em;display:inline-flex}.input-group .button{display:inline-block;background:var(--dt-form-background-color,#cecece);border:1px solid var(--dt-form-border-color,#cecece);color:var(--alert-color,#cc4b37);align-self:stretch;font-size:1rem;height:auto;padding:0 1em;margin:0}.input-group .button:hover:not([disabled]){background-color:var(--alert-color,#cc4b37);color:var(--text-color-inverse,#fefefe)}.icon-overlay{inset-inline-end:5rem}`]}static get properties(){return{...super.properties,id:{type:String},value:{type:String,reflect:!0},timestamp:{converter:e=>{let t=Number(e);if(t<1e12&&(t*=1e3),t)return t},reflect:!0},onchange:{type:String}}}updateTimestamp(e){const t=new Date(e).getTime(),i=t/1e3,r=new CustomEvent("change",{detail:{field:this.name,oldValue:this.timestamp,newValue:i}});this.timestamp=t,this.value=e,this._setFormValue(e),this.dispatchEvent(r)}_change(e){this.updateTimestamp(e.target.value)}clearInput(){this.updateTimestamp("")}showDatePicker(){this.shadowRoot.querySelector("input").showPicker()}render(){return this.timestamp?this.value=new Date(this.timestamp).toISOString().substring(0,10):this.value&&(this.timestamp=new Date(this.value).getTime()),t`${this.labelTemplate()}
    ${this.touched&&this.invalid||this.error?t``:null} ${this.loading?t``:null} ${this.saved?t``:null}
    `}}window.customElements.define("dt-date",r);export{r as D}; +import { i as e, y as t } from '../../lit-element-2409d5fe.js'; +import { D as i } from '../dt-form-base.js'; +import '../../dt-base.js'; +import '../../lit-localize-763e4978.js'; +import '../dt-label/dt-label.js'; +class r extends i { + static get styles() { + return [ + ...super.styles, + e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-form-background-color,#cecece);border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;box-shadow:var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:inline-flex;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);width:100%}.input-group button:disabled,input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-form-disabled-background-color,#e6e6e6);cursor:not-allowed}input::-webkit-calendar-picker-indicator{color:red}.input-group{position:relative;display:inline-flex;margin:0 0 1.0666666667rem;width:100%}.input-group .input-group-button{font-size:.75rem;line-height:1em;display:inline-flex}.input-group .button{display:inline-block;background:var(--dt-form-background-color,#cecece);border:1px solid var(--dt-form-border-color,#cecece);color:var(--alert-color,#cc4b37);align-self:stretch;font-size:1rem;height:auto;padding:0 1em;margin:0}.input-group .button:hover:not([disabled]){background-color:var(--alert-color,#cc4b37);color:var(--text-color-inverse,#fefefe)}.icon-overlay{inset-inline-end:5rem}`, + ]; + } + static get properties() { + return { + ...super.properties, + id: { type: String }, + value: { type: String, reflect: !0 }, + timestamp: { + converter: (e) => { + let t = Number(e); + if ((t < 1e12 && (t *= 1e3), t)) return t; + }, + reflect: !0, + }, + onchange: { type: String }, + }; + } + updateTimestamp(e) { + const t = new Date(e).getTime(), + i = t / 1e3, + r = new CustomEvent('change', { + detail: { field: this.name, oldValue: this.timestamp, newValue: i }, + }); + (this.timestamp = t), + (this.value = e), + this._setFormValue(e), + this.dispatchEvent(r); + } + _change(e) { + this.updateTimestamp(e.target.value); + } + clearInput() { + this.updateTimestamp(''); + } + showDatePicker() { + this.shadowRoot.querySelector('input').showPicker(); + } + render() { + return ( + this.timestamp + ? (this.value = new Date(this.timestamp).toISOString().substring(0, 10)) + : this.value && (this.timestamp = new Date(this.value).getTime()), + t`${this.labelTemplate()}
    ${(this.touched && this.invalid) || this.error ? t`` : null} ${this.loading ? t`` : null} ${this.saved ? t`` : null}
    ` + ); + } +} +window.customElements.define('dt-date', r); +export { r as D }; +//# sourceMappingURL=dt-date.js.map diff --git a/dt-assets/build/components/form/dt-date/dt-date.js.map b/dt-assets/build/components/form/dt-date/dt-date.js.map new file mode 100644 index 0000000000..92b234c4a7 --- /dev/null +++ b/dt-assets/build/components/form/dt-date/dt-date.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-date.js","sources":["../../../src/components/form/dt-date/dt-date.js"],"sourcesContent":["import { html, css } from 'lit';\nimport DtFormBase from '../dt-form-base.js';\n\nexport class DtDate extends DtFormBase {\n static get styles() {\n return [\n ...super.styles,\n css`\n input {\n color: var(--dt-form-text-color, #000);\n appearance: none;\n background-color: var(--dt-form-background-color, #cecece);\n border: 1px solid var(--dt-form-border-color, #cacaca);\n border-radius: 0;\n box-shadow: var(\n --dt-form-input-box-shadow,\n inset 0 1px 2px hsl(0deg 0% 4% / 10%)\n );\n box-sizing: border-box;\n display: inline-flex;\n font-family: inherit;\n font-size: 1rem;\n font-weight: 300;\n height: 2.5rem;\n line-height: 1.5;\n padding: var(--dt-form-padding, 0.5333333333rem);\n transition: var(\n --dt-form-transition,\n box-shadow 0.5s,\n border-color 0.25s ease-in-out\n );\n width: 100%;\n }\n input:disabled,\n input[readonly],\n textarea:disabled,\n textarea[readonly],\n .input-group button:disabled {\n background-color: var(--dt-form-disabled-background-color, #e6e6e6);\n cursor: not-allowed;\n }\n\n /* input::-webkit-datetime-edit-text { color: red; padding: 0 0.3em; } */\n input::-webkit-calendar-picker-indicator {\n color: red;\n }\n\n .input-group {\n position: relative;\n display: inline-flex;\n margin: 0 0 1.0666666667rem;\n width: 100%;\n }\n\n .input-group .input-group-button {\n font-size: 0.75rem;\n line-height: 1em;\n display: inline-flex;\n }\n .input-group .button {\n display: inline-block;\n background: var(--dt-form-background-color, #cecece);\n border: 1px solid var(--dt-form-border-color, #cecece);\n color: var(--alert-color, #cc4b37);\n align-self: stretch;\n font-size: 1rem;\n height: auto;\n padding: 0 1em;\n margin: 0;\n }\n .input-group .button:hover:not([disabled]) {\n background-color: var(--alert-color, #cc4b37);\n color: var(--text-color-inverse, #fefefe);\n }\n\n .icon-overlay {\n inset-inline-end: 5rem;\n }\n `,\n ];\n }\n\n static get properties() {\n return {\n ...super.properties,\n id: { type: String },\n value: {\n type: String,\n reflect: true,\n },\n timestamp: {\n converter: date => {\n let JStimestamp = Number(date);\n if (JStimestamp < 1000000000000) {\n JStimestamp *= 1000;\n }\n if (JStimestamp) return JStimestamp;\n return undefined;\n },\n reflect: true,\n },\n onchange: { type: String },\n };\n }\n\n // _convertArabicToEnglishNumbers() {\n // this.value\n // .replace(/[\\u0660-\\u0669]/g, (c) => { return c.charCodeAt(0) - 0x0660; })\n // .replace(/[\\u06f0-\\u06f9]/g, (c) => {\n // return c.charCodeAt(0) - 0x06f0;\n // });\n // }\n\n updateTimestamp(value) {\n const timestampMilliseconds = new Date(value).getTime();\n const timestampSecond = timestampMilliseconds / 1000;\n const event = new CustomEvent('change', {\n detail: {\n field: this.name,\n oldValue: this.timestamp,\n newValue: timestampSecond,\n },\n });\n\n this.timestamp = timestampMilliseconds;\n this.value = value;\n this._setFormValue(value);\n this.dispatchEvent(event);\n }\n\n _change(e) {\n this.updateTimestamp(e.target.value);\n }\n\n clearInput() {\n this.updateTimestamp('');\n }\n\n showDatePicker() {\n const input = this.shadowRoot.querySelector('input');\n input.showPicker();\n }\n\n render() {\n if (this.timestamp) {\n this.value = new Date(this.timestamp).toISOString().substring(0, 10);\n } else if (this.value) {\n this.timestamp = new Date(this.value).getTime();\n }\n\n return html`\n ${this.labelTemplate()}\n\n
    \n \n \n x\n \n\n ${(this.touched && this.invalid) || this.error\n ? html``\n : null}\n ${this.loading\n ? html``\n : null}\n ${this.saved\n ? html``\n : null}\n
    \n `;\n }\n}\n\nwindow.customElements.define('dt-date', DtDate);\n"],"names":["DtDate","DtFormBase","styles","super","css","properties","id","type","String","value","reflect","timestamp","converter","date","JStimestamp","Number","onchange","updateTimestamp","timestampMilliseconds","Date","getTime","timestampSecond","event","CustomEvent","detail","field","this","name","oldValue","newValue","_setFormValue","dispatchEvent","_change","e","target","clearInput","showDatePicker","shadowRoot","querySelector","showPicker","render","toISOString","substring","html","labelTemplate","disabled","touched","invalid","error","loading","saved","window","customElements","define"],"mappings":"gMAGO,MAAMA,UAAeC,EACfC,oBACT,MAAO,IACFC,MAAMD,OACTE,CAAG,q0CAy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AGT,EAGHQ,OAAOC,eAAeC,OAAO,UAAWrD"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-datetime/dt-datetime.js b/dt-assets/build/components/form/dt-datetime/dt-datetime.js index a5726c7588..c082ae1e96 100644 --- a/dt-assets/build/components/form/dt-datetime/dt-datetime.js +++ b/dt-assets/build/components/form/dt-datetime/dt-datetime.js @@ -1 +1,28 @@ -import{y as t}from"../../lit-element-2409d5fe.js";import{D as e}from"../dt-date/dt-date.js";import"../dt-form-base.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";window.customElements.define("dt-datetime",class extends e{static get properties(){return{...super.properties,tzoffset:{type:Number}}}constructor(){super(),this.tzoffset=6e4*(new Date).getTimezoneOffset()}render(){return this.timestamp?this.value=new Date(this.timestamp-this.tzoffset).toISOString().substring(0,16):this.value&&(this.timestamp=new Date(this.value).getTime()),t`${this.labelTemplate()}
    ${this.touched&&this.invalid||this.error?t``:null} ${this.loading?t``:null} ${this.saved?t``:null}
    `}}); +import { y as t } from '../../lit-element-2409d5fe.js'; +import { D as e } from '../dt-date/dt-date.js'; +import '../dt-form-base.js'; +import '../../dt-base.js'; +import '../../lit-localize-763e4978.js'; +import '../dt-label/dt-label.js'; +window.customElements.define( + 'dt-datetime', + class extends e { + static get properties() { + return { ...super.properties, tzoffset: { type: Number } }; + } + constructor() { + super(), (this.tzoffset = 6e4 * new Date().getTimezoneOffset()); + } + render() { + return ( + this.timestamp + ? (this.value = new Date(this.timestamp - this.tzoffset) + .toISOString() + .substring(0, 16)) + : this.value && (this.timestamp = new Date(this.value).getTime()), + t`${this.labelTemplate()}
    ${(this.touched && this.invalid) || this.error ? t`` : null} ${this.loading ? t`` : null} ${this.saved ? t`` : null}
    ` + ); + } + }, +); +//# sourceMappingURL=dt-datetime.js.map diff --git a/dt-assets/build/components/form/dt-datetime/dt-datetime.js.map b/dt-assets/build/components/form/dt-datetime/dt-datetime.js.map new file mode 100644 index 0000000000..bbd5260fc2 --- /dev/null +++ b/dt-assets/build/components/form/dt-datetime/dt-datetime.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-datetime.js","sources":["../../../src/components/form/dt-datetime/dt-datetime.js"],"sourcesContent":["import { html } from 'lit';\nimport { DtDate } from '../dt-date/dt-date.js';\n\nexport class DtDatetime extends DtDate {\n static get properties() {\n return {\n ...super.properties,\n tzoffset: { type: Number },\n };\n }\n\n constructor() {\n super();\n this.tzoffset = (new Date()).getTimezoneOffset() * 60000;\n }\n\n render() {\n if (this.timestamp) {\n this.value = new Date(this.timestamp - this.tzoffset).toISOString().substring(0, 16);\n } else if (this.value) {\n this.timestamp = new Date(this.value).getTime();\n }\n\n return html`\n ${this.labelTemplate()}\n\n
    \n \n \n x\n \n\n ${(this.touched && this.invalid) || this.error\n ? html``\n : null}\n ${this.loading\n ? html``\n : null}\n ${this.saved\n ? html``\n : null}\n
    \n `;\n }\n}\n\n window.customElements.define('dt-datetime', DtDatetime);\n"],"names":["window","customElements","define","DtDate","properties","super","tzoffset","type","Number","constructor","this","Date","getTimezoneOffset","render","timestamp","value","toISOString","substring","getTime","html","labelTemplate","id","date","disabled","_change","showDatePicker","clearInput","touched","invalid","error","loading","saved"],"mappings":"uNAmEEA,OAAOC,eAAeC,OAAO,cAhExB,cAAyBC,EACnBC,wBACT,MAAO,IACFC,MAAMD,WACTE,SAAU,CAAEC,KAAMC,QAErB,CAEDC,cACEJ,QACAK,KAAKJ,SAA8C,KAAnC,IAAKK,MAAQC,mBAC9B,CAEDC,SAOE,OANIH,KAAKI,UACPJ,KAAKK,MAAQ,IAAIJ,KAAKD,KAAKI,UAAYJ,KAAKJ,UAAUU,cAAcC,UAAU,EAAG,IACxEP,KAAKK,QACdL,KAAKI,UAAY,IAAIH,KAAKD,KAAKK,OAAOG,WAGjCC,CAAI,GACPT,KAAKU,sDAIGV,KAAKW,wGAIK,IAAIV,MAAOK,0BACjBN,KAAKK,sBACDL,KAAKY,oBACPZ,KAAKa,sBACNb,KAAKc,oBACNd,KAAKe,gCAGTf,KAAKW,yEAEKX,KAAKW,oDAGTX,KAAKa,qBACPb,KAAKgB,0BAKdhB,KAAKiB,SAAWjB,KAAKkB,SAAYlB,KAAKmB,MACrCV,CAAI,6EAGJ,QACFT,KAAKoB,QACHX,CAAI,iDACJ,QACFT,KAAKqB,MACHZ,CAAI,6DACJ,YAGT"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-form-base.js b/dt-assets/build/components/form/dt-form-base.js index 0758fe571e..bd8d3f0b3f 100644 --- a/dt-assets/build/components/form/dt-form-base.js +++ b/dt-assets/build/components/form/dt-form-base.js @@ -1 +1,83 @@ -import{i as t,y as e}from"../lit-element-2409d5fe.js";import{D as i}from"../dt-base.js";import"./dt-label/dt-label.js";import"../lit-localize-763e4978.js";class a extends i{static get formAssociated(){return!0}static get styles(){return[t`.input-group{position:relative}.input-group.disabled{background-color:var(--disabled-color)}.icon-overlay{position:absolute;inset-inline-end:1rem;top:0;height:100%;display:flex;justify-content:center;align-items:center}.icon-overlay.alert{color:var(--alert-color);cursor:pointer}.icon-overlay.success{color:var(--success-color)}`]}static get properties(){return{...super.properties,name:{type:String},label:{type:String},icon:{type:String},iconAltText:{type:String},private:{type:Boolean},privateLabel:{type:String},disabled:{type:Boolean},required:{type:Boolean},requiredMessage:{type:String},touched:{type:Boolean,state:!0},invalid:{type:Boolean,state:!0},error:{type:String},loading:{type:Boolean},saved:{type:Boolean}}}get _field(){return this.shadowRoot.querySelector("input, textarea, select")}get _focusTarget(){return this._field}constructor(){super(),this.touched=!1,this.invalid=!1,this.internals=this.attachInternals(),this.addEventListener("invalid",(()=>{this.touched=!0,this._validateRequired()}))}firstUpdated(...t){super.firstUpdated(...t);const e=a._jsonToFormData(this.value,this.name);this.internals.setFormValue(e),this._validateRequired()}static _buildFormData(t,e,i){if(!e||"object"!=typeof e||e instanceof Date||e instanceof File){const a=e??"";t.append(i,a)}else Object.keys(e).forEach((a=>{this._buildFormData(t,e[a],i?`${i}[${a}]`:a)}))}static _jsonToFormData(t,e){const i=new FormData;return a._buildFormData(i,t,e),i}_setFormValue(t){const e=a._jsonToFormData(t,this.name);this.internals.setFormValue(e,t),this._validateRequired(),this.touched=!0}_validateRequired(){}labelTemplate(){return this.label?e`${this.icon?null:e``} ${this.label}`:""}render(){return e`${this.labelTemplate()}`}}export{a as D}; +import { i as t, y as e } from '../lit-element-2409d5fe.js'; +import { D as i } from '../dt-base.js'; +import './dt-label/dt-label.js'; +import '../lit-localize-763e4978.js'; +class a extends i { + static get formAssociated() { + return !0; + } + static get styles() { + return [ + t`.input-group{position:relative}.input-group.disabled{background-color:var(--disabled-color)}.icon-overlay{position:absolute;inset-inline-end:2rem;top:0;height:100%;display:flex;justify-content:center;align-items:center}.icon-overlay.alert{color:var(--alert-color);cursor:pointer}.icon-overlay.success{color:var(--success-color)}`, + ]; + } + static get properties() { + return { + ...super.properties, + name: { type: String }, + label: { type: String }, + icon: { type: String }, + iconAltText: { type: String }, + private: { type: Boolean }, + privateLabel: { type: String }, + disabled: { type: Boolean }, + required: { type: Boolean }, + requiredMessage: { type: String }, + touched: { type: Boolean, state: !0 }, + invalid: { type: Boolean, state: !0 }, + error: { type: String }, + loading: { type: Boolean }, + saved: { type: Boolean }, + }; + } + get _field() { + return this.shadowRoot.querySelector('input, textarea, select'); + } + get _focusTarget() { + return this._field; + } + constructor() { + super(), + (this.touched = !1), + (this.invalid = !1), + (this.internals = this.attachInternals()), + this.addEventListener('invalid', () => { + (this.touched = !0), this._validateRequired(); + }); + } + firstUpdated(...t) { + super.firstUpdated(...t); + const e = a._jsonToFormData(this.value, this.name); + this.internals.setFormValue(e), this._validateRequired(); + } + static _buildFormData(t, e, i) { + if (!e || 'object' != typeof e || e instanceof Date || e instanceof File) { + const a = e ?? ''; + t.append(i, a); + } else + Object.keys(e).forEach((a) => { + this._buildFormData(t, e[a], i ? `${i}[${a}]` : a); + }); + } + static _jsonToFormData(t, e) { + const i = new FormData(); + return a._buildFormData(i, t, e), i; + } + _setFormValue(t) { + const e = a._jsonToFormData(t, this.name); + this.internals.setFormValue(e, t), + this._validateRequired(), + (this.touched = !0); + } + _validateRequired() {} + labelTemplate() { + return this.label + ? e`${this.icon ? null : e``} ${this.label}` + : ''; + } + render() { + return e`${this.labelTemplate()}`; + } +} +export { a as D }; +//# sourceMappingURL=dt-form-base.js.map diff --git a/dt-assets/build/components/form/dt-form-base.js.map b/dt-assets/build/components/form/dt-form-base.js.map new file mode 100644 index 0000000000..2205482bd9 --- /dev/null +++ b/dt-assets/build/components/form/dt-form-base.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-form-base.js","sources":["../../src/components/form/dt-form-base.js"],"sourcesContent":["import { css, html } from 'lit';\nimport DtBase from '../dt-base.js';\nimport 'element-internals-polyfill'; // eslint-disable-line import/no-extraneous-dependencies\nimport './dt-label/dt-label.js';\n\nexport default class DtFormBase extends DtBase {\n static get formAssociated() {\n return true;\n }\n\n static get styles() {\n return [\n css`\n .input-group {\n position: relative;\n }\n .input-group.disabled {\n background-color: var(--disabled-color);\n }\n\n /* === Inline Icons === */\n .icon-overlay {\n position: absolute;\n inset-inline-end: 2rem;\n top: 0;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .icon-overlay.alert {\n color: var(--alert-color);\n cursor: pointer;\n }\n .icon-overlay.success {\n color: var(--success-color);\n }\n `,\n ];\n }\n\n static get properties() {\n return {\n ...super.properties,\n name: { type: String },\n label: { type: String },\n icon: { type: String },\n iconAltText: { type: String },\n private: { type: Boolean },\n privateLabel: { type: String },\n disabled: { type: Boolean },\n required: { type: Boolean },\n requiredMessage: { type: String },\n touched: {\n type: Boolean,\n state: true,\n },\n invalid: {\n type: Boolean,\n state: true,\n },\n error: { type: String },\n loading: { type: Boolean },\n saved: { type: Boolean },\n };\n }\n\n /**\n * return the field elemnt\n */\n get _field() {\n return this.shadowRoot.querySelector('input, textarea, select');\n }\n\n /**\n * return the element to proxy focus to\n */\n get _focusTarget() {\n return this._field;\n }\n\n constructor() {\n super();\n this.touched = false;\n this.invalid = false;\n this.internals = this.attachInternals();\n\n // catch oninvalid event (when validation is triggered from form submit)\n // and set touched=true so that styles are shown\n this.addEventListener('invalid', () => {\n this.touched = true;\n this._validateRequired();\n });\n }\n\n firstUpdated(...args) {\n super.firstUpdated(...args);\n\n // set initial form value\n const formdata = DtFormBase._jsonToFormData(this.value, this.name);\n this.internals.setFormValue(formdata);\n this._validateRequired();\n }\n\n /**\n * Recursively create FormData from JSON data\n * @param formData\n * @param data\n * @param parentKey\n * @private\n */\n static _buildFormData(formData, data, parentKey) {\n if (data && typeof data === 'object' && !(data instanceof Date) && !(data instanceof File)) {\n Object.keys(data).forEach(key => {\n this._buildFormData(formData, data[key], parentKey ? `${parentKey}[${key}]` : key);\n });\n } else {\n const value = data == null ? '' : data;\n formData.append(parentKey, value);\n }\n }\n\n /**\n * Convert JSON to FormData object\n * @param data\n * @param parentKey - prefix for all values. Should be the field name\n * @returns {FormData}\n * @private\n */\n static _jsonToFormData(data, parentKey) {\n const formData = new FormData();\n DtFormBase._buildFormData(formData, data, parentKey);\n return formData;\n }\n\n _setFormValue(value) {\n // handle complex types like arrays and objects by converting to FormData\n const formdata = DtFormBase._jsonToFormData(value, this.name);\n this.internals.setFormValue(formdata, value);\n this._validateRequired();\n this.touched = true;\n }\n\n /* eslint-disable class-methods-use-this */\n /**\n * Can/should be overriden by each component to implement logic for checking if a value is entered/selected\n * @private\n */\n _validateRequired() {\n // const { value } = this;\n // const input = this.shadowRoot.querySelector('input');\n // if (value === '' && this.required) {\n // this.invalid = true;\n // this.internals.setValidity({\n // valueMissing: true\n // }, this.requiredMessage || 'This field is required', input);\n // } else {\n // this.invalid = false;\n // this.internals.setValidity({});\n // }\n }\n /* eslint-enable class-methods-use-this */\n\n labelTemplate() {\n if (!this.label) {\n return '';\n }\n\n return html`\n \n ${!this.icon\n ? html``\n : null}\n ${this.label}\n \n `;\n }\n\n render() {\n return html`\n ${this.labelTemplate()}\n \n `;\n }\n}\n"],"names":["DtFormBase","DtBase","formAssociated","styles","css","properties","super","name","type","String","label","icon","iconAltText","private","Boolean","privateLabel","disabled","required","requiredMessage","touched","state","invalid","error","loading","saved","_field","this","shadowRoot","querySelector","_focusTarget","constructor","internals","attachInternals","addEventListener","_validateRequired","firstUpdated","args","formdata","_jsonToFormData","value","setFormValue","static","formData","data","parentKey","Date","File","append","Object","keys","forEach","key","_buildFormData","FormData","_setFormValue","labelTemplate","html","render"],"mappings":"2JAKe,MAAMA,UAAmBC,EAC3BC,4BACT,OAAO,CACR,CAEUC,oBACT,MAAO,CACLC,CAAG,2UA4BN,CAEUC,wBACT,MAAO,IACFC,MAAMD,WACTE,KAAM,CAAEC,KAAMC,QACdC,MAAO,CAAEF,KAAMC,QACfE,KAAM,CAAEH,KAAMC,QACdG,YAAa,CAAEJ,KAAMC,QACrBI,QAAS,CAAEL,KAAMM,SACjBC,aAAc,CAAEP,KAAMC,QACtBO,SAAU,CAAER,KAAMM,SAClBG,SAAU,CAAET,KAAMM,SAClBI,gBAAiB,CAAEV,KAAMC,QACzBU,QAAS,CACPX,KAAMM,QACNM,OAAO,GAETC,QAAS,CACPb,KAAMM,QACNM,OAAO,GAETE,MAAO,CAAEd,KAAMC,QACfc,QAAS,CAAEf,KAAMM,SACjBU,MAAO,CAAEhB,KAAMM,SAElB,CAKGW,aACF,OAAOC,KAAKC,WAAWC,cAAc,0BACtC,CAKGC,mBACF,OAAOH,KAAKD,MACb,CAEDK,cACExB,QACAoB,KAAKP,SAAU,EACfO,KAAKL,SAAU,EACfK,KAAKK,UAAYL,KAAKM,kBAItBN,KAAKO,iBAAiB,WAAW,KAC/BP,KAAKP,SAAU,EACfO,KAAKQ,mBAAmB,GAE3B,CAEDC,gBAAgBC,GACd9B,MAAM6B,gBAAgBC,GAGtB,MAAMC,EAAWrC,EAAWsC,gBAAgBZ,KAAKa,MAAOb,KAAKnB,MAC7DmB,KAAKK,UAAUS,aAAaH,GAC5BX,KAAKQ,mBACN,CASDO,sBAAsBC,EAAUC,EAAMC,GACpC,IAAID,GAAwB,iBAATA,GAAuBA,aAAgBE,MAAWF,aAAgBG,KAI9E,CACL,MAAMP,EAA4BI,GAAL,GAC7BD,EAASK,OAAOH,EAAWL,EAC5B,MANCS,OAAOC,KAAKN,GAAMO,SAAQC,IACxBzB,KAAK0B,eAAeV,EAAUC,EAAKQ,GAAMP,EAAY,GAAGA,KAAaO,KAASA,EAAI,GAMvF,CASDV,uBAAuBE,EAAMC,GAC3B,MAAMF,EAAW,IAAIW,SAErB,OADArD,EAAWoD,eAAeV,EAAUC,EAAMC,GACnCF,CACR,CAEDY,cAAcf,GAEZ,MAAMF,EAAWrC,EAAWsC,gBAAgBC,EAAOb,KAAKnB,MACxDmB,KAAKK,UAAUS,aAAaH,EAAUE,GACtCb,KAAKQ,oBACLR,KAAKP,SAAU,CAChB,CAODe,oBAYC,CAGDqB,gBACE,OAAK7B,KAAKhB,MAIH8C,CAAI,uBAEI9B,KAAKb,0BACAa,KAAKX,8BACNW,KAAKd,sBACZc,KAAKf,SAEVe,KAAKf,KAEJ,KADA6C,CAAI,uDAEN9B,KAAKhB,mBAbF,EAgBV,CAED+C,SACE,OAAOD,CAAI,GACP9B,KAAK6B,8BAGV"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-label/dt-label.js b/dt-assets/build/components/form/dt-label/dt-label.js index 5157dd10e7..ceb53e8ea2 100644 --- a/dt-assets/build/components/form/dt-label/dt-label.js +++ b/dt-assets/build/components/form/dt-label/dt-label.js @@ -1 +1,35 @@ -import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{m as o}from"../../lit-localize-763e4978.js";import{D as i}from"../../dt-base.js";window.customElements.define("dt-label",class extends i{static get styles(){return t`:host{font-family:var(--font-family);font-size:var(--dt-label-font-size,14px);font-weight:var(--dt-label-font-weight,700);color:var(--dt-label-color,#000);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon{height:var(--dt-label-font-size,14px);width:auto;display:inline-block}.icon.private{position:relative}.icon.private:hover .tooltip{display:block}.tooltip{display:none;position:absolute;color:var(--dt-label-tooltip-color,#666);background:var(--dt-label-tooltip-background,#eee);top:calc(100% + .5rem);inset-inline-start:-1rem;font-weight:400;padding:.4rem}.tooltip:before{content:'';position:absolute;inset-inline-start:1rem;top:-.5rem;height:0;width:0;border-bottom:.5rem solid var(--dt-label-tooltip-background,#eee);border-inline-start:.5rem solid transparent;border-inline-end:.5rem solid transparent}`}static get properties(){return{icon:{type:String},iconAltText:{type:String},private:{type:Boolean},privateLabel:{type:String}}}firstUpdated(){const t=this.shadowRoot.querySelector("slot[name=icon-start]").assignedElements({flatten:!0});for(const e of t)e.style.height="100%",e.style.width="auto"}get _slottedChildren(){return this.shadowRoot.querySelector("slot").assignedElements({flatten:!0})}render(){const t=e``;return e`
    ${this.icon?e`${this.iconAltText}`:null}${this.private?e`${t} ${this.privateLabel||o("Private Field: Only I can see its content")}`:null}
    `}}); +import { i as t, y as e } from '../../lit-element-2409d5fe.js'; +import { m as o } from '../../lit-localize-763e4978.js'; +import { D as i } from '../../dt-base.js'; +window.customElements.define( + 'dt-label', + class extends i { + static get styles() { + return t`:host{font-family:var(--font-family);font-size:var(--dt-label-font-size,14px);font-weight:var(--dt-label-font-weight,700);color:var(--dt-label-color,#000);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon{height:var(--dt-label-font-size,14px);width:auto;display:inline-block}.icon.private{position:relative}.icon.private:hover .tooltip{display:block}.tooltip{display:none;position:absolute;color:var(--dt-label-tooltip-color,#666);background:var(--dt-label-tooltip-background,#eee);top:calc(100% + .5rem);inset-inline-start:-1rem;font-weight:400;padding:.4rem}.tooltip:before{content:'';position:absolute;inset-inline-start:1rem;top:-.5rem;height:0;width:0;border-bottom:.5rem solid var(--dt-label-tooltip-background,#eee);border-inline-start:.5rem solid transparent;border-inline-end:.5rem solid transparent}`; + } + static get properties() { + return { + icon: { type: String }, + iconAltText: { type: String }, + private: { type: Boolean }, + privateLabel: { type: String }, + }; + } + firstUpdated() { + const t = this.shadowRoot + .querySelector('slot[name=icon-start]') + .assignedElements({ flatten: !0 }); + for (const e of t) (e.style.height = '100%'), (e.style.width = 'auto'); + } + get _slottedChildren() { + return this.shadowRoot + .querySelector('slot') + .assignedElements({ flatten: !0 }); + } + render() { + const t = e``; + return e`
    ${this.icon ? e`${this.iconAltText}` : null}${this.private ? e`${t} ${this.privateLabel || o('Private Field: Only I can see its content')}` : null}
    `; + } + }, +); +//# sourceMappingURL=dt-label.js.map diff --git a/dt-assets/build/components/form/dt-label/dt-label.js.map b/dt-assets/build/components/form/dt-label/dt-label.js.map new file mode 100644 index 0000000000..c9d64089af --- /dev/null +++ b/dt-assets/build/components/form/dt-label/dt-label.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-label.js","sources":["../../../src/components/form/dt-label/dt-label.js"],"sourcesContent":["import { html, css } from 'lit';\nimport { msg } from '@lit/localize';\nimport DtBase from '../../dt-base.js';\n\nexport class DtLabel extends DtBase {\n static get styles() {\n return css`\n :host {\n font-family: var(--font-family);\n font-size: var(--dt-label-font-size, 14px);\n font-weight: var(--dt-label-font-weight, 700);\n color: var(--dt-label-color, #000);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .icon {\n height: var(--dt-label-font-size, 14px);\n width: auto;\n display: inline-block;\n }\n\n .icon.private {\n position: relative;\n }\n .icon.private:hover .tooltip {\n display: block;\n }\n .tooltip {\n display: none;\n position: absolute;\n color: var(--dt-label-tooltip-color, #666);\n background: var(--dt-label-tooltip-background, #eee);\n top: calc(100% + 0.5rem);\n inset-inline-start: -1rem;\n font-weight: normal;\n padding: 0.4rem;\n }\n .tooltip:before {\n content: '';\n position: absolute;\n inset-inline-start: 1rem;\n top: -0.5rem;\n height: 0;\n width: 0;\n border-bottom: 0.5rem solid var(--dt-label-tooltip-background, #eee);\n border-inline-start: 0.5rem solid transparent;\n border-inline-end: 0.5rem solid transparent;\n }\n `;\n }\n\n static get properties() {\n return {\n icon: { type: String },\n iconAltText: { type: String },\n private: { type: Boolean },\n privateLabel: { type: String },\n };\n }\n\n firstUpdated() {\n // handle img or svg content that may be bigger than the space allotted\n const slot = this.shadowRoot.querySelector('slot[name=icon-start]');\n const elements = slot.assignedElements({ flatten: true });\n for (const element of elements) {\n element.style.height = '100%';\n element.style.width = 'auto';\n }\n }\n\n get _slottedChildren() {\n const slot = this.shadowRoot.querySelector('slot');\n return slot.assignedElements({ flatten: true });\n }\n\n render() {\n // prettier-ignore\n const svg = html``;\n return html`\n
    \n \n \n ${this.icon\n ? html`\"${this.iconAltText}\"`\n : null}\n \n \n \n\n ${this.private\n ? html`\n ${svg}\n ${this.privateLabel ||\n msg('Private Field: Only I can see its content')}\n `\n : null}\n
    \n `;\n }\n}\n\nwindow.customElements.define('dt-label', DtLabel);\n"],"names":["window","customElements","define","DtBase","styles","css","properties","icon","type","String","iconAltText","private","Boolean","privateLabel","firstUpdated","elements","this","shadowRoot","querySelector","assignedElements","flatten","element","style","height","width","_slottedChildren","render","svg","html","msg"],"mappings":"iJAyGAA,OAAOC,eAAeC,OAAO,WArGtB,cAAsBC,EAChBC,oBACT,OAAOC,CAAG,yzBA6CX,CAEUC,wBACT,MAAO,CACLC,KAAM,CAAEC,KAAMC,QACdC,YAAa,CAAEF,KAAMC,QACrBE,QAAS,CAAEH,KAAMI,SACjBC,aAAc,CAAEL,KAAMC,QAEzB,CAEDK,eAEE,MACMC,EADOC,KAAKC,WAAWC,cAAc,yBACrBC,iBAAiB,CAAEC,SAAS,IAClD,IAAK,MAAMC,KAAWN,EACpBM,EAAQC,MAAMC,OAAS,OACvBF,EAAQC,MAAME,MAAQ,MAEzB,CAEGC,uBAEF,OADaT,KAAKC,WAAWC,cAAc,QAC/BC,iBAAiB,CAAEC,SAAS,GACzC,CAEDM,SAEE,MAAMC,EAAMC,CAAI,2mDAChB,OAAOA,CAAI,iEAIDZ,KAAKT,KACHqB,CAAI,aAAaZ,KAAKT,cAAcS,KAAKN,gBACzC,kCAKNM,KAAKL,QACHiB,CAAI,8BACAD,2BAEGX,KAAKH,cACRgB,EAAI,6DAGR,YAGT"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-location-map/dt-location-map-item.js b/dt-assets/build/components/form/dt-location-map/dt-location-map-item.js index 8a8952ff68..f5069964e8 100644 --- a/dt-assets/build/components/form/dt-location-map/dt-location-map-item.js +++ b/dt-assets/build/components/form/dt-location-map/dt-location-map-item.js @@ -1 +1,389 @@ -import{s as t,i as e,y as o}from"../../lit-element-2409d5fe.js";import{i}from"../../style-map-ac85d91b.js";import{m as a}from"../../lit-localize-763e4978.js";import"../../icons/dt-icon.js";import"./dt-map-modal.js";import"../../directive-de55b00a.js";import"../../dt-base.js";import"../../layout/dt-modal/dt-modal.js";import"../../class-map-8d921948.js";class s{constructor(t){this.token=t}async searchPlaces(t,e="en"){const o=new URLSearchParams({types:["country","region","postcode","district","place","locality","neighborhood","address"],limit:6,access_token:this.token,language:e}),i=`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURI(t)}.json?${o}`,a=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"}});return(await a.json())?.features}async reverseGeocode(t,e,o="en"){const i=new URLSearchParams({types:["country","region","postcode","district","place","locality","neighborhood","address"],access_token:this.token,language:o}),a=`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURI(t)},${encodeURI(e)}.json?${i}`,s=await fetch(a,{method:"GET",headers:{"Content-Type":"application/json"}});return(await s.json())?.features}}class n{constructor(t,e,o){if(this.token=t,this.window=e,!e.google?.maps?.places?.AutocompleteService){let e=o.createElement("script");e.src=`https://maps.googleapis.com/maps/api/js?libraries=places&key=${t}`,o.body.appendChild(e)}}async getPlacePredictions(t,e="en"){if(this.window.google){const o=new this.window.google.maps.places.AutocompleteService,{predictions:i}=await o.getPlacePredictions({input:t,language:e});return i}return null}async getPlaceDetails(t,e="en"){const o=`https://maps.googleapis.com/maps/api/geocode/json?${new URLSearchParams({key:this.token,address:t,language:e})}`,i=await fetch(o,{method:"GET"}),a=await i.json();let s=[];if("OK"===a.status)s=a.results;return s&&s.length?s[0]:null}async reverseGeocode(t,e,o="en"){const i=`https://maps.googleapis.com/maps/api/geocode/json?${new URLSearchParams({key:this.token,latlng:`${e},${t}`,language:o,result_type:["point_of_interest","establishment","premise","street_address","neighborhood","sublocality","locality","colloquial_area","political","country"].join("|")})}`,a=await fetch(i,{method:"GET"});return(await a.json())?.results}}window.customElements.define("dt-location-map-item",class extends t{static get properties(){return{id:{type:String,reflect:!0},placeholder:{type:String},mapboxToken:{type:String,attribute:"mapbox-token"},googleToken:{type:String,attribute:"google-token"},metadata:{type:Object},disabled:{type:Boolean},open:{type:Boolean,state:!0},query:{type:String,state:!0},activeIndex:{type:Number,state:!0},containerHeight:{type:Number,state:!0},loading:{type:Boolean},saved:{type:Boolean},filteredOptions:{type:Array,state:!0}}}static get styles(){return[e`:host{position:relative;font-family:Helvetica,Arial,sans-serif;display:block}.input-group{color:var(--dt-multi-select-text-color,#0a0a0a);margin-bottom:1rem}.input-group.disabled .field-container,.input-group.disabled input{background-color:var(--disabled-color)}.input-group.disabled a,.input-group.disabled button{cursor:not-allowed;pointer-events:none}.input-group.disabled :hover{cursor:not-allowed}.option-list{list-style:none;margin:0;padding:0;border:1px solid var(--dt-form-border-color,#cacaca);background:var(--dt-form-background-color,#fefefe);z-index:10;position:absolute;width:var(--container-width,100%);width:100%;top:0;left:0;box-shadow:var(--shadow-1);max-height:150px;overflow-y:scroll}.option-list li{border-block-start:1px solid var(--dt-form-border-color,#cacaca);outline:0}.option-list li button,.option-list li div{padding:.5rem .75rem;color:var(--dt-multi-select-text-color,#0a0a0a);font-weight:100;font-size:1rem;text-decoration:none;text-align:inherit}.option-list li button{display:block;width:100%;border:0;background:0 0}.option-list li button.active,.option-list li button:hover{cursor:pointer;background:var(--dt-multi-select-option-hover-background,#f5f5f5)}`,e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-location-map-background-color,#fefefe);border:1px solid var(--dt-location-map-border-color,#fefefe);border-radius:var(--dt-location-map-border-radius,0);box-shadow:var(--dt-location-map-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;line-height:1.5;margin:0;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out)}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-text-disabled-background-color,var(--dt-form-disabled-background-color,#e6e6e6));cursor:not-allowed}input.disabled{color:var(--dt-text-placeholder-color,#999)}input:focus-visible,input:focus-within{outline:0}input::placeholder{color:var(--dt-text-placeholder-color,#999);text-transform:var(--dt-text-placeholder-transform,none);font-size:var(--dt-text-placeholder-font-size,1rem);font-weight:var(--dt-text-placeholder-font-weight,400);letter-spacing:var(--dt-text-placeholder-letter-spacing,normal)}input.invalid{border-color:var(--dt-text-border-color-alert,var(--alert-color))}.field-container{display:flex;margin-bottom:.5rem}.field-container input{flex-grow:1}.field-container .input-addon{flex-shrink:1;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1;padding:10px;border:solid 1px gray;border-collapse:collapse;color:var(--dt-location-map-button-color,#cc4b37);background-color:var(--dt-location-map-background-color,buttonface);border:1px solid var(--dt-location-map-border-color,#fefefe);border-radius:var(--dt-location-map-border-radius,0);box-shadow:var(--dt-location-map-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)))}.field-container .input-addon:hover{background-color:var(--dt-location-map-button-hover-background-color,#cc4b37);color:var(--dt-location-map-button-hover-color,#fff)}.input-addon:disabled{background-color:var(--dt-form-disabled-background-color);color:var(--dt-text-placeholder-color,#999)}.input-addon:disabled:hover{background-color:var(--dt-form-disabled-background-color);color:var(--dt-text-placeholder-color,#999);cursor:not-allowed}`,e`.icon-overlay{position:absolute;inset-inline-end:1rem;top:0;inset-inline-end:3rem;height:100%;display:flex;justify-content:center;align-items:center}.icon-overlay.alert{color:var(--alert-color)}.icon-overlay.success{color:var(--success-color)}`]}constructor(){super(),this.activeIndex=-1,this.filteredOptions=[],this.detectTap=!1,this.debounceTimer=null}connectedCallback(){super.connectedCallback(),this.addEventListener("autofocus",(async t=>{await this.updateComplete;const e=this.shadowRoot.querySelector("input");e&&e.focus()})),this.mapboxToken&&(this.mapboxService=new s(this.mapboxToken)),this.googleToken&&(this.googleGeocodeService=new n(this.googleToken,window,document))}updated(t){this._scrollOptionListToActive();const e=this.shadowRoot.querySelector(".input-group");e.style.getPropertyValue("--container-width")||e.style.setProperty("--container-width",`${e.clientWidth}px`)}_scrollOptionListToActive(){const t=this.shadowRoot.querySelector(".option-list"),e=this.shadowRoot.querySelector("button.active");if(t&&e){const o=e.offsetTop,i=e.offsetTop+e.clientHeight,a=t.scrollTop;i>t.scrollTop+t.clientHeight?t.scrollTo({top:i-t.clientHeight,behavior:"smooth"}):o-1&&(this.activeIndex({label:t.description,place_id:t.place_id,source:"user",raw:t}))),this.loading=!1}catch(t){return console.error(t),this.error=!0,void(this.loading=!1)}}else if(this.mapboxToken&&this.mapboxService){this.loading=!0;const t=await this.mapboxService.searchPlaces(this.query,this.locale);this.filteredOptions=t.map((t=>({lng:t.center[0],lat:t.center[1],level:t.place_type[0],label:t.place_name,source:"user"}))),this.loading=!1}return this.filteredOptions}willUpdate(t){if(super.willUpdate(t),t){if(t.has("query")&&(this.error=!1,clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>this._filterOptions()),300)),!this.containerHeight&&this.shadowRoot.children&&this.shadowRoot.children.length){const t=this.shadowRoot.querySelector(".input-group");t&&(this.containerHeight=t.offsetHeight)}}}_change(){}_delete(){const t={detail:{metadata:this.metadata},bubbles:!1};this.dispatchEvent(new CustomEvent("delete",t))}_openMapModal(){this.shadowRoot.querySelector("dt-map-modal").dispatchEvent(new Event("open"))}async _onMapModalSubmit(t){if(t?.detail?.location?.lat){const{location:e}=t?.detail,{lat:o,lng:i}=e;if(this.googleGeocodeService){const t=await this.googleGeocodeService.reverseGeocode(i,o,this.locale);if(t&&t.length){const e=t[0];this._select({lng:e.geometry.location.lng,lat:e.geometry.location.lat,level:e.types&&e.types.length?e.types[0]:null,label:e.formatted_address,source:"user"})}}else if(this.mapboxService){const t=await this.mapboxService.reverseGeocode(i,o,this.locale);if(t&&t.length){const e=t[0];this._select({lng:e.center[0],lat:e.center[1],level:e.place_type[0],label:e.place_name,source:"user"})}}}}_renderOption(t,e,i){return o`
  • `}_renderOptions(){let t=[];return this.filteredOptions.length?t.push(...this.filteredOptions.map(((t,e)=>this._renderOption(t,e)))):this.loading?t.push(o`
  • ${a("Loading...")}
  • `):t.push(o`
  • ${a("No Data Available")}
  • `),t.push(this._renderOption({value:this.query,label:this.query},(this.filteredOptions||[]).length,o`${a("Use")}: "${this.query}"`)),t}render(){const t={display:this.open?"block":"none",top:this.containerHeight?`${this.containerHeight}px`:"2.5rem"},e=!!this.metadata?.label,a=this.metadata?.lat&&this.metadata?.lng;return o`
    ${e&&a?o``:null} ${e?o``:o``}
      ${this._renderOptions()}
    ${this.touched&&this.invalid||this.error?o``:null} ${this.loading?o``:null} ${this.saved?o``:null}
    `}}); +import { s as t, i as e, y as o } from '../../lit-element-2409d5fe.js'; +import { i } from '../../style-map-ac85d91b.js'; +import { m as a } from '../../lit-localize-763e4978.js'; +import '../../icons/dt-icon.js'; +import './dt-map-modal.js'; +import '../../directive-de55b00a.js'; +import '../../dt-base.js'; +import '../../layout/dt-modal/dt-modal.js'; +import '../../class-map-8d921948.js'; +class s { + constructor(t) { + this.token = t; + } + async searchPlaces(t, e = 'en') { + const o = new URLSearchParams({ + types: [ + 'country', + 'region', + 'postcode', + 'district', + 'place', + 'locality', + 'neighborhood', + 'address', + ], + limit: 6, + access_token: this.token, + language: e, + }), + i = `https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURI(t)}.json?${o}`, + a = await fetch(i, { + method: 'GET', + headers: { 'Content-Type': 'application/json' }, + }); + return (await a.json())?.features; + } + async reverseGeocode(t, e, o = 'en') { + const i = new URLSearchParams({ + types: [ + 'country', + 'region', + 'postcode', + 'district', + 'place', + 'locality', + 'neighborhood', + 'address', + ], + access_token: this.token, + language: o, + }), + a = `https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURI(t)},${encodeURI(e)}.json?${i}`, + s = await fetch(a, { + method: 'GET', + headers: { 'Content-Type': 'application/json' }, + }); + return (await s.json())?.features; + } +} +class n { + constructor(t, e, o) { + if ( + ((this.token = t), + (this.window = e), + !e.google?.maps?.places?.AutocompleteService) + ) { + let e = o.createElement('script'); + (e.src = `https://maps.googleapis.com/maps/api/js?libraries=places&key=${t}`), + o.body.appendChild(e); + } + } + async getPlacePredictions(t, e = 'en') { + if (this.window.google) { + const o = new this.window.google.maps.places.AutocompleteService(), + { predictions: i } = await o.getPlacePredictions({ + input: t, + language: e, + }); + return i; + } + return null; + } + async getPlaceDetails(t, e = 'en') { + const o = `https://maps.googleapis.com/maps/api/geocode/json?${new URLSearchParams({ key: this.token, address: t, language: e })}`, + i = await fetch(o, { method: 'GET' }), + a = await i.json(); + let s = []; + if ('OK' === a.status) s = a.results; + return s && s.length ? s[0] : null; + } + async reverseGeocode(t, e, o = 'en') { + const i = `https://maps.googleapis.com/maps/api/geocode/json?${new URLSearchParams({ key: this.token, latlng: `${e},${t}`, language: o, result_type: ['point_of_interest', 'establishment', 'premise', 'street_address', 'neighborhood', 'sublocality', 'locality', 'colloquial_area', 'political', 'country'].join('|') })}`, + a = await fetch(i, { method: 'GET' }); + return (await a.json())?.results; + } +} +window.customElements.define( + 'dt-location-map-item', + class extends t { + static get properties() { + return { + id: { type: String, reflect: !0 }, + placeholder: { type: String }, + mapboxToken: { type: String, attribute: 'mapbox-token' }, + googleToken: { type: String, attribute: 'google-token' }, + metadata: { type: Object }, + disabled: { type: Boolean }, + open: { type: Boolean, state: !0 }, + query: { type: String, state: !0 }, + activeIndex: { type: Number, state: !0 }, + containerHeight: { type: Number, state: !0 }, + loading: { type: Boolean }, + saved: { type: Boolean }, + filteredOptions: { type: Array, state: !0 }, + }; + } + static get styles() { + return [ + e`:host{position:relative;font-family:Helvetica,Arial,sans-serif;display:block}.input-group{color:var(--dt-multi-select-text-color,#0a0a0a);margin-bottom:1rem}.input-group.disabled .field-container,.input-group.disabled input{background-color:var(--disabled-color)}.input-group.disabled a,.input-group.disabled button{cursor:not-allowed;pointer-events:none}.input-group.disabled :hover{cursor:not-allowed}.option-list{list-style:none;margin:0;padding:0;border:1px solid var(--dt-form-border-color,#cacaca);background:var(--dt-form-background-color,#fefefe);z-index:10;position:absolute;width:var(--container-width,100%);width:100%;top:0;left:0;box-shadow:var(--shadow-1);max-height:150px;overflow-y:scroll}.option-list li{border-block-start:1px solid var(--dt-form-border-color,#cacaca);outline:0}.option-list li button,.option-list li div{padding:.5rem .75rem;color:var(--dt-multi-select-text-color,#0a0a0a);font-weight:100;font-size:1rem;text-decoration:none;text-align:inherit}.option-list li button{display:block;width:100%;border:0;background:0 0}.option-list li button.active,.option-list li button:hover{cursor:pointer;background:var(--dt-multi-select-option-hover-background,#f5f5f5)}`, + e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-location-map-background-color,#fefefe);border:1px solid var(--dt-location-map-border-color,#fefefe);border-radius:var(--dt-location-map-border-radius,0);box-shadow:var(--dt-location-map-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;line-height:1.5;margin:0;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out)}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-text-disabled-background-color,var(--dt-form-disabled-background-color,#e6e6e6));cursor:not-allowed}input.disabled{color:var(--dt-text-placeholder-color,#999)}input:focus-visible,input:focus-within{outline:0}input::placeholder{color:var(--dt-text-placeholder-color,#999);text-transform:var(--dt-text-placeholder-transform,none);font-size:var(--dt-text-placeholder-font-size,1rem);font-weight:var(--dt-text-placeholder-font-weight,400);letter-spacing:var(--dt-text-placeholder-letter-spacing,normal)}input.invalid{border-color:var(--dt-text-border-color-alert,var(--alert-color))}.field-container{display:flex;margin-bottom:.5rem}.field-container input{flex-grow:1}.field-container .input-addon{flex-shrink:1;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1;padding:10px;border:solid 1px gray;border-collapse:collapse;color:var(--dt-location-map-button-color,#cc4b37);background-color:var(--dt-location-map-background-color,buttonface);border:1px solid var(--dt-location-map-border-color,#fefefe);border-radius:var(--dt-location-map-border-radius,0);box-shadow:var(--dt-location-map-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)))}.field-container .input-addon:hover{background-color:var(--dt-location-map-button-hover-background-color,#cc4b37);color:var(--dt-location-map-button-hover-color,#fff)}.input-addon:disabled{background-color:var(--dt-form-disabled-background-color);color:var(--dt-text-placeholder-color,#999)}.input-addon:disabled:hover{background-color:var(--dt-form-disabled-background-color);color:var(--dt-text-placeholder-color,#999);cursor:not-allowed}`, + e`.icon-overlay{position:absolute;inset-inline-end:1rem;top:0;inset-inline-end:3rem;height:100%;display:flex;justify-content:center;align-items:center}.icon-overlay.alert{color:var(--alert-color)}.icon-overlay.success{color:var(--success-color)}`, + ]; + } + constructor() { + super(), + (this.activeIndex = -1), + (this.filteredOptions = []), + (this.detectTap = !1), + (this.debounceTimer = null); + } + connectedCallback() { + super.connectedCallback(), + this.addEventListener('autofocus', async (t) => { + await this.updateComplete; + const e = this.shadowRoot.querySelector('input'); + e && e.focus(); + }), + this.mapboxToken && (this.mapboxService = new s(this.mapboxToken)), + this.googleToken && + (this.googleGeocodeService = new n( + this.googleToken, + window, + document, + )); + } + updated(t) { + this._scrollOptionListToActive(); + const e = this.shadowRoot.querySelector('.input-group'); + e.style.getPropertyValue('--container-width') || + e.style.setProperty('--container-width', `${e.clientWidth}px`); + } + _scrollOptionListToActive() { + const t = this.shadowRoot.querySelector('.option-list'), + e = this.shadowRoot.querySelector('button.active'); + if (t && e) { + const o = e.offsetTop, + i = e.offsetTop + e.clientHeight, + a = t.scrollTop; + i > t.scrollTop + t.clientHeight + ? t.scrollTo({ top: i - t.clientHeight, behavior: 'smooth' }) + : o < a && t.scrollTo({ top: o, behavior: 'smooth' }); + } + } + _clickOption(t) { + const e = t.currentTarget ?? t.target; + e && e.value && this._select(JSON.parse(e.value)); + } + _touchStart(t) { + t.target && (this.detectTap = !1); + } + _touchMove(t) { + t.target && (this.detectTap = !0); + } + _touchEnd(t) { + this.detectTap || + (t.target && t.target.value && this._clickOption(t), + (this.detectTap = !1)); + } + _keyboardSelectOption() { + this.activeIndex > -1 && + (this.activeIndex < this.filteredOptions.length + ? this._select(this.filteredOptions[this.activeIndex]) + : this._select({ value: this.query, label: this.query })); + } + async _select(t) { + if (t.place_id && this.googleGeocodeService) { + this.loading = !0; + const e = await this.googleGeocodeService.getPlaceDetails( + t.label, + this.locale, + ); + (this.loading = !1), + e && + ((t.lat = e.geometry.location.lat), + (t.lng = e.geometry.location.lng), + (t.level = e.types && e.types.length ? e.types[0] : null)); + } + const e = { detail: { metadata: t }, bubbles: !1 }; + this.dispatchEvent(new CustomEvent('select', e)), (this.metadata = t); + const o = this.shadowRoot.querySelector('input'); + o && (o.value = t?.label), (this.open = !1), (this.activeIndex = -1); + } + get _focusTarget() { + let t = this._field; + return ( + this.metadata && (t = this.shadowRoot.querySelector('button') || t), t + ); + } + _inputFocusIn() { + this.activeIndex = -1; + } + _inputFocusOut(t) { + (t.relatedTarget && + ['BUTTON', 'LI'].includes(t.relatedTarget.nodeName)) || + (this.open = !1); + } + _inputKeyDown(t) { + switch (t.keyCode || t.which) { + case 38: + (this.open = !0), this._listHighlightPrevious(); + break; + case 40: + (this.open = !0), this._listHighlightNext(); + break; + case 9: + this.activeIndex < 0 ? (this.open = !1) : t.preventDefault(), + this._keyboardSelectOption(); + break; + case 13: + this._keyboardSelectOption(); + break; + case 27: + (this.open = !1), (this.activeIndex = -1); + break; + default: + this.open = !0; + } + } + _inputKeyUp(t) { + const e = t.keyCode || t.which; + t.target.value && ![9, 13].includes(e) && (this.open = !0), + (this.query = t.target.value); + } + _listHighlightNext() { + this.activeIndex = Math.min( + this.filteredOptions.length, + this.activeIndex + 1, + ); + } + _listHighlightPrevious() { + this.activeIndex = Math.max(0, this.activeIndex - 1); + } + async _filterOptions() { + if (this.query) + if (this.googleToken && this.googleGeocodeService) { + this.loading = !0; + try { + const t = await this.googleGeocodeService.getPlacePredictions( + this.query, + this.locale, + ); + (this.filteredOptions = (t || []).map((t) => ({ + label: t.description, + place_id: t.place_id, + source: 'user', + raw: t, + }))), + (this.loading = !1); + } catch (t) { + return ( + console.error(t), (this.error = !0), void (this.loading = !1) + ); + } + } else if (this.mapboxToken && this.mapboxService) { + this.loading = !0; + const t = await this.mapboxService.searchPlaces( + this.query, + this.locale, + ); + (this.filteredOptions = t.map((t) => ({ + lng: t.center[0], + lat: t.center[1], + level: t.place_type[0], + label: t.place_name, + source: 'user', + }))), + (this.loading = !1); + } + return this.filteredOptions; + } + willUpdate(t) { + if ((super.willUpdate(t), t)) { + if ( + (t.has('query') && + ((this.error = !1), + clearTimeout(this.debounceTimer), + (this.debounceTimer = setTimeout( + () => this._filterOptions(), + 300, + ))), + !this.containerHeight && + this.shadowRoot.children && + this.shadowRoot.children.length) + ) { + const t = this.shadowRoot.querySelector('.input-group'); + t && (this.containerHeight = t.offsetHeight); + } + } + } + _change() {} + _delete() { + const t = { detail: { metadata: this.metadata }, bubbles: !1 }; + this.dispatchEvent(new CustomEvent('delete', t)); + } + _openMapModal() { + this.shadowRoot + .querySelector('dt-map-modal') + .dispatchEvent(new Event('open')); + } + async _onMapModalSubmit(t) { + if (t?.detail?.location?.lat) { + const { location: e } = t?.detail, + { lat: o, lng: i } = e; + if (this.googleGeocodeService) { + const t = await this.googleGeocodeService.reverseGeocode( + i, + o, + this.locale, + ); + if (t && t.length) { + const e = t[0]; + this._select({ + lng: e.geometry.location.lng, + lat: e.geometry.location.lat, + level: e.types && e.types.length ? e.types[0] : null, + label: e.formatted_address, + source: 'user', + }); + } + } else if (this.mapboxService) { + const t = await this.mapboxService.reverseGeocode(i, o, this.locale); + if (t && t.length) { + const e = t[0]; + this._select({ + lng: e.center[0], + lat: e.center[1], + level: e.place_type[0], + label: e.place_name, + source: 'user', + }); + } + } + } + } + _renderOption(t, e, i) { + return o`
  • `; + } + _renderOptions() { + let t = []; + return ( + this.filteredOptions.length + ? t.push( + ...this.filteredOptions.map((t, e) => this._renderOption(t, e)), + ) + : this.loading + ? t.push(o`
  • ${a('Loading...')}
  • `) + : t.push(o`
  • ${a('No Data Available')}
  • `), + t.push( + this._renderOption( + { value: this.query, label: this.query }, + (this.filteredOptions || []).length, + o`${a('Use')}: "${this.query}"`, + ), + ), + t + ); + } + render() { + const t = { + display: this.open ? 'block' : 'none', + top: this.containerHeight ? `${this.containerHeight}px` : '2.5rem', + }, + e = !!this.metadata?.label, + a = this.metadata?.lat && this.metadata?.lng; + return o`
    ${e && a ? o`` : null} ${e ? o`` : o``}
      ${this._renderOptions()}
    ${(this.touched && this.invalid) || this.error ? o`` : null} ${this.loading ? o`` : null} ${this.saved ? o`` : null}
    `; + } + }, +); +//# sourceMappingURL=dt-location-map-item.js.map diff --git a/dt-assets/build/components/form/dt-location-map/dt-location-map-item.js.map b/dt-assets/build/components/form/dt-location-map/dt-location-map-item.js.map new file mode 100644 index 0000000000..7c79f9bb1e --- /dev/null +++ b/dt-assets/build/components/form/dt-location-map/dt-location-map-item.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-location-map-item.js","sources":["../../../src/services/mapboxService.js","../../../src/services/googleGeocodeService.js","../../../src/components/form/dt-location-map/dt-location-map-item.js"],"sourcesContent":["export default class MapboxService {\n constructor(token) {\n this.token = token;\n }\n\n /**\n * Search places via Mapbox API\n * @param query\n * @param language\n * @returns {Promise}\n */\n async searchPlaces(query, language = 'en') {\n const params = new URLSearchParams({\n types: ['country', 'region', 'postcode', 'district', 'place', 'locality', 'neighborhood', 'address'],\n limit: 6,\n access_token: this.token,\n language,\n });\n\n const options = {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n };\n\n const apiUrl = `https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURI(query)}.json?${params}`;\n const response = await fetch(apiUrl, options);\n\n const result = await response.json();\n return result?.features;\n }\n\n /**\n * Reverse geocode a long/lat pair to get place details\n * @param longitude\n * @param latitude\n * @param language\n * @returns {Promise}\n */\n async reverseGeocode(longitude, latitude, language = 'en') {\n const params = new URLSearchParams({\n types: ['country', 'region', 'postcode', 'district', 'place', 'locality', 'neighborhood', 'address'],\n access_token: this.token,\n language,\n });\n\n const options = {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n };\n\n const apiUrl = `https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURI(longitude)},${encodeURI(latitude)}.json?${params}`;\n const response = await fetch(apiUrl, options);\n\n const result = await response.json();\n return result?.features;\n }\n}\n","export default class GoogleGeocodeService {\n constructor(token, window, document) {\n this.token = token;\n this.window = window;\n\n if (!window.google?.maps?.places?.AutocompleteService) {\n let script = document.createElement('script');\n script.src = `https://maps.googleapis.com/maps/api/js?libraries=places&key=${token}`;\n document.body.appendChild(script);\n }\n }\n\n /**\n * Search places via Mapbox API\n * @param query\n * @returns {Promise}\n */\n async getPlacePredictions(query, language = 'en') {\n if (this.window.google) {\n const service = new this.window.google.maps.places.AutocompleteService();\n const { predictions } = await service.getPlacePredictions({\n input: query,\n language,\n });\n\n return predictions;\n }\n return null;\n }\n\n /**\n * Get details for a given address\n * @param address\n * @param language\n * @returns {Promise}\n */\n async getPlaceDetails(address, language = 'en') {\n const params = new URLSearchParams({\n key: this.token,\n address,\n language,\n });\n const apiUrl = `https://maps.googleapis.com/maps/api/geocode/json?${params}`;\n const response = await fetch(apiUrl, { method: 'GET' });\n\n const data = await response.json();\n let results = [];\n\n // https://developers.google.com/maps/documentation/geocoding/requests-geocoding#StatusCodes\n switch (data.status) {\n case 'OK':\n results = data.results;\n break;\n case 'ZERO_RESULTS':\n default:\n // general error catch\n break;\n }\n\n return results && results.length ? results[0] : null;\n }\n\n /**\n * Reverse geocode a lng/lat pair to get place details\n * @param longitude\n * @param latitude\n * @param language\n * @returns {Promise}\n */\n async reverseGeocode(longitude, latitude, language = 'en') {\n const params = new URLSearchParams({\n key: this.token,\n latlng: `${latitude},${longitude}`,\n language,\n result_type: [\n 'point_of_interest',\n 'establishment',\n 'premise',\n 'street_address',\n 'neighborhood',\n 'sublocality',\n 'locality',\n 'colloquial_area',\n 'political',\n 'country',\n ].join('|')\n });\n const apiUrl = `https://maps.googleapis.com/maps/api/geocode/json?${params}`;\n const response = await fetch(apiUrl, { method: 'GET' });\n\n const result = await response.json();\n return result?.results;\n }\n}\n","import { css, html, LitElement } from 'lit';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { msg } from '@lit/localize';\nimport MapboxService from '../../../services/mapboxService';\nimport GoogleGeocodeService from '../../../services/googleGeocodeService';\nimport '../../icons/dt-icon.js';\nimport './dt-map-modal.js';\n\nexport default class DtLocationMapItem extends LitElement {\n static get properties() {\n return {\n id: { type: String, reflect: true },\n placeholder: { type: String },\n mapboxToken: { type: String, attribute: 'mapbox-token' },\n googleToken: { type: String, attribute: 'google-token' },\n metadata: { type: Object },\n disabled: { type: Boolean },\n open: {\n type: Boolean,\n state: true,\n },\n query: {\n type: String,\n state: true,\n },\n activeIndex: {\n type: Number,\n state: true,\n },\n containerHeight: {\n type: Number,\n state: true,\n },\n loading: { type: Boolean },\n saved: { type: Boolean },\n filteredOptions: { type: Array, state: true },\n };\n }\n\n static get styles() {\n return [\n css`\n :host {\n position: relative;\n font-family: Helvetica, Arial, sans-serif;\n display: block;\n }\n \n .input-group {\n color: var(--dt-multi-select-text-color, #0a0a0a);\n margin-bottom: 1rem;\n }\n .input-group.disabled input,\n .input-group.disabled .field-container {\n background-color: var(--disabled-color);\n }\n .input-group.disabled a,\n .input-group.disabled button {\n cursor: not-allowed;\n pointer-events: none;\n }\n .input-group.disabled *:hover {\n cursor: not-allowed;\n }\n \n /* === Options List === */\n .option-list {\n list-style: none;\n margin: 0;\n padding: 0;\n border: 1px solid var(--dt-form-border-color, #cacaca);\n background: var(--dt-form-background-color, #fefefe);\n z-index: 10;\n position: absolute;\n width: var(--container-width, 100%);\n width: 100%;\n top: 0;\n left: 0;\n box-shadow: var(--shadow-1);\n max-height: 150px;\n overflow-y: scroll;\n }\n .option-list li {\n border-block-start: 1px solid var(--dt-form-border-color, #cacaca);\n outline: 0;\n }\n .option-list li div,\n .option-list li button {\n padding: 0.5rem 0.75rem;\n color: var(--dt-multi-select-text-color, #0a0a0a);\n font-weight: 100;\n font-size: 1rem;\n text-decoration: none;\n text-align: inherit;\n }\n .option-list li button {\n display: block;\n width: 100%;\n border: 0;\n background: transparent;\n }\n .option-list li button:hover,\n .option-list li button.active {\n cursor: pointer;\n background: var(--dt-multi-select-option-hover-background, #f5f5f5);\n }\n `,\n css`\n input {\n color: var(--dt-form-text-color, #000);\n appearance: none;\n background-color: var(--dt-location-map-background-color, #fefefe);\n border: 1px solid var(--dt-location-map-border-color, #fefefe);\n border-radius: var(--dt-location-map-border-radius, 0);\n box-shadow: var(\n --dt-location-map-box-shadow,\n var(\n --dt-form-input-box-shadow,\n inset 0 1px 2px hsl(0deg 0% 4% / 10%)\n )\n );\n box-sizing: border-box;\n display: block;\n font-family: inherit;\n font-size: 1rem;\n font-weight: 300;\n line-height: 1.5;\n margin: 0;\n padding: var(--dt-form-padding, 0.5333333333rem);\n transition: var(\n --dt-form-transition,\n box-shadow 0.5s,\n border-color 0.25s ease-in-out\n );\n }\n input:disabled,\n input[readonly],\n textarea:disabled,\n textarea[readonly] {\n background-color: var(\n --dt-text-disabled-background-color,\n var(--dt-form-disabled-background-color, #e6e6e6)\n );\n cursor: not-allowed;\n }\n input.disabled {\n color: var(--dt-text-placeholder-color, #999); \n }\n input:focus-within,\n input:focus-visible {\n outline: none;\n }\n input::placeholder {\n color: var(--dt-text-placeholder-color, #999);\n text-transform: var(--dt-text-placeholder-transform, none);\n font-size: var(--dt-text-placeholder-font-size, 1rem);\n font-weight: var(--dt-text-placeholder-font-weight, 400);\n letter-spacing: var(--dt-text-placeholder-letter-spacing, normal);\n }\n input.invalid {\n border-color: var(--dt-text-border-color-alert, var(--alert-color));\n }\n \n .field-container {\n display: flex;\n margin-bottom: 0.5rem;\n }\n .field-container input {\n flex-grow: 1;\n }\n .field-container .input-addon {\n flex-shrink: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n aspect-ratio: 1/1;\n padding: 10px;\n border: solid 1px gray;\n border-collapse: collapse;\n color: var(--dt-location-map-button-color, #cc4b37);\n background-color: var(--dt-location-map-background-color, buttonface);\n border: 1px solid var(--dt-location-map-border-color, #fefefe);\n border-radius: var(--dt-location-map-border-radius, 0);\n box-shadow: var(\n --dt-location-map-box-shadow,\n var(\n --dt-form-input-box-shadow,\n inset 0 1px 2px hsl(0deg 0% 4% / 10%)\n )\n );\n }\n .field-container .input-addon:hover {\n background-color: var(--dt-location-map-button-hover-background-color, #cc4b37);\n color: var(--dt-location-map-button-hover-color, #ffffff);\n }\n \n .input-addon:disabled {\n background-color: var(--dt-form-disabled-background-color);\n color: var(--dt-text-placeholder-color, #999);\n }\n .input-addon:disabled:hover {\n background-color: var(--dt-form-disabled-background-color);\n color: var(--dt-text-placeholder-color, #999);\n cursor: not-allowed; \n }\n `,\n css`\n /* === Inline Icons === */\n .icon-overlay {\n position: absolute;\n inset-inline-end: 1rem;\n top: 0;\n inset-inline-end: 3rem;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .icon-overlay.alert {\n color: var(--alert-color);\n }\n .icon-overlay.success {\n color: var(--success-color);\n }\n `,\n ];\n }\n\n constructor() {\n super();\n this.activeIndex = -1;\n this.filteredOptions = [];\n this.detectTap = false;\n this.debounceTimer = null;\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.addEventListener('autofocus', async (evt) => {\n // wait for render to complete\n await this.updateComplete;\n\n const input = this.shadowRoot.querySelector('input');\n if (input) {\n input.focus();\n }\n });\n\n if (this.mapboxToken) {\n this.mapboxService = new MapboxService(this.mapboxToken);\n }\n\n if (this.googleToken) {\n this.googleGeocodeService = new GoogleGeocodeService(this.googleToken, window, document);\n }\n }\n\n updated(changedProperties) {\n this._scrollOptionListToActive();\n\n // set variable with width of container for truncating selected options via CSS\n const container = this.shadowRoot.querySelector('.input-group');\n const currentValue = container.style.getPropertyValue('--container-width');\n if (!currentValue) {\n container.style.setProperty(\n '--container-width',\n `${container.clientWidth}px`\n );\n }\n }\n\n /**\n * When navigating via keyboard, keep active element within visible area of option list\n * @private\n */\n _scrollOptionListToActive() {\n const optionList = this.shadowRoot.querySelector('.option-list');\n const activeEl = this.shadowRoot.querySelector('button.active');\n if (optionList && activeEl) {\n const elTop = activeEl.offsetTop;\n const elBottom = activeEl.offsetTop + activeEl.clientHeight;\n const listTop = optionList.scrollTop;\n const listBottom = optionList.scrollTop + optionList.clientHeight;\n if (elBottom > listBottom) {\n // active element below visible area. scroll down\n optionList.scrollTo({\n top: elBottom - optionList.clientHeight,\n behavior: 'smooth',\n });\n } else if (elTop < listTop) {\n // active element above visible area. scroll up\n optionList.scrollTo({ top: elTop, behavior: 'smooth' });\n }\n }\n }\n\n _clickOption(e) {\n const target = e.currentTarget ?? e.target;\n if (target && target.value) {\n this._select(JSON.parse(target.value));\n }\n }\n\n _touchStart(e) {\n if (e.target) {\n this.detectTap = false;\n }\n }\n\n _touchMove(e) {\n if (e.target) {\n this.detectTap = true;\n }\n }\n\n _touchEnd(e) {\n if (!this.detectTap) {\n if (e.target && e.target.value) {\n this._clickOption(e);\n }\n this.detectTap = false;\n }\n }\n\n _keyboardSelectOption() {\n if (this.activeIndex > -1) {\n if (this.activeIndex < this.filteredOptions.length) {\n // select one of the options\n this._select(this.filteredOptions[this.activeIndex]);\n } else {\n // select the Add New option\n this._select({\n value: this.query,\n label: this.query,\n })\n }\n }\n }\n\n async _select(metadata) {\n if (metadata.place_id && this.googleGeocodeService) {\n // Google Places autocomplete will give a place_id instead of geometry details,\n // so we need to get those details by geocoding the full address from Place lookup\n this.loading = true;\n const place = await this.googleGeocodeService.getPlaceDetails(metadata.label, this.locale);\n this.loading = false;\n if (place) {\n metadata.lat = place.geometry.location.lat;\n metadata.lng = place.geometry.location.lng;\n metadata.level = place.types && place.types.length ? place.types[0] : null;\n }\n }\n\n // Create custom event with new/old values to pass to onchange function\n const options = {\n detail: {\n metadata,\n },\n bubbles: false,\n };\n this.dispatchEvent(new CustomEvent('select', options));\n\n // update value in this component\n this.metadata = metadata;\n const input = this.shadowRoot.querySelector('input');\n if (input) {\n input.value = metadata?.label;\n }\n\n this.open = false; // close options list\n this.activeIndex = -1; // reset keyboard-selected option\n }\n\n get _focusTarget() {\n let target = this._field;\n if (this.metadata) {\n target = this.shadowRoot.querySelector('button') || target;\n }\n return target;\n }\n\n _inputFocusIn() {\n this.activeIndex = -1;\n }\n\n _inputFocusOut(e) {\n // allow clicks on option list button to not close the option list\n // Safari actually passes the parent
  • as the relatedTarget\n if (\n !e.relatedTarget ||\n !['BUTTON', 'LI'].includes(e.relatedTarget.nodeName)\n ) {\n this.open = false;\n }\n }\n\n _inputKeyDown(e) {\n const keycode = e.keyCode || e.which;\n\n switch (keycode) {\n case 38: // arrow up\n this.open = true;\n this._listHighlightPrevious();\n break;\n case 40: // arrow down\n this.open = true;\n this._listHighlightNext();\n break;\n case 9: // tab\n if (this.activeIndex < 0) {\n // if pressing tab while no option is selected,\n // close the list so you can go to next field\n this.open = false;\n } else {\n e.preventDefault();\n }\n this._keyboardSelectOption();\n break;\n case 13: // enter\n this._keyboardSelectOption();\n break;\n case 27: // escape\n this.open = false;\n this.activeIndex = -1;\n break;\n default:\n this.open = true;\n break;\n }\n }\n\n _inputKeyUp(e) {\n const keycode = e.keyCode || e.which;\n const ignoredKeys = [9, 13]; // ignore tab & enter;\n if (e.target.value && !ignoredKeys.includes(keycode)) {\n this.open = true;\n }\n this.query = e.target.value;\n }\n\n _listHighlightNext() {\n this.activeIndex = Math.min(\n this.filteredOptions.length,\n this.activeIndex + 1\n );\n }\n\n _listHighlightPrevious() {\n this.activeIndex = Math.max(0, this.activeIndex - 1);\n }\n\n /**\n * Filter to options that:\n * 1: are not selected\n * 2: match the search query\n * @private\n */\n async _filterOptions() {\n if (this.query) {\n if (this.googleToken && this.googleGeocodeService) {\n this.loading = true;\n\n try {\n const predictions = await this.googleGeocodeService.getPlacePredictions(this.query, this.locale);\n\n this.filteredOptions = (predictions || []).map((i) => ({\n label: i.description,\n place_id: i.place_id,\n source: 'user',\n raw: i,\n }));\n\n this.loading = false;\n } catch (ex) {\n console.error(ex);\n this.error = true;\n this.loading = false;\n return;\n }\n } else if (this.mapboxToken && this.mapboxService) {\n this.loading = true;\n\n const results = await this.mapboxService.searchPlaces(this.query, this.locale);\n\n this.filteredOptions = results.map((i) => ({\n lng: i.center[0],\n lat: i.center[1],\n level: i.place_type[0],\n label: i.place_name,\n source: 'user'\n }));\n\n this.loading = false;\n }\n }\n return this.filteredOptions;\n }\n\n willUpdate(props) {\n super.willUpdate(props);\n\n if (props) {\n // // if query changes, trigger filter\n const queryChanged = props.has('query');\n if (queryChanged) {\n this.error = false;\n clearTimeout(this.debounceTimer);\n this.debounceTimer = setTimeout(() => this._filterOptions(), 300);\n }\n\n // Set the containerHeight for dropdown positioning if it hasn't been set yet\n if (\n !this.containerHeight &&\n this.shadowRoot.children &&\n this.shadowRoot.children.length\n ) {\n const inputGroup = this.shadowRoot.querySelector('.input-group');\n if (inputGroup) {\n this.containerHeight = inputGroup.offsetHeight;\n }\n }\n }\n }\n\n _change() {\n\n }\n _delete() {\n const options = {\n detail: {\n metadata: this.metadata,\n },\n bubbles: false,\n };\n this.dispatchEvent(new CustomEvent('delete', options));\n }\n _openMapModal() {\n this.shadowRoot.querySelector('dt-map-modal').dispatchEvent(new Event('open'));\n }\n async _onMapModalSubmit(e) {\n if (e?.detail?.location?.lat) {\n const { location } = e?.detail;\n const { lat, lng } = location;\n\n // reverse geocode location and save\n if (this.googleGeocodeService) {\n const results = await this.googleGeocodeService.reverseGeocode(lng, lat, this.locale);\n if (results && results.length) {\n const place = results[0];\n this._select({\n lng: place.geometry.location.lng,\n lat: place.geometry.location.lat,\n level: place.types && place.types.length ? place.types[0] : null,\n label: place.formatted_address,\n source: 'user',\n });\n }\n } else if (this.mapboxService) {\n const results = await this.mapboxService.reverseGeocode(lng, lat, this.locale);\n if (results && results.length) {\n const place = results[0];\n this._select({\n lng: place.center[0],\n lat: place.center[1],\n level: place.place_type[0],\n label: place.place_name,\n source: 'user',\n });\n }\n }\n }\n }\n\n _renderOption(opt, idx, label) {\n return html`\n
  • \n -1 && this.activeIndex === idx\n ? 'active'\n : ''}\"\n >\n ${label ?? opt.label}\n \n
  • \n `;\n }\n\n _renderOptions() {\n let options = [];\n if (!this.filteredOptions.length) {\n if (this.loading) {\n options.push(html`
  • ${msg('Loading...')}
  • `);\n } else {\n options.push(html`
  • ${msg('No Data Available')}
  • `);\n }\n } else {\n options.push(...this.filteredOptions.map((opt, idx) => this._renderOption(opt, idx)));\n }\n\n options.push(this._renderOption({\n value: this.query,\n label: this.query,\n }, (this.filteredOptions || []).length, html`${msg('Use')}: \"${this.query}\"`));\n return options;\n }\n\n render() {\n const optionListStyles = {\n display: this.open ? 'block' : 'none',\n top: this.containerHeight ? `${this.containerHeight}px` : '2.5rem',\n };\n const existingValue = !!this.metadata?.label;\n const hasGeometry = this.metadata?.lat && this.metadata?.lng;\n return html`\n
    \n
    \n \n \n ${existingValue && hasGeometry ? html`\n \n ` : null }\n ${existingValue ? html`\n \n ` : html`\n \n ` }\n
    \n
      \n ${this._renderOptions()}\n
    \n ${(this.touched && this.invalid) || this.error\n ? html``\n : null}\n ${this.loading\n ? html`` : null}\n ${this.saved \n ? html`` : null}\n
    \n \n \n \n`;\n }\n}\nwindow.customElements.define('dt-location-map-item', DtLocationMapItem);\n"],"names":["MapboxService","constructor","token","this","async","query","language","params","URLSearchParams","types","limit","access_token","apiUrl","encodeURI","response","fetch","method","headers","json","features","longitude","latitude","GoogleGeocodeService","window","document","google","maps","places","AutocompleteService","script","createElement","src","body","appendChild","service","predictions","getPlacePredictions","input","address","key","data","results","status","length","latlng","result_type","join","customElements","define","LitElement","properties","id","type","String","reflect","placeholder","mapboxToken","attribute","googleToken","metadata","Object","disabled","Boolean","open","state","activeIndex","Number","containerHeight","loading","saved","filteredOptions","Array","styles","css","super","detectTap","debounceTimer","connectedCallback","addEventListener","evt","updateComplete","shadowRoot","querySelector","focus","mapboxService","googleGeocodeService","updated","changedProperties","_scrollOptionListToActive","container","style","getPropertyValue","setProperty","clientWidth","optionList","activeEl","elTop","offsetTop","elBottom","clientHeight","listTop","scrollTop","scrollTo","top","behavior","_clickOption","e","target","currentTarget","value","_select","JSON","parse","_touchStart","_touchMove","_touchEnd","_keyboardSelectOption","label","place_id","place","getPlaceDetails","locale","lat","geometry","location","lng","level","options","detail","bubbles","dispatchEvent","CustomEvent","_focusTarget","_field","_inputFocusIn","_inputFocusOut","relatedTarget","includes","nodeName","_inputKeyDown","keyCode","which","_listHighlightPrevious","_listHighlightNext","preventDefault","_inputKeyUp","keycode","Math","min","max","map","i","description","source","raw","ex","console","error","searchPlaces","center","place_type","place_name","willUpdate","props","has","clearTimeout","setTimeout","_filterOptions","children","inputGroup","offsetHeight","_change","_delete","_openMapModal","Event","reverseGeocode","formatted_address","_renderOption","opt","idx","html","stringify","_renderOptions","push","msg","render","optionListStyles","display","existingValue","hasGeometry","styleMap","touched","invalid","_onMapModalSubmit"],"mappings":"kWAAe,MAAMA,EACnBC,YAAYC,GACVC,KAAKD,MAAQA,CACd,CAQDE,mBAAmBC,EAAOC,EAAW,MACnC,MAAMC,EAAS,IAAIC,gBAAgB,CACjCC,MAAO,CAAC,UAAW,SAAU,WAAY,WAAY,QAAS,WAAY,eAAgB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B1D,KAAKoD,uBACXpD,KAAKwD,UAAU0D,qBACXuE,GAAiBC,GAAgB1L,KAAK0D,uBACvC1D,KAAKmI,yBACRnI,KAAKoI,6BACFpI,KAAKwI,0BACPxI,KAAK8I,iBAGf2C,GAAiBC,EAAcT,CAAI,+CAG1BjL,KAAK0K,6BACF1K,KAAK0D,8CAIf,QACF+H,EAAgBR,CAAI,kDAGXjL,KAAKyK,uBACFzK,KAAK0D,4DAIfuH,CAAI,+CAGGjL,KAAK0K,6BACF1K,KAAK0D,mGAMWiI,EAASJ,OACrCvL,KAAKmL,wBAENnL,KAAK4L,SAAW5L,KAAK6L,SAAY7L,KAAK0J,MACrCuB,CAAI,6EACF,QACJjL,KAAKiE,QACHgH,CAAI,iDAAmD,QACzDjL,KAAKkE,MACH+G,CAAI,6DAA+D,sCAI3DjL,KAAKwD,2BACDxD,KAAKqD,yBACXrD,KAAK8L,qBAIpB"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-location-map/dt-location-map.js b/dt-assets/build/components/form/dt-location-map/dt-location-map.js index 0a395ce816..d570f7743a 100644 --- a/dt-assets/build/components/form/dt-location-map/dt-location-map.js +++ b/dt-assets/build/components/form/dt-location-map/dt-location-map.js @@ -1 +1,120 @@ -import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{c as i}from"../../repeat-1a2b8966.js";import{D as a}from"../dt-form-base.js";import"./dt-location-map-item.js";import"../../directive-de55b00a.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";import"../../style-map-ac85d91b.js";import"../../icons/dt-icon.js";import"./dt-map-modal.js";import"../../layout/dt-modal/dt-modal.js";import"../../class-map-8d921948.js";window.customElements.define("dt-location-map",class extends a{static get properties(){return{...super.properties,placeholder:{type:String},value:{type:Array,reflect:!0},locations:{type:Array,state:!0},open:{type:Boolean,state:!0},onchange:{type:String},mapboxToken:{type:String,attribute:"mapbox-token"},googleToken:{type:String,attribute:"google-token"}}}static get styles(){return[...super.styles,t`:host{font-family:Helvetica,Arial,sans-serif}.input-group{display:flex}.field-container{position:relative}`]}constructor(){super(),this.value=[],this.locations=[{id:Date.now()}]}_setFormValue(t){super._setFormValue(t),this.internals.setFormValue(JSON.stringify(t))}willUpdate(...t){super.willUpdate(...t),this.value&&this.value.filter((t=>!t.id))&&(this.value=[...this.value.map((t=>({...t,id:t.grid_meta_id})))]),this.updateLocationList()}firstUpdated(...t){super.firstUpdated(...t),this.internals.setFormValue(JSON.stringify(this.value))}updated(t){if(t.has("value")){const e=t.get("value");e&&e?.length!==this.value?.length&&this.focusNewLocation()}if(t.has("locations")){const e=t.get("locations");e&&e?.length!==this.locations?.length&&this.focusNewLocation()}}focusNewLocation(){const t=this.shadowRoot.querySelectorAll("dt-location-map-item");t&&t.length&&t[t.length-1].dispatchEvent(new Event("autofocus"))}updateLocationList(){this.disabled||!this.open&&this.value&&this.value.length?this.locations=[...(this.value||[]).filter((t=>t.label))]:(this.open=!0,this.locations=[...(this.value||[]).filter((t=>t.label)),{id:Date.now()}])}selectLocation(t){const e=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value}}),i={...t.detail.metadata,id:Date.now()};this.value=[...(this.value||[]).filter((t=>t.label)),i],this.updateLocationList(),e.detail.newValue=this.value,this.dispatchEvent(e),this._setFormValue(this.value)}deleteItem(t){const e=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value}}),i=t.detail?.metadata,a=i?.grid_meta_id;this.value=a?(this.value||[]).filter((t=>t.grid_meta_id!==a)):(this.value||[]).filter((t=>t.lat!==i.lat&&t.lng!==i.lng)),this.updateLocationList(),e.detail.newValue=this.value,this.dispatchEvent(e),this._setFormValue(this.value)}addNew(){this.open=!0,this.updateLocationList()}renderItem(t){return e``}render(){return this.value,e`${this.labelTemplate()} ${i(this.locations||[],(t=>t.id),((t,e)=>this.renderItem(t,e)))} ${this.open?null:e``}`}}); +import { i as t, y as e } from '../../lit-element-2409d5fe.js'; +import { c as i } from '../../repeat-1a2b8966.js'; +import { D as a } from '../dt-form-base.js'; +import './dt-location-map-item.js'; +import '../../directive-de55b00a.js'; +import '../../dt-base.js'; +import '../../lit-localize-763e4978.js'; +import '../dt-label/dt-label.js'; +import '../../style-map-ac85d91b.js'; +import '../../icons/dt-icon.js'; +import './dt-map-modal.js'; +import '../../layout/dt-modal/dt-modal.js'; +import '../../class-map-8d921948.js'; +window.customElements.define( + 'dt-location-map', + class extends a { + static get properties() { + return { + ...super.properties, + placeholder: { type: String }, + value: { type: Array, reflect: !0 }, + locations: { type: Array, state: !0 }, + open: { type: Boolean, state: !0 }, + onchange: { type: String }, + mapboxToken: { type: String, attribute: 'mapbox-token' }, + googleToken: { type: String, attribute: 'google-token' }, + }; + } + static get styles() { + return [ + ...super.styles, + t`:host{font-family:Helvetica,Arial,sans-serif}.input-group{display:flex}.field-container{position:relative}`, + ]; + } + constructor() { + super(), (this.value = []), (this.locations = [{ id: Date.now() }]); + } + _setFormValue(t) { + super._setFormValue(t), this.internals.setFormValue(JSON.stringify(t)); + } + willUpdate(...t) { + super.willUpdate(...t), + this.value && + this.value.filter((t) => !t.id) && + (this.value = [ + ...this.value.map((t) => ({ ...t, id: t.grid_meta_id })), + ]), + this.updateLocationList(); + } + firstUpdated(...t) { + super.firstUpdated(...t), + this.internals.setFormValue(JSON.stringify(this.value)); + } + updated(t) { + if (t.has('value')) { + const e = t.get('value'); + e && e?.length !== this.value?.length && this.focusNewLocation(); + } + if (t.has('locations')) { + const e = t.get('locations'); + e && e?.length !== this.locations?.length && this.focusNewLocation(); + } + } + focusNewLocation() { + const t = this.shadowRoot.querySelectorAll('dt-location-map-item'); + t && t.length && t[t.length - 1].dispatchEvent(new Event('autofocus')); + } + updateLocationList() { + this.disabled || (!this.open && this.value && this.value.length) + ? (this.locations = [...(this.value || []).filter((t) => t.label)]) + : ((this.open = !0), + (this.locations = [ + ...(this.value || []).filter((t) => t.label), + { id: Date.now() }, + ])); + } + selectLocation(t) { + const e = new CustomEvent('change', { + detail: { field: this.name, oldValue: this.value }, + }), + i = { ...t.detail.metadata, id: Date.now() }; + (this.value = [...(this.value || []).filter((t) => t.label), i]), + this.updateLocationList(), + (e.detail.newValue = this.value), + this.dispatchEvent(e), + this._setFormValue(this.value); + } + deleteItem(t) { + const e = new CustomEvent('change', { + detail: { field: this.name, oldValue: this.value }, + }), + i = t.detail?.metadata, + a = i?.grid_meta_id; + (this.value = a + ? (this.value || []).filter((t) => t.grid_meta_id !== a) + : (this.value || []).filter((t) => t.lat !== i.lat && t.lng !== i.lng)), + this.updateLocationList(), + (e.detail.newValue = this.value), + this.dispatchEvent(e), + this._setFormValue(this.value); + } + addNew() { + (this.open = !0), this.updateLocationList(); + } + renderItem(t) { + return e``; + } + render() { + return ( + this.value, + e`${this.labelTemplate()} ${i( + this.locations || [], + (t) => t.id, + (t, e) => this.renderItem(t, e), + )} ${this.open ? null : e``}` + ); + } + }, +); +//# sourceMappingURL=dt-location-map.js.map diff --git a/dt-assets/build/components/form/dt-location-map/dt-location-map.js.map b/dt-assets/build/components/form/dt-location-map/dt-location-map.js.map new file mode 100644 index 0000000000..16ab2387ae --- /dev/null +++ b/dt-assets/build/components/form/dt-location-map/dt-location-map.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-location-map.js","sources":["../../../src/components/form/dt-location-map/dt-location-map.js"],"sourcesContent":["import { css, html } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\nimport DtFormBase from '../dt-form-base.js';\nimport './dt-location-map-item.js';\n\nexport class DtLocationMap extends DtFormBase {\n static get properties() {\n return {\n ...super.properties,\n placeholder: { type: String },\n value: {\n type: Array,\n reflect: true,\n },\n locations: {\n type: Array,\n state: true,\n },\n open: {\n type: Boolean,\n state: true,\n },\n onchange: { type: String },\n mapboxToken: {\n type: String,\n attribute: 'mapbox-token',\n },\n googleToken: {\n type: String,\n attribute: 'google-token',\n },\n };\n }\n\n static get styles() {\n return [\n ...super.styles,\n css`\n :host {\n font-family: Helvetica, Arial, sans-serif;\n }\n .input-group {\n display: flex;\n }\n\n .field-container {\n position: relative;\n }\n `,\n ];\n }\n\n constructor() {\n super();\n this.value = [];\n this.locations = [{\n id: Date.now(),\n }];\n }\n\n _setFormValue(value) {\n super._setFormValue(value);\n this.internals.setFormValue(JSON.stringify(value));\n }\n\n willUpdate(...args) {\n super.willUpdate(...args);\n\n if (this.value) {\n if (this.value.filter((opt) => !opt.id)) {\n this.value = [\n ...this.value.map((opt) => ({\n ...opt,\n id: opt.grid_meta_id,\n }))\n ];\n }\n }\n this.updateLocationList();\n }\n\n firstUpdated(...args) {\n super.firstUpdated(...args);\n this.internals.setFormValue(JSON.stringify(this.value));\n }\n\n updated(changedProperties) {\n // if length of value was changed, focus the last element\n if (changedProperties.has('value')) {\n const old = changedProperties.get('value');\n if (old && old?.length !== this.value?.length) {\n this.focusNewLocation();\n }\n }\n // if length of locations was changed, focus the last element\n if (changedProperties.has('locations')) {\n const old = changedProperties.get('locations');\n if (old && old?.length !== this.locations?.length) {\n this.focusNewLocation();\n }\n }\n }\n\n focusNewLocation() {\n const items = this.shadowRoot.querySelectorAll('dt-location-map-item');\n if (items && items.length) {\n // console.log('trigger focus');\n items[items.length - 1].dispatchEvent(new Event('autofocus'));\n }\n }\n\n updateLocationList() {\n if (!this.disabled && (this.open || !this.value || !this.value.length)) {\n this.open = true;\n this.locations = [\n ...(this.value || []).filter(i => i.label),\n {\n id: Date.now(),\n }\n ];\n } else {\n this.locations = [\n ...(this.value || []).filter(i => i.label),\n ];\n }\n }\n\n selectLocation(evt) {\n const event = new CustomEvent('change', {\n detail: {\n field: this.name,\n oldValue: this.value,\n },\n });\n const newLocation = {\n ...evt.detail.metadata,\n id: Date.now(),\n }\n this.value = [\n ...(this.value || []).filter(i => i.label),\n newLocation,\n ];\n this.updateLocationList();\n event.detail.newValue = this.value;\n\n // dispatch event for use with addEventListener from javascript\n this.dispatchEvent(event);\n this._setFormValue(this.value);\n }\n\n deleteItem(evt) {\n const event = new CustomEvent('change', {\n detail: {\n field: this.name,\n oldValue: this.value,\n },\n });\n\n const item = evt.detail?.metadata;\n const gridMetaId = item?.grid_meta_id;\n if (gridMetaId) {\n // remove this item from the value\n this.value = (this.value || []).filter(m => m.grid_meta_id !== gridMetaId);\n } else {\n // remove by lat/lng\n this.value = (this.value || []).filter(m => m.lat !== item.lat && m.lng !== item.lng);\n }\n\n this.updateLocationList();\n event.detail.newValue = this.value;\n\n // dispatch event for use with addEventListener from javascript\n this.dispatchEvent(event);\n this._setFormValue(this.value);\n }\n\n addNew() {\n this.open = true;\n this.updateLocationList();\n }\n\n renderItem(opt) {\n return html`\n \n `;\n }\n\n render() {\n const values = [...(this.value || [])];\n values.push({\n id: Date.now(),\n });\n return html`\n ${this.labelTemplate()}\n\n ${repeat(this.locations || [], (opt) => opt.id, (opt, idx) => this.renderItem(opt, idx))}\n ${!this.open\n ? html``\n : null}\n `;\n }\n}\n\nwindow.customElements.define('dt-location-map', DtLocationMap);\n"],"names":["window","customElements","define","DtFormBase","properties","super","placeholder","type","String","value","Array","reflect","locations","state","open","Boolean","onchange","mapboxToken","attribute","googleToken","styles","css","constructor","this","id","Date","now","_setFormValue","internals","setFormValue","JSON","stringify","willUpdate","args","filter","opt","map","grid_meta_id","updateLocationList","firstUpdated","updated","changedProperties","has","old","get","length","focusNewLocation","items","shadowRoot","querySelectorAll","dispatchEvent","Event","disabled","i","label","selectLocation","evt","event","CustomEvent","detail","field","name","oldValue","newLocation","metadata","newValue","deleteItem","item","gridMetaId","m","lat","lng","addNew","renderItem","html","render","labelTemplate","repeat","idx"],"mappings":"8dAmNAA,OAAOC,eAAeC,OAAO,kBA9MtB,cAA4BC,EACtBC,wBACT,MAAO,IACFC,MAAMD,WACTE,YAAa,CAAEC,KAAMC,QACrBC,MAAO,CACLF,KAAMG,MACNC,SAAS,GAEXC,UAAW,CACTL,KAAMG,MACNG,OAAO,GAETC,KAAM,CACJP,KAAMQ,QACNF,OAAO,GAETG,SAAU,CAAET,KAAMC,QAClBS,YAAa,CACXV,KAAMC,OACNU,UAAW,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,KAAKkD,WAAWtC,EAAK2C,QAChFvD,KAAKT,KAEJ,KADA4D,CAAI,mBAAmBnD,KAAKiD,4BAGnC"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-location-map/dt-map-modal.js b/dt-assets/build/components/form/dt-location-map/dt-map-modal.js index 21de79c842..0f46e48184 100644 --- a/dt-assets/build/components/form/dt-location-map/dt-map-modal.js +++ b/dt-assets/build/components/form/dt-location-map/dt-map-modal.js @@ -1 +1,121 @@ -import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{m as a}from"../../lit-localize-763e4978.js";import{D as i}from"../../dt-base.js";import"../../layout/dt-modal/dt-modal.js";import"../../class-map-8d921948.js";import"../../directive-de55b00a.js";import"../../style-map-ac85d91b.js";window.customElements.define("dt-map-modal",class extends i{static get properties(){return{...super.properties,title:{type:String},isOpen:{type:Boolean},canEdit:{type:Boolean,state:!0},metadata:{type:Object},center:{type:Array},mapboxToken:{type:String,attribute:"mapbox-token"}}}static get styles(){return[t`.map{width:100%;min-width:50vw;min-height:50dvb}`]}constructor(){super(),this.addEventListener("open",(t=>{this.shadowRoot.querySelector("dt-modal").dispatchEvent(new Event("open")),this.isOpen=!0})),this.addEventListener("close",(t=>{this.shadowRoot.querySelector("dt-modal").dispatchEvent(new Event("close")),this.isOpen=!1}))}connectedCallback(){if(super.connectedCallback(),this.canEdit=!this.metadata,window.mapboxgl)this.initMap();else{let t=document.createElement("script");t.src="https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.js",t.onload=this.initMap.bind(this),document.body.appendChild(t),console.log("injected script")}}initMap(){if(!this.isOpen||!window.mapboxgl||!this.mapboxToken)return;const t=this.shadowRoot.querySelector("#map");if(t&&!this.map){this.map=new window.mapboxgl.Map({accessToken:this.mapboxToken,container:t,style:"mapbox://styles/mapbox/streets-v12",minZoom:1}),this.map.on("load",(()=>this.map.resize())),this.center&&this.center.length&&(this.map.setCenter(this.center),this.map.setZoom(15));const e=new mapboxgl.NavigationControl;this.map.addControl(e,"bottom-right"),this.addPinFromMetadata(),this.map.on("click",(t=>{this.canEdit&&(this.marker?this.marker.setLngLat(t.lngLat):this.marker=(new mapboxgl.Marker).setLngLat(t.lngLat).addTo(this.map))}))}}addPinFromMetadata(){if(this.metadata){const{lng:t,lat:e,level:a}=this.metadata;let i=15;"admin0"===a?i=3:"admin1"===a?i=6:"admin2"===a&&(i=10),this.map&&(this.map.setCenter([t,e]),this.map.setZoom(i),this.marker=(new mapboxgl.Marker).setLngLat([t,e]).addTo(this.map))}}updated(t){window.mapboxgl&&(t.has("metadata")&&this.metadata&&this.metadata.lat&&this.addPinFromMetadata(),t.has("isOpen")&&this.isOpen&&this.initMap())}onClose(t){"button"===t?.detail?.action&&this.marker&&this.dispatchEvent(new CustomEvent("submit",{detail:{location:this.marker.getLngLat()}}))}render(){return e`
    ${this.canEdit?e`
    ${a("Save")}
    `:null}
    `}}); +import { i as t, y as e } from '../../lit-element-2409d5fe.js'; +import { m as a } from '../../lit-localize-763e4978.js'; +import { D as i } from '../../dt-base.js'; +import '../../layout/dt-modal/dt-modal.js'; +import '../../class-map-8d921948.js'; +import '../../directive-de55b00a.js'; +import '../../style-map-ac85d91b.js'; +window.customElements.define( + 'dt-map-modal', + class extends i { + static get properties() { + return { + ...super.properties, + title: { type: String }, + isOpen: { type: Boolean }, + canEdit: { type: Boolean, state: !0 }, + metadata: { type: Object }, + center: { type: Array }, + mapboxToken: { type: String, attribute: 'mapbox-token' }, + }; + } + static get styles() { + return [t`.map{width:100%;min-width:50vw;min-height:50dvb}`]; + } + constructor() { + super(), + this.addEventListener('open', (t) => { + this.shadowRoot + .querySelector('dt-modal') + .dispatchEvent(new Event('open')), + (this.isOpen = !0); + }), + this.addEventListener('close', (t) => { + this.shadowRoot + .querySelector('dt-modal') + .dispatchEvent(new Event('close')), + (this.isOpen = !1); + }); + } + connectedCallback() { + if ( + (super.connectedCallback(), + (this.canEdit = !this.metadata), + window.mapboxgl) + ) + this.initMap(); + else { + let t = document.createElement('script'); + (t.src = 'https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.js'), + (t.onload = this.initMap.bind(this)), + document.body.appendChild(t), + console.log('injected script'); + } + } + initMap() { + if (!this.isOpen || !window.mapboxgl || !this.mapboxToken) return; + const t = this.shadowRoot.querySelector('#map'); + if (t && !this.map) { + (this.map = new window.mapboxgl.Map({ + accessToken: this.mapboxToken, + container: t, + style: 'mapbox://styles/mapbox/streets-v12', + minZoom: 1, + })), + this.map.on('load', () => this.map.resize()), + this.center && + this.center.length && + (this.map.setCenter(this.center), this.map.setZoom(15)); + const e = new mapboxgl.NavigationControl(); + this.map.addControl(e, 'bottom-right'), + this.addPinFromMetadata(), + this.map.on('click', (t) => { + this.canEdit && + (this.marker + ? this.marker.setLngLat(t.lngLat) + : (this.marker = new mapboxgl.Marker() + .setLngLat(t.lngLat) + .addTo(this.map))); + }); + } + } + addPinFromMetadata() { + if (this.metadata) { + const { lng: t, lat: e, level: a } = this.metadata; + let i = 15; + 'admin0' === a + ? (i = 3) + : 'admin1' === a + ? (i = 6) + : 'admin2' === a && (i = 10), + this.map && + (this.map.setCenter([t, e]), + this.map.setZoom(i), + (this.marker = new mapboxgl.Marker() + .setLngLat([t, e]) + .addTo(this.map))); + } + } + updated(t) { + window.mapboxgl && + (t.has('metadata') && + this.metadata && + this.metadata.lat && + this.addPinFromMetadata(), + t.has('isOpen') && this.isOpen && this.initMap()); + } + onClose(t) { + 'button' === t?.detail?.action && + this.marker && + this.dispatchEvent( + new CustomEvent('submit', { + detail: { location: this.marker.getLngLat() }, + }), + ); + } + render() { + return e`
    ${this.canEdit ? e`
    ${a('Save')}
    ` : null}
    `; + } + }, +); +//# sourceMappingURL=dt-map-modal.js.map diff --git a/dt-assets/build/components/form/dt-location-map/dt-map-modal.js.map b/dt-assets/build/components/form/dt-location-map/dt-map-modal.js.map new file mode 100644 index 0000000000..45bcf514e8 --- /dev/null +++ b/dt-assets/build/components/form/dt-location-map/dt-map-modal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-map-modal.js","sources":["../../../src/components/form/dt-location-map/dt-map-modal.js"],"sourcesContent":["import { css, html } from 'lit';\nimport { msg } from '@lit/localize';\nimport DtBase from '../../dt-base.js';\nimport '../../layout/dt-modal/dt-modal.js';\n\nexport class DtMapModal extends DtBase {\n static get properties() {\n return {\n ...super.properties,\n title: { type: String },\n isOpen: { type: Boolean },\n canEdit: { type: Boolean, state: true },\n metadata: { type: Object },\n center: { type: Array },\n mapboxToken: {\n type: String,\n attribute: 'mapbox-token',\n },\n };\n }\n\n static get styles() {\n return [\n css`\n .map {\n width: 100%;\n min-width: 50vw;\n min-height: 50dvb;\n }\n `,\n ];\n }\n\n constructor() {\n super();\n\n this.addEventListener('open', (e) => {\n this.shadowRoot.querySelector('dt-modal').dispatchEvent(new Event('open'));\n this.isOpen = true;\n });\n this.addEventListener('close', (e) => {\n this.shadowRoot.querySelector('dt-modal').dispatchEvent(new Event('close'));\n this.isOpen = false;\n });\n }\n\n connectedCallback() {\n super.connectedCallback();\n\n this.canEdit = !this.metadata;\n\n if (!window.mapboxgl) {\n let script = document.createElement('script');\n script.src = 'https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.js';\n script.onload = this.initMap.bind(this);\n document.body.appendChild(script);\n console.log('injected script')\n } else {\n this.initMap();\n }\n }\n\n initMap() {\n if (!this.isOpen || !window.mapboxgl || !this.mapboxToken) {\n return;\n }\n\n const mapContainer = this.shadowRoot.querySelector('#map')\n if (mapContainer && !this.map) {\n this.map = new window.mapboxgl.Map({\n accessToken: this.mapboxToken,\n container: mapContainer,\n style: 'mapbox://styles/mapbox/streets-v12', // style URL\n minZoom: 1,\n });\n this.map.on('load', () => this.map.resize());\n if (this.center && this.center.length) {\n this.map.setCenter(this.center);\n this.map.setZoom(15);\n }\n\n // Add zoom controls\n const nav = new mapboxgl.NavigationControl();\n this.map.addControl(nav, 'bottom-right');\n\n // Add pin if there is one\n this.addPinFromMetadata();\n\n // If map is editable add/move marker on click\n this.map.on('click', (e) => {\n if (!this.canEdit) {\n return;\n }\n if (this.marker) {\n this.marker.setLngLat(e.lngLat)\n } else {\n this.marker = new mapboxgl.Marker()\n .setLngLat(e.lngLat)\n .addTo(this.map);\n }\n });\n }\n }\n\n addPinFromMetadata() {\n if (this.metadata) {\n const { lng, lat, level } = this.metadata;\n let zoom = 15\n if ('admin0' === level) {\n zoom = 3\n } else if ('admin1' === level) {\n zoom = 6\n } else if ('admin2' === level) {\n zoom = 10\n }\n\n if (this.map) {\n this.map.setCenter([lng, lat]);\n this.map.setZoom(zoom);\n this.marker = new mapboxgl.Marker()\n .setLngLat([lng, lat])\n .addTo(this.map);\n }\n }\n }\n\n updated(changedProperties) {\n if (!window.mapboxgl) {\n return;\n }\n\n if (changedProperties.has('metadata') && this.metadata && this.metadata.lat) {\n this.addPinFromMetadata()\n }\n if (changedProperties.has('isOpen') && this.isOpen) {\n this.initMap();\n }\n }\n\n onClose(e) {\n if (e?.detail?.action === 'button' && this.marker) {\n this.dispatchEvent(new CustomEvent('submit', {\n detail: {\n location: this.marker.getLngLat(),\n }\n }));\n }\n }\n render() {\n return html` \n \n
    \n
    \n
    \n \n ${this.canEdit ? html`
    ${msg('Save')}
    ` : null}\n \n \n \n `;\n }\n}\n\nwindow.customElements.define('dt-map-modal', DtMapModal);\n"],"names":["window","customElements","define","DtBase","properties","super","title","type","String","isOpen","Boolean","canEdit","state","metadata","Object","center","Array","mapboxToken","attribute","styles","css","constructor","this","addEventListener","e","shadowRoot","querySelector","dispatchEvent","Event","connectedCallback","mapboxgl","initMap","script","document","createElement","src","onload","bind","body","appendChild","console","log","mapContainer","map","Map","accessToken","container","style","minZoom","on","resize","length","setCenter","setZoom","nav","NavigationControl","addControl","addPinFromMetadata","marker","setLngLat","lngLat","Marker","addTo","lng","lat","level","zoom","updated","changedProperties","has","onClose","detail","action","CustomEvent","location","getLngLat","render","html","label","msg"],"mappings":"uSAwKAA,OAAOC,eAAeC,OAAO,eAnKtB,cAAy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xB,SAASyB,kBACzBjC,KAAKqB,IAAIa,WAAWF,EAAK,gBAGzBhC,KAAKmC,qBAGLnC,KAAKqB,IAAIM,GAAG,SAAUzB,IACfF,KAAKX,UAGNW,KAAKoC,OACPpC,KAAKoC,OAAOC,UAAUnC,EAAEoC,QAExBtC,KAAKoC,QAAS,IAAI5B,SAAS+B,QACxBF,UAAUnC,EAAEoC,QACZE,MAAMxC,KAAKqB,KACf,GAEJ,CACF,CAEDc,qBACE,GAAInC,KAAKT,SAAU,CACjB,MAAMkD,IAAEA,EAAGC,IAAEA,EAAGC,MAAEA,GAAU3C,KAAKT,SACjC,IAAIqD,EAAO,GACP,WAAaD,EACfC,EAAO,EACE,WAAaD,EACtBC,EAAO,EACE,WAAaD,IACtBC,EAAO,IAGL5C,KAAKqB,MACPrB,KAAKqB,IAAIS,UAAU,CAACW,EAAKC,IACzB1C,KAAKqB,IAAIU,QAAQa,GACjB5C,KAAKoC,QAAS,IAAI5B,SAAS+B,QACxBF,UAAU,CAACI,EAAKC,IAChBF,MAAMxC,KAAKqB,KAEjB,CACF,CAEDwB,QAAQC,GACDpE,OAAO8B,WAIRsC,EAAkBC,IAAI,aAAe/C,KAAKT,UAAYS,KAAKT,SAASmD,KACtE1C,KAAKmC,qBAEHW,EAAkBC,IAAI,WAAa/C,KAAKb,QAC1Ca,KAAKS,UAER,CAEDuC,QAAQ9C,GACoB,WAAtBA,GAAG+C,QAAQC,QAAuBlD,KAAKoC,QACzCpC,KAAKK,cAAc,IAAI8C,YAAY,SAAU,CAC3CF,OAAQ,CACNG,SAAUpD,KAAKoC,OAAOiB,eAI7B,CACDC,SACE,OAAOC,CAAI,qBAEEvD,KAAKT,UAAUiE,mBACdxD,KAAKb,8BAENa,KAAKgD,sEAMZhD,KAAKX,QAAUkE,CAAI,4BAA4BE,EAAI,gBAAkB,yGAK5E"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-location/dt-location.js b/dt-assets/build/components/form/dt-location/dt-location.js index 12292880a0..041fc6b6fe 100644 --- a/dt-assets/build/components/form/dt-location/dt-location.js +++ b/dt-assets/build/components/form/dt-location/dt-location.js @@ -1 +1,137 @@ -import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{i}from"../../style-map-ac85d91b.js";import{o as s}from"../../map-c0e24c36.js";import{D as l}from"../dt-tags/dt-tags.js";import"../../directive-de55b00a.js";import"../dt-multi-select/dt-multi-select.js";import"../../lit-localize-763e4978.js";import"../dt-form-base.js";import"../../dt-base.js";import"../dt-label/dt-label.js";import"../mixins/hasOptionsList.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";window.customElements.define("dt-location",class extends l{static get properties(){return{...super.properties,filters:{type:Array},mapboxKey:{type:String},dtMapbox:{type:Object}}}static get styles(){return[...super.styles,t`.input-group{display:flex}.field-container{position:relative}select{border:1px solid var(--dt-form-border-color,#cacaca);outline:0}.selected-option>:first-child{max-width:calc(var(--container-width) - var(--select-width) - var(--container-padding) - var(--option-padding) - var(--option-button) - 8px)}`]}_clickOption(t){if(t.target&&t.target.value){const e=t.target.value,i=this.filteredOptions.reduce(((t,i)=>t||i.id!==e?t:i),null);this._select(i)}}_clickAddNew(t){if(t.target){this._select({id:t.target.dataset?.label,label:t.target.dataset?.label,isNew:!0});const e=this.shadowRoot.querySelector("input");e&&(e.value="")}}_keyboardSelectOption(){this.activeIndex>-1&&(this.activeIndex+1>this.filteredOptions.length?this._select({id:this.query,label:this.query,isNew:!0}):this._select(this.filteredOptions[this.activeIndex]))}_remove(t){if(t.target&&t.target.dataset&&t.target.dataset.value){const e=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value}});this.value=(this.value||[]).map((e=>{const i={...e};return e.id===t.target.dataset.value&&(i.delete=!0),i})),e.detail.newValue=this.value,this.dispatchEvent(e),this.open&&this.shadowRoot.querySelector("input").focus()}}updated(){super.updated();const t=this.shadowRoot.querySelector(".input-group"),e=t.style.getPropertyValue("--select-width"),i=this.shadowRoot.querySelector("select");!e&&i?.clientWidth>0&&t.style.setProperty("--select-width",`${i.clientWidth}px`)}_filterOptions(){const t=(this.value||[]).filter((t=>!t.delete)).map((t=>t?.id));if(this.options?.length)this.filteredOptions=(this.options||[]).filter((e=>!t.includes(e.id)&&(!this.query||e.label.toLocaleLowerCase().includes(this.query.toLocaleLowerCase()))));else{this.loading=!0,this.filteredOptions=[];const e=this,i=this.shadowRoot.querySelector("select"),s=new CustomEvent("load",{bubbles:!0,detail:{field:this.name,query:this.query,filter:i?.value,onSuccess:i=>{e.loading=!1,e.filteredOptions=i.filter((e=>!t.includes(e.id)))},onError:t=>{console.warn(t),e.loading=!1}}});this.dispatchEvent(s)}return this.filteredOptions}_renderOption(t,i){return e`
  • `}_renderSelectedOptions(){return(this.value||[]).filter((t=>!t.delete)).map((t=>e``))}render(){const t={display:this.open?"block":"none",top:`${this.containerHeight}px`};return this.mapboxKey?e`${this.labelTemplate()}
    `:e`${this.labelTemplate()}
    ${this._renderSelectedOptions()} ${this.loading?e``:null} ${this.saved?e``:null}
      ${this._renderOptions()}
    `}}); +import { i as t, y as e } from '../../lit-element-2409d5fe.js'; +import { i } from '../../style-map-ac85d91b.js'; +import { o as s } from '../../map-c0e24c36.js'; +import { D as l } from '../dt-tags/dt-tags.js'; +import '../../directive-de55b00a.js'; +import '../dt-multi-select/dt-multi-select.js'; +import '../../lit-localize-763e4978.js'; +import '../dt-form-base.js'; +import '../../dt-base.js'; +import '../dt-label/dt-label.js'; +import '../mixins/hasOptionsList.js'; +import '../../icons/dt-spinner.js'; +import '../../icons/dt-checkmark.js'; +window.customElements.define( + 'dt-location', + class extends l { + static get properties() { + return { + ...super.properties, + filters: { type: Array }, + mapboxKey: { type: String }, + dtMapbox: { type: Object }, + }; + } + static get styles() { + return [ + ...super.styles, + t`.input-group{display:flex}.field-container{position:relative}select{border:1px solid var(--dt-form-border-color,#cacaca);outline:0}.selected-option>:first-child{max-width:calc(var(--container-width) - var(--select-width) - var(--container-padding) - var(--option-padding) - var(--option-button) - 8px)}`, + ]; + } + _clickOption(t) { + if (t.target && t.target.value) { + const e = t.target.value, + i = this.filteredOptions.reduce( + (t, i) => (t || i.id !== e ? t : i), + null, + ); + this._select(i); + } + } + _clickAddNew(t) { + if (t.target) { + this._select({ + id: t.target.dataset?.label, + label: t.target.dataset?.label, + isNew: !0, + }); + const e = this.shadowRoot.querySelector('input'); + e && (e.value = ''); + } + } + _keyboardSelectOption() { + this.activeIndex > -1 && + (this.activeIndex + 1 > this.filteredOptions.length + ? this._select({ id: this.query, label: this.query, isNew: !0 }) + : this._select(this.filteredOptions[this.activeIndex])); + } + _remove(t) { + if (t.target && t.target.dataset && t.target.dataset.value) { + const e = new CustomEvent('change', { + detail: { field: this.name, oldValue: this.value }, + }); + (this.value = (this.value || []).map((e) => { + const i = { ...e }; + return e.id === t.target.dataset.value && (i.delete = !0), i; + })), + (e.detail.newValue = this.value), + this.dispatchEvent(e), + this.open && this.shadowRoot.querySelector('input').focus(); + } + } + updated() { + super.updated(); + const t = this.shadowRoot.querySelector('.input-group'), + e = t.style.getPropertyValue('--select-width'), + i = this.shadowRoot.querySelector('select'); + !e && + i?.clientWidth > 0 && + t.style.setProperty('--select-width', `${i.clientWidth}px`); + } + _filterOptions() { + const t = (this.value || []).filter((t) => !t.delete).map((t) => t?.id); + if (this.options?.length) + this.filteredOptions = (this.options || []).filter( + (e) => + !t.includes(e.id) && + (!this.query || + e.label + .toLocaleLowerCase() + .includes(this.query.toLocaleLowerCase())), + ); + else { + (this.loading = !0), (this.filteredOptions = []); + const e = this, + i = this.shadowRoot.querySelector('select'), + s = new CustomEvent('load', { + bubbles: !0, + detail: { + field: this.name, + query: this.query, + filter: i?.value, + onSuccess: (i) => { + (e.loading = !1), + (e.filteredOptions = i.filter((e) => !t.includes(e.id))); + }, + onError: (t) => { + console.warn(t), (e.loading = !1); + }, + }, + }); + this.dispatchEvent(s); + } + return this.filteredOptions; + } + _renderOption(t, i) { + return e`
  • `; + } + _renderSelectedOptions() { + return (this.value || []) + .filter((t) => !t.delete) + .map( + (t) => + e``, + ); + } + render() { + const t = { + display: this.open ? 'block' : 'none', + top: `${this.containerHeight}px`, + }; + return this.mapboxKey + ? e`${this.labelTemplate()}
    ` + : e`${this.labelTemplate()}
    ${this._renderSelectedOptions()} ${this.loading ? e`` : null} ${this.saved ? e`` : null}
      ${this._renderOptions()}
    `; + } + }, +); +//# sourceMappingURL=dt-location.js.map diff --git a/dt-assets/build/components/form/dt-location/dt-location.js.map b/dt-assets/build/components/form/dt-location/dt-location.js.map new file mode 100644 index 0000000000..ea8c23d460 --- /dev/null +++ b/dt-assets/build/components/form/dt-location/dt-location.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-location.js","sources":["../../../src/components/form/dt-location/dt-location.js"],"sourcesContent":["import { css, html } from 'lit';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { map } from 'lit/directives/map.js';\nimport { DtTags } from '../dt-tags/dt-tags.js';\n\nexport class DtLocation extends DtTags {\n static get properties() {\n return {\n ...super.properties,\n filters: { type: Array },\n mapboxKey: { type: String },\n dtMapbox: { type: Object },\n };\n }\n\n static get styles() {\n return [\n ...super.styles,\n css`\n .input-group {\n display: flex;\n }\n\n .field-container {\n position: relative;\n }\n\n select {\n border: 1px solid var(--dt-form-border-color, #cacaca);\n outline: 0;\n }\n .selected-option > *:first-child {\n max-width: calc(\n var(--container-width) - var(--select-width) -\n var(--container-padding) - var(--option-padding) -\n var(--option-button) - 8px\n );\n }\n `,\n ];\n }\n\n _clickOption(e) {\n if (e.target && e.target.value) {\n const id = e.target.value;\n const option = this.filteredOptions.reduce((result, opt) => {\n if (!result && opt.id === id) {\n return opt;\n }\n return result;\n }, null);\n this._select(option);\n }\n }\n\n _clickAddNew(e) {\n if (e.target) {\n this._select({\n id: e.target.dataset?.label,\n label: e.target.dataset?.label,\n isNew: true,\n });\n // clear search field if clicked with mouse, since field will lose focus\n const input = this.shadowRoot.querySelector('input');\n if (input) {\n input.value = '';\n }\n }\n }\n\n _keyboardSelectOption() {\n if (this.activeIndex > -1) {\n if (this.activeIndex + 1 > this.filteredOptions.length) {\n this._select({\n id: this.query,\n label: this.query,\n isNew: true,\n });\n } else {\n this._select(this.filteredOptions[this.activeIndex]);\n }\n }\n }\n\n _remove(e) {\n if (e.target && e.target.dataset && e.target.dataset.value) {\n const event = new CustomEvent('change', {\n detail: {\n field: this.name,\n oldValue: this.value,\n },\n });\n this.value = (this.value || []).map(i => {\n const val = {\n ...i,\n };\n if (i.id === e.target.dataset.value) {\n val.delete = true;\n }\n return val;\n });\n event.detail.newValue = this.value;\n\n // dispatch event for use with addEventListener from javascript\n this.dispatchEvent(event);\n\n // If option was de-selected while list was open, re-focus input\n if (this.open) {\n this.shadowRoot.querySelector('input').focus();\n }\n }\n }\n\n updated() {\n super.updated();\n\n // set variable with width of container for truncating selected options via CSS\n const container = this.shadowRoot.querySelector('.input-group');\n const currentValue = container.style.getPropertyValue('--select-width');\n const select = this.shadowRoot.querySelector('select');\n if (!currentValue && select?.clientWidth > 0) {\n container.style.setProperty('--select-width', `${select.clientWidth}px`);\n }\n }\n\n /**\n * Filter to options that:\n * 1: are not selected\n * 2: match the search query\n * @private\n */\n _filterOptions() {\n const selectedValues = (this.value || [])\n .filter(i => !i.delete)\n .map(v => v?.id);\n\n if (this.options?.length) {\n this.filteredOptions = (this.options || []).filter(\n opt =>\n !selectedValues.includes(opt.id) &&\n (!this.query ||\n opt.label\n .toLocaleLowerCase()\n .includes(this.query.toLocaleLowerCase()))\n );\n } else {\n this.loading = true;\n this.filteredOptions = [];\n\n // need to fetch data via API request\n const self = this;\n const selectEl = this.shadowRoot.querySelector('select');\n const event = new CustomEvent('load', {\n bubbles: true,\n detail: {\n field: this.name,\n query: this.query,\n filter: selectEl?.value,\n onSuccess: result => {\n self.loading = false;\n\n // filter out selected values from list\n self.filteredOptions = result.filter(\n opt => !selectedValues.includes(opt.id)\n );\n },\n onError: error => {\n console.warn(error);\n self.loading = false;\n },\n },\n });\n this.dispatchEvent(event);\n }\n return this.filteredOptions;\n }\n\n _renderOption(opt, idx) {\n return html`\n
  • \n -1 && this.activeIndex === idx\n ? 'active'\n : ''}\"\n >\n ${opt.label}\n \n
  • \n `;\n }\n\n _renderSelectedOptions() {\n return (this.value || [])\n .filter(i => !i.delete)\n .map(\n opt => {\n return html`\n
    \n ${opt.label}\n \n x\n \n
    \n `}\n );\n }\n\n render() {\n const optionListStyles = {\n display: this.open ? 'block' : 'none',\n top: `${this.containerHeight}px`,\n };\n return this.mapboxKey\n ? html` ${this.labelTemplate()}\n
    \n \n \n
    \n \n \n \n \n ×\n \n
    \n
    \n \n
    \n `\n : html`\n ${this.labelTemplate()}\n\n
    \n \n ${this._renderSelectedOptions()}\n \n\n ${this.loading\n ? html``\n : null}\n ${this.saved\n ? html``\n : null}\n
    \n \n
      \n ${this._renderOptions()}\n
    \n \n `;\n }\n}\n\nwindow.customElements.define('dt-location', DtLocation);\n"],"names":["window","customElements","define","DtTags","properties","super","filters","type","Array","mapboxKey","String","dtMapbox","Object","styles","css","_clickOption","e","target","value","id","option","this","filteredOptions","reduce","result","opt","_select","_clickAddNew","dataset","label","isNew","input","shadowRoot","querySelector","_keyboardSelectOption","activeIndex","length","query","_remove","event","CustomEvent","detail","field","name","oldValue","map","i","val","delete","newValue","dispatchEvent","open","focus","updated","container","currentValue","style","getPropertyValue","select","clientWidth","setProperty","_filterOptions","selectedValues","filter","v","options","includes","toLocaleLowerCase","loading","self","selectEl","bubbles","onSuccess","onError","error","console","warn","_renderOption","idx","html","_touchStart","_touchMove","_touchEnd","_renderSelectedOptions","link","disabled","status","render","optionListStyles","display","top","containerHeight","labelTemplate","_focusInput","placeholder","_inputFocusIn","_inputFocusOut","_inputKeyDown","_inputKeyUp","saved","f","styleMap","_renderOptions"],"mappings":"+eA8TAA,OAAOC,eAAeC,OAAO,cAzTtB,cAAyBC,EACnBC,wBACT,MAAO,IACFC,MAAMD,WACTE,QAAS,CAAEC,KAAMC,OACjBC,UAAW,CAAEF,KAAMG,QACnBC,SAAU,C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B6C,QAAOjB,IAAMA,EAAEE,SACfH,KACCpB,GACSsD,CAAI,yCAGCtD,EAAI2D,oBACC/D,KAAKgE,kBACX5D,EAAI6D,OAAS7D,EAAI6D,OAAOzD,MAAQJ,EAAII,UACxCJ,EAAII,6BAGGR,KAAKiB,uBACFjB,KAAKgE,yBACJ5D,EAAIN,wBAO7B,CAEDoE,SACE,MAAMC,EAAmB,CACvBC,QAASpE,KAAK8B,KAAO,QAAU,OAC/BuC,IAAK,GAAGrE,KAAKsE,qBAEf,OAAOtE,KAAKZ,UACRsE,CAAI,GAAI1D,KAAKuE,05BA6Cbb,CAAI,GACA1D,KAAKuE,0CAEmBvE,KAAKgE,SAAW,WAAa,4CAGzChE,KAAKwE,0BACHxE,KAAKwE,gBAEfxE,KAAK8D,4DAGU9D,KAAKyE,0BACRzE,KAAK0E,yBACR1E,KAAK2E,6BACF3E,KAAK4E,0BACP5E,KAAK6E,2BACF7E,KAAKgE,cAGlBhE,KAAK+C,QACHW,CAAI,iDACJ,QACF1D,KAAK8E,MACHpB,CAAI,6DAGJ,oDAEmC1D,KAAKgE,aAC1CxC,EACAxB,KAAKf,SACL8F,GAAKrB,CAAI,kBAAkBqB,EAAEjF,OAAOiF,EAAEvE,6DAGVwE,EAASb,OACrCnE,KAAKiF,6BAIlB"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-multi-select/dt-multi-select.js b/dt-assets/build/components/form/dt-multi-select/dt-multi-select.js index 0ef8113165..e44b3c661e 100644 --- a/dt-assets/build/components/form/dt-multi-select/dt-multi-select.js +++ b/dt-assets/build/components/form/dt-multi-select/dt-multi-select.js @@ -1 +1,112 @@ -import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{i}from"../../style-map-ac85d91b.js";import"../../lit-localize-763e4978.js";import{D as o}from"../dt-form-base.js";import{H as r}from"../mixins/hasOptionsList.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";import"../../directive-de55b00a.js";import"../../dt-base.js";import"../dt-label/dt-label.js";class l extends(r(o)){static get styles(){return[...super.styles,t`:host{position:relative;font-family:Helvetica,Arial,sans-serif}.input-group{color:var(--dt-multi-select-text-color,#0a0a0a);margin-bottom:1rem}.input-group.disabled .field-container,.input-group.disabled input{background-color:var(--disabled-color)}.input-group.disabled a,.input-group.disabled button{cursor:not-allowed;pointer-events:none}.input-group.disabled :hover{cursor:not-allowed}.field-container{background-color:var(--dt-multi-select-background-color,#fefefe);border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;color:var(--dt-multi-select-text-color,#0a0a0a);font-size:1rem;font-weight:300;min-height:2.5rem;line-height:1.5;margin:0;padding-top:calc(.5rem - .375rem);padding-bottom:.5rem;padding-inline:.5rem 1.6rem;box-sizing:border-box;width:100%;text-transform:none;display:flex;flex-wrap:wrap}.field-container .selected-option,.field-container input{height:1.25rem}.selected-option{border:1px solid var(--dt-multi-select-tag-border-color,#c2e0ff);background-color:var(--dt-multi-select-tag-background-color,#c2e0ff);display:flex;font-size:.875rem;position:relative;border-radius:2px;margin-inline-end:4px;margin-block-start:.375rem;box-sizing:border-box}.selected-option>:first-child{padding-inline-start:4px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;--container-padding:calc(0.5rem + 1.6rem + 2px);--option-padding:8px;--option-button:20px;max-width:calc(var(--container-width) - var(--container-padding) - var(--option-padding) - var(--option-button))}.selected-option *{align-self:center}.selected-option button{background:0 0;outline:0;border:0;border-inline-start:1px solid var(--dt-multi-select-tag-border-color,#c2e0ff);color:var(--dt-multi-select-text-color,#0a0a0a);margin-inline-start:4px}.selected-option button:hover{cursor:pointer}.field-container input{background-color:var(--dt-form-background-color,#fff);color:var(--dt-form-text-color,#000);flex-grow:1;min-width:50px;border:0;margin-block-start:.375rem}.field-container input:active,.field-container input:focus,.field-container input:focus-visible{border:0;outline:0}.field-container input::placeholder{color:var(--dt-text-placeholder-color,#999);opacity:1}.option-list{list-style:none;margin:0;padding:0;border:1px solid var(--dt-form-border-color,#cacaca);background:var(--dt-form-background-color,#fefefe);z-index:10;position:absolute;width:100%;top:0;left:0;box-shadow:var(--shadow-1);max-height:150px;overflow-y:scroll}.option-list li{border-block-start:1px solid var(--dt-form-border-color,#cacaca);outline:0}.option-list li button,.option-list li div{padding:.5rem .75rem;color:var(--dt-multi-select-text-color,#0a0a0a);font-weight:100;font-size:1rem;text-decoration:none;text-align:inherit}.option-list li button{display:block;width:100%;border:0;background:0 0}.option-list li button.active,.option-list li button:hover{cursor:pointer;background:var(--dt-multi-select-option-hover-background,#f5f5f5)}`]}static get properties(){return{...super.properties,placeholder:{type:String},containerHeight:{type:Number,state:!0},onchange:{type:String}}}_select(t){const e=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value}});if(this.value&&this.value.length)if("string"==typeof this.value[0])this.value=[...this.value.filter((e=>e!==`-${t}`)),t];else{let e=!1;const i=this.value.map((i=>{const o={...i};return i.id===t.id&&i.delete&&(delete o.delete,e=!0),o}));e||i.push(t),this.value=i}else this.value=[t];e.detail.newValue=this.value,this.open=!1,this.activeIndex=-1,this.dispatchEvent(e),this._setFormValue(this.value)}_remove(t){if(t.target&&t.target.dataset&&t.target.dataset.value){const e=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value}});this.value=(this.value||[]).map((e=>e===t.target.dataset.value?`-${e}`:e)),e.detail.newValue=this.value,this.dispatchEvent(e),this._setFormValue(this.value),this.open&&this.shadowRoot.querySelector("input").focus()}}_filterOptions(){return this.filteredOptions=(this.options||[]).filter((t=>!(this.value||[]).includes(t.id)&&(!this.query||t.label.toLocaleLowerCase().includes(this.query.toLocaleLowerCase())))),this.filteredOptions}willUpdate(t){if(super.willUpdate(t),t){const e=t.has("value"),i=t.has("query"),o=t.has("options");(e||i||o)&&this._filterOptions()}}_renderSelectedOptions(){return this.options&&this.options.filter((t=>this.value&&this.value.indexOf(t.id)>-1)).map((t=>e`
    ${t.label}
    `))}render(){const t={display:this.open?"block":"none",top:this.containerHeight?`${this.containerHeight}px`:"2.5rem"};return e`${this.labelTemplate()}
    ${this._renderSelectedOptions()}
      ${this._renderOptions()}
    ${this.loading?e``:null} ${this.saved?e``:null} ${this.error?e``:null}
    `}}window.customElements.define("dt-multi-select",l);export{l as D}; +import { i as t, y as e } from '../../lit-element-2409d5fe.js'; +import { i } from '../../style-map-ac85d91b.js'; +import '../../lit-localize-763e4978.js'; +import { D as o } from '../dt-form-base.js'; +import { H as r } from '../mixins/hasOptionsList.js'; +import '../../icons/dt-spinner.js'; +import '../../icons/dt-checkmark.js'; +import '../../directive-de55b00a.js'; +import '../../dt-base.js'; +import '../dt-label/dt-label.js'; +class l extends r(o) { + static get styles() { + return [ + ...super.styles, + t`:host{position:relative;font-family:Helvetica,Arial,sans-serif}.input-group{color:var(--dt-multi-select-text-color,#0a0a0a);margin-bottom:1rem}.input-group.disabled .field-container,.input-group.disabled input{background-color:var(--disabled-color)}.input-group.disabled a,.input-group.disabled button{cursor:not-allowed;pointer-events:none}.input-group.disabled :hover{cursor:not-allowed}.field-container{background-color:var(--dt-multi-select-background-color,#fefefe);border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;color:var(--dt-multi-select-text-color,#0a0a0a);font-size:1rem;font-weight:300;min-height:2.5rem;line-height:1.5;margin:0;padding-top:calc(.5rem - .375rem);padding-bottom:.5rem;padding-inline:.5rem 1.6rem;box-sizing:border-box;width:100%;text-transform:none;display:flex;flex-wrap:wrap}.field-container .selected-option,.field-container input{height:1.25rem}.selected-option{border:1px solid var(--dt-multi-select-tag-border-color,#c2e0ff);background-color:var(--dt-multi-select-tag-background-color,#c2e0ff);display:flex;font-size:.875rem;position:relative;border-radius:2px;margin-inline-end:4px;margin-block-start:.375rem;box-sizing:border-box}.selected-option>:first-child{padding-inline-start:4px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;--container-padding:calc(0.5rem + 1.6rem + 2px);--option-padding:8px;--option-button:20px;max-width:calc(var(--container-width) - var(--container-padding) - var(--option-padding) - var(--option-button))}.selected-option *{align-self:center}.selected-option button{background:0 0;outline:0;border:0;border-inline-start:1px solid var(--dt-multi-select-tag-border-color,#c2e0ff);color:var(--dt-multi-select-text-color,#0a0a0a);margin-inline-start:4px}.selected-option button:hover{cursor:pointer}.field-container input{background-color:var(--dt-form-background-color,#fff);color:var(--dt-form-text-color,#000);flex-grow:1;min-width:50px;border:0;margin-block-start:.375rem}.field-container input:active,.field-container input:focus,.field-container input:focus-visible{border:0;outline:0}.field-container input::placeholder{color:var(--dt-text-placeholder-color,#999);opacity:1}.option-list{list-style:none;margin:0;padding:0;border:1px solid var(--dt-form-border-color,#cacaca);background:var(--dt-form-background-color,#fefefe);z-index:10;position:absolute;width:100%;top:0;left:0;box-shadow:var(--shadow-1);max-height:150px;overflow-y:scroll}.option-list li{border-block-start:1px solid var(--dt-form-border-color,#cacaca);outline:0}.option-list li button,.option-list li div{padding:.5rem .75rem;color:var(--dt-multi-select-text-color,#0a0a0a);font-weight:100;font-size:1rem;text-decoration:none;text-align:inherit}.option-list li button{display:block;width:100%;border:0;background:0 0}.option-list li button.active,.option-list li button:hover{cursor:pointer;background:var(--dt-multi-select-option-hover-background,#f5f5f5)}`, + ]; + } + static get properties() { + return { + ...super.properties, + placeholder: { type: String }, + containerHeight: { type: Number, state: !0 }, + onchange: { type: String }, + }; + } + connectedCallback() { + super.connectedCallback(), + this.value && + this.value.length && + (this.value = this.value.map((t) => (t.id ? t.label : t))); + } + _select(t) { + const e = new CustomEvent('change', { + bubbles: !0, + detail: { field: this.name, oldValue: this.value }, + }); + if (this.value && this.value.length) + if ('string' == typeof this.value[0]) + this.value = [...this.value.filter((e) => e !== `-${t}`), t]; + else { + let e = !1; + const i = this.value.map((i) => { + const o = { ...i }; + return i.id === t.id && i.delete && (delete o.delete, (e = !0)), o; + }); + e || i.push(t), (this.value = i); + } + else this.value = [t]; + (e.detail.newValue = this.value), + (this.open = !1), + (this.activeIndex = -1), + this.dispatchEvent(e), + this._setFormValue(this.value); + } + _remove(t) { + if (t.target && t.target.dataset && t.target.dataset.value) { + const e = new CustomEvent('change', { + bubbles: !0, + detail: { field: this.name, oldValue: this.value }, + }); + (this.value = (this.value || []).map((e) => + e === t.target.dataset.value ? `-${e}` : e, + )), + (e.detail.newValue = this.value), + this.dispatchEvent(e), + this._setFormValue(this.value), + this.open && this.shadowRoot.querySelector('input').focus(); + } + } + _filterOptions() { + return ( + (this.filteredOptions = (this.options || []).filter( + (t) => + !(this.value || []).includes(t.id) && + (!this.query || + t.label + .toLocaleLowerCase() + .includes(this.query.toLocaleLowerCase())), + )), + this.filteredOptions + ); + } + willUpdate(t) { + if ((super.willUpdate(t), t)) { + const e = t.has('value'), + i = t.has('query'), + o = t.has('options'); + (e || i || o) && this._filterOptions(); + } + } + _renderSelectedOptions() { + return ( + this.options && + this.options + .filter((t) => this.value && this.value.indexOf(t.id) > -1) + .map( + (t) => + e`
    ${t.label}
    `, + ) + ); + } + render() { + const t = { + display: this.open ? 'block' : 'none', + top: this.containerHeight ? `${this.containerHeight}px` : '2.5rem', + }; + return e`${this.labelTemplate()}
    ${this._renderSelectedOptions()}
      ${this._renderOptions()}
    ${this.loading ? e`` : null} ${this.saved ? e`` : null} ${this.error ? e`` : null}
    `; + } +} +window.customElements.define('dt-multi-select', l); +export { l as D }; +//# sourceMappingURL=dt-multi-select.js.map diff --git a/dt-assets/build/components/form/dt-multi-select/dt-multi-select.js.map b/dt-assets/build/components/form/dt-multi-select/dt-multi-select.js.map new file mode 100644 index 0000000000..8fee8d3f84 --- /dev/null +++ b/dt-assets/build/components/form/dt-multi-select/dt-multi-select.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-multi-select.js","sources":["../../../src/components/form/dt-multi-select/dt-multi-select.js"],"sourcesContent":["import { html, css } from 'lit';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { msg } from '@lit/localize';\nimport DtFormBase from '../dt-form-base.js';\nimport {HasOptionsList} from '../mixins/hasOptionsList.js';\nimport '../../icons/dt-spinner.js';\nimport '../../icons/dt-checkmark.js';\n\nexport class DtMultiSelect extends HasOptionsList(DtFormBase) {\n static get styles() {\n return [\n ...super.styles,\n css`\n :host {\n position: relative;\n font-family: Helvetica, Arial, sans-serif;\n }\n\n .input-group {\n color: var(--dt-multi-select-text-color, #0a0a0a);\n margin-bottom: 1rem;\n }\n .input-group.disabled input,\n .input-group.disabled .field-container {\n background-color: var(--disabled-color);\n }\n .input-group.disabled a,\n .input-group.disabled button {\n cursor: not-allowed;\n pointer-events: none;\n }\n .input-group.disabled *:hover {\n cursor: not-allowed;\n }\n\n .field-container {\n background-color: var(--dt-multi-select-background-color, #fefefe);\n border: 1px solid var(--dt-form-border-color, #cacaca);\n border-radius: 0;\n color: var(--dt-multi-select-text-color, #0a0a0a);\n font-size: 1rem;\n font-weight: 300;\n min-height: 2.5rem;\n line-height: 1.5;\n margin: 0;\n padding-top: calc(0.5rem - 0.375rem);\n padding-bottom: 0.5rem;\n padding-inline: 0.5rem 1.6rem;\n box-sizing: border-box;\n width: 100%;\n text-transform: none;\n display: flex;\n flex-wrap: wrap;\n }\n\n .field-container input,\n .field-container .selected-option {\n height: 1.25rem;\n }\n\n .selected-option {\n border: 1px solid var(--dt-multi-select-tag-border-color, #c2e0ff);\n background-color: var(\n --dt-multi-select-tag-background-color,\n #c2e0ff\n );\n\n display: flex;\n font-size: 0.875rem;\n position: relative;\n border-radius: 2px;\n margin-inline-end: 4px;\n margin-block-start: 0.375rem;\n box-sizing: border-box;\n }\n .selected-option > *:first-child {\n padding-inline-start: 4px;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n --container-padding: calc(0.5rem + 1.6rem + 2px);\n --option-padding: 8px;\n --option-button: 20px;\n max-width: calc(\n var(--container-width) - var(--container-padding) -\n var(--option-padding) - var(--option-button)\n );\n }\n .selected-option * {\n align-self: center;\n }\n .selected-option button {\n background: transparent;\n outline: 0;\n border: 0;\n border-inline-start: 1px solid\n var(--dt-multi-select-tag-border-color, #c2e0ff);\n color: var(--dt-multi-select-text-color, #0a0a0a);\n margin-inline-start: 4px;\n }\n .selected-option button:hover {\n cursor: pointer;\n }\n\n .field-container input {\n background-color: var(--dt-form-background-color, #fff);\n color: var(--dt-form-text-color, #000);\n flex-grow: 1;\n min-width: 50px;\n border: 0;\n margin-block-start: 0.375rem;\n }\n .field-container input:focus,\n .field-container input:focus-visible,\n .field-container input:active {\n border: 0;\n outline: 0;\n }\n .field-container input::placeholder {\n color: var(--dt-text-placeholder-color, #999);\n opacity: 1;\n }\n\n /* === Options List === */\n .option-list {\n list-style: none;\n margin: 0;\n padding: 0;\n border: 1px solid var(--dt-form-border-color, #cacaca);\n background: var(--dt-form-background-color, #fefefe);\n z-index: 10;\n position: absolute;\n width: 100%;\n top: 0;\n left: 0;\n box-shadow: var(--shadow-1);\n max-height: 150px;\n overflow-y: scroll;\n }\n .option-list li {\n border-block-start: 1px solid var(--dt-form-border-color, #cacaca);\n outline: 0;\n }\n .option-list li div,\n .option-list li button {\n padding: 0.5rem 0.75rem;\n color: var(--dt-multi-select-text-color, #0a0a0a);\n font-weight: 100;\n font-size: 1rem;\n text-decoration: none;\n text-align: inherit;\n }\n .option-list li button {\n display: block;\n width: 100%;\n border: 0;\n background: transparent;\n }\n .option-list li button:hover,\n .option-list li button.active {\n cursor: pointer;\n background: var(--dt-multi-select-option-hover-background, #f5f5f5);\n }\n `,\n ];\n }\n\n static get properties() {\n return {\n ...super.properties,\n placeholder: { type: String },\n containerHeight: {\n type: Number,\n state: true,\n },\n onchange: { type: String },\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.value && this.value.length) {\n this.value = this.value.map(value => {\n if (value.id) {\n return value.label;\n }\n return value;\n });\n }\n }\n\n _select(value) {\n // Create custom event with new/old values to pass to onchange function\n const event = new CustomEvent('change', {\n bubbles: true,\n detail: {\n field: this.name,\n oldValue: this.value,\n },\n });\n\n // update value in this component\n if (this.value && this.value.length) {\n if (typeof this.value[0] === 'string') {\n // If value is array of strings, check for same value prefixed with hyphen\n this.value = [...this.value.filter(i => i !== `-${value}`), value];\n } else {\n // If value is array of objects, check for same value with `delete` property\n let foundPrevious = false;\n const newVal = this.value.map(i => {\n const val = {\n ...i,\n };\n if (i.id === value.id && i.delete) {\n delete val.delete;\n foundPrevious = true;\n }\n return val;\n });\n if (!foundPrevious) {\n newVal.push(value);\n }\n this.value = newVal;\n }\n } else {\n this.value = [value];\n }\n event.detail.newValue = this.value;\n this.open = false; // close options list\n this.activeIndex = -1; // reset keyboard-selected option\n\n // dispatch event for use with addEventListener from javascript\n this.dispatchEvent(event);\n this._setFormValue(this.value);\n }\n\n _remove(e) {\n if (e.target && e.target.dataset && e.target.dataset.value) {\n const event = new CustomEvent('change', {\n bubbles: true,\n detail: {\n field: this.name,\n oldValue: this.value,\n },\n });\n this.value = (this.value || []).map(i =>\n i === e.target.dataset.value ? `-${i}` : i\n );\n event.detail.newValue = this.value;\n\n // dispatch event for use with addEventListener from javascript\n this.dispatchEvent(event);\n this._setFormValue(this.value);\n\n // If option was de-selected while list was open, re-focus input\n if (this.open) {\n this.shadowRoot.querySelector('input').focus();\n }\n }\n }\n\n /**\n * Filter to options that:\n * 1: are not selected\n * 2: match the search query\n * @private\n */\n _filterOptions() {\n this.filteredOptions = (this.options || []).filter(\n opt =>\n !(this.value || []).includes(opt.id) &&\n (!this.query ||\n opt.label\n .toLocaleLowerCase()\n .includes(this.query.toLocaleLowerCase()))\n );\n return this.filteredOptions;\n }\n\n willUpdate(props) {\n super.willUpdate(props);\n\n if (props) {\n const valueChanged = props.has('value');\n const queryChanged = props.has('query');\n const optionsChanged = props.has('options');\n\n // if value, query, or options change, trigger filter\n if (valueChanged || queryChanged || optionsChanged) {\n this._filterOptions();\n }\n }\n }\n\n _renderSelectedOptions() {\n return (\n this.options &&\n this.options\n .filter(opt => this.value && this.value.indexOf(opt.id) > -1)\n .map(\n opt => html`\n
    \n ${opt.label}\n \n x\n \n
    \n `\n )\n );\n }\n\n render() {\n const optionListStyles = {\n display: this.open ? 'block' : 'none',\n top: this.containerHeight ? `${this.containerHeight}px` : '2.5rem',\n };\n return html`\n ${this.labelTemplate()}\n\n
    \n \n ${this._renderSelectedOptions()}\n \n
    \n
      \n ${this._renderOptions()}\n
    \n ${this.loading\n ? html``\n : null}\n ${this.saved\n ? html``\n : null}\n ${this.error\n ? html``\n : null}\n \n`;\n }\n}\n\nwindow.customElements.define('dt-multi-select', DtMultiSelect);\n"],"names":["DtMultiSelect","HasOptionsList","DtFormBase","styles","super","css","properties","placeholder","type","String","containerHeight","Number","state","onchange","connectedCallback","this","value","length","map","id","label","_select","event","CustomEvent","bubbles","detail","field","name","oldValue","filter","i","foundPrevious","newVal","val","delete","push","newValue","open","activeIndex","dispatchEvent","_setFormValue","_remove","e","target","dataset","shadowRoot","querySelector","focus","_filterOptions","filteredOptions","options","opt","includes","query","toLocaleLowerCase","willUpdate","props","valueChanged","has","queryChanged","optionsChanged","_renderSelectedOptions","indexOf","html","disabled","render","optionListStyles","display","top","labelTemplate","_focusInput","_inputFocusIn","_inputFocusOut","_inputKeyDown","_inputKeyUp","styleMap","_renderOptions","loading","saved","error","window","customElements","define"],"mappings":"qYAQO,MAAMA,UAAsBC,EAAeC,IACrCC,oBACT,MAAO,IACFC,MAAMD,OACTE,CAAG,m3FAyJN,CAEUC,wBACT,MAAO,IACFF,MAAME,WACTC,YAAa,CAAEC,KAAMC,QACrBC,gBAAiB,CACfF,KAAMG,OACNC,OAAO,GAETC,SAAU,CAAEL,KAAMC,QAErB,CAEDK,oBACEV,MAAMU,oBACFC,KAAKC,OAASD,KAAKC,MAAMC,SAC3BF,KAAKC,MAAQD,KAAKC,MAAME,KAAIF,GACtBA,EAAMG,GACCH,EAAMI,MAEVJ,IAGZ,CAEDK,QAAQL,GAEN,MAAMM,EAAQ,IAAIC,YAAY,SAAU,CACtCC,SAAS,EACTC,OAAQ,CACNC,MAAOX,KAAKY,KACZC,SAAUb,KAAKC,SAKnB,GAAID,KAAKC,OAASD,KAAKC,MAAMC,OAC3B,GAA6B,iBAAlBF,KAAKC,MAAM,GAEpBD,K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AeD,EAAME,IAAI,SACzBC,EAAeH,EAAME,IAAI,SACzBE,EAAiBJ,EAAME,IAAI,YAG7BD,GAAgBE,GAAgBC,IAClC7C,KAAKiC,gBAER,CACF,CAEDa,yBACE,OACE9C,KAAKmC,SACLnC,KAAKmC,QACFrB,QAAOsB,GAAOpC,KAAKC,OAASD,KAAKC,MAAM8C,QAAQX,EAAIhC,KAAO,IAC1DD,KACCiC,GAAOY,CAAI,sCAECZ,EAAI/B,gCAEAL,KAAK0B,uBACF1B,KAAKiD,yBACJb,EAAIhC,wBAQ/B,CAED8C,SACE,MAAMC,EAAmB,CACvBC,QAASpD,KAAKsB,KAAO,QAAU,OAC/B+B,IAAKrD,KAAKL,gBAAkB,GAAGK,KAAKL,oBAAsB,UAE5D,OAAOqD,CAAI,GACPhD,KAAKsD,0CAEmBtD,KAAKiD,SAAW,WAAa,4CAGzCjD,KAAKuD,0BACHvD,KAAKuD,gBAEfvD,KAAK8C,4DAGU9C,KAAKR,0BACRQ,KAAKwD,yBACRxD,KAAKyD,6BACFzD,KAAK0D,0BACP1D,KAAK2D,2BACF3D,KAAKiD,kDAGUW,EAAST,OACrCnD,KAAK6D,wBAEP7D,KAAK8D,QACHd,CAAI,iDACJ,QACFhD,KAAK+D,MACHf,CAAI,6DACJ,QACFhD,KAAKgE,MACHhB,CAAI,wEAGWhD,KAAKgE,gCAGhB,YAGb,EAGHC,OAAOC,eAAeC,OAAO,kBAAmBlF"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-number/dt-number.js b/dt-assets/build/components/form/dt-number/dt-number.js index bd5c07be2a..e575aa1c75 100644 --- a/dt-assets/build/components/form/dt-number/dt-number.js +++ b/dt-assets/build/components/form/dt-number/dt-number.js @@ -1 +1,67 @@ -import{i as e,y as t}from"../../lit-element-2409d5fe.js";import{l as r}from"../../if-defined-11ddebeb.js";import{D as o}from"../dt-form-base.js";import{A as a}from"../../dt-base.js";import"../dt-label/dt-label.js";import"../../lit-localize-763e4978.js";window.customElements.define("dt-number",class extends o{static get styles(){return[...super.styles,e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-form-background-color,#fff);border:1px solid var(--dt-form-border-color,#ccc);border-radius:0;box-shadow:var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out)}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-form-disabled-background-color,#e6e6e6);cursor:not-allowed}input:invalid{border-color:var(--dt-form-invalid-border-color,#dc3545)}`]}static get properties(){return{...super.properties,id:{type:String},value:{type:String,reflect:!0},oldValue:{type:String},min:{type:Number},max:{type:Number},loading:{type:Boolean},saved:{type:Boolean},onchange:{type:String}}}connectedCallback(){super.connectedCallback(),this.oldValue=this.value}_checkValue(e){return!(ethis.max)}async onChange(e){if(this._checkValue(e.target.value)){const t=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value,newValue:e.target.value},bubbles:!0,composed:!0});this.value=e.target.value,this._field.setCustomValidity(""),this.dispatchEvent(t),this.api=new a(this.nonce,`${this.apiRoot}`)}else e.currentTarget.value=""}handleError(e="An error occurred."){let t=e;t instanceof Error?(console.error(t),t=t.message):console.error(t),this.error=t,this._field.setCustomValidity(t),this.invalid=!0,this.value=this.oldValue}render(){return t`${this.labelTemplate()} `}}); +import { i as e, y as t } from '../../lit-element-2409d5fe.js'; +import { l as r } from '../../if-defined-11ddebeb.js'; +import { D as o } from '../dt-form-base.js'; +import { A as a } from '../../dt-base.js'; +import '../dt-label/dt-label.js'; +import '../../lit-localize-763e4978.js'; +window.customElements.define( + 'dt-number', + class extends o { + static get styles() { + return [ + ...super.styles, + e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-form-background-color,#fff);border:1px solid var(--dt-form-border-color,#ccc);border-radius:0;box-shadow:var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out)}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-form-disabled-background-color,#e6e6e6);cursor:not-allowed}input:invalid{border-color:var(--dt-form-invalid-border-color,#dc3545)}`, + ]; + } + static get properties() { + return { + ...super.properties, + id: { type: String }, + value: { type: String, reflect: !0 }, + oldValue: { type: String }, + min: { type: Number }, + max: { type: Number }, + loading: { type: Boolean }, + saved: { type: Boolean }, + onchange: { type: String }, + }; + } + connectedCallback() { + super.connectedCallback(), (this.oldValue = this.value); + } + _checkValue(e) { + return !(e < this.min || e > this.max); + } + async onChange(e) { + if (this._checkValue(e.target.value)) { + const t = new CustomEvent('change', { + detail: { + field: this.name, + oldValue: this.value, + newValue: e.target.value, + }, + bubbles: !0, + composed: !0, + }); + (this.value = e.target.value), + this._field.setCustomValidity(''), + this.dispatchEvent(t), + (this.api = new a(this.nonce, `${this.apiRoot}`)); + } else e.currentTarget.value = ''; + } + handleError(e = 'An error occurred.') { + let t = e; + t instanceof Error + ? (console.error(t), (t = t.message)) + : console.error(t), + (this.error = t), + this._field.setCustomValidity(t), + (this.invalid = !0), + (this.value = this.oldValue); + } + render() { + return t`${this.labelTemplate()} `; + } + }, +); +//# sourceMappingURL=dt-number.js.map diff --git a/dt-assets/build/components/form/dt-number/dt-number.js.map b/dt-assets/build/components/form/dt-number/dt-number.js.map new file mode 100644 index 0000000000..65311d0b09 --- /dev/null +++ b/dt-assets/build/components/form/dt-number/dt-number.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-number.js","sources":["../../../src/components/form/dt-number/dt-number.js"],"sourcesContent":["import { html, css } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport DtFormBase from '../dt-form-base.js';\nimport ApiService from '../../../services/apiService.js';\n\nexport class DtNumberField extends DtFormBase {\n static get styles() {\n return [\n ...super.styles,\n css`\n input {\n color: var(--dt-form-text-color, #000);\n appearance: none;\n background-color: var(--dt-form-background-color, #fff);\n border: 1px solid var(--dt-form-border-color, #ccc);\n border-radius: 0;\n box-shadow: var(\n --dt-form-input-box-shadow,\n inset 0 1px 2px hsl(0deg 0% 4% / 10%)\n );\n box-sizing: border-box;\n display: block;\n font-family: inherit;\n font-size: 1rem;\n font-weight: 300;\n height: 2.5rem;\n line-height: 1.5;\n margin: 0 0 1.0666666667rem;\n padding: var(--dt-form-padding, 0.5333333333rem);\n transition: var(\n --dt-form-transition,\n box-shadow 0.5s,\n border-color 0.25s ease-in-out\n );\n }\n input:disabled,\n input[readonly],\n textarea:disabled,\n textarea[readonly] {\n background-color: var(--dt-form-disabled-background-color, #e6e6e6);\n cursor: not-allowed;\n }\n input:invalid {\n border-color: var(--dt-form-invalid-border-color, #dc3545);\n }\n `,\n ];\n }\n\n static get properties() {\n return {\n ...super.properties,\n id: { type: String },\n value: {\n type: String,\n reflect: true,\n },\n oldValue: {\n type: String,\n },\n min: { type: Number },\n max: { type: Number },\n loading: { type: Boolean },\n saved: { type: Boolean },\n onchange: { type: String },\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.oldValue = this.value;\n }\n\n _checkValue(value) {\n if (value < this.min || value > this.max) {\n return false;\n }\n\n return true;\n }\n\n async onChange(e) {\n if (this._checkValue(e.target.value)) {\n const event = new CustomEvent('change', {\n detail: {\n field: this.name,\n oldValue: this.value,\n newValue: e.target.value,\n },\n bubbles: true,\n composed: true,\n });\n\n this.value = e.target.value;\n this._field.setCustomValidity('');\n this.dispatchEvent(event);\n this.api = new ApiService(this.nonce, `${this.apiRoot}`);\n\n /*try {\n const response = await this.api.updatePost(this.postType, this.postID, {\n [this.name]: e.target.value,\n });\n if (response.data && response.data.status !== 200) {\n this.handleError(response.message);\n } else {\n this.saved = true;\n this.oldValue = this.value;\n }\n } catch (error) {\n this.handleError(error);\n }*/\n } else {\n e.currentTarget.value = '';\n }\n }\n\n handleError(er = 'An error occurred.') {\n let error = er;\n if (error instanceof Error) {\n console.error(error);\n error = error.message;\n } else {\n console.error(error);\n }\n this.error = error;\n this._field.setCustomValidity(error);\n this.invalid = true;\n this.value = this.oldValue;\n }\n\n render() {\n return html`\n ${this.labelTemplate()}\n\n \n `;\n }\n}\n\nwindow.customElements.define('dt-number', DtNumberField);\n"],"names":["window","customElements","define","DtFormBase","styles","super","css","properties","id","type","String","value","reflect","oldValue","min","Number","max","loading","Boolean","saved","onchange","connectedCallback","this","_checkValue","async","e","target","event","CustomEvent","detail","field","name","newValue","bubbles","composed","_field","setCustomValidity","dispatchEvent","api","ApiService","nonce","apiRoot","currentTarget","handleError","er","error","Error","console","message","invalid","render","html","labelTemplate","label","disabled","ifDefined","onChange"],"mappings":"6PAsJAA,OAAOC,eAAeC,OAAO,YAjJtB,cAA4BC,EACtBC,oBACT,MAAO,IACFC,MAAMD,OACTE,CAAG,svBAsCN,CAEUC,wBACT,MAAO,IACFF,MAAME,WACTC,GAAI,CAAEC,KAAMC,QACZC,MAAO,CACLF,KAAMC,OACNE,SAAS,GAEXC,SAAU,CACRJ,KAAMC,QAERI,IAAK,CAAEL,KAAMM,QACbC,IAAK,CAAEP,KAAMM,QACbE,QAAS,CAAER,KAAMS,SACjBC,MAAO,CAAEV,KAAMS,SACfE,SAAU,CAAEX,KAAMC,QAErB,CAEDW,oBACEhB,MAAMgB,oBACNC,KAAKT,SAAWS,KAAKX,KACtB,CAEDY,YAAYZ,GACV,QAAIA,EAAQW,KAAKR,KAAOH,EAAQW,KAAKN,IAKtC,CAEDQ,eAAeC,GACb,GAAIH,KAAKC,YAAYE,EAAEC,OAAOf,OAAQ,CACpC,MAAMgB,EAAQ,IAAIC,YAAY,SAAU,CACtCC,OAAQ,CACNC,MAAOR,KAAKS,KACZlB,SAAUS,KAAKX,MACfqB,SAAUP,EAAEC,OAAOf,OAErBsB,SAAS,EACTC,UAAU,IAGZZ,KAAKX,MAAQc,EAAEC,OAAOf,MACtBW,KAAKa,OAAOC,kBAAkB,IAC9Bd,KAAKe,cAAcV,GACnBL,KAAKgB,IAAM,IAAIC,EAAWjB,KAAKkB,MAAO,GAAGlB,KAAKmB,UAepD,MACMhB,EAAEiB,cAAc/B,MAAQ,EAE3B,CAEDgC,YAAYC,EAAK,sBACf,IAAIC,EAAQD,EACRC,aAAiBC,OACnBC,QAAQF,MAAMA,GACdA,EAAQA,EAAMG,SAEdD,QAAQF,MAAMA,GAEhBvB,KAAKuB,MAAQA,EACbvB,KAAKa,OAAOC,kBAAkBS,GAC9BvB,KAAK2B,SAAU,EACf3B,KAAKX,MAAQW,KAAKT,QACnB,CAEDqC,SACE,OAAOC,CAAI,GACP7B,KAAK8B,8BAGC9B,KAAKd,aACHc,KAAKS,qBACCT,KAAK+B,mCAEP/B,KAAKgC,wCAEPhC,KAAKX,eACR4C,EAAUjC,KAAKR,cACfyC,EAAUjC,KAAKN,kBACZM,KAAKkC,YAGpB"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-single-select/dt-single-select.js b/dt-assets/build/components/form/dt-single-select/dt-single-select.js index d02f4c919e..cf70c320f7 100644 --- a/dt-assets/build/components/form/dt-single-select/dt-single-select.js +++ b/dt-assets/build/components/form/dt-single-select/dt-single-select.js @@ -1 +1,56 @@ -import{i as e,y as t}from"../../lit-element-2409d5fe.js";import{D as o}from"../dt-form-base.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";window.customElements.define("dt-single-select",class extends o{static get styles(){return[...super.styles,e`:host{position:relative}select{appearance:none;background-color:var(--dt-form-background-color,#fefefe);background-image:linear-gradient(45deg,transparent 50%,var(--dt-single-select-text-color) 50%),linear-gradient(135deg,var(--dt-single-select-text-color) 50%,transparent 50%);background-position:calc(100% - 20px) calc(1em + 2px),calc(100% - 15px) calc(1em + 2px),calc(100% - 2.5em) .5em;background-size:5px 5px,5px 5px,1px 1.5em;background-repeat:no-repeat;border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;color:var(--dt-single-select-text-color,#0a0a0a);font-family:var(--font-family,sans-serif);font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1rem;padding:.53rem;padding-inline-end:1.6rem;transition:border-color .25s ease-in-out;transition:box-shadow .5s,border-color .25s ease-in-out;box-sizing:border-box;width:100%;text-transform:none}[dir=rtl] select{background-position:15px calc(1em + 2px),20px calc(1em + 2px),2.5em .5em}select.color-select{background-image:url("data:image/svg+xml;utf8,");background-color:var(--dt-form-border-color,#cacaca);border:none;border-radius:10px;color:var(--dt-single-select-text-color-inverse,#fff);font-weight:700;text-shadow:rgb(0 0 0 / 45%) 0 0 6px}.icon-overlay{inset-inline-end:2.5rem}`]}static get properties(){return{...super.properties,placeholder:{type:String},options:{type:Array},value:{type:String,reflect:!0},color:{type:String,state:!0},onchange:{type:String}}}updateColor(){if(this.value&&this.options){const e=this.options.filter((e=>e.id===this.value));e&&e.length&&(this.color=e[0].color)}}isColorSelect(){return(this.options||[]).reduce(((e,t)=>e||t.color),!1)}willUpdate(e){super.willUpdate(e),e.has("value")&&this.updateColor()}_change(e){const t=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value,newValue:e.target.value}});this.value=e.target.value,this.dispatchEvent(t)}render(){return t`${this.labelTemplate()}
    ${this.loading?t``:null} ${this.saved?t``:null}
    `}}); +import { i as e, y as t } from '../../lit-element-2409d5fe.js'; +import { D as o } from '../dt-form-base.js'; +import '../../icons/dt-spinner.js'; +import '../../icons/dt-checkmark.js'; +import '../../dt-base.js'; +import '../../lit-localize-763e4978.js'; +import '../dt-label/dt-label.js'; +window.customElements.define( + 'dt-single-select', + class extends o { + static get styles() { + return [ + ...super.styles, + e`:host{position:relative}select{appearance:none;background-color:var(--dt-form-background-color,#fefefe);background-image:linear-gradient(45deg,transparent 50%,var(--dt-single-select-text-color) 50%),linear-gradient(135deg,var(--dt-single-select-text-color) 50%,transparent 50%);background-position:calc(100% - 20px) calc(1em + 2px),calc(100% - 15px) calc(1em + 2px),calc(100% - 2.5em) .5em;background-size:5px 5px,5px 5px,1px 1.5em;background-repeat:no-repeat;border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;color:var(--dt-single-select-text-color,#0a0a0a);font-family:var(--font-family,sans-serif);font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1rem;padding:.53rem;padding-inline-end:1.6rem;transition:border-color .25s ease-in-out;transition:box-shadow .5s,border-color .25s ease-in-out;box-sizing:border-box;width:100%;text-transform:none}[dir=rtl] select{background-position:15px calc(1em + 2px),20px calc(1em + 2px),2.5em .5em}select.color-select{background-image:url("data:image/svg+xml;utf8,");background-color:var(--dt-form-border-color,#cacaca);border:none;border-radius:10px;color:var(--dt-single-select-text-color-inverse,#fff);font-weight:700;text-shadow:rgb(0 0 0 / 45%) 0 0 6px}.icon-overlay{inset-inline-end:2.5rem}`, + ]; + } + static get properties() { + return { + ...super.properties, + placeholder: { type: String }, + options: { type: Array }, + value: { type: String, reflect: !0 }, + color: { type: String, state: !0 }, + onchange: { type: String }, + }; + } + updateColor() { + if (this.value && this.options) { + const e = this.options.filter((e) => e.id === this.value); + e && e.length && (this.color = e[0].color); + } + } + isColorSelect() { + return (this.options || []).reduce((e, t) => e || t.color, !1); + } + willUpdate(e) { + super.willUpdate(e), e.has('value') && this.updateColor(); + } + _change(e) { + const t = new CustomEvent('change', { + detail: { + field: this.name, + oldValue: this.value, + newValue: e.target.value, + }, + }); + (this.value = e.target.value), + this._setFormValue(this.value), + this.dispatchEvent(t); + } + render() { + return t`${this.labelTemplate()}
    ${this.loading ? t`` : null} ${this.saved ? t`` : null}
    `; + } + }, +); +//# sourceMappingURL=dt-single-select.js.map diff --git a/dt-assets/build/components/form/dt-single-select/dt-single-select.js.map b/dt-assets/build/components/form/dt-single-select/dt-single-select.js.map new file mode 100644 index 0000000000..500b1331e5 --- /dev/null +++ b/dt-assets/build/components/form/dt-single-select/dt-single-select.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-single-select.js","sources":["../../../src/components/form/dt-single-select/dt-single-select.js"],"sourcesContent":["import { html, css } from 'lit';\nimport DtFormBase from '../dt-form-base.js';\nimport '../../icons/dt-spinner.js';\nimport '../../icons/dt-checkmark.js';\n\nexport class DtSingleSelect extends DtFormBase {\n static get styles() {\n return [\n ...super.styles,\n css`\n :host {\n position: relative;\n }\n\n select {\n appearance: none;\n background-color: var(--dt-form-background-color, #fefefe);\n background-image: linear-gradient(\n 45deg,\n transparent 50%,\n var(--dt-single-select-text-color) 50%\n ),\n linear-gradient(\n 135deg,\n var(--dt-single-select-text-color) 50%,\n transparent 50%\n );\n background-position: calc(100% - 20px) calc(1em + 2px),\n calc(100% - 15px) calc(1em + 2px), calc(100% - 2.5em) 0.5em;\n background-size: 5px 5px, 5px 5px, 1px 1.5em;\n background-repeat: no-repeat;\n border: 1px solid var(--dt-form-border-color, #cacaca);\n border-radius: 0;\n color: var(--dt-single-select-text-color, #0a0a0a);\n font-family: var(--font-family, sans-serif);\n font-size: 1rem;\n font-weight: 300;\n height: 2.5rem;\n line-height: 1.5;\n margin: 0 0 1rem;\n padding: 0.53rem;\n padding-inline-end: 1.6rem;\n transition: border-color 0.25s ease-in-out;\n transition: box-shadow 0.5s, border-color 0.25s ease-in-out;\n box-sizing: border-box;\n width: 100%;\n text-transform: none;\n }\n [dir='rtl'] select {\n background-position: 15px calc(1em + 2px), 20px calc(1em + 2px),\n 2.5em 0.5em;\n }\n select.color-select {\n background-image: url(\"data:image/svg+xml;utf8,\");\n background-color: var(--dt-form-border-color, #cacaca);\n border: none;\n border-radius: 10px;\n color: var(--dt-single-select-text-color-inverse, #fff);\n font-weight: 700;\n text-shadow: rgb(0 0 0 / 45%) 0 0 6px;\n }\n\n .icon-overlay {\n inset-inline-end: 2.5rem;\n }\n `,\n ];\n }\n\n static get properties() {\n return {\n ...super.properties,\n placeholder: { type: String },\n options: { type: Array },\n value: {\n type: String,\n reflect: true,\n },\n color: {\n type: String,\n state: true,\n },\n onchange: { type: String },\n };\n }\n\n /**\n * Find the color for the currently selected value\n */\n updateColor() {\n if (this.value && this.options) {\n const options = this.options.filter(opt => opt.id === this.value);\n if (options && options.length) {\n this.color = options[0].color;\n }\n }\n }\n\n isColorSelect() {\n return (this.options || []).reduce(\n (isColor, option) => isColor || option.color,\n false\n );\n }\n\n willUpdate(changedProperties) {\n super.willUpdate(changedProperties);\n if (changedProperties.has('value')) {\n this.updateColor();\n }\n }\n\n _change(e) {\n // Create custom event with new/old values to pass to onchange function\n const event = new CustomEvent('change', {\n detail: {\n field: this.name,\n oldValue: this.value,\n newValue: e.target.value,\n },\n });\n\n // update value in this component\n this.value = e.target.value;\n this._setFormValue(this.value);\n\n // dispatch event for use with addEventListener from javascript\n this.dispatchEvent(event);\n }\n\n render() {\n return html`\n ${this.labelTemplate()}\n\n
    \n \n \n\n ${this.options &&\n this.options.map(\n i => html`\n \n `\n )}\n \n ${this.loading\n ? html``\n : null}\n ${this.saved\n ? html``\n : null}\n
    \n `;\n }\n}\n\nwindow.customElements.define('dt-single-select', DtSingleSelect);\n"],"names":["window","customElements","define","DtFormBase","styles","super","css","properties","placeholder","type","String","options","Array","value","reflect","color","state","onchange","updateColor","this","filter","opt","id","length","isColorSelect","reduce","isColor","option","willUpdate","changedProperties","has","_change","e","event","CustomEvent","detail","field","name","oldValue","newValue","target","_setFormValue","dispatchEvent","render","html","labelTemplate","RTL","disabled","map","i","label","loading","saved"],"mappings":"sQAqKAA,OAAOC,eAAeC,OAAO,mBAhKtB,cAA6BC,EACvBC,oBACT,MAAO,IACFC,MAAMD,OACTE,CAAG,q6CA0DN,CAEUC,wBACT,MAAO,IACFF,MAAME,WACTC,YAAa,CAAEC,KAAMC,QACrBC,QAAS,CAAEF,KAAMG,OACjBC,MAAO,CACLJ,KAAMC,OACNI,SAAS,GAEXC,MAAO,CACLN,KAAMC,OACNM,OAAO,GAETC,SAAU,CAAER,KAAMC,QAErB,CAKDQ,cACE,GAAIC,KAAKN,OAASM,KAAKR,QAAS,CAC9B,MAAMA,EAAUQ,KAAKR,QAAQS,QAAOC,GAAOA,EAAIC,KAAOH,KAAKN,QACvDF,GAAWA,EAAQY,SACrBJ,KAAKJ,MAAQJ,EAAQ,GAAGI,MAE3B,CACF,CAEDS,gBACE,OAAQL,KAAKR,SAAW,IAAIc,QAC1B,CAACC,EAASC,IAAWD,GAAWC,EAAOZ,QACvC,EAEH,CAEDa,WAAWC,GACTxB,MAAMuB,WAAWC,GACbA,EAAkBC,IAAI,UACxBX,KAAKD,aAER,CAEDa,QAAQC,GAEN,MAAMC,EAAQ,IAAIC,YAAY,SAAU,CACtCC,OAAQ,CACNC,MAAOjB,KAAKkB,KACZC,SAAUnB,KAAKN,MACf0B,SAAUP,EAAEQ,OAAO3B,SAKvBM,KAAKN,MAAQmB,EAAEQ,OAAO3B,MACtBM,KAAKsB,cAActB,KAAKN,OAGxBM,KAAKuB,cAAcT,EACpB,CAEDU,SACE,OAAOC,CAAI,GACPzB,KAAK0B,8CAEuB1B,KAAK2B,IAAM,MAAQ,wBAErC3B,KAAKkB,qBACClB,KAAKkB,kBACRlB,KAAKY,mBACPZ,KAAKK,gBAAkB,eAAiB,+BACtBL,KAAKJ,qBACnBI,KAAK4B,6EAE0B5B,KAAKX,uBAE/CW,KAAKR,SACPQ,KAAKR,QAAQqC,KACXC,GAAKL,CAAI,kBACUK,EAAE3B,kBAAkB2B,EAAE3B,KAAOH,KAAKN,UAC/CoC,EAAEC,+BAKV/B,KAAKgC,QACHP,CAAI,iDACJ,QACFzB,KAAKiC,MACHR,CAAI,6DACJ,YAGT"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-tags/dt-tags.js b/dt-assets/build/components/form/dt-tags/dt-tags.js index 86af9b98e9..31f9f4769e 100644 --- a/dt-assets/build/components/form/dt-tags/dt-tags.js +++ b/dt-assets/build/components/form/dt-tags/dt-tags.js @@ -1 +1,100 @@ -import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{D as i}from"../dt-multi-select/dt-multi-select.js";import"../../style-map-ac85d91b.js";import"../../directive-de55b00a.js";import"../../lit-localize-763e4978.js";import"../dt-form-base.js";import"../../dt-base.js";import"../dt-label/dt-label.js";import"../mixins/hasOptionsList.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";class s extends i{static get properties(){return{...super.properties,allowAdd:{type:Boolean},onload:{type:String}}}static get styles(){return[...super.styles,t`.selected-option a,.selected-option a:active,.selected-option a:visited{text-decoration:none;color:var(--primary-color,#3f729b)}`]}willUpdate(t){if(super.willUpdate(t),t){!t.has("open")||!this.open||this.filteredOptions&&this.filteredOptions.length||this._filterOptions()}}_filterOptions(){const t=(this.value||[]).filter((t=>!t.startsWith("-")));if(this.options?.length)this.filteredOptions=(this.options||[]).filter((e=>!t.includes(e.id)&&(!this.query||e.id.toLocaleLowerCase().includes(this.query.toLocaleLowerCase()))));else if(this.open){this.loading=!0,this.filteredOptions=[];const e=this,i=new CustomEvent("load",{bubbles:!0,detail:{field:this.name,postType:this.postType,query:this.query,onSuccess:i=>{e.loading=!1;let s=i;s.length&&"string"==typeof s[0]&&(s=s.map((t=>({id:t})))),e.allOptions=s,e.filteredOptions=s.filter((e=>!t.includes(e.id)))},onError:t=>{console.warn(t),e.loading=!1}}});this.dispatchEvent(i)}return this.filteredOptions}_renderOption(t,i){return e`
  • `}_renderSelectedOptions(){const t=this.options||this.allOptions;return(this.value||[]).filter((t=>!t.startsWith("-"))).map((i=>{let s,o=i;if(t){const e=t.filter((t=>t===i||t.id===i));e.length&&(o=e[0].label||e[0].id||i)}if(!s&&window?.SHAREDFUNCTIONS?.createCustomFilter){const t=window.SHAREDFUNCTIONS.createCustomFilter(this.name,[i]),e=this.label||this.name,o=[{id:`${this.name}_${i}`,name:`${e}: ${i}`}];s=window.SHAREDFUNCTIONS.create_url_for_list_query(this.postType,t,o)}return e``}))}}window.customElements.define("dt-tags",s);export{s as D}; +import { i as t, y as e } from '../../lit-element-2409d5fe.js'; +import { D as i } from '../dt-multi-select/dt-multi-select.js'; +import '../../style-map-ac85d91b.js'; +import '../../directive-de55b00a.js'; +import '../../lit-localize-763e4978.js'; +import '../dt-form-base.js'; +import '../../dt-base.js'; +import '../dt-label/dt-label.js'; +import '../mixins/hasOptionsList.js'; +import '../../icons/dt-spinner.js'; +import '../../icons/dt-checkmark.js'; +class s extends i { + static get properties() { + return { + ...super.properties, + allowAdd: { type: Boolean }, + onload: { type: String }, + }; + } + static get styles() { + return [ + ...super.styles, + t`.selected-option a,.selected-option a:active,.selected-option a:visited{text-decoration:none;color:var(--primary-color,#3f729b)}`, + ]; + } + willUpdate(t) { + if ((super.willUpdate(t), t)) { + !t.has('open') || + !this.open || + (this.filteredOptions && this.filteredOptions.length) || + this._filterOptions(); + } + } + _filterOptions() { + const t = (this.value || []).filter((t) => !t.startsWith('-')); + if (this.options?.length) + this.filteredOptions = (this.options || []).filter( + (e) => + !t.includes(e.id) && + (!this.query || + e.id.toLocaleLowerCase().includes(this.query.toLocaleLowerCase())), + ); + else if (this.open) { + (this.loading = !0), (this.filteredOptions = []); + const e = this, + i = new CustomEvent('load', { + bubbles: !0, + detail: { + field: this.name, + postType: this.postType, + query: this.query, + onSuccess: (i) => { + e.loading = !1; + let s = i; + s.length && + 'string' == typeof s[0] && + (s = s.map((t) => ({ id: t }))), + (e.allOptions = s), + (e.filteredOptions = s.filter((e) => !t.includes(e.id))); + }, + onError: (t) => { + console.warn(t), (e.loading = !1); + }, + }, + }); + this.dispatchEvent(i); + } + return this.filteredOptions; + } + _renderOption(t, i) { + return e`
  • `; + } + _renderSelectedOptions() { + const t = this.options || this.allOptions; + return (this.value || []) + .filter((t) => !t.startsWith('-')) + .map((i) => { + let s, + o = i.label || i.id || i; + if (t) { + const e = t.filter((t) => t === i || t.id === i); + e.length && (o = e[0].label || e[0].id || i); + } + if (!s && window?.SHAREDFUNCTIONS?.createCustomFilter) { + const t = window.SHAREDFUNCTIONS.createCustomFilter(this.name, [i]), + e = this.label || this.name, + o = [{ id: `${this.name}_${i}`, name: `${e}: ${i}` }]; + s = window.SHAREDFUNCTIONS.create_url_for_list_query( + this.postType, + t, + o, + ); + } + return e``; + }); + } +} +window.customElements.define('dt-tags', s); +export { s as D }; +//# sourceMappingURL=dt-tags.js.map diff --git a/dt-assets/build/components/form/dt-tags/dt-tags.js.map b/dt-assets/build/components/form/dt-tags/dt-tags.js.map new file mode 100644 index 0000000000..5974dbe7a2 --- /dev/null +++ b/dt-assets/build/components/form/dt-tags/dt-tags.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-tags.js","sources":["../../../src/components/form/dt-tags/dt-tags.js"],"sourcesContent":["import { css, html } from 'lit';\nimport { DtMultiSelect } from '../dt-multi-select/dt-multi-select.js';\n\nexport class DtTags extends DtMultiSelect {\n static get properties() {\n return {\n ...super.properties,\n allowAdd: { type: Boolean },\n onload: { type: String },\n };\n }\n\n static get styles() {\n return [\n ...super.styles,\n css`\n .selected-option a,\n .selected-option a:active,\n .selected-option a:visited {\n text-decoration: none;\n color: var(--primary-color, #3f729b);\n }\n `,\n ];\n }\n\n willUpdate(props) {\n super.willUpdate(props);\n\n if (props) {\n const openChanged = props.has('open');\n // When list is first opened and we don't have any options yet,\n // trigger _filterOptions to load options\n if (openChanged && this.open && (!this.filteredOptions || !this.filteredOptions.length)) {\n this._filterOptions();\n }\n }\n }\n\n /**\n * Filter to options that:\n * 1: are not selected\n * 2: match the search query\n * @private\n */\n _filterOptions() {\n const selectedValues = (this.value || [])\n .filter(i => !i.startsWith('-'));\n\n if (this.options?.length) {\n this.filteredOptions = (this.options || []).filter(\n opt =>\n !selectedValues.includes(opt.id) &&\n (!this.query ||\n opt.id\n .toLocaleLowerCase()\n .includes(this.query.toLocaleLowerCase()))\n );\n } else if (this.open) {\n // Only run this filtering if the list is open.\n // This prevents it from running on initial load before a `load` event is attached.\n this.loading = true;\n this.filteredOptions = [];\n\n // need to fetch data via API request\n const self = this;\n const event = new CustomEvent('load', {\n bubbles: true,\n detail: {\n field: this.name,\n postType: this.postType,\n query: this.query,\n onSuccess: result => {\n self.loading = false;\n\n // if given an array of strings, transform to object array\n let options = result;\n if (options.length && typeof options[0] === 'string') {\n options = options.map(o => ({\n id: o,\n }));\n }\n\n self.allOptions = options;\n // filter out selected values from list\n self.filteredOptions = options.filter(\n opt => !selectedValues.includes(opt.id)\n );\n },\n onError: error => {\n console.warn(error);\n self.loading = false;\n },\n },\n });\n this.dispatchEvent(event);\n }\n return this.filteredOptions;\n }\n\n _renderOption(opt, idx) {\n return html`\n
  • \n -1 && this.activeIndex === idx\n ? 'active'\n : ''}\"\n >\n ${opt.label || opt.id}\n \n
  • \n `;\n }\n\n _renderSelectedOptions() {\n const options = this.options || this.allOptions;\n return (this.value || [])\n .filter(i => !i.startsWith('-'))\n .map(\n tag => {\n let label = tag.label || tag.id || tag;\n if (options) {\n const option = options.filter(o => o === tag || o.id === tag);\n if (option.length) {\n label = option[0].label || option[0].id || tag;\n }\n }\n let link;\n if (!link && window?.SHAREDFUNCTIONS?.createCustomFilter) {\n const query = window.SHAREDFUNCTIONS.createCustomFilter(this.name, [tag])\n const fieldLabel = this.label || this.name\n const labels = [{ id: `${this.name}_${tag}`, name: `${fieldLabel}: ${tag}`}]\n link = window.SHAREDFUNCTIONS.create_url_for_list_query(this.postType, query, labels);\n }\n return html`\n
    \n ${label}\n \n x\n \n
    \n `}\n );\n }\n}\n\nwindow.customElements.define('dt-tags', DtTags);\n"],"names":["DtTags","DtMultiSelect","properties","super","allowAdd","type","Boolean","onload","String","styles","css","willUpdate","props","has","this","open","filteredOptions","length","_filterOptions","selectedValues","value","filter","i","startsWith","options","opt","includes","id","query","toLocaleLowerCase","loading","self","event","CustomEvent","bubbles","detail","field","name","postType","onSuccess","result","map","o","allOptions","onError","error","console","warn","dispatchEvent","_renderOption","idx","html","label","_clickOption","_touchStart","_touchMove","_touchEnd","activeIndex","_renderSelectedOptions","tag","link","option","window","SHAREDFUNCTIONS","createCustomFilter","fieldLabel","labels","create_url_for_list_query","disabled","_remove","customElements","define"],"mappings":"gaAGO,MAAMA,UAAeC,EACfC,wBACT,MAAO,IACFC,MAAMD,WACTE,SAAU,CAAEC,KAAMC,SAClBC,OAAQ,CAAEF,KAAMG,QAEnB,CAEUC,oBACT,MAAO,IACFN,MAAMM,OACTC,CAAG,mIASN,CAEDC,WAAWC,GAGT,GAFAT,MAAMQ,WAAWC,GAEbA,EAAO,EACWA,EAAMC,IAAI,UAGXC,KAAKC,MAAUD,KAAKE,iBAAoBF,KAAKE,gBAAgBC,QAC9EH,KAAKI,gBAER,CACF,CAQDA,iBACE,MAAMC,GAAkBL,KAAKM,OAAS,IACnCC,QAAOC,IAAMA,EAAEC,WAAW,OAE7B,GAAIT,KAAKU,SAASP,OAChBH,KAAKE,iBAAmBF,KAAKU,SAAW,IAAIH,QAC1CI,IACGN,EAAeO,SAASD,EAAIE,OAC3Bb,KAAKc,OACLH,EAAIE,GACDE,oBACAH,SAASZ,KAAKc,MAAMC,6BAExB,GAAIf,KAAKC,KAAM,CAGpBD,KAAKgB,SAAU,EACfhB,KAAKE,gBAAkB,GAGvB,MAAMe,EAAOjB,KACPkB,EAAQ,IAAIC,YAAY,OAAQ,CACpCC,SAAS,EACTC,OAAQ,CACNC,MAAOtB,KAAKuB,KACZC,SAAUxB,KAAKwB,SACfV,MAAOd,KAAKc,MACZW,UAAWC,IACTT,EAAKD,SAAU,EAGf,IAAIN,EAAUgB,EACVhB,EAAQP,QAAgC,iBAAfO,EAAQ,KACnCA,EAAUA,EAAQiB,KAAIC,IAAM,CAC1Bf,GAAIe,OAIRX,EAAKY,WAAanB,EAElBO,EAAKf,gBAAkBQ,EAAQH,QAC7BI,IAAQN,EAAeO,SAASD,EAAIE,KACrC,EAEHiB,QAASC,IACPC,QAAQC,KAAKF,GACbd,EAAKD,SAAU,CAAK,KAI1BhB,KAAKkC,cAAchB,EACpB,CACD,OAAOlB,KAAKE,eACb,CAEDiC,cAAcxB,EAAKyB,GACjB,OAAOC,CAAI,oCAGI1B,EAAIE,iCAECF,EAAI2B,kBACRtC,KAAKuC,8BACAvC,KAAKwC,4BACNxC,KAAKyC,0BACNzC,KAAK0C,mCAET1C,KAAK2C,aAAe,GAAK3C,KAAK2C,cAAgBP,EACzD,SACA,OAEIzB,EAAI2B,OAAS3B,EAAIE,kBAI1B,CAED+B,yBACE,MAAMlC,EAAUV,KAAKU,SAAWV,KAAK6B,WACrC,OAAQ7B,KAAKM,OAAS,IACnBC,QAAOC,IAAMA,EAAEC,WAAW,OAC1BkB,KACCkB,IACE,IAOIC,EAPAR,EAAQO,EAAIP,OAASO,EAAIhC,IAAMgC,EACnC,GAAInC,EAAS,CACX,MAAMqC,EAASrC,EAAQH,QAAOqB,GAAKA,IAAMiB,GAAOjB,EAAEf,KAAOgC,IACrDE,EAAO5C,SACTmC,EAAQS,EAAO,GAAGT,OAASS,EAAO,GAAGlC,IAAMgC,EAE9C,CAED,IAAKC,GAAQE,QAAQC,iBAAiBC,mBAAoB,CACxD,MAAMpC,EAASkC,OAAOC,gBAAgBC,mBAAmBlD,KAAKuB,KAAM,CAACsB,IAC/DM,EAAanD,KAAKsC,OAAStC,KAAKuB,KAChC6B,EAAS,CAAC,CAAEvC,GAAI,GAAGb,KAAKuB,QAAQsB,IAAOtB,KAAM,GAAG4B,MAAeN,MACrEC,EAAOE,OAAOC,gBAAgBI,0BAA0BrD,KAAKwB,SAAUV,EAAOsC,EAC/E,CACD,OAAOf,CAAI,yCAGCS,GAAQ,mBACH9C,KAAKsD,kBACXT,MACJP,yBAGOtC,KAAKuD,uBACFvD,KAAKsD,yBACJT,qBAAG,GAO5B,EAGHG,OAAOQ,eAAeC,OAAO,UAAWvE"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-text/dt-text.js b/dt-assets/build/components/form/dt-text/dt-text.js index 685ed134ee..80d54a4b7b 100644 --- a/dt-assets/build/components/form/dt-text/dt-text.js +++ b/dt-assets/build/components/form/dt-text/dt-text.js @@ -1 +1,69 @@ -import{i as e,y as t}from"../../lit-element-2409d5fe.js";import{o as i}from"../../class-map-8d921948.js";import{D as r}from"../dt-form-base.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";import"../../icons/dt-exclamation-circle.js";import"../../directive-de55b00a.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";class a extends r{static get styles(){return[...super.styles,e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-text-background-color,#fefefe);border:1px solid var(--dt-text-border-color,#fefefe);border-radius:var(--dt-text-border-radius,0);box-shadow:var(--dt-text-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);width:100%}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-text-disabled-background-color,var(--dt-form-disabled-background-color,#e6e6e6));cursor:not-allowed}input:focus-visible,input:focus-within{outline:0}input::placeholder{color:var(--dt-text-placeholder-color,#999);text-transform:var(--dt-text-placeholder-transform,none);font-size:var(--dt-text-placeholder-font-size,1rem);font-weight:var(--dt-text-placeholder-font-weight,400);letter-spacing:var(--dt-text-placeholder-letter-spacing,normal)}input.invalid{border-color:var(--dt-text-border-color-alert,var(--alert-color))}`]}static get properties(){return{...super.properties,id:{type:String},type:{type:String},placeholder:{type:String},value:{type:String,reflect:!0},onchange:{type:String}}}_change(e){const t=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value,newValue:e.target.value}});this.value=e.target.value,this._setFormValue(this.value),this.dispatchEvent(t)}implicitFormSubmit(e){if(13===(e.keyCode||e.which)&&this.internals.form){const e=this.internals.form.querySelector("button");e&&e.click()}}_validateRequired(){const{value:e}=this,t=this.shadowRoot.querySelector("input");""===e&&this.required?(this.invalid=!0,this.internals.setValidity({valueMissing:!0},this.requiredMessage||"This field is required",t)):(this.invalid=!1,this.internals.setValidity({}))}get classes(){return{"text-input":!0,invalid:this.touched&&this.invalid}}render(){return t`${this.labelTemplate()}
    ${this.touched&&this.invalid?t``:null} ${this.error?t``:null} ${this.loading?t``:null} ${this.saved?t``:null}
    `}}window.customElements.define("dt-text",a);export{a as D}; +import { i as e, y as t } from '../../lit-element-2409d5fe.js'; +import { o as i } from '../../class-map-8d921948.js'; +import { D as r } from '../dt-form-base.js'; +import '../../icons/dt-spinner.js'; +import '../../icons/dt-checkmark.js'; +import '../../icons/dt-exclamation-circle.js'; +import '../../directive-de55b00a.js'; +import '../../dt-base.js'; +import '../../lit-localize-763e4978.js'; +import '../dt-label/dt-label.js'; +class a extends r { + static get styles() { + return [ + ...super.styles, + e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-text-background-color,#fefefe);border:1px solid var(--dt-text-border-color,#fefefe);border-radius:var(--dt-text-border-radius,0);box-shadow:var(--dt-text-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);width:100%}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-text-disabled-background-color,var(--dt-form-disabled-background-color,#e6e6e6));cursor:copy}input:focus-visible,input:focus-within{outline:0}input::placeholder{color:var(--dt-text-placeholder-color,#999);text-transform:var(--dt-text-placeholder-transform,none);font-size:var(--dt-text-placeholder-font-size,1rem);font-weight:var(--dt-text-placeholder-font-weight,400);letter-spacing:var(--dt-text-placeholder-letter-spacing,normal)}input.invalid{border-color:var(--dt-text-border-color-alert,var(--alert-color))}`, + ]; + } + static get properties() { + return { + ...super.properties, + id: { type: String }, + type: { type: String }, + maxlength: { type: Number }, + placeholder: { type: String }, + value: { type: String, reflect: !0 }, + onchange: { type: String }, + }; + } + _change(e) { + const t = new CustomEvent('change', { + bubbles: !0, + detail: { + field: this.name, + oldValue: this.value, + newValue: e.target.value, + }, + }); + (this.value = e.target.value), + this._setFormValue(this.value), + this.dispatchEvent(t); + } + implicitFormSubmit(e) { + if (13 === (e.keyCode || e.which) && this.internals.form) { + const e = this.internals.form.querySelector('button'); + e && e.click(); + } + } + _validateRequired() { + const { value: e } = this, + t = this.shadowRoot.querySelector('input'); + '' === e && this.required + ? ((this.invalid = !0), + this.internals.setValidity( + { valueMissing: !0 }, + this.requiredMessage || 'This field is required', + t, + )) + : ((this.invalid = !1), this.internals.setValidity({})); + } + get classes() { + return { 'text-input': !0, invalid: this.touched && this.invalid }; + } + render() { + return t`${this.labelTemplate()}
    ${this.touched && this.invalid ? t`` : null} ${this.error ? t`` : null} ${this.loading ? t`` : null} ${this.saved ? t`` : null}
    `; + } +} +window.customElements.define('dt-text', a); +export { a as D }; +//# sourceMappingURL=dt-text.js.map diff --git a/dt-assets/build/components/form/dt-text/dt-text.js.map b/dt-assets/build/components/form/dt-text/dt-text.js.map new file mode 100644 index 0000000000..06d2783e67 --- /dev/null +++ b/dt-assets/build/components/form/dt-text/dt-text.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-text.js","sources":["../../../src/components/form/dt-text/dt-text.js"],"sourcesContent":["import { html, css } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\nimport DtFormBase from '../dt-form-base.js';\nimport '../../icons/dt-spinner.js';\nimport '../../icons/dt-checkmark.js';\nimport '../../icons/dt-exclamation-circle.js';\n\nexport class DtText extends DtFormBase {\n static get styles() {\n return [\n ...super.styles,\n css`\n input {\n color: var(--dt-form-text-color, #000);\n appearance: none;\n background-color: var(--dt-text-background-color, #fefefe);\n border: 1px solid var(--dt-text-border-color, #fefefe);\n border-radius: var(--dt-text-border-radius, 0);\n box-shadow: var(\n --dt-text-box-shadow,\n var(\n --dt-form-input-box-shadow,\n inset 0 1px 2px hsl(0deg 0% 4% / 10%)\n )\n );\n box-sizing: border-box;\n display: block;\n font-family: inherit;\n font-size: 1rem;\n font-weight: 300;\n height: 2.5rem;\n line-height: 1.5;\n margin: 0 0 1.0666666667rem;\n padding: var(--dt-form-padding, 0.5333333333rem);\n transition: var(\n --dt-form-transition,\n box-shadow 0.5s,\n border-color 0.25s ease-in-out\n );\n width: 100%;\n }\n input:disabled,\n input[readonly],\n textarea:disabled,\n textarea[readonly] {\n background-color: var(\n --dt-text-disabled-background-color,\n var(--dt-form-disabled-background-color, #e6e6e6)\n );\n cursor: copy;\n }\n input:focus-within,\n input:focus-visible {\n outline: none;\n }\n input::placeholder {\n color: var(--dt-text-placeholder-color, #999);\n text-transform: var(--dt-text-placeholder-transform, none);\n font-size: var(--dt-text-placeholder-font-size, 1rem);\n font-weight: var(--dt-text-placeholder-font-weight, 400);\n letter-spacing: var(--dt-text-placeholder-letter-spacing, normal);\n }\n input.invalid {\n border-color: var(--dt-text-border-color-alert, var(--alert-color));\n }\n `,\n ];\n }\n\n static get properties() {\n return {\n ...super.properties,\n id: { type: String },\n type: { type: String },\n maxlength: {type: Number},\n placeholder: { type: String },\n value: {\n type: String,\n reflect: true,\n },\n onchange: { type: String }\n };\n }\n\n _change(e) {\n const event = new CustomEvent('change', {\n bubbles: true,\n detail: {\n field: this.name,\n oldValue: this.value,\n newValue: e.target.value,\n },\n });\n\n this.value = e.target.value;\n\n this._setFormValue(this.value);\n\n this.dispatchEvent(event);\n }\n\n implicitFormSubmit(e) {\n const keycode = e.keyCode || e.which;\n // If the Enter key is pressed, find the first button in the form and click it.\n // This replicates normal browser handling of input elements when pressing Enter\n if (keycode === 13 && this.internals.form) {\n const button = this.internals.form.querySelector('button');\n if (button) {\n button.click();\n }\n }\n }\n\n _validateRequired() {\n const { value } = this;\n const input = this.shadowRoot.querySelector('input');\n if (value === '' && this.required) {\n this.invalid = true;\n this.internals.setValidity(\n {\n valueMissing: true,\n },\n this.requiredMessage || 'This field is required',\n input\n );\n } else {\n this.invalid = false;\n this.internals.setValidity({});\n }\n }\n\n get classes() {\n const classes = {\n 'text-input': true,\n invalid: this.touched && this.invalid,\n };\n return classes;\n }\n\n render() {\n return html`\n ${this.labelTemplate()}\n\n
    \n \n\n ${this.touched && this.invalid\n ? html``\n : null}\n ${this.error\n ? html``\n : null}\n ${this.loading\n ? html``\n : null}\n ${this.saved\n ? html``\n : null}\n
    \n `;\n }\n}\n\nwindow.customElements.define('dt-text', DtText);\n"],"names":["DtText","DtFormBase","styles","super","css","properties","id","type","String","maxlength","Number","placeholder","value","reflect","onchange","_change","e","event","CustomEvent","bubbles","detail","field","this","name","oldValue","newValue","target","_setFormValue","dispatchEvent","implicitFormSubmit","keyCode","which","internals","form","button","querySelector","click","_validateRequired","input","shadowRoot","required","invalid","setValidity","valueMissing","requiredMessage","classes","touched","render","html","labelTemplate","label","disabled","classMap","error","loading","saved","window","customElements","define"],"mappings":"uYAOO,MAAMA,UAAeC,EACfC,oBACT,MAAO,IACFC,MAAMD,OACTE,CAAG,6rCAwDN,CAEUC,wBACT,MAAO,IACFF,MAAME,WACTC,GAAI,CAAEC,KAAMC,QACZD,KAAM,CAAEA,KAAMC,QACdC,UAAW,CAACF,KAAMG,QAClBC,YAAa,CAAEJ,KAAMC,QACrBI,MAAO,CACLL,KAAMC,OACNK,SAAS,GAEXC,SAAU,CAAEP,KAAMC,QAErB,CAEDO,QAAQC,GACN,MAAMC,EAAQ,IAAIC,YAAY,SAAU,CACtCC,SAAS,EACTC,OAAQ,CACNC,MAAOC,KAAKC,KACZC,SAAUF,KAAKV,MACfa,SAAUT,EAAEU,OAAOd,SAIvBU,KAAKV,MAAQI,EAAEU,OAAOd,MAEtBU,KAAKK,cAAcL,KAAKV,OAExBU,KAAKM,cAAcX,EACpB,CAEDY,mBAAmBb,GAIjB,GAAgB,MAHAA,EAAEc,SAAWd,EAAEe,QAGTT,KAAKU,UAAUC,KAAM,CACzC,MAAMC,EAASZ,KAAKU,UAAUC,KAAKE,cAAc,UAC7CD,GACFA,EAAOE,OAEV,CACF,CAEDC,oBACE,MAAMzB,MAAEA,GAAUU,KACZgB,EAAQhB,KAAKiB,WAAWJ,cAAc,SAC9B,KAAVvB,GAAgBU,KAAKkB,UACvBlB,KAAKmB,SAAU,EACfnB,KAAKU,UAAUU,YACb,CACEC,cAAc,GAEhBrB,KAAKsB,iBAAmB,yBACxBN,KAGFhB,KAAKmB,SAAU,EACfnB,KAAKU,UAAUU,YAAY,CAAA,GAE9B,CAEGG,cAKF,MAJgB,CACd,cAAc,EACdJ,QAASnB,KAAKwB,SAAWxB,KAAKmB,QAGjC,CAEDM,SACE,OAAOC,CAAI,GACP1B,KAAK2B,sDAIG3B,KAAKhB,aACHgB,KAAKC,qBACCD,KAAK4B,gBACX5B,KAAKf,MAAQ,sBACRe,KAAKb,WAAa,uBAChBa,KAAKX,2BACRW,KAAK6B,wBACL7B,KAAKkB,oBACRY,EAAS9B,KAAKuB,qBACbvB,KAAKV,OAAS,gBACdU,KAAKP,+BAELO,KAAKO,wBAGfP,KAAKwB,SAAWxB,KAAKmB,QACnBO,CAAI,6EAGJ,QACF1B,KAAK+B,MACHL,CAAI,wEAGS1B,KAAK+B,gCAGhB,QACJ/B,KAAKgC,QACHN,CAAI,iDACJ,QACF1B,KAAKiC,MACHP,CAAI,6DACJ,YAGT,EAGHQ,OAAOC,eAAeC,OAAO,UAAW1D"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-textarea/dt-textarea.js b/dt-assets/build/components/form/dt-textarea/dt-textarea.js index ceb4017efa..4c59c6584e 100644 --- a/dt-assets/build/components/form/dt-textarea/dt-textarea.js +++ b/dt-assets/build/components/form/dt-textarea/dt-textarea.js @@ -1 +1,40 @@ -import{i as e,y as t}from"../../lit-element-2409d5fe.js";import{D as a}from"../dt-form-base.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";window.customElements.define("dt-textarea",class extends a{static get styles(){return[...super.styles,e`textarea{color:var(--dt-textarea-text-color,#0a0a0a);appearance:none;background-color:var(--dt-textarea-background-color,#fefefe);border:1px solid var(--dt-textarea-border-color,#cecece);border-radius:3px;box-shadow:var(--dt-textarea-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:10rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);overflow:hidden;position:relative;outline:0;resize:none}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-textarea-disabled-background-color,#e6e6e6);cursor:not-allowed}`]}static get properties(){return{...super.properties,id:{type:String},value:{type:String,reflect:!0},loading:{type:Boolean},saved:{type:Boolean},onchange:{type:String}}}onChange(e){const t=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value,newValue:e.target.value}});this.value=e.target.value,this.dispatchEvent(t)}render(){return t`${this.labelTemplate()} `}}); +import { i as e, y as t } from '../../lit-element-2409d5fe.js'; +import { D as a } from '../dt-form-base.js'; +import '../../dt-base.js'; +import '../../lit-localize-763e4978.js'; +import '../dt-label/dt-label.js'; +window.customElements.define( + 'dt-textarea', + class extends a { + static get styles() { + return [ + ...super.styles, + e`textarea{color:var(--dt-textarea-text-color,#0a0a0a);appearance:none;background-color:var(--dt-textarea-background-color,#fefefe);border:1px solid var(--dt-textarea-border-color,#cecece);border-radius:3px;box-shadow:var(--dt-textarea-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:10rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);overflow:hidden;position:relative;outline:0;resize:none}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-textarea-disabled-background-color,#e6e6e6);cursor:not-allowed}`, + ]; + } + static get properties() { + return { + ...super.properties, + id: { type: String }, + value: { type: String, reflect: !0 }, + loading: { type: Boolean }, + saved: { type: Boolean }, + onchange: { type: String }, + }; + } + onChange(e) { + const t = new CustomEvent('change', { + detail: { + field: this.name, + oldValue: this.value, + newValue: e.target.value, + }, + }); + (this.value = e.target.value), this.dispatchEvent(t); + } + render() { + return t`${this.labelTemplate()} `; + } + }, +); +//# sourceMappingURL=dt-textarea.js.map diff --git a/dt-assets/build/components/form/dt-textarea/dt-textarea.js.map b/dt-assets/build/components/form/dt-textarea/dt-textarea.js.map new file mode 100644 index 0000000000..0ec2d88936 --- /dev/null +++ b/dt-assets/build/components/form/dt-textarea/dt-textarea.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-textarea.js","sources":["../../../src/components/form/dt-textarea/dt-textarea.js"],"sourcesContent":["import { html, css } from 'lit';\nimport DtFormBase from '../dt-form-base.js';\n\nexport class DtTextArea extends DtFormBase {\n static get styles() {\n return [\n ...super.styles,\n css`\n textarea {\n color: var(--dt-textarea-text-color, #0a0a0a);\n appearance: none;\n background-color: var(--dt-textarea-background-color, #fefefe);\n border: 1px solid var(--dt-textarea-border-color, #cecece);\n border-radius: 3px;\n box-shadow: var(\n --dt-textarea-input-box-shadow,\n inset 0 1px 2px hsl(0deg 0% 4% / 10%)\n );\n box-sizing: border-box;\n display: block;\n font-family: inherit;\n font-size: 1rem;\n font-weight: 300;\n height: 10rem;\n line-height: 1.5;\n margin: 0 0 1.0666666667rem;\n padding: var(--dt-form-padding, 0.5333333333rem);\n transition: var(\n --dt-form-transition,\n box-shadow 0.5s,\n border-color 0.25s ease-in-out\n );\n overflow: hidden;\n position: relative;\n outline: 0;\n resize: none;\n }\n input:disabled,\n input[readonly],\n textarea:disabled,\n textarea[readonly] {\n background-color: var(\n --dt-textarea-disabled-background-color,\n #e6e6e6\n );\n cursor: not-allowed;\n }\n `,\n ];\n }\n\n static get properties() {\n return {\n ...super.properties,\n id: { type: String },\n value: {\n type: String,\n reflect: true,\n },\n loading: { type: Boolean },\n saved: { type: Boolean },\n onchange: { type: String },\n };\n }\n\n onChange(e) {\n const event = new CustomEvent('change', {\n detail: {\n field: this.name,\n oldValue: this.value,\n newValue: e.target.value,\n },\n });\n\n this.value = e.target.value;\n\n this.dispatchEvent(event);\n }\n\n render() {\n return html`\n ${this.labelTemplate()}\n\n \n `;\n }\n}\n\nwindow.customElements.define('dt-textarea', DtTextArea);\n"],"names":["window","customElements","define","DtFormBase","styles","super","css","properties","id","type","String","value","reflect","loading","Boolean","saved","onchange","onChange","e","event","CustomEvent","detail","field","this","name","oldValue","newValue","target","dispatchEvent","render","html","labelTemplate","label","disabled"],"mappings":"gMAiGAA,OAAOC,eAAeC,OAAO,cA9FtB,cAAyBC,EACnBC,oBACT,MAAO,IACFC,MAAMD,OACTE,CAAG,wwBA0CN,CAEUC,wBACT,MAAO,IACFF,MAAME,WACTC,GAAI,CAAEC,KAAMC,QACZC,MAAO,CACLF,KAAMC,OACNE,SAAS,GAEXC,QAAS,CAAEJ,KAAMK,SACjBC,MAAO,CAAEN,KAAMK,SACfE,SAAU,CAAEP,KAAMC,QAErB,CAEDO,SAASC,GACP,MAAMC,EAAQ,IAAIC,YAAY,SAAU,CACtCC,OAAQ,CACNC,MAAOC,KAAKC,KACZC,SAAUF,KAAKZ,MACfe,SAAUR,EAAES,OAAOhB,SAIvBY,KAAKZ,MAAQO,EAAES,OAAOhB,MAEtBY,KAAKK,cAAcT,EACpB,CAEDU,SACE,OAAOC,CAAI,GACPP,KAAKQ,iCAGCR,KAAKf,aACHe,KAAKC,qBACCD,KAAKS,iCAEPT,KAAKU,yCAEPV,KAAKN,qBACLM,KAAKZ,OAAS,iBAG7B"} \ No newline at end of file diff --git a/dt-assets/build/components/form/dt-toggle/dt-toggle.js b/dt-assets/build/components/form/dt-toggle/dt-toggle.js index d918a2a964..dca5d8830e 100644 --- a/dt-assets/build/components/form/dt-toggle/dt-toggle.js +++ b/dt-assets/build/components/form/dt-toggle/dt-toggle.js @@ -1 +1,46 @@ -import{i as e,y as o}from"../../lit-element-2409d5fe.js";import{D as t}from"../dt-form-base.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";window.customElements.define("dt-toggle",class extends t{static get styles(){return[...super.styles,e`:host{display:inline-block}.Toggle{display:flex;flex-wrap:wrap;align-items:center;position:relative;margin-bottom:1em;cursor:pointer;gap:1ch}button.Toggle{border:0;padding:0;background-color:transparent;font:inherit}.Toggle__input{position:absolute;opacity:0;width:100%;height:100%}.Toggle__display{--offset:0.25em;--diameter:1.2em;display:inline-flex;align-items:center;justify-content:space-around;box-sizing:content-box;width:calc(var(--diameter) * 2 + var(--offset) * 2);height:calc(var(--diameter) + var(--offset) * 2);border:.1em solid rgb(0 0 0 / .2);position:relative;border-radius:100vw;background-color:var(--dt-toggle-background-color-off,#ecf5fc);transition:250ms}.Toggle__display::before{content:'';z-index:2;position:absolute;top:50%;left:var(--offset);box-sizing:border-box;width:var(--diameter);height:var(--diameter);border:.1em solid rgb(0 0 0 / .2);border-radius:50%;background-color:#fff;transform:translate(0,-50%);will-change:transform;transition:inherit}.Toggle:focus .Toggle__display,.Toggle__input:focus+.Toggle__display{outline:1px dotted #212121;outline:1px auto -webkit-focus-ring-color;outline-offset:2px}.Toggle:focus,.Toggle:focus:not(:focus-visible) .Toggle__display,.Toggle__input:focus:not(:focus-visible)+.Toggle__display{outline:0}.Toggle[aria-pressed=true] .Toggle__display,.Toggle__input:checked+.Toggle__display{background-color:var(--primary-color)}.Toggle[aria-pressed=true] .Toggle__display::before,.Toggle__input:checked+.Toggle__display::before{transform:translate(100%,-50%)}.Toggle[disabled] .Toggle__display,.Toggle__input:disabled+.Toggle__display{opacity:.6;filter:grayscale(40%);cursor:not-allowed}[dir=rtl] .Toggle__display::before{left:auto;right:var(--offset)}[dir=rtl] .Toggle[aria-pressed=true]+.Toggle__display::before,[dir=rtl] .Toggle__input:checked+.Toggle__display::before{transform:translate(-100%,-50%)}.Toggle__icon{display:inline-block;width:1em;height:1em;color:inherit;fill:currentcolor;vertical-align:middle;overflow:hidden}.Toggle__icon--cross{color:var(--alert-color);font-size:65%}.Toggle__icon--checkmark{color:var(--success-color)}`]}static get properties(){return{...super.properties,id:{type:String},checked:{type:Boolean,reflect:!0},onchange:{type:String},hideIcons:{type:Boolean,default:!0}}}constructor(){super(),this.hideIcons=!1}onChange(e){const o=new CustomEvent("change",{detail:{field:this.name,oldValue:this.checked,newValue:e.target.checked}});this.checked=e.target.checked,this._setFormValue(this.checked),this.dispatchEvent(o)}render(){const e=o``,t=o``;return o``}}); +import { i as e, y as o } from '../../lit-element-2409d5fe.js'; +import { D as t } from '../dt-form-base.js'; +import '../../dt-base.js'; +import '../../lit-localize-763e4978.js'; +import '../dt-label/dt-label.js'; +window.customElements.define( + 'dt-toggle', + class extends t { + static get styles() { + return [ + ...super.styles, + e`:host{display:inline-block}.Toggle{display:flex;flex-wrap:wrap;align-items:center;position:relative;margin-bottom:1em;cursor:pointer;gap:1ch}button.Toggle{border:0;padding:0;background-color:transparent;font:inherit}.Toggle__input{position:absolute;opacity:0;width:100%;height:100%}.Toggle__display{--offset:0.25em;--diameter:1.2em;display:inline-flex;align-items:center;justify-content:space-around;box-sizing:content-box;width:calc(var(--diameter) * 2 + var(--offset) * 2);height:calc(var(--diameter) + var(--offset) * 2);border:.1em solid rgb(0 0 0 / .2);position:relative;border-radius:100vw;background-color:var(--dt-toggle-background-color-off,#ecf5fc);transition:250ms}.Toggle__display::before{content:'';z-index:2;position:absolute;top:50%;left:var(--offset);box-sizing:border-box;width:var(--diameter);height:var(--diameter);border:.1em solid rgb(0 0 0 / .2);border-radius:50%;background-color:#fff;transform:translate(0,-50%);will-change:transform;transition:inherit}.Toggle:focus .Toggle__display,.Toggle__input:focus+.Toggle__display{outline:1px dotted #212121;outline:1px auto -webkit-focus-ring-color;outline-offset:2px}.Toggle:focus,.Toggle:focus:not(:focus-visible) .Toggle__display,.Toggle__input:focus:not(:focus-visible)+.Toggle__display{outline:0}.Toggle[aria-pressed=true] .Toggle__display,.Toggle__input:checked+.Toggle__display{background-color:var(--primary-color)}.Toggle[aria-pressed=true] .Toggle__display::before,.Toggle__input:checked+.Toggle__display::before{transform:translate(100%,-50%)}.Toggle[disabled] .Toggle__display,.Toggle__input:disabled+.Toggle__display{opacity:.6;filter:grayscale(40%);cursor:not-allowed}[dir=rtl] .Toggle__display::before{left:auto;right:var(--offset)}[dir=rtl] .Toggle[aria-pressed=true]+.Toggle__display::before,[dir=rtl] .Toggle__input:checked+.Toggle__display::before{transform:translate(-100%,-50%)}.Toggle__icon{display:inline-block;width:1em;height:1em;color:inherit;fill:currentcolor;vertical-align:middle;overflow:hidden}.Toggle__icon--cross{color:var(--alert-color);font-size:65%}.Toggle__icon--checkmark{color:var(--success-color)}`, + ]; + } + static get properties() { + return { + ...super.properties, + id: { type: String }, + checked: { type: Boolean, reflect: !0 }, + onchange: { type: String }, + hideIcons: { type: Boolean, default: !0 }, + }; + } + constructor() { + super(), (this.hideIcons = !1); + } + onChange(e) { + const o = new CustomEvent('change', { + detail: { + field: this.name, + oldValue: this.checked, + newValue: e.target.checked, + }, + }); + (this.checked = e.target.checked), + this._setFormValue(this.checked), + this.dispatchEvent(o); + } + render() { + const e = o``, + t = o``; + return o``; + } + }, +); +//# sourceMappingURL=dt-toggle.js.map diff --git a/dt-assets/build/components/form/dt-toggle/dt-toggle.js.map b/dt-assets/build/components/form/dt-toggle/dt-toggle.js.map new file mode 100644 index 0000000000..b98bb05082 --- /dev/null +++ b/dt-assets/build/components/form/dt-toggle/dt-toggle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-toggle.js","sources":["../../../src/components/form/dt-toggle/dt-toggle.js"],"sourcesContent":["import { html, css } from 'lit';\nimport DtFormBase from '../dt-form-base.js';\n\nexport class DtToggle extends DtFormBase {\n static get styles() {\n return [\n ...super.styles,\n css`\n :host {\n display: inline-block;\n }\n\n .Toggle {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n position: relative;\n margin-bottom: 1em;\n cursor: pointer;\n gap: 1ch;\n }\n\n button.Toggle {\n border: 0;\n padding: 0;\n background-color: transparent;\n font: inherit;\n }\n\n .Toggle__input {\n position: absolute;\n opacity: 0;\n width: 100%;\n height: 100%;\n }\n\n .Toggle__display {\n --offset: 0.25em;\n --diameter: 1.2em;\n\n display: inline-flex;\n align-items: center;\n justify-content: space-around;\n box-sizing: content-box;\n width: calc(var(--diameter) * 2 + var(--offset) * 2);\n height: calc(var(--diameter) + var(--offset) * 2);\n border: 0.1em solid rgb(0 0 0 / 0.2);\n position: relative;\n border-radius: 100vw;\n background-color: var(--dt-toggle-background-color-off, #ecf5fc);\n transition: 250ms;\n }\n\n .Toggle__display::before {\n content: '';\n z-index: 2;\n position: absolute;\n top: 50%;\n left: var(--offset);\n box-sizing: border-box;\n width: var(--diameter);\n height: var(--diameter);\n border: 0.1em solid rgb(0 0 0 / 0.2);\n border-radius: 50%;\n background-color: white;\n transform: translate(0, -50%);\n will-change: transform;\n transition: inherit;\n }\n\n .Toggle:focus .Toggle__display,\n .Toggle__input:focus + .Toggle__display {\n outline: 1px dotted #212121;\n outline: 1px auto -webkit-focus-ring-color;\n outline-offset: 2px;\n }\n\n .Toggle:focus,\n .Toggle:focus:not(:focus-visible) .Toggle__display,\n .Toggle__input:focus:not(:focus-visible) + .Toggle__display {\n outline: 0;\n }\n\n .Toggle[aria-pressed='true'] .Toggle__display,\n .Toggle__input:checked + .Toggle__display {\n background-color: var(--primary-color);\n }\n\n .Toggle[aria-pressed='true'] .Toggle__display::before,\n .Toggle__input:checked + .Toggle__display::before {\n transform: translate(100%, -50%);\n }\n\n .Toggle[disabled] .Toggle__display,\n .Toggle__input:disabled + .Toggle__display {\n opacity: 0.6;\n filter: grayscale(40%);\n cursor: not-allowed;\n }\n [dir='rtl'] .Toggle__display::before {\n left: auto;\n right: var(--offset);\n }\n\n [dir='rtl'] .Toggle[aria-pressed='true'] + .Toggle__display::before,\n [dir='rtl'] .Toggle__input:checked + .Toggle__display::before {\n transform: translate(-100%, -50%);\n }\n\n .Toggle__icon {\n display: inline-block;\n width: 1em;\n height: 1em;\n color: inherit;\n fill: currentcolor;\n vertical-align: middle;\n overflow: hidden;\n }\n\n .Toggle__icon--cross {\n color: var(--alert-color);\n font-size: 65%;\n }\n\n .Toggle__icon--checkmark {\n color: var(--success-color);\n }\n `,\n ];\n }\n\n static get properties() {\n return {\n ...super.properties,\n id: { type: String },\n checked: {\n type: Boolean,\n reflect: true,\n },\n onchange: { type: String },\n hideIcons: { type: Boolean, default: true },\n };\n }\n\n constructor() {\n super();\n this.hideIcons = false;\n }\n\n onChange(e) {\n const event = new CustomEvent('change', {\n detail: {\n field: this.name,\n oldValue: this.checked,\n newValue: e.target.checked,\n },\n });\n this.checked = e.target.checked;\n\n this._setFormValue(this.checked);\n\n this.dispatchEvent(event);\n }\n\n render() {\n // prettier-ignore\n const check = html``\n // prettier-ignore\n const cross = html``\n return html`\n \n `;\n }\n}\n\nwindow.customElements.define('dt-toggle', DtToggle);\n"],"names":["window","customElements","define","DtFormBase","styles","super","css","properties","id","type","String","checked","Boolean","reflect","onchange","hideIcons","default","constructor","this","onChange","e","event","CustomEvent","detail","field","name","oldValue","newValue","target","_setFormValue","dispatchEvent","render","check","html","cross","RTL","label","disabled"],"mappings":"gMA6LAA,OAAOC,eAAeC,OAAO,YA1LtB,cAAuBC,EACjBC,oBACT,MAAO,IACFC,MAAMD,OACTE,CAAG,0jEA0HN,CAEUC,wBACT,MAAO,IACFF,MAAME,WACTC,GAAI,CAAEC,KAAMC,QACZC,QAAS,CACPF,KAAMG,QACNC,SAAS,GAEXC,SAAU,CAAEL,KAAMC,QAClBK,UAAW,CAAEN,KAAMG,QAASI,SAAS,GAExC,CAEDC,cACEZ,QACAa,KAAKH,WAAY,CAClB,CAEDI,SAASC,GACP,MAAMC,EAAQ,IAAIC,YAAY,SAAU,CACtCC,OAAQ,CACNC,MAAON,KAAKO,KACZC,SAAUR,KAAKP,QACfgB,SAAUP,EAAEQ,OAAOjB,WAGvBO,KAAKP,QAAUS,EAAEQ,OAAOjB,QAExBO,KAAKW,cAAcX,KAAKP,SAExBO,KAAKY,cAAcT,EACpB,CAEDU,SAEE,MAAMC,EAAQC,CAAI,gVAEZC,EAAQD,CAAI,gVAClB,OAAOA,CAAI,8BACoBf,KAAKV,YAAYU,KAAKiB,IAAM,MAAQ,UAC7DjB,KAAKkB,sCAGGlB,KAAKV,WACPU,KAAKV,uCAEAU,KAAKP,oBACPO,KAAKC,wBACFD,KAAKmB,mDAGdnB,KAAKH,UAAwCkB,CAAI,GAAhCA,CAAI,GAAID,KAASE,oBAI5C"} \ No newline at end of file diff --git a/dt-assets/build/components/form/index.js b/dt-assets/build/components/form/index.js index 3306bacbe5..ed7d490487 100644 --- a/dt-assets/build/components/form/index.js +++ b/dt-assets/build/components/form/index.js @@ -1 +1,35 @@ -import"./dt-button/dt-button.js";import"./dt-church-health-circle/dt-church-health-circle.js";import"./dt-connection/dt-connection.js";import"./dt-date/dt-date.js";import"./dt-label/dt-label.js";import"./dt-location/dt-location.js";import"./dt-location-map/dt-location-map.js";import"./dt-multi-select/dt-multi-select.js";import"./dt-number/dt-number.js";import"./dt-single-select/dt-single-select.js";import"./dt-tags/dt-tags.js";import"./dt-text/dt-text.js";import"./dt-textarea/dt-textarea.js";import"./dt-toggle/dt-toggle.js";import"./dt-communication-channel/dt-comm-channel.js";import"../lit-element-2409d5fe.js";import"../class-map-8d921948.js";import"../directive-de55b00a.js";import"../dt-base.js";import"../lit-localize-763e4978.js";import"./dt-church-health-circle/dt-church-health-circle-icon.js";import"../style-map-ac85d91b.js";import"./dt-form-base.js";import"./mixins/hasOptionsList.js";import"../icons/dt-spinner.js";import"../icons/dt-checkmark.js";import"../map-c0e24c36.js";import"../repeat-1a2b8966.js";import"./dt-location-map/dt-location-map-item.js";import"../icons/dt-icon.js";import"./dt-location-map/dt-map-modal.js";import"../layout/dt-modal/dt-modal.js";import"../if-defined-11ddebeb.js";import"../icons/dt-exclamation-circle.js"; +import './dt-button/dt-button.js'; +import './dt-church-health-circle/dt-church-health-circle.js'; +import './dt-connection/dt-connection.js'; +import './dt-date/dt-date.js'; +import './dt-label/dt-label.js'; +import './dt-location/dt-location.js'; +import './dt-location-map/dt-location-map.js'; +import './dt-multi-select/dt-multi-select.js'; +import './dt-number/dt-number.js'; +import './dt-single-select/dt-single-select.js'; +import './dt-tags/dt-tags.js'; +import './dt-text/dt-text.js'; +import './dt-textarea/dt-textarea.js'; +import './dt-toggle/dt-toggle.js'; +import './dt-communication-channel/dt-comm-channel.js'; +import '../lit-element-2409d5fe.js'; +import '../class-map-8d921948.js'; +import '../directive-de55b00a.js'; +import '../dt-base.js'; +import '../lit-localize-763e4978.js'; +import './dt-church-health-circle/dt-church-health-circle-icon.js'; +import '../style-map-ac85d91b.js'; +import './dt-form-base.js'; +import './mixins/hasOptionsList.js'; +import '../icons/dt-spinner.js'; +import '../icons/dt-checkmark.js'; +import '../map-c0e24c36.js'; +import '../repeat-1a2b8966.js'; +import './dt-location-map/dt-location-map-item.js'; +import '../icons/dt-icon.js'; +import './dt-location-map/dt-map-modal.js'; +import '../layout/dt-modal/dt-modal.js'; +import '../if-defined-11ddebeb.js'; +import '../icons/dt-exclamation-circle.js'; +//# sourceMappingURL=index.js.map diff --git a/dt-assets/build/components/form/index.js.map b/dt-assets/build/components/form/index.js.map new file mode 100644 index 0000000000..c8e9b4f445 --- /dev/null +++ b/dt-assets/build/components/form/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/form/mixins/hasOptionsList.js b/dt-assets/build/components/form/mixins/hasOptionsList.js index a3bcbeab2c..94fd8b9e4f 100644 --- a/dt-assets/build/components/form/mixins/hasOptionsList.js +++ b/dt-assets/build/components/form/mixins/hasOptionsList.js @@ -1 +1,170 @@ -import{y as t}from"../../lit-element-2409d5fe.js";import{m as e}from"../../lit-localize-763e4978.js";const i=i=>class extends i{constructor(){super(),this.activeIndex=-1,this.filteredOptions=[],this.detectTap=!1}static get properties(){return{...super.properties,value:{type:Array,reflect:!0},query:{type:String,state:!0},options:{type:Array},filteredOptions:{type:Array,state:!0},open:{type:Boolean,state:!0},activeIndex:{type:Number,state:!0},containerHeight:{type:Number,state:!0},loading:{type:Boolean}}}willUpdate(t){if(super.willUpdate(t),t&&!this.containerHeight&&this.shadowRoot.children&&this.shadowRoot.children.length){const t=this.shadowRoot.querySelector(".input-group");t&&(this.containerHeight=t.offsetHeight)}}updated(){this._scrollOptionListToActive();const t=this.shadowRoot.querySelector(".input-group");!t.style.getPropertyValue("--container-width")&&t.clientWidth>0&&t.style.setProperty("--container-width",`${t.clientWidth}px`)}_select(){console.error("Must implement `_select(value)` function")}static _focusInput(t){t.target===t.currentTarget&&t.target.getElementsByTagName("input")[0].focus()}_inputFocusIn(t){t.relatedTarget&&["BUTTON","LI"].includes(t.relatedTarget.nodeName)||(this.open=!0,this.activeIndex=-1)}_inputFocusOut(t){t.relatedTarget&&["BUTTON","LI"].includes(t.relatedTarget.nodeName)||(this.open=!1)}_inputKeyDown(t){switch(t.keyCode||t.which){case 8:""===t.target.value?this.value=this.value.slice(0,-1):this.open=!0;break;case 38:this.open=!0,this._listHighlightPrevious();break;case 40:this.open=!0,this._listHighlightNext();break;case 9:this.activeIndex<0?this.open=!1:t.preventDefault(),this._keyboardSelectOption();break;case 13:this._keyboardSelectOption();break;case 27:this.open=!1,this.activeIndex=-1;break;default:this.open=!0}}_inputKeyUp(t){this.query=t.target.value}_scrollOptionListToActive(){const t=this.shadowRoot.querySelector(".option-list"),e=this.shadowRoot.querySelector("button.active");if(t&&e){const i=e.offsetTop,s=e.offsetTop+e.clientHeight,o=t.scrollTop;s>t.scrollTop+t.clientHeight?t.scrollTo({top:s-t.clientHeight,behavior:"smooth"}):i-1&&(this.activeIndex+1>this.filteredOptions.length?this._select(this.query):this._select(this.filteredOptions[this.activeIndex].id),this._clearSearch())}_clickOption(t){t.target&&t.target.value&&(this._select(t.target.value),this._clearSearch())}_clickAddNew(t){t.target&&(this._select(t.target.dataset?.label),this._clearSearch())}_clearSearch(){const t=this.shadowRoot.querySelector("input");t&&(t.value="")}_listHighlightNext(){this.allowAdd?this.activeIndex=Math.min(this.filteredOptions.length,this.activeIndex+1):this.activeIndex=Math.min(this.filteredOptions.length-1,this.activeIndex+1)}_listHighlightPrevious(){this.activeIndex=Math.max(0,this.activeIndex-1)}_renderOption(e,i){return t`
  • `}_baseRenderOptions(){return this.filteredOptions.length?this.filteredOptions.map(((t,e)=>this._renderOption(t,e))):this.loading?t`
  • ${e("Loading options...")}
  • `:t`
  • ${e("No Data Available")}
  • `}_renderOptions(){let i=this._baseRenderOptions();return this.allowAdd&&this.query&&(Array.isArray(i)||(i=[i]),i.push(t`
  • `)),i}};export{i as H}; +import { y as t } from '../../lit-element-2409d5fe.js'; +import { m as e } from '../../lit-localize-763e4978.js'; +const i = (i) => + class extends i { + constructor() { + super(), + (this.activeIndex = -1), + (this.filteredOptions = []), + (this.detectTap = !1); + } + static get properties() { + return { + ...super.properties, + value: { type: Array, reflect: !0 }, + query: { type: String, state: !0 }, + options: { type: Array }, + filteredOptions: { type: Array, state: !0 }, + open: { type: Boolean, state: !0 }, + activeIndex: { type: Number, state: !0 }, + containerHeight: { type: Number, state: !0 }, + loading: { type: Boolean }, + }; + } + willUpdate(t) { + if ( + (super.willUpdate(t), + t && + !this.containerHeight && + this.shadowRoot.children && + this.shadowRoot.children.length) + ) { + const t = this.shadowRoot.querySelector('.input-group'); + t && (this.containerHeight = t.offsetHeight); + } + } + updated() { + this._scrollOptionListToActive(); + const t = this.shadowRoot.querySelector('.input-group'); + !t.style.getPropertyValue('--container-width') && + t.clientWidth > 0 && + t.style.setProperty('--container-width', `${t.clientWidth}px`); + } + _select() { + console.error('Must implement `_select(value)` function'); + } + static _focusInput(t) { + t.target === t.currentTarget && + t.target.getElementsByTagName('input')[0].focus(); + } + _inputFocusIn(t) { + (t.relatedTarget && + ['BUTTON', 'LI'].includes(t.relatedTarget.nodeName)) || + ((this.open = !0), (this.activeIndex = -1)); + } + _inputFocusOut(t) { + (t.relatedTarget && + ['BUTTON', 'LI'].includes(t.relatedTarget.nodeName)) || + (this.open = !1); + } + _inputKeyDown(t) { + switch (t.keyCode || t.which) { + case 8: + '' === t.target.value + ? (this.value = this.value.slice(0, -1)) + : (this.open = !0); + break; + case 38: + (this.open = !0), this._listHighlightPrevious(); + break; + case 40: + (this.open = !0), this._listHighlightNext(); + break; + case 9: + this.activeIndex < 0 ? (this.open = !1) : t.preventDefault(), + this._keyboardSelectOption(); + break; + case 13: + this._keyboardSelectOption(); + break; + case 27: + (this.open = !1), (this.activeIndex = -1); + break; + default: + this.open = !0; + } + } + _inputKeyUp(t) { + this.query = t.target.value; + } + _scrollOptionListToActive() { + const t = this.shadowRoot.querySelector('.option-list'), + e = this.shadowRoot.querySelector('button.active'); + if (t && e) { + const i = e.offsetTop, + s = e.offsetTop + e.clientHeight, + o = t.scrollTop; + s > t.scrollTop + t.clientHeight + ? t.scrollTo({ top: s - t.clientHeight, behavior: 'smooth' }) + : i < o && t.scrollTo({ top: i, behavior: 'smooth' }); + } + } + _touchStart(t) { + t.target && (this.detectTap = !1); + } + _touchMove(t) { + t.target && (this.detectTap = !0); + } + _touchEnd(t) { + this.detectTap || + (t.target && t.target.value && this._clickOption(t), + (this.detectTap = !1)); + } + _keyboardSelectOption() { + this.activeIndex > -1 && + (this.activeIndex + 1 > this.filteredOptions.length + ? this._select(this.query) + : this._select(this.filteredOptions[this.activeIndex].id), + this._clearSearch()); + } + _clickOption(t) { + t.target && + t.target.value && + (this._select(t.target.value), this._clearSearch()); + } + _clickAddNew(t) { + t.target && (this._select(t.target.dataset?.label), this._clearSearch()); + } + _clearSearch() { + const t = this.shadowRoot.querySelector('input'); + t && (t.value = ''); + } + _listHighlightNext() { + this.allowAdd + ? (this.activeIndex = Math.min( + this.filteredOptions.length, + this.activeIndex + 1, + )) + : (this.activeIndex = Math.min( + this.filteredOptions.length - 1, + this.activeIndex + 1, + )); + } + _listHighlightPrevious() { + this.activeIndex = Math.max(0, this.activeIndex - 1); + } + _renderOption(e, i) { + return t`
  • `; + } + _baseRenderOptions() { + return this.filteredOptions.length + ? this.filteredOptions.map((t, e) => this._renderOption(t, e)) + : this.loading + ? t`
  • ${e('Loading options...')}
  • ` + : t`
  • ${e('No Data Available')}
  • `; + } + _renderOptions() { + let i = this._baseRenderOptions(); + return ( + this.allowAdd && + this.query && + (Array.isArray(i) || (i = [i]), + i.push( + t`
  • `, + )), + i + ); + } + }; +export { i as H }; +//# sourceMappingURL=hasOptionsList.js.map diff --git a/dt-assets/build/components/form/mixins/hasOptionsList.js.map b/dt-assets/build/components/form/mixins/hasOptionsList.js.map new file mode 100644 index 0000000000..837375d353 --- /dev/null +++ b/dt-assets/build/components/form/mixins/hasOptionsList.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hasOptionsList.js","sources":["../../../src/components/form/mixins/hasOptionsList.js"],"sourcesContent":["import { html } from 'lit';\nimport { msg } from '@lit/localize';\n\nexport const HasOptionsList = (superClass) => class extends superClass {\n constructor() {\n super();\n this.activeIndex = -1;\n this.filteredOptions = [];\n this.detectTap = false;\n }\n\n static get properties() {\n return {\n ...super.properties,\n value: {\n type: Array,\n reflect: true,\n },\n query: {\n type: String,\n state: true,\n },\n options: { type: Array },\n filteredOptions: { type: Array, state: true },\n open: {\n type: Boolean,\n state: true,\n },\n activeIndex: {\n type: Number,\n state: true,\n },\n containerHeight: {\n type: Number,\n state: true,\n },\n loading: { type: Boolean },\n };\n }\n\n willUpdate(props) {\n super.willUpdate(props);\n\n if (props) {\n // Set the containerHeight for dropdown positioning if it hasn't been set yet\n if (\n !this.containerHeight &&\n this.shadowRoot.children &&\n this.shadowRoot.children.length\n ) {\n const inputGroup = this.shadowRoot.querySelector('.input-group');\n if (inputGroup) {\n this.containerHeight = inputGroup.offsetHeight;\n }\n }\n }\n }\n\n updated() {\n this._scrollOptionListToActive();\n\n // set variable with width of container for truncating selected options via CSS\n const container = this.shadowRoot.querySelector('.input-group');\n const currentValue = container.style.getPropertyValue('--container-width');\n if (!currentValue && container.clientWidth > 0) {\n container.style.setProperty(\n '--container-width',\n `${container.clientWidth}px`\n );\n }\n }\n\n _select() { // eslint-disable-line class-methods-use-this\n console.error(\"Must implement `_select(value)` function\");\n }\n\n /* Search Input Field Events */\n static _focusInput(e) {\n if (e.target !== e.currentTarget) return;\n\n e.target.getElementsByTagName('input')[0].focus();\n }\n\n _inputFocusIn(e) {\n if (\n !e.relatedTarget ||\n !['BUTTON', 'LI'].includes(e.relatedTarget.nodeName)\n ) {\n this.open = true;\n this.activeIndex = -1;\n }\n }\n\n _inputFocusOut(e) {\n // allow clicks on option list button to not close the option list\n // Safari actually passes the parent
  • as the relatedTarget\n if (\n !e.relatedTarget ||\n !['BUTTON', 'LI'].includes(e.relatedTarget.nodeName)\n ) {\n this.open = false;\n }\n }\n\n _inputKeyDown(e) {\n const keycode = e.keyCode || e.which;\n\n switch (keycode) {\n case 8: // backspace\n if (e.target.value === '') {\n this.value = this.value.slice(0, -1);\n } else {\n this.open = true;\n }\n break;\n case 38: // arrow up\n this.open = true;\n this._listHighlightPrevious();\n break;\n case 40: // arrow down\n this.open = true;\n this._listHighlightNext();\n break;\n case 9: // tab\n if (this.activeIndex < 0) {\n // if pressing tab while no option is selected,\n // close the list so you can go to next field\n this.open = false;\n } else {\n e.preventDefault();\n }\n this._keyboardSelectOption();\n break;\n case 13: // enter\n this._keyboardSelectOption();\n break;\n case 27: // escape\n this.open = false;\n this.activeIndex = -1;\n break;\n default:\n this.open = true;\n break;\n }\n }\n\n _inputKeyUp(e) {\n this.query = e.target.value;\n }\n\n /**\n * When navigating via keyboard, keep active element within visible area of option list\n * @private\n */\n _scrollOptionListToActive() {\n const optionList = this.shadowRoot.querySelector('.option-list');\n const activeEl = this.shadowRoot.querySelector('button.active');\n if (optionList && activeEl) {\n const elTop = activeEl.offsetTop;\n const elBottom = activeEl.offsetTop + activeEl.clientHeight;\n const listTop = optionList.scrollTop;\n const listBottom = optionList.scrollTop + optionList.clientHeight;\n if (elBottom > listBottom) {\n // active element below visible area. scroll down\n optionList.scrollTo({\n top: elBottom - optionList.clientHeight,\n behavior: 'smooth',\n });\n } else if (elTop < listTop) {\n // active element above visible area. scroll up\n optionList.scrollTo({ top: elTop, behavior: 'smooth' });\n }\n }\n }\n\n /* Option List Events */\n _touchStart(e) {\n if (e.target) {\n this.detectTap = false;\n }\n }\n\n _touchMove(e) {\n if (e.target) {\n this.detectTap = true;\n }\n }\n\n _touchEnd(e) {\n if (!this.detectTap) {\n if (e.target && e.target.value) {\n this._clickOption(e);\n }\n this.detectTap = false;\n }\n }\n\n _keyboardSelectOption() {\n if (this.activeIndex > -1) {\n if (this.activeIndex + 1 > this.filteredOptions.length) {\n this._select(this.query);\n } else {\n this._select(this.filteredOptions[this.activeIndex].id);\n }\n this._clearSearch();\n }\n }\n\n _clickOption(e) {\n if (e.target && e.target.value) {\n this._select(e.target.value);\n this._clearSearch();\n }\n }\n\n _clickAddNew(e) {\n if (e.target) {\n this._select(e.target.dataset?.label);\n // clear search field if clicked with mouse, since field will lose focus\n this._clearSearch();\n }\n }\n\n _clearSearch() {\n const input = this.shadowRoot.querySelector('input');\n if (input) {\n input.value = '';\n }\n }\n\n /* Option List Navigation */\n _listHighlightNext() {\n if (this.allowAdd) {\n this.activeIndex = Math.min(\n this.filteredOptions.length, // allow 1 more than the list length\n this.activeIndex + 1\n );\n } else {\n this.activeIndex = Math.min(\n this.filteredOptions.length - 1,\n this.activeIndex + 1\n );\n }\n }\n\n _listHighlightPrevious() {\n this.activeIndex = Math.max(0, this.activeIndex - 1);\n }\n\n /* Rendering */\n _renderOption(opt, idx) {\n return html`\n
  • \n -1 && this.activeIndex === idx\n ? 'active'\n : ''}\"\n >\n ${opt.label}\n \n
  • \n `;\n }\n\n _baseRenderOptions() {\n if (!this.filteredOptions.length) {\n if (this.loading) {\n return html`
  • ${msg('Loading options...')}
  • `;\n }\n return html`
  • ${msg('No Data Available')}
  • `;\n }\n\n return this.filteredOptions.map((opt, idx) => this._renderOption(opt, idx));\n }\n\n _renderOptions() {\n let optionsMarkup = this._baseRenderOptions();\n\n if (this.allowAdd && this.query) {\n if (!Array.isArray(optionsMarkup)) {\n optionsMarkup = [optionsMarkup];\n }\n optionsMarkup.push(html`
  • \n -1 &&\n this.activeIndex >= this.filteredOptions.length\n ? 'active'\n : ''}\"\n >\n ${msg('Add')} \"${this.query}\"\n \n
  • `);\n }\n return optionsMarkup;\n }\n}\n"],"names":["HasOptionsList","superClass","constructor","super","this","activeIndex","filteredOptions","detectTap","properties","value","type","Array","reflect","query","String","state","options","open","Boolean","Number","containerHeight","loading","willUpdate","props","shadowRoot","children","length","inputGroup","querySelector","offsetHeight","updated","_scrollOptionListToActive","container","style","getPropertyValue","clientWidth","setProperty","_select","console","error","static","e","target","currentTarget","getElementsByTagName","focus","_inputFocusIn","relatedTarget","includes","nodeName","_inputFocusOut","_inputKeyDown","keyCode","which","slice","_listHighlightPrevious","_listHighlightNext","preventDefault","_keyboardSelectOption","_inputKeyUp","optionList","activeEl","elTop","offsetTop","elBottom","clientHeight","listTop","scrollTop","scrollTo","top","behavior","_touchStart","_touchMove","_touchEnd","_clickOption","id","_clearSearch","_clickAddNew","dataset","label","input","allowAdd","Math","min","max","_renderOption","opt","idx","html","_baseRenderOptions","map","msg","_renderOptions","optionsMarkup","isArray","push"],"mappings":"qGAGY,MAACA,EAAkBC,GAAe,cAAcA,EAC1DC,cACEC,QACAC,KAAKC,aAAe,EACpBD,KAAKE,gBAAkB,GACvBF,KAAKG,WAAY,CAClB,CAEUC,wBACT,MAAO,IACFL,MAAMK,WACTC,MAAO,CACLC,KAAMC,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vF,KAAKS,yBAIrBgF,CACR"} \ No newline at end of file diff --git a/dt-assets/build/components/generated/am_ET.js b/dt-assets/build/components/generated/am_ET.js index 97c4fb736c..edda49a4f1 100644 --- a/dt-assets/build/components/generated/am_ET.js +++ b/dt-assets/build/components/generated/am_ET.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=am_ET.js.map diff --git a/dt-assets/build/components/generated/am_ET.js.map b/dt-assets/build/components/generated/am_ET.js.map new file mode 100644 index 0000000000..2c742b9f01 --- /dev/null +++ b/dt-assets/build/components/generated/am_ET.js.map @@ -0,0 +1 @@ +{"version":3,"file":"am_ET.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/ar.js b/dt-assets/build/components/generated/ar.js index 97c4fb736c..8ae62d69e6 100644 --- a/dt-assets/build/components/generated/ar.js +++ b/dt-assets/build/components/generated/ar.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=ar.js.map diff --git a/dt-assets/build/components/generated/ar.js.map b/dt-assets/build/components/generated/ar.js.map new file mode 100644 index 0000000000..94e1bdfea6 --- /dev/null +++ b/dt-assets/build/components/generated/ar.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ar.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/ar_MA.js b/dt-assets/build/components/generated/ar_MA.js index 97c4fb736c..376251e3ce 100644 --- a/dt-assets/build/components/generated/ar_MA.js +++ b/dt-assets/build/components/generated/ar_MA.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=ar_MA.js.map diff --git a/dt-assets/build/components/generated/ar_MA.js.map b/dt-assets/build/components/generated/ar_MA.js.map new file mode 100644 index 0000000000..c86c89bdda --- /dev/null +++ b/dt-assets/build/components/generated/ar_MA.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ar_MA.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/bg_BG.js b/dt-assets/build/components/generated/bg_BG.js index 97c4fb736c..4549aee76c 100644 --- a/dt-assets/build/components/generated/bg_BG.js +++ b/dt-assets/build/components/generated/bg_BG.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=bg_BG.js.map diff --git a/dt-assets/build/components/generated/bg_BG.js.map b/dt-assets/build/components/generated/bg_BG.js.map new file mode 100644 index 0000000000..afa4371e29 --- /dev/null +++ b/dt-assets/build/components/generated/bg_BG.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bg_BG.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/bn_BD.js b/dt-assets/build/components/generated/bn_BD.js index 97c4fb736c..3cce0ea1cf 100644 --- a/dt-assets/build/components/generated/bn_BD.js +++ b/dt-assets/build/components/generated/bn_BD.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=bn_BD.js.map diff --git a/dt-assets/build/components/generated/bn_BD.js.map b/dt-assets/build/components/generated/bn_BD.js.map new file mode 100644 index 0000000000..e28638fa3a --- /dev/null +++ b/dt-assets/build/components/generated/bn_BD.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bn_BD.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/bs_BA.js b/dt-assets/build/components/generated/bs_BA.js index 97c4fb736c..0455852baf 100644 --- a/dt-assets/build/components/generated/bs_BA.js +++ b/dt-assets/build/components/generated/bs_BA.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=bs_BA.js.map diff --git a/dt-assets/build/components/generated/bs_BA.js.map b/dt-assets/build/components/generated/bs_BA.js.map new file mode 100644 index 0000000000..0de9611893 --- /dev/null +++ b/dt-assets/build/components/generated/bs_BA.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bs_BA.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/cs.js b/dt-assets/build/components/generated/cs.js index 97c4fb736c..a77ec3d62f 100644 --- a/dt-assets/build/components/generated/cs.js +++ b/dt-assets/build/components/generated/cs.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=cs.js.map diff --git a/dt-assets/build/components/generated/cs.js.map b/dt-assets/build/components/generated/cs.js.map new file mode 100644 index 0000000000..62d3ec7aca --- /dev/null +++ b/dt-assets/build/components/generated/cs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/de_DE.js b/dt-assets/build/components/generated/de_DE.js index 97c4fb736c..5d14490037 100644 --- a/dt-assets/build/components/generated/de_DE.js +++ b/dt-assets/build/components/generated/de_DE.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=de_DE.js.map diff --git a/dt-assets/build/components/generated/de_DE.js.map b/dt-assets/build/components/generated/de_DE.js.map new file mode 100644 index 0000000000..9a3d9a2242 --- /dev/null +++ b/dt-assets/build/components/generated/de_DE.js.map @@ -0,0 +1 @@ +{"version":3,"file":"de_DE.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/el.js b/dt-assets/build/components/generated/el.js index 97c4fb736c..b944496383 100644 --- a/dt-assets/build/components/generated/el.js +++ b/dt-assets/build/components/generated/el.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=el.js.map diff --git a/dt-assets/build/components/generated/el.js.map b/dt-assets/build/components/generated/el.js.map new file mode 100644 index 0000000000..f0f3ba1d09 --- /dev/null +++ b/dt-assets/build/components/generated/el.js.map @@ -0,0 +1 @@ +{"version":3,"file":"el.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/en_US.js b/dt-assets/build/components/generated/en_US.js index 97c4fb736c..d408f524e7 100644 --- a/dt-assets/build/components/generated/en_US.js +++ b/dt-assets/build/components/generated/en_US.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=en_US.js.map diff --git a/dt-assets/build/components/generated/en_US.js.map b/dt-assets/build/components/generated/en_US.js.map new file mode 100644 index 0000000000..f80c75b962 --- /dev/null +++ b/dt-assets/build/components/generated/en_US.js.map @@ -0,0 +1 @@ +{"version":3,"file":"en_US.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/es-419.js b/dt-assets/build/components/generated/es-419.js index 97c4fb736c..2fe7af91f5 100644 --- a/dt-assets/build/components/generated/es-419.js +++ b/dt-assets/build/components/generated/es-419.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=es-419.js.map diff --git a/dt-assets/build/components/generated/es-419.js.map b/dt-assets/build/components/generated/es-419.js.map new file mode 100644 index 0000000000..580b0cff7d --- /dev/null +++ b/dt-assets/build/components/generated/es-419.js.map @@ -0,0 +1 @@ +{"version":3,"file":"es-419.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/es_419.js b/dt-assets/build/components/generated/es_419.js index 97c4fb736c..00ba6030cb 100644 --- a/dt-assets/build/components/generated/es_419.js +++ b/dt-assets/build/components/generated/es_419.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=es_419.js.map diff --git a/dt-assets/build/components/generated/es_419.js.map b/dt-assets/build/components/generated/es_419.js.map new file mode 100644 index 0000000000..bad1e7ebfd --- /dev/null +++ b/dt-assets/build/components/generated/es_419.js.map @@ -0,0 +1 @@ +{"version":3,"file":"es_419.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/es_ES.js b/dt-assets/build/components/generated/es_ES.js index 97c4fb736c..0bdfce860a 100644 --- a/dt-assets/build/components/generated/es_ES.js +++ b/dt-assets/build/components/generated/es_ES.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=es_ES.js.map diff --git a/dt-assets/build/components/generated/es_ES.js.map b/dt-assets/build/components/generated/es_ES.js.map new file mode 100644 index 0000000000..856528f4b2 --- /dev/null +++ b/dt-assets/build/components/generated/es_ES.js.map @@ -0,0 +1 @@ +{"version":3,"file":"es_ES.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/fa_IR.js b/dt-assets/build/components/generated/fa_IR.js index 97c4fb736c..32437c6ae4 100644 --- a/dt-assets/build/components/generated/fa_IR.js +++ b/dt-assets/build/components/generated/fa_IR.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=fa_IR.js.map diff --git a/dt-assets/build/components/generated/fa_IR.js.map b/dt-assets/build/components/generated/fa_IR.js.map new file mode 100644 index 0000000000..25d2e04bc4 --- /dev/null +++ b/dt-assets/build/components/generated/fa_IR.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fa_IR.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/fr_FR.js b/dt-assets/build/components/generated/fr_FR.js index 97c4fb736c..2dfb041c61 100644 --- a/dt-assets/build/components/generated/fr_FR.js +++ b/dt-assets/build/components/generated/fr_FR.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=fr_FR.js.map diff --git a/dt-assets/build/components/generated/fr_FR.js.map b/dt-assets/build/components/generated/fr_FR.js.map new file mode 100644 index 0000000000..a37c957ca1 --- /dev/null +++ b/dt-assets/build/components/generated/fr_FR.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fr_FR.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/hi_IN.js b/dt-assets/build/components/generated/hi_IN.js index 97c4fb736c..28303e461d 100644 --- a/dt-assets/build/components/generated/hi_IN.js +++ b/dt-assets/build/components/generated/hi_IN.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=hi_IN.js.map diff --git a/dt-assets/build/components/generated/hi_IN.js.map b/dt-assets/build/components/generated/hi_IN.js.map new file mode 100644 index 0000000000..fe4c82e9a1 --- /dev/null +++ b/dt-assets/build/components/generated/hi_IN.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hi_IN.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/hr.js b/dt-assets/build/components/generated/hr.js index 97c4fb736c..128501dcf6 100644 --- a/dt-assets/build/components/generated/hr.js +++ b/dt-assets/build/components/generated/hr.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=hr.js.map diff --git a/dt-assets/build/components/generated/hr.js.map b/dt-assets/build/components/generated/hr.js.map new file mode 100644 index 0000000000..52ae5796a8 --- /dev/null +++ b/dt-assets/build/components/generated/hr.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hr.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/hu_HU.js b/dt-assets/build/components/generated/hu_HU.js index 97c4fb736c..6c35d2cc9a 100644 --- a/dt-assets/build/components/generated/hu_HU.js +++ b/dt-assets/build/components/generated/hu_HU.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=hu_HU.js.map diff --git a/dt-assets/build/components/generated/hu_HU.js.map b/dt-assets/build/components/generated/hu_HU.js.map new file mode 100644 index 0000000000..291d2d2cb6 --- /dev/null +++ b/dt-assets/build/components/generated/hu_HU.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hu_HU.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/id_ID.js b/dt-assets/build/components/generated/id_ID.js index 97c4fb736c..31a4fd3d78 100644 --- a/dt-assets/build/components/generated/id_ID.js +++ b/dt-assets/build/components/generated/id_ID.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=id_ID.js.map diff --git a/dt-assets/build/components/generated/id_ID.js.map b/dt-assets/build/components/generated/id_ID.js.map new file mode 100644 index 0000000000..2671ae580d --- /dev/null +++ b/dt-assets/build/components/generated/id_ID.js.map @@ -0,0 +1 @@ +{"version":3,"file":"id_ID.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/it_IT.js b/dt-assets/build/components/generated/it_IT.js index 97c4fb736c..777b693999 100644 --- a/dt-assets/build/components/generated/it_IT.js +++ b/dt-assets/build/components/generated/it_IT.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=it_IT.js.map diff --git a/dt-assets/build/components/generated/it_IT.js.map b/dt-assets/build/components/generated/it_IT.js.map new file mode 100644 index 0000000000..0839cb7509 --- /dev/null +++ b/dt-assets/build/components/generated/it_IT.js.map @@ -0,0 +1 @@ +{"version":3,"file":"it_IT.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/ja.js b/dt-assets/build/components/generated/ja.js index 97c4fb736c..cfa0ee5741 100644 --- a/dt-assets/build/components/generated/ja.js +++ b/dt-assets/build/components/generated/ja.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=ja.js.map diff --git a/dt-assets/build/components/generated/ja.js.map b/dt-assets/build/components/generated/ja.js.map new file mode 100644 index 0000000000..dcb2946ada --- /dev/null +++ b/dt-assets/build/components/generated/ja.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ja.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/ko_KR.js b/dt-assets/build/components/generated/ko_KR.js index 97c4fb736c..fd81a78a86 100644 --- a/dt-assets/build/components/generated/ko_KR.js +++ b/dt-assets/build/components/generated/ko_KR.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=ko_KR.js.map diff --git a/dt-assets/build/components/generated/ko_KR.js.map b/dt-assets/build/components/generated/ko_KR.js.map new file mode 100644 index 0000000000..abbe5da9da --- /dev/null +++ b/dt-assets/build/components/generated/ko_KR.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ko_KR.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/mk_MK.js b/dt-assets/build/components/generated/mk_MK.js index 97c4fb736c..f2bc538f4a 100644 --- a/dt-assets/build/components/generated/mk_MK.js +++ b/dt-assets/build/components/generated/mk_MK.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=mk_MK.js.map diff --git a/dt-assets/build/components/generated/mk_MK.js.map b/dt-assets/build/components/generated/mk_MK.js.map new file mode 100644 index 0000000000..2455f78aa3 --- /dev/null +++ b/dt-assets/build/components/generated/mk_MK.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mk_MK.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/mr.js b/dt-assets/build/components/generated/mr.js index 97c4fb736c..94d8c58125 100644 --- a/dt-assets/build/components/generated/mr.js +++ b/dt-assets/build/components/generated/mr.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=mr.js.map diff --git a/dt-assets/build/components/generated/mr.js.map b/dt-assets/build/components/generated/mr.js.map new file mode 100644 index 0000000000..ad296afe7d --- /dev/null +++ b/dt-assets/build/components/generated/mr.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mr.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/my_MM.js b/dt-assets/build/components/generated/my_MM.js index 97c4fb736c..325ce77ae8 100644 --- a/dt-assets/build/components/generated/my_MM.js +++ b/dt-assets/build/components/generated/my_MM.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=my_MM.js.map diff --git a/dt-assets/build/components/generated/my_MM.js.map b/dt-assets/build/components/generated/my_MM.js.map new file mode 100644 index 0000000000..623f012c2f --- /dev/null +++ b/dt-assets/build/components/generated/my_MM.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my_MM.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/ne_NP.js b/dt-assets/build/components/generated/ne_NP.js index 97c4fb736c..b3c3cf4619 100644 --- a/dt-assets/build/components/generated/ne_NP.js +++ b/dt-assets/build/components/generated/ne_NP.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=ne_NP.js.map diff --git a/dt-assets/build/components/generated/ne_NP.js.map b/dt-assets/build/components/generated/ne_NP.js.map new file mode 100644 index 0000000000..32f82fda43 --- /dev/null +++ b/dt-assets/build/components/generated/ne_NP.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ne_NP.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/nl_NL.js b/dt-assets/build/components/generated/nl_NL.js index 97c4fb736c..e7db83b0de 100644 --- a/dt-assets/build/components/generated/nl_NL.js +++ b/dt-assets/build/components/generated/nl_NL.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=nl_NL.js.map diff --git a/dt-assets/build/components/generated/nl_NL.js.map b/dt-assets/build/components/generated/nl_NL.js.map new file mode 100644 index 0000000000..dd41a5214e --- /dev/null +++ b/dt-assets/build/components/generated/nl_NL.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nl_NL.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/pa_IN.js b/dt-assets/build/components/generated/pa_IN.js index 97c4fb736c..954455840f 100644 --- a/dt-assets/build/components/generated/pa_IN.js +++ b/dt-assets/build/components/generated/pa_IN.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=pa_IN.js.map diff --git a/dt-assets/build/components/generated/pa_IN.js.map b/dt-assets/build/components/generated/pa_IN.js.map new file mode 100644 index 0000000000..32767a8baa --- /dev/null +++ b/dt-assets/build/components/generated/pa_IN.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pa_IN.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/pl.js b/dt-assets/build/components/generated/pl.js index 97c4fb736c..a51754fdd8 100644 --- a/dt-assets/build/components/generated/pl.js +++ b/dt-assets/build/components/generated/pl.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=pl.js.map diff --git a/dt-assets/build/components/generated/pl.js.map b/dt-assets/build/components/generated/pl.js.map new file mode 100644 index 0000000000..5e1276c8c1 --- /dev/null +++ b/dt-assets/build/components/generated/pl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pl.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/pt_BR.js b/dt-assets/build/components/generated/pt_BR.js index 97c4fb736c..299fa8ebd7 100644 --- a/dt-assets/build/components/generated/pt_BR.js +++ b/dt-assets/build/components/generated/pt_BR.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=pt_BR.js.map diff --git a/dt-assets/build/components/generated/pt_BR.js.map b/dt-assets/build/components/generated/pt_BR.js.map new file mode 100644 index 0000000000..ab4e757d12 --- /dev/null +++ b/dt-assets/build/components/generated/pt_BR.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pt_BR.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/ro_RO.js b/dt-assets/build/components/generated/ro_RO.js index 97c4fb736c..653e1f094c 100644 --- a/dt-assets/build/components/generated/ro_RO.js +++ b/dt-assets/build/components/generated/ro_RO.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=ro_RO.js.map diff --git a/dt-assets/build/components/generated/ro_RO.js.map b/dt-assets/build/components/generated/ro_RO.js.map new file mode 100644 index 0000000000..450c38d732 --- /dev/null +++ b/dt-assets/build/components/generated/ro_RO.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ro_RO.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/ru_RU.js b/dt-assets/build/components/generated/ru_RU.js index 97c4fb736c..173e7acbb9 100644 --- a/dt-assets/build/components/generated/ru_RU.js +++ b/dt-assets/build/components/generated/ru_RU.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=ru_RU.js.map diff --git a/dt-assets/build/components/generated/ru_RU.js.map b/dt-assets/build/components/generated/ru_RU.js.map new file mode 100644 index 0000000000..a6197a787d --- /dev/null +++ b/dt-assets/build/components/generated/ru_RU.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ru_RU.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/sl_SI.js b/dt-assets/build/components/generated/sl_SI.js index 97c4fb736c..6b6f15b98d 100644 --- a/dt-assets/build/components/generated/sl_SI.js +++ b/dt-assets/build/components/generated/sl_SI.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=sl_SI.js.map diff --git a/dt-assets/build/components/generated/sl_SI.js.map b/dt-assets/build/components/generated/sl_SI.js.map new file mode 100644 index 0000000000..c3954e5e00 --- /dev/null +++ b/dt-assets/build/components/generated/sl_SI.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sl_SI.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/sr_BA.js b/dt-assets/build/components/generated/sr_BA.js index 97c4fb736c..a4364f7f56 100644 --- a/dt-assets/build/components/generated/sr_BA.js +++ b/dt-assets/build/components/generated/sr_BA.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=sr_BA.js.map diff --git a/dt-assets/build/components/generated/sr_BA.js.map b/dt-assets/build/components/generated/sr_BA.js.map new file mode 100644 index 0000000000..88d8b8ee1f --- /dev/null +++ b/dt-assets/build/components/generated/sr_BA.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sr_BA.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/sw.js b/dt-assets/build/components/generated/sw.js index 97c4fb736c..55dd1982b4 100644 --- a/dt-assets/build/components/generated/sw.js +++ b/dt-assets/build/components/generated/sw.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=sw.js.map diff --git a/dt-assets/build/components/generated/sw.js.map b/dt-assets/build/components/generated/sw.js.map new file mode 100644 index 0000000000..6640bf8e94 --- /dev/null +++ b/dt-assets/build/components/generated/sw.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sw.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/th.js b/dt-assets/build/components/generated/th.js index 97c4fb736c..f178eb5eeb 100644 --- a/dt-assets/build/components/generated/th.js +++ b/dt-assets/build/components/generated/th.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=th.js.map diff --git a/dt-assets/build/components/generated/th.js.map b/dt-assets/build/components/generated/th.js.map new file mode 100644 index 0000000000..3e56e2d376 --- /dev/null +++ b/dt-assets/build/components/generated/th.js.map @@ -0,0 +1 @@ +{"version":3,"file":"th.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/tl.js b/dt-assets/build/components/generated/tl.js index 97c4fb736c..1f352940cf 100644 --- a/dt-assets/build/components/generated/tl.js +++ b/dt-assets/build/components/generated/tl.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=tl.js.map diff --git a/dt-assets/build/components/generated/tl.js.map b/dt-assets/build/components/generated/tl.js.map new file mode 100644 index 0000000000..86e8ce782e --- /dev/null +++ b/dt-assets/build/components/generated/tl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tl.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/tr_TR.js b/dt-assets/build/components/generated/tr_TR.js index 97c4fb736c..6af9f92feb 100644 --- a/dt-assets/build/components/generated/tr_TR.js +++ b/dt-assets/build/components/generated/tr_TR.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=tr_TR.js.map diff --git a/dt-assets/build/components/generated/tr_TR.js.map b/dt-assets/build/components/generated/tr_TR.js.map new file mode 100644 index 0000000000..3cda8b354d --- /dev/null +++ b/dt-assets/build/components/generated/tr_TR.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tr_TR.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/uk.js b/dt-assets/build/components/generated/uk.js index 97c4fb736c..55bc39dc14 100644 --- a/dt-assets/build/components/generated/uk.js +++ b/dt-assets/build/components/generated/uk.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=uk.js.map diff --git a/dt-assets/build/components/generated/uk.js.map b/dt-assets/build/components/generated/uk.js.map new file mode 100644 index 0000000000..434328913d --- /dev/null +++ b/dt-assets/build/components/generated/uk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uk.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/vi.js b/dt-assets/build/components/generated/vi.js index 97c4fb736c..a812fc6584 100644 --- a/dt-assets/build/components/generated/vi.js +++ b/dt-assets/build/components/generated/vi.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=vi.js.map diff --git a/dt-assets/build/components/generated/vi.js.map b/dt-assets/build/components/generated/vi.js.map new file mode 100644 index 0000000000..73164697d4 --- /dev/null +++ b/dt-assets/build/components/generated/vi.js.map @@ -0,0 +1 @@ +{"version":3,"file":"vi.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/zh_CN.js b/dt-assets/build/components/generated/zh_CN.js index 97c4fb736c..ed8813fb40 100644 --- a/dt-assets/build/components/generated/zh_CN.js +++ b/dt-assets/build/components/generated/zh_CN.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=zh_CN.js.map diff --git a/dt-assets/build/components/generated/zh_CN.js.map b/dt-assets/build/components/generated/zh_CN.js.map new file mode 100644 index 0000000000..eef6d8041c --- /dev/null +++ b/dt-assets/build/components/generated/zh_CN.js.map @@ -0,0 +1 @@ +{"version":3,"file":"zh_CN.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/generated/zh_TW.js b/dt-assets/build/components/generated/zh_TW.js index 97c4fb736c..b6a214915b 100644 --- a/dt-assets/build/components/generated/zh_TW.js +++ b/dt-assets/build/components/generated/zh_TW.js @@ -1 +1,2 @@ -import"../lit-localize-763e4978.js"; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=zh_TW.js.map diff --git a/dt-assets/build/components/generated/zh_TW.js.map b/dt-assets/build/components/generated/zh_TW.js.map new file mode 100644 index 0000000000..e8f376cc0a --- /dev/null +++ b/dt-assets/build/components/generated/zh_TW.js.map @@ -0,0 +1 @@ +{"version":3,"file":"zh_TW.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/icons/dt-checkmark.js b/dt-assets/build/components/icons/dt-checkmark.js index 92f7358bad..4a74c48fb8 100644 --- a/dt-assets/build/components/icons/dt-checkmark.js +++ b/dt-assets/build/components/icons/dt-checkmark.js @@ -1 +1,10 @@ -import{s as t,i as e}from"../lit-element-2409d5fe.js";window.customElements.define("dt-checkmark",class extends t{static get styles(){return e`@keyframes fadeOut{0%{opacity:1}75%{opacity:1}100%{opacity:0}}:host{margin-top:-.25rem}:host::before{content:'';transform:rotate(45deg);height:1rem;width:.5rem;opacity:0;color:inherit;border-bottom:var(--dt-checkmark-width) solid currentcolor;border-right:var(--dt-checkmark-width) solid currentcolor;animation:fadeOut 4s}`}}); +import { s as t, i as e } from '../lit-element-2409d5fe.js'; +window.customElements.define( + 'dt-checkmark', + class extends t { + static get styles() { + return e`@keyframes fadeOut{0%{opacity:1}75%{opacity:1}100%{opacity:0}}:host{margin-top:-.25rem}:host::before{content:'';transform:rotate(45deg);height:1rem;width:.5rem;opacity:0;color:inherit;border-bottom:var(--dt-checkmark-width) solid currentcolor;border-right:var(--dt-checkmark-width) solid currentcolor;animation:fadeOut 4s}`; + } + }, +); +//# sourceMappingURL=dt-checkmark.js.map diff --git a/dt-assets/build/components/icons/dt-checkmark.js.map b/dt-assets/build/components/icons/dt-checkmark.js.map new file mode 100644 index 0000000000..703163d245 --- /dev/null +++ b/dt-assets/build/components/icons/dt-checkmark.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-checkmark.js","sources":["../../src/components/icons/dt-checkmark.js"],"sourcesContent":["import { css, LitElement } from 'lit';\n\nexport class DtCheckmark extends LitElement {\n static get styles() {\n return css`\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 75% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n :host {\n margin-top: -0.25rem;\n }\n :host::before {\n content: '';\n transform: rotate(45deg);\n height: 1rem;\n width: 0.5rem;\n opacity: 0;\n color: inherit;\n border-bottom: var(--dt-checkmark-width) solid currentcolor;\n border-right: var(--dt-checkmark-width) solid currentcolor;\n animation: fadeOut 4s;\n }\n `;\n }\n}\n\nwindow.customElements.define('dt-checkmark', DtCheckmark);\n"],"names":["window","customElements","define","LitElement","styles","css"],"mappings":"sDAkCAA,OAAOC,eAAeC,OAAO,eAhCtB,cAA0BC,EACpBC,oBACT,OAAOC,CAAG,oUA2BX"} \ No newline at end of file diff --git a/dt-assets/build/components/icons/dt-exclamation-circle.js b/dt-assets/build/components/icons/dt-exclamation-circle.js index ea7a394d5c..5f103f8080 100644 --- a/dt-assets/build/components/icons/dt-exclamation-circle.js +++ b/dt-assets/build/components/icons/dt-exclamation-circle.js @@ -1 +1,13 @@ -import{s as e,i as t,y as r}from"../lit-element-2409d5fe.js";window.customElements.define("dt-exclamation-circle",class extends e{static get styles(){return t`svg use{fill:currentcolor}`}render(){return r``}}); +import { s as e, i as t, y as r } from '../lit-element-2409d5fe.js'; +window.customElements.define( + 'dt-exclamation-circle', + class extends e { + static get styles() { + return t`svg use{fill:currentcolor}`; + } + render() { + return r``; + } + }, +); +//# sourceMappingURL=dt-exclamation-circle.js.map diff --git a/dt-assets/build/components/icons/dt-exclamation-circle.js.map b/dt-assets/build/components/icons/dt-exclamation-circle.js.map new file mode 100644 index 0000000000..eb5ebe2b03 --- /dev/null +++ b/dt-assets/build/components/icons/dt-exclamation-circle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-exclamation-circle.js","sources":["../../src/components/icons/dt-exclamation-circle.js"],"sourcesContent":["import { css, html, LitElement } from 'lit';\n\nexport class DtExclamationCircle extends LitElement {\n static get styles() {\n return css`\n svg use {\n fill: currentcolor;\n }\n `;\n }\n\n render() {\n return html`\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n `;\n }\n}\n\nwindow.customElements.define('dt-exclamation-circle', DtExclamationCircle);\n"],"names":["window","customElements","define","LitElement","styles","css","render","html"],"mappings":"6DA6CAA,OAAOC,eAAeC,OAAO,wBA3CtB,cAAkCC,EAC5BC,oBACT,OAAOC,CAAG,4BAKX,CAEDC,SACE,OAAOC,CAAI,8oBA8BZ"} \ No newline at end of file diff --git a/dt-assets/build/components/icons/dt-icon.js b/dt-assets/build/components/icons/dt-icon.js index 10e51bc44e..35978f212e 100644 --- a/dt-assets/build/components/icons/dt-icon.js +++ b/dt-assets/build/components/icons/dt-icon.js @@ -1,12 +1,1363 @@ -import{i as t,y as e}from"../lit-element-2409d5fe.js";import{D as n}from"../dt-base.js";import"../lit-localize-763e4978.js"; +import { i as t, y as e } from '../lit-element-2409d5fe.js'; +import { D as n } from '../dt-base.js'; +import '../lit-localize-763e4978.js'; /** -* (c) Iconify -* -* For the full copyright and license information, please view the license.txt -* files at https://github.com/iconify/iconify -* -* Licensed under MIT. -* -* @license MIT -* @version 1.0.2 -*/const o=Object.freeze({left:0,top:0,width:16,height:16}),i=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),r=Object.freeze({...o,...i}),s=Object.freeze({...r,body:"",hidden:!1}),c=Object.freeze({width:null,height:null}),a=Object.freeze({...c,...i});const l=/[\s,]+/;const u={...a,preserveAspectRatio:""};function f(t){const e={...u},n=(e,n)=>t.getAttribute(e)||n;var o;return e.width=n("width",null),e.height=n("height",null),e.rotate=function(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function o(t){for(;t<0;)t+=4;return t%4}if(""===n){const e=parseInt(t);return isNaN(e)?0:o(e)}if(n!==t){let e=0;switch(n){case"%":e=25;break;case"deg":e=90}if(e){let i=parseFloat(t.slice(0,t.length-n.length));return isNaN(i)?0:(i/=e,i%1==0?o(i):0)}}return e}(n("rotate","")),o=e,n("flip","").split(l).forEach((t=>{switch(t.trim()){case"horizontal":o.hFlip=!0;break;case"vertical":o.vFlip=!0}})),e.preserveAspectRatio=n("preserveAspectRatio",n("preserveaspectratio","")),e}const d=/^[a-z0-9]+(-[a-z0-9]+)*$/,p=(t,e,n,o="")=>{const i=t.split(":");if("@"===t.slice(0,1)){if(i.length<2||i.length>3)return null;o=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const t=i.pop(),n=i.pop(),r={provider:i.length>0?i[0]:o,prefix:n,name:t};return e&&!h(r)?null:r}const r=i[0],s=r.split("-");if(s.length>1){const t={provider:o,prefix:s.shift(),name:s.join("-")};return e&&!h(t)?null:t}if(n&&""===o){const t={provider:o,prefix:"",name:r};return e&&!h(t,n)?null:t}return null},h=(t,e)=>!!t&&!(""!==t.provider&&!t.provider.match(d)||!(e&&""===t.prefix||t.prefix.match(d))||!t.name.match(d));function g(t,e){const n=function(t,e){const n={};!t.hFlip!=!e.hFlip&&(n.hFlip=!0),!t.vFlip!=!e.vFlip&&(n.vFlip=!0);const o=((t.rotate||0)+(e.rotate||0))%4;return o&&(n.rotate=o),n}(t,e);for(const o in s)o in i?o in t&&!(o in n)&&(n[o]=i[o]):o in e?n[o]=e[o]:o in t&&(n[o]=t[o]);return n}function m(t,e,n){const o=t.icons,i=t.aliases||Object.create(null);let r={};function s(t){r=g(o[t]||i[t],r)}return s(e),n.forEach(s),g(t,r)}function b(t,e){const n=[];if("object"!=typeof t||"object"!=typeof t.icons)return n;t.not_found instanceof Array&&t.not_found.forEach((t=>{e(t,null),n.push(t)}));const o=function(t,e){const n=t.icons,o=t.aliases||Object.create(null),i=Object.create(null);return(e||Object.keys(n).concat(Object.keys(o))).forEach((function t(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;const n=o[e]&&o[e].parent,r=n&&t(n);r&&(i[e]=[n].concat(r))}return i[e]})),i}(t);for(const i in o){const r=o[i];r&&(e(i,m(t,i,r)),n.push(i))}return n}const y={provider:"",aliases:{},not_found:{},...o};function v(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function x(t){if("object"!=typeof t||null===t)return null;const e=t;if("string"!=typeof e.prefix||!t.icons||"object"!=typeof t.icons)return null;if(!v(t,y))return null;const n=e.icons;for(const t in n){const e=n[t];if(!t.match(d)||"string"!=typeof e.body||!v(e,s))return null}const o=e.aliases||Object.create(null);for(const t in o){const e=o[t],i=e.parent;if(!t.match(d)||"string"!=typeof i||!n[i]&&!o[i]||!v(e,s))return null}return e}const w=Object.create(null);function k(t,e){const n=w[t]||(w[t]=Object.create(null));return n[e]||(n[e]=function(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}(t,e))}function j(t,e){return x(e)?b(e,((e,n)=>{n?t.icons[e]=n:t.missing.add(e)})):[]}function _(t,e){let n=[];return("string"==typeof t?[t]:Object.keys(w)).forEach((t=>{("string"==typeof t&&"string"==typeof e?[e]:Object.keys(w[t]||{})).forEach((e=>{const o=k(t,e);n=n.concat(Object.keys(o.icons).map((n=>(""!==t?"@"+t+":":"")+e+":"+n)))}))})),n}let A=!1;function S(t){return"boolean"==typeof t&&(A=t),A}function O(t){const e="string"==typeof t?p(t,!0,A):t;if(e){const t=k(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function C(t,e){const n=p(t,!0,A);if(!n)return!1;return function(t,e,n){try{if("string"==typeof n.body)return t.icons[e]={...n},!0}catch(t){}return!1}(k(n.provider,n.prefix),n.name,e)}function E(t,e){if("object"!=typeof t)return!1;if("string"!=typeof e&&(e=t.provider||""),A&&!e&&!t.prefix){let e=!1;return x(t)&&(t.prefix="",b(t,((t,n)=>{n&&C(t,n)&&(e=!0)}))),e}const n=t.prefix;if(!h({provider:e,prefix:n,name:"a"}))return!1;return!!j(k(e,n),t)}function I(t){return!!O(t)}function M(t){const e=O(t);return e?{...r,...e}:null}function T(t,e){t.forEach((t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter((t=>t.id!==e)))}))}let F=0;const N=Object.create(null);function P(t,e){N[t]=e}function R(t){return N[t]||N[""]}var z={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function L(t,e,n,o){const i=t.resources.length,r=t.random?Math.floor(Math.random()*i):t.index;let s;if(t.random){let e=t.resources.slice(0);for(s=[];e.length>1;){const t=Math.floor(Math.random()*e.length);s.push(e[t]),e=e.slice(0,t).concat(e.slice(t+1))}s=s.concat(e)}else s=t.resources.slice(r).concat(t.resources.slice(0,r));const c=Date.now();let a,l="pending",u=0,f=null,d=[],p=[];function h(){f&&(clearTimeout(f),f=null)}function g(){"pending"===l&&(l="aborted"),h(),d.forEach((t=>{"pending"===t.status&&(t.status="aborted")})),d=[]}function m(t,e){e&&(p=[]),"function"==typeof t&&p.push(t)}function b(){l="failed",p.forEach((t=>{t(void 0,a)}))}function y(){d.forEach((t=>{"pending"===t.status&&(t.status="aborted")})),d=[]}function v(){if("pending"!==l)return;h();const o=s.shift();if(void 0===o)return d.length?void(f=setTimeout((()=>{h(),"pending"===l&&(y(),b())}),t.timeout)):void b();const i={status:"pending",resource:o,callback:(e,n)=>{!function(e,n,o){const i="success"!==n;switch(d=d.filter((t=>t!==e)),l){case"pending":break;case"failed":if(i||!t.dataAfterTimeout)return;break;default:return}if("abort"===n)return a=o,void b();if(i)return a=o,void(d.length||(s.length?v():b()));if(h(),y(),!t.random){const n=t.resources.indexOf(e.resource);-1!==n&&n!==t.index&&(t.index=n)}l="completed",p.forEach((t=>{t(o)}))}(i,e,n)}};d.push(i),u++,f=setTimeout(v,t.rotate),n(o,e,i.callback)}return"function"==typeof o&&p.push(o),setTimeout(v),function(){return{startTime:c,payload:e,status:l,queriesSent:u,queriesPending:d.length,subscribe:m,abort:g}}}function Q(t){const e={...z,...t};let n=[];function o(){n=n.filter((t=>"pending"===t().status))}return{query:function(t,i,r){const s=L(e,t,i,((t,e)=>{o(),r&&r(t,e)}));return n.push(s),s},find:function(t){return n.find((e=>t(e)))||null},setIndex:t=>{e.index=t},getIndex:()=>e.index,cleanup:o}}function $(t){let e;if("string"==typeof t.resources)e=[t.resources];else if(e=t.resources,!(e instanceof Array&&e.length))return null;return{resources:e,path:t.path||"/",maxURL:t.maxURL||500,rotate:t.rotate||750,timeout:t.timeout||5e3,random:!0===t.random,index:t.index||0,dataAfterTimeout:!1!==t.dataAfterTimeout}}const D=Object.create(null),q=["https://api.simplesvg.com","https://api.unisvg.com"],U=[];for(;q.length>0;)1===q.length||Math.random()>.5?U.push(q.shift()):U.push(q.pop());function J(t,e){const n=$(e);return null!==n&&(D[t]=n,!0)}function B(t){return D[t]}function H(){return Object.keys(D)}function G(){}D[""]=$({resources:["https://api.iconify.design"].concat(U)});const V=Object.create(null);function K(t,e,n){let o,i;if("string"==typeof t){const e=R(t);if(!e)return n(void 0,424),G;i=e.send;const r=function(t){if(!V[t]){const e=B(t);if(!e)return;const n={config:e,redundancy:Q(e)};V[t]=n}return V[t]}(t);r&&(o=r.redundancy)}else{const e=$(t);if(e){o=Q(e);const n=R(t.resources?t.resources[0]:"");n&&(i=n.send)}}return o&&i?o.query(e,i,n)().abort:(n(void 0,424),G)}function W(t,e){try{return t.getItem(e)}catch(t){}}function X(t,e,n){try{return t.setItem(e,n),!0}catch(t){}}function Y(t,e){try{t.removeItem(e)}catch(t){}}function Z(t,e){return X(t,"iconify-count",e.toString())}function tt(t){return parseInt(W(t,"iconify-count"))||0}const et={local:!0,session:!0},nt={local:new Set,session:new Set};let ot=!1;let it="undefined"==typeof window?{}:window;function rt(t){const e=t+"Storage";try{if(it&&it[e]&&"number"==typeof it[e].length)return it[e]}catch(t){}et[t]=!1}function st(t,e){const n=rt(t);if(!n)return;const o=W(n,"iconify-version");if("iconify2"!==o){if(o){const t=tt(n);for(let e=0;e{const o="iconify"+t.toString(),r=W(n,o);if("string"==typeof r){try{const n=JSON.parse(r);if("object"==typeof n&&"number"==typeof n.cached&&n.cached>i&&"string"==typeof n.provider&&"object"==typeof n.data&&"string"==typeof n.data.prefix&&e(n,t))return!0}catch(t){}Y(n,o)}};let s=tt(n);for(let e=s-1;e>=0;e--)r(e)||(e===s-1?(s--,Z(n,s)):nt[t].add(e))}function ct(){if(!ot){ot=!0;for(const t in et)st(t,(t=>{const e=t.data,n=k(t.provider,e.prefix);if(!j(n,e).length)return!1;const o=e.lastModified||-1;return n.lastModifiedCached=n.lastModifiedCached?Math.min(n.lastModifiedCached,o):o,!0}))}}function at(t,e){function n(n){let o;if(!et[n]||!(o=rt(n)))return;const i=nt[n];let r;if(i.size)i.delete(r=Array.from(i).shift());else if(r=tt(o),!Z(o,r+1))return;const s={cached:Math.floor(Date.now()/36e5),provider:t.provider,data:e};return X(o,"iconify"+r.toString(),JSON.stringify(s))}ot||ct(),e.lastModified&&!function(t,e){const n=t.lastModifiedCached;if(n&&n>=e)return n===e;if(t.lastModifiedCached=e,n)for(const n in et)st(n,(n=>{const o=n.data;return n.provider!==t.provider||o.prefix!==t.prefix||o.lastModified===e}));return!0}(t,e.lastModified)||Object.keys(e.icons).length&&(e.not_found&&delete(e=Object.assign({},e)).not_found,n("local")||n("session"))}function lt(){}function ut(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout((()=>{t.iconsLoaderFlag=!1,function(t){t.pendingCallbacksFlag||(t.pendingCallbacksFlag=!0,setTimeout((()=>{t.pendingCallbacksFlag=!1;const e=t.loaderCallbacks?t.loaderCallbacks.slice(0):[];if(!e.length)return;let n=!1;const o=t.provider,i=t.prefix;e.forEach((e=>{const r=e.icons,s=r.pending.length;r.pending=r.pending.filter((e=>{if(e.prefix!==i)return!0;const s=e.name;if(t.icons[s])r.loaded.push({provider:o,prefix:i,name:s});else{if(!t.missing.has(s))return n=!0,!0;r.missing.push({provider:o,prefix:i,name:s})}return!1})),r.pending.length!==s&&(n||T([t],e.id),e.callback(r.loaded.slice(0),r.missing.slice(0),r.pending.slice(0),e.abort))}))})))}(t)})))}const ft=(t,e)=>{const n=function(t,e=!0,n=!1){const o=[];return t.forEach((t=>{const i="string"==typeof t?p(t,e,n):t;i&&o.push(i)})),o}(t,!0,S()),o=function(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort(((t,e)=>t.provider!==e.provider?t.provider.localeCompare(e.provider):t.prefix!==e.prefix?t.prefix.localeCompare(e.prefix):t.name.localeCompare(e.name)));let o={provider:"",prefix:"",name:""};return t.forEach((t=>{if(o.name===t.name&&o.prefix===t.prefix&&o.provider===t.provider)return;o=t;const i=t.provider,r=t.prefix,s=t.name,c=n[i]||(n[i]=Object.create(null)),a=c[r]||(c[r]=k(i,r));let l;l=s in a.icons?e.loaded:""===r||a.missing.has(s)?e.missing:e.pending;const u={provider:i,prefix:r,name:s};l.push(u)})),e}(n);if(!o.pending.length){let t=!0;return e&&setTimeout((()=>{t&&e(o.loaded,o.missing,o.pending,lt)})),()=>{t=!1}}const i=Object.create(null),r=[];let s,c;return o.pending.forEach((t=>{const{provider:e,prefix:n}=t;if(n===c&&e===s)return;s=e,c=n,r.push(k(e,n));const o=i[e]||(i[e]=Object.create(null));o[n]||(o[n]=[])})),o.pending.forEach((t=>{const{provider:e,prefix:n,name:o}=t,r=k(e,n),s=r.pendingIcons||(r.pendingIcons=new Set);s.has(o)||(s.add(o),i[e][n].push(o))})),r.forEach((t=>{const{provider:e,prefix:n}=t;i[e][n].length&&function(t,e){t.iconsToLoad?t.iconsToLoad=t.iconsToLoad.concat(e).sort():t.iconsToLoad=e,t.iconsQueueFlag||(t.iconsQueueFlag=!0,setTimeout((()=>{t.iconsQueueFlag=!1;const{provider:e,prefix:n}=t,o=t.iconsToLoad;let i;delete t.iconsToLoad,o&&(i=R(e))&&i.prepare(e,n,o).forEach((n=>{K(e,n,(e=>{if("object"!=typeof e)n.icons.forEach((e=>{t.missing.add(e)}));else try{const n=j(t,e);if(!n.length)return;const o=t.pendingIcons;o&&n.forEach((t=>{o.delete(t)})),at(t,e)}catch(t){console.error(t)}ut(t)}))}))})))}(t,i[e][n])})),e?function(t,e,n){const o=F++,i=T.bind(null,n,o);if(!e.pending.length)return i;const r={id:o,icons:e,callback:t,abort:i};return n.forEach((t=>{(t.loaderCallbacks||(t.loaderCallbacks=[])).push(r)})),i}(e,o,r):lt},dt=t=>new Promise(((e,n)=>{const o="string"==typeof t?p(t,!0):t;o?ft([o||t],(i=>{if(i.length&&o){const t=O(o);if(t)return void e({...r,...t})}n(t)})):n(t)}));function pt(t,e){const n="string"==typeof t?p(t,!0,!0):null;if(!n){const e=function(t){try{const e="string"==typeof t?JSON.parse(t):t;if("string"==typeof e.body)return{...e}}catch(t){}}(t);return{value:t,data:e}}const o=O(n);if(void 0!==o||!n.prefix)return{value:t,name:n,data:o};const i=ft([n],(()=>e(t,n,O(n))));return{value:t,name:n,loading:i}}function ht(t){return t.hasAttribute("inline")}let gt=!1;try{gt=0===navigator.vendor.indexOf("Apple")}catch(t){}const mt=/(-?[0-9.]*[0-9]+[0-9.]*)/g,bt=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function yt(t,e,n){if(1===e)return t;if(n=n||100,"number"==typeof t)return Math.ceil(t*e*n)/n;if("string"!=typeof t)return t;const o=t.split(mt);if(null===o||!o.length)return t;const i=[];let r=o.shift(),s=bt.test(r);for(;;){if(s){const t=parseFloat(r);isNaN(t)?i.push(r):i.push(Math.ceil(t*e*n)/n)}else i.push(r);if(r=o.shift(),void 0===r)return i.join("");s=!s}}function vt(t,e){const n={...r,...t},o={...a,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let s=n.body;[n,o].forEach((t=>{const e=[],n=t.hFlip,o=t.vFlip;let r,c=t.rotate;switch(n?o?c+=2:(e.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),e.push("scale(-1 1)"),i.top=i.left=0):o&&(e.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),e.push("scale(1 -1)"),i.top=i.left=0),c<0&&(c-=4*Math.floor(c/4)),c%=4,c){case 1:r=i.height/2+i.top,e.unshift("rotate(90 "+r.toString()+" "+r.toString()+")");break;case 2:e.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:r=i.width/2+i.left,e.unshift("rotate(-90 "+r.toString()+" "+r.toString()+")")}c%2==1&&(i.left!==i.top&&(r=i.left,i.left=i.top,i.top=r),i.width!==i.height&&(r=i.width,i.width=i.height,i.height=r)),e.length&&(s=''+s+"")}));const c=o.width,l=o.height,u=i.width,f=i.height;let d,p;null===c?(p=null===l?"1em":"auto"===l?f:l,d=yt(p,u/f)):(d="auto"===c?u:c,p=null===l?yt(d,f/u):"auto"===l?f:l);return{attributes:{width:d.toString(),height:p.toString(),viewBox:i.left.toString()+" "+i.top.toString()+" "+u.toString()+" "+f.toString()},body:s}}let xt=(()=>{let t;try{if(t=fetch,"function"==typeof t)return t}catch(t){}})();function wt(t){xt=t}function kt(){return xt}const jt={prepare:(t,e,n)=>{const o=[],i=function(t,e){const n=B(t);if(!n)return 0;let o;if(n.maxURL){let t=0;n.resources.forEach((e=>{const n=e;t=Math.max(t,n.length)}));const i=e+".json?icons=";o=n.maxURL-t-n.path.length-i.length}else o=0;return o}(t,e),r="icons";let s={type:r,provider:t,prefix:e,icons:[]},c=0;return n.forEach(((n,a)=>{c+=n.length+1,c>=i&&a>0&&(o.push(s),s={type:r,provider:t,prefix:e,icons:[]},c=n.length),s.icons.push(n)})),o.push(s),o},send:(t,e,n)=>{if(!xt)return void n("abort",424);let o=function(t){if("string"==typeof t){const e=B(t);if(e)return e.path}return"/"}(e.provider);switch(e.type){case"icons":{const t=e.prefix,n=e.icons.join(",");o+=t+".json?"+new URLSearchParams({icons:n}).toString();break}case"custom":{const t=e.uri;o+="/"===t.slice(0,1)?t.slice(1):t;break}default:return void n("abort",400)}let i=503;xt(t+o).then((t=>{const e=t.status;if(200===e)return i=501,t.json();setTimeout((()=>{n(function(t){return 404===t}(e)?"abort":"next",e)}))})).then((t=>{"object"==typeof t&&null!==t?setTimeout((()=>{n("success",t)})):setTimeout((()=>{404===t?n("abort",t):n("next",i)}))})).catch((()=>{n("next",i)}))}};function _t(t,e){switch(t){case"local":case"session":et[t]=e;break;case"all":for(const t in et)et[t]=e}}function At(){let t;P("",jt),S(!0);try{t=window}catch(t){}if(t){if(ct(),void 0!==t.IconifyPreload){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";"object"==typeof e&&null!==e&&(e instanceof Array?e:[e]).forEach((t=>{try{("object"!=typeof t||null===t||t instanceof Array||"object"!=typeof t.icons||"string"!=typeof t.prefix||!E(t))&&console.error(n)}catch(t){console.error(n)}}))}if(void 0!==t.IconifyProviders){const e=t.IconifyProviders;if("object"==typeof e&&null!==e)for(const t in e){const n="IconifyProviders["+t+"] is invalid.";try{const o=e[t];if("object"!=typeof o||!o||void 0===o.resources)continue;J(t,o)||console.error(n)}catch(t){console.error(n)}}}}return{enableCache:t=>_t(t,!0),disableCache:t=>_t(t,!1),iconExists:I,getIcon:M,listIcons:_,addIcon:C,addCollection:E,calculateSize:yt,buildIcon:vt,loadIcons:ft,loadIcon:dt,addAPIProvider:J,_api:{getAPIConfig:B,setAPIModule:P,sendAPIQuery:K,setFetch:wt,getFetch:kt,listAPIProviders:H}}}function St(t,e){let n=-1===t.indexOf("xlink:")?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const t in e)n+=" "+t+'="'+e[t]+'"';return'"+t+""}const Ot={"background-color":"currentColor"},Ct={"background-color":"transparent"},Et={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},It={"-webkit-mask":Ot,mask:Ot,background:Ct};for(const t in It){const e=It[t];for(const n in Et)e[t+"-"+n]=Et[n]}function Mt(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}function Tt(t,e){const n=e.icon.data,o=e.customisations,i=vt(n,o);o.preserveAspectRatio&&(i.attributes.preserveAspectRatio=o.preserveAspectRatio);const s=e.renderedMode;let c;if("svg"===s)c=function(t){const e=document.createElement("span");return e.innerHTML=St(t.body,t.attributes),e.firstChild}(i);else c=function(t,e,n){const o=document.createElement("span");let i=t.body;-1!==i.indexOf("/g,"%3E").replace(/\s+/g," ")+'")'),c=o.style,a={"--svg":s,width:Mt(r.width),height:Mt(r.height),...n?Ot:Ct};var l;for(const t in a)c.setProperty(t,a[t]);return o}(i,{...r,...n},"mask"===s);const a=Array.from(t.childNodes).find((t=>{const e=t.tagName&&t.tagName.toUpperCase();return"SPAN"===e||"SVG"===e}));a?"SPAN"===c.tagName&&a.tagName===c.tagName?a.setAttribute("style",c.getAttribute("style")):t.replaceChild(c,a):t.appendChild(c)}function Ft(t,e){let n=Array.from(t.childNodes).find((t=>t.hasAttribute&&t.hasAttribute("data-style")));n||(n=document.createElement("style"),n.setAttribute("data-style","data-style"),t.appendChild(n)),n.textContent=":host{display:inline-block;vertical-align:"+(e?"-0.125em":"0")+"}span,svg{display:block}"}function Nt(t,e,n){return{rendered:!1,inline:e,icon:t,lastRender:n&&(n.rendered?n:n.lastRender)}}(function(t="iconify-icon"){let e,n;try{e=window.customElements,n=window.HTMLElement}catch(t){return}if(!e||!n)return;const o=e.get(t);if(o)return o;const i=["icon","mode","inline","width","height","rotate","flip"],r=class extends n{_shadowRoot;_state;_checkQueued=!1;constructor(){super();const t=this._shadowRoot=this.attachShadow({mode:"open"}),e=ht(this);Ft(t,e),this._state=Nt({value:""},e),this._queueCheck()}static get observedAttributes(){return i.slice(0)}attributeChangedCallback(t){if("inline"===t){const t=ht(this),e=this._state;t!==e.inline&&(e.inline=t,Ft(this._shadowRoot,t))}else this._queueCheck()}get icon(){const t=this.getAttribute("icon");if(t&&"{"===t.slice(0,1))try{return JSON.parse(t)}catch(t){}return t}set icon(t){"object"==typeof t&&(t=JSON.stringify(t)),this.setAttribute("icon",t)}get inline(){return ht(this)}set inline(t){this.setAttribute("inline",t?"true":null)}restartAnimation(){const t=this._state;if(t.rendered){const e=this._shadowRoot;if("svg"===t.renderedMode)try{return void e.lastChild.setCurrentTime(0)}catch(t){}Tt(e,t)}}get status(){const t=this._state;return t.rendered?"rendered":null===t.icon.data?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout((()=>{this._check()})))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const t=this._state,e=this.getAttribute("icon");if(e!==t.icon.value)return void this._iconChanged(e);if(!t.rendered)return;const n=this.getAttribute("mode"),o=f(this);(t.attrMode!==n||function(t,e){for(const n in u)if(t[n]!==e[n])return!0;return!1}(t.customisations,o))&&this._renderIcon(t.icon,o,n)}_iconChanged(t){const e=pt(t,((t,e,n)=>{const o=this._state;if(o.rendered||this.getAttribute("icon")!==t)return;const i={value:t,name:e,data:n};i.data?this._gotIconData(i):o.icon=i}));e.data?this._gotIconData(e):this._state=Nt(e,this._state.inline,this._state)}_gotIconData(t){this._checkQueued=!1,this._renderIcon(t,f(this),this.getAttribute("mode"))}_renderIcon(t,e,n){const o=function(t,e){switch(e){case"svg":case"bg":case"mask":return e}return"style"===e||!gt&&-1!==t.indexOf("{t in r.prototype||Object.defineProperty(r.prototype,t,{get:function(){return this.getAttribute(t)},set:function(e){this.setAttribute(t,e)}})}));const s=At();for(const t in s)r[t]=r.prototype[t]=s[t];return e.define(t,r),r})()||At();window.customElements.define("dt-icon",class extends n{static get styles(){return t`:root{font-size:inherit;color:inherit;display:inline-flex;width:fit-content;height:fit-content;position:relative}.tooltip{position:absolute;right:0;top:100%;min-width:9rem;border:solid 1px currentcolor;background-color:var(--dt-form-background-color,var(--surface-1));padding:.25rem;border-radius:.25rem;text-align:end;z-index:1;display:block}.tooltip:before{position:absolute;right:.7rem;top:-.55rem;content:" ";border-width:.25rem;border-style:solid;border-color:transparent transparent currentcolor transparent}.tooltip[hidden]{display:none}`}static get properties(){return{...super.properties,icon:{type:String},tooltip:{type:String},tooltip_open:{type:Boolean},size:{type:String}}}_showTooltip(){this.tooltip_open?this.tooltip_open=!1:this.tooltip_open=!0}render(){const t=this.tooltip?e`
    ${this.tooltip}
    `:null;return e`${t}`}}); + * (c) Iconify + * + * For the full copyright and license information, please view the license.txt + * files at https://github.com/iconify/iconify + * + * Licensed under MIT. + * + * @license MIT + * @version 1.0.2 + */ const o = Object.freeze({ left: 0, top: 0, width: 16, height: 16 }), + i = Object.freeze({ rotate: 0, vFlip: !1, hFlip: !1 }), + r = Object.freeze({ ...o, ...i }), + s = Object.freeze({ ...r, body: '', hidden: !1 }), + c = Object.freeze({ width: null, height: null }), + a = Object.freeze({ ...c, ...i }); +const l = /[\s,]+/; +const u = { ...a, preserveAspectRatio: '' }; +function f(t) { + const e = { ...u }, + n = (e, n) => t.getAttribute(e) || n; + var o; + return ( + (e.width = n('width', null)), + (e.height = n('height', null)), + (e.rotate = (function (t, e = 0) { + const n = t.replace(/^-?[0-9.]*/, ''); + function o(t) { + for (; t < 0; ) t += 4; + return t % 4; + } + if ('' === n) { + const e = parseInt(t); + return isNaN(e) ? 0 : o(e); + } + if (n !== t) { + let e = 0; + switch (n) { + case '%': + e = 25; + break; + case 'deg': + e = 90; + } + if (e) { + let i = parseFloat(t.slice(0, t.length - n.length)); + return isNaN(i) ? 0 : ((i /= e), i % 1 == 0 ? o(i) : 0); + } + } + return e; + })(n('rotate', ''))), + (o = e), + n('flip', '') + .split(l) + .forEach((t) => { + switch (t.trim()) { + case 'horizontal': + o.hFlip = !0; + break; + case 'vertical': + o.vFlip = !0; + } + }), + (e.preserveAspectRatio = n( + 'preserveAspectRatio', + n('preserveaspectratio', ''), + )), + e + ); +} +const d = /^[a-z0-9]+(-[a-z0-9]+)*$/, + p = (t, e, n, o = '') => { + const i = t.split(':'); + if ('@' === t.slice(0, 1)) { + if (i.length < 2 || i.length > 3) return null; + o = i.shift().slice(1); + } + if (i.length > 3 || !i.length) return null; + if (i.length > 1) { + const t = i.pop(), + n = i.pop(), + r = { provider: i.length > 0 ? i[0] : o, prefix: n, name: t }; + return e && !h(r) ? null : r; + } + const r = i[0], + s = r.split('-'); + if (s.length > 1) { + const t = { provider: o, prefix: s.shift(), name: s.join('-') }; + return e && !h(t) ? null : t; + } + if (n && '' === o) { + const t = { provider: o, prefix: '', name: r }; + return e && !h(t, n) ? null : t; + } + return null; + }, + h = (t, e) => + !!t && + !( + ('' !== t.provider && !t.provider.match(d)) || + !((e && '' === t.prefix) || t.prefix.match(d)) || + !t.name.match(d) + ); +function g(t, e) { + const n = (function (t, e) { + const n = {}; + !t.hFlip != !e.hFlip && (n.hFlip = !0), + !t.vFlip != !e.vFlip && (n.vFlip = !0); + const o = ((t.rotate || 0) + (e.rotate || 0)) % 4; + return o && (n.rotate = o), n; + })(t, e); + for (const o in s) + o in i + ? o in t && !(o in n) && (n[o] = i[o]) + : o in e + ? (n[o] = e[o]) + : o in t && (n[o] = t[o]); + return n; +} +function m(t, e, n) { + const o = t.icons, + i = t.aliases || Object.create(null); + let r = {}; + function s(t) { + r = g(o[t] || i[t], r); + } + return s(e), n.forEach(s), g(t, r); +} +function b(t, e) { + const n = []; + if ('object' != typeof t || 'object' != typeof t.icons) return n; + t.not_found instanceof Array && + t.not_found.forEach((t) => { + e(t, null), n.push(t); + }); + const o = (function (t, e) { + const n = t.icons, + o = t.aliases || Object.create(null), + i = Object.create(null); + return ( + (e || Object.keys(n).concat(Object.keys(o))).forEach(function t(e) { + if (n[e]) return (i[e] = []); + if (!(e in i)) { + i[e] = null; + const n = o[e] && o[e].parent, + r = n && t(n); + r && (i[e] = [n].concat(r)); + } + return i[e]; + }), + i + ); + })(t); + for (const i in o) { + const r = o[i]; + r && (e(i, m(t, i, r)), n.push(i)); + } + return n; +} +const y = { provider: '', aliases: {}, not_found: {}, ...o }; +function v(t, e) { + for (const n in e) if (n in t && typeof t[n] != typeof e[n]) return !1; + return !0; +} +function x(t) { + if ('object' != typeof t || null === t) return null; + const e = t; + if ('string' != typeof e.prefix || !t.icons || 'object' != typeof t.icons) + return null; + if (!v(t, y)) return null; + const n = e.icons; + for (const t in n) { + const e = n[t]; + if (!t.match(d) || 'string' != typeof e.body || !v(e, s)) return null; + } + const o = e.aliases || Object.create(null); + for (const t in o) { + const e = o[t], + i = e.parent; + if (!t.match(d) || 'string' != typeof i || (!n[i] && !o[i]) || !v(e, s)) + return null; + } + return e; +} +const w = Object.create(null); +function k(t, e) { + const n = w[t] || (w[t] = Object.create(null)); + return ( + n[e] || + (n[e] = (function (t, e) { + return { + provider: t, + prefix: e, + icons: Object.create(null), + missing: new Set(), + }; + })(t, e)) + ); +} +function j(t, e) { + return x(e) + ? b(e, (e, n) => { + n ? (t.icons[e] = n) : t.missing.add(e); + }) + : []; +} +function _(t, e) { + let n = []; + return ( + ('string' == typeof t ? [t] : Object.keys(w)).forEach((t) => { + ('string' == typeof t && 'string' == typeof e + ? [e] + : Object.keys(w[t] || {}) + ).forEach((e) => { + const o = k(t, e); + n = n.concat( + Object.keys(o.icons).map( + (n) => ('' !== t ? '@' + t + ':' : '') + e + ':' + n, + ), + ); + }); + }), + n + ); +} +let A = !1; +function S(t) { + return 'boolean' == typeof t && (A = t), A; +} +function O(t) { + const e = 'string' == typeof t ? p(t, !0, A) : t; + if (e) { + const t = k(e.provider, e.prefix), + n = e.name; + return t.icons[n] || (t.missing.has(n) ? null : void 0); + } +} +function C(t, e) { + const n = p(t, !0, A); + if (!n) return !1; + return (function (t, e, n) { + try { + if ('string' == typeof n.body) return (t.icons[e] = { ...n }), !0; + } catch (t) {} + return !1; + })(k(n.provider, n.prefix), n.name, e); +} +function E(t, e) { + if ('object' != typeof t) return !1; + if (('string' != typeof e && (e = t.provider || ''), A && !e && !t.prefix)) { + let e = !1; + return ( + x(t) && + ((t.prefix = ''), + b(t, (t, n) => { + n && C(t, n) && (e = !0); + })), + e + ); + } + const n = t.prefix; + if (!h({ provider: e, prefix: n, name: 'a' })) return !1; + return !!j(k(e, n), t); +} +function I(t) { + return !!O(t); +} +function M(t) { + const e = O(t); + return e ? { ...r, ...e } : null; +} +function T(t, e) { + t.forEach((t) => { + const n = t.loaderCallbacks; + n && (t.loaderCallbacks = n.filter((t) => t.id !== e)); + }); +} +let F = 0; +const N = Object.create(null); +function P(t, e) { + N[t] = e; +} +function R(t) { + return N[t] || N['']; +} +var z = { + resources: [], + index: 0, + timeout: 2e3, + rotate: 750, + random: !1, + dataAfterTimeout: !1, +}; +function L(t, e, n, o) { + const i = t.resources.length, + r = t.random ? Math.floor(Math.random() * i) : t.index; + let s; + if (t.random) { + let e = t.resources.slice(0); + for (s = []; e.length > 1; ) { + const t = Math.floor(Math.random() * e.length); + s.push(e[t]), (e = e.slice(0, t).concat(e.slice(t + 1))); + } + s = s.concat(e); + } else s = t.resources.slice(r).concat(t.resources.slice(0, r)); + const c = Date.now(); + let a, + l = 'pending', + u = 0, + f = null, + d = [], + p = []; + function h() { + f && (clearTimeout(f), (f = null)); + } + function g() { + 'pending' === l && (l = 'aborted'), + h(), + d.forEach((t) => { + 'pending' === t.status && (t.status = 'aborted'); + }), + (d = []); + } + function m(t, e) { + e && (p = []), 'function' == typeof t && p.push(t); + } + function b() { + (l = 'failed'), + p.forEach((t) => { + t(void 0, a); + }); + } + function y() { + d.forEach((t) => { + 'pending' === t.status && (t.status = 'aborted'); + }), + (d = []); + } + function v() { + if ('pending' !== l) return; + h(); + const o = s.shift(); + if (void 0 === o) + return d.length + ? void (f = setTimeout(() => { + h(), 'pending' === l && (y(), b()); + }, t.timeout)) + : void b(); + const i = { + status: 'pending', + resource: o, + callback: (e, n) => { + !(function (e, n, o) { + const i = 'success' !== n; + switch (((d = d.filter((t) => t !== e)), l)) { + case 'pending': + break; + case 'failed': + if (i || !t.dataAfterTimeout) return; + break; + default: + return; + } + if ('abort' === n) return (a = o), void b(); + if (i) return (a = o), void (d.length || (s.length ? v() : b())); + if ((h(), y(), !t.random)) { + const n = t.resources.indexOf(e.resource); + -1 !== n && n !== t.index && (t.index = n); + } + (l = 'completed'), + p.forEach((t) => { + t(o); + }); + })(i, e, n); + }, + }; + d.push(i), u++, (f = setTimeout(v, t.rotate)), n(o, e, i.callback); + } + return ( + 'function' == typeof o && p.push(o), + setTimeout(v), + function () { + return { + startTime: c, + payload: e, + status: l, + queriesSent: u, + queriesPending: d.length, + subscribe: m, + abort: g, + }; + } + ); +} +function Q(t) { + const e = { ...z, ...t }; + let n = []; + function o() { + n = n.filter((t) => 'pending' === t().status); + } + return { + query: function (t, i, r) { + const s = L(e, t, i, (t, e) => { + o(), r && r(t, e); + }); + return n.push(s), s; + }, + find: function (t) { + return n.find((e) => t(e)) || null; + }, + setIndex: (t) => { + e.index = t; + }, + getIndex: () => e.index, + cleanup: o, + }; +} +function $(t) { + let e; + if ('string' == typeof t.resources) e = [t.resources]; + else if (((e = t.resources), !(e instanceof Array && e.length))) return null; + return { + resources: e, + path: t.path || '/', + maxURL: t.maxURL || 500, + rotate: t.rotate || 750, + timeout: t.timeout || 5e3, + random: !0 === t.random, + index: t.index || 0, + dataAfterTimeout: !1 !== t.dataAfterTimeout, + }; +} +const D = Object.create(null), + q = ['https://api.simplesvg.com', 'https://api.unisvg.com'], + U = []; +for (; q.length > 0; ) + 1 === q.length || Math.random() > 0.5 ? U.push(q.shift()) : U.push(q.pop()); +function J(t, e) { + const n = $(e); + return null !== n && ((D[t] = n), !0); +} +function B(t) { + return D[t]; +} +function H() { + return Object.keys(D); +} +function G() {} +D[''] = $({ resources: ['https://api.iconify.design'].concat(U) }); +const V = Object.create(null); +function K(t, e, n) { + let o, i; + if ('string' == typeof t) { + const e = R(t); + if (!e) return n(void 0, 424), G; + i = e.send; + const r = (function (t) { + if (!V[t]) { + const e = B(t); + if (!e) return; + const n = { config: e, redundancy: Q(e) }; + V[t] = n; + } + return V[t]; + })(t); + r && (o = r.redundancy); + } else { + const e = $(t); + if (e) { + o = Q(e); + const n = R(t.resources ? t.resources[0] : ''); + n && (i = n.send); + } + } + return o && i ? o.query(e, i, n)().abort : (n(void 0, 424), G); +} +function W(t, e) { + try { + return t.getItem(e); + } catch (t) {} +} +function X(t, e, n) { + try { + return t.setItem(e, n), !0; + } catch (t) {} +} +function Y(t, e) { + try { + t.removeItem(e); + } catch (t) {} +} +function Z(t, e) { + return X(t, 'iconify-count', e.toString()); +} +function tt(t) { + return parseInt(W(t, 'iconify-count')) || 0; +} +const et = { local: !0, session: !0 }, + nt = { local: new Set(), session: new Set() }; +let ot = !1; +let it = 'undefined' == typeof window ? {} : window; +function rt(t) { + const e = t + 'Storage'; + try { + if (it && it[e] && 'number' == typeof it[e].length) return it[e]; + } catch (t) {} + et[t] = !1; +} +function st(t, e) { + const n = rt(t); + if (!n) return; + const o = W(n, 'iconify-version'); + if ('iconify2' !== o) { + if (o) { + const t = tt(n); + for (let e = 0; e < t; e++) Y(n, 'iconify' + e.toString()); + } + return X(n, 'iconify-version', 'iconify2'), void Z(n, 0); + } + const i = Math.floor(Date.now() / 36e5) - 168, + r = (t) => { + const o = 'iconify' + t.toString(), + r = W(n, o); + if ('string' == typeof r) { + try { + const n = JSON.parse(r); + if ( + 'object' == typeof n && + 'number' == typeof n.cached && + n.cached > i && + 'string' == typeof n.provider && + 'object' == typeof n.data && + 'string' == typeof n.data.prefix && + e(n, t) + ) + return !0; + } catch (t) {} + Y(n, o); + } + }; + let s = tt(n); + for (let e = s - 1; e >= 0; e--) + r(e) || (e === s - 1 ? (s--, Z(n, s)) : nt[t].add(e)); +} +function ct() { + if (!ot) { + ot = !0; + for (const t in et) + st(t, (t) => { + const e = t.data, + n = k(t.provider, e.prefix); + if (!j(n, e).length) return !1; + const o = e.lastModified || -1; + return ( + (n.lastModifiedCached = n.lastModifiedCached + ? Math.min(n.lastModifiedCached, o) + : o), + !0 + ); + }); + } +} +function at(t, e) { + function n(n) { + let o; + if (!et[n] || !(o = rt(n))) return; + const i = nt[n]; + let r; + if (i.size) i.delete((r = Array.from(i).shift())); + else if (((r = tt(o)), !Z(o, r + 1))) return; + const s = { + cached: Math.floor(Date.now() / 36e5), + provider: t.provider, + data: e, + }; + return X(o, 'iconify' + r.toString(), JSON.stringify(s)); + } + ot || ct(), + (e.lastModified && + !(function (t, e) { + const n = t.lastModifiedCached; + if (n && n >= e) return n === e; + if (((t.lastModifiedCached = e), n)) + for (const n in et) + st(n, (n) => { + const o = n.data; + return ( + n.provider !== t.provider || + o.prefix !== t.prefix || + o.lastModified === e + ); + }); + return !0; + })(t, e.lastModified)) || + (Object.keys(e.icons).length && + (e.not_found && delete (e = Object.assign({}, e)).not_found, + n('local') || n('session'))); +} +function lt() {} +function ut(t) { + t.iconsLoaderFlag || + ((t.iconsLoaderFlag = !0), + setTimeout(() => { + (t.iconsLoaderFlag = !1), + (function (t) { + t.pendingCallbacksFlag || + ((t.pendingCallbacksFlag = !0), + setTimeout(() => { + t.pendingCallbacksFlag = !1; + const e = t.loaderCallbacks ? t.loaderCallbacks.slice(0) : []; + if (!e.length) return; + let n = !1; + const o = t.provider, + i = t.prefix; + e.forEach((e) => { + const r = e.icons, + s = r.pending.length; + (r.pending = r.pending.filter((e) => { + if (e.prefix !== i) return !0; + const s = e.name; + if (t.icons[s]) + r.loaded.push({ provider: o, prefix: i, name: s }); + else { + if (!t.missing.has(s)) return (n = !0), !0; + r.missing.push({ provider: o, prefix: i, name: s }); + } + return !1; + })), + r.pending.length !== s && + (n || T([t], e.id), + e.callback( + r.loaded.slice(0), + r.missing.slice(0), + r.pending.slice(0), + e.abort, + )); + }); + })); + })(t); + })); +} +const ft = (t, e) => { + const n = (function (t, e = !0, n = !1) { + const o = []; + return ( + t.forEach((t) => { + const i = 'string' == typeof t ? p(t, e, n) : t; + i && o.push(i); + }), + o + ); + })(t, !0, S()), + o = (function (t) { + const e = { loaded: [], missing: [], pending: [] }, + n = Object.create(null); + t.sort((t, e) => + t.provider !== e.provider + ? t.provider.localeCompare(e.provider) + : t.prefix !== e.prefix + ? t.prefix.localeCompare(e.prefix) + : t.name.localeCompare(e.name), + ); + let o = { provider: '', prefix: '', name: '' }; + return ( + t.forEach((t) => { + if ( + o.name === t.name && + o.prefix === t.prefix && + o.provider === t.provider + ) + return; + o = t; + const i = t.provider, + r = t.prefix, + s = t.name, + c = n[i] || (n[i] = Object.create(null)), + a = c[r] || (c[r] = k(i, r)); + let l; + l = + s in a.icons + ? e.loaded + : '' === r || a.missing.has(s) + ? e.missing + : e.pending; + const u = { provider: i, prefix: r, name: s }; + l.push(u); + }), + e + ); + })(n); + if (!o.pending.length) { + let t = !0; + return ( + e && + setTimeout(() => { + t && e(o.loaded, o.missing, o.pending, lt); + }), + () => { + t = !1; + } + ); + } + const i = Object.create(null), + r = []; + let s, c; + return ( + o.pending.forEach((t) => { + const { provider: e, prefix: n } = t; + if (n === c && e === s) return; + (s = e), (c = n), r.push(k(e, n)); + const o = i[e] || (i[e] = Object.create(null)); + o[n] || (o[n] = []); + }), + o.pending.forEach((t) => { + const { provider: e, prefix: n, name: o } = t, + r = k(e, n), + s = r.pendingIcons || (r.pendingIcons = new Set()); + s.has(o) || (s.add(o), i[e][n].push(o)); + }), + r.forEach((t) => { + const { provider: e, prefix: n } = t; + i[e][n].length && + (function (t, e) { + t.iconsToLoad + ? (t.iconsToLoad = t.iconsToLoad.concat(e).sort()) + : (t.iconsToLoad = e), + t.iconsQueueFlag || + ((t.iconsQueueFlag = !0), + setTimeout(() => { + t.iconsQueueFlag = !1; + const { provider: e, prefix: n } = t, + o = t.iconsToLoad; + let i; + delete t.iconsToLoad, + o && + (i = R(e)) && + i.prepare(e, n, o).forEach((n) => { + K(e, n, (e) => { + if ('object' != typeof e) + n.icons.forEach((e) => { + t.missing.add(e); + }); + else + try { + const n = j(t, e); + if (!n.length) return; + const o = t.pendingIcons; + o && + n.forEach((t) => { + o.delete(t); + }), + at(t, e); + } catch (t) { + console.error(t); + } + ut(t); + }); + }); + })); + })(t, i[e][n]); + }), + e + ? (function (t, e, n) { + const o = F++, + i = T.bind(null, n, o); + if (!e.pending.length) return i; + const r = { id: o, icons: e, callback: t, abort: i }; + return ( + n.forEach((t) => { + (t.loaderCallbacks || (t.loaderCallbacks = [])).push(r); + }), + i + ); + })(e, o, r) + : lt + ); + }, + dt = (t) => + new Promise((e, n) => { + const o = 'string' == typeof t ? p(t, !0) : t; + o + ? ft([o || t], (i) => { + if (i.length && o) { + const t = O(o); + if (t) return void e({ ...r, ...t }); + } + n(t); + }) + : n(t); + }); +function pt(t, e) { + const n = 'string' == typeof t ? p(t, !0, !0) : null; + if (!n) { + const e = (function (t) { + try { + const e = 'string' == typeof t ? JSON.parse(t) : t; + if ('string' == typeof e.body) return { ...e }; + } catch (t) {} + })(t); + return { value: t, data: e }; + } + const o = O(n); + if (void 0 !== o || !n.prefix) return { value: t, name: n, data: o }; + const i = ft([n], () => e(t, n, O(n))); + return { value: t, name: n, loading: i }; +} +function ht(t) { + return t.hasAttribute('inline'); +} +let gt = !1; +try { + gt = 0 === navigator.vendor.indexOf('Apple'); +} catch (t) {} +const mt = /(-?[0-9.]*[0-9]+[0-9.]*)/g, + bt = /^-?[0-9.]*[0-9]+[0-9.]*$/g; +function yt(t, e, n) { + if (1 === e) return t; + if (((n = n || 100), 'number' == typeof t)) return Math.ceil(t * e * n) / n; + if ('string' != typeof t) return t; + const o = t.split(mt); + if (null === o || !o.length) return t; + const i = []; + let r = o.shift(), + s = bt.test(r); + for (;;) { + if (s) { + const t = parseFloat(r); + isNaN(t) ? i.push(r) : i.push(Math.ceil(t * e * n) / n); + } else i.push(r); + if (((r = o.shift()), void 0 === r)) return i.join(''); + s = !s; + } +} +function vt(t, e) { + const n = { ...r, ...t }, + o = { ...a, ...e }, + i = { left: n.left, top: n.top, width: n.width, height: n.height }; + let s = n.body; + [n, o].forEach((t) => { + const e = [], + n = t.hFlip, + o = t.vFlip; + let r, + c = t.rotate; + switch ( + (n + ? o + ? (c += 2) + : (e.push( + 'translate(' + + (i.width + i.left).toString() + + ' ' + + (0 - i.top).toString() + + ')', + ), + e.push('scale(-1 1)'), + (i.top = i.left = 0)) + : o && + (e.push( + 'translate(' + + (0 - i.left).toString() + + ' ' + + (i.height + i.top).toString() + + ')', + ), + e.push('scale(1 -1)'), + (i.top = i.left = 0)), + c < 0 && (c -= 4 * Math.floor(c / 4)), + (c %= 4), + c) + ) { + case 1: + (r = i.height / 2 + i.top), + e.unshift('rotate(90 ' + r.toString() + ' ' + r.toString() + ')'); + break; + case 2: + e.unshift( + 'rotate(180 ' + + (i.width / 2 + i.left).toString() + + ' ' + + (i.height / 2 + i.top).toString() + + ')', + ); + break; + case 3: + (r = i.width / 2 + i.left), + e.unshift('rotate(-90 ' + r.toString() + ' ' + r.toString() + ')'); + } + c % 2 == 1 && + (i.left !== i.top && ((r = i.left), (i.left = i.top), (i.top = r)), + i.width !== i.height && + ((r = i.width), (i.width = i.height), (i.height = r))), + e.length && (s = '' + s + ''); + }); + const c = o.width, + l = o.height, + u = i.width, + f = i.height; + let d, p; + null === c + ? ((p = null === l ? '1em' : 'auto' === l ? f : l), (d = yt(p, u / f))) + : ((d = 'auto' === c ? u : c), + (p = null === l ? yt(d, f / u) : 'auto' === l ? f : l)); + return { + attributes: { + width: d.toString(), + height: p.toString(), + viewBox: + i.left.toString() + + ' ' + + i.top.toString() + + ' ' + + u.toString() + + ' ' + + f.toString(), + }, + body: s, + }; +} +let xt = (() => { + let t; + try { + if (((t = fetch), 'function' == typeof t)) return t; + } catch (t) {} +})(); +function wt(t) { + xt = t; +} +function kt() { + return xt; +} +const jt = { + prepare: (t, e, n) => { + const o = [], + i = (function (t, e) { + const n = B(t); + if (!n) return 0; + let o; + if (n.maxURL) { + let t = 0; + n.resources.forEach((e) => { + const n = e; + t = Math.max(t, n.length); + }); + const i = e + '.json?icons='; + o = n.maxURL - t - n.path.length - i.length; + } else o = 0; + return o; + })(t, e), + r = 'icons'; + let s = { type: r, provider: t, prefix: e, icons: [] }, + c = 0; + return ( + n.forEach((n, a) => { + (c += n.length + 1), + c >= i && + a > 0 && + (o.push(s), + (s = { type: r, provider: t, prefix: e, icons: [] }), + (c = n.length)), + s.icons.push(n); + }), + o.push(s), + o + ); + }, + send: (t, e, n) => { + if (!xt) return void n('abort', 424); + let o = (function (t) { + if ('string' == typeof t) { + const e = B(t); + if (e) return e.path; + } + return '/'; + })(e.provider); + switch (e.type) { + case 'icons': { + const t = e.prefix, + n = e.icons.join(','); + o += t + '.json?' + new URLSearchParams({ icons: n }).toString(); + break; + } + case 'custom': { + const t = e.uri; + o += '/' === t.slice(0, 1) ? t.slice(1) : t; + break; + } + default: + return void n('abort', 400); + } + let i = 503; + xt(t + o) + .then((t) => { + const e = t.status; + if (200 === e) return (i = 501), t.json(); + setTimeout(() => { + n( + (function (t) { + return 404 === t; + })(e) + ? 'abort' + : 'next', + e, + ); + }); + }) + .then((t) => { + 'object' == typeof t && null !== t + ? setTimeout(() => { + n('success', t); + }) + : setTimeout(() => { + 404 === t ? n('abort', t) : n('next', i); + }); + }) + .catch(() => { + n('next', i); + }); + }, +}; +function _t(t, e) { + switch (t) { + case 'local': + case 'session': + et[t] = e; + break; + case 'all': + for (const t in et) et[t] = e; + } +} +function At() { + let t; + P('', jt), S(!0); + try { + t = window; + } catch (t) {} + if (t) { + if ((ct(), void 0 !== t.IconifyPreload)) { + const e = t.IconifyPreload, + n = 'Invalid IconifyPreload syntax.'; + 'object' == typeof e && + null !== e && + (e instanceof Array ? e : [e]).forEach((t) => { + try { + ('object' != typeof t || + null === t || + t instanceof Array || + 'object' != typeof t.icons || + 'string' != typeof t.prefix || + !E(t)) && + console.error(n); + } catch (t) { + console.error(n); + } + }); + } + if (void 0 !== t.IconifyProviders) { + const e = t.IconifyProviders; + if ('object' == typeof e && null !== e) + for (const t in e) { + const n = 'IconifyProviders[' + t + '] is invalid.'; + try { + const o = e[t]; + if ('object' != typeof o || !o || void 0 === o.resources) continue; + J(t, o) || console.error(n); + } catch (t) { + console.error(n); + } + } + } + } + return { + enableCache: (t) => _t(t, !0), + disableCache: (t) => _t(t, !1), + iconExists: I, + getIcon: M, + listIcons: _, + addIcon: C, + addCollection: E, + calculateSize: yt, + buildIcon: vt, + loadIcons: ft, + loadIcon: dt, + addAPIProvider: J, + _api: { + getAPIConfig: B, + setAPIModule: P, + sendAPIQuery: K, + setFetch: wt, + getFetch: kt, + listAPIProviders: H, + }, + }; +} +function St(t, e) { + let n = + -1 === t.indexOf('xlink:') + ? '' + : ' xmlns:xlink="http://www.w3.org/1999/xlink"'; + for (const t in e) n += ' ' + t + '="' + e[t] + '"'; + return '' + t + ''; +} +const Ot = { 'background-color': 'currentColor' }, + Ct = { 'background-color': 'transparent' }, + Et = { image: 'var(--svg)', repeat: 'no-repeat', size: '100% 100%' }, + It = { '-webkit-mask': Ot, mask: Ot, background: Ct }; +for (const t in It) { + const e = It[t]; + for (const n in Et) e[t + '-' + n] = Et[n]; +} +function Mt(t) { + return t + (t.match(/^[-0-9.]+$/) ? 'px' : ''); +} +function Tt(t, e) { + const n = e.icon.data, + o = e.customisations, + i = vt(n, o); + o.preserveAspectRatio && + (i.attributes.preserveAspectRatio = o.preserveAspectRatio); + const s = e.renderedMode; + let c; + if ('svg' === s) + c = (function (t) { + const e = document.createElement('span'); + return (e.innerHTML = St(t.body, t.attributes)), e.firstChild; + })(i); + else + c = (function (t, e, n) { + const o = document.createElement('span'); + let i = t.body; + -1 !== i.indexOf('/g, '%3E') + .replace(/\s+/g, ' ') + '")'), + c = o.style, + a = { + '--svg': s, + width: Mt(r.width), + height: Mt(r.height), + ...(n ? Ot : Ct), + }; + var l; + for (const t in a) c.setProperty(t, a[t]); + return o; + })(i, { ...r, ...n }, 'mask' === s); + const a = Array.from(t.childNodes).find((t) => { + const e = t.tagName && t.tagName.toUpperCase(); + return 'SPAN' === e || 'SVG' === e; + }); + a + ? 'SPAN' === c.tagName && a.tagName === c.tagName + ? a.setAttribute('style', c.getAttribute('style')) + : t.replaceChild(c, a) + : t.appendChild(c); +} +function Ft(t, e) { + let n = Array.from(t.childNodes).find( + (t) => t.hasAttribute && t.hasAttribute('data-style'), + ); + n || + ((n = document.createElement('style')), + n.setAttribute('data-style', 'data-style'), + t.appendChild(n)), + (n.textContent = + ':host{display:inline-block;vertical-align:' + + (e ? '-0.125em' : '0') + + '}span,svg{display:block}'); +} +function Nt(t, e, n) { + return { + rendered: !1, + inline: e, + icon: t, + lastRender: n && (n.rendered ? n : n.lastRender), + }; +} +(function (t = 'iconify-icon') { + let e, n; + try { + (e = window.customElements), (n = window.HTMLElement); + } catch (t) { + return; + } + if (!e || !n) return; + const o = e.get(t); + if (o) return o; + const i = ['icon', 'mode', 'inline', 'width', 'height', 'rotate', 'flip'], + r = class extends n { + _shadowRoot; + _state; + _checkQueued = !1; + constructor() { + super(); + const t = (this._shadowRoot = this.attachShadow({ mode: 'open' })), + e = ht(this); + Ft(t, e), (this._state = Nt({ value: '' }, e)), this._queueCheck(); + } + static get observedAttributes() { + return i.slice(0); + } + attributeChangedCallback(t) { + if ('inline' === t) { + const t = ht(this), + e = this._state; + t !== e.inline && ((e.inline = t), Ft(this._shadowRoot, t)); + } else this._queueCheck(); + } + get icon() { + const t = this.getAttribute('icon'); + if (t && '{' === t.slice(0, 1)) + try { + return JSON.parse(t); + } catch (t) {} + return t; + } + set icon(t) { + 'object' == typeof t && (t = JSON.stringify(t)), + this.setAttribute('icon', t); + } + get inline() { + return ht(this); + } + set inline(t) { + this.setAttribute('inline', t ? 'true' : null); + } + restartAnimation() { + const t = this._state; + if (t.rendered) { + const e = this._shadowRoot; + if ('svg' === t.renderedMode) + try { + return void e.lastChild.setCurrentTime(0); + } catch (t) {} + Tt(e, t); + } + } + get status() { + const t = this._state; + return t.rendered + ? 'rendered' + : null === t.icon.data + ? 'failed' + : 'loading'; + } + _queueCheck() { + this._checkQueued || + ((this._checkQueued = !0), + setTimeout(() => { + this._check(); + })); + } + _check() { + if (!this._checkQueued) return; + this._checkQueued = !1; + const t = this._state, + e = this.getAttribute('icon'); + if (e !== t.icon.value) return void this._iconChanged(e); + if (!t.rendered) return; + const n = this.getAttribute('mode'), + o = f(this); + (t.attrMode !== n || + (function (t, e) { + for (const n in u) if (t[n] !== e[n]) return !0; + return !1; + })(t.customisations, o)) && + this._renderIcon(t.icon, o, n); + } + _iconChanged(t) { + const e = pt(t, (t, e, n) => { + const o = this._state; + if (o.rendered || this.getAttribute('icon') !== t) return; + const i = { value: t, name: e, data: n }; + i.data ? this._gotIconData(i) : (o.icon = i); + }); + e.data + ? this._gotIconData(e) + : (this._state = Nt(e, this._state.inline, this._state)); + } + _gotIconData(t) { + (this._checkQueued = !1), + this._renderIcon(t, f(this), this.getAttribute('mode')); + } + _renderIcon(t, e, n) { + const o = (function (t, e) { + switch (e) { + case 'svg': + case 'bg': + case 'mask': + return e; + } + return 'style' === e || (!gt && -1 !== t.indexOf(' { + t in r.prototype || + Object.defineProperty(r.prototype, t, { + get: function () { + return this.getAttribute(t); + }, + set: function (e) { + this.setAttribute(t, e); + }, + }); + }); + const s = At(); + for (const t in s) r[t] = r.prototype[t] = s[t]; + return e.define(t, r), r; +})() || At(); +window.customElements.define( + 'dt-icon', + class extends n { + static get styles() { + return t`:root{font-size:inherit;color:inherit;display:inline-flex;width:fit-content;height:fit-content;position:relative}.tooltip{position:absolute;right:20px;top:-50%;min-width:max-content;border:solid 1px currentcolor;background-color:var(--dt-form-background-color,var(--surface-1));padding:.25rem;border-radius:.25rem;text-align:end;z-index:1;display:block}.tooltip:before{position:absolute;right:.7rem;top:1.45rem;content:" ";border-width:.25rem;border-style:solid;border-color:transparent transparent currentcolor transparent}.tooltip[hidden]{display:none}`; + } + static get properties() { + return { + ...super.properties, + icon: { type: String }, + tooltip: { type: String }, + tooltip_open: { type: Boolean }, + size: { type: String }, + }; + } + _showTooltip() { + this.tooltip_open ? (this.tooltip_open = !1) : (this.tooltip_open = !0); + } + render() { + const t = this.tooltip + ? e`
    ${this.tooltip}
    ` + : null; + return e`${t}`; + } + }, +); +//# sourceMappingURL=dt-icon.js.map diff --git a/dt-assets/build/components/icons/dt-icon.js.map b/dt-assets/build/components/icons/dt-icon.js.map new file mode 100644 index 0000000000..754ec3c3a0 --- /dev/null +++ b/dt-assets/build/components/icons/dt-icon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-icon.js","sources":["../../node_modules/iconify-icon/dist/iconify-icon.mjs","../../src/components/icons/dt-icon.js"],"sourcesContent":["/**\n* (c) Iconify\n*\n* For the full copyright and license information, please view the license.txt\n* files at https://github.com/iconify/iconify\n*\n* Licensed under MIT.\n*\n* @license MIT\n* @version 1.0.2\n*/\nconst defaultIconDimensions = Object.freeze(\n {\n left: 0,\n top: 0,\n width: 16,\n height: 16\n }\n);\nconst defaultIconTransformations = Object.freeze({\n rotate: 0,\n vFlip: false,\n hFlip: false\n});\nconst defaultIconProps = Object.freeze({\n ...defaultIconDimensions,\n ...defaultIconTransformations\n});\nconst defaultExtendedIconProps = Object.freeze({\n ...defaultIconProps,\n body: \"\",\n hidden: false\n});\n\nconst defaultIconSizeCustomisations = Object.freeze({\n width: null,\n height: null\n});\nconst defaultIconCustomisations = Object.freeze({\n ...defaultIconSizeCustomisations,\n ...defaultIconTransformations\n});\n\nfunction rotateFromString(value, defaultValue = 0) {\n const units = value.replace(/^-?[0-9.]*/, \"\");\n function cleanup(value2) {\n while (value2 < 0) {\n value2 += 4;\n }\n return value2 % 4;\n }\n if (units === \"\") {\n const num = parseInt(value);\n return isNaN(num) ? 0 : cleanup(num);\n } else if (units !== value) {\n let split = 0;\n switch (units) {\n case \"%\":\n split = 25;\n break;\n case \"deg\":\n split = 90;\n }\n if (split) {\n let num = parseFloat(value.slice(0, value.length - units.length));\n if (isNaN(num)) {\n return 0;\n }\n num = num / split;\n return num % 1 === 0 ? cleanup(num) : 0;\n }\n }\n return defaultValue;\n}\n\nconst separator = /[\\s,]+/;\nfunction flipFromString(custom, flip) {\n flip.split(separator).forEach((str) => {\n const value = str.trim();\n switch (value) {\n case \"horizontal\":\n custom.hFlip = true;\n break;\n case \"vertical\":\n custom.vFlip = true;\n break;\n }\n });\n}\n\nconst defaultCustomisations = {\n ...defaultIconCustomisations,\n preserveAspectRatio: '',\n};\n/**\n * Get customisations\n */\nfunction getCustomisations(node) {\n const customisations = {\n ...defaultCustomisations,\n };\n const attr = (key, def) => node.getAttribute(key) || def;\n // Dimensions\n customisations.width = attr('width', null);\n customisations.height = attr('height', null);\n // Rotation\n customisations.rotate = rotateFromString(attr('rotate', ''));\n // Flip\n flipFromString(customisations, attr('flip', ''));\n // SVG attributes\n customisations.preserveAspectRatio = attr('preserveAspectRatio', attr('preserveaspectratio', ''));\n return customisations;\n}\n/**\n * Check if customisations have been updated\n */\nfunction haveCustomisationsChanged(value1, value2) {\n for (const key in defaultCustomisations) {\n if (value1[key] !== value2[key]) {\n return true;\n }\n }\n return false;\n}\n\nconst matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;\nconst stringToIcon = (value, validate, allowSimpleName, provider = \"\") => {\n const colonSeparated = value.split(\":\");\n if (value.slice(0, 1) === \"@\") {\n if (colonSeparated.length < 2 || colonSeparated.length > 3) {\n return null;\n }\n provider = colonSeparated.shift().slice(1);\n }\n if (colonSeparated.length > 3 || !colonSeparated.length) {\n return null;\n }\n if (colonSeparated.length > 1) {\n const name2 = colonSeparated.pop();\n const prefix = colonSeparated.pop();\n const result = {\n provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,\n prefix,\n name: name2\n };\n return validate && !validateIconName(result) ? null : result;\n }\n const name = colonSeparated[0];\n const dashSeparated = name.split(\"-\");\n if (dashSeparated.length > 1) {\n const result = {\n provider,\n prefix: dashSeparated.shift(),\n name: dashSeparated.join(\"-\")\n };\n return validate && !validateIconName(result) ? null : result;\n }\n if (allowSimpleName && provider === \"\") {\n const result = {\n provider,\n prefix: \"\",\n name\n };\n return validate && !validateIconName(result, allowSimpleName) ? null : result;\n }\n return null;\n};\nconst validateIconName = (icon, allowSimpleName) => {\n if (!icon) {\n return false;\n }\n return !!((icon.provider === \"\" || icon.provider.match(matchIconName)) && (allowSimpleName && icon.prefix === \"\" || icon.prefix.match(matchIconName)) && icon.name.match(matchIconName));\n};\n\nfunction mergeIconTransformations(obj1, obj2) {\n const result = {};\n if (!obj1.hFlip !== !obj2.hFlip) {\n result.hFlip = true;\n }\n if (!obj1.vFlip !== !obj2.vFlip) {\n result.vFlip = true;\n }\n const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;\n if (rotate) {\n result.rotate = rotate;\n }\n return result;\n}\n\nfunction mergeIconData(parent, child) {\n const result = mergeIconTransformations(parent, child);\n for (const key in defaultExtendedIconProps) {\n if (key in defaultIconTransformations) {\n if (key in parent && !(key in result)) {\n result[key] = defaultIconTransformations[key];\n }\n } else if (key in child) {\n result[key] = child[key];\n } else if (key in parent) {\n result[key] = parent[key];\n }\n }\n return result;\n}\n\nfunction getIconsTree(data, names) {\n const icons = data.icons;\n const aliases = data.aliases || /* @__PURE__ */ Object.create(null);\n const resolved = /* @__PURE__ */ Object.create(null);\n function resolve(name) {\n if (icons[name]) {\n return resolved[name] = [];\n }\n if (!(name in resolved)) {\n resolved[name] = null;\n const parent = aliases[name] && aliases[name].parent;\n const value = parent && resolve(parent);\n if (value) {\n resolved[name] = [parent].concat(value);\n }\n }\n return resolved[name];\n }\n (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);\n return resolved;\n}\n\nfunction internalGetIconData(data, name, tree) {\n const icons = data.icons;\n const aliases = data.aliases || /* @__PURE__ */ Object.create(null);\n let currentProps = {};\n function parse(name2) {\n currentProps = mergeIconData(\n icons[name2] || aliases[name2],\n currentProps\n );\n }\n parse(name);\n tree.forEach(parse);\n return mergeIconData(data, currentProps);\n}\n\nfunction parseIconSet(data, callback) {\n const names = [];\n if (typeof data !== \"object\" || typeof data.icons !== \"object\") {\n return names;\n }\n if (data.not_found instanceof Array) {\n data.not_found.forEach((name) => {\n callback(name, null);\n names.push(name);\n });\n }\n const tree = getIconsTree(data);\n for (const name in tree) {\n const item = tree[name];\n if (item) {\n callback(name, internalGetIconData(data, name, item));\n names.push(name);\n }\n }\n return names;\n}\n\nconst optionalPropertyDefaults = {\n provider: \"\",\n aliases: {},\n not_found: {},\n ...defaultIconDimensions\n};\nfunction checkOptionalProps(item, defaults) {\n for (const prop in defaults) {\n if (prop in item && typeof item[prop] !== typeof defaults[prop]) {\n return false;\n }\n }\n return true;\n}\nfunction quicklyValidateIconSet(obj) {\n if (typeof obj !== \"object\" || obj === null) {\n return null;\n }\n const data = obj;\n if (typeof data.prefix !== \"string\" || !obj.icons || typeof obj.icons !== \"object\") {\n return null;\n }\n if (!checkOptionalProps(obj, optionalPropertyDefaults)) {\n return null;\n }\n const icons = data.icons;\n for (const name in icons) {\n const icon = icons[name];\n if (!name.match(matchIconName) || typeof icon.body !== \"string\" || !checkOptionalProps(\n icon,\n defaultExtendedIconProps\n )) {\n return null;\n }\n }\n const aliases = data.aliases || /* @__PURE__ */ Object.create(null);\n for (const name in aliases) {\n const icon = aliases[name];\n const parent = icon.parent;\n if (!name.match(matchIconName) || typeof parent !== \"string\" || !icons[parent] && !aliases[parent] || !checkOptionalProps(\n icon,\n defaultExtendedIconProps\n )) {\n return null;\n }\n }\n return data;\n}\n\nconst dataStorage = /* @__PURE__ */ Object.create(null);\nfunction newStorage(provider, prefix) {\n return {\n provider,\n prefix,\n icons: /* @__PURE__ */ Object.create(null),\n missing: /* @__PURE__ */ new Set()\n };\n}\nfunction getStorage(provider, prefix) {\n const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null));\n return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));\n}\nfunction addIconSet(storage, data) {\n if (!quicklyValidateIconSet(data)) {\n return [];\n }\n return parseIconSet(data, (name, icon) => {\n if (icon) {\n storage.icons[name] = icon;\n } else {\n storage.missing.add(name);\n }\n });\n}\nfunction addIconToStorage(storage, name, icon) {\n try {\n if (typeof icon.body === \"string\") {\n storage.icons[name] = { ...icon };\n return true;\n }\n } catch (err) {\n }\n return false;\n}\nfunction listIcons$1(provider, prefix) {\n let allIcons = [];\n const providers = typeof provider === \"string\" ? [provider] : Object.keys(dataStorage);\n providers.forEach((provider2) => {\n const prefixes = typeof provider2 === \"string\" && typeof prefix === \"string\" ? [prefix] : Object.keys(dataStorage[provider2] || {});\n prefixes.forEach((prefix2) => {\n const storage = getStorage(provider2, prefix2);\n allIcons = allIcons.concat(\n Object.keys(storage.icons).map(\n (name) => (provider2 !== \"\" ? \"@\" + provider2 + \":\" : \"\") + prefix2 + \":\" + name\n )\n );\n });\n });\n return allIcons;\n}\n\nlet simpleNames = false;\nfunction allowSimpleNames(allow) {\n if (typeof allow === \"boolean\") {\n simpleNames = allow;\n }\n return simpleNames;\n}\nfunction getIconData(name) {\n const icon = typeof name === \"string\" ? stringToIcon(name, true, simpleNames) : name;\n if (icon) {\n const storage = getStorage(icon.provider, icon.prefix);\n const iconName = icon.name;\n return storage.icons[iconName] || (storage.missing.has(iconName) ? null : void 0);\n }\n}\nfunction addIcon$1(name, data) {\n const icon = stringToIcon(name, true, simpleNames);\n if (!icon) {\n return false;\n }\n const storage = getStorage(icon.provider, icon.prefix);\n return addIconToStorage(storage, icon.name, data);\n}\nfunction addCollection$1(data, provider) {\n if (typeof data !== \"object\") {\n return false;\n }\n if (typeof provider !== \"string\") {\n provider = data.provider || \"\";\n }\n if (simpleNames && !provider && !data.prefix) {\n let added = false;\n if (quicklyValidateIconSet(data)) {\n data.prefix = \"\";\n parseIconSet(data, (name, icon) => {\n if (icon && addIcon$1(name, icon)) {\n added = true;\n }\n });\n }\n return added;\n }\n const prefix = data.prefix;\n if (!validateIconName({\n provider,\n prefix,\n name: \"a\"\n })) {\n return false;\n }\n const storage = getStorage(provider, prefix);\n return !!addIconSet(storage, data);\n}\nfunction iconExists$1(name) {\n return !!getIconData(name);\n}\nfunction getIcon$1(name) {\n const result = getIconData(name);\n return result ? {\n ...defaultIconProps,\n ...result\n } : null;\n}\n\nfunction sortIcons(icons) {\n const result = {\n loaded: [],\n missing: [],\n pending: []\n };\n const storage = /* @__PURE__ */ Object.create(null);\n icons.sort((a, b) => {\n if (a.provider !== b.provider) {\n return a.provider.localeCompare(b.provider);\n }\n if (a.prefix !== b.prefix) {\n return a.prefix.localeCompare(b.prefix);\n }\n return a.name.localeCompare(b.name);\n });\n let lastIcon = {\n provider: \"\",\n prefix: \"\",\n name: \"\"\n };\n icons.forEach((icon) => {\n if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {\n return;\n }\n lastIcon = icon;\n const provider = icon.provider;\n const prefix = icon.prefix;\n const name = icon.name;\n const providerStorage = storage[provider] || (storage[provider] = /* @__PURE__ */ Object.create(null));\n const localStorage = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));\n let list;\n if (name in localStorage.icons) {\n list = result.loaded;\n } else if (prefix === \"\" || localStorage.missing.has(name)) {\n list = result.missing;\n } else {\n list = result.pending;\n }\n const item = {\n provider,\n prefix,\n name\n };\n list.push(item);\n });\n return result;\n}\n\nfunction removeCallback(storages, id) {\n storages.forEach((storage) => {\n const items = storage.loaderCallbacks;\n if (items) {\n storage.loaderCallbacks = items.filter((row) => row.id !== id);\n }\n });\n}\nfunction updateCallbacks(storage) {\n if (!storage.pendingCallbacksFlag) {\n storage.pendingCallbacksFlag = true;\n setTimeout(() => {\n storage.pendingCallbacksFlag = false;\n const items = storage.loaderCallbacks ? storage.loaderCallbacks.slice(0) : [];\n if (!items.length) {\n return;\n }\n let hasPending = false;\n const provider = storage.provider;\n const prefix = storage.prefix;\n items.forEach((item) => {\n const icons = item.icons;\n const oldLength = icons.pending.length;\n icons.pending = icons.pending.filter((icon) => {\n if (icon.prefix !== prefix) {\n return true;\n }\n const name = icon.name;\n if (storage.icons[name]) {\n icons.loaded.push({\n provider,\n prefix,\n name\n });\n } else if (storage.missing.has(name)) {\n icons.missing.push({\n provider,\n prefix,\n name\n });\n } else {\n hasPending = true;\n return true;\n }\n return false;\n });\n if (icons.pending.length !== oldLength) {\n if (!hasPending) {\n removeCallback([storage], item.id);\n }\n item.callback(\n icons.loaded.slice(0),\n icons.missing.slice(0),\n icons.pending.slice(0),\n item.abort\n );\n }\n });\n });\n }\n}\nlet idCounter = 0;\nfunction storeCallback(callback, icons, pendingSources) {\n const id = idCounter++;\n const abort = removeCallback.bind(null, pendingSources, id);\n if (!icons.pending.length) {\n return abort;\n }\n const item = {\n id,\n icons,\n callback,\n abort\n };\n pendingSources.forEach((storage) => {\n (storage.loaderCallbacks || (storage.loaderCallbacks = [])).push(item);\n });\n return abort;\n}\n\nconst storage = /* @__PURE__ */ Object.create(null);\nfunction setAPIModule(provider, item) {\n storage[provider] = item;\n}\nfunction getAPIModule(provider) {\n return storage[provider] || storage[\"\"];\n}\n\nfunction listToIcons(list, validate = true, simpleNames = false) {\n const result = [];\n list.forEach((item) => {\n const icon = typeof item === \"string\" ? stringToIcon(item, validate, simpleNames) : item;\n if (icon) {\n result.push(icon);\n }\n });\n return result;\n}\n\n// src/config.ts\nvar defaultConfig = {\n resources: [],\n index: 0,\n timeout: 2e3,\n rotate: 750,\n random: false,\n dataAfterTimeout: false\n};\n\n// src/query.ts\nfunction sendQuery(config, payload, query, done) {\n const resourcesCount = config.resources.length;\n const startIndex = config.random ? Math.floor(Math.random() * resourcesCount) : config.index;\n let resources;\n if (config.random) {\n let list = config.resources.slice(0);\n resources = [];\n while (list.length > 1) {\n const nextIndex = Math.floor(Math.random() * list.length);\n resources.push(list[nextIndex]);\n list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));\n }\n resources = resources.concat(list);\n } else {\n resources = config.resources.slice(startIndex).concat(config.resources.slice(0, startIndex));\n }\n const startTime = Date.now();\n let status = \"pending\";\n let queriesSent = 0;\n let lastError;\n let timer = null;\n let queue = [];\n let doneCallbacks = [];\n if (typeof done === \"function\") {\n doneCallbacks.push(done);\n }\n function resetTimer() {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n }\n function abort() {\n if (status === \"pending\") {\n status = \"aborted\";\n }\n resetTimer();\n queue.forEach((item) => {\n if (item.status === \"pending\") {\n item.status = \"aborted\";\n }\n });\n queue = [];\n }\n function subscribe(callback, overwrite) {\n if (overwrite) {\n doneCallbacks = [];\n }\n if (typeof callback === \"function\") {\n doneCallbacks.push(callback);\n }\n }\n function getQueryStatus() {\n return {\n startTime,\n payload,\n status,\n queriesSent,\n queriesPending: queue.length,\n subscribe,\n abort\n };\n }\n function failQuery() {\n status = \"failed\";\n doneCallbacks.forEach((callback) => {\n callback(void 0, lastError);\n });\n }\n function clearQueue() {\n queue.forEach((item) => {\n if (item.status === \"pending\") {\n item.status = \"aborted\";\n }\n });\n queue = [];\n }\n function moduleResponse(item, response, data) {\n const isError = response !== \"success\";\n queue = queue.filter((queued) => queued !== item);\n switch (status) {\n case \"pending\":\n break;\n case \"failed\":\n if (isError || !config.dataAfterTimeout) {\n return;\n }\n break;\n default:\n return;\n }\n if (response === \"abort\") {\n lastError = data;\n failQuery();\n return;\n }\n if (isError) {\n lastError = data;\n if (!queue.length) {\n if (!resources.length) {\n failQuery();\n } else {\n execNext();\n }\n }\n return;\n }\n resetTimer();\n clearQueue();\n if (!config.random) {\n const index = config.resources.indexOf(item.resource);\n if (index !== -1 && index !== config.index) {\n config.index = index;\n }\n }\n status = \"completed\";\n doneCallbacks.forEach((callback) => {\n callback(data);\n });\n }\n function execNext() {\n if (status !== \"pending\") {\n return;\n }\n resetTimer();\n const resource = resources.shift();\n if (resource === void 0) {\n if (queue.length) {\n timer = setTimeout(() => {\n resetTimer();\n if (status === \"pending\") {\n clearQueue();\n failQuery();\n }\n }, config.timeout);\n return;\n }\n failQuery();\n return;\n }\n const item = {\n status: \"pending\",\n resource,\n callback: (status2, data) => {\n moduleResponse(item, status2, data);\n }\n };\n queue.push(item);\n queriesSent++;\n timer = setTimeout(execNext, config.rotate);\n query(resource, payload, item.callback);\n }\n setTimeout(execNext);\n return getQueryStatus;\n}\n\n// src/index.ts\nfunction initRedundancy(cfg) {\n const config = {\n ...defaultConfig,\n ...cfg\n };\n let queries = [];\n function cleanup() {\n queries = queries.filter((item) => item().status === \"pending\");\n }\n function query(payload, queryCallback, doneCallback) {\n const query2 = sendQuery(\n config,\n payload,\n queryCallback,\n (data, error) => {\n cleanup();\n if (doneCallback) {\n doneCallback(data, error);\n }\n }\n );\n queries.push(query2);\n return query2;\n }\n function find(callback) {\n return queries.find((value) => {\n return callback(value);\n }) || null;\n }\n const instance = {\n query,\n find,\n setIndex: (index) => {\n config.index = index;\n },\n getIndex: () => config.index,\n cleanup\n };\n return instance;\n}\n\nfunction createAPIConfig(source) {\n let resources;\n if (typeof source.resources === \"string\") {\n resources = [source.resources];\n } else {\n resources = source.resources;\n if (!(resources instanceof Array) || !resources.length) {\n return null;\n }\n }\n const result = {\n resources,\n path: source.path || \"/\",\n maxURL: source.maxURL || 500,\n rotate: source.rotate || 750,\n timeout: source.timeout || 5e3,\n random: source.random === true,\n index: source.index || 0,\n dataAfterTimeout: source.dataAfterTimeout !== false\n };\n return result;\n}\nconst configStorage = /* @__PURE__ */ Object.create(null);\nconst fallBackAPISources = [\n \"https://api.simplesvg.com\",\n \"https://api.unisvg.com\"\n];\nconst fallBackAPI = [];\nwhile (fallBackAPISources.length > 0) {\n if (fallBackAPISources.length === 1) {\n fallBackAPI.push(fallBackAPISources.shift());\n } else {\n if (Math.random() > 0.5) {\n fallBackAPI.push(fallBackAPISources.shift());\n } else {\n fallBackAPI.push(fallBackAPISources.pop());\n }\n }\n}\nconfigStorage[\"\"] = createAPIConfig({\n resources: [\"https://api.iconify.design\"].concat(fallBackAPI)\n});\nfunction addAPIProvider$1(provider, customConfig) {\n const config = createAPIConfig(customConfig);\n if (config === null) {\n return false;\n }\n configStorage[provider] = config;\n return true;\n}\nfunction getAPIConfig(provider) {\n return configStorage[provider];\n}\nfunction listAPIProviders() {\n return Object.keys(configStorage);\n}\n\nfunction emptyCallback$1() {\n}\nconst redundancyCache = /* @__PURE__ */ Object.create(null);\nfunction getRedundancyCache(provider) {\n if (!redundancyCache[provider]) {\n const config = getAPIConfig(provider);\n if (!config) {\n return;\n }\n const redundancy = initRedundancy(config);\n const cachedReundancy = {\n config,\n redundancy\n };\n redundancyCache[provider] = cachedReundancy;\n }\n return redundancyCache[provider];\n}\nfunction sendAPIQuery(target, query, callback) {\n let redundancy;\n let send;\n if (typeof target === \"string\") {\n const api = getAPIModule(target);\n if (!api) {\n callback(void 0, 424);\n return emptyCallback$1;\n }\n send = api.send;\n const cached = getRedundancyCache(target);\n if (cached) {\n redundancy = cached.redundancy;\n }\n } else {\n const config = createAPIConfig(target);\n if (config) {\n redundancy = initRedundancy(config);\n const moduleKey = target.resources ? target.resources[0] : \"\";\n const api = getAPIModule(moduleKey);\n if (api) {\n send = api.send;\n }\n }\n }\n if (!redundancy || !send) {\n callback(void 0, 424);\n return emptyCallback$1;\n }\n return redundancy.query(query, send, callback)().abort;\n}\n\nconst browserCacheVersion = \"iconify2\";\nconst browserCachePrefix = \"iconify\";\nconst browserCacheCountKey = browserCachePrefix + \"-count\";\nconst browserCacheVersionKey = browserCachePrefix + \"-version\";\nconst browserStorageHour = 36e5;\nconst browserStorageCacheExpiration = 168;\n\nfunction getStoredItem(func, key) {\n try {\n return func.getItem(key);\n } catch (err) {\n }\n}\nfunction setStoredItem(func, key, value) {\n try {\n func.setItem(key, value);\n return true;\n } catch (err) {\n }\n}\nfunction removeStoredItem(func, key) {\n try {\n func.removeItem(key);\n } catch (err) {\n }\n}\n\nfunction setBrowserStorageItemsCount(storage, value) {\n return setStoredItem(storage, browserCacheCountKey, value.toString());\n}\nfunction getBrowserStorageItemsCount(storage) {\n return parseInt(getStoredItem(storage, browserCacheCountKey)) || 0;\n}\n\nconst browserStorageConfig = {\n local: true,\n session: true\n};\nconst browserStorageEmptyItems = {\n local: /* @__PURE__ */ new Set(),\n session: /* @__PURE__ */ new Set()\n};\nlet browserStorageStatus = false;\nfunction setBrowserStorageStatus(status) {\n browserStorageStatus = status;\n}\n\nlet _window = typeof window === \"undefined\" ? {} : window;\nfunction getBrowserStorage(key) {\n const attr = key + \"Storage\";\n try {\n if (_window && _window[attr] && typeof _window[attr].length === \"number\") {\n return _window[attr];\n }\n } catch (err) {\n }\n browserStorageConfig[key] = false;\n}\n\nfunction iterateBrowserStorage(key, callback) {\n const func = getBrowserStorage(key);\n if (!func) {\n return;\n }\n const version = getStoredItem(func, browserCacheVersionKey);\n if (version !== browserCacheVersion) {\n if (version) {\n const total2 = getBrowserStorageItemsCount(func);\n for (let i = 0; i < total2; i++) {\n removeStoredItem(func, browserCachePrefix + i.toString());\n }\n }\n setStoredItem(func, browserCacheVersionKey, browserCacheVersion);\n setBrowserStorageItemsCount(func, 0);\n return;\n }\n const minTime = Math.floor(Date.now() / browserStorageHour) - browserStorageCacheExpiration;\n const parseItem = (index) => {\n const name = browserCachePrefix + index.toString();\n const item = getStoredItem(func, name);\n if (typeof item !== \"string\") {\n return;\n }\n try {\n const data = JSON.parse(item);\n if (typeof data === \"object\" && typeof data.cached === \"number\" && data.cached > minTime && typeof data.provider === \"string\" && typeof data.data === \"object\" && typeof data.data.prefix === \"string\" && callback(data, index)) {\n return true;\n }\n } catch (err) {\n }\n removeStoredItem(func, name);\n };\n let total = getBrowserStorageItemsCount(func);\n for (let i = total - 1; i >= 0; i--) {\n if (!parseItem(i)) {\n if (i === total - 1) {\n total--;\n setBrowserStorageItemsCount(func, total);\n } else {\n browserStorageEmptyItems[key].add(i);\n }\n }\n }\n}\n\nfunction initBrowserStorage() {\n if (browserStorageStatus) {\n return;\n }\n setBrowserStorageStatus(true);\n for (const key in browserStorageConfig) {\n iterateBrowserStorage(key, (item) => {\n const iconSet = item.data;\n const provider = item.provider;\n const prefix = iconSet.prefix;\n const storage = getStorage(\n provider,\n prefix\n );\n if (!addIconSet(storage, iconSet).length) {\n return false;\n }\n const lastModified = iconSet.lastModified || -1;\n storage.lastModifiedCached = storage.lastModifiedCached ? Math.min(storage.lastModifiedCached, lastModified) : lastModified;\n return true;\n });\n }\n}\n\nfunction updateLastModified(storage, lastModified) {\n const lastValue = storage.lastModifiedCached;\n if (lastValue && lastValue >= lastModified) {\n return lastValue === lastModified;\n }\n storage.lastModifiedCached = lastModified;\n if (lastValue) {\n for (const key in browserStorageConfig) {\n iterateBrowserStorage(key, (item) => {\n const iconSet = item.data;\n return item.provider !== storage.provider || iconSet.prefix !== storage.prefix || iconSet.lastModified === lastModified;\n });\n }\n }\n return true;\n}\nfunction storeInBrowserStorage(storage, data) {\n if (!browserStorageStatus) {\n initBrowserStorage();\n }\n function store(key) {\n let func;\n if (!browserStorageConfig[key] || !(func = getBrowserStorage(key))) {\n return;\n }\n const set = browserStorageEmptyItems[key];\n let index;\n if (set.size) {\n set.delete(index = Array.from(set).shift());\n } else {\n index = getBrowserStorageItemsCount(func);\n if (!setBrowserStorageItemsCount(func, index + 1)) {\n return;\n }\n }\n const item = {\n cached: Math.floor(Date.now() / browserStorageHour),\n provider: storage.provider,\n data\n };\n return setStoredItem(\n func,\n browserCachePrefix + index.toString(),\n JSON.stringify(item)\n );\n }\n if (data.lastModified && !updateLastModified(storage, data.lastModified)) {\n return;\n }\n if (!Object.keys(data.icons).length) {\n return;\n }\n if (data.not_found) {\n data = Object.assign({}, data);\n delete data.not_found;\n }\n if (!store(\"local\")) {\n store(\"session\");\n }\n}\n\nfunction emptyCallback() {\n}\nfunction loadedNewIcons(storage) {\n if (!storage.iconsLoaderFlag) {\n storage.iconsLoaderFlag = true;\n setTimeout(() => {\n storage.iconsLoaderFlag = false;\n updateCallbacks(storage);\n });\n }\n}\nfunction loadNewIcons(storage, icons) {\n if (!storage.iconsToLoad) {\n storage.iconsToLoad = icons;\n } else {\n storage.iconsToLoad = storage.iconsToLoad.concat(icons).sort();\n }\n if (!storage.iconsQueueFlag) {\n storage.iconsQueueFlag = true;\n setTimeout(() => {\n storage.iconsQueueFlag = false;\n const { provider, prefix } = storage;\n const icons2 = storage.iconsToLoad;\n delete storage.iconsToLoad;\n let api;\n if (!icons2 || !(api = getAPIModule(provider))) {\n return;\n }\n const params = api.prepare(provider, prefix, icons2);\n params.forEach((item) => {\n sendAPIQuery(provider, item, (data) => {\n if (typeof data !== \"object\") {\n item.icons.forEach((name) => {\n storage.missing.add(name);\n });\n } else {\n try {\n const parsed = addIconSet(\n storage,\n data\n );\n if (!parsed.length) {\n return;\n }\n const pending = storage.pendingIcons;\n if (pending) {\n parsed.forEach((name) => {\n pending.delete(name);\n });\n }\n storeInBrowserStorage(storage, data);\n } catch (err) {\n console.error(err);\n }\n }\n loadedNewIcons(storage);\n });\n });\n });\n }\n}\nconst loadIcons$1 = (icons, callback) => {\n const cleanedIcons = listToIcons(icons, true, allowSimpleNames());\n const sortedIcons = sortIcons(cleanedIcons);\n if (!sortedIcons.pending.length) {\n let callCallback = true;\n if (callback) {\n setTimeout(() => {\n if (callCallback) {\n callback(\n sortedIcons.loaded,\n sortedIcons.missing,\n sortedIcons.pending,\n emptyCallback\n );\n }\n });\n }\n return () => {\n callCallback = false;\n };\n }\n const newIcons = /* @__PURE__ */ Object.create(null);\n const sources = [];\n let lastProvider, lastPrefix;\n sortedIcons.pending.forEach((icon) => {\n const { provider, prefix } = icon;\n if (prefix === lastPrefix && provider === lastProvider) {\n return;\n }\n lastProvider = provider;\n lastPrefix = prefix;\n sources.push(getStorage(provider, prefix));\n const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null));\n if (!providerNewIcons[prefix]) {\n providerNewIcons[prefix] = [];\n }\n });\n sortedIcons.pending.forEach((icon) => {\n const { provider, prefix, name } = icon;\n const storage = getStorage(provider, prefix);\n const pendingQueue = storage.pendingIcons || (storage.pendingIcons = /* @__PURE__ */ new Set());\n if (!pendingQueue.has(name)) {\n pendingQueue.add(name);\n newIcons[provider][prefix].push(name);\n }\n });\n sources.forEach((storage) => {\n const { provider, prefix } = storage;\n if (newIcons[provider][prefix].length) {\n loadNewIcons(storage, newIcons[provider][prefix]);\n }\n });\n return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;\n};\nconst loadIcon$1 = (icon) => {\n return new Promise((fulfill, reject) => {\n const iconObj = typeof icon === \"string\" ? stringToIcon(icon, true) : icon;\n if (!iconObj) {\n reject(icon);\n return;\n }\n loadIcons$1([iconObj || icon], (loaded) => {\n if (loaded.length && iconObj) {\n const data = getIconData(iconObj);\n if (data) {\n fulfill({\n ...defaultIconProps,\n ...data\n });\n return;\n }\n }\n reject(icon);\n });\n });\n};\n\n/**\n * Test icon string\n */\nfunction testIconObject(value) {\n try {\n const obj = typeof value === 'string' ? JSON.parse(value) : value;\n if (typeof obj.body === 'string') {\n return {\n ...obj,\n };\n }\n }\n catch (err) {\n //\n }\n}\n\n/**\n * Parse icon value, load if needed\n */\nfunction parseIconValue(value, onload) {\n // Check if icon name is valid\n const name = typeof value === 'string' ? stringToIcon(value, true, true) : null;\n if (!name) {\n // Test for serialised object\n const data = testIconObject(value);\n return {\n value,\n data,\n };\n }\n // Valid icon name: check if data is available\n const data = getIconData(name);\n // Icon data exists or icon has no prefix. Do not load icon from API if icon has no prefix\n if (data !== void 0 || !name.prefix) {\n return {\n value,\n name,\n data, // could be 'null' -> icon is missing\n };\n }\n // Load icon\n const loading = loadIcons$1([name], () => onload(value, name, getIconData(name)));\n return {\n value,\n name,\n loading,\n };\n}\n\n/**\n * Check for inline\n */\nfunction getInline(node) {\n return node.hasAttribute('inline');\n}\n\n// Check for Safari\nlet isBuggedSafari = false;\ntry {\n isBuggedSafari = navigator.vendor.indexOf('Apple') === 0;\n}\ncatch (err) {\n //\n}\n/**\n * Get render mode\n */\nfunction getRenderMode(body, mode) {\n switch (mode) {\n // Force mode\n case 'svg':\n case 'bg':\n case 'mask':\n return mode;\n }\n // Check for animation, use 'style' for animated icons, unless browser is Safari\n // (only , which should be ignored or animations start with '\n return 'svg';\n }\n // Use background or mask\n return body.indexOf('currentColor') === -1 ? 'bg' : 'mask';\n}\n\nconst unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;\nconst unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;\nfunction calculateSize$1(size, ratio, precision) {\n if (ratio === 1) {\n return size;\n }\n precision = precision || 100;\n if (typeof size === \"number\") {\n return Math.ceil(size * ratio * precision) / precision;\n }\n if (typeof size !== \"string\") {\n return size;\n }\n const oldParts = size.split(unitsSplit);\n if (oldParts === null || !oldParts.length) {\n return size;\n }\n const newParts = [];\n let code = oldParts.shift();\n let isNumber = unitsTest.test(code);\n while (true) {\n if (isNumber) {\n const num = parseFloat(code);\n if (isNaN(num)) {\n newParts.push(code);\n } else {\n newParts.push(Math.ceil(num * ratio * precision) / precision);\n }\n } else {\n newParts.push(code);\n }\n code = oldParts.shift();\n if (code === void 0) {\n return newParts.join(\"\");\n }\n isNumber = !isNumber;\n }\n}\n\nfunction iconToSVG(icon, customisations) {\n const fullIcon = {\n ...defaultIconProps,\n ...icon\n };\n const fullCustomisations = {\n ...defaultIconCustomisations,\n ...customisations\n };\n const box = {\n left: fullIcon.left,\n top: fullIcon.top,\n width: fullIcon.width,\n height: fullIcon.height\n };\n let body = fullIcon.body;\n [fullIcon, fullCustomisations].forEach((props) => {\n const transformations = [];\n const hFlip = props.hFlip;\n const vFlip = props.vFlip;\n let rotation = props.rotate;\n if (hFlip) {\n if (vFlip) {\n rotation += 2;\n } else {\n transformations.push(\n \"translate(\" + (box.width + box.left).toString() + \" \" + (0 - box.top).toString() + \")\"\n );\n transformations.push(\"scale(-1 1)\");\n box.top = box.left = 0;\n }\n } else if (vFlip) {\n transformations.push(\n \"translate(\" + (0 - box.left).toString() + \" \" + (box.height + box.top).toString() + \")\"\n );\n transformations.push(\"scale(1 -1)\");\n box.top = box.left = 0;\n }\n let tempValue;\n if (rotation < 0) {\n rotation -= Math.floor(rotation / 4) * 4;\n }\n rotation = rotation % 4;\n switch (rotation) {\n case 1:\n tempValue = box.height / 2 + box.top;\n transformations.unshift(\n \"rotate(90 \" + tempValue.toString() + \" \" + tempValue.toString() + \")\"\n );\n break;\n case 2:\n transformations.unshift(\n \"rotate(180 \" + (box.width / 2 + box.left).toString() + \" \" + (box.height / 2 + box.top).toString() + \")\"\n );\n break;\n case 3:\n tempValue = box.width / 2 + box.left;\n transformations.unshift(\n \"rotate(-90 \" + tempValue.toString() + \" \" + tempValue.toString() + \")\"\n );\n break;\n }\n if (rotation % 2 === 1) {\n if (box.left !== box.top) {\n tempValue = box.left;\n box.left = box.top;\n box.top = tempValue;\n }\n if (box.width !== box.height) {\n tempValue = box.width;\n box.width = box.height;\n box.height = tempValue;\n }\n }\n if (transformations.length) {\n body = '' + body + \"\";\n }\n });\n const customisationsWidth = fullCustomisations.width;\n const customisationsHeight = fullCustomisations.height;\n const boxWidth = box.width;\n const boxHeight = box.height;\n let width;\n let height;\n if (customisationsWidth === null) {\n height = customisationsHeight === null ? \"1em\" : customisationsHeight === \"auto\" ? boxHeight : customisationsHeight;\n width = calculateSize$1(height, boxWidth / boxHeight);\n } else {\n width = customisationsWidth === \"auto\" ? boxWidth : customisationsWidth;\n height = customisationsHeight === null ? calculateSize$1(width, boxHeight / boxWidth) : customisationsHeight === \"auto\" ? boxHeight : customisationsHeight;\n }\n const result = {\n attributes: {\n width: width.toString(),\n height: height.toString(),\n viewBox: box.left.toString() + \" \" + box.top.toString() + \" \" + boxWidth.toString() + \" \" + boxHeight.toString()\n },\n body\n };\n return result;\n}\n\nconst detectFetch = () => {\n let callback;\n try {\n callback = fetch;\n if (typeof callback === \"function\") {\n return callback;\n }\n } catch (err) {\n }\n};\nlet fetchModule = detectFetch();\nfunction setFetch(fetch2) {\n fetchModule = fetch2;\n}\nfunction getFetch() {\n return fetchModule;\n}\nfunction calculateMaxLength(provider, prefix) {\n const config = getAPIConfig(provider);\n if (!config) {\n return 0;\n }\n let result;\n if (!config.maxURL) {\n result = 0;\n } else {\n let maxHostLength = 0;\n config.resources.forEach((item) => {\n const host = item;\n maxHostLength = Math.max(maxHostLength, host.length);\n });\n const url = prefix + \".json?icons=\";\n result = config.maxURL - maxHostLength - config.path.length - url.length;\n }\n return result;\n}\nfunction shouldAbort(status) {\n return status === 404;\n}\nconst prepare = (provider, prefix, icons) => {\n const results = [];\n const maxLength = calculateMaxLength(provider, prefix);\n const type = \"icons\";\n let item = {\n type,\n provider,\n prefix,\n icons: []\n };\n let length = 0;\n icons.forEach((name, index) => {\n length += name.length + 1;\n if (length >= maxLength && index > 0) {\n results.push(item);\n item = {\n type,\n provider,\n prefix,\n icons: []\n };\n length = name.length;\n }\n item.icons.push(name);\n });\n results.push(item);\n return results;\n};\nfunction getPath(provider) {\n if (typeof provider === \"string\") {\n const config = getAPIConfig(provider);\n if (config) {\n return config.path;\n }\n }\n return \"/\";\n}\nconst send = (host, params, callback) => {\n if (!fetchModule) {\n callback(\"abort\", 424);\n return;\n }\n let path = getPath(params.provider);\n switch (params.type) {\n case \"icons\": {\n const prefix = params.prefix;\n const icons = params.icons;\n const iconsList = icons.join(\",\");\n const urlParams = new URLSearchParams({\n icons: iconsList\n });\n path += prefix + \".json?\" + urlParams.toString();\n break;\n }\n case \"custom\": {\n const uri = params.uri;\n path += uri.slice(0, 1) === \"/\" ? uri.slice(1) : uri;\n break;\n }\n default:\n callback(\"abort\", 400);\n return;\n }\n let defaultError = 503;\n fetchModule(host + path).then((response) => {\n const status = response.status;\n if (status !== 200) {\n setTimeout(() => {\n callback(shouldAbort(status) ? \"abort\" : \"next\", status);\n });\n return;\n }\n defaultError = 501;\n return response.json();\n }).then((data) => {\n if (typeof data !== \"object\" || data === null) {\n setTimeout(() => {\n if (data === 404) {\n callback(\"abort\", data);\n } else {\n callback(\"next\", defaultError);\n }\n });\n return;\n }\n setTimeout(() => {\n callback(\"success\", data);\n });\n }).catch(() => {\n callback(\"next\", defaultError);\n });\n};\nconst fetchAPIModule = {\n prepare,\n send\n};\n\nfunction toggleBrowserCache(storage, value) {\n switch (storage) {\n case \"local\":\n case \"session\":\n browserStorageConfig[storage] = value;\n break;\n case \"all\":\n for (const key in browserStorageConfig) {\n browserStorageConfig[key] = value;\n }\n break;\n }\n}\n\n// Core\n/**\n * Get functions and initialise stuff\n */\nfunction exportFunctions() {\n /**\n * Initialise stuff\n */\n // Set API module\n setAPIModule('', fetchAPIModule);\n // Allow simple icon names\n allowSimpleNames(true);\n let _window;\n try {\n _window = window;\n }\n catch (err) {\n //\n }\n if (_window) {\n // Set cache and load existing cache\n initBrowserStorage();\n // Load icons from global \"IconifyPreload\"\n if (_window.IconifyPreload !== void 0) {\n const preload = _window.IconifyPreload;\n const err = 'Invalid IconifyPreload syntax.';\n if (typeof preload === 'object' && preload !== null) {\n (preload instanceof Array ? preload : [preload]).forEach((item) => {\n try {\n if (\n // Check if item is an object and not null/array\n typeof item !== 'object' ||\n item === null ||\n item instanceof Array ||\n // Check for 'icons' and 'prefix'\n typeof item.icons !== 'object' ||\n typeof item.prefix !== 'string' ||\n // Add icon set\n !addCollection$1(item)) {\n console.error(err);\n }\n }\n catch (e) {\n console.error(err);\n }\n });\n }\n }\n // Set API from global \"IconifyProviders\"\n if (_window.IconifyProviders !== void 0) {\n const providers = _window.IconifyProviders;\n if (typeof providers === 'object' && providers !== null) {\n for (const key in providers) {\n const err = 'IconifyProviders[' + key + '] is invalid.';\n try {\n const value = providers[key];\n if (typeof value !== 'object' ||\n !value ||\n value.resources === void 0) {\n continue;\n }\n if (!addAPIProvider$1(key, value)) {\n console.error(err);\n }\n }\n catch (e) {\n console.error(err);\n }\n }\n }\n }\n }\n const _api = {\n getAPIConfig,\n setAPIModule,\n sendAPIQuery,\n setFetch,\n getFetch,\n listAPIProviders,\n };\n return {\n enableCache: (storage) => toggleBrowserCache(storage, true),\n disableCache: (storage) => toggleBrowserCache(storage, false),\n iconExists: iconExists$1,\n getIcon: getIcon$1,\n listIcons: listIcons$1,\n addIcon: addIcon$1,\n addCollection: addCollection$1,\n calculateSize: calculateSize$1,\n buildIcon: iconToSVG,\n loadIcons: loadIcons$1,\n loadIcon: loadIcon$1,\n addAPIProvider: addAPIProvider$1,\n _api,\n };\n}\n\nfunction iconToHTML(body, attributes) {\n let renderAttribsHTML = body.indexOf(\"xlink:\") === -1 ? \"\" : ' xmlns:xlink=\"http://www.w3.org/1999/xlink\"';\n for (const attr in attributes) {\n renderAttribsHTML += \" \" + attr + '=\"' + attributes[attr] + '\"';\n }\n return '\" + body + \"\";\n}\n\nfunction encodeSVGforURL(svg) {\n return svg.replace(/\"/g, \"'\").replace(/%/g, \"%25\").replace(/#/g, \"%23\").replace(//g, \"%3E\").replace(/\\s+/g, \" \");\n}\nfunction svgToURL(svg) {\n return 'url(\"data:image/svg+xml,' + encodeSVGforURL(svg) + '\")';\n}\n\n// List of properties to apply\nconst monotoneProps = {\n 'background-color': 'currentColor',\n};\nconst coloredProps = {\n 'background-color': 'transparent',\n};\n// Dynamically add common props to variables above\nconst propsToAdd = {\n image: 'var(--svg)',\n repeat: 'no-repeat',\n size: '100% 100%',\n};\nconst propsToAddTo = {\n '-webkit-mask': monotoneProps,\n 'mask': monotoneProps,\n 'background': coloredProps,\n};\nfor (const prefix in propsToAddTo) {\n const list = propsToAddTo[prefix];\n for (const prop in propsToAdd) {\n list[prefix + '-' + prop] = propsToAdd[prop];\n }\n}\n/**\n * Fix size: add 'px' to numbers\n */\nfunction fixSize(value) {\n return value + (value.match(/^[-0-9.]+$/) ? 'px' : '');\n}\n/**\n * Render node as \n */\nfunction renderSPAN(data, icon, useMask) {\n const node = document.createElement('span');\n // Body\n let body = data.body;\n if (body.indexOf('';\n }\n // Generate SVG as URL\n const renderAttribs = data.attributes;\n const html = iconToHTML(body, {\n ...renderAttribs,\n width: icon.width + '',\n height: icon.height + '',\n });\n const url = svgToURL(html);\n // Generate style\n const svgStyle = node.style;\n const styles = {\n '--svg': url,\n 'width': fixSize(renderAttribs.width),\n 'height': fixSize(renderAttribs.height),\n ...(useMask ? monotoneProps : coloredProps),\n };\n // Apply style\n for (const prop in styles) {\n svgStyle.setProperty(prop, styles[prop]);\n }\n return node;\n}\n\n/**\n * Render node as \n */\nfunction renderSVG(data) {\n const node = document.createElement('span');\n // Generate SVG\n node.innerHTML = iconToHTML(data.body, data.attributes);\n return node.firstChild;\n}\n\n/**\n * Render icon\n */\nfunction renderIcon(parent, state) {\n const iconData = state.icon.data;\n const customisations = state.customisations;\n // Render icon\n const renderData = iconToSVG(iconData, customisations);\n if (customisations.preserveAspectRatio) {\n renderData.attributes['preserveAspectRatio'] =\n customisations.preserveAspectRatio;\n }\n const mode = state.renderedMode;\n let node;\n switch (mode) {\n case 'svg':\n node = renderSVG(renderData);\n break;\n default:\n node = renderSPAN(renderData, {\n ...defaultIconProps,\n ...iconData,\n }, mode === 'mask');\n }\n // Set element\n const oldNode = Array.from(parent.childNodes).find((node) => {\n const tag = node.tagName &&\n node.tagName.toUpperCase();\n return tag === 'SPAN' || tag === 'SVG';\n });\n if (oldNode) {\n // Replace old element\n if (node.tagName === 'SPAN' && oldNode.tagName === node.tagName) {\n // Swap style instead of whole node\n oldNode.setAttribute('style', node.getAttribute('style'));\n }\n else {\n parent.replaceChild(node, oldNode);\n }\n }\n else {\n // Add new element\n parent.appendChild(node);\n }\n}\n\n/**\n * Attribute to add\n */\nconst nodeAttr = 'data-style';\n/**\n * Add/update style node\n */\nfunction updateStyle(parent, inline) {\n // Get node, create if needed\n let styleNode = Array.from(parent.childNodes).find((node) => node.hasAttribute &&\n node.hasAttribute(nodeAttr));\n if (!styleNode) {\n styleNode = document.createElement('style');\n styleNode.setAttribute(nodeAttr, nodeAttr);\n parent.appendChild(styleNode);\n }\n // Update content\n styleNode.textContent =\n ':host{display:inline-block;vertical-align:' +\n (inline ? '-0.125em' : '0') +\n '}span,svg{display:block}';\n}\n\n/**\n * Set state to PendingState\n */\nfunction setPendingState(icon, inline, lastState) {\n const lastRender = lastState &&\n (lastState.rendered\n ? lastState\n : lastState.lastRender);\n return {\n rendered: false,\n inline,\n icon,\n lastRender,\n };\n}\n\n/**\n * Register 'iconify-icon' component, if it does not exist\n */\nfunction defineIconifyIcon(name = 'iconify-icon') {\n // Check for custom elements registry and HTMLElement\n let customElements;\n let ParentClass;\n try {\n customElements = window.customElements;\n ParentClass = window.HTMLElement;\n }\n catch (err) {\n return;\n }\n // Make sure registry and HTMLElement exist\n if (!customElements || !ParentClass) {\n return;\n }\n // Check for duplicate\n const ConflictingClass = customElements.get(name);\n if (ConflictingClass) {\n return ConflictingClass;\n }\n // All attributes\n const attributes = [\n // Icon\n 'icon',\n // Mode\n 'mode',\n 'inline',\n // Customisations\n 'width',\n 'height',\n 'rotate',\n 'flip',\n ];\n /**\n * Component class\n */\n const IconifyIcon = class extends ParentClass {\n // Root\n _shadowRoot;\n // State\n _state;\n // Attributes check queued\n _checkQueued = false;\n /**\n * Constructor\n */\n constructor() {\n super();\n // Attach shadow DOM\n const root = (this._shadowRoot = this.attachShadow({\n mode: 'open',\n }));\n // Add style\n const inline = getInline(this);\n updateStyle(root, inline);\n // Create empty state\n this._state = setPendingState({\n value: '',\n }, inline);\n // Queue icon render\n this._queueCheck();\n }\n /**\n * Observed attributes\n */\n static get observedAttributes() {\n return attributes.slice(0);\n }\n /**\n * Observed properties that are different from attributes\n *\n * Experimental! Need to test with various frameworks that support it\n */\n /*\n static get properties() {\n return {\n inline: {\n type: Boolean,\n reflect: true,\n },\n // Not listing other attributes because they are strings or combination\n // of string and another type. Cannot have multiple types\n };\n }\n */\n /**\n * Attribute has changed\n */\n attributeChangedCallback(name) {\n if (name === 'inline') {\n // Update immediately: not affected by other attributes\n const newInline = getInline(this);\n const state = this._state;\n if (newInline !== state.inline) {\n // Update style if inline mode changed\n state.inline = newInline;\n updateStyle(this._shadowRoot, newInline);\n }\n }\n else {\n // Queue check for other attributes\n this._queueCheck();\n }\n }\n /**\n * Get/set icon\n */\n get icon() {\n const value = this.getAttribute('icon');\n if (value && value.slice(0, 1) === '{') {\n try {\n return JSON.parse(value);\n }\n catch (err) {\n //\n }\n }\n return value;\n }\n set icon(value) {\n if (typeof value === 'object') {\n value = JSON.stringify(value);\n }\n this.setAttribute('icon', value);\n }\n /**\n * Get/set inline\n */\n get inline() {\n return getInline(this);\n }\n set inline(value) {\n this.setAttribute('inline', value ? 'true' : null);\n }\n /**\n * Restart animation\n */\n restartAnimation() {\n const state = this._state;\n if (state.rendered) {\n const root = this._shadowRoot;\n if (state.renderedMode === 'svg') {\n // Update root node\n try {\n root.lastChild.setCurrentTime(0);\n return;\n }\n catch (err) {\n // Failed: setCurrentTime() is not supported\n }\n }\n renderIcon(root, state);\n }\n }\n /**\n * Get status\n */\n get status() {\n const state = this._state;\n return state.rendered\n ? 'rendered'\n : state.icon.data === null\n ? 'failed'\n : 'loading';\n }\n /**\n * Queue attributes re-check\n */\n _queueCheck() {\n if (!this._checkQueued) {\n this._checkQueued = true;\n setTimeout(() => {\n this._check();\n });\n }\n }\n /**\n * Check for changes\n */\n _check() {\n if (!this._checkQueued) {\n return;\n }\n this._checkQueued = false;\n const state = this._state;\n // Get icon\n const newIcon = this.getAttribute('icon');\n if (newIcon !== state.icon.value) {\n this._iconChanged(newIcon);\n return;\n }\n // Ignore other attributes if icon is not rendered\n if (!state.rendered) {\n return;\n }\n // Check for mode and attribute changes\n const mode = this.getAttribute('mode');\n const customisations = getCustomisations(this);\n if (state.attrMode !== mode ||\n haveCustomisationsChanged(state.customisations, customisations)) {\n this._renderIcon(state.icon, customisations, mode);\n }\n }\n /**\n * Icon value has changed\n */\n _iconChanged(newValue) {\n const icon = parseIconValue(newValue, (value, name, data) => {\n // Asynchronous callback: re-check values to make sure stuff wasn't changed\n const state = this._state;\n if (state.rendered || this.getAttribute('icon') !== value) {\n // Icon data is already available or icon attribute was changed\n return;\n }\n // Change icon\n const icon = {\n value,\n name,\n data,\n };\n if (icon.data) {\n // Render icon\n this._gotIconData(icon);\n }\n else {\n // Nothing to render: update icon in state\n state.icon = icon;\n }\n });\n if (icon.data) {\n // Icon is ready to render\n this._gotIconData(icon);\n }\n else {\n // Pending icon\n this._state = setPendingState(icon, this._state.inline, this._state);\n }\n }\n /**\n * Got new icon data, icon is ready to (re)render\n */\n _gotIconData(icon) {\n this._checkQueued = false;\n this._renderIcon(icon, getCustomisations(this), this.getAttribute('mode'));\n }\n /**\n * Re-render based on icon data\n */\n _renderIcon(icon, customisations, attrMode) {\n // Get mode\n const renderedMode = getRenderMode(icon.data.body, attrMode);\n // Inline was not changed\n const inline = this._state.inline;\n // Set state and render\n renderIcon(this._shadowRoot, (this._state = {\n rendered: true,\n icon,\n inline,\n customisations,\n attrMode,\n renderedMode,\n }));\n }\n };\n // Add getters and setters\n attributes.forEach((attr) => {\n if (!(attr in IconifyIcon.prototype)) {\n Object.defineProperty(IconifyIcon.prototype, attr, {\n get: function () {\n return this.getAttribute(attr);\n },\n set: function (value) {\n this.setAttribute(attr, value);\n },\n });\n }\n });\n // Add exported functions: both as static and instance methods\n const functions = exportFunctions();\n for (const key in functions) {\n IconifyIcon[key] = IconifyIcon.prototype[key] = functions[key];\n }\n // Define new component\n customElements.define(name, IconifyIcon);\n return IconifyIcon;\n}\n\n/**\n * Create exported data: either component instance or functions\n */\nconst IconifyIconComponent = defineIconifyIcon() || exportFunctions();\n/**\n * Export functions\n */\nconst { enableCache, disableCache, iconExists, getIcon, listIcons, addIcon, addCollection, calculateSize, buildIcon, loadIcons, loadIcon, addAPIProvider, _api, } = IconifyIconComponent;\n\nexport { IconifyIconComponent, _api, addAPIProvider, addCollection, addIcon, buildIcon, calculateSize, disableCache, enableCache, getIcon, iconExists, listIcons, loadIcon, loadIcons };\n","import { css, html } from 'lit';\nimport DtBase from '../dt-base.js';\nimport 'iconify-icon';\n\nexport class DtIcon extends DtBase {\n static get styles() {\n return css`\n :root {\n font-size: inherit;\n color: inherit;\n display: inline-flex;\n width: fit-content;\n height: fit-content;\n position: relative;\n }\n .tooltip {\n position: absolute;\n right: 20px;\n top: -50%;\n min-width: max-content;\n border: solid 1px currentcolor;\n background-color: var(--dt-form-background-color, var(--surface-1));\n padding: .25rem;\n border-radius: .25rem;\n text-align: end;\n z-index: 1;\n display:block;\n }\n .tooltip:before {\n position: absolute;\n right: .7rem;\n top: 1.45rem;\n content: \" \";\n border-width: .25rem;\n border-style: solid;\n border-color: transparent transparent currentcolor transparent;\n }\n .tooltip[hidden] {\n display: none;\n }\n `;\n }\n\n static get properties() {\n return {\n ...super.properties,\n icon: { type: String },\n tooltip: { type: String },\n tooltip_open: { type: Boolean },\n size: { type: String },\n };\n }\n\n _showTooltip() {\n if (this.tooltip_open){\n this.tooltip_open = false;\n } else {\n this.tooltip_open = true;\n }\n }\n\n render() {\n const tooltip = this.tooltip ? html`
    ${this.tooltip}
    ` : null;\n return html`\n \n ${tooltip}\n `;\n }\n}\n\nwindow.customElements.define('dt-icon', DtIcon);\n"],"names":["defaultIconDimensions","Object","freeze","left","top","width","height","defaultIconTransformations","rotate","vFlip","hFlip","defaultIconProps","defaultExtendedIconProps","body","hidden","defaultIconSizeCustomisations","defaultIconCustomisations","separator","defaultCustomisations","preserveAspectRatio","getCustomisations","node","customisations","attr","key","def","getAttribute","custom","value","defaultValue","units","replace","cleanup","value2","num","parseInt","isNaN","split","parseFloat","slice","length","rotateFromString","forEach","str","trim","matchIconName","stringToIcon","validate","allowSimpleName","provider","colonSeparated","shift","name2","pop","prefix","result","name","validateIconName","dashSeparated","join","icon","match","mergeIconData","parent","child","obj1","obj2","mergeIconTransformations","internalGetIconData","data","tree","icons","aliases","create","currentProps","parse","parseIconSet","callback","names","not_found","Array","push","resolved","keys","concat","resolve","getIconsTree","item","optionalPropertyDefaults","checkOptionalProps","defaults","prop","quicklyValidateIconSet","obj","dataStorage","getStorage","providerStorage","missing","Set","newStorage","addIconSet","storage","add","listIcons$1","allIcons","provider2","prefix2","map","simpleNames","allowSimpleNames","allow","getIconData","iconName","has","addIcon$1","err","addIconToStorage","addCollection$1","added","iconExists$1","getIcon$1","removeCallback","storages","id","items","loaderCallbacks","filter","row","idCounter","setAPIModule","getAPIModule","defaultConfig","resources","index","timeout","random","dataAfterTimeout","sendQuery","config","payload","query","done","resourcesCount","startIndex","Math","floor","list","nextIndex","startTime","Date","now","lastError","status","queriesSent","timer","queue","doneCallbacks","resetTimer","clearTimeout","abort","subscribe","overwrite","failQuery","clearQueue","execNext","resource","setTimeout","status2","response","isError","queued","indexOf","moduleResponse","queriesPending","initRedundancy","cfg","queries","queryCallback","doneCallback","query2","error","find","setIndex","getIndex","createAPIConfig","source","path","maxURL","configStorage","fallBackAPISources","fallBackAPI","addAPIProvider$1","customConfig","getAPIConfig","listAPIProviders","emptyCallback$1","redundancyCache","sendAPIQuery","target","redundancy","send","api","cached","cachedReundancy","getRedundancyCache","getStoredItem","func","getItem","setStoredItem","setItem","removeStoredItem","removeItem","setBrowserStorageItemsCount","browserCachePrefix","toString","getBrowserStorageItemsCount","browserStorageConfig","local","session","browserStorageEmptyItems","browserStorageStatus","_window","window","getBrowserStorage","iterateBrowserStorage","version","total2","i","minTime","parseItem","JSON","total","initBrowserStorage","iconSet","lastModified","lastModifiedCached","min","storeInBrowserStorage","store","set","size","delete","from","stringify","lastValue","updateLastModified","assign","emptyCallback","loadedNewIcons","iconsLoaderFlag","pendingCallbacksFlag","hasPending","oldLength","pending","loaded","updateCallbacks","loadIcons$1","cleanedIcons","listToIcons","sortedIcons","sort","a","b","localeCompare","lastIcon","localStorage","sortIcons","callCallback","newIcons","sources","lastProvider","lastPrefix","providerNewIcons","pendingQueue","pendingIcons","iconsToLoad","iconsQueueFlag","icons2","prepare","parsed","console","loadNewIcons","pendingSources","bind","storeCallback","loadIcon$1","Promise","fulfill","reject","iconObj","parseIconValue","onload","testIconObject","loading","getInline","hasAttribute","isBuggedSafari","navigator","vendor","unitsSplit","unitsTest","calculateSize$1","ratio","precision","ceil","oldParts","newParts","code","isNumber","test","iconToSVG","fullIcon","fullCustomisations","box","props","transformations","tempValue","rotation","unshift","customisationsWidth","customisationsHeight","boxWidth","boxHeight","attributes","viewBox","fetchModule","fetch","detectFetch","setFetch","fetch2","getFetch","fetchAPIModule","results","maxLength","maxHostLength","host","max","url","calculateMaxLength","type","params","getPath","iconsList","URLSearchParams","uri","defaultError","then","json","shouldAbort","catch","toggleBrowserCache","exportFunctions","IconifyPreload","preload","e","IconifyProviders","providers","enableCache","disableCache","iconExists","getIcon","listIcons","addIcon","addCollection","calculateSize","buildIcon","loadIcons","loadIcon","addAPIProvider","_api","iconToHTML","renderAttribsHTML","monotoneProps","coloredProps","propsToAdd","image","repeat","propsToAddTo","mask","background","fixSize","renderIcon","state","iconData","renderData","mode","renderedMode","document","createElement","innerHTML","firstChild","renderSVG","useMask","renderAttribs","svg","svgStyle","style","styles","setProperty","renderSPAN","oldNode","childNodes","tag","tagName","toUpperCase","setAttribute","replaceChild","appendChild","updateStyle","inline","styleNode","textContent","setPendingState","lastState","rendered","lastRender","customElements","ParentClass","HTMLElement","ConflictingClass","get","IconifyIcon","_shadowRoot","_state","_checkQueued","constructor","super","root","this","attachShadow","_queueCheck","observedAttributes","attributeChangedCallback","newInline","restartAnimation","lastChild","setCurrentTime","_check","newIcon","_iconChanged","attrMode","value1","haveCustomisationsChanged","_renderIcon","newValue","_gotIconData","getRenderMode","prototype","defineProperty","functions","define","defineIconifyIcon","DtBase","css","properties","String","tooltip","tooltip_open","Boolean","_showTooltip","render","html"],"mappings":";;;;;;;;;;;EAWA,MAAMA,EAAwBC,OAAOC,OACnC,CACEC,KAAM,EACNC,IAAK,EACLC,MAAO,GACPC,OAAQ,KAGNC,EAA6BN,OAAOC,OAAO,CAC/CM,OAAQ,EACRC,OAAO,EACPC,OAAO,IAEHC,EAAmBV,OAAOC,OAAO,IAClCF,KACAO,IAECK,EAA2BX,OAAOC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AKlZ,aAAaH,EAC5B,EACDwN,IAAK,SAAUnN,GACXgZ,KAAKvB,aAAa9X,EAAMK,EAC3B,GAER,IAGL,MAAMqa,EAAYlG,KAClB,IAAK,MAAMvU,KAAOya,EACd5B,EAAY7Y,GAAO6Y,EAAY0B,UAAUva,GAAOya,EAAUza,GAI9D,OADAwY,EAAekC,OAAO1Y,EAAM6W,GACrBA,CACX,EAK6B8B,IAAuBpG,KC7iEpDjI,OAAOkM,eAAekC,OAAO,UAlEtB,cAAqBE,EACfvD,oBACT,OAAOwD,CAAG,4iBAmCX,CAEUC,wBACT,MAAO,IACF5B,MAAM4B,WACT1Y,KAAM,CAAEuR,KAAMoH,QACdC,QAAS,CAAErH,KAAMoH,QACjBE,aAAc,CAAEtH,KAAMuH,SACtB1N,KAAM,CAAEmG,KAAMoH,QAEjB,CAEDI,eACM/B,KAAK6B,aACP7B,KAAK6B,cAAe,EAEpB7B,KAAK6B,cAAe,CAEvB,CAEDG,SACE,MAAMJ,EAAU5B,KAAK4B,QAAUK,CAAI,iCAAgCjC,KAAK6B,iBAAgB7B,KAAK4B,gBAAkB,KAC/G,OAAOK,CAAI,uBACYjC,KAAKhX,gBAAegX,KAAK5L,iBAAgB4L,KAAK+B,gCACjEH,GAEL"} \ No newline at end of file diff --git a/dt-assets/build/components/icons/dt-spinner.js b/dt-assets/build/components/icons/dt-spinner.js index 4ba110ecab..3e71a77c35 100644 --- a/dt-assets/build/components/icons/dt-spinner.js +++ b/dt-assets/build/components/icons/dt-spinner.js @@ -1 +1,10 @@ -import{s as e,i as r}from"../lit-element-2409d5fe.js";window.customElements.define("dt-spinner",class extends e{static get styles(){return r`@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}:host::before{content:'';animation:spin 1s linear infinite;border:.25rem solid var(--dt-spinner-color-1,#919191);border-radius:50%;border-top-color:var(--dt-spinner-color-2,#000);display:inline-block;height:1rem;width:1rem}`}}); +import { s as e, i as r } from '../lit-element-2409d5fe.js'; +window.customElements.define( + 'dt-spinner', + class extends e { + static get styles() { + return r`@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}:host::before{content:'';animation:spin 1s linear infinite;border:.25rem solid var(--dt-spinner-color-1,#919191);border-radius:50%;border-top-color:var(--dt-spinner-color-2,#000);display:inline-block;height:1rem;width:1rem}`; + } + }, +); +//# sourceMappingURL=dt-spinner.js.map diff --git a/dt-assets/build/components/icons/dt-spinner.js.map b/dt-assets/build/components/icons/dt-spinner.js.map new file mode 100644 index 0000000000..d3954db466 --- /dev/null +++ b/dt-assets/build/components/icons/dt-spinner.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-spinner.js","sources":["../../src/components/icons/dt-spinner.js"],"sourcesContent":["import { css, LitElement } from 'lit';\n\nexport class DtSpinner extends LitElement {\n static get styles() {\n return css`\n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n }\n :host::before {\n content: '';\n animation: spin 1s linear infinite;\n border: 0.25rem solid var(--dt-spinner-color-1, #919191);\n border-radius: 50%;\n border-top-color: var(--dt-spinner-color-2, #000);\n display: inline-block;\n height: 1rem;\n width: 1rem;\n }\n `;\n }\n}\n\nwindow.customElements.define('dt-spinner', DtSpinner);\n"],"names":["window","customElements","define","LitElement","styles","css"],"mappings":"sDA4BAA,OAAOC,eAAeC,OAAO,aA1BtB,cAAwBC,EAClBC,oBACT,OAAOC,CAAG,uSAqBX"} \ No newline at end of file diff --git a/dt-assets/build/components/icons/dt-star.js b/dt-assets/build/components/icons/dt-star.js index 21f32d817d..10dec086bf 100644 --- a/dt-assets/build/components/icons/dt-star.js +++ b/dt-assets/build/components/icons/dt-star.js @@ -1 +1,29 @@ -import{s as e,i as t,y as s}from"../lit-element-2409d5fe.js";window.customElements.define("dt-star",class extends e{static get styles(){return t`:host{fill:var(--star-unselected-color,#c7c6c1)}:host([selected]){fill:var(--star-unselected-color,#ffc005)}`}static get properties(){return{postID:{type:Number},selected:{type:Boolean,reflect:!0}}}_onclick(){this.selected=!this.selected;const e=new CustomEvent("change",{detail:{postID:this.postID,favorited:this.selected}});this.dispatchEvent(e)}_keyUp(e){13===(e.keyCode||e.which)&&this._onclick()}render(){return s``}}); +import { s as e, i as t, y as s } from '../lit-element-2409d5fe.js'; +window.customElements.define( + 'dt-star', + class extends e { + static get styles() { + return t`:host{fill:var(--star-unselected-color,#c7c6c1)}:host([selected]){fill:var(--star-unselected-color,#ffc005)}`; + } + static get properties() { + return { + postID: { type: Number }, + selected: { type: Boolean, reflect: !0 }, + }; + } + _onclick() { + this.selected = !this.selected; + const e = new CustomEvent('change', { + detail: { postID: this.postID, favorited: this.selected }, + }); + this.dispatchEvent(e); + } + _keyUp(e) { + 13 === (e.keyCode || e.which) && this._onclick(); + } + render() { + return s``; + } + }, +); +//# sourceMappingURL=dt-star.js.map diff --git a/dt-assets/build/components/icons/dt-star.js.map b/dt-assets/build/components/icons/dt-star.js.map new file mode 100644 index 0000000000..601852e4c1 --- /dev/null +++ b/dt-assets/build/components/icons/dt-star.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-star.js","sources":["../../src/components/icons/dt-star.js"],"sourcesContent":["import { html, css, LitElement } from 'lit';\n\nexport class DtStar extends LitElement {\n static get styles() {\n return css`\n :host {\n fill: var(--star-unselected-color, #c7c6c1);\n }\n :host([selected]) {\n fill: var(--star-unselected-color, hsl(45, 100%, 51%));\n }\n `;\n }\n\n static get properties() {\n return {\n postID: { type: Number },\n selected: { type: Boolean, reflect: true },\n };\n }\n\n _onclick() {\n this.selected = !this.selected;\n\n const event = new CustomEvent('change', {\n detail: {\n postID: this.postID,\n favorited: this.selected,\n },\n });\n\n this.dispatchEvent(event);\n }\n\n _keyUp(e) {\n // If key pressed was enter, simulate a click\n const keycode = e.keyCode || e.which;\n\n if (keycode === 13) {\n // Enter\n this._onclick();\n }\n }\n\n render() {\n return html`\n \n \n \n `;\n }\n}\n\nwindow.customElements.define('dt-star', DtStar);\n"],"names":["window","customElements","define","LitElement","styles","css","properties","postID","type","Number","selected","Boolean","reflect","_onclick","this","event","CustomEvent","detail","favorited","dispatchEvent","_keyUp","e","keyCode","which","render","html"],"mappings":"6DAgEAA,OAAOC,eAAeC,OAAO,UA9DtB,cAAqBC,EACfC,oBACT,OAAOC,CAAG,8GAQX,CAEUC,wBACT,MAAO,CACLC,OAAQ,CAAEC,KAAMC,QAChBC,SAAU,CAAEF,KAAMG,QAASC,SAAS,GAEvC,CAEDC,WACEC,KAAKJ,UAAYI,KAAKJ,SAEtB,MAAMK,EAAQ,IAAIC,YAAY,SAAU,CACtCC,OAAQ,CACNV,OAAQO,KAAKP,OACbW,UAAWJ,KAAKJ,YAIpBI,KAAKK,cAAcJ,EACpB,CAEDK,OAAOC,GAIW,MAFAA,EAAEC,SAAWD,EAAEE,QAI7BT,KAAKD,UAER,CAEDW,SACE,OAAOC,CAAI,gBAEGX,KAAKD,qBACLC,KAAKM,uuBAapB"} \ No newline at end of file diff --git a/dt-assets/build/components/icons/index.js b/dt-assets/build/components/icons/index.js index 9b56558f6f..93ce32827c 100644 --- a/dt-assets/build/components/icons/index.js +++ b/dt-assets/build/components/icons/index.js @@ -1 +1,9 @@ -import"./dt-checkmark.js";import"./dt-exclamation-circle.js";import"./dt-icon.js";import"./dt-spinner.js";import"./dt-star.js";import"../lit-element-2409d5fe.js";import"../dt-base.js";import"../lit-localize-763e4978.js"; +import './dt-checkmark.js'; +import './dt-exclamation-circle.js'; +import './dt-icon.js'; +import './dt-spinner.js'; +import './dt-star.js'; +import '../lit-element-2409d5fe.js'; +import '../dt-base.js'; +import '../lit-localize-763e4978.js'; +//# sourceMappingURL=index.js.map diff --git a/dt-assets/build/components/icons/index.js.map b/dt-assets/build/components/icons/index.js.map new file mode 100644 index 0000000000..c8e9b4f445 --- /dev/null +++ b/dt-assets/build/components/icons/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/if-defined-11ddebeb.js b/dt-assets/build/components/if-defined-11ddebeb.js index 14a8883944..ff0325fc8f 100644 --- a/dt-assets/build/components/if-defined-11ddebeb.js +++ b/dt-assets/build/components/if-defined-11ddebeb.js @@ -1,6 +1,8 @@ -import{b as e}from"./lit-element-2409d5fe.js"; +import { b as e } from './lit-element-2409d5fe.js'; /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const t=t=>null!=t?t:e;export{t as l}; + */ const t = (t) => (null != t ? t : e); +export { t as l }; +//# sourceMappingURL=if-defined-11ddebeb.js.map diff --git a/dt-assets/build/components/if-defined-11ddebeb.js.map b/dt-assets/build/components/if-defined-11ddebeb.js.map new file mode 100644 index 0000000000..ffb30f4743 --- /dev/null +++ b/dt-assets/build/components/if-defined-11ddebeb.js.map @@ -0,0 +1 @@ +{"version":3,"file":"if-defined-11ddebeb.js","sources":["../node_modules/lit-html/directives/if-defined.js"],"sourcesContent":["import{nothing as t}from\"../lit-html.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const l=l=>null!=l?l:t;export{l as ifDefined};\n//# sourceMappingURL=if-defined.js.map\n"],"names":["l","t"],"mappings":";;;;;GAKQ,MAACA,EAAEA,GAAG,MAAMA,EAAEA,EAAEC"} \ No newline at end of file diff --git a/dt-assets/build/components/index.js b/dt-assets/build/components/index.js index ed5b1c268c..245da49600 100644 --- a/dt-assets/build/components/index.js +++ b/dt-assets/build/components/index.js @@ -1 +1,39 @@ -import"./form/dt-button/dt-button.js";import"./form/dt-church-health-circle/dt-church-health-circle.js";import"./form/dt-connection/dt-connection.js";import"./form/dt-date/dt-date.js";import"./form/dt-label/dt-label.js";import"./form/dt-location/dt-location.js";import"./form/dt-location-map/dt-location-map.js";import"./form/dt-multi-select/dt-multi-select.js";import"./form/dt-number/dt-number.js";import"./form/dt-single-select/dt-single-select.js";import"./form/dt-tags/dt-tags.js";import"./form/dt-text/dt-text.js";import"./form/dt-textarea/dt-textarea.js";import"./form/dt-toggle/dt-toggle.js";import"./form/dt-communication-channel/dt-comm-channel.js";import"./icons/dt-checkmark.js";import"./icons/dt-exclamation-circle.js";import"./icons/dt-icon.js";import"./icons/dt-spinner.js";import"./icons/dt-star.js";import"./layout/dt-alert/dt-alert.js";import"./layout/dt-list/dt-list.js";import"./layout/dt-modal/dt-modal.js";import"./layout/dt-tile/dt-tile.js";import"./lit-element-2409d5fe.js";import"./class-map-8d921948.js";import"./directive-de55b00a.js";import"./dt-base.js";import"./lit-localize-763e4978.js";import"./form/dt-church-health-circle/dt-church-health-circle-icon.js";import"./form/dt-form-base.js";import"./style-map-ac85d91b.js";import"./map-c0e24c36.js";import"./repeat-1a2b8966.js";import"./form/dt-location-map/dt-location-map-item.js";import"./form/dt-location-map/dt-map-modal.js";import"./form/mixins/hasOptionsList.js";import"./if-defined-11ddebeb.js"; +import './form/dt-button/dt-button.js'; +import './form/dt-church-health-circle/dt-church-health-circle.js'; +import './form/dt-connection/dt-connection.js'; +import './form/dt-date/dt-date.js'; +import './form/dt-label/dt-label.js'; +import './form/dt-location/dt-location.js'; +import './form/dt-location-map/dt-location-map.js'; +import './form/dt-multi-select/dt-multi-select.js'; +import './form/dt-number/dt-number.js'; +import './form/dt-single-select/dt-single-select.js'; +import './form/dt-tags/dt-tags.js'; +import './form/dt-text/dt-text.js'; +import './form/dt-textarea/dt-textarea.js'; +import './form/dt-toggle/dt-toggle.js'; +import './form/dt-communication-channel/dt-comm-channel.js'; +import './icons/dt-checkmark.js'; +import './icons/dt-exclamation-circle.js'; +import './icons/dt-icon.js'; +import './icons/dt-spinner.js'; +import './icons/dt-star.js'; +import './layout/dt-alert/dt-alert.js'; +import './layout/dt-list/dt-list.js'; +import './layout/dt-modal/dt-modal.js'; +import './layout/dt-tile/dt-tile.js'; +import './lit-element-2409d5fe.js'; +import './class-map-8d921948.js'; +import './directive-de55b00a.js'; +import './dt-base.js'; +import './lit-localize-763e4978.js'; +import './form/dt-church-health-circle/dt-church-health-circle-icon.js'; +import './form/dt-form-base.js'; +import './style-map-ac85d91b.js'; +import './map-c0e24c36.js'; +import './repeat-1a2b8966.js'; +import './form/dt-location-map/dt-location-map-item.js'; +import './form/dt-location-map/dt-map-modal.js'; +import './form/mixins/hasOptionsList.js'; +import './if-defined-11ddebeb.js'; +//# sourceMappingURL=index.js.map diff --git a/dt-assets/build/components/index.js.map b/dt-assets/build/components/index.js.map new file mode 100644 index 0000000000..c8e9b4f445 --- /dev/null +++ b/dt-assets/build/components/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/layout/dt-alert/dt-alert.js b/dt-assets/build/components/layout/dt-alert/dt-alert.js index 02c8a11d9f..a4bff3b819 100644 --- a/dt-assets/build/components/layout/dt-alert/dt-alert.js +++ b/dt-assets/build/components/layout/dt-alert/dt-alert.js @@ -1 +1,45 @@ -import{i as t,y as r}from"../../lit-element-2409d5fe.js";import{o as e}from"../../class-map-8d921948.js";import{D as o}from"../../dt-base.js";import"../../directive-de55b00a.js";import"../../lit-localize-763e4978.js";window.customElements.define("dt-alert",class extends o{static get styles(){return t`:host{display:block}.dt-alert{padding:var(--dt-alert-padding,10px);font-family:var(--dt-alert-font-family);font-size:var(--dt-alert-font-size,14px);font-weight:var(--dt-alert-font-weight,700);background-color:var(--dt-alert-context-background-color,var(--dt-alert-background-color));border:var(--dt-alert-border-width,1px) solid var(--dt-alert-context-border-color,var(--dt-alert-border-color));border-radius:var(--dt-alert-border-radius,10px);box-shadow:var(--dt-alert-box-shadow,0 2px 4px rgb(0 0 0 / 25%));color:var(--dt-alert-context-text-color,var(--dt-alert-text-color));text-rendering:optimizeLegibility;display:flex;gap:var(--dt-alert-gap,10px);justify-content:space-between;align-content:center;align-items:center;white-space:initial}.dt-alert.dt-alert--outline{background-color:transparent;color:var(--dt-alert-context-text-color,var(--text-color-inverse))}.dt-alert--primary:not(.dt-alert--outline){--dt-alert-context-border-color:var(--primary-color);--dt-alert-context-background-color:var(--primary-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--alert:not(.dt-alert--outline){--dt-alert-context-border-color:var(--alert-color);--dt-alert-context-background-color:var(--alert-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--caution:not(.dt-alert--outline){--dt-alert-context-border-color:var(--caution-color);--dt-alert-context-background-color:var(--caution-color);--dt-alert-context-text-color:var(--dt-alert-text-color-dark)}.dt-alert--success:not(.dt-alert--outline){--dt-alert-context-border-color:var(--success-color);--dt-alert-context-background-color:var(--success-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--inactive:not(.dt-alert--outline){--dt-alert-context-border-color:var(--inactive-color);--dt-alert-context-background-color:var(--inactive-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--disabled:not(.dt-alert--outline){--dt-alert-context-border-color:var(--disabled-color);--dt-alert-context-background-color:var(--disabled-color);--dt-alert-context-text-color:var(--dt-alert-text-color-dark)}.dt-alert--primary.dt-alert--outline{--dt-alert-context-border-color:var(--primary-color);--dt-alert-context-text-color:var(--primary-color)}.dt-alert--alert.dt-alert--outline{--dt-alert-context-border-color:var(--alert-color);--dt-alert-context-text-color:var(--alert-color)}.dt-alert--caution.dt-alert--outline{--dt-alert-context-border-color:var(--caution-color);--dt-alert-context-text-color:var(--caution-color)}.dt-alert--success.dt-alert--outline{--dt-alert-context-border-color:var(--success-color);--dt-alert-context-text-color:var(--success-color)}.dt-alert--inactive.dt-alert--outline{--dt-alert-context-border-color:var(--inactive-color)}.dt-alert--disabled.dt-alert--outline{--dt-alert-context-border-color:var(--disabled-color)}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none;color:inherit;cursor:pointer;display:flex;align-items:center}`}static get properties(){return{context:{type:String},dismissable:{type:Boolean},timeout:{type:Number},hide:{type:Boolean},outline:{type:Boolean}}}get classes(){const t={"dt-alert":!0,"dt-alert--outline":this.outline};return t[`dt-alert--${this.context}`]=!0,t}constructor(){super(),this.context="default"}connectedCallback(){super.connectedCallback(),this.timeout&&setTimeout((()=>{this._dismiss()}),this.timeout)}_dismiss(){this.hide=!0}render(){if(this.hide)return r``;const t=r`xmlns="http://www.w3.org/2000/svg">`;return r``}}); +import { i as t, y as r } from '../../lit-element-2409d5fe.js'; +import { o as e } from '../../class-map-8d921948.js'; +import { D as o } from '../../dt-base.js'; +import '../../directive-de55b00a.js'; +import '../../lit-localize-763e4978.js'; +window.customElements.define( + 'dt-alert', + class extends o { + static get styles() { + return t`:host{display:block}.dt-alert{padding:var(--dt-alert-padding,10px);font-family:var(--dt-alert-font-family);font-size:var(--dt-alert-font-size,14px);font-weight:var(--dt-alert-font-weight,700);background-color:var(--dt-alert-context-background-color,var(--dt-alert-background-color));border:var(--dt-alert-border-width,1px) solid var(--dt-alert-context-border-color,var(--dt-alert-border-color));border-radius:var(--dt-alert-border-radius,10px);box-shadow:var(--dt-alert-box-shadow,0 2px 4px rgb(0 0 0 / 25%));color:var(--dt-alert-context-text-color,var(--dt-alert-text-color));text-rendering:optimizeLegibility;display:flex;gap:var(--dt-alert-gap,10px);justify-content:space-between;align-content:center;align-items:center;white-space:initial}.dt-alert.dt-alert--outline{background-color:transparent;color:var(--dt-alert-context-text-color,var(--text-color-inverse))}.dt-alert--primary:not(.dt-alert--outline){--dt-alert-context-border-color:var(--primary-color);--dt-alert-context-background-color:var(--primary-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--alert:not(.dt-alert--outline){--dt-alert-context-border-color:var(--alert-color);--dt-alert-context-background-color:var(--alert-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--caution:not(.dt-alert--outline){--dt-alert-context-border-color:var(--caution-color);--dt-alert-context-background-color:var(--caution-color);--dt-alert-context-text-color:var(--dt-alert-text-color-dark)}.dt-alert--success:not(.dt-alert--outline){--dt-alert-context-border-color:var(--success-color);--dt-alert-context-background-color:var(--success-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--inactive:not(.dt-alert--outline){--dt-alert-context-border-color:var(--inactive-color);--dt-alert-context-background-color:var(--inactive-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--disabled:not(.dt-alert--outline){--dt-alert-context-border-color:var(--disabled-color);--dt-alert-context-background-color:var(--disabled-color);--dt-alert-context-text-color:var(--dt-alert-text-color-dark)}.dt-alert--primary.dt-alert--outline{--dt-alert-context-border-color:var(--primary-color);--dt-alert-context-text-color:var(--primary-color)}.dt-alert--alert.dt-alert--outline{--dt-alert-context-border-color:var(--alert-color);--dt-alert-context-text-color:var(--alert-color)}.dt-alert--caution.dt-alert--outline{--dt-alert-context-border-color:var(--caution-color);--dt-alert-context-text-color:var(--caution-color)}.dt-alert--success.dt-alert--outline{--dt-alert-context-border-color:var(--success-color);--dt-alert-context-text-color:var(--success-color)}.dt-alert--inactive.dt-alert--outline{--dt-alert-context-border-color:var(--inactive-color)}.dt-alert--disabled.dt-alert--outline{--dt-alert-context-border-color:var(--disabled-color)}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none;color:inherit;cursor:pointer;display:flex;align-items:center}`; + } + static get properties() { + return { + context: { type: String }, + dismissable: { type: Boolean }, + timeout: { type: Number }, + hide: { type: Boolean }, + outline: { type: Boolean }, + }; + } + get classes() { + const t = { 'dt-alert': !0, 'dt-alert--outline': this.outline }; + return (t[`dt-alert--${this.context}`] = !0), t; + } + constructor() { + super(), (this.context = 'default'); + } + connectedCallback() { + super.connectedCallback(), + this.timeout && + setTimeout(() => { + this._dismiss(); + }, this.timeout); + } + _dismiss() { + this.hide = !0; + } + render() { + if (this.hide) return r``; + const t = r`xmlns="http://www.w3.org/2000/svg">`; + return r``; + } + }, +); +//# sourceMappingURL=dt-alert.js.map diff --git a/dt-assets/build/components/layout/dt-alert/dt-alert.js.map b/dt-assets/build/components/layout/dt-alert/dt-alert.js.map new file mode 100644 index 0000000000..9c5e0c1ccd --- /dev/null +++ b/dt-assets/build/components/layout/dt-alert/dt-alert.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-alert.js","sources":["../../../src/components/layout/dt-alert/dt-alert.js"],"sourcesContent":["import { html, css } from 'lit';\n// import { msg } from '@lit/localize';\nimport { classMap } from 'lit/directives/class-map.js';\nimport DtBase from '../../dt-base.js';\n\nexport class DtAlert extends DtBase {\n static get styles() {\n return css`\n :host {\n display: block;\n }\n\n .dt-alert {\n padding: var(--dt-alert-padding, 10px);\n font-family: var(--dt-alert-font-family);\n font-size: var(--dt-alert-font-size, 14px);\n font-weight: var(--dt-alert-font-weight, 700);\n background-color: var(\n --dt-alert-context-background-color,\n var(--dt-alert-background-color)\n );\n border: var(--dt-alert-border-width, 1px) solid\n var(--dt-alert-context-border-color, var(--dt-alert-border-color));\n border-radius: var(--dt-alert-border-radius, 10px);\n box-shadow: var(--dt-alert-box-shadow, 0 2px 4px rgb(0 0 0 / 25%));\n color: var(--dt-alert-context-text-color, var(--dt-alert-text-color));\n text-rendering: optimizeLegibility;\n display: flex;\n gap: var(--dt-alert-gap, 10px);\n justify-content: space-between;\n align-content: center;\n align-items: center;\n white-space: initial;\n }\n\n .dt-alert.dt-alert--outline {\n background-color: transparent;\n color: var(--dt-alert-context-text-color, var(--text-color-inverse));\n }\n\n .dt-alert--primary:not(.dt-alert--outline) {\n --dt-alert-context-border-color: var(--primary-color);\n --dt-alert-context-background-color: var(--primary-color);\n --dt-alert-context-text-color: var(--dt-alert-text-color-light);\n }\n\n .dt-alert--alert:not(.dt-alert--outline) {\n --dt-alert-context-border-color: var(--alert-color);\n --dt-alert-context-background-color: var(--alert-color);\n --dt-alert-context-text-color: var(--dt-alert-text-color-light);\n }\n\n .dt-alert--caution:not(.dt-alert--outline) {\n --dt-alert-context-border-color: var(--caution-color);\n --dt-alert-context-background-color: var(--caution-color);\n --dt-alert-context-text-color: var(--dt-alert-text-color-dark);\n }\n\n .dt-alert--success:not(.dt-alert--outline) {\n --dt-alert-context-border-color: var(--success-color);\n --dt-alert-context-background-color: var(--success-color);\n --dt-alert-context-text-color: var(--dt-alert-text-color-light);\n }\n\n .dt-alert--inactive:not(.dt-alert--outline) {\n --dt-alert-context-border-color: var(--inactive-color);\n --dt-alert-context-background-color: var(--inactive-color);\n --dt-alert-context-text-color: var(--dt-alert-text-color-light);\n }\n\n .dt-alert--disabled:not(.dt-alert--outline) {\n --dt-alert-context-border-color: var(--disabled-color);\n --dt-alert-context-background-color: var(--disabled-color);\n --dt-alert-context-text-color: var(--dt-alert-text-color-dark);\n }\n\n .dt-alert--primary.dt-alert--outline {\n --dt-alert-context-border-color: var(--primary-color);\n --dt-alert-context-text-color: var(--primary-color);\n }\n\n .dt-alert--alert.dt-alert--outline {\n --dt-alert-context-border-color: var(--alert-color);\n --dt-alert-context-text-color: var(--alert-color);\n }\n\n .dt-alert--caution.dt-alert--outline {\n --dt-alert-context-border-color: var(--caution-color);\n --dt-alert-context-text-color: var(--caution-color);\n }\n\n .dt-alert--success.dt-alert--outline {\n --dt-alert-context-border-color: var(--success-color);\n --dt-alert-context-text-color: var(--success-color);\n }\n\n .dt-alert--inactive.dt-alert--outline {\n --dt-alert-context-border-color: var(--inactive-color);\n }\n\n .dt-alert--disabled.dt-alert--outline {\n --dt-alert-context-border-color: var(--disabled-color);\n }\n\n button.toggle {\n margin-inline-end: 0;\n margin-inline-start: auto;\n background: none;\n border: none;\n color: inherit;\n cursor: pointer;\n display: flex;\n align-items: center;\n }\n `;\n }\n\n static get properties() {\n return {\n context: { type: String },\n dismissable: { type: Boolean },\n timeout: { type: Number },\n hide: { type: Boolean },\n outline: { type: Boolean },\n };\n }\n\n get classes() {\n const classes = {\n 'dt-alert': true,\n 'dt-alert--outline': this.outline,\n };\n const contextClass = `dt-alert--${this.context}`;\n classes[contextClass] = true;\n return classes;\n }\n\n constructor() {\n super();\n\n this.context = 'default';\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.timeout) {\n setTimeout(() => {\n this._dismiss();\n }, this.timeout);\n }\n }\n\n _dismiss() {\n this.hide = true;\n }\n\n render() {\n if (this.hide) {\n return html``;\n }\n\n // prettier-ignore\n const svg = html`\n \n xmlns=\"http://www.w3.org/2000/svg\">\n \n \n \n `;\n\n return html`\n
    \n
    \n \n
    \n ${this.dismissable\n ? html`\n \n `\n : null}\n
    \n `;\n }\n}\n\nwindow.customElements.define('dt-alert', DtAlert);\n"],"names":["window","customElements","define","DtBase","styles","css","properties","context","type","String","dismissable","Boolean","timeout","Number","hide","outline","classes","this","constructor","super","connectedCallback","setTimeout","_dismiss","render","html","svg","classMap"],"mappings":"yNA+LAA,OAAOC,eAAeC,OAAO,WA1LtB,cAAsBC,EAChBC,oBACT,OAAOC,CAAG,4+FA4GX,CAEUC,wBACT,MAAO,CACLC,QAAS,CAAEC,KAAMC,QACjBC,YAAa,CAAEF,KAAMG,SACrBC,QAAS,CAAEJ,KAAMK,QACjBC,KAAM,CAAEN,KAAMG,SACdI,QAAS,CAAEP,KAAMG,SAEpB,CAEGK,cACF,MAAMA,EAAU,CACd,YAAY,EACZ,oBAAqBC,KAAKF,SAI5B,OADAC,EADqB,aAAaC,KAAKV,YACf,EACjBS,CACR,CAEDE,cACEC,QAEAF,KAAKV,QAAU,SAChB,CAEDa,oBACED,MAAMC,oBACFH,KAAKL,SACPS,YAAW,KACTJ,KAAKK,UAAU,GACdL,KAAKL,QAEX,CAEDU,WACEL,KAAKH,MAAO,CACb,CAEDS,SACE,GAAIN,KAAKH,KACP,OAAOU,CAAI,GAIb,MAAMC,EAAMD,CAAI,mQAchB,OAAOA,CAAI,4BACiBE,EAAST,KAAKD,qCAIpCC,KAAKP,YACHc,CAAI,mBACgBP,KAAKK,4BAA4BG,aAErD,YAGT"} \ No newline at end of file diff --git a/dt-assets/build/components/layout/dt-list/dt-list.js b/dt-assets/build/components/layout/dt-list/dt-list.js index a522ec510d..dbfb881750 100644 --- a/dt-assets/build/components/layout/dt-list/dt-list.js +++ b/dt-assets/build/components/layout/dt-list/dt-list.js @@ -1 +1,175 @@ -import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{m as i,s}from"../../lit-localize-763e4978.js";import{o}from"../../map-c0e24c36.js";import{c as r}from"../../repeat-1a2b8966.js";import{l}from"../../if-defined-11ddebeb.js";import{o as n}from"../../class-map-8d921948.js";import{D as a,A as d}from"../../dt-base.js";import"../../icons/dt-star.js";import"../../directive-de55b00a.js";window.customElements.define("dt-list",class extends a{static get styles(){return t`:host{--number-of-columns:7;font-family:var(--dt-list-font-family,var(--font-family));font-size:var(--dt-list-font-size,15px);font-weight:var(--dt-list-font-weight,300);line-height:var(--dt-list-line-height,1.5);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.section{container-type:inline-size;background-color:var(--dt-list-background-color,#fefefe);border:1px solid var(--dt-list-border-color,#f1f1f1);border-radius:var(--dt-list-border-radius,10px);box-shadow:var(--dt-list-box-shadow,0 2px 4px rgb(0 0 0 / 25%));padding:var(--dt-list-section-padding,1rem)}.header{display:flex;justify-content:flex-start;align-items:baseline;gap:var(--dt-list-header-gap,1.5em);flex-wrap:wrap}.section-header{color:var(--dt-list-header-color,var(--primary-color));font-size:1.5rem;display:inline-block;text-transform:capitalize}.toggleButton{color:var(--dt-list-header-color,var(--primary-color));font-size:1rem;background:0 0;border:var(--dt-list-toggleButton,.1em solid rgb(0 0 0 / .2));border-radius:.25em;padding:.25em .5em;cursor:pointer}.toggleButton svg{height:.9rem;transform:translateY(-2px);vertical-align:bottom;width:1rem;fill:var(--dt-list-header-color,var(--primary-color));stroke:var(--dt-list-header-color,var(--primary-color))}.list_action_section{background-color:var(--dt-list-action-section-background-color,#ecf5fc);border-radius:var(--dt-list-border-radius,10px);margin:var(--dt-list-action-section-margin,30px 0);padding:var(--dt-list-action-section-padding,20px)}.list_action_section_header{display:flex;flex-direction:row;justify-content:space-between}.close-button{outline:0;font-size:2.5em;line-height:1;color:var(--dt-list-action-close-button,var(--inactive-color));background:0 0;border:none;cursor:pointer}.fieldsList{list-style-type:none;column-count:1}.list-field-picker-item{list-style-type:none}.list-field-picker-item input{margin:1rem}.list-field-picker-item .dt-icon{height:var(--dt-list-field-picker-icon-size,1rem);width:var(--dt-list-field-picker-icon-size,1rem)}table{display:grid;border:1px solid var(--dt-list-border-color,#f1f1f1);border-top:0;border-collapse:collapse;min-width:100%;grid-template-columns:minmax(32px,.1fr) minmax(32px,.1fr) minmax(50px,.8fr)}table td:last-child{border-bottom:1px solid var(--dt-list-border-color,#f1f1f1);padding-bottom:2rem}tbody,thead,tr{display:contents}tr{cursor:pointer}tr:nth-child(2n + 1){background:#f1f1f1}tr:hover{background-color:var(--dt-list-hover-background-color,#ecf5fc)}tr a{color:var(--dt-list-link-color,var(--primary-color))}th{display:none}.column-name{pointer-events:none}#sort-arrows{grid-template-columns:4fr 1fr;display:flex;flex-direction:column;height:1.5em;justify-content:space-evenly}th.all span.sort-arrow-up{border-color:transparent transparent var(--dt-list-sort-arrow-color,grey) transparent;border-style:solid;border-width:0 .5em .5em .5em}th.all span.sort-arrow-down{content:'';border-color:var(--dt-list-sort-arrow-color,grey) transparent transparent;border-style:solid;border-width:.5em .5em 0}th.all span.sort-arrow-up.sortedBy{border-color:transparent transparent var(--dt-list-sort-arrow-color-highlight,#999) transparent}th.all span.sort-arrow-down.sortedBy{border-color:var(--dt-list-sort-arrow-color-highlight,#999) transparent transparent}td{border:0;grid-column:1/span 3;padding-inline-start:1em}td::before{content:attr(title) ': ';padding-inline-end:1em}td.no-title{grid-column:auto}td.line-count{padding-block-start:.8em;padding-inline-start:1em}td.bulk_edit_checkbox{grid-column:1/auto}td.no-title::before{content:'';padding-inline-end:.25em}td.bulk_edit_checkbox,th.bulk_edit_checkbox{grid-column:none}.bulk_edit_checkbox input{display:none}.bulk_editing td.bulk_edit_checkbox,.bulk_editing th.bulk_edit_checkbox{grid-column:1/auto}.bulk_editing .bulk_edit_checkbox input{display:initial}ul{margin:0;padding:0}ul li{list-style-type:none}input[type=checkbox]{margin:1rem}table{grid-template-columns:minmax(32px,.5fr) minmax(32px,.5fr) minmax(32px,.5fr) repeat(var(--number-of-columns,7),minmax(50px,1fr))}th{position:sticky;top:0;background:var(--dt-list-header-background-color,var(--dt-tile-background-color,#fefefe));text-align:start;justify-self:start;font-weight:400;font-size:1.1rem;color:var(--dt-list-header-color,#0a0a0a);white-space:pre-wrap;display:grid;place-items:center;grid-template-columns:2fr 1fr}th:last-child{border:0}td{display:flex;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-top:.5rem;padding-bottom:.5rem;padding-inline-start:0;color:var(--text-color-mid);border-bottom:1px solid var(--dt-list-border-color,#f1f1f1);grid-column:auto}td::before{content:'';display:none}`}static get properties(){return{postType:{type:String},postTypeLabel:{type:String},postTypeSettings:{type:Object,attribute:!0},posts:{type:Array},total:{type:Number},columns:{type:Array},sortedBy:{type:String},loading:{type:Boolean,default:!0},offset:{type:Number},showArchived:{type:Boolean,default:!1},showFieldsSelector:{type:Boolean,default:!1},showBulkEditSelector:{type:Boolean,default:!1},nonce:{type:String}}}constructor(){super(),this.sortedBy="name"}firstUpdated(){this.nonce&&!this.api&&(this.api=new d(this.nonce))}async _getPosts(t=0,e="name",i="desc"){this.loading=!0,this.filteredOptions=[];const s=encodeURI(`?offset=${t}&sortBy=${`${"desc"===i?"-":""}${e}`}&offset=${t}${this.columns.map((t=>`&fields_to_return=${t}`)).join("")}`);return await this.api.makeRequestOnPosts("GET",`${this.postType}${s}`)}_headerClick(t){const e=t.target.dataset.id;this._getPosts(this.offset?this.offset:0,e).then((t=>{this.posts=t,this.sortedBy=e}))}_bulkEdit(){this.showBulkEditSelector=!this.showBulkEditSelector}_fieldsEdit(){this.showFieldsSelector=!this.showFieldsSelector}_toggleShowArchived(){this.showArchived=!this.showArchived}_sortArrowsClass(t){return this.sortedBy===t?"sortedBy":""}_sortArrowsToggle(t){return this.sortedBy!==`-${t}`?`-${t}`:t}_headerTemplate(){return e`${o(this.columns,(t=>e`${this.postTypeSettings[t].name} `))}`}_rowTemplate(){return o(this.posts,((t,i)=>this.showArchived||!this.showArchived&&"closed"!==t.overall_status.key?e`${i+1}.${this._cellTemplate(t)}`:null))}_cellTemplate(t){return o(this.columns,(i=>{if(["text","textarea","number"].includes(this.postTypeSettings[i].type))return e`
    ${t[i]}`;if("date"===this.postTypeSettings[i].type)return e`${t[i].formatted}`;if("user_select"===this.postTypeSettings[i].type&&t[i]&&t[i].display)return e`${l(t[i].display)}`;if("key_select"===this.postTypeSettings[i].type&&t[i]&&(t[i].label||t[i].name))return e`${t[i].label||t[i].name}`;if("multi_select"===this.postTypeSettings[i].type||"tags"===this.postTypeSettings[i].type&&t[i]&&t[i].length>0)return e`
      ${o(t[i],(t=>e`
    • ${this.postTypeSettings[i].default[t].label}
    • `))}
    `;if("location"===this.postTypeSettings[i].type||"location_meta"===this.postTypeSettings[i].type)return e`${l(t[i].label)}`;if("communication_channel"===this.postTypeSettings[i].type)return e`${l(t[i].value)}`;if("connection"===this.postTypeSettings[i].type)return e`${l(t[i].value)}`;if("boolean"===this.postTypeSettings[i].type){if("favorite"===i)return e``;if(!0===this.postTypeSettings[i])return e`['✓']`}return e``}))}_fieldListIconTemplate(t){return this.postTypeSettings[t].icon?e`${this.postTypeSettings[t].name}`:null}_fieldsListTemplate(){return r(Object.keys(this.postTypeSettings).sort(((t,e)=>{const i=this.postTypeSettings[t].name.toUpperCase(),s=this.postTypeSettings[e].name.toUpperCase();return is?1:0})),(t=>t),(t=>this.postTypeSettings[t].hidden?null:e`
  • `))}_fieldsSelectorTemplate(){return this.showFieldsSelector?e`

    ${i("Choose which fields to display as columns in the list")}

      ${this._fieldsListTemplate()}
    `:null}_updateFields(t){const e=t.target.value,i=this.columns;i.includes(e)?(i.filter((t=>t!==e)),i.splice(i.indexOf(e),1)):i.push(e),this.columns=i,this.style.setProperty("--number-of-columns",this.columns.length-1),this.requestUpdate()}_bulkSelectorTemplate(){return this.showBulkEditSelector?e`

    ${i(s`Select all the ${this.postType} you want to update from the list, and update them below`)}

      This is where the bulk edit form will go.
    `:null}connectedCallback(){super.connectedCallback(),this.posts||this._getPosts().then((t=>{this.posts=t}))}render(){const t={bulk_editing:this.showBulkEditSelector,hidden:!1},o=e``,r=e``;return e`
    ${i(s`${this.postTypeLabel?this.postTypeLabel:this.postType} List`)}
    ${i(s`Showing 1 of ${this.total}`)}
    ${this._fieldsSelectorTemplate()} ${this._bulkSelectorTemplate()}${this._headerTemplate()} ${this.posts?this._rowTemplate():i("Loading")}
    `}}); +import { i as t, y as e } from '../../lit-element-2409d5fe.js'; +import { m as i, s } from '../../lit-localize-763e4978.js'; +import { o } from '../../map-c0e24c36.js'; +import { c as r } from '../../repeat-1a2b8966.js'; +import { l } from '../../if-defined-11ddebeb.js'; +import { o as n } from '../../class-map-8d921948.js'; +import { D as a, A as d } from '../../dt-base.js'; +import '../../icons/dt-star.js'; +import '../../directive-de55b00a.js'; +window.customElements.define( + 'dt-list', + class extends a { + static get styles() { + return t`:host{--number-of-columns:7;font-family:var(--dt-list-font-family,var(--font-family));font-size:var(--dt-list-font-size,15px);font-weight:var(--dt-list-font-weight,300);line-height:var(--dt-list-line-height,1.5);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.section{container-type:inline-size;background-color:var(--dt-list-background-color,#fefefe);border:1px solid var(--dt-list-border-color,#f1f1f1);border-radius:var(--dt-list-border-radius,10px);box-shadow:var(--dt-list-box-shadow,0 2px 4px rgb(0 0 0 / 25%));padding:var(--dt-list-section-padding,1rem)}.header{display:flex;justify-content:flex-start;align-items:baseline;gap:var(--dt-list-header-gap,1.5em);flex-wrap:wrap}.section-header{color:var(--dt-list-header-color,var(--primary-color));font-size:1.5rem;display:inline-block;text-transform:capitalize}.toggleButton{color:var(--dt-list-header-color,var(--primary-color));font-size:1rem;background:0 0;border:var(--dt-list-toggleButton,.1em solid rgb(0 0 0 / .2));border-radius:.25em;padding:.25em .5em;cursor:pointer}.toggleButton svg{height:.9rem;transform:translateY(-2px);vertical-align:bottom;width:1rem;fill:var(--dt-list-header-color,var(--primary-color));stroke:var(--dt-list-header-color,var(--primary-color))}.list_action_section{background-color:var(--dt-list-action-section-background-color,#ecf5fc);border-radius:var(--dt-list-border-radius,10px);margin:var(--dt-list-action-section-margin,30px 0);padding:var(--dt-list-action-section-padding,20px)}.list_action_section_header{display:flex;flex-direction:row;justify-content:space-between}.close-button{outline:0;font-size:2.5em;line-height:1;color:var(--dt-list-action-close-button,var(--inactive-color));background:0 0;border:none;cursor:pointer}.fieldsList{list-style-type:none;column-count:1}.list-field-picker-item{list-style-type:none}.list-field-picker-item input{margin:1rem}.list-field-picker-item .dt-icon{height:var(--dt-list-field-picker-icon-size,1rem);width:var(--dt-list-field-picker-icon-size,1rem)}table{display:grid;border:1px solid var(--dt-list-border-color,#f1f1f1);border-top:0;border-collapse:collapse;min-width:100%;grid-template-columns:minmax(32px,.1fr) minmax(32px,.1fr) minmax(50px,.8fr)}table td:last-child{border-bottom:1px solid var(--dt-list-border-color,#f1f1f1);padding-bottom:2rem}tbody,thead,tr{display:contents}tr{cursor:pointer}tr:nth-child(2n + 1){background:#f1f1f1}tr:hover{background-color:var(--dt-list-hover-background-color,#ecf5fc)}tr a{color:var(--dt-list-link-color,var(--primary-color))}th{display:none}.column-name{pointer-events:none}#sort-arrows{grid-template-columns:4fr 1fr;display:flex;flex-direction:column;height:1.5em;justify-content:space-evenly}th.all span.sort-arrow-up{border-color:transparent transparent var(--dt-list-sort-arrow-color,grey) transparent;border-style:solid;border-width:0 .5em .5em .5em}th.all span.sort-arrow-down{content:'';border-color:var(--dt-list-sort-arrow-color,grey) transparent transparent;border-style:solid;border-width:.5em .5em 0}th.all span.sort-arrow-up.sortedBy{border-color:transparent transparent var(--dt-list-sort-arrow-color-highlight,#999) transparent}th.all span.sort-arrow-down.sortedBy{border-color:var(--dt-list-sort-arrow-color-highlight,#999) transparent transparent}td{border:0;grid-column:1/span 3;padding-inline-start:1em}td::before{content:attr(title) ': ';padding-inline-end:1em}td.no-title{grid-column:auto}td.line-count{padding-block-start:.8em;padding-inline-start:1em}td.bulk_edit_checkbox{grid-column:1/auto}td.no-title::before{content:'';padding-inline-end:.25em}td.bulk_edit_checkbox,th.bulk_edit_checkbox{grid-column:none}.bulk_edit_checkbox input{display:none}.bulk_editing td.bulk_edit_checkbox,.bulk_editing th.bulk_edit_checkbox{grid-column:1/auto}.bulk_editing .bulk_edit_checkbox input{display:initial}ul{margin:0;padding:0}ul li{list-style-type:none}input[type=checkbox]{margin:1rem}table{grid-template-columns:minmax(32px,.5fr) minmax(32px,.5fr) minmax(32px,.5fr) repeat(var(--number-of-columns,7),minmax(50px,1fr))}th{position:sticky;top:0;background:var(--dt-list-header-background-color,var(--dt-tile-background-color,#fefefe));text-align:start;justify-self:start;font-weight:400;font-size:1.1rem;color:var(--dt-list-header-color,#0a0a0a);white-space:pre-wrap;display:grid;place-items:center;grid-template-columns:2fr 1fr}th:last-child{border:0}td{display:flex;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-top:.5rem;padding-bottom:.5rem;padding-inline-start:0;color:var(--text-color-mid);border-bottom:1px solid var(--dt-list-border-color,#f1f1f1);grid-column:auto}td::before{content:'';display:none}`; + } + static get properties() { + return { + postType: { type: String }, + postTypeLabel: { type: String }, + postTypeSettings: { type: Object, attribute: !0 }, + posts: { type: Array }, + total: { type: Number }, + columns: { type: Array }, + sortedBy: { type: String }, + loading: { type: Boolean, default: !0 }, + offset: { type: Number }, + showArchived: { type: Boolean, default: !1 }, + showFieldsSelector: { type: Boolean, default: !1 }, + showBulkEditSelector: { type: Boolean, default: !1 }, + nonce: { type: String }, + }; + } + constructor() { + super(), (this.sortedBy = 'name'); + } + firstUpdated() { + this.nonce && !this.api && (this.api = new d(this.nonce)); + } + async _getPosts(t = 0, e = 'name', i = 'desc') { + (this.loading = !0), (this.filteredOptions = []); + const s = encodeURI( + `?offset=${t}&sortBy=${`${'desc' === i ? '-' : ''}${e}`}&offset=${t}${this.columns.map((t) => `&fields_to_return=${t}`).join('')}`, + ); + return await this.api.makeRequestOnPosts('GET', `${this.postType}${s}`); + } + _headerClick(t) { + const e = t.target.dataset.id; + this._getPosts(this.offset ? this.offset : 0, e).then((t) => { + (this.posts = t), (this.sortedBy = e); + }); + } + _bulkEdit() { + this.showBulkEditSelector = !this.showBulkEditSelector; + } + _fieldsEdit() { + this.showFieldsSelector = !this.showFieldsSelector; + } + _toggleShowArchived() { + this.showArchived = !this.showArchived; + } + _sortArrowsClass(t) { + return this.sortedBy === t ? 'sortedBy' : ''; + } + _sortArrowsToggle(t) { + return this.sortedBy !== `-${t}` ? `-${t}` : t; + } + _headerTemplate() { + return e`${o(this.columns, (t) => e`${this.postTypeSettings[t].name} `)}`; + } + _rowTemplate() { + return o(this.posts, (t, i) => + this.showArchived || + (!this.showArchived && 'closed' !== t.overall_status.key) + ? e`${i + 1}.${this._cellTemplate(t)}` + : null, + ); + } + _cellTemplate(t) { + return o(this.columns, (i) => { + if ( + ['text', 'textarea', 'number'].includes(this.postTypeSettings[i].type) + ) + return e`${t[i]}`; + if ('date' === this.postTypeSettings[i].type) + return e`${t[i].formatted}`; + if ( + 'user_select' === this.postTypeSettings[i].type && + t[i] && + t[i].display + ) + return e`${l(t[i].display)}`; + if ( + 'key_select' === this.postTypeSettings[i].type && + t[i] && + (t[i].label || t[i].name) + ) + return e`${t[i].label || t[i].name}`; + if ( + 'multi_select' === this.postTypeSettings[i].type || + ('tags' === this.postTypeSettings[i].type && t[i] && t[i].length > 0) + ) + return e`
      ${o(t[i], (t) => e`
    • ${this.postTypeSettings[i].default[t].label}
    • `)}
    `; + if ( + 'location' === this.postTypeSettings[i].type || + 'location_meta' === this.postTypeSettings[i].type + ) + return e`${l(t[i].label)}`; + if ('communication_channel' === this.postTypeSettings[i].type) + return e`${l(t[i].value)}`; + if ('connection' === this.postTypeSettings[i].type) + return e`${l(t[i].value)}`; + if ('boolean' === this.postTypeSettings[i].type) { + if ('favorite' === i) + return e``; + if (!0 === this.postTypeSettings[i]) + return e`['✓']`; + } + return e``; + }); + } + _fieldListIconTemplate(t) { + return this.postTypeSettings[t].icon + ? e`${this.postTypeSettings[t].name}` + : null; + } + _fieldsListTemplate() { + return r( + Object.keys(this.postTypeSettings).sort((t, e) => { + const i = this.postTypeSettings[t].name.toUpperCase(), + s = this.postTypeSettings[e].name.toUpperCase(); + return i < s ? -1 : i > s ? 1 : 0; + }), + (t) => t, + (t) => + this.postTypeSettings[t].hidden + ? null + : e`
  • `, + ); + } + _fieldsSelectorTemplate() { + return this.showFieldsSelector + ? e`

    ${i('Choose which fields to display as columns in the list')}

      ${this._fieldsListTemplate()}
    ` + : null; + } + _updateFields(t) { + const e = t.target.value, + i = this.columns; + i.includes(e) + ? (i.filter((t) => t !== e), i.splice(i.indexOf(e), 1)) + : i.push(e), + (this.columns = i), + this.style.setProperty('--number-of-columns', this.columns.length - 1), + this.requestUpdate(); + } + _bulkSelectorTemplate() { + return this.showBulkEditSelector + ? e`

    ${i(s`Select all the ${this.postType} you want to update from the list, and update them below`)}

      This is where the bulk edit form will go.
    ` + : null; + } + connectedCallback() { + super.connectedCallback(), + this.posts || + this._getPosts().then((t) => { + this.posts = t; + }); + } + render() { + const t = { bulk_editing: this.showBulkEditSelector, hidden: !1 }, + o = e``, + r = e``; + return e`
    ${i(s`${this.postTypeLabel ? this.postTypeLabel : this.postType} List`)}
    ${i(s`Showing 1 of ${this.total}`)}
    ${this._fieldsSelectorTemplate()} ${this._bulkSelectorTemplate()}${this._headerTemplate()} ${this.posts ? this._rowTemplate() : i('Loading')}
    `; + } + }, +); +//# sourceMappingURL=dt-list.js.map diff --git a/dt-assets/build/components/layout/dt-list/dt-list.js.map b/dt-assets/build/components/layout/dt-list/dt-list.js.map new file mode 100644 index 0000000000..6d6e777e78 --- /dev/null +++ b/dt-assets/build/components/layout/dt-list/dt-list.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-list.js","sources":["../../../src/components/layout/dt-list/dt-list.js"],"sourcesContent":["import { html, css } from 'lit';\nimport { msg, str } from '@lit/localize';\nimport { map } from 'lit/directives/map.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport DtBase from '../../dt-base.js';\nimport ApiService from '../../../services/apiService.js';\nimport '../../icons/dt-star.js';\n\nexport class DtList extends DtBase {\n static get styles() {\n return css`\n :host {\n --number-of-columns: 7;\n font-family: var(--dt-list-font-family, var(--font-family));\n font-size: var(--dt-list-font-size, 15px);\n font-weight: var(--dt-list-font-weight, 300);\n line-height: var(--dt-list-line-height, 1.5);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .section {\n container-type: inline-size;\n background-color: var(--dt-list-background-color, #fefefe);\n border: 1px solid var(--dt-list-border-color, #f1f1f1);\n border-radius: var(--dt-list-border-radius, 10px);\n box-shadow: var(--dt-list-box-shadow, 0 2px 4px rgb(0 0 0 / 25%));\n padding: var(--dt-list-section-padding, 1rem);\n }\n\n .header {\n display: flex;\n justify-content: flex-start;\n align-items: baseline;\n gap: var(--dt-list-header-gap, 1.5em);\n flex-wrap: wrap;\n }\n\n .section-header {\n color: var(--dt-list-header-color, var(--primary-color));\n font-size: 1.5rem;\n display: inline-block;\n text-transform: capitalize;\n }\n\n .toggleButton {\n color: var(--dt-list-header-color, var(--primary-color));\n font-size: 1rem;\n background: transparent;\n border: var(--dt-list-toggleButton, 0.1em solid rgb(0 0 0 / 0.2));\n border-radius: 0.25em;\n padding: 0.25em 0.5em;\n cursor: pointer;\n }\n\n .toggleButton svg {\n height: 0.9rem;\n transform: translateY(-2px);\n vertical-align: bottom;\n width: 1rem;\n fill: var(--dt-list-header-color, var(--primary-color));\n stroke: var(--dt-list-header-color, var(--primary-color));\n }\n\n .list_action_section {\n background-color: var(\n --dt-list-action-section-background-color,\n #ecf5fc\n );\n border-radius: var(--dt-list-border-radius, 10px);\n margin: var(--dt-list-action-section-margin, 30px 0);\n padding: var(--dt-list-action-section-padding, 20px);\n }\n .list_action_section_header {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n }\n .close-button {\n outline: none;\n font-size: 2.5em;\n line-height: 1;\n color: var(--dt-list-action-close-button, var(--inactive-color));\n background: transparent;\n border: none;\n cursor: pointer;\n }\n .fieldsList {\n list-style-type: none;\n column-count: 1;\n }\n\n .list-field-picker-item {\n list-style-type: none;\n }\n\n .list-field-picker-item input {\n margin: 1rem;\n }\n\n .list-field-picker-item .dt-icon {\n height: var(--dt-list-field-picker-icon-size, 1rem);\n width: var(--dt-list-field-picker-icon-size, 1rem);\n }\n\n table {\n display: grid;\n border: 1px solid var(--dt-list-border-color, #f1f1f1);\n border-top: 0;\n border-collapse: collapse;\n min-width: 100%;\n grid-template-columns: minmax(32px, 0.1fr) minmax(32px, 0.1fr) minmax(\n 50px,\n 0.8fr\n );\n }\n\n table td:last-child {\n border-bottom: 1px solid var(--dt-list-border-color, #f1f1f1);\n padding-bottom: 2rem;\n }\n\n thead,\n tbody,\n tr {\n display: contents;\n }\n\n tr {\n cursor: pointer;\n }\n\n tr:nth-child(2n + 1) {\n background: #f1f1f1;\n }\n\n tr:hover {\n background-color: var(--dt-list-hover-background-color, #ecf5fc);\n }\n\n tr a {\n color: var(--dt-list-link-color, var(--primary-color));\n }\n\n th {\n display: none;\n }\n\n .column-name {\n pointer-events: none;\n }\n #sort-arrows {\n grid-template-columns: 4fr 1fr;\n display: flex;\n flex-direction: column;\n height: 1.5em;\n justify-content: space-evenly;\n }\n th.all span.sort-arrow-up {\n border-color: transparent transparent\n var(--dt-list-sort-arrow-color, #808080) transparent;\n border-style: solid;\n border-width: 0 0.5em 0.5em 0.5em;\n }\n\n th.all span.sort-arrow-down {\n content: '';\n border-color: var(--dt-list-sort-arrow-color, #808080) transparent\n transparent;\n border-style: solid;\n border-width: 0.5em 0.5em 0;\n }\n\n th.all span.sort-arrow-up.sortedBy {\n border-color: transparent transparent\n var(--dt-list-sort-arrow-color-highlight, #999999) transparent;\n }\n\n th.all span.sort-arrow-down.sortedBy {\n border-color: var(--dt-list-sort-arrow-color-highlight, #999999)\n transparent transparent;\n }\n\n td {\n border: 0;\n grid-column: 1 / span 3;\n padding-inline-start: 1em;\n }\n\n td::before {\n content: attr(title) ': ';\n padding-inline-end: 1em;\n }\n\n td.no-title {\n grid-column: auto;\n }\n\n td.line-count {\n padding-block-start: 0.8em;\n padding-inline-start: 1em;\n }\n\n td.bulk_edit_checkbox {\n grid-column: 1 / auto;\n }\n\n td.no-title::before {\n content: '';\n padding-inline-end: 0.25em;\n }\n\n th.bulk_edit_checkbox,\n td.bulk_edit_checkbox {\n grid-column: none;\n }\n\n .bulk_edit_checkbox input {\n display: none;\n }\n\n .bulk_editing th.bulk_edit_checkbox,\n .bulk_editing td.bulk_edit_checkbox {\n grid-column: 1 / auto;\n }\n\n .bulk_editing .bulk_edit_checkbox input {\n display: initial;\n }\n\n ul {\n margin: 0;\n padding: 0;\n }\n\n ul li {\n list-style-type: none;\n }\n\n input[type='checkbox'] {\n margin: 1rem;\n }\n @container (min-width: 650px) {\n .fieldsList {\n column-count: 2;\n }\n table {\n grid-template-columns:\n minmax(32px, 0.5fr)\n minmax(32px, 0.5fr)\n minmax(32px, 0.5fr)\n repeat(var(--number-of-columns, 7), minmax(50px, 1fr));\n }\n\n th {\n position: sticky;\n top: 0;\n background: var(\n --dt-list-header-background-color,\n var(--dt-tile-background-color, #fefefe)\n );\n text-align: start;\n justify-self: start;\n font-weight: normal;\n font-size: 1.1rem;\n color: var(--dt-list-header-color, #0a0a0a);\n white-space: pre-wrap;\n display: grid;\n place-items: center;\n grid-template-columns: 2fr 1fr;\n }\n\n th:last-child {\n border: 0;\n }\n td {\n display: flex;\n align-items: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n padding-inline-start: 0;\n color: var(--text-color-mid);\n border-bottom: 1px solid var(--dt-list-border-color, #f1f1f1);\n grid-column: auto;\n }\n td::before {\n content: '';\n display: none;\n }\n }\n @container (min-width: 950px) {\n .fieldsList {\n column-count: 3;\n }\n }\n @container (min-width: 1500px) {\n .fieldsList {\n column-count: 4;\n }\n }\n `;\n }\n\n static get properties() {\n return {\n postType: { type: String },\n postTypeLabel: { type: String },\n postTypeSettings: { type: Object, attribute: true },\n posts: { type: Array },\n total: { type: Number },\n columns: { type: Array },\n sortedBy: { type: String },\n loading: { type: Boolean, default: true },\n offset: { type: Number },\n showArchived: { type: Boolean, default: false },\n showFieldsSelector: { type: Boolean, default: false },\n showBulkEditSelector: { type: Boolean, default: false },\n nonce: { type: String },\n };\n }\n\n constructor() {\n super();\n this.sortedBy = 'name';\n }\n\n firstUpdated() {\n if (this.nonce && !this.api) {\n this.api = new ApiService(this.nonce);\n }\n }\n\n async _getPosts(offset = 0, sortBy = 'name', sortOrder = 'desc') {\n this.loading = true;\n this.filteredOptions = [];\n const sort = `${sortOrder === 'desc' ? '-' : ''}${sortBy}`;\n const URLParams = encodeURI(\n `?offset=${offset}&sortBy=${sort}&offset=${offset}${this.columns\n .map(column => `&fields_to_return=${column}`)\n .join('')}`\n );\n const response = await this.api.makeRequestOnPosts(\n 'GET',\n `${this.postType}${URLParams}`\n );\n\n return response;\n }\n\n _headerClick(e) {\n const column = e.target.dataset.id;\n this._getPosts(this.offset ? this.offset : 0, column).then(response => {\n this.posts = response;\n this.sortedBy = column;\n });\n }\n\n _bulkEdit() {\n this.showBulkEditSelector = !this.showBulkEditSelector;\n }\n\n _fieldsEdit() {\n this.showFieldsSelector = !this.showFieldsSelector;\n }\n\n _toggleShowArchived() {\n this.showArchived = !this.showArchived;\n }\n\n _sortArrowsClass(column) {\n return this.sortedBy === column ? 'sortedBy' : '';\n }\n\n _sortArrowsToggle(column) {\n if (this.sortedBy !== `-${column}`) {\n return `-${column}`;\n }\n return column;\n }\n\n _headerTemplate() {\n // const classes = {\n // sortedBy: this.sortedBy,\n // };\n return html`\n \n \n \n \n \n\n \n\n ${map(\n this.columns,\n column =>\n html`\n ${this.postTypeSettings[column].name}\n \n \n \n \n `\n )}\n \n \n `;\n }\n\n _rowTemplate() {\n return map(this.posts, (post, i) => {\n if (\n this.showArchived ||\n (!this.showArchived && post.overall_status.key !== 'closed')\n ) {\n return html`\n \n \n \n \n ${i + 1}.\n\n ${this._cellTemplate(post)}\n \n `;\n }\n return null;\n });\n }\n\n _cellTemplate(post) {\n return map(this.columns, column => {\n if (\n ['text', 'textarea', 'number'].includes(\n this.postTypeSettings[column].type\n )\n ) {\n return html` \n ${post[column]}\n `;\n }\n if (this.postTypeSettings[column].type === 'date') {\n // TODO: format date\n return html` \n ${post[column].formatted}\n `;\n }\n if (\n this.postTypeSettings[column].type === 'user_select' &&\n post[column] &&\n post[column].display\n ) {\n return html` \n ${ifDefined(post[column].display)}\n `;\n }\n if (\n this.postTypeSettings[column].type === 'key_select' &&\n post[column] &&\n (post[column].label || post[column].name)\n ) {\n return html` \n ${post[column].label || post[column].name}\n `;\n }\n if (\n this.postTypeSettings[column].type === 'multi_select' ||\n (this.postTypeSettings[column].type === 'tags' &&\n post[column] &&\n post[column].length > 0)\n ) {\n return html` \n
      \n ${map(\n post[column],\n value =>\n html`
    • \n ${this.postTypeSettings[column].default[value].label}\n
    • `\n )}\n
    \n `;\n }\n if (\n this.postTypeSettings[column].type === 'location' ||\n this.postTypeSettings[column].type === 'location_meta'\n ) {\n return html` \n ${ifDefined(post[column].label)}\n `;\n }\n if (this.postTypeSettings[column].type === 'communication_channel') {\n return html` \n ${ifDefined(post[column].value)}\n `;\n }\n if (this.postTypeSettings[column].type === 'connection') {\n return html` \n \n ${ifDefined(post[column].value)}\n `;\n }\n if (this.postTypeSettings[column].type === 'boolean') {\n if (column === 'favorite') {\n return html`\n \n `;\n }\n if (this.postTypeSettings[column] === true) {\n return html`\n ['✓']\n `;\n }\n }\n return html``;\n });\n }\n\n _fieldListIconTemplate(field) {\n if (this.postTypeSettings[field].icon) {\n return html``;\n }\n return null;\n }\n\n _fieldsListTemplate() {\n return repeat(\n Object.keys(this.postTypeSettings).sort((a, b) => {\n const nameA = this.postTypeSettings[a].name.toUpperCase(); // ignore upper and lowercase\n const nameB = this.postTypeSettings[b].name.toUpperCase(); // ignore upper and lowercase\n if (nameA < nameB) {\n return -1;\n }\n if (nameA > nameB) {\n return 1;\n }\n // names must be equal\n return 0;\n }),\n field => field,\n field => {\n if (!this.postTypeSettings[field].hidden) {\n return html`
  • \n
  • `;\n }\n return null;\n }\n );\n }\n\n _fieldsSelectorTemplate() {\n if (this.showFieldsSelector) {\n return html`\n
    \n

    \n ${msg('Choose which fields to display as columns in the list')}\n

    \n \n ×\n \n
    \n
      \n ${this._fieldsListTemplate()}\n
    \n `;\n }\n return null;\n }\n\n _updateFields(e) {\n const field = e.target.value;\n const viewableColumns = this.columns;\n\n if (!viewableColumns.includes(field)) {\n viewableColumns.push(field);\n } else {\n viewableColumns.filter(column => column !== field);\n viewableColumns.splice(viewableColumns.indexOf(field), 1);\n }\n\n this.columns = viewableColumns;\n this.style.setProperty('--number-of-columns', this.columns.length - 1);\n\n this.requestUpdate();\n }\n\n _bulkSelectorTemplate() {\n if (this.showBulkEditSelector) {\n return html`
    \n
    \n

    \n ${msg(\n str`Select all the ${this.postType} you want to update from the list, and update them below`\n )}\n

    \n \n ×\n \n
    \n
      \n This is where the bulk edit form will go.\n
    \n
    `;\n }\n return null;\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (!this.posts) {\n this._getPosts().then(posts => {\n this.posts = posts;\n });\n }\n }\n\n render() {\n const bulkEditClass = {\n bulk_editing: this.showBulkEditSelector,\n hidden: false,\n };\n\n // prettier-ignore\n const bulkEditSvg = html`\n \n \n \n \n \n \n `;\n // prettier-ignore\n const fieldsSvg = html``;\n\n return html`\n
    \n
    \n
    \n ${msg(\n str`${\n this.postTypeLabel ? this.postTypeLabel : this.postType\n } List`\n )}\n
    \n ${msg(str`Showing 1 of ${this.total}`)}\n\n \n ${bulkEditSvg} ${msg('Bulk Edit')}\n \n \n ${fieldsSvg} ${msg('Fields')}\n \n\n \n
    \n ${this._fieldsSelectorTemplate()} ${this._bulkSelectorTemplate()}\n \n ${this._headerTemplate()}\n ${this.posts ? this._rowTemplate() : msg('Loading')}\n
    \n
    \n `;\n }\n}\n\nwindow.customElements.define('dt-list', DtList);\n"],"names":["window","customElements","define","DtBase","styles","css","properties","postType","type","String","postTypeLabel","postTypeSettings","Object","attribute","posts","Array","total","Number","columns","sortedBy","loading","Boolean","default","offset","showArchived","showFieldsSelector","showBulkEditSelector","nonce","constructor","super","this","firstUpdated","api","ApiService","async","sortBy","sortOrder","filteredOptions","URLParams","encodeURI","map","column","join","makeRequestOnPosts","_headerClick","e","target","dataset","id","_getPosts","then","response","_bulkEdit","_fieldsEdit","_toggleShowArchived","_sortArrowsClass","_sortArrowsToggle","_headerTemplate","html","name","_rowTemplate","post","i","overall_status","key","permalink","ID","_cellTemplate","includes","formatted","display","ifDefined","label","length","value","favorite","_fieldListIconTemplate","field","icon","_fieldsListTemplate","repeat","keys","sort","a","b","nameA","toUpperCase","nameB","hidden","_updateFields","_fieldsSelectorTemplate","msg","viewableColumns","filter","splice","indexOf","push","style","setProperty","requestUpdate","_bulkSelectorTemplate","str","connectedCallback","render","bulkEditClass","bulk_editing","bulkEditSvg","fieldsSvg","classMap"],"mappings":"2YAqwBAA,OAAOC,eAAeC,OAAO,UA3vBtB,cAAqBC,EACfC,oBACT,OAAOC,CAAG,qjJAuSX,CAEUC,wBACT,MAAO,CACLC,SAAU,CAAEC,KAAMC,QAClBC,cAAe,CAAEF,KAAMC,QACvBE,iBAAkB,CAAEH,KAAMI,OAAQC,WAAW,GAC7CC,MAAO,CAAEN,KAAMO,OACfC,MAAO,CAAER,KAAMS,QACfC,QAAS,CAAEV,KAAMO,OACjBI,SAAU,CAAEX,KAAMC,QAClBW,QAAS,CAAEZ,KAAMa,QAASC,SAAS,GACnCC,OAAQ,CAAEf,KAAMS,QAChBO,aAAc,CAAEhB,KAAMa,QAASC,SAAS,GACxCG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,KAAef,EAAI,mGAKZ7D,KAAKuB,gBAEZsD,KAAahB,EAAI,2DAKXA,EAAI,+BACD7D,KAAKN,qCAELM,KAAKwB,gCACPxB,KAAKwB,0CAGhBxB,KAAK4D,6BAA6B5D,KAAKsE,wCAC1BQ,EAASJ,OACpB1E,KAAK2B,qBACL3B,KAAKhB,MAAQgB,KAAK8B,eAAiB+B,EAAI,0BAIhD"} \ No newline at end of file diff --git a/dt-assets/build/components/layout/dt-modal/dt-modal.js b/dt-assets/build/components/layout/dt-modal/dt-modal.js index 9296852270..2299d58cee 100644 --- a/dt-assets/build/components/layout/dt-modal/dt-modal.js +++ b/dt-assets/build/components/layout/dt-modal/dt-modal.js @@ -1 +1,81 @@ -import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{m as o}from"../../lit-localize-763e4978.js";import{o as a}from"../../class-map-8d921948.js";import{i}from"../../style-map-ac85d91b.js";import{D as r}from"../../dt-base.js";import"../../directive-de55b00a.js";window.customElements.define("dt-modal",class extends r{static get styles(){return t`:host{display:block;font-family:var(--font-family)}:host:has(dialog[open]){overflow:hidden}.dt-modal{display:block;background:var(--dt-modal-background-color,#fff);color:var(--dt-modal-color,#000);max-inline-size:min(90vw,100%);max-block-size:min(80vh,100%);max-block-size:min(80dvb,100%);margin:auto;height:fit-content;padding:var(--dt-modal-padding,1em);position:fixed;inset:0;border-radius:1em;border:none;box-shadow:var(--shadow-6);z-index:1000;transition:opacity .1s ease-in-out}dialog:not([open]){pointer-events:none;opacity:0}dialog::backdrop{background:var(--dt-modal-backdrop-color,rgba(0,0,0,.25));animation:var(--dt-modal-animation,fade-in .75s)}@keyframes fade-in{from{opacity:0}to{opacity:1}}h1,h2,h3,h4,h5,h6{line-height:1.4;text-rendering:optimizeLegibility;color:inherit;font-style:normal;font-weight:300;margin:0}form{display:grid;height:fit-content;grid-template-columns:1fr;grid-template-rows:100px auto 100px;grid-template-areas:'header' 'main' 'footer';position:relative}form.no-header{grid-template-rows:auto auto;grid-template-areas:'main' 'footer'}header{grid-area:header;display:flex;justify-content:space-between}.button{color:var(--dt-modal-button-color,#fff);background:var(--dt-modal-button-background,#000);font-size:1rem;border:.1em solid var(--dt-modal-button-background,#000);border-radius:.25em;padding:.25rem .5rem;cursor:pointer;text-decoration:none}.button.opener{color:var(--dt-modal-button-opener-color,var(--dt-modal-button-color,#fff));background:var(--dt-modal-button-opener-background,var(--dt-modal-button-background,#000));border:.1em solid var(--dt-modal-button-opener-background,#000)}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none;color:inherit;cursor:pointer;display:flex;align-items:flex-start}article{grid-area:main;overflow:auto}footer{grid-area:footer;display:flex;justify-content:space-between}.help-more h5{font-size:.75rem;display:block}.help-more .button{font-size:.75rem;display:block}`}static get properties(){return{title:{type:String},context:{type:String},isHelp:{type:Boolean},isOpen:{type:Boolean},hideHeader:{type:Boolean},hideButton:{type:Boolean},buttonClass:{type:Object},buttonStyle:{type:Object}}}constructor(){super(),this.context="default",this.addEventListener("open",(t=>this._openModal())),this.addEventListener("close",(t=>this._closeModal()))}_openModal(){this.isOpen=!0,this.shadowRoot.querySelector("dialog").showModal(),document.querySelector("body").style.overflow="hidden"}_dialogHeader(t){return this.hideHeader?e``:e`

    ${this.title}

    `}_closeModal(){this.isOpen=!1,this.shadowRoot.querySelector("dialog").close(),document.querySelector("body").style.overflow="initial"}_cancelModal(){this._triggerClose("cancel")}_triggerClose(t){this.dispatchEvent(new CustomEvent("close",{detail:{action:t}}))}_dialogClick(t){if("DIALOG"!==t.target.tagName)return;const e=t.target.getBoundingClientRect();!1===(e.top<=t.clientY&&t.clientY<=e.top+e.height&&e.left<=t.clientX&&t.clientX<=e.left+e.width)&&this._cancelModal()}_dialogKeypress(t){"Escape"===t.key&&this._cancelModal()}_helpMore(){return this.isHelp?e`
    ${o("Need more help?")}
    ${o("Read the documentation")}
    `:null}firstUpdated(){this.isOpen&&this._openModal()}_onButtonClick(){this._triggerClose("button")}render(){const t=e`xmlns="http://www.w3.org/2000/svg">`;return e`
    ${this._dialogHeader(t)}
    ${this._helpMore()}
    ${this.hideButton?null:e``}`}}); +import { i as t, y as e } from '../../lit-element-2409d5fe.js'; +import { m as o } from '../../lit-localize-763e4978.js'; +import { o as a } from '../../class-map-8d921948.js'; +import { i } from '../../style-map-ac85d91b.js'; +import { D as r } from '../../dt-base.js'; +import '../../directive-de55b00a.js'; +window.customElements.define( + 'dt-modal', + class extends r { + static get styles() { + return t`:host{display:block;font-family:var(--font-family)}:host:has(dialog[open]){overflow:hidden}.dt-modal{display:block;background:var(--dt-modal-background-color,#fff);color:var(--dt-modal-color,#000);max-inline-size:min(90vw,100%);max-block-size:min(80vh,100%);max-block-size:min(80dvb,100%);margin:auto;height:fit-content;padding:var(--dt-modal-padding,1em);position:fixed;inset:0;border-radius:1em;border:none;box-shadow:var(--shadow-6);z-index:1000;transition:opacity .1s ease-in-out}dialog:not([open]){pointer-events:none;opacity:0}dialog::backdrop{background:var(--dt-modal-backdrop-color,rgba(0,0,0,.25));animation:var(--dt-modal-animation,fade-in .75s)}@keyframes fade-in{from{opacity:0}to{opacity:1}}h1,h2,h3,h4,h5,h6{line-height:1.4;text-rendering:optimizeLegibility;color:inherit;font-style:normal;font-weight:300;margin:0}form{display:grid;height:fit-content;grid-template-columns:1fr;grid-template-rows:100px auto 100px;grid-template-areas:'header' 'main' 'footer';position:relative}form.no-header{grid-template-rows:auto auto;grid-template-areas:'main' 'footer'}header{grid-area:header;display:flex;justify-content:space-between}.button{color:var(--dt-modal-button-color,#fff);background:var(--dt-modal-button-background,#000);font-size:1rem;border:.1em solid var(--dt-modal-button-background,#000);border-radius:.25em;padding:.25rem .5rem;cursor:pointer;text-decoration:none}.button.opener{color:var(--dt-modal-button-opener-color,var(--dt-modal-button-color,#fff));background:var(--dt-modal-button-opener-background,var(--dt-modal-button-background,#000));border:.1em solid var(--dt-modal-button-opener-background,#000)}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none;color:inherit;cursor:pointer;display:flex;align-items:flex-start}article{grid-area:main;overflow:auto}footer{grid-area:footer;display:flex;justify-content:space-between}.help-more h5{font-size:.75rem;display:block}.help-more .button{font-size:.75rem;display:block}`; + } + static get properties() { + return { + title: { type: String }, + context: { type: String }, + isHelp: { type: Boolean }, + isOpen: { type: Boolean }, + hideHeader: { type: Boolean }, + hideButton: { type: Boolean }, + buttonClass: { type: Object }, + buttonStyle: { type: Object }, + }; + } + constructor() { + super(), + (this.context = 'default'), + this.addEventListener('open', (t) => this._openModal()), + this.addEventListener('close', (t) => this._closeModal()); + } + _openModal() { + (this.isOpen = !0), + this.shadowRoot.querySelector('dialog').showModal(), + (document.querySelector('body').style.overflow = 'hidden'); + } + _dialogHeader(t) { + return this.hideHeader + ? e`` + : e`

    ${this.title}

    `; + } + _closeModal() { + (this.isOpen = !1), + this.shadowRoot.querySelector('dialog').close(), + (document.querySelector('body').style.overflow = 'initial'); + } + _cancelModal() { + this._triggerClose('cancel'); + } + _triggerClose(t) { + this.dispatchEvent(new CustomEvent('close', { detail: { action: t } })); + } + _dialogClick(t) { + if ('DIALOG' !== t.target.tagName) return; + const e = t.target.getBoundingClientRect(); + !1 === + (e.top <= t.clientY && + t.clientY <= e.top + e.height && + e.left <= t.clientX && + t.clientX <= e.left + e.width) && this._cancelModal(); + } + _dialogKeypress(t) { + 'Escape' === t.key && this._cancelModal(); + } + _helpMore() { + return this.isHelp + ? e`
    ${o('Need more help?')}
    ${o('Read the documentation')}
    ` + : null; + } + firstUpdated() { + this.isOpen && this._openModal(); + } + _onButtonClick() { + this._triggerClose('button'); + } + render() { + const t = e`xmlns="http://www.w3.org/2000/svg">`; + return e`
    ${this._dialogHeader(t)}
    ${this._helpMore()}
    ${this.hideButton ? null : e``}`; + } + }, +); +//# sourceMappingURL=dt-modal.js.map diff --git a/dt-assets/build/components/layout/dt-modal/dt-modal.js.map b/dt-assets/build/components/layout/dt-modal/dt-modal.js.map new file mode 100644 index 0000000000..ee0e187a5c --- /dev/null +++ b/dt-assets/build/components/layout/dt-modal/dt-modal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-modal.js","sources":["../../../src/components/layout/dt-modal/dt-modal.js"],"sourcesContent":["import { html, css } from 'lit';\nimport { msg } from '@lit/localize';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport DtBase from '../../dt-base.js';\n\nexport class DtModal extends DtBase {\n static get styles() {\n return css`\n :host {\n display: block;\n font-family: var(--font-family);\n }\n :host:has(dialog[open]) {\n overflow: hidden;\n }\n\n .dt-modal {\n display: block;\n background: var(--dt-modal-background-color, #fff);\n color: var(--dt-modal-color, #000);\n max-inline-size: min(90vw, 100%);\n max-block-size: min(80vh, 100%);\n max-block-size: min(80dvb, 100%);\n margin: auto;\n height: fit-content;\n padding: var(--dt-modal-padding, 1em);\n position: fixed;\n inset: 0;\n border-radius: 1em;\n border: none;\n box-shadow: var(--shadow-6);\n z-index: 1000;\n transition: opacity 0.1s ease-in-out;\n }\n\n dialog:not([open]) {\n pointer-events: none;\n opacity: 0;\n }\n\n dialog::backdrop {\n background: var(--dt-modal-backdrop-color, rgba(0, 0, 0, 0.25));\n animation: var(--dt-modal-animation, fade-in 0.75s);\n }\n\n @keyframes fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n line-height: 1.4;\n text-rendering: optimizeLegibility;\n color: inherit;\n font-style: normal;\n font-weight: 300;\n margin: 0;\n }\n\n form {\n display: grid;\n height: fit-content;\n grid-template-columns: 1fr;\n grid-template-rows: 100px auto 100px;\n grid-template-areas:\n 'header'\n 'main'\n 'footer';\n position: relative;\n }\n\n form.no-header {\n grid-template-rows: auto auto;\n grid-template-areas:\n 'main'\n 'footer';\n }\n\n header {\n grid-area: header;\n display: flex;\n justify-content: space-between;\n }\n\n .button {\n color: var(--dt-modal-button-color, #fff);\n background: var(--dt-modal-button-background, #000);\n font-size: 1rem;\n border: 0.1em solid var(--dt-modal-button-background, #000);\n border-radius: 0.25em;\n padding: 0.25rem 0.5rem;\n cursor: pointer;\n text-decoration: none;\n }\n .button.opener {\n color: var(--dt-modal-button-opener-color,var(--dt-modal-button-color, #fff) );\n background: var(--dt-modal-button-opener-background, var(--dt-modal-button-background, #000) );\n border: 0.1em solid var(--dt-modal-button-opener-background, #000);\n }\n button.toggle {\n margin-inline-end: 0;\n margin-inline-start: auto;\n background: none;\n border: none;\n color: inherit;\n cursor: pointer;\n display: flex;\n align-items: flex-start;\n }\n\n article {\n grid-area: main;\n overflow: auto;\n }\n\n footer {\n grid-area: footer;\n display: flex;\n justify-content: space-between;\n }\n\n .help-more h5 {\n font-size: 0.75rem;\n display: block;\n }\n .help-more .button {\n font-size: 0.75rem;\n display: block;\n }\n `;\n }\n\n static get properties() {\n return {\n title: { type: String },\n context: { type: String },\n isHelp: { type: Boolean },\n isOpen: { type: Boolean },\n hideHeader: { type: Boolean },\n hideButton: { type: Boolean },\n buttonClass: { type: Object },\n buttonStyle: { type: Object },\n };\n }\n\n constructor() {\n super();\n this.context = 'default';\n this.addEventListener('open', (e) => this._openModal());\n this.addEventListener('close', (e) => this._closeModal());\n }\n\n _openModal() {\n this.isOpen = true;\n this.shadowRoot.querySelector('dialog').showModal();\n\n document.querySelector('body').style.overflow = \"hidden\"\n }\n\n _dialogHeader(svg) {\n if (!this.hideHeader) {\n return html`\n
    \n

    ${this.title}

    \n \n
    \n `;\n }\n return html``;\n }\n\n _closeModal() {\n this.isOpen = false;\n this.shadowRoot.querySelector('dialog').close();\n document.querySelector('body').style.overflow = \"initial\"\n }\n _cancelModal() {\n this._triggerClose('cancel');\n }\n _triggerClose(action) {\n this.dispatchEvent(new CustomEvent('close', {\n detail: {\n action,\n },\n }));\n }\n\n _dialogClick(e) {\n if (e.target.tagName !== 'DIALOG') {\n // This prevents issues with forms\n return;\n }\n\n // Close the modal if the user clicks outside of the modal\n const rect = e.target.getBoundingClientRect();\n\n const clickedInDialog =\n rect.top <= e.clientY &&\n e.clientY <= rect.top + rect.height &&\n rect.left <= e.clientX &&\n e.clientX <= rect.left + rect.width;\n\n if (clickedInDialog === false) {\n this._cancelModal();\n }\n }\n\n _dialogKeypress(e) {\n if (e.key === 'Escape') {\n this._cancelModal();\n }\n }\n\n _helpMore() {\n return this.isHelp\n ? html`\n
    \n
    ${msg('Need more help?')}
    \n ${msg('Read the documentation')}\n
    \n `\n : null;\n }\n\n firstUpdated() {\n if (this.isOpen) {\n this._openModal();\n }\n }\n\n _onButtonClick() {\n this._triggerClose('button');\n }\n\n render() {\n // prettier-ignore\n const svg = html`\n \n xmlns=\"http://www.w3.org/2000/svg\">\n \n \n \n `;\n return html`\n \n
    \n ${this._dialogHeader(svg)}\n
    \n \n
    \n
    \n \n ${msg('Close')}\n \n ${this._helpMore()}\n
    \n
    \n \n\n ${!this.hideButton\n ? html`\n \n ${msg('Open Dialog')}\n \n ` : null}\n `;\n }\n}\n\nwindow.customElements.define('dt-modal', DtModal);\n"],"names":["window","customElements","define","DtBase","styles","css","properties","title","type","String","context","isHelp","Boolean","isOpen","hideHeader","hideButton","buttonClass","Object","buttonStyle","constructor","super","this","addEventListener","e","_openModal","_closeModal","shadowRoot","querySelector","showModal","document","style","overflow","_dialogHeader","svg","html","_cancelModal","close","_triggerClose","action","dispatchEvent","CustomEvent","detail","_dialogClick","target","tagName","rect","getBoundingClientRect","top","clientY","height","left","clientX","width","_dialogKeypress","key","_helpMore","msg","firstUpdated","_onButtonClick","render","classMap","styleMap"],"mappings":"gRAqTAA,OAAOC,eAAeC,OAAO,WA/StB,cAAsBC,EAChBC,oBACT,OAAOC,CAAG,g8DAoIX,CAEUC,wBACT,MAAO,CACLC,MAAO,CAAEC,KAAMC,QACfC,QAAS,CAAEF,KAAMC,QACjBE,OAAQ,CAAEH,KAAMI,SAChBC,OAAQ,CAAEL,KAAMI,SAChBE,WAAY,CAAEN,KAAMI,SACpBG,WAAY,CAAEP,KAAMI,SACpBI,YAAa,CAAER,KAAMS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AKW,cAAcC,uJAUJZ,KAAKqC,6CAEcF,EAAI,4BAEhCnC,KAAKkC,uCAKVlC,KAAKN,WAYJ,KAXFmB,CAAI,sCAEyB0B,EAASvC,KAAKL,aAAe,CAAE,mEAIlDK,KAAKG,sBACPqC,EAASxC,KAAKH,aAAe,gCAEXsC,EAAI,kCAInC"} \ No newline at end of file diff --git a/dt-assets/build/components/layout/dt-tile/dt-tile.js b/dt-assets/build/components/layout/dt-tile/dt-tile.js index e09f25b88e..7167ac33f9 100644 --- a/dt-assets/build/components/layout/dt-tile/dt-tile.js +++ b/dt-assets/build/components/layout/dt-tile/dt-tile.js @@ -1 +1,33 @@ -import{i as e,b as t,y as o}from"../../lit-element-2409d5fe.js";import{D as r}from"../../dt-base.js";import"../../lit-localize-763e4978.js";window.customElements.define("dt-tile",class extends r{static get styles(){return e`:host{font-family:var(--dt-tile-font-family,var(--font-family));font-size:var(--dt-tile-font-size,14px);font-weight:var(--dt-tile-font-weight,700);overflow:hidden;text-overflow:ellipsis}section{background-color:var(--dt-tile-background-color,#fefefe);border-top:var(--dt-tile-border-top,1px solid #cecece);border-bottom:var(--dt-tile-border-bottom,1px solid #cecece);border-right:var(--dt-tile-border-right,1px solid #cecece);border-left:var(--dt-tile-border-left,1px solid #cecece);border-radius:var(--dt-tile-border-radius,10px);box-shadow:var(--dt-tile-box-shadow,0 2px 4px rgb(0 0 0 / 25%));padding:1rem;margin:var(--dt-tile-margin,0)}h3{line-height:1.4;margin:var(--dt-tile-header-margin,0 0 .5rem 0);text-rendering:optimizeLegibility;font-family:var(--dt-tile-font-family,var(--font-family));font-style:normal;font-weight:var(--dt-tile-header-font-weight,300)}.section-header{color:var(--dt-tile-header-color,#3f729b);font-size:1.5rem;display:flex;text-transform:var(--dt-tile-header-text-transform,capitalize);justify-content:var(--dt-tile-header-justify-content)}.section-body{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));column-gap:1.4rem;transition:height 1s ease 0s;height:auto}.section-body.collapsed{height:0!important;overflow:hidden}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none}.chevron::before{border-color:var(--dt-tile-header-color,var(--primary-color));border-style:solid;border-width:2px 2px 0 0;content:'';display:inline-block;height:1em;width:1em;left:.15em;position:relative;top:.15em;transform:rotate(-45deg);vertical-align:top}.chevron.down:before{top:0;transform:rotate(135deg)}`}static get properties(){return{title:{type:String},expands:{type:Boolean},collapsed:{type:Boolean}}}get hasHeading(){return this.title||this.expands}_toggle(){this.collapsed=!this.collapsed}renderHeading(){return this.hasHeading?o`

    ${this.title} ${this.expands?o``:null}

    `:t}render(){return o`
    ${this.renderHeading()}
    `}}); +import { i as e, b as t, y as o } from '../../lit-element-2409d5fe.js'; +import { D as r } from '../../dt-base.js'; +import '../../lit-localize-763e4978.js'; +window.customElements.define( + 'dt-tile', + class extends r { + static get styles() { + return e`:host{font-family:var(--dt-tile-font-family,var(--font-family));font-size:var(--dt-tile-font-size,14px);font-weight:var(--dt-tile-font-weight,700);overflow:hidden;text-overflow:ellipsis}section{background-color:var(--dt-tile-background-color,#fefefe);border-top:var(--dt-tile-border-top,1px solid #cecece);border-bottom:var(--dt-tile-border-bottom,1px solid #cecece);border-right:var(--dt-tile-border-right,1px solid #cecece);border-left:var(--dt-tile-border-left,1px solid #cecece);border-radius:var(--dt-tile-border-radius,10px);box-shadow:var(--dt-tile-box-shadow,0 2px 4px rgb(0 0 0 / 25%));padding:1rem;margin:var(--dt-tile-margin,0)}h3{line-height:1.4;margin:var(--dt-tile-header-margin,0 0 .5rem 0);text-rendering:optimizeLegibility;font-family:var(--dt-tile-font-family,var(--font-family));font-style:normal;font-weight:var(--dt-tile-header-font-weight,300)}.section-header{color:var(--dt-tile-header-color,#3f729b);font-size:1.5rem;display:flex;text-transform:var(--dt-tile-header-text-transform,capitalize);justify-content:var(--dt-tile-header-justify-content)}.section-body{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));column-gap:1.4rem;transition:height 1s ease 0s;height:auto}.section-body.collapsed{height:0!important;overflow:hidden}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none}.chevron::before{border-color:var(--dt-tile-header-color,var(--primary-color));border-style:solid;border-width:2px 2px 0 0;content:'';display:inline-block;height:1em;width:1em;left:.15em;position:relative;top:.15em;transform:rotate(-45deg);vertical-align:top}.chevron.down:before{top:0;transform:rotate(135deg)}`; + } + static get properties() { + return { + title: { type: String }, + expands: { type: Boolean }, + collapsed: { type: Boolean }, + }; + } + get hasHeading() { + return this.title || this.expands; + } + _toggle() { + this.collapsed = !this.collapsed; + } + renderHeading() { + return this.hasHeading + ? o`

    ${this.title} ${this.expands ? o`` : null}

    ` + : t; + } + render() { + return o`
    ${this.renderHeading()}
    `; + } + }, +); +//# sourceMappingURL=dt-tile.js.map diff --git a/dt-assets/build/components/layout/dt-tile/dt-tile.js.map b/dt-assets/build/components/layout/dt-tile/dt-tile.js.map new file mode 100644 index 0000000000..a9e81dd220 --- /dev/null +++ b/dt-assets/build/components/layout/dt-tile/dt-tile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dt-tile.js","sources":["../../../src/components/layout/dt-tile/dt-tile.js"],"sourcesContent":["import { html, css, nothing } from 'lit';\nimport DtBase from '../../dt-base.js';\n\nexport class DtTile extends DtBase {\n static get styles() {\n return css`\n :host {\n font-family: var(--dt-tile-font-family, var(--font-family));\n font-size: var(--dt-tile-font-size, 14px);\n font-weight: var(--dt-tile-font-weight, 700);\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n section {\n background-color: var(--dt-tile-background-color, #fefefe);\n border-top: var(--dt-tile-border-top, 1px solid #cecece);\n border-bottom: var(--dt-tile-border-bottom, 1px solid #cecece);\n border-right: var(--dt-tile-border-right, 1px solid #cecece);\n border-left: var(--dt-tile-border-left, 1px solid #cecece);\n border-radius: var(--dt-tile-border-radius, 10px);\n box-shadow: var(--dt-tile-box-shadow, 0 2px 4px rgb(0 0 0 / 25%));\n padding: 1rem;\n margin: var(--dt-tile-margin, 0); \n }\n\n h3 {\n line-height: 1.4;\n margin: var(--dt-tile-header-margin, 0 0 0.5rem 0);\n text-rendering: optimizeLegibility;\n font-family: var(--dt-tile-font-family, var(--font-family));\n font-style: normal;\n font-weight: var(--dt-tile-header-font-weight, 300);\n }\n\n .section-header {\n color: var(--dt-tile-header-color, #3f729b);\n font-size: 1.5rem;\n display: flex;\n text-transform: var(--dt-tile-header-text-transform, capitalize);\n justify-content: var(--dt-tile-header-justify-content);\n }\n\n .section-body {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));\n column-gap: 1.4rem;\n transition: height 1s ease 0s;\n height: auto;\n }\n .section-body.collapsed {\n height: 0 !important;\n overflow: hidden;\n }\n\n button.toggle {\n margin-inline-end: 0;\n margin-inline-start: auto;\n background: none;\n border: none;\n }\n\n .chevron::before {\n border-color: var(--dt-tile-header-color, var(--primary-color));\n border-style: solid;\n border-width: 2px 2px 0 0;\n content: '';\n display: inline-block;\n height: 1em;\n width: 1em;\n left: 0.15em;\n position: relative;\n top: 0.15em;\n transform: rotate(-45deg);\n vertical-align: top;\n }\n\n .chevron.down:before {\n top: 0;\n transform: rotate(135deg);\n }\n `;\n }\n\n static get properties() {\n return {\n title: { type: String },\n expands: { type: Boolean },\n collapsed: { type: Boolean },\n };\n }\n\n get hasHeading() {\n return this.title || this.expands;\n }\n\n _toggle() {\n // const body = this.renderRoot.querySelector('.section-body');\n // if (!this.collapsed && body && body.clientHeight) {\n // body.style.height = body.clientHeight + 'px';\n // }\n this.collapsed = !this.collapsed;\n }\n\n renderHeading() {\n if (!this.hasHeading) {\n return nothing\n }\n\n return html`\n

    \n ${this.title}\n ${this.expands\n ? html`\n \n  \n \n `\n : null}\n

    \n `\n }\n\n render() {\n return html`\n
    \n ${this.renderHeading()}\n
    \n \n
    \n
    \n `;\n }\n}\n\nwindow.customElements.define('dt-tile', DtTile);\n"],"names":["window","customElements","define","DtBase","styles","css","properties","title","type","String","expands","Boolean","collapsed","hasHeading","this","_toggle","renderHeading","html","nothing","render"],"mappings":"4IA0IAA,OAAOC,eAAeC,OAAO,UAvItB,cAAqBC,EACfC,oBACT,OAAOC,CAAG,yoDA6EX,CAEUC,wBACT,MAAO,CACLC,MAAO,CAAEC,KAAMC,QACfC,QAAS,CAAEF,KAAMG,SACjBC,UAAW,CAAEJ,KAAMG,SAEtB,CAEGE,iBACF,OAAOC,KAAKP,OAASO,KAAKJ,OAC3B,CAEDK,UAKED,KAAKF,WAAaE,KAAKF,SACxB,CAEDI,gBACE,OAAKF,KAAKD,WAIHI,CAAI,8BAEHH,KAAKP,SACLO,KAAKJ,QACHO,CAAI,mBAEUH,KAAKC,kCACSD,KAAKF,UAAY,OAAS,mBAKtD,YAfDM,CAkBV,CAEDC,SACE,OAAOF,CAAI,YAELH,KAAKE,2CACoBF,KAAKF,UAAY,YAAc,qCAK/D"} \ No newline at end of file diff --git a/dt-assets/build/components/layout/index.js b/dt-assets/build/components/layout/index.js index 1e63e3c60a..e5e0c4f96c 100644 --- a/dt-assets/build/components/layout/index.js +++ b/dt-assets/build/components/layout/index.js @@ -1 +1,15 @@ -import"./dt-alert/dt-alert.js";import"./dt-list/dt-list.js";import"./dt-modal/dt-modal.js";import"./dt-tile/dt-tile.js";import"../lit-element-2409d5fe.js";import"../class-map-8d921948.js";import"../directive-de55b00a.js";import"../dt-base.js";import"../lit-localize-763e4978.js";import"../map-c0e24c36.js";import"../repeat-1a2b8966.js";import"../if-defined-11ddebeb.js";import"../icons/dt-star.js";import"../style-map-ac85d91b.js"; +import './dt-alert/dt-alert.js'; +import './dt-list/dt-list.js'; +import './dt-modal/dt-modal.js'; +import './dt-tile/dt-tile.js'; +import '../lit-element-2409d5fe.js'; +import '../class-map-8d921948.js'; +import '../directive-de55b00a.js'; +import '../dt-base.js'; +import '../lit-localize-763e4978.js'; +import '../map-c0e24c36.js'; +import '../repeat-1a2b8966.js'; +import '../if-defined-11ddebeb.js'; +import '../icons/dt-star.js'; +import '../style-map-ac85d91b.js'; +//# sourceMappingURL=index.js.map diff --git a/dt-assets/build/components/layout/index.js.map b/dt-assets/build/components/layout/index.js.map new file mode 100644 index 0000000000..c8e9b4f445 --- /dev/null +++ b/dt-assets/build/components/layout/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/dt-assets/build/components/lit-element-2409d5fe.js b/dt-assets/build/components/lit-element-2409d5fe.js index 6b93698089..490ce98823 100644 --- a/dt-assets/build/components/lit-element-2409d5fe.js +++ b/dt-assets/build/components/lit-element-2409d5fe.js @@ -3,21 +3,956 @@ * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),i=new WeakMap;class n{constructor(t,e,i){if(this._$cssResult$=!0,i!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=i.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&i.set(s,t))}return t}toString(){return this.cssText}}const o=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,s,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[i+1]),t[0]);return new n(i,t,s)},r=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,s))(e)})(t):t +const t = window, + e = + t.ShadowRoot && + (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && + 'adoptedStyleSheets' in Document.prototype && + 'replace' in CSSStyleSheet.prototype, + s = Symbol(), + i = new WeakMap(); +class n { + constructor(t, e, i) { + if (((this._$cssResult$ = !0), i !== s)) + throw Error( + 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.', + ); + (this.cssText = t), (this.t = e); + } + get styleSheet() { + let t = this.o; + const s = this.t; + if (e && void 0 === t) { + const e = void 0 !== s && 1 === s.length; + e && (t = i.get(s)), + void 0 === t && + ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), + e && i.set(s, t)); + } + return t; + } + toString() { + return this.cssText; + } +} +const o = (t, ...e) => { + const i = + 1 === t.length + ? t[0] + : e.reduce( + (e, s, i) => + e + + ((t) => { + if (!0 === t._$cssResult$) return t.cssText; + if ('number' == typeof t) return t; + throw Error( + "Value passed to 'css' function must be a 'css' function result: " + + t + + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.", + ); + })(s) + + t[i + 1], + t[0], + ); + return new n(i, t, s); + }, + r = e + ? (t) => t + : (t) => + t instanceof CSSStyleSheet + ? ((t) => { + let e = ''; + for (const s of t.cssRules) e += s.cssText; + return ((t) => + new n('string' == typeof t ? t : t + '', void 0, s))(e); + })(t) + : t; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */;var l;const h=window,a=h.trustedTypes,d=a?a.emptyScript:"",c=h.reactiveElementPolyfillSupport,u={toAttribute(t,e){switch(e){case Boolean:t=t?d:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},p=(t,e)=>e!==t&&(e==e||t==t),$={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:p};class v extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;null!==(e=this.h)&&void 0!==e||(this.h=[]),this.h.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,s)=>{const i=this._$Ep(s,e);void 0!==i&&(this._$Ev.set(i,s),t.push(i))})),t}static createProperty(t,e=$){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const s="symbol"==typeof t?Symbol():"__"+t,i=this.getPropertyDescriptor(t,s,e);void 0!==i&&Object.defineProperty(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(i){const n=this[t];this[e]=i,this.requestUpdate(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||$}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of e)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(r(t))}else void 0!==t&&e.push(r(t));return e}static _$Ep(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,s;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var s;const i=null!==(s=this.shadowRoot)&&void 0!==s?s:this.attachShadow(this.constructor.shadowRootOptions);return((s,i)=>{e?s.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):i.forEach((e=>{const i=document.createElement("style"),n=t.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,s.appendChild(i)}))})(i,this.constructor.elementStyles),i}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e,s=$){var i;const n=this.constructor._$Ep(t,s);if(void 0!==n&&!0===s.reflect){const o=(void 0!==(null===(i=s.converter)||void 0===i?void 0:i.toAttribute)?s.converter:u).toAttribute(e,s.type);this._$El=t,null==o?this.removeAttribute(n):this.setAttribute(n,o),this._$El=null}}_$AK(t,e){var s;const i=this.constructor,n=i._$Ev.get(t);if(void 0!==n&&this._$El!==n){const t=i.getPropertyOptions(n),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(s=t.converter)||void 0===s?void 0:s.fromAttribute)?t.converter:u;this._$El=n,this[n]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,s){let i=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||p)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===s.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(s)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}} + */ var l; +const h = window, + a = h.trustedTypes, + d = a ? a.emptyScript : '', + c = h.reactiveElementPolyfillSupport, + u = { + toAttribute(t, e) { + switch (e) { + case Boolean: + t = t ? d : null; + break; + case Object: + case Array: + t = null == t ? t : JSON.stringify(t); + } + return t; + }, + fromAttribute(t, e) { + let s = t; + switch (e) { + case Boolean: + s = null !== t; + break; + case Number: + s = null === t ? null : Number(t); + break; + case Object: + case Array: + try { + s = JSON.parse(t); + } catch (t) { + s = null; + } + } + return s; + }, + }, + p = (t, e) => e !== t && (e == e || t == t), + $ = { attribute: !0, type: String, converter: u, reflect: !1, hasChanged: p }; +class v extends HTMLElement { + constructor() { + super(), + (this._$Ei = new Map()), + (this.isUpdatePending = !1), + (this.hasUpdated = !1), + (this._$El = null), + this.u(); + } + static addInitializer(t) { + var e; + (null !== (e = this.h) && void 0 !== e) || (this.h = []), this.h.push(t); + } + static get observedAttributes() { + this.finalize(); + const t = []; + return ( + this.elementProperties.forEach((e, s) => { + const i = this._$Ep(s, e); + void 0 !== i && (this._$Ev.set(i, s), t.push(i)); + }), + t + ); + } + static createProperty(t, e = $) { + if ( + (e.state && (e.attribute = !1), + this.finalize(), + this.elementProperties.set(t, e), + !e.noAccessor && !this.prototype.hasOwnProperty(t)) + ) { + const s = 'symbol' == typeof t ? Symbol() : '__' + t, + i = this.getPropertyDescriptor(t, s, e); + void 0 !== i && Object.defineProperty(this.prototype, t, i); + } + } + static getPropertyDescriptor(t, e, s) { + return { + get() { + return this[e]; + }, + set(i) { + const n = this[t]; + (this[e] = i), this.requestUpdate(t, n, s); + }, + configurable: !0, + enumerable: !0, + }; + } + static getPropertyOptions(t) { + return this.elementProperties.get(t) || $; + } + static finalize() { + if (this.hasOwnProperty('finalized')) return !1; + this.finalized = !0; + const t = Object.getPrototypeOf(this); + if ( + (t.finalize(), + (this.elementProperties = new Map(t.elementProperties)), + (this._$Ev = new Map()), + this.hasOwnProperty('properties')) + ) { + const t = this.properties, + e = [ + ...Object.getOwnPropertyNames(t), + ...Object.getOwnPropertySymbols(t), + ]; + for (const s of e) this.createProperty(s, t[s]); + } + return (this.elementStyles = this.finalizeStyles(this.styles)), !0; + } + static finalizeStyles(t) { + const e = []; + if (Array.isArray(t)) { + const s = new Set(t.flat(1 / 0).reverse()); + for (const t of s) e.unshift(r(t)); + } else void 0 !== t && e.push(r(t)); + return e; + } + static _$Ep(t, e) { + const s = e.attribute; + return !1 === s + ? void 0 + : 'string' == typeof s + ? s + : 'string' == typeof t + ? t.toLowerCase() + : void 0; + } + u() { + var t; + (this._$E_ = new Promise((t) => (this.enableUpdating = t))), + (this._$AL = new Map()), + this._$Eg(), + this.requestUpdate(), + null === (t = this.constructor.h) || + void 0 === t || + t.forEach((t) => t(this)); + } + addController(t) { + var e, s; + (null !== (e = this._$ES) && void 0 !== e ? e : (this._$ES = [])).push(t), + void 0 !== this.renderRoot && + this.isConnected && + (null === (s = t.hostConnected) || void 0 === s || s.call(t)); + } + removeController(t) { + var e; + null === (e = this._$ES) || + void 0 === e || + e.splice(this._$ES.indexOf(t) >>> 0, 1); + } + _$Eg() { + this.constructor.elementProperties.forEach((t, e) => { + this.hasOwnProperty(e) && (this._$Ei.set(e, this[e]), delete this[e]); + }); + } + createRenderRoot() { + var s; + const i = + null !== (s = this.shadowRoot) && void 0 !== s + ? s + : this.attachShadow(this.constructor.shadowRootOptions); + return ( + ((s, i) => { + e + ? (s.adoptedStyleSheets = i.map((t) => + t instanceof CSSStyleSheet ? t : t.styleSheet, + )) + : i.forEach((e) => { + const i = document.createElement('style'), + n = t.litNonce; + void 0 !== n && i.setAttribute('nonce', n), + (i.textContent = e.cssText), + s.appendChild(i); + }); + })(i, this.constructor.elementStyles), + i + ); + } + connectedCallback() { + var t; + void 0 === this.renderRoot && (this.renderRoot = this.createRenderRoot()), + this.enableUpdating(!0), + null === (t = this._$ES) || + void 0 === t || + t.forEach((t) => { + var e; + return null === (e = t.hostConnected) || void 0 === e + ? void 0 + : e.call(t); + }); + } + enableUpdating(t) {} + disconnectedCallback() { + var t; + null === (t = this._$ES) || + void 0 === t || + t.forEach((t) => { + var e; + return null === (e = t.hostDisconnected) || void 0 === e + ? void 0 + : e.call(t); + }); + } + attributeChangedCallback(t, e, s) { + this._$AK(t, s); + } + _$EO(t, e, s = $) { + var i; + const n = this.constructor._$Ep(t, s); + if (void 0 !== n && !0 === s.reflect) { + const o = ( + void 0 !== + (null === (i = s.converter) || void 0 === i ? void 0 : i.toAttribute) + ? s.converter + : u + ).toAttribute(e, s.type); + (this._$El = t), + null == o ? this.removeAttribute(n) : this.setAttribute(n, o), + (this._$El = null); + } + } + _$AK(t, e) { + var s; + const i = this.constructor, + n = i._$Ev.get(t); + if (void 0 !== n && this._$El !== n) { + const t = i.getPropertyOptions(n), + o = + 'function' == typeof t.converter + ? { fromAttribute: t.converter } + : void 0 !== + (null === (s = t.converter) || void 0 === s + ? void 0 + : s.fromAttribute) + ? t.converter + : u; + (this._$El = n), + (this[n] = o.fromAttribute(e, t.type)), + (this._$El = null); + } + } + requestUpdate(t, e, s) { + let i = !0; + void 0 !== t && + (((s = s || this.constructor.getPropertyOptions(t)).hasChanged || p)( + this[t], + e, + ) + ? (this._$AL.has(t) || this._$AL.set(t, e), + !0 === s.reflect && + this._$El !== t && + (void 0 === this._$EC && (this._$EC = new Map()), + this._$EC.set(t, s))) + : (i = !1)), + !this.isUpdatePending && i && (this._$E_ = this._$Ej()); + } + async _$Ej() { + this.isUpdatePending = !0; + try { + await this._$E_; + } catch (t) { + Promise.reject(t); + } + const t = this.scheduleUpdate(); + return null != t && (await t), !this.isUpdatePending; + } + scheduleUpdate() { + return this.performUpdate(); + } + performUpdate() { + var t; + if (!this.isUpdatePending) return; + this.hasUpdated, + this._$Ei && + (this._$Ei.forEach((t, e) => (this[e] = t)), (this._$Ei = void 0)); + let e = !1; + const s = this._$AL; + try { + (e = this.shouldUpdate(s)), + e + ? (this.willUpdate(s), + null === (t = this._$ES) || + void 0 === t || + t.forEach((t) => { + var e; + return null === (e = t.hostUpdate) || void 0 === e + ? void 0 + : e.call(t); + }), + this.update(s)) + : this._$Ek(); + } catch (t) { + throw ((e = !1), this._$Ek(), t); + } + e && this._$AE(s); + } + willUpdate(t) {} + _$AE(t) { + var e; + null === (e = this._$ES) || + void 0 === e || + e.forEach((t) => { + var e; + return null === (e = t.hostUpdated) || void 0 === e + ? void 0 + : e.call(t); + }), + this.hasUpdated || ((this.hasUpdated = !0), this.firstUpdated(t)), + this.updated(t); + } + _$Ek() { + (this._$AL = new Map()), (this.isUpdatePending = !1); + } + get updateComplete() { + return this.getUpdateComplete(); + } + getUpdateComplete() { + return this._$E_; + } + shouldUpdate(t) { + return !0; + } + update(t) { + void 0 !== this._$EC && + (this._$EC.forEach((t, e) => this._$EO(e, this[e], t)), + (this._$EC = void 0)), + this._$Ek(); + } + updated(t) {} + firstUpdated(t) {} +} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -var _;v.finalized=!0,v.elementProperties=new Map,v.elementStyles=[],v.shadowRootOptions={mode:"open"},null==c||c({ReactiveElement:v}),(null!==(l=h.reactiveElementVersions)&&void 0!==l?l:h.reactiveElementVersions=[]).push("1.4.1");const A=window,f=A.trustedTypes,g=f?f.createPolicy("lit-html",{createHTML:t=>t}):void 0,y=`lit$${(Math.random()+"").slice(9)}$`,m="?"+y,E=`<${m}>`,S=document,b=(t="")=>S.createComment(t),C=t=>null===t||"object"!=typeof t&&"function"!=typeof t,w=Array.isArray,x=t=>w(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,P=/-->/g,H=/>/g,O=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),N=/'/g,T=/"/g,R=/^(?:script|style|textarea|title)$/i,M=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),k=Symbol.for("lit-noChange"),L=Symbol.for("lit-nothing"),j=new WeakMap,B=S.createTreeWalker(S,129,null,!1),z=(t,e)=>{const s=t.length-1,i=[];let n,o=2===e?"":"",r=U;for(let e=0;e"===h[0]?(r=null!=n?n:U,a=-1):void 0===h[1]?a=-2:(a=r.lastIndex-h[2].length,l=h[1],r=void 0===h[3]?O:'"'===h[3]?T:N):r===T||r===N?r=O:r===P||r===H?r=U:(r=O,n=void 0);const c=r===O&&t[e+1].startsWith("/>")?" ":"";o+=r===U?s+E:a>=0?(i.push(l),s.slice(0,a)+"$lit$"+s.slice(a)+y+c):s+y+(-2===a?(i.push(void 0),e):c)}const l=o+(t[s]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==g?g.createHTML(l):l,i]};class D{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let n=0,o=0;const r=t.length-1,l=this.parts,[h,a]=z(t,e);if(this.el=D.createElement(h,s),B.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(i=B.nextNode())&&l.length0){i.textContent=f?f.emptyScript:"";for(let s=0;s2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=L}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,i){const n=this.strings;let o=!1;if(void 0===n)t=I(this,t,e,0),o=!C(t)||t!==this._$AH&&t!==k,o&&(this._$AH=t);else{const i=t;let r,l;for(t=n[0],r=0;r t }) : void 0, + y = `lit$${(Math.random() + '').slice(9)}$`, + m = '?' + y, + E = `<${m}>`, + S = document, + b = (t = '') => S.createComment(t), + C = (t) => null === t || ('object' != typeof t && 'function' != typeof t), + w = Array.isArray, + x = (t) => + w(t) || 'function' == typeof (null == t ? void 0 : t[Symbol.iterator]), + U = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, + P = /-->/g, + H = />/g, + O = RegExp( + '>|[ \t\n\f\r](?:([^\\s"\'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r"\'`<>=]|("|\')|))|$)', + 'g', + ), + N = /'/g, + T = /"/g, + R = /^(?:script|style|textarea|title)$/i, + M = ( + (t) => + (e, ...s) => ({ _$litType$: t, strings: e, values: s }) + )(1), + k = Symbol.for('lit-noChange'), + L = Symbol.for('lit-nothing'), + j = new WeakMap(), + B = S.createTreeWalker(S, 129, null, !1), + z = (t, e) => { + const s = t.length - 1, + i = []; + let n, + o = 2 === e ? '' : '', + r = U; + for (let e = 0; e < s; e++) { + const s = t[e]; + let l, + h, + a = -1, + d = 0; + for (; d < s.length && ((r.lastIndex = d), (h = r.exec(s)), null !== h); ) + (d = r.lastIndex), + r === U + ? '!--' === h[1] + ? (r = P) + : void 0 !== h[1] + ? (r = H) + : void 0 !== h[2] + ? (R.test(h[2]) && (n = RegExp('' === h[0] + ? ((r = null != n ? n : U), (a = -1)) + : void 0 === h[1] + ? (a = -2) + : ((a = r.lastIndex - h[2].length), + (l = h[1]), + (r = void 0 === h[3] ? O : '"' === h[3] ? T : N)) + : r === T || r === N + ? (r = O) + : r === P || r === H + ? (r = U) + : ((r = O), (n = void 0)); + const c = r === O && t[e + 1].startsWith('/>') ? ' ' : ''; + o += + r === U + ? s + E + : a >= 0 + ? (i.push(l), s.slice(0, a) + '$lit$' + s.slice(a) + y + c) + : s + y + (-2 === a ? (i.push(void 0), e) : c); + } + const l = o + (t[s] || '') + (2 === e ? '' : ''); + if (!Array.isArray(t) || !t.hasOwnProperty('raw')) + throw Error('invalid template strings array'); + return [void 0 !== g ? g.createHTML(l) : l, i]; + }; +class D { + constructor({ strings: t, _$litType$: e }, s) { + let i; + this.parts = []; + let n = 0, + o = 0; + const r = t.length - 1, + l = this.parts, + [h, a] = z(t, e); + if ( + ((this.el = D.createElement(h, s)), + (B.currentNode = this.el.content), + 2 === e) + ) { + const t = this.el.content, + e = t.firstChild; + e.remove(), t.append(...e.childNodes); + } + for (; null !== (i = B.nextNode()) && l.length < r; ) { + if (1 === i.nodeType) { + if (i.hasAttributes()) { + const t = []; + for (const e of i.getAttributeNames()) + if (e.endsWith('$lit$') || e.startsWith(y)) { + const s = a[o++]; + if ((t.push(e), void 0 !== s)) { + const t = i.getAttribute(s.toLowerCase() + '$lit$').split(y), + e = /([.?@])?(.*)/.exec(s); + l.push({ + type: 1, + index: n, + name: e[2], + strings: t, + ctor: + '.' === e[1] ? J : '?' === e[1] ? Z : '@' === e[1] ? F : q, + }); + } else l.push({ type: 6, index: n }); + } + for (const e of t) i.removeAttribute(e); + } + if (R.test(i.tagName)) { + const t = i.textContent.split(y), + e = t.length - 1; + if (e > 0) { + i.textContent = f ? f.emptyScript : ''; + for (let s = 0; s < e; s++) + i.append(t[s], b()), + B.nextNode(), + l.push({ type: 2, index: ++n }); + i.append(t[e], b()); + } + } + } else if (8 === i.nodeType) + if (i.data === m) l.push({ type: 2, index: n }); + else { + let t = -1; + for (; -1 !== (t = i.data.indexOf(y, t + 1)); ) + l.push({ type: 7, index: n }), (t += y.length - 1); + } + n++; + } + } + static createElement(t, e) { + const s = S.createElement('template'); + return (s.innerHTML = t), s; + } +} +function I(t, e, s = t, i) { + var n, o, r, l; + if (e === k) return e; + let h = + void 0 !== i + ? null === (n = s._$Co) || void 0 === n + ? void 0 + : n[i] + : s._$Cl; + const a = C(e) ? void 0 : e._$litDirective$; + return ( + (null == h ? void 0 : h.constructor) !== a && + (null === (o = null == h ? void 0 : h._$AO) || + void 0 === o || + o.call(h, !1), + void 0 === a ? (h = void 0) : ((h = new a(t)), h._$AT(t, s, i)), + void 0 !== i + ? ((null !== (r = (l = s)._$Co) && void 0 !== r ? r : (l._$Co = []))[ + i + ] = h) + : (s._$Cl = h)), + void 0 !== h && (e = I(t, h._$AS(t, e.values), h, i)), + e + ); +} +class V { + constructor(t, e) { + (this.u = []), (this._$AN = void 0), (this._$AD = t), (this._$AM = e); + } + get parentNode() { + return this._$AM.parentNode; + } + get _$AU() { + return this._$AM._$AU; + } + v(t) { + var e; + const { + el: { content: s }, + parts: i, + } = this._$AD, + n = ( + null !== (e = null == t ? void 0 : t.creationScope) && void 0 !== e + ? e + : S + ).importNode(s, !0); + B.currentNode = n; + let o = B.nextNode(), + r = 0, + l = 0, + h = i[0]; + for (; void 0 !== h; ) { + if (r === h.index) { + let e; + 2 === h.type + ? (e = new W(o, o.nextSibling, this, t)) + : 1 === h.type + ? (e = new h.ctor(o, h.name, h.strings, this, t)) + : 6 === h.type && (e = new G(o, this, t)), + this.u.push(e), + (h = i[++l]); + } + r !== (null == h ? void 0 : h.index) && ((o = B.nextNode()), r++); + } + return n; + } + p(t) { + let e = 0; + for (const s of this.u) + void 0 !== s && + (void 0 !== s.strings + ? (s._$AI(t, s, e), (e += s.strings.length - 2)) + : s._$AI(t[e])), + e++; + } +} +class W { + constructor(t, e, s, i) { + var n; + (this.type = 2), + (this._$AH = L), + (this._$AN = void 0), + (this._$AA = t), + (this._$AB = e), + (this._$AM = s), + (this.options = i), + (this._$Cm = + null === (n = null == i ? void 0 : i.isConnected) || void 0 === n || n); + } + get _$AU() { + var t, e; + return null !== + (e = null === (t = this._$AM) || void 0 === t ? void 0 : t._$AU) && + void 0 !== e + ? e + : this._$Cm; + } + get parentNode() { + let t = this._$AA.parentNode; + const e = this._$AM; + return void 0 !== e && 11 === t.nodeType && (t = e.parentNode), t; + } + get startNode() { + return this._$AA; + } + get endNode() { + return this._$AB; + } + _$AI(t, e = this) { + (t = I(this, t, e)), + C(t) + ? t === L || null == t || '' === t + ? (this._$AH !== L && this._$AR(), (this._$AH = L)) + : t !== this._$AH && t !== k && this.g(t) + : void 0 !== t._$litType$ + ? this.$(t) + : void 0 !== t.nodeType + ? this.T(t) + : x(t) + ? this.k(t) + : this.g(t); + } + O(t, e = this._$AB) { + return this._$AA.parentNode.insertBefore(t, e); + } + T(t) { + this._$AH !== t && (this._$AR(), (this._$AH = this.O(t))); + } + g(t) { + this._$AH !== L && C(this._$AH) + ? (this._$AA.nextSibling.data = t) + : this.T(S.createTextNode(t)), + (this._$AH = t); + } + $(t) { + var e; + const { values: s, _$litType$: i } = t, + n = + 'number' == typeof i + ? this._$AC(t) + : (void 0 === i.el && (i.el = D.createElement(i.h, this.options)), i); + if ((null === (e = this._$AH) || void 0 === e ? void 0 : e._$AD) === n) + this._$AH.p(s); + else { + const t = new V(n, this), + e = t.v(this.options); + t.p(s), this.T(e), (this._$AH = t); + } + } + _$AC(t) { + let e = j.get(t.strings); + return void 0 === e && j.set(t.strings, (e = new D(t))), e; + } + k(t) { + w(this._$AH) || ((this._$AH = []), this._$AR()); + const e = this._$AH; + let s, + i = 0; + for (const n of t) + i === e.length + ? e.push((s = new W(this.O(b()), this.O(b()), this, this.options))) + : (s = e[i]), + s._$AI(n), + i++; + i < e.length && (this._$AR(s && s._$AB.nextSibling, i), (e.length = i)); + } + _$AR(t = this._$AA.nextSibling, e) { + var s; + for ( + null === (s = this._$AP) || void 0 === s || s.call(this, !1, !0, e); + t && t !== this._$AB; + + ) { + const e = t.nextSibling; + t.remove(), (t = e); + } + } + setConnected(t) { + var e; + void 0 === this._$AM && + ((this._$Cm = t), + null === (e = this._$AP) || void 0 === e || e.call(this, t)); + } +} +class q { + constructor(t, e, s, i, n) { + (this.type = 1), + (this._$AH = L), + (this._$AN = void 0), + (this.element = t), + (this.name = e), + (this._$AM = i), + (this.options = n), + s.length > 2 || '' !== s[0] || '' !== s[1] + ? ((this._$AH = Array(s.length - 1).fill(new String())), + (this.strings = s)) + : (this._$AH = L); + } + get tagName() { + return this.element.tagName; + } + get _$AU() { + return this._$AM._$AU; + } + _$AI(t, e = this, s, i) { + const n = this.strings; + let o = !1; + if (void 0 === n) + (t = I(this, t, e, 0)), + (o = !C(t) || (t !== this._$AH && t !== k)), + o && (this._$AH = t); + else { + const i = t; + let r, l; + for (t = n[0], r = 0; r < n.length - 1; r++) + (l = I(this, i[s + r], e, r)), + l === k && (l = this._$AH[r]), + o || (o = !C(l) || l !== this._$AH[r]), + l === L ? (t = L) : t !== L && (t += (null != l ? l : '') + n[r + 1]), + (this._$AH[r] = l); + } + o && !i && this.j(t); + } + j(t) { + t === L + ? this.element.removeAttribute(this.name) + : this.element.setAttribute(this.name, null != t ? t : ''); + } +} +class J extends q { + constructor() { + super(...arguments), (this.type = 3); + } + j(t) { + this.element[this.name] = t === L ? void 0 : t; + } +} +const K = f ? f.emptyScript : ''; +class Z extends q { + constructor() { + super(...arguments), (this.type = 4); + } + j(t) { + t && t !== L + ? this.element.setAttribute(this.name, K) + : this.element.removeAttribute(this.name); + } +} +class F extends q { + constructor(t, e, s, i, n) { + super(t, e, s, i, n), (this.type = 5); + } + _$AI(t, e = this) { + var s; + if ((t = null !== (s = I(this, t, e, 0)) && void 0 !== s ? s : L) === k) + return; + const i = this._$AH, + n = + (t === L && i !== L) || + t.capture !== i.capture || + t.once !== i.once || + t.passive !== i.passive, + o = t !== L && (i === L || n); + n && this.element.removeEventListener(this.name, this, i), + o && this.element.addEventListener(this.name, this, t), + (this._$AH = t); + } + handleEvent(t) { + var e, s; + 'function' == typeof this._$AH + ? this._$AH.call( + null !== + (s = + null === (e = this.options) || void 0 === e ? void 0 : e.host) && + void 0 !== s + ? s + : this.element, + t, + ) + : this._$AH.handleEvent(t); + } +} +class G { + constructor(t, e, s) { + (this.element = t), + (this.type = 6), + (this._$AN = void 0), + (this._$AM = e), + (this.options = s); + } + get _$AU() { + return this._$AM._$AU; + } + _$AI(t) { + I(this, t); + } +} +const Q = { + P: '$lit$', + A: y, + M: m, + C: 1, + L: z, + R: V, + D: x, + V: I, + I: W, + H: q, + N: Z, + U: F, + B: J, + F: G, + }, + X = A.litHtmlPolyfillSupport; +null == X || X(D, W), + (null !== (_ = A.litHtmlVersions) && void 0 !== _ + ? _ + : (A.litHtmlVersions = []) + ).push('2.4.0'); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -var Y,tt;class et extends v{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const s=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=s.firstChild),s}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{var i,n;const o=null!==(i=null==s?void 0:s.renderBefore)&&void 0!==i?i:e;let r=o._$litPart$;if(void 0===r){const t=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:null;o._$litPart$=r=new W(e.insertBefore(b(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return k}}et.finalized=!0,et._$litElement$=!0,null===(Y=globalThis.litElementHydrateSupport)||void 0===Y||Y.call(globalThis,{LitElement:et});const st=globalThis.litElementPolyfillSupport;null==st||st({LitElement:et}),(null!==(tt=globalThis.litElementVersions)&&void 0!==tt?tt:globalThis.litElementVersions=[]).push("3.2.2");export{Q as L,L as b,o as i,et as s,k as x,M as y}; +var Y, tt; +class et extends v { + constructor() { + super(...arguments), + (this.renderOptions = { host: this }), + (this._$Do = void 0); + } + createRenderRoot() { + var t, e; + const s = super.createRenderRoot(); + return ( + (null !== (t = (e = this.renderOptions).renderBefore) && void 0 !== t) || + (e.renderBefore = s.firstChild), + s + ); + } + update(t) { + const e = this.render(); + this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), + super.update(t), + (this._$Do = ((t, e, s) => { + var i, n; + const o = + null !== (i = null == s ? void 0 : s.renderBefore) && void 0 !== i + ? i + : e; + let r = o._$litPart$; + if (void 0 === r) { + const t = + null !== (n = null == s ? void 0 : s.renderBefore) && void 0 !== n + ? n + : null; + o._$litPart$ = r = new W( + e.insertBefore(b(), t), + t, + void 0, + null != s ? s : {}, + ); + } + return r._$AI(t), r; + })(e, this.renderRoot, this.renderOptions)); + } + connectedCallback() { + var t; + super.connectedCallback(), + null === (t = this._$Do) || void 0 === t || t.setConnected(!0); + } + disconnectedCallback() { + var t; + super.disconnectedCallback(), + null === (t = this._$Do) || void 0 === t || t.setConnected(!1); + } + render() { + return k; + } +} +(et.finalized = !0), + (et._$litElement$ = !0), + null === (Y = globalThis.litElementHydrateSupport) || + void 0 === Y || + Y.call(globalThis, { LitElement: et }); +const st = globalThis.litElementPolyfillSupport; +null == st || st({ LitElement: et }), + (null !== (tt = globalThis.litElementVersions) && void 0 !== tt + ? tt + : (globalThis.litElementVersions = []) + ).push('3.2.2'); +export { Q as L, L as b, o as i, et as s, k as x, M as y }; +//# sourceMappingURL=lit-element-2409d5fe.js.map diff --git a/dt-assets/build/components/lit-element-2409d5fe.js.map b/dt-assets/build/components/lit-element-2409d5fe.js.map new file mode 100644 index 0000000000..c2d9aa6dd2 --- /dev/null +++ b/dt-assets/build/components/lit-element-2409d5fe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lit-element-2409d5fe.js","sources":["../node_modules/@lit/reactive-element/css-tag.js","../node_modules/@lit/reactive-element/reactive-element.js","../node_modules/lit-html/lit-html.js","../node_modules/lit-element/lit-element.js"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,s=Symbol(),n=new WeakMap;class o{constructor(t,e,n){if(this._$cssResult$=!0,n!==s)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=n.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(s,t))}return t}toString(){return this.cssText}}const r=t=>new o(\"string\"==typeof t?t:t+\"\",void 0,s),i=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,s,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if(\"number\"==typeof t)return t;throw Error(\"Value passed to 'css' function must be a 'css' function result: \"+t+\". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.\")})(s)+t[n+1]),t[0]);return new o(n,t,s)},S=(s,n)=>{e?s.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((e=>{const n=document.createElement(\"style\"),o=t.litNonce;void 0!==o&&n.setAttribute(\"nonce\",o),n.textContent=e.cssText,s.appendChild(n)}))},c=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e=\"\";for(const s of t.cssRules)e+=s.cssText;return r(e)})(t):t;export{o as CSSResult,S as adoptStyles,i as css,c as getCompatibleStyle,e as supportsAdoptingStyleSheets,r as unsafeCSS};\n//# sourceMappingURL=css-tag.js.map\n","import{getCompatibleStyle as t,adoptStyles as i}from\"./css-tag.js\";export{CSSResult,adoptStyles,css,getCompatibleStyle,supportsAdoptingStyleSheets,unsafeCSS}from\"./css-tag.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */var s;const e=window,r=e.trustedTypes,h=r?r.emptyScript:\"\",o=e.reactiveElementPolyfillSupport,n={toAttribute(t,i){switch(i){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},a=(t,i)=>i!==t&&(i==i||t==t),l={attribute:!0,type:String,converter:n,reflect:!1,hasChanged:a};class d extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var i;null!==(i=this.h)&&void 0!==i||(this.h=[]),this.h.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,s)=>{const e=this._$Ep(s,i);void 0!==e&&(this._$Ev.set(e,s),t.push(e))})),t}static createProperty(t,i=l){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const s=\"symbol\"==typeof t?Symbol():\"__\"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e)}}static getPropertyDescriptor(t,i,s){return{get(){return this[i]},set(e){const r=this[t];this[i]=e,this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||l}static finalize(){if(this.hasOwnProperty(\"finalized\"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty(\"properties\")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of i)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(i){const s=[];if(Array.isArray(i)){const e=new Set(i.flat(1/0).reverse());for(const i of e)s.unshift(t(i))}else void 0!==i&&s.push(t(i));return s}static _$Ep(t,i){const s=i.attribute;return!1===s?void 0:\"string\"==typeof s?s:\"string\"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var i,s;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t))}removeController(t){var i;null===(i=this._$ES)||void 0===i||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])}))}createRenderRoot(){var t;const s=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return i(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}))}attributeChangedCallback(t,i,s){this._$AK(t,s)}_$EO(t,i,s=l){var e;const r=this.constructor._$Ep(t,s);if(void 0!==r&&!0===s.reflect){const h=(void 0!==(null===(e=s.converter)||void 0===e?void 0:e.toAttribute)?s.converter:n).toAttribute(i,s.type);this._$El=t,null==h?this.removeAttribute(r):this.setAttribute(r,h),this._$El=null}}_$AK(t,i){var s;const e=this.constructor,r=e._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=e.getPropertyOptions(r),h=\"function\"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(s=t.converter)||void 0===s?void 0:s.fromAttribute)?t.converter:n;this._$El=r,this[r]=h.fromAttribute(i,t.type),this._$El=null}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||a)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):e=!1),!this.isUpdatePending&&e&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,i)=>this[i]=t)),this._$Ei=void 0);let i=!1;const s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(s)):this._$Ek()}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(s)}willUpdate(t){}_$AE(t){var i;null===(i=this._$ES)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,i)=>this._$EO(i,this[i],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}d.finalized=!0,d.elementProperties=new Map,d.elementStyles=[],d.shadowRootOptions={mode:\"open\"},null==o||o({ReactiveElement:d}),(null!==(s=e.reactiveElementVersions)&&void 0!==s?s:e.reactiveElementVersions=[]).push(\"1.4.1\");export{d as ReactiveElement,n as defaultConverter,a as notEqual};\n//# sourceMappingURL=reactive-element.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nvar t;const i=window,s=i.trustedTypes,e=s?s.createPolicy(\"lit-html\",{createHTML:t=>t}):void 0,o=`lit$${(Math.random()+\"\").slice(9)}$`,n=\"?\"+o,l=`<${n}>`,h=document,r=(t=\"\")=>h.createComment(t),d=t=>null===t||\"object\"!=typeof t&&\"function\"!=typeof t,u=Array.isArray,c=t=>u(t)||\"function\"==typeof(null==t?void 0:t[Symbol.iterator]),v=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,a=/-->/g,f=/>/g,_=RegExp(\">|[ \\t\\n\\f\\r](?:([^\\\\s\\\"'>=/]+)([ \\t\\n\\f\\r]*=[ \\t\\n\\f\\r]*(?:[^ \\t\\n\\f\\r\\\"'`<>=]|(\\\"|')|))|$)\",\"g\"),m=/'/g,p=/\"/g,$=/^(?:script|style|textarea|title)$/i,g=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),y=g(1),w=g(2),x=Symbol.for(\"lit-noChange\"),b=Symbol.for(\"lit-nothing\"),T=new WeakMap,A=h.createTreeWalker(h,129,null,!1),E=(t,i)=>{const s=t.length-1,n=[];let h,r=2===i?\"\":\"\",d=v;for(let i=0;i\"===u[0]?(d=null!=h?h:v,c=-1):void 0===u[1]?c=-2:(c=d.lastIndex-u[2].length,e=u[1],d=void 0===u[3]?_:'\"'===u[3]?p:m):d===p||d===m?d=_:d===a||d===f?d=v:(d=_,h=void 0);const y=d===_&&t[i+1].startsWith(\"/>\")?\" \":\"\";r+=d===v?s+l:c>=0?(n.push(e),s.slice(0,c)+\"$lit$\"+s.slice(c)+o+y):s+o+(-2===c?(n.push(void 0),i):y)}const u=r+(t[s]||\"\")+(2===i?\"\":\"\");if(!Array.isArray(t)||!t.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return[void 0!==e?e.createHTML(u):u,n]};class C{constructor({strings:t,_$litType$:i},e){let l;this.parts=[];let h=0,d=0;const u=t.length-1,c=this.parts,[v,a]=E(t,i);if(this.el=C.createElement(v,e),A.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(l=A.nextNode())&&c.length0){l.textContent=s?s.emptyScript:\"\";for(let s=0;s2||\"\"!==s[0]||\"\"!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=b}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=P(this,t,i,0),n=!d(t)||t!==this._$AH&&t!==x,n&&(this._$AH=t);else{const e=t;let l,h;for(t=o[0],l=0;l{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(r(),t),t,void 0,null!=s?s:{})}return l._$AI(t),l};export{L as _$LH,y as html,x as noChange,b as nothing,Z as render,w as svg};\n//# sourceMappingURL=lit-html.js.map\n","import{ReactiveElement as t}from\"@lit/reactive-element\";export*from\"@lit/reactive-element\";import{render as e,noChange as i}from\"lit-html\";export*from\"lit-html\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */var l,o;const r=t;class s extends t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=e(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return i}}s.finalized=!0,s._$litElement$=!0,null===(l=globalThis.litElementHydrateSupport)||void 0===l||l.call(globalThis,{LitElement:s});const n=globalThis.litElementPolyfillSupport;null==n||n({LitElement:s});const h={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(o=globalThis.litElementVersions)&&void 0!==o?o:globalThis.litElementVersions=[]).push(\"3.2.2\");export{s as LitElement,r as UpdatingElement,h as _$LE};\n//# sourceMappingURL=lit-element.js.map\n"],"names":["t","window","e","ShadowRoot","ShadyCSS","nativeShadow","Document","prototype","CSSStyleSheet","s","Symbol","n","WeakMap","o","constructor","this","_$cssResult$","Error","cssText","styleSheet","length","get","replaceSync","set","toString","i","reduce","c","cssRules","r","trustedTypes","h","emptyScript","reactiveElementPolyfillSupport","toAttribute","Boolean","Object","Array","JSON","stringify","fromAttribute","Number","parse","a","l","attribute","type","String","converter","reflect","hasChanged","d","HTMLElement","super","_$Ei","Map","isUpdatePending","hasUpdated","_$El","u","static","push","observedAttributes","finalize","elementProperties","forEach","_$Ep","_$Ev","state","noAccessor","hasOwnProperty","getPropertyDescriptor","defineProperty","requestUpdate","configurable","enumerable","finalized","getPrototypeOf","properties","getOwnPropertyNames","getOwnPropertySymbols","createProperty","elementStyles","finalizeStyles","styles","isArray","Set","flat","reverse","unshift","toLowerCase","_$E_","Promise","enableUpdating","_$AL","_$Eg","addController","_$ES","renderRoot","isConnected","hostConnected","call","removeController","splice","indexOf","createRenderRoot","shadowRoot","attachShadow","shadowRootOptions","adoptedStyleSheets","map","document","createElement","litNonce","setAttribute","textContent","appendChild","connectedCallback","disconnectedCallback","hostDisconnected","attributeChangedCallback","_$AK","_$EO","removeAttribute","getPropertyOptions","has","_$EC","_$Ej","async","reject","scheduleUpdate","performUpdate","shouldUpdate","willUpdate","hostUpdate","update","_$Ek","_$AE","hostUpdated","firstUpdated","updated","updateComplete","getUpdateComplete","mode","ReactiveElement","reactiveElementVersions","createPolicy","createHTML","Math","random","slice","createComment","iterator","v","f","_","RegExp","m","p","$","y","_$litType$","strings","values","g","x","for","b","T","A","createTreeWalker","E","lastIndex","exec","test","startsWith","C","parts","el","currentNode","content","firstChild","remove","append","childNodes","nextNode","nodeType","hasAttributes","getAttributeNames","endsWith","getAttribute","split","index","name","ctor","M","k","H","S","tagName","data","innerHTML","P","_$Co","_$Cl","_$litDirective$","_$AO","_$AT","_$AS","V","_$AN","_$AD","_$AM","parentNode","_$AU","creationScope","importNode","N","nextSibling","I","_$AI","_$AH","_$AA","_$AB","options","_$Cm","startNode","endNode","_$AR","O","insertBefore","createTextNode","_$AC","_$AP","setConnected","element","fill","j","arguments","R","capture","once","passive","removeEventListener","addEventListener","handleEvent","host","L","D","U","B","F","z","litHtmlPolyfillSupport","litHtmlVersions","renderOptions","_$Do","renderBefore","render","_$litPart$","_$litElement$","globalThis","litElementHydrateSupport","LitElement","litElementPolyfillSupport","litElementVersions"],"mappings":";;;;;AAKA,MAAMA,EAAEC,OAAOC,EAAEF,EAAEG,kBAAa,IAASH,EAAEI,UAAUJ,EAAEI,SAASC,eAAe,uBAAuBC,SAASC,WAAW,YAAYC,cAAcD,UAAUE,EAAEC,SAASC,EAAE,IAAIC,QAAQ,MAAMC,EAAEC,YAAYd,EAAEE,EAAES,GAAG,GAAGI,KAAKC,cAAa,EAAGL,IAAIF,EAAE,MAAMQ,MAAM,qEAAqEF,KAAKG,QAAQlB,EAAEe,KAAKf,EAAEE,CAAC,CAAKiB,iBAAa,IAAInB,EAAEe,KAAKF,EAAE,MAAMJ,EAAEM,KAAKf,EAAE,GAAGE,QAAG,IAASF,E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components/lit-localize-763e4978.js b/dt-assets/build/components/lit-localize-763e4978.js index 3d613c904c..b4c48d62a6 100644 --- a/dt-assets/build/components/lit-localize-763e4978.js +++ b/dt-assets/build/components/lit-localize-763e4978.js @@ -3,36 +3,190 @@ * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const e=(e,...t)=>({strTag:!0,strings:e,values:t}),t=(e,t,r)=>{let s=e[0];for(let o=1;o{return"string"!=typeof(r=e)&&"strTag"in r?t(e.strings,e.values):e;var r},s="lit-localize-status"; +const e = (e, ...t) => ({ strTag: !0, strings: e, values: t }), + t = (e, t, r) => { + let s = e[0]; + for (let o = 1; o < e.length; o++) + (s += t[r ? r[o - 1] : o - 1]), (s += e[o]); + return s; + }, + r = (e) => { + return 'string' != typeof (r = e) && 'strTag' in r + ? t(e.strings, e.values) + : e; + var r; + }, + s = 'lit-localize-status'; /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -class o{constructor(){this.settled=!1,this.promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}} +class o { + constructor() { + (this.settled = !1), + (this.promise = new Promise((e, t) => { + (this._resolve = e), (this._reject = t); + })); + } + resolve(e) { + (this.settled = !0), this._resolve(e); + } + reject(e) { + (this.settled = !0), this._reject(e); + } +} /** * @license * Copyright 2014 Travis Webb * SPDX-License-Identifier: MIT - */const n=[];for(let e=0;e<256;e++)n[e]=(e>>4&15).toString(16)+(15&e).toString(16);function l(e,t){return(t?"h":"s")+function(e){let t=0,r=8997,s=0,o=33826,l=0,i=40164,a=0,c=52210;for(let n=0;n>>16,r=65535&t,l+=s>>>16,o=65535&s,c=a+(l>>>16)&65535,i=65535&l;return n[c>>8]+n[255&c]+n[i>>8]+n[255&i]+n[o>>8]+n[255&o]+n[r>>8]+n[255&r]} -/** - * @license - * Copyright 2020 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */("string"==typeof e?e:e.join(""))} -/** - * @license - * Copyright 2021 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */const i=new WeakMap,a=new Map;function c(e,s,o){var n;if(e){const r=null!==(n=null==o?void 0:o.id)&&void 0!==n?n:function(e){const t="string"==typeof e?e:e.strings;let r=a.get(t);void 0===r&&(r=l(t,"string"!=typeof e&&!("strTag"in e)),a.set(t,r));return r} + */ const n = []; +for (let e = 0; e < 256; e++) + n[e] = ((e >> 4) & 15).toString(16) + (15 & e).toString(16); +function l(e, t) { + return ( + (t ? 'h' : 's') + + (function (e) { + let t = 0, + r = 8997, + s = 0, + o = 33826, + l = 0, + i = 40164, + a = 0, + c = 52210; + for (let n = 0; n < e.length; n++) + (r ^= e.charCodeAt(n)), + (t = 435 * r), + (s = 435 * o), + (l = 435 * i), + (a = 435 * c), + (l += r << 8), + (a += o << 8), + (s += t >>> 16), + (r = 65535 & t), + (l += s >>> 16), + (o = 65535 & s), + (c = (a + (l >>> 16)) & 65535), + (i = 65535 & l); + return ( + n[c >> 8] + + n[255 & c] + + n[i >> 8] + + n[255 & i] + + n[o >> 8] + + n[255 & o] + + n[r >> 8] + + n[255 & r] + ); + })( + /** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ 'string' == typeof e ? e : e.join(''), + ) + ); +} /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */(s),c=e[r];if(c){if("string"==typeof c)return c;if("strTag"in c)return t(c.strings,s.values,c.values);{let e=i.get(c);return void 0===e&&(e=c.values,i.set(c,e)),{...c,values:e.map((e=>s.values[e]))}}}}return r(s)}function u(e){window.dispatchEvent(new CustomEvent("lit-localize-status",{detail:e}))}let g,d,v,f,h,p="",w=new o;w.resolve();let m=0;const L=e=>(function(e){if(S)throw new Error("lit-localize can only be configured once");E=e,S=!0}(((e,t)=>c(h,e,t))),p=d=e.sourceLocale,v=new Set(e.targetLocales),v.add(e.sourceLocale),f=e.loadLocale,{getLocale:y,setLocale:j}),y=()=>p,j=e=>{if(e===(null!=g?g:p))return w.promise;if(!v||!f)throw new Error("Internal error");if(!v.has(e))throw new Error("Invalid locale code");m++;const t=m;g=e,w.settled&&(w=new o),u({status:"loading",loadingLocale:e});return(e===d?Promise.resolve({templates:void 0}):f(e)).then((r=>{m===t&&(p=e,g=void 0,h=r.templates,u({status:"ready",readyLocale:e}),w.resolve())}),(r=>{m===t&&(u({status:"error",errorLocale:e,errorMessage:r.toString()}),w.reject(r))})),w.promise}; + */ const i = new WeakMap(), + a = new Map(); +function c(e, s, o) { + var n; + if (e) { + const r = + null !== (n = null == o ? void 0 : o.id) && void 0 !== n + ? n + : (function (e) { + const t = 'string' == typeof e ? e : e.strings; + let r = a.get(t); + void 0 === r && + ((r = l(t, 'string' != typeof e && !('strTag' in e))), + a.set(t, r)); + return r; + })( + /** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ s, + ), + c = e[r]; + if (c) { + if ('string' == typeof c) return c; + if ('strTag' in c) return t(c.strings, s.values, c.values); + { + let e = i.get(c); + return ( + void 0 === e && ((e = c.values), i.set(c, e)), + { ...c, values: e.map((e) => s.values[e]) } + ); + } + } + } + return r(s); +} +function u(e) { + window.dispatchEvent(new CustomEvent('lit-localize-status', { detail: e })); +} +let g, + d, + v, + f, + h, + p = '', + w = new o(); +w.resolve(); +let m = 0; +const L = (e) => ( + (function (e) { + if (S) throw new Error('lit-localize can only be configured once'); + (E = e), (S = !0); + })((e, t) => c(h, e, t)), + (p = d = e.sourceLocale), + (v = new Set(e.targetLocales)), + v.add(e.sourceLocale), + (f = e.loadLocale), + { getLocale: y, setLocale: j } + ), + y = () => p, + j = (e) => { + if (e === (null != g ? g : p)) return w.promise; + if (!v || !f) throw new Error('Internal error'); + if (!v.has(e)) throw new Error('Invalid locale code'); + m++; + const t = m; + (g = e), + w.settled && (w = new o()), + u({ status: 'loading', loadingLocale: e }); + return ( + (e === d ? Promise.resolve({ templates: void 0 }) : f(e)).then( + (r) => { + m === t && + ((p = e), + (g = void 0), + (h = r.templates), + u({ status: 'ready', readyLocale: e }), + w.resolve()); + }, + (r) => { + m === t && + (u({ status: 'error', errorLocale: e, errorMessage: r.toString() }), + w.reject(r)); + }, + ), + w.promise + ); + }; /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -let E=r,S=!1;export{s as L,L as c,E as m,e as s}; +let E = r, + S = !1; +export { s as L, L as c, E as m, e as s }; +//# sourceMappingURL=lit-localize-763e4978.js.map diff --git a/dt-assets/build/components/lit-localize-763e4978.js.map b/dt-assets/build/components/lit-localize-763e4978.js.map new file mode 100644 index 0000000000..d49eedb4a5 --- /dev/null +++ b/dt-assets/build/components/lit-localize-763e4978.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lit-localize-763e4978.js","sources":["../node_modules/@lit/localize/internal/str-tag.js","../node_modules/@lit/localize/internal/default-msg.js","../node_modules/@lit/localize/internal/locale-status-event.js","../node_modules/@lit/localize/internal/deferred.js","../node_modules/@lit/localize/internal/fnv1a64.js","../node_modules/@lit/localize/internal/id-generation.js","../node_modules/@lit/localize/internal/runtime-msg.js","../node_modules/@lit/localize/init/runtime.js","../node_modules/@lit/localize/lit-localize.js"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n/**\n * Tag that allows expressions to be used in localized non-HTML template\n * strings.\n *\n * Example: msg(str`Hello ${this.user}!`);\n *\n * The Lit html tag can also be used for this purpose, but HTML will need to be\n * escaped, and there is a small overhead for HTML parsing.\n *\n * Untagged template strings with expressions aren't supported by lit-localize\n * because they don't allow for values to be captured at runtime.\n */\nconst _str = (strings, ...values) => ({\n strTag: true,\n strings,\n values,\n});\nexport const str = _str;\nexport const isStrTagged = (val) => typeof val !== 'string' && 'strTag' in val;\n/**\n * Render the result of a `str` tagged template to a string. Note we don't need\n * to do this for Lit templates, since Lit itself handles rendering.\n */\nexport const joinStringsAndValues = (strings, values, valueOrder) => {\n let concat = strings[0];\n for (let i = 1; i < strings.length; i++) {\n concat += values[valueOrder ? valueOrder[i - 1] : i - 1];\n concat += strings[i];\n }\n return concat;\n};\n//# sourceMappingURL=str-tag.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { isStrTagged, joinStringsAndValues } from './str-tag.js';\n/**\n * Default identity msg implementation. Simply returns the input template with\n * no awareness of translations. If the template is str-tagged, returns it in\n * string form.\n */\nexport const defaultMsg = ((template) => isStrTagged(template)\n ? joinStringsAndValues(template.strings, template.values)\n : template);\n//# sourceMappingURL=default-msg.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n/**\n * Name of the event dispatched to `window` whenever a locale change starts,\n * finishes successfully, or fails. Only relevant to runtime mode.\n *\n * The `detail` of this event is an object with a `status` string that can be:\n * \"loading\", \"ready\", or \"error\", along with the relevant locale code, and\n * error message if applicable.\n *\n * You can listen for this event to know when your application should be\n * re-rendered following a locale change. See also the Localized mixin, which\n * automatically re-renders LitElement classes using this event.\n */\nexport const LOCALE_STATUS_EVENT = 'lit-localize-status';\n//# sourceMappingURL=locale-status-event.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nexport class Deferred {\n constructor() {\n this.settled = false;\n this.promise = new Promise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n }\n resolve(value) {\n this.settled = true;\n this._resolve(value);\n }\n reject(error) {\n this.settled = true;\n this._reject(error);\n }\n}\n//# sourceMappingURL=deferred.js.map","/**\n * @license\n * Copyright 2014 Travis Webb\n * SPDX-License-Identifier: MIT\n */\n// This module is derived from the file:\n// https://github.com/tjwebb/fnv-plus/blob/1e2ce68a07cb7dd4c3c85364f3d8d96c95919474/index.js#L309\n//\n// Changes:\n// - Only the _hash64_1a_fast function is included.\n// - Removed loop unrolling.\n// - Converted to TypeScript ES module.\n// - var -> let/const\n//\n// TODO(aomarks) Upstream improvements to https://github.com/tjwebb/fnv-plus/.\nconst hl = [];\nfor (let i = 0; i < 256; i++) {\n hl[i] = ((i >> 4) & 15).toString(16) + (i & 15).toString(16);\n}\n/**\n * Perform a FNV-1A 64-bit hash of the given string (as UTF-16 code units), and\n * return a hexadecimal digest (left zero padded to 16 characters).\n *\n * @see {@link http://tools.ietf.org/html/draft-eastlake-fnv-06}\n */\nexport function fnv1a64(str) {\n let t0 = 0, v0 = 0x2325, t1 = 0, v1 = 0x8422, t2 = 0, v2 = 0x9ce4, t3 = 0, v3 = 0xcbf2;\n for (let i = 0; i < str.length; i++) {\n v0 ^= str.charCodeAt(i);\n t0 = v0 * 435;\n t1 = v1 * 435;\n t2 = v2 * 435;\n t3 = v3 * 435;\n t2 += v0 << 8;\n t3 += v1 << 8;\n t1 += t0 >>> 16;\n v0 = t0 & 65535;\n t2 += t1 >>> 16;\n v1 = t1 & 65535;\n v3 = (t3 + (t2 >>> 16)) & 65535;\n v2 = t2 & 65535;\n }\n return (hl[v3 >> 8] +\n hl[v3 & 255] +\n hl[v2 >> 8] +\n hl[v2 & 255] +\n hl[v1 >> 8] +\n hl[v1 & 255] +\n hl[v0 >> 8] +\n hl[v0 & 255]);\n}\n//# sourceMappingURL=fnv1a64.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { fnv1a64 } from './fnv1a64.js';\n/**\n * Delimiter used between each template string component before hashing. Used to\n * prevent e.g. \"foobar\" and \"foo${baz}bar\" from sharing a hash.\n *\n * This is the \"record separator\" ASCII character.\n */\nexport const HASH_DELIMITER = '\\x1e';\n/**\n * Id prefix on html-tagged templates to distinguish e.g. `x` from\n * html`x`.\n */\nconst HTML_PREFIX = 'h';\n/**\n * Id prefix on plain string templates to distinguish e.g. `x` from\n * html`x`.\n */\nconst STRING_PREFIX = 's';\n/**\n * Generate a unique ID for a lit-localize message.\n *\n * Example:\n * Template: html`Hello ${who}!`\n * Params: [\"Hello \", \"!\"], true\n * Output: h82ccc38d4d46eaa9\n *\n * The ID is constructed as:\n *\n * [0] Kind of template: [h]tml or [s]tring.\n * [1,16] 64-bit FNV-1a hash hex digest of the template strings, as UTF-16\n * code points, delineated by an ASCII \"record separator\" character.\n *\n * We choose FNV-1a because:\n *\n * 1. It's pretty fast (e.g. much faster than SHA-1).\n * 2. It's pretty small (0.25 KiB minified + brotli).\n * 3. We don't require cryptographic security, and 64 bits should give\n * sufficient collision resistance for any one application. Worst\n * case, we will always detect collisions during analysis.\n * 4. We can't use Web Crypto API (e.g. SHA-1), because it's asynchronous.\n * 5. It's a well known non-cryptographic hash with implementations in many\n * languages.\n * 6. There was an existing JavaScript implementation that doesn't require\n * BigInt, for IE11 compatibility.\n */\nexport function generateMsgId(strings, isHtmlTagged) {\n return ((isHtmlTagged ? HTML_PREFIX : STRING_PREFIX) +\n fnv1a64(typeof strings === 'string' ? strings : strings.join(HASH_DELIMITER)));\n}\n//# sourceMappingURL=id-generation.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { defaultMsg } from './default-msg.js';\nimport { joinStringsAndValues } from './str-tag.js';\nimport { generateMsgId } from './id-generation.js';\nconst expressionOrders = new WeakMap();\nconst hashCache = new Map();\nexport function runtimeMsg(templates, template, options) {\n var _a;\n if (templates) {\n const id = (_a = options === null || options === void 0 ? void 0 : options.id) !== null && _a !== void 0 ? _a : generateId(template);\n const localized = templates[id];\n if (localized) {\n if (typeof localized === 'string') {\n // E.g. \"Hello World!\"\n return localized;\n }\n else if ('strTag' in localized) {\n // E.g. str`Hello ${name}!`\n //\n // Localized templates have ${number} in place of real template\n // expressions. They can't have real template values, because the\n // variable scope would be wrong. The number tells us the index of the\n // source value to substitute in its place, because expressions can be\n // moved to a different position during translation.\n return joinStringsAndValues(localized.strings, \n // Cast `template` because its type wasn't automatically narrowed (but\n // we know it must be the same type as `localized`).\n template.values, localized.values);\n }\n else {\n // E.g. html`Hello ${name}!`\n //\n // We have to keep our own mapping of expression ordering because we do\n // an in-place update of `values`, and otherwise we'd lose ordering for\n // subsequent renders.\n let order = expressionOrders.get(localized);\n if (order === undefined) {\n order = localized.values;\n expressionOrders.set(localized, order);\n }\n return {\n ...localized,\n values: order.map((i) => template.values[i]),\n };\n }\n }\n }\n return defaultMsg(template);\n}\nfunction generateId(template) {\n const strings = typeof template === 'string' ? template : template.strings;\n let id = hashCache.get(strings);\n if (id === undefined) {\n id = generateMsgId(strings, typeof template !== 'string' && !('strTag' in template));\n hashCache.set(strings, id);\n }\n return id;\n}\n//# sourceMappingURL=runtime-msg.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { _installMsgImplementation } from '../lit-localize.js';\nimport { Deferred } from '../internal/deferred.js';\nimport { LOCALE_STATUS_EVENT } from '../internal/locale-status-event.js';\nimport { runtimeMsg } from '../internal/runtime-msg.js';\n/**\n * Dispatch a \"lit-localize-status\" event to `window` with the given detail.\n */\nfunction dispatchStatusEvent(detail) {\n window.dispatchEvent(new CustomEvent(LOCALE_STATUS_EVENT, { detail }));\n}\nlet activeLocale = '';\nlet loadingLocale;\nlet sourceLocale;\nlet validLocales;\nlet loadLocale;\nlet templates;\nlet loading = new Deferred();\n// The loading promise must be initially resolved, because that's what we should\n// return if the user immediately calls setLocale(sourceLocale).\nloading.resolve();\nlet requestId = 0;\n/**\n * Set configuration parameters for lit-localize when in runtime mode. Returns\n * an object with functions:\n *\n * - `getLocale`: Return the active locale code.\n * - `setLocale`: Set the active locale code.\n *\n * Throws if called more than once.\n */\nexport const configureLocalization = (config) => {\n _installMsgImplementation(((template, options) => runtimeMsg(templates, template, options)));\n activeLocale = sourceLocale = config.sourceLocale;\n validLocales = new Set(config.targetLocales);\n validLocales.add(config.sourceLocale);\n loadLocale = config.loadLocale;\n return { getLocale, setLocale };\n};\n/**\n * Return the active locale code.\n */\nconst getLocale = () => {\n return activeLocale;\n};\n/**\n * Set the active locale code, and begin loading templates for that locale using\n * the `loadLocale` function that was passed to `configureLocalization`. Returns\n * a promise that resolves when the next locale is ready to be rendered.\n *\n * Note that if a second call to `setLocale` is made while the first requested\n * locale is still loading, then the second call takes precedence, and the\n * promise returned from the first call will resolve when second locale is\n * ready. If you need to know whether a particular locale was loaded, check\n * `getLocale` after the promise resolves.\n *\n * Throws if the given locale is not contained by the configured `sourceLocale`\n * or `targetLocales`.\n */\nconst setLocale = (newLocale) => {\n if (newLocale === (loadingLocale !== null && loadingLocale !== void 0 ? loadingLocale : activeLocale)) {\n return loading.promise;\n }\n if (!validLocales || !loadLocale) {\n throw new Error('Internal error');\n }\n if (!validLocales.has(newLocale)) {\n throw new Error('Invalid locale code');\n }\n requestId++;\n const thisRequestId = requestId;\n loadingLocale = newLocale;\n if (loading.settled) {\n loading = new Deferred();\n }\n dispatchStatusEvent({ status: 'loading', loadingLocale: newLocale });\n const localePromise = newLocale === sourceLocale\n ? // We could switch to the source locale synchronously, but we prefer to\n // queue it on a microtask so that switching locales is consistently\n // asynchronous.\n Promise.resolve({ templates: undefined })\n : loadLocale(newLocale);\n localePromise.then((mod) => {\n if (requestId === thisRequestId) {\n activeLocale = newLocale;\n loadingLocale = undefined;\n templates = mod.templates;\n dispatchStatusEvent({ status: 'ready', readyLocale: newLocale });\n loading.resolve();\n }\n // Else another locale was requested in the meantime. Don't resolve or\n // reject, because the newer load call is going to use the same promise.\n // Note the user can call getLocale() after the promise resolves if they\n // need to check if the locale is still the one they expected to load.\n }, (err) => {\n if (requestId === thisRequestId) {\n dispatchStatusEvent({\n status: 'error',\n errorLocale: newLocale,\n errorMessage: err.toString(),\n });\n loading.reject(err);\n }\n });\n return loading.promise;\n};\n//# sourceMappingURL=runtime.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { defaultMsg } from './internal/default-msg.js';\nexport * from './internal/locale-status-event.js';\nexport * from './internal/str-tag.js';\nexport * from './internal/types.js';\n// TODO(aomarks) In a future breaking version, remove these imports so that the\n// bulk of the code isn't included in bundles by default. In particular imagine\n// the component library use-case where msg() calls are made, but there is no\n// need to actually initialize any of the localization runtime.\nexport * from './internal/localized-controller.js';\nexport * from './internal/localized-decorator.js';\nexport * from './init/runtime.js';\nexport * from './init/transform.js';\n/**\n * Make a string or lit-html template localizable.\n *\n * @param template A string, a lit-html template, or a function that returns\n * either a string or lit-html template.\n * @param options Optional configuration object with the following properties:\n * - id: Optional project-wide unique identifier for this template. If\n * omitted, an id will be automatically generated from the template strings.\n * - desc: Optional description\n */\nexport let msg = defaultMsg;\nlet installed = false;\n/**\n * Internal only. Do not use this function.\n *\n * Installs an implementation of the msg function to replace the default\n * identity function. Throws if called more than once.\n *\n * @internal\n */\nexport function _installMsgImplementation(impl) {\n if (installed) {\n throw new Error('lit-localize can only be configured once');\n }\n msg = impl;\n installed = true;\n}\n//# sourceMappingURL=lit-localize.js.map"],"names":["str","strings","values","strTag","joinStringsAndValues","valueOrder","concat","i","length","defaultMsg","template","isStrTagged","val","LOCALE_STATUS_EVENT","Deferred","constructor","this","settled","promise","Promise","resolve","reject","_resolve","_reject","value","error","hl","toString","generateMsgId","isHtmlTagged","t0","v0","t1","v1","t2","v2","t3","v3","charCodeAt","fnv1a64","join","expressionOrders","WeakMap","hashCache","Map","runtimeMsg","templates","options","_a","id","get","undefined","set","generateId","localized","order","map","dispatchStatusEvent","detail","window","dispatchEvent","CustomEvent","loadingLocale","sourceLocale","validLocales","loadLocale","activeLocale","loading","requestId","configureLocalization","config","impl","installed","Error","msg","_installMsgImplementation","Set","targetLocales","add","getLocale","setLocale","newLocale","has","thisRequestId","status","then","mod","readyLocale","err","errorLocale","errorMessage"],"mappings":";;;;;AAiBA,MAKaA,EALA,CAACC,KAAYC,KAAY,CAClCC,QAAQ,EACRF,UACAC,WAQSE,EAAuB,CAACH,EAASC,EAAQG,KAClD,IAAIC,EAASL,EAAQ,GACrB,IAAK,IAAIM,EA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,MAACC,EAAyBC,ICE/B,SAAmCC,GACtC,GAAIC,EACA,MAAM,IAAIC,MAAM,4CAEpBC,EAAMH,EACNC,GAAY,CAChB,CDPIG,EAA2B,CAACjE,EAAUqC,IAAYF,EAAWC,EAAWpC,EAAUqC,KAClFmB,EAAeH,EAAeO,EAAOP,aACrCC,EAAe,IAAIY,IAAIN,EAAOO,eAC9Bb,EAAac,IAAIR,EAAOP,cACxBE,EAAaK,EAAOL,WACb,CAAEc,YAAWC,cAKlBD,EAAY,IACPb,EAgBLc,EAAaC,IACf,GAAIA,KAAenB,QAAqDA,EAAgBI,GACpF,OAAOC,EAAQjD,QAEnB,IAAK8C,IAAiBC,EAClB,MAAM,IAAIQ,MAAM,kBAEpB,IAAKT,EAAakB,IAAID,GAClB,MAAM,IAAIR,MAAM,uBAEpBL,IACA,MAAMe,EAAgBf,EACtBN,EAAgBmB,EACZd,EAAQlD,UACRkD,EAAU,IAAIrD,GAElB2C,EAAoB,CAAE2B,OAAQ,UAAWtB,cAAemB,IA6BxD,OA5BsBA,IAAclB,EAI5B5C,QAAQC,QAAQ,CAAE0B,eAAWK,IAC/Bc,EAAWgB,IACHI,MAAMC,IACZlB,IAAce,IACdjB,EAAee,EACfnB,OAAgBX,EAChBL,EAAYwC,EAAIxC,UAChBW,EAAoB,CAAE2B,OAAQ,QAASG,YAAaN,IACpDd,EAAQ/C,UACX,IAKDoE,IACIpB,IAAce,IACd1B,EAAoB,CAChB2B,OAAQ,QACRK,YAAaR,EACbS,aAAcF,EAAI7D,aAEtBwC,EAAQ9C,OAAOmE,GAClB,IAEErB,EAAQjD,OAAO;;;;;;ACjFhB,IAACwD,EAAMjE,EACb+D,GAAY"} \ No newline at end of file diff --git a/dt-assets/build/components/map-c0e24c36.js b/dt-assets/build/components/map-c0e24c36.js index b89ecd928a..11936482bf 100644 --- a/dt-assets/build/components/map-c0e24c36.js +++ b/dt-assets/build/components/map-c0e24c36.js @@ -3,4 +3,11 @@ * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -function*o(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++)}}export{o}; +function* o(o, f) { + if (void 0 !== o) { + let i = 0; + for (const t of o) yield f(t, i++); + } +} +export { o }; +//# sourceMappingURL=map-c0e24c36.js.map diff --git a/dt-assets/build/components/map-c0e24c36.js.map b/dt-assets/build/components/map-c0e24c36.js.map new file mode 100644 index 0000000000..b84f959c74 --- /dev/null +++ b/dt-assets/build/components/map-c0e24c36.js.map @@ -0,0 +1 @@ +{"version":3,"file":"map-c0e24c36.js","sources":["../node_modules/lit-html/directives/map.js"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nfunction*o(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++)}}export{o as map};\n//# sourceMappingURL=map.js.map\n"],"names":["o","f","i","t"],"mappings":";;;;;AAKA,SAASA,EAAEA,EAAEC,GAAG,QAAG,IAASD,EAAE,CAAC,IAAIE,EAAE,EAAE,IAAI,MAAMC,KAAKH,QAAQC,EAAEE,EAAED,IAAI,CAAC"} \ No newline at end of file diff --git a/dt-assets/build/components/repeat-1a2b8966.js b/dt-assets/build/components/repeat-1a2b8966.js index fc9d08251a..19b8057cf8 100644 --- a/dt-assets/build/components/repeat-1a2b8966.js +++ b/dt-assets/build/components/repeat-1a2b8966.js @@ -1,11 +1,130 @@ -import{L as e,x as t}from"./lit-element-2409d5fe.js";import{e as n,i as s,t as o}from"./directive-de55b00a.js"; +import { L as e, x as t } from './lit-element-2409d5fe.js'; +import { e as n, i as s, t as o } from './directive-de55b00a.js'; /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const{I:l}=e,r=()=>document.createComment(""),i=(e,t,n)=>{var s;const o=e._$AA.parentNode,i=void 0===t?e._$AB:t._$AA;if(void 0===n){const t=o.insertBefore(r(),i),s=o.insertBefore(r(),i);n=new l(t,s,e,e.options)}else{const t=n._$AB.nextSibling,l=n._$AM,r=l!==e;if(r){let t;null===(s=n._$AQ)||void 0===s||s.call(n,e),n._$AM=e,void 0!==n._$AP&&(t=e._$AU)!==l._$AU&&n._$AP(t)}if(t!==i||r){let e=n._$AA;for(;e!==t;){const t=e.nextSibling;o.insertBefore(e,i),e=t}}}return n},f=(e,t,n=e)=>(e._$AI(t,n),e),u={},c=e=>{var t;null===(t=e._$AP)||void 0===t||t.call(e,!1,!0);let n=e._$AA;const s=e._$AB.nextSibling;for(;n!==s;){const e=n.nextSibling;n.remove(),n=e}},A=(e,t,n)=>{const s=new Map;for(let o=t;o<=n;o++)s.set(e[o],o);return s},a=n(class extends s{constructor(e){if(super(e),e.type!==o.CHILD)throw Error("repeat() can only be used in text expressions")}ht(e,t,n){let s;void 0===n?n=t:void 0!==t&&(s=t);const o=[],l=[];let r=0;for(const t of e)o[r]=s?s(t,r):r,l[r]=n(t,r),r++;return{values:l,keys:o}}render(e,t,n){return this.ht(e,t,n).values}update(e,[n,s,o]){var l;const r=e._$AH,{values:a,keys:d}=this.ht(n,s,o);if(!Array.isArray(r))return this.ut=d,a;const v=null!==(l=this.ut)&&void 0!==l?l:this.ut=[],$=[];let _,h,p=0,m=r.length-1,x=0,g=a.length-1;for(;p<=m&&x<=g;)if(null===r[p])p++;else if(null===r[m])m--;else if(v[p]===d[x])$[x]=f(r[p],a[x]),p++,x++;else if(v[m]===d[g])$[g]=f(r[m],a[g]),m--,g--;else if(v[p]===d[g])$[g]=f(r[p],a[g]),i(e,$[g+1],r[p]),p++,g--;else if(v[m]===d[x])$[x]=f(r[m],a[x]),i(e,r[p],r[m]),m--,x++;else if(void 0===_&&(_=A(d,x,g),h=A(v,p,m)),_.has(v[p]))if(_.has(v[m])){const t=h.get(d[x]),n=void 0!==t?r[t]:null;if(null===n){const t=i(e,r[p]);f(t,a[x]),$[x]=t}else $[x]=f(n,a[x]),i(e,r[p],n),r[t]=null;x++}else c(r[m]),m--;else c(r[p]),p++;for(;x<=g;){const t=i(e,$[g+1]);f(t,a[x]),$[x++]=t}for(;p<=m;){const e=r[p++];null!==e&&c(e)}return this.ut=d,((e,t=u)=>{e._$AH=t})(e,$),t}}); + */ const { I: l } = e, + r = () => document.createComment(''), + i = (e, t, n) => { + var s; + const o = e._$AA.parentNode, + i = void 0 === t ? e._$AB : t._$AA; + if (void 0 === n) { + const t = o.insertBefore(r(), i), + s = o.insertBefore(r(), i); + n = new l(t, s, e, e.options); + } else { + const t = n._$AB.nextSibling, + l = n._$AM, + r = l !== e; + if (r) { + let t; + null === (s = n._$AQ) || void 0 === s || s.call(n, e), + (n._$AM = e), + void 0 !== n._$AP && (t = e._$AU) !== l._$AU && n._$AP(t); + } + if (t !== i || r) { + let e = n._$AA; + for (; e !== t; ) { + const t = e.nextSibling; + o.insertBefore(e, i), (e = t); + } + } + } + return n; + }, + f = (e, t, n = e) => (e._$AI(t, n), e), + u = {}, + c = (e) => { + var t; + null === (t = e._$AP) || void 0 === t || t.call(e, !1, !0); + let n = e._$AA; + const s = e._$AB.nextSibling; + for (; n !== s; ) { + const e = n.nextSibling; + n.remove(), (n = e); + } + }, + A = (e, t, n) => { + const s = new Map(); + for (let o = t; o <= n; o++) s.set(e[o], o); + return s; + }, + a = n( + class extends s { + constructor(e) { + if ((super(e), e.type !== o.CHILD)) + throw Error('repeat() can only be used in text expressions'); + } + ht(e, t, n) { + let s; + void 0 === n ? (n = t) : void 0 !== t && (s = t); + const o = [], + l = []; + let r = 0; + for (const t of e) (o[r] = s ? s(t, r) : r), (l[r] = n(t, r)), r++; + return { values: l, keys: o }; + } + render(e, t, n) { + return this.ht(e, t, n).values; + } + update(e, [n, s, o]) { + var l; + const r = e._$AH, + { values: a, keys: d } = this.ht(n, s, o); + if (!Array.isArray(r)) return (this.ut = d), a; + const v = null !== (l = this.ut) && void 0 !== l ? l : (this.ut = []), + $ = []; + let _, + h, + p = 0, + m = r.length - 1, + x = 0, + g = a.length - 1; + for (; p <= m && x <= g; ) + if (null === r[p]) p++; + else if (null === r[m]) m--; + else if (v[p] === d[x]) ($[x] = f(r[p], a[x])), p++, x++; + else if (v[m] === d[g]) ($[g] = f(r[m], a[g])), m--, g--; + else if (v[p] === d[g]) + ($[g] = f(r[p], a[g])), i(e, $[g + 1], r[p]), p++, g--; + else if (v[m] === d[x]) + ($[x] = f(r[m], a[x])), i(e, r[p], r[m]), m--, x++; + else if ( + (void 0 === _ && ((_ = A(d, x, g)), (h = A(v, p, m))), _.has(v[p])) + ) + if (_.has(v[m])) { + const t = h.get(d[x]), + n = void 0 !== t ? r[t] : null; + if (null === n) { + const t = i(e, r[p]); + f(t, a[x]), ($[x] = t); + } else ($[x] = f(n, a[x])), i(e, r[p], n), (r[t] = null); + x++; + } else c(r[m]), m--; + else c(r[p]), p++; + for (; x <= g; ) { + const t = i(e, $[g + 1]); + f(t, a[x]), ($[x++] = t); + } + for (; p <= m; ) { + const e = r[p++]; + null !== e && c(e); + } + return ( + (this.ut = d), + ((e, t = u) => { + e._$AH = t; + })(e, $), + t + ); + } + }, + ); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */export{a as c}; + */ export { a as c }; +//# sourceMappingURL=repeat-1a2b8966.js.map diff --git a/dt-assets/build/components/repeat-1a2b8966.js.map b/dt-assets/build/components/repeat-1a2b8966.js.map new file mode 100644 index 0000000000..686395b587 --- /dev/null +++ b/dt-assets/build/components/repeat-1a2b8966.js.map @@ -0,0 +1 @@ +{"version":3,"file":"repeat-1a2b8966.js","sources":["../node_modules/lit-html/directive-helpers.js","../node_modules/lit-html/directives/repeat.js"],"sourcesContent":["import{_$LH as o}from\"./lit-html.js\";\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{I:l}=o,t=o=>null===o||\"object\"!=typeof o&&\"function\"!=typeof o,i={HTML:1,SVG:2},n=(o,l)=>void 0===l?void 0!==(null==o?void 0:o._$litType$):(null==o?void 0:o._$litType$)===l,d=o=>void 0!==(null==o?void 0:o._$litDirective$),v=o=>null==o?void 0:o._$litDirective$,e=o=>void 0===o.strings,c=()=>document.createComment(\"\"),r=(o,t,i)=>{var n;const d=o._$AA.parentNode,v=void 0===t?o._$AB:t._$AA;if(void 0===i){const t=d.insertBefore(c(),v),n=d.insertBefore(c(),v);i=new l(t,n,o,o.options)}else{const l=i._$AB.nextSibling,t=i._$AM,e=t!==o;if(e){let l;null===(n=i._$AQ)||void 0===n||n.call(i,o),i._$AM=o,void 0!==i._$AP&&(l=o._$AU)!==t._$AU&&i._$AP(l)}if(l!==v||e){let o=i._$AA;for(;o!==l;){const l=o.nextSibling;d.insertBefore(o,v),o=l}}}return i},u=(o,l,t=o)=>(o._$AI(l,t),o),f={},s=(o,l=f)=>o._$AH=l,m=o=>o._$AH,p=o=>{var l;null===(l=o._$AP)||void 0===l||l.call(o,!1,!0);let t=o._$AA;const i=o._$AB.nextSibling;for(;t!==i;){const o=t.nextSibling;t.remove(),t=o}},a=o=>{o._$AR()};export{i as TemplateResultType,a as clearPart,m as getCommittedValue,v as getDirectiveClass,r as insertPart,d as isDirectiveResult,t as isPrimitive,e as isSingleExpression,n as isTemplateResult,p as removePart,u as setChildPartValue,s as setCommittedValue};\n//# sourceMappingURL=directive-helpers.js.map\n","import{noChange as e}from\"../lit-html.js\";import{directive as s,Directive as t,PartType as r}from\"../directive.js\";import{getCommittedValue as l,setChildPartValue as o,insertPart as i,removePart as n,setCommittedValue as f}from\"../directive-helpers.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst u=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c=s(class extends t{constructor(e){if(super(e),e.type!==r.CHILD)throw Error(\"repeat() can only be used in text expressions\")}ht(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return{values:o,keys:l}}render(e,s,t){return this.ht(e,s,t).values}update(s,[t,r,c]){var d;const a=l(s),{values:p,keys:v}=this.ht(t,r,c);if(!Array.isArray(a))return this.ut=v,p;const h=null!==(d=this.ut)&&void 0!==d?d:this.ut=[],m=[];let y,x,j=0,k=a.length-1,w=0,A=p.length-1;for(;j<=k&&w<=A;)if(null===a[j])j++;else if(null===a[k])k--;else if(h[j]===v[w])m[w]=o(a[j],p[w]),j++,w++;else if(h[k]===v[A])m[A]=o(a[k],p[A]),k--,A--;else if(h[j]===v[A])m[A]=o(a[j],p[A]),i(s,m[A+1],a[j]),j++,A--;else if(h[k]===v[w])m[w]=o(a[k],p[w]),i(s,a[j],a[k]),k--,w++;else if(void 0===y&&(y=u(v,w,A),x=u(h,j,k)),y.has(h[j]))if(y.has(h[k])){const e=x.get(v[w]),t=void 0!==e?a[e]:null;if(null===t){const e=i(s,a[j]);o(e,p[w]),m[w]=e}else m[w]=o(t,p[w]),i(s,a[j],t),a[e]=null;w++}else n(a[k]),k--;else n(a[j]),j++;for(;w<=A;){const e=i(s,m[A+1]);o(e,p[w]),m[w++]=e}for(;j<=k;){const e=a[j++];null!==e&&n(e)}return this.ut=v,f(s,m),e}});export{c as repeat};\n//# sourceMappingURL=repeat.js.map\n"],"names":["I","l","o","c","document","createComment","r","t","i","n","d","_$AA","parentNode","v","_$AB","insertBefore","options","nextSibling","_$AM","e","_$AQ","call","_$AP","_$AU","u","_$AI","f","p","remove","s","Map","set","constructor","super","type","CHILD","Error","ht","values","keys","render","this","update","a","_$AH","Array","isArray","ut","h","m","y","x","j","k","length","w","A","has","get"],"mappings":";;;;;GAKO,MAAEA,EAAEC,GAAGC,EAAuRC,EAAE,IAAIC,SAASC,cAAc,IAAIC,EAAE,CAACJ,EAAEK,EAAEC,KAAK,IAAIC,EAAE,MAAMC,EAAER,EAAES,KAAKC,WAAWC,OAAE,IAASN,EAAEL,EAAEY,KAAKP,EAAEI,KAAK,QAAG,IAASH,EAAE,CAAC,MAAMD,EAAEG,EAAEK,aAAaZ,IAAIU,GAAGJ,E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E6B,IAAIhD,EAAEqB,EAAEoB,EAAEO,EAAE,GAAGb,EAAES,IAAIA,IAAII,SAAS,GAAGR,EAAEK,KAAKxC,EAAE0C,GAAGN,EAAEM,GAAGrD,EAAEyC,EAAEU,GAAG1B,EAAE4B,IAAI/C,EAAEqB,EAAEc,EAAES,GAAGT,EAAEU,IAAIA,IAAIE,SAAS,QAAG,IAASL,IAAIA,EAAE1B,EAAEX,EAAE0C,EAAEC,GAAGL,EAAE3B,EAAEwB,EAAEI,EAAEC,IAAIH,EAAEO,IAAIT,EAAEI,IAAI,GAAGF,EAAEO,IAAIT,EAAEK,IAAI,CAAC,MAAMlC,EAAEgC,EAAEO,IAAI7C,EAAE0C,IAAIhD,OAAE,IAASY,EAAEwB,EAAExB,GAAG,KAAK,GAAG,OAAOZ,EAAE,CAAC,MAAMY,EAAEX,EAAEqB,EAAEc,EAAES,IAAIlD,EAAEiB,EAAEQ,EAAE4B,IAAIN,EAAEM,GAAGpC,CAAC,MAAM8B,EAAEM,GAAGrD,EAAEK,EAAEoB,EAAE4B,IAAI/C,EAAEqB,EAAEc,EAAES,GAAG7C,GAAGoC,EAAExB,GAAG,KAAKoC,GAAG,MAAM9C,EAAEkC,EAAEU,IAAIA,SAAS5C,EAAEkC,EAAES,IAAIA,IAAI,KAAKG,GAAGC,GAAG,CAAC,MAAMrC,EAAEX,EAAEqB,EAAEoB,EAAEO,EAAE,IAAItD,EAAEiB,EAAEQ,EAAE4B,IAAIN,EAAEM,KAAKpC,CAAC,CAAC,KAAKiC,GAAGC,GAAG,CAAC,MAAMlC,EAAEwB,EAAES,KAAK,OAAOjC,GAAGV,EAAEU,EAAE,CAAC,OAAOsB,KAAKM,GAAGlC,EDD5b,EAACX,EAAED,EAAEyB,KAAIxB,EAAE0C,KAAK3C,CAAC,ECC6ayB,CAAEG,EAAEoB,GAAG9B,CAAC;;;;;"} \ No newline at end of file diff --git a/dt-assets/build/components/services.min.js b/dt-assets/build/components/services.min.js index 3b2d6c1138..c6292db5df 100644 --- a/dt-assets/build/components/services.min.js +++ b/dt-assets/build/components/services.min.js @@ -1 +1 @@ -var WebComponentServices=function(t){"use strict";class e{constructor(t,e="wp-json"){this.nonce=t,this.apiRoot=e.endsWith("/")?`${e}`:`${e} + "/"`,this.apiRoot=`/${e}/`.replace(/\/\//g,"/")}async makeRequest(t,e,s,a="dt/v1/"){let n=a;n.endsWith("/")||e.startsWith("/")||(n+="/");const o=e.startsWith("http")?e:`${this.apiRoot}${n}${e}`,r={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":this.nonce}};"GET"!==t&&(r.body=JSON.stringify(s));const i=await fetch(o,r),c=await i.json();if(!i.ok){const t=new Error(c?.message||c.toString());throw t.args={status:i.status,statusText:i.statusText,body:c},t}return c}async makeRequestOnPosts(t,e,s={}){return this.makeRequest(t,e,s,"dt-posts/v2/")}async getPost(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}`)}async createPost(t,e){return this.makeRequestOnPosts("POST",t,e)}async updatePost(t,e,s){return this.makeRequestOnPosts("POST",`${t}/${e}`,s)}async deletePost(t,e){return this.makeRequestOnPosts("DELETE",`${t}/${e}`)}async listPostsCompact(t,e=""){const s=new URLSearchParams({s:e});return this.makeRequestOnPosts("GET",`${t}/compact?${s}`)}async getPostDuplicates(t,e,s){return this.makeRequestOnPosts("GET",`${t}/${e}/all_duplicates`,s)}async getMultiSelectValues(t,e,s=""){const a=new URLSearchParams({s,field:e});return this.makeRequestOnPosts("GET",`${t}/multi-select-values?${a}`)}async transferContact(t,e){return this.makeRequestOnPosts("POST","contacts/transfer",{contact_id:t,site_post_id:e})}async transferContactSummaryUpdate(t,e){return this.makeRequestOnPosts("POST","contacts/transfer/summary/send-update",{contact_id:t,update:e})}async requestRecordAccess(t,e,s){return this.makeRequestOnPosts("POST",`${t}/${e}/request_record_access`,{user_id:s})}async createComment(t,e,s,a="comment"){return this.makeRequestOnPosts("POST",`${t}/${e}/comments`,{comment:s,comment_type:a})}async updateComment(t,e,s,a,n="comment"){return this.makeRequestOnPosts("POST",`${t}/${e}/comments/${s}`,{comment:a,comment_type:n})}async deleteComment(t,e,s){return this.makeRequestOnPosts("DELETE",`${t}/${e}/comments/${s}`)}async getComments(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}/comments`)}async toggle_comment_reaction(t,e,s,a,n){return this.makeRequestOnPosts("POST",`${t}/${e}/comments/${s}/react`,{user_id:a,reaction:n})}async getPostActivity(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}/activity`)}async getSingleActivity(t,e,s){return this.makeRequestOnPosts("GET",`${t}/${e}/activity/${s}`)}async revertActivity(t,e,s){return this.makeRequestOnPosts("GET",`${t}/${e}/revert/${s}`)}async getPostShares(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}/shares`)}async addPostShare(t,e,s){return this.makeRequestOnPosts("POST",`${t}/${e}/shares`,{user_id:s})}async removePostShare(t,e,s){return this.makeRequestOnPosts("DELETE",`${t}/${e}/shares`,{user_id:s})}async getFilters(){return this.makeRequest("GET","users/get_filters")}async saveFilters(t,e){return this.makeRequest("POST","users/save_filters",{filter:e,postType:t})}async deleteFilter(t,e){return this.makeRequest("DELETE","users/save_filters",{id:e,postType:t})}async searchUsers(t){return this.makeRequest("GET",`users/get_users?s=${t}`)}async createUser(t){return this.makeRequest("POST","users/create",t)}async advanced_search(t,e,s,a){return this.makeRequest("GET","advanced_search",{query:t,postType:e,offset:s,post:a.post,comment:a.comment,meta:a.meta,status:a.status},"dt-posts/v2/posts/search/")}}class s{constructor(t,s,a,n="wp-json"){this.postType=t,this.postId=s,this.nonce=a,this.apiRoot=`${n}/`.replace("//","/"),this.api=new e(this.nonce,this.apiRoot),this.autoSaveComponents=["dt-connection","dt-date","dt-location","dt-multi-select","dt-number","dt-single-select","dt-tags","dt-text","dt-textarea","dt-toggle","dt-comm-channel"],this.dynamicLoadComponents=["dt-connection","dt-tags"]}initialize(){this.enableAutoSave(),this.attachLoadEvents()}attachLoadEvents(t){const e=document.querySelectorAll(t||this.dynamicLoadComponents.join(","));e&&e.forEach((t=>t.addEventListener("load",this.handleLoadEvent.bind(this))))}enableAutoSave(t){const e=document.querySelectorAll(t||this.autoSaveComponents.join(","));e&&e.forEach((t=>t.addEventListener("change",this.handleChangeEvent.bind(this))))}async handleLoadEvent(t){const e=t.detail;if(e){const{field:s,query:a,onSuccess:n,onError:o}=e;try{const o=t.target.tagName.toLowerCase();let r=[];switch(o){case"dt-connection":{const t=e.postType||this.postType,s=await this.api.listPostsCompact(t,a);s?.posts&&(r=s?.posts.map((t=>({id:t.ID,label:t.name,link:t.permalink,status:t.status}))));break}default:r=await this.api.getMultiSelectValues(this.postType,s,a),r=r.map((t=>({id:t,label:t})))}n(r)}catch(t){o(t)}}}async handleChangeEvent(t){const e=t.detail;if(e){const{field:a,newValue:n}=e,o=t.target.tagName.toLowerCase(),r=s.convertValue(o,n);t.target.setAttribute("loading",!0);try{await this.api.updatePost(this.postType,this.postId,{[a]:r}),t.target.removeAttribute("loading"),t.target.setAttribute("saved",!0)}catch(e){console.error(e),t.target.removeAttribute("loading"),t.target.setAttribute("invalid",!0),t.target.setAttribute("error",e.message||e.toString())}}}static convertValue(t,e){let s=e;if(e)switch(t){case"dt-toggle":"string"==typeof e&&(s="true"===e.toLowerCase());break;case"dt-multi-select":"string"==typeof e&&(s=[e]),s={values:s.map((t=>{const e={value:t.replace("-","")};return t.startsWith("-")&&(e.delete=!0),e})),force_values:!1};break;case"dt-connection":case"dt-location":case"dt-tags":"string"==typeof e&&(s=[{id:e}]),s={values:s.map((t=>{const e={value:t.id};return t.delete&&(e.delete=t.delete),e})),force_values:!1};break;case"dt-comm-channel":"string"==typeof e&&(console.log("dt-comm-channel",e),s=[{id:e}])}return s}}return t.ApiService=e,t.ComponentService=s,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); +var WebComponentServices=function(t){"use strict";class e{constructor(t,e="wp-json"){this.nonce=t,this.apiRoot=e.endsWith("/")?`${e}`:`${e} + "/"`,this.apiRoot=`/${e}/`.replace(/\/\//g,"/")}async makeRequest(t,e,s,a="dt/v1/"){let n=a;n.endsWith("/")||e.startsWith("/")||(n+="/");const o=e.startsWith("http")?e:`${this.apiRoot}${n}${e}`,r={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":this.nonce}};"GET"!==t&&(r.body=JSON.stringify(s));const i=await fetch(o,r),c=await i.json();if(!i.ok){const t=new Error(c?.message||c.toString());throw t.args={status:i.status,statusText:i.statusText,body:c},t}return c}async makeRequestOnPosts(t,e,s={}){return this.makeRequest(t,e,s,"dt-posts/v2/")}async getPost(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}`)}async createPost(t,e){return this.makeRequestOnPosts("POST",t,e)}async updatePost(t,e,s){return this.makeRequestOnPosts("POST",`${t}/${e}`,s)}async deletePost(t,e){return this.makeRequestOnPosts("DELETE",`${t}/${e}`)}async listPostsCompact(t,e=""){const s=new URLSearchParams({s:e});return this.makeRequestOnPosts("GET",`${t}/compact?${s}`)}async getPostDuplicates(t,e,s){return this.makeRequestOnPosts("GET",`${t}/${e}/all_duplicates`,s)}async getMultiSelectValues(t,e,s=""){const a=new URLSearchParams({s,field:e});return this.makeRequestOnPosts("GET",`${t}/multi-select-values?${a}`)}async transferContact(t,e){return this.makeRequestOnPosts("POST","contacts/transfer",{contact_id:t,site_post_id:e})}async transferContactSummaryUpdate(t,e){return this.makeRequestOnPosts("POST","contacts/transfer/summary/send-update",{contact_id:t,update:e})}async requestRecordAccess(t,e,s){return this.makeRequestOnPosts("POST",`${t}/${e}/request_record_access`,{user_id:s})}async createComment(t,e,s,a="comment"){return this.makeRequestOnPosts("POST",`${t}/${e}/comments`,{comment:s,comment_type:a})}async updateComment(t,e,s,a,n="comment"){return this.makeRequestOnPosts("POST",`${t}/${e}/comments/${s}`,{comment:a,comment_type:n})}async deleteComment(t,e,s){return this.makeRequestOnPosts("DELETE",`${t}/${e}/comments/${s}`)}async getComments(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}/comments`)}async toggle_comment_reaction(t,e,s,a,n){return this.makeRequestOnPosts("POST",`${t}/${e}/comments/${s}/react`,{user_id:a,reaction:n})}async getPostActivity(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}/activity`)}async getSingleActivity(t,e,s){return this.makeRequestOnPosts("GET",`${t}/${e}/activity/${s}`)}async revertActivity(t,e,s){return this.makeRequestOnPosts("GET",`${t}/${e}/revert/${s}`)}async getPostShares(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}/shares`)}async addPostShare(t,e,s){return this.makeRequestOnPosts("POST",`${t}/${e}/shares`,{user_id:s})}async removePostShare(t,e,s){return this.makeRequestOnPosts("DELETE",`${t}/${e}/shares`,{user_id:s})}async getFilters(){return this.makeRequest("GET","users/get_filters")}async saveFilters(t,e){return this.makeRequest("POST","users/save_filters",{filter:e,postType:t})}async deleteFilter(t,e){return this.makeRequest("DELETE","users/save_filters",{id:e,postType:t})}async searchUsers(t){return this.makeRequest("GET",`users/get_users?s=${t}`)}async createUser(t){return this.makeRequest("POST","users/create",t)}async advanced_search(t,e,s,a){return this.makeRequest("GET","advanced_search",{query:t,postType:e,offset:s,post:a.post,comment:a.comment,meta:a.meta,status:a.status},"dt-posts/v2/posts/search/")}}class s{constructor(t,s,a,n="wp-json"){this.postType=t,this.postId=s,this.nonce=a,this.apiRoot=`${n}/`.replace("//","/"),this.api=new e(this.nonce,this.apiRoot),this.autoSaveComponents=["dt-connection","dt-date","dt-location","dt-multi-select","dt-number","dt-single-select","dt-tags","dt-text","dt-textarea","dt-toggle","dt-comm-channel"],this.dynamicLoadComponents=["dt-connection","dt-tags"]}initialize(){this.postId&&this.enableAutoSave(),this.attachLoadEvents()}attachLoadEvents(t){const e=document.querySelectorAll(t||this.dynamicLoadComponents.join(","));e&&e.forEach((t=>t.addEventListener("load",this.handleLoadEvent.bind(this))))}enableAutoSave(t){const e=document.querySelectorAll(t||this.autoSaveComponents.join(","));e&&e.forEach((t=>t.addEventListener("change",this.handleChangeEvent.bind(this))))}async handleLoadEvent(t){const e=t.detail;if(e){const{field:s,query:a,onSuccess:n,onError:o}=e;try{const o=t.target.tagName.toLowerCase();let r=[];switch(o){case"dt-connection":{const t=e.postType||this.postType,s=await this.api.listPostsCompact(t,a);s?.posts&&(r=s?.posts.map((t=>({id:t.ID,label:t.name,link:t.permalink,status:t.status}))));break}default:r=await this.api.getMultiSelectValues(this.postType,s,a),r=r.map((t=>({id:t,label:t})))}n(r)}catch(t){o(t)}}}async handleChangeEvent(t){const e=t.detail;if(e){const{field:a,newValue:n}=e,o=t.target.tagName.toLowerCase(),r=s.convertValue(o,n);t.target.setAttribute("loading",!0);try{await this.api.updatePost(this.postType,this.postId,{[a]:r}),t.target.removeAttribute("loading"),t.target.setAttribute("saved",!0)}catch(e){console.error(e),t.target.removeAttribute("loading"),t.target.setAttribute("invalid",!0),t.target.setAttribute("error",e.message||e.toString())}}}static convertValue(t,e){let s=e;if(e)switch(t){case"dt-toggle":"string"==typeof e&&(s="true"===e.toLowerCase());break;case"dt-multi-select":"string"==typeof e&&(s=[e]),s={values:s.map((t=>{const e={value:t.replace("-","")};return t.startsWith("-")&&(e.delete=!0),e})),force_values:!1};break;case"dt-connection":case"dt-location":case"dt-tags":"string"==typeof e&&(s=[{id:e}]),s={values:s.map((t=>{const e={value:t.id};return t.delete&&(e.delete=t.delete),e})),force_values:!1};break;case"dt-comm-channel":"string"==typeof e&&(console.log("dt-comm-channel",e),s=[{id:e}])}return s}}return t.ApiService=e,t.ComponentService=s,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); diff --git a/dt-assets/build/components/style-map-ac85d91b.js b/dt-assets/build/components/style-map-ac85d91b.js index 036aa47adb..8011df60f0 100644 --- a/dt-assets/build/components/style-map-ac85d91b.js +++ b/dt-assets/build/components/style-map-ac85d91b.js @@ -1,6 +1,52 @@ -import{x as t}from"./lit-element-2409d5fe.js";import{e,i as r,t as s}from"./directive-de55b00a.js"; +import { x as t } from './lit-element-2409d5fe.js'; +import { e, i as r, t as s } from './directive-de55b00a.js'; /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const n=e(class extends r{constructor(t){var e;if(super(t),t.type!==s.ATTRIBUTE||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.vt){this.vt=new Set;for(const t in r)this.vt.add(t);return this.render(r)}this.vt.forEach((t=>{null==r[t]&&(this.vt.delete(t),t.includes("-")?s.removeProperty(t):s[t]="")}));for(const t in r){const e=r[t];null!=e&&(this.vt.add(t),t.includes("-")?s.setProperty(t,e):s[t]=e)}return t}});export{n as i}; + */ const n = e( + class extends r { + constructor(t) { + var e; + if ( + (super(t), + t.type !== s.ATTRIBUTE || + 'style' !== t.name || + (null === (e = t.strings) || void 0 === e ? void 0 : e.length) > 2) + ) + throw Error( + 'The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.', + ); + } + render(t) { + return Object.keys(t).reduce((e, r) => { + const s = t[r]; + return null == s + ? e + : e + + `${(r = r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&').toLowerCase())}:${s};`; + }, ''); + } + update(e, [r]) { + const { style: s } = e.element; + if (void 0 === this.vt) { + this.vt = new Set(); + for (const t in r) this.vt.add(t); + return this.render(r); + } + this.vt.forEach((t) => { + null == r[t] && + (this.vt.delete(t), + t.includes('-') ? s.removeProperty(t) : (s[t] = '')); + }); + for (const t in r) { + const e = r[t]; + null != e && + (this.vt.add(t), t.includes('-') ? s.setProperty(t, e) : (s[t] = e)); + } + return t; + } + }, +); +export { n as i }; +//# sourceMappingURL=style-map-ac85d91b.js.map diff --git a/dt-assets/build/components/style-map-ac85d91b.js.map b/dt-assets/build/components/style-map-ac85d91b.js.map new file mode 100644 index 0000000000..de0148fc23 --- /dev/null +++ b/dt-assets/build/components/style-map-ac85d91b.js.map @@ -0,0 +1 @@ +{"version":3,"file":"style-map-ac85d91b.js","sources":["../node_modules/lit-html/directives/style-map.js"],"sourcesContent":["import{noChange as t}from\"../lit-html.js\";import{directive as e,Directive as r,PartType as s}from\"../directive.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const i=e(class extends r{constructor(t){var e;if(super(t),t.type!==s.ATTRIBUTE||\"style\"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error(\"The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.\")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,\"-$&\").toLowerCase()}:${s};`}),\"\")}update(e,[r]){const{style:s}=e.element;if(void 0===this.vt){this.vt=new Set;for(const t in r)this.vt.add(t);return this.render(r)}this.vt.forEach((t=>{null==r[t]&&(this.vt.delete(t),t.includes(\"-\")?s.removeProperty(t):s[t]=\"\")}));for(const t in r){const e=r[t];null!=e&&(this.vt.add(t),t.includes(\"-\")?s.setProperty(t,e):s[t]=e)}return t}});export{i as styleMap};\n//# sourceMappingURL=style-map.js.map\n"],"names":["i","e","r","constructor","t","super","type","s","ATTRIBUTE","name","strings","length","Error","render","Object","keys","reduce","replace","toLowerCase","update","style","element","this","vt","Set","add","forEach","delete","includes","removeProperty","setProperty"],"mappings":";;;;;GAKQ,MAACA,EAAEC,EAAE,cAAcC,EAAEC,YAAYC,GAAG,IAAIH,EAAE,GAAGI,MAAMD,GAAGA,EAAEE,OAAOC,EAAEC,WAAW,UAAUJ,EAAEK,OAAO,QAAQR,EAAEG,EAAEM,eAAU,IAAST,OAAE,EAAOA,EAAEU,QAAQ,EAAE,MAAMC,MAAM,6GAA6G,CAACC,OAAOT,GAAG,OAAOU,OAAOC,KAAKX,GAAGY,QAAM,CAAGf,EAAEC,KAAK,MAAMK,EAAEH,EAAEF,GAAG,OAAO,MAAMK,EAAEN,EAAEA,EAAE,GAAGC,EAAEA,EAAEe,QAAQ,oCAAoC,OAAOC,iBAAiBX,IAAK,GAAE,GAAG,CAACY,OAAOlB,GAAGC,IAAI,MAAMkB,MAAMb,GAAGN,EAAEoB,QAAQ,QAAG,IAASC,KAAKC,GAAG,CAACD,KAAKC,GAAG,IAAIC,IAAI,IAAI,MAAMpB,KAAKF,EAAEoB,KAAKC,GAAGE,IAAIrB,GAAG,OAAOkB,KAAKT,OAAOX,EAAE,CAACoB,KAAKC,GAAGG,SAAStB,IAAI,MAAMF,EAAEE,KAAKkB,KAAKC,GAAGI,OAAOvB,GAAGA,EAAEwB,SAAS,KAAKrB,EAAEsB,eAAezB,GAAGG,EAAEH,GAAG,GAAI,IAAG,IAAI,MAAMA,KAAKF,EAAE,CAAC,MAAMD,EAAEC,EAAEE,GAAG,MAAMH,IAAIqB,KAAKC,GAAGE,IAAIrB,GAAGA,EAAEwB,SAAS,KAAKrB,EAAEuB,YAAY1B,EAAEH,GAAGM,EAAEH,GAAGH,EAAE,CAAC,OAAOG,CAAC"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 94c4d2c1d0..f60a824dfb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "GPL-2.0-or-later", "dependencies": { "@babel/eslint-parser": "^7.18.2", - "@disciple.tools/web-components": "^0.5.1", + "@disciple.tools/web-components": "^0.6.1", "babel-eslint": "^10.1.0", "browserslist": "^4.17.0", "dotenv": "^16.4.5", @@ -1806,9 +1806,9 @@ } }, "node_modules/@disciple.tools/web-components": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@disciple.tools/web-components/-/web-components-0.5.1.tgz", - "integrity": "sha512-YktYB1xNYFW6L0RmXIPTwRhRkvJXtrwUB/Sxuie/Kd/xmRBq/lzupJh5iuMxsm2P+WWmB7tB/t4tzwWjU0NYpQ==", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@disciple.tools/web-components/-/web-components-0.6.1.tgz", + "integrity": "sha512-wK5QxJFQc67OKiGZvjN72r69a8qNtlhYoroo1r0evqpa2GAa39AKQ4PFDpoOAKPVk9Fl6hQ3I0EI/gEwj3+08w==", "dependencies": { "@lit/localize": "^0.11.4", "iconify-icon": "^1.0.2", @@ -13446,9 +13446,9 @@ } }, "@disciple.tools/web-components": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@disciple.tools/web-components/-/web-components-0.5.1.tgz", - "integrity": "sha512-YktYB1xNYFW6L0RmXIPTwRhRkvJXtrwUB/Sxuie/Kd/xmRBq/lzupJh5iuMxsm2P+WWmB7tB/t4tzwWjU0NYpQ==", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@disciple.tools/web-components/-/web-components-0.6.1.tgz", + "integrity": "sha512-wK5QxJFQc67OKiGZvjN72r69a8qNtlhYoroo1r0evqpa2GAa39AKQ4PFDpoOAKPVk9Fl6hQ3I0EI/gEwj3+08w==", "requires": { "@lit/localize": "^0.11.4", "iconify-icon": "^1.0.2", diff --git a/package.json b/package.json index 61fbc0c5bd..804509c652 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ }, "dependencies": { "@babel/eslint-parser": "^7.18.2", - "@disciple.tools/web-components": "^0.5.1", + "@disciple.tools/web-components": "^0.6.1", "babel-eslint": "^10.1.0", "browserslist": "^4.17.0", "dotenv": "^16.4.5", From ae5a7b2305550de9dd6332f2f0cb93b7f32a9bdb Mon Sep 17 00:00:00 2001 From: Micah Mills Date: Thu, 23 May 2024 08:57:45 +0300 Subject: [PATCH 8/8] running npm run build --- .../build/components/class-map-8d921948.js | 59 +- .../build/components/directive-de55b00a.js | 28 +- dt-assets/build/components/dt-base.js | 855 +--------- .../components/form/dt-button/dt-button.js | 56 +- .../dt-church-health-circle-icon.js | 49 +- .../dt-church-health-circle.js | 117 +- .../dt-comm-channel.js | 81 +- .../form/dt-connection/dt-connection.js | 112 +- .../form/dt-copy-text/dt-copy-text.js | 57 +- .../build/components/form/dt-date/dt-date.js | 59 +- .../form/dt-datetime/dt-datetime.js | 28 +- .../build/components/form/dt-form-base.js | 83 +- .../components/form/dt-label/dt-label.js | 35 +- .../dt-location-map/dt-location-map-item.js | 389 +---- .../form/dt-location-map/dt-location-map.js | 120 +- .../form/dt-location-map/dt-map-modal.js | 121 +- .../form/dt-location/dt-location.js | 137 +- .../form/dt-multi-select/dt-multi-select.js | 112 +- .../components/form/dt-number/dt-number.js | 67 +- .../form/dt-single-select/dt-single-select.js | 56 +- .../build/components/form/dt-tags/dt-tags.js | 100 +- .../build/components/form/dt-text/dt-text.js | 69 +- .../form/dt-textarea/dt-textarea.js | 40 +- .../components/form/dt-toggle/dt-toggle.js | 46 +- dt-assets/build/components/form/index.js | 35 +- .../components/form/mixins/hasOptionsList.js | 170 +- dt-assets/build/components/generated/am_ET.js | 2 +- dt-assets/build/components/generated/ar.js | 2 +- dt-assets/build/components/generated/ar_MA.js | 2 +- dt-assets/build/components/generated/bg_BG.js | 2 +- dt-assets/build/components/generated/bn_BD.js | 2 +- dt-assets/build/components/generated/bs_BA.js | 2 +- dt-assets/build/components/generated/cs.js | 2 +- dt-assets/build/components/generated/de_DE.js | 2 +- dt-assets/build/components/generated/el.js | 2 +- dt-assets/build/components/generated/en_US.js | 2 +- .../build/components/generated/es-419.js | 2 +- .../build/components/generated/es_419.js | 2 +- dt-assets/build/components/generated/es_ES.js | 2 +- dt-assets/build/components/generated/fa_IR.js | 2 +- dt-assets/build/components/generated/fr_FR.js | 2 +- dt-assets/build/components/generated/hi_IN.js | 2 +- dt-assets/build/components/generated/hr.js | 2 +- dt-assets/build/components/generated/hu_HU.js | 2 +- dt-assets/build/components/generated/id_ID.js | 2 +- dt-assets/build/components/generated/it_IT.js | 2 +- dt-assets/build/components/generated/ja.js | 2 +- dt-assets/build/components/generated/ko_KR.js | 2 +- dt-assets/build/components/generated/mk_MK.js | 2 +- dt-assets/build/components/generated/mr.js | 2 +- dt-assets/build/components/generated/my_MM.js | 2 +- dt-assets/build/components/generated/ne_NP.js | 2 +- dt-assets/build/components/generated/nl_NL.js | 2 +- dt-assets/build/components/generated/pa_IN.js | 2 +- dt-assets/build/components/generated/pl.js | 2 +- dt-assets/build/components/generated/pt_BR.js | 2 +- dt-assets/build/components/generated/ro_RO.js | 2 +- dt-assets/build/components/generated/ru_RU.js | 2 +- dt-assets/build/components/generated/sl_SI.js | 2 +- dt-assets/build/components/generated/sr_BA.js | 2 +- dt-assets/build/components/generated/sw.js | 2 +- dt-assets/build/components/generated/th.js | 2 +- dt-assets/build/components/generated/tl.js | 2 +- dt-assets/build/components/generated/tr_TR.js | 2 +- dt-assets/build/components/generated/uk.js | 2 +- dt-assets/build/components/generated/vi.js | 2 +- dt-assets/build/components/generated/zh_CN.js | 2 +- dt-assets/build/components/generated/zh_TW.js | 2 +- .../build/components/icons/dt-checkmark.js | 10 +- .../components/icons/dt-exclamation-circle.js | 13 +- dt-assets/build/components/icons/dt-icon.js | 1372 +---------------- .../build/components/icons/dt-spinner.js | 10 +- dt-assets/build/components/icons/dt-star.js | 29 +- dt-assets/build/components/icons/index.js | 9 +- .../build/components/if-defined-11ddebeb.js | 5 +- dt-assets/build/components/index.js | 39 +- .../components/layout/dt-alert/dt-alert.js | 45 +- .../components/layout/dt-list/dt-list.js | 175 +-- .../components/layout/dt-modal/dt-modal.js | 81 +- .../components/layout/dt-tile/dt-tile.js | 33 +- dt-assets/build/components/layout/index.js | 15 +- .../build/components/lit-element-2409d5fe.js | 942 +---------- .../build/components/lit-localize-763e4978.js | 183 +-- dt-assets/build/components/map-c0e24c36.js | 8 +- dt-assets/build/components/repeat-1a2b8966.js | 124 +- .../build/components/style-map-ac85d91b.js | 49 +- 86 files changed, 119 insertions(+), 6188 deletions(-) diff --git a/dt-assets/build/components/class-map-8d921948.js b/dt-assets/build/components/class-map-8d921948.js index 7607ea6a9e..fa173b3bf5 100644 --- a/dt-assets/build/components/class-map-8d921948.js +++ b/dt-assets/build/components/class-map-8d921948.js @@ -1,62 +1,7 @@ -import { x as t } from './lit-element-2409d5fe.js'; -import { e, i as s, t as i } from './directive-de55b00a.js'; +import{x as t}from"./lit-element-2409d5fe.js";import{e,i as s,t as i}from"./directive-de55b00a.js"; /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */ const n = e( - class extends s { - constructor(t) { - var e; - if ( - (super(t), - t.type !== i.ATTRIBUTE || - 'class' !== t.name || - (null === (e = t.strings) || void 0 === e ? void 0 : e.length) > 2) - ) - throw Error( - '`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.', - ); - } - render(t) { - return ( - ' ' + - Object.keys(t) - .filter((e) => t[e]) - .join(' ') + - ' ' - ); - } - update(e, [s]) { - var i, n; - if (void 0 === this.nt) { - (this.nt = new Set()), - void 0 !== e.strings && - (this.st = new Set( - e.strings - .join(' ') - .split(/\s/) - .filter((t) => '' !== t), - )); - for (const t in s) - s[t] && - !(null === (i = this.st) || void 0 === i ? void 0 : i.has(t)) && - this.nt.add(t); - return this.render(s); - } - const r = e.element.classList; - this.nt.forEach((t) => { - t in s || (r.remove(t), this.nt.delete(t)); - }); - for (const t in s) { - const e = !!s[t]; - e === this.nt.has(t) || - (null === (n = this.st) || void 0 === n ? void 0 : n.has(t)) || - (e ? (r.add(t), this.nt.add(t)) : (r.remove(t), this.nt.delete(t))); - } - return t; - } - }, -); -export { n as o }; + */const n=e(class extends s{constructor(t){var e;if(super(t),t.type!==i.ATTRIBUTE||"class"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(e,[s]){var i,n;if(void 0===this.nt){this.nt=new Set,void 0!==e.strings&&(this.st=new Set(e.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in s)s[t]&&!(null===(i=this.st)||void 0===i?void 0:i.has(t))&&this.nt.add(t);return this.render(s)}const r=e.element.classList;this.nt.forEach((t=>{t in s||(r.remove(t),this.nt.delete(t))}));for(const t in s){const e=!!s[t];e===this.nt.has(t)||(null===(n=this.st)||void 0===n?void 0:n.has(t))||(e?(r.add(t),this.nt.add(t)):(r.remove(t),this.nt.delete(t)))}return t}});export{n as o}; //# sourceMappingURL=class-map-8d921948.js.map diff --git a/dt-assets/build/components/directive-de55b00a.js b/dt-assets/build/components/directive-de55b00a.js index 508053c228..49c8e663eb 100644 --- a/dt-assets/build/components/directive-de55b00a.js +++ b/dt-assets/build/components/directive-de55b00a.js @@ -3,31 +3,5 @@ * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const t = { - ATTRIBUTE: 1, - CHILD: 2, - PROPERTY: 3, - BOOLEAN_ATTRIBUTE: 4, - EVENT: 5, - ELEMENT: 6, - }, - e = - (t) => - (...e) => ({ _$litDirective$: t, values: e }); -class r { - constructor(t) {} - get _$AU() { - return this._$AM._$AU; - } - _$AT(t, e, r) { - (this._$Ct = t), (this._$AM = e), (this._$Ci = r); - } - _$AS(t, e) { - return this.update(t, e); - } - update(t, e) { - return this.render(...e); - } -} -export { e, r as i, t }; +const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e=t=>(...e)=>({_$litDirective$:t,values:e});class r{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}export{e,r as i,t}; //# sourceMappingURL=directive-de55b00a.js.map diff --git a/dt-assets/build/components/dt-base.js b/dt-assets/build/components/dt-base.js index 9c80b398f0..f7885f6802 100644 --- a/dt-assets/build/components/dt-base.js +++ b/dt-assets/build/components/dt-base.js @@ -1,858 +1,7 @@ -import { s as t } from './lit-element-2409d5fe.js'; -import { L as e, c as a } from './lit-localize-763e4978.js'; +import{s as t}from"./lit-element-2409d5fe.js";import{L as e,c as a}from"./lit-localize-763e4978.js"; /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */ class s { - constructor(t) { - (this.__litLocalizeEventHandler = (t) => { - 'ready' === t.detail.status && this.host.requestUpdate(); - }), - (this.host = t); - } - hostConnected() { - window.addEventListener(e, this.__litLocalizeEventHandler); - } - hostDisconnected() { - window.removeEventListener(e, this.__litLocalizeEventHandler); - } -} -const r = (t) => t.addController(new s(t)), - n = [ - 'am_ET', - 'ar', - 'ar_MA', - 'bg_BG', - 'bn_BD', - 'bs_BA', - 'cs', - 'de_DE', - 'el', - 'en_US', - 'es_419', - 'es_ES', - 'fa_IR', - 'fr_FR', - 'hi_IN', - 'hr', - 'hu_HU', - 'id_ID', - 'it_IT', - 'ja', - 'ko_KR', - 'mk_MK', - 'mr', - 'my_MM', - 'ne_NP', - 'nl_NL', - 'pa_IN', - 'pl', - 'pt_BR', - 'ro_RO', - 'ru_RU', - 'sl_SI', - 'sr_BA', - 'sw', - 'th', - 'tl', - 'tr_TR', - 'uk', - 'vi', - 'zh_CN', - 'zh_TW', - ], - { getLocale: i, setLocale: o } = a({ - sourceLocale: 'en', - targetLocales: n, - loadLocale: (t) => import(`./generated/${t}.js`), - }); -class l { - constructor(t, e = 'wp-json') { - (this.nonce = t), - (this.apiRoot = e.endsWith('/') ? `${e}` : `${e} + "/"`), - (this.apiRoot = `/${e}/`.replace(/\/\//g, '/')); - } - async makeRequest(t, e, a, s = 'dt/v1/') { - let r = s; - r.endsWith('/') || e.startsWith('/') || (r += '/'); - const n = e.startsWith('http') ? e : `${this.apiRoot}${r}${e}`, - i = { - method: t, - credentials: 'same-origin', - headers: { - 'Content-Type': 'application/json', - 'X-WP-Nonce': this.nonce, - }, - }; - 'GET' !== t && (i.body = JSON.stringify(a)); - const o = await fetch(n, i), - l = await o.json(); - if (!o.ok) { - const t = new Error(l?.message || l.toString()); - throw ( - ((t.args = { status: o.status, statusText: o.statusText, body: l }), t) - ); - } - return l; - } - async makeRequestOnPosts(t, e, a = {}) { - return this.makeRequest(t, e, a, 'dt-posts/v2/'); - } - async getPost(t, e) { - return this.makeRequestOnPosts('GET', `${t}/${e}`); - } - async createPost(t, e) { - return this.makeRequestOnPosts('POST', t, e); - } - async updatePost(t, e, a) { - return this.makeRequestOnPosts('POST', `${t}/${e}`, a); - } - async deletePost(t, e) { - return this.makeRequestOnPosts('DELETE', `${t}/${e}`); - } - async listPostsCompact(t, e = '') { - const a = new URLSearchParams({ s: e }); - return this.makeRequestOnPosts('GET', `${t}/compact?${a}`); - } - async getPostDuplicates(t, e, a) { - return this.makeRequestOnPosts('GET', `${t}/${e}/all_duplicates`, a); - } - async getMultiSelectValues(t, e, a = '') { - const s = new URLSearchParams({ s: a, field: e }); - return this.makeRequestOnPosts('GET', `${t}/multi-select-values?${s}`); - } - async transferContact(t, e) { - return this.makeRequestOnPosts('POST', 'contacts/transfer', { - contact_id: t, - site_post_id: e, - }); - } - async transferContactSummaryUpdate(t, e) { - return this.makeRequestOnPosts( - 'POST', - 'contacts/transfer/summary/send-update', - { contact_id: t, update: e }, - ); - } - async requestRecordAccess(t, e, a) { - return this.makeRequestOnPosts('POST', `${t}/${e}/request_record_access`, { - user_id: a, - }); - } - async createComment(t, e, a, s = 'comment') { - return this.makeRequestOnPosts('POST', `${t}/${e}/comments`, { - comment: a, - comment_type: s, - }); - } - async updateComment(t, e, a, s, r = 'comment') { - return this.makeRequestOnPosts('POST', `${t}/${e}/comments/${a}`, { - comment: s, - comment_type: r, - }); - } - async deleteComment(t, e, a) { - return this.makeRequestOnPosts('DELETE', `${t}/${e}/comments/${a}`); - } - async getComments(t, e) { - return this.makeRequestOnPosts('GET', `${t}/${e}/comments`); - } - async toggle_comment_reaction(t, e, a, s, r) { - return this.makeRequestOnPosts('POST', `${t}/${e}/comments/${a}/react`, { - user_id: s, - reaction: r, - }); - } - async getPostActivity(t, e) { - return this.makeRequestOnPosts('GET', `${t}/${e}/activity`); - } - async getSingleActivity(t, e, a) { - return this.makeRequestOnPosts('GET', `${t}/${e}/activity/${a}`); - } - async revertActivity(t, e, a) { - return this.makeRequestOnPosts('GET', `${t}/${e}/revert/${a}`); - } - async getPostShares(t, e) { - return this.makeRequestOnPosts('GET', `${t}/${e}/shares`); - } - async addPostShare(t, e, a) { - return this.makeRequestOnPosts('POST', `${t}/${e}/shares`, { user_id: a }); - } - async removePostShare(t, e, a) { - return this.makeRequestOnPosts('DELETE', `${t}/${e}/shares`, { - user_id: a, - }); - } - async getFilters() { - return this.makeRequest('GET', 'users/get_filters'); - } - async saveFilters(t, e) { - return this.makeRequest('POST', 'users/save_filters', { - filter: e, - postType: t, - }); - } - async deleteFilter(t, e) { - return this.makeRequest('DELETE', 'users/save_filters', { - id: e, - postType: t, - }); - } - async searchUsers(t) { - return this.makeRequest('GET', `users/get_users?s=${t}`); - } - async createUser(t) { - return this.makeRequest('POST', 'users/create', t); - } - async advanced_search(t, e, a, s) { - return this.makeRequest( - 'GET', - 'advanced_search', - { - query: t, - postType: e, - offset: a, - post: s.post, - comment: s.comment, - meta: s.meta, - status: s.status, - }, - 'dt-posts/v2/posts/search/', - ); - } -} -!(function () { - const t = new WeakMap(), - e = new WeakMap(), - a = new WeakMap(), - s = new WeakMap(), - r = new WeakMap(), - n = new WeakMap(), - i = new WeakMap(), - o = new WeakMap(), - l = new WeakMap(), - c = new WeakMap(), - d = new WeakMap(), - u = new WeakMap(), - m = new WeakMap(), - h = { attributes: !0, attributeFilter: ['disabled'] }, - p = new MutationObserver((t) => { - for (const e of t) { - const t = e.target; - if (t.constructor.formAssociated) { - const e = t.hasAttribute('disabled'); - t.toggleAttribute('internals-disabled', e), - e - ? t.setAttribute('aria-disabled', 'true') - : t.removeAttribute('aria-disabled'), - t.formDisabledCallback && t.formDisabledCallback.apply(t, [e]); - } - } - }), - f = (t) => { - a.get(t).forEach((t) => { - t.remove(); - }), - a.set(t, []); - }, - g = (t, e) => { - const s = document.createElement('input'); - return ( - (s.type = 'hidden'), - (s.name = t.getAttribute('name')), - t.after(s), - a.get(e).push(s), - s - ); - }, - y = (t, e) => { - if (e.length) { - Array.from(e).forEach((e) => - e.addEventListener('click', t.focus.bind(t)), - ); - let a = e[0].id; - e[0].id || ((a = `${e[0].htmlFor}_Label`), (e[0].id = a)), - t.setAttribute('aria-labelledby', a); - } - }, - E = (t) => { - const e = Array.from(t.elements) - .filter((t) => t.validity) - .map((t) => t.validity.valid), - a = o.get(t) || [], - r = [ - ...e, - ...Array.from(a) - .filter((t) => t.isConnected) - .map((t) => s.get(t).validity.valid), - ].includes(!1); - t.toggleAttribute('internals-invalid', r), - t.toggleAttribute('internals-valid', !r); - }, - w = (t) => { - E(k(t.target)); - }, - b = (t) => { - E(k(t.target)); - }, - v = (t) => { - const e = o.get(t.target); - e && - e.size && - e.forEach((t) => { - t.constructor.formAssociated && - t.formResetCallback && - t.formResetCallback.apply(t); - }); - }, - T = (t, e, a) => { - if (e) { - const r = o.get(e); - if (r) r.add(t); - else { - const a = new Set(); - a.add(t), - o.set(e, a), - ((t) => { - const e = - ':is(:is(button, input)[type=submit], button:not([type])):not([disabled])'; - let a = `${e}:not([form])`; - t.id && (a += `,${e}[form='${t.id}']`), - t.addEventListener('click', (e) => { - if (e.target.closest(a)) { - const a = o.get(t); - if (t.noValidate) return; - a.size && - Array.from(a) - .reverse() - .map((t) => s.get(t).reportValidity()) - .includes(!1) && - e.preventDefault(); - } - }); - })(e), - e.addEventListener('reset', v), - e.addEventListener('input', w), - e.addEventListener('change', b); - } - n.set(e, { ref: t, internals: a }), - t.constructor.formAssociated && - t.formAssociatedCallback && - setTimeout(() => { - t.formAssociatedCallback.apply(t, [e]); - }, 0), - E(e); - } - }, - k = (t) => { - let e = t.parentNode; - return e && 'FORM' !== e.tagName && (e = k(e)), e; - }, - R = (t, e, a = DOMException) => { - if (!t.constructor.formAssociated) throw new a(e); - }, - _ = (t, e, a) => { - const r = o.get(t); - return ( - r && - r.size && - r.forEach((t) => { - s.get(t)[a]() || (e = !1); - }), - e - ); - }, - O = (t) => { - if (t.constructor.formAssociated) { - const e = s.get(t), - { labels: a, form: r } = e; - y(t, a), T(t, r, e); - } - }, - $ = { - ariaAtomic: 'aria-atomic', - ariaAutoComplete: 'aria-autocomplete', - ariaBusy: 'aria-busy', - ariaChecked: 'aria-checked', - ariaColCount: 'aria-colcount', - ariaColIndex: 'aria-colindex', - ariaColSpan: 'aria-colspan', - ariaCurrent: 'aria-current', - ariaDisabled: 'aria-disabled', - ariaExpanded: 'aria-expanded', - ariaHasPopup: 'aria-haspopup', - ariaHidden: 'aria-hidden', - ariaKeyShortcuts: 'aria-keyshortcuts', - ariaLabel: 'aria-label', - ariaLevel: 'aria-level', - ariaLive: 'aria-live', - ariaModal: 'aria-modal', - ariaMultiLine: 'aria-multiline', - ariaMultiSelectable: 'aria-multiselectable', - ariaOrientation: 'aria-orientation', - ariaPlaceholder: 'aria-placeholder', - ariaPosInSet: 'aria-posinset', - ariaPressed: 'aria-pressed', - ariaReadOnly: 'aria-readonly', - ariaRelevant: 'aria-relevant', - ariaRequired: 'aria-required', - ariaRoleDescription: 'aria-roledescription', - ariaRowCount: 'aria-rowcount', - ariaRowIndex: 'aria-rowindex', - ariaRowSpan: 'aria-rowspan', - ariaSelected: 'aria-selected', - ariaSetSize: 'aria-setsize', - ariaSort: 'aria-sort', - ariaValueMax: 'aria-valuemax', - ariaValueMin: 'aria-valuemin', - ariaValueNow: 'aria-valuenow', - ariaValueText: 'aria-valuetext', - role: 'role', - }; - class M { - constructor() { - (this.badInput = !1), - (this.customError = !1), - (this.patternMismatch = !1), - (this.rangeOverflow = !1), - (this.rangeUnderflow = !1), - (this.stepMismatch = !1), - (this.tooLong = !1), - (this.tooShort = !1), - (this.typeMismatch = !1), - (this.valid = !0), - (this.valueMissing = !1), - Object.seal(this); - } - } - const S = (t) => { - let e = !0; - for (let a in t) 'valid' !== a && !1 !== t[a] && (e = !1); - return e; - }; - function P(t) { - const e = s.get(t), - { form: a } = e; - T(t, a, e), y(t, e.labels); - } - function A(t) { - t.forEach((t) => { - const { addedNodes: e, removedNodes: r } = t, - n = Array.from(e), - l = Array.from(r); - n.forEach((t) => { - if ((s.has(t) && t.constructor.formAssociated && P(t), c.has(t))) { - const e = c.get(t); - Object.keys($) - .filter((t) => null !== e[t]) - .forEach((a) => { - t.setAttribute($[a], e[a]); - }), - c.delete(t); - } - if ('form' === t.localName) { - const e = o.get(t), - a = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, { - acceptNode: (t) => - !s.has(t) || e || e.has(t) - ? NodeFilter.FILTER_SKIP - : NodeFilter.FILTER_ACCEPT, - }); - let r = a.nextNode(); - for (; r; ) P(r), (r = a.nextNode()); - } - }), - l.forEach((t) => { - const e = s.get(t); - if ((e && a.get(e) && f(e), i.has(t))) { - i.get(t).disconnect(); - } - }); - }); - } - function L(t) { - t.forEach((t) => { - const { removedNodes: e } = t; - e.forEach((e) => { - const a = m.get(t.target); - s.has(e) && O(e), a.disconnect(); - }); - }); - } - new MutationObserver(A); - const I = { childList: !0, subtree: !0 }, - x = new WeakMap(); - class F extends Set { - static get isPolyfilled() { - return !0; - } - constructor(t) { - if ((super(), !t || !t.tagName || -1 === t.tagName.indexOf('-'))) - throw new TypeError('Illegal constructor'); - x.set(this, t); - } - add(t) { - if (!/^--/.test(t) || 'string' != typeof t) - throw new DOMException( - `Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`, - ); - const e = super.add(t), - a = x.get(this); - return ( - a.toggleAttribute(`state${t}`, !0), a.part && a.part.add(`state${t}`), e - ); - } - clear() { - for (let [t] of this.entries()) this.delete(t); - super.clear(); - } - delete(t) { - const e = super.delete(t), - a = x.get(this); - return ( - a.toggleAttribute(`state${t}`, !1), - a.part && a.part.remove(`state${t}`), - e - ); - } - } - class q { - constructor(r) { - if (!r || !r.tagName || -1 === r.tagName.indexOf('-')) - throw new TypeError('Illegal constructor'); - const n = r.getRootNode(), - i = new M(); - (this.states = new F(r)), - t.set(this, r), - e.set(this, i), - s.set(r, this), - ((t, e) => { - for (let a in $) { - e[a] = null; - let s = null; - const r = $[a]; - Object.defineProperty(e, a, { - get: () => s, - set(a) { - (s = a), t.isConnected ? t.setAttribute(r, a) : c.set(t, e); - }, - }); - } - })(r, this), - ((t, e) => { - a.set(e, []); - const s = t.hasAttribute('disabled'); - t.toggleAttribute('internals-disabled', s), p.observe(t, h); - })(r, this), - Object.seal(this), - O(r), - n instanceof DocumentFragment && - ((t) => { - const e = new MutationObserver(L); - e.observe(t, { childList: !0 }), m.set(t, e); - })(n); - } - static get isPolyfilled() { - return !0; - } - checkValidity() { - const a = t.get(this); - if ( - (R( - a, - "Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element.", - ), - !this.willValidate) - ) - return !0; - const s = e.get(this); - if (!s.valid) { - const t = new Event('invalid', { - bubbles: !1, - cancelable: !0, - composed: !1, - }); - a.dispatchEvent(t); - } - return s.valid; - } - get form() { - const e = t.get(this); - let a; - return ( - R( - e, - "Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.", - ), - !0 === e.constructor.formAssociated && (a = k(e)), - a - ); - } - get labels() { - const e = t.get(this); - R( - e, - "Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.", - ); - const a = e.getAttribute('id'), - s = e.getRootNode(); - return s && a ? s.querySelectorAll(`[for="${a}"]`) : []; - } - reportValidity() { - const e = t.get(this); - if ( - (R( - e, - "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.", - ), - !this.willValidate) - ) - return !0; - const a = this.checkValidity(), - s = u.get(this); - if (s && !e.constructor.formAssociated) - throw new DOMException( - "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.", - ); - return !a && s && (e.focus(), s.focus()), a; - } - setFormValue(e) { - const a = t.get(this); - if ( - (R( - a, - "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element.", - ), - f(this), - null == e || e instanceof FormData) - ) - null != e && - e instanceof FormData && - Array.from(e) - .reverse() - .forEach(([t, e]) => { - if ('string' == typeof e) { - const s = g(a, this); - (s.name = t), (s.value = e); - } - }); - else if (a.getAttribute('name')) { - g(a, this).value = e; - } - l.set(a, e); - } - setValidity(a, s, n) { - const i = t.get(this); - if ( - (R( - i, - "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element.", - ), - !a) - ) - throw new TypeError( - "Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.", - ); - u.set(this, n); - const o = e.get(this), - l = {}; - for (const t in a) l[t] = a[t]; - var c; - 0 === Object.keys(l).length && - (((c = o).badInput = !1), - (c.customError = !1), - (c.patternMismatch = !1), - (c.rangeOverflow = !1), - (c.rangeUnderflow = !1), - (c.stepMismatch = !1), - (c.tooLong = !1), - (c.tooShort = !1), - (c.typeMismatch = !1), - (c.valid = !0), - (c.valueMissing = !1)); - const d = { ...o, ...l }; - delete d.valid; - const { valid: m } = ((t, e, a) => ( - (t.valid = S(e)), - Object.keys(e).forEach((a) => (t[a] = e[a])), - a && E(a), - t - ))(o, d, this.form); - if (!m && !s) - throw new DOMException( - "Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.", - ); - r.set(this, m ? '' : s), - i.toggleAttribute('internals-invalid', !m), - i.toggleAttribute('internals-valid', m), - i.setAttribute('aria-invalid', `${!m}`); - } - get shadowRoot() { - const e = t.get(this), - a = d.get(e); - return a || null; - } - get validationMessage() { - const e = t.get(this); - return ( - R( - e, - "Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element.", - ), - r.get(this) - ); - } - get validity() { - const a = t.get(this); - R( - a, - "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element.", - ); - return e.get(this); - } - get willValidate() { - const e = t.get(this); - return ( - R( - e, - "Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element.", - ), - !( - e.disabled || - e.hasAttribute('disabled') || - e.hasAttribute('readonly') - ) - ); - } - } - if ( - (function () { - if (!window.ElementInternals || !HTMLElement.prototype.attachInternals) - return !1; - class t extends HTMLElement { - constructor() { - super(), (this.internals = this.attachInternals()); - } - } - const e = `element-internals-feature-detection-${Math.random() - .toString(36) - .replace(/[^a-z]+/g, '')}`; - customElements.define(e, t); - const a = new t(); - return [ - 'shadowRoot', - 'form', - 'willValidate', - 'validity', - 'validationMessage', - 'labels', - 'setFormValue', - 'setValidity', - 'checkValidity', - 'reportValidity', - ].every((t) => t in a.internals); - })() - ) { - if (!window.CustomStateSet) { - window.CustomStateSet = F; - const t = HTMLElement.prototype.attachInternals; - HTMLElement.prototype.attachInternals = function (...e) { - const a = t.call(this, e); - return (a.states = new F(this)), a; - }; - } - } else { - (window.ElementInternals = q), - (HTMLElement.prototype.attachInternals = function () { - if (!this.tagName) return {}; - if (-1 === this.tagName.indexOf('-')) - throw new Error( - "Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.", - ); - if (s.has(this)) - throw new DOMException( - "DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.", - ); - return new q(this); - }); - const t = Element.prototype.attachShadow; - Element.prototype.attachShadow = function (...e) { - const a = t.apply(this, e), - s = new MutationObserver(A); - return ( - d.set(this, a), - window.ShadyDOM ? s.observe(this, I) : s.observe(a, I), - i.set(this, s), - a - ); - }; - new MutationObserver(A).observe(document.documentElement, I); - const e = HTMLFormElement.prototype.checkValidity; - HTMLFormElement.prototype.checkValidity = function (...t) { - let a = e.apply(this, t); - return _(this, a, 'checkValidity'); - }; - const a = HTMLFormElement.prototype.reportValidity; - (HTMLFormElement.prototype.reportValidity = function (...t) { - let e = a.apply(this, t); - return _(this, e, 'reportValidity'); - }), - window.CustomStateSet || (window.CustomStateSet = F); - } -})(); -class c extends t { - static get properties() { - return { - RTL: { type: String }, - locale: { type: String }, - apiRoot: { type: String, reflect: !1 }, - postType: { type: String, reflect: !1 }, - postID: { type: String, reflect: !1 }, - }; - } - get _focusTarget() { - return this.shadowRoot.children[0] instanceof Element - ? this.shadowRoot.children[0] - : null; - } - constructor() { - super(), - r(this), - this.addEventListener('focus', this._proxyFocus.bind(this)); - } - connectedCallback() { - super.connectedCallback(), - (this.apiRoot = this.apiRoot - ? `${this.apiRoot}/`.replace('//', '/') - : '/'), - (this.api = new l(this.nonce, this.apiRoot)); - } - willUpdate(t) { - if (void 0 === this.RTL) { - const t = this.closest('[dir]'); - if (t) { - const e = t.getAttribute('dir'); - e && (this.RTL = 'rtl' === e.toLowerCase()); - } - } - if (!this.locale) { - const t = this.closest('[lang]'); - if (t) { - const e = t.getAttribute('lang'); - e && (this.locale = e); - } - } - if (t && t.has('locale') && this.locale) - try { - o(this.locale); - } catch (t) { - console.error(t); - } - } - _proxyFocus() { - this._focusTarget && this._focusTarget.focus(); - } -} -export { l as A, c as D }; + */class s{constructor(t){this.__litLocalizeEventHandler=t=>{"ready"===t.detail.status&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(e,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(e,this.__litLocalizeEventHandler)}}const r=t=>t.addController(new s(t)),n=["am_ET","ar","ar_MA","bg_BG","bn_BD","bs_BA","cs","de_DE","el","en_US","es_419","es_ES","fa_IR","fr_FR","hi_IN","hr","hu_HU","id_ID","it_IT","ja","ko_KR","mk_MK","mr","my_MM","ne_NP","nl_NL","pa_IN","pl","pt_BR","ro_RO","ru_RU","sl_SI","sr_BA","sw","th","tl","tr_TR","uk","vi","zh_CN","zh_TW"],{getLocale:i,setLocale:o}=a({sourceLocale:"en",targetLocales:n,loadLocale:t=>import(`./generated/${t}.js`)});class l{constructor(t,e="wp-json"){this.nonce=t,this.apiRoot=e.endsWith("/")?`${e}`:`${e} + "/"`,this.apiRoot=`/${e}/`.replace(/\/\//g,"/")}async makeRequest(t,e,a,s="dt/v1/"){let r=s;r.endsWith("/")||e.startsWith("/")||(r+="/");const n=e.startsWith("http")?e:`${this.apiRoot}${r}${e}`,i={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":this.nonce}};"GET"!==t&&(i.body=JSON.stringify(a));const o=await fetch(n,i),l=await o.json();if(!o.ok){const t=new Error(l?.message||l.toString());throw t.args={status:o.status,statusText:o.statusText,body:l},t}return l}async makeRequestOnPosts(t,e,a={}){return this.makeRequest(t,e,a,"dt-posts/v2/")}async getPost(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}`)}async createPost(t,e){return this.makeRequestOnPosts("POST",t,e)}async updatePost(t,e,a){return this.makeRequestOnPosts("POST",`${t}/${e}`,a)}async deletePost(t,e){return this.makeRequestOnPosts("DELETE",`${t}/${e}`)}async listPostsCompact(t,e=""){const a=new URLSearchParams({s:e});return this.makeRequestOnPosts("GET",`${t}/compact?${a}`)}async getPostDuplicates(t,e,a){return this.makeRequestOnPosts("GET",`${t}/${e}/all_duplicates`,a)}async getMultiSelectValues(t,e,a=""){const s=new URLSearchParams({s:a,field:e});return this.makeRequestOnPosts("GET",`${t}/multi-select-values?${s}`)}async transferContact(t,e){return this.makeRequestOnPosts("POST","contacts/transfer",{contact_id:t,site_post_id:e})}async transferContactSummaryUpdate(t,e){return this.makeRequestOnPosts("POST","contacts/transfer/summary/send-update",{contact_id:t,update:e})}async requestRecordAccess(t,e,a){return this.makeRequestOnPosts("POST",`${t}/${e}/request_record_access`,{user_id:a})}async createComment(t,e,a,s="comment"){return this.makeRequestOnPosts("POST",`${t}/${e}/comments`,{comment:a,comment_type:s})}async updateComment(t,e,a,s,r="comment"){return this.makeRequestOnPosts("POST",`${t}/${e}/comments/${a}`,{comment:s,comment_type:r})}async deleteComment(t,e,a){return this.makeRequestOnPosts("DELETE",`${t}/${e}/comments/${a}`)}async getComments(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}/comments`)}async toggle_comment_reaction(t,e,a,s,r){return this.makeRequestOnPosts("POST",`${t}/${e}/comments/${a}/react`,{user_id:s,reaction:r})}async getPostActivity(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}/activity`)}async getSingleActivity(t,e,a){return this.makeRequestOnPosts("GET",`${t}/${e}/activity/${a}`)}async revertActivity(t,e,a){return this.makeRequestOnPosts("GET",`${t}/${e}/revert/${a}`)}async getPostShares(t,e){return this.makeRequestOnPosts("GET",`${t}/${e}/shares`)}async addPostShare(t,e,a){return this.makeRequestOnPosts("POST",`${t}/${e}/shares`,{user_id:a})}async removePostShare(t,e,a){return this.makeRequestOnPosts("DELETE",`${t}/${e}/shares`,{user_id:a})}async getFilters(){return this.makeRequest("GET","users/get_filters")}async saveFilters(t,e){return this.makeRequest("POST","users/save_filters",{filter:e,postType:t})}async deleteFilter(t,e){return this.makeRequest("DELETE","users/save_filters",{id:e,postType:t})}async searchUsers(t){return this.makeRequest("GET",`users/get_users?s=${t}`)}async createUser(t){return this.makeRequest("POST","users/create",t)}async advanced_search(t,e,a,s){return this.makeRequest("GET","advanced_search",{query:t,postType:e,offset:a,post:s.post,comment:s.comment,meta:s.meta,status:s.status},"dt-posts/v2/posts/search/")}}!function(){const t=new WeakMap,e=new WeakMap,a=new WeakMap,s=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,l=new WeakMap,c=new WeakMap,d=new WeakMap,u=new WeakMap,m=new WeakMap,h={attributes:!0,attributeFilter:["disabled"]},p=new MutationObserver((t=>{for(const e of t){const t=e.target;if(t.constructor.formAssociated){const e=t.hasAttribute("disabled");t.toggleAttribute("internals-disabled",e),e?t.setAttribute("aria-disabled","true"):t.removeAttribute("aria-disabled"),t.formDisabledCallback&&t.formDisabledCallback.apply(t,[e])}}})),f=t=>{a.get(t).forEach((t=>{t.remove()})),a.set(t,[])},g=(t,e)=>{const s=document.createElement("input");return s.type="hidden",s.name=t.getAttribute("name"),t.after(s),a.get(e).push(s),s},y=(t,e)=>{if(e.length){Array.from(e).forEach((e=>e.addEventListener("click",t.focus.bind(t))));let a=e[0].id;e[0].id||(a=`${e[0].htmlFor}_Label`,e[0].id=a),t.setAttribute("aria-labelledby",a)}},E=t=>{const e=Array.from(t.elements).filter((t=>t.validity)).map((t=>t.validity.valid)),a=o.get(t)||[],r=[...e,...Array.from(a).filter((t=>t.isConnected)).map((t=>s.get(t).validity.valid))].includes(!1);t.toggleAttribute("internals-invalid",r),t.toggleAttribute("internals-valid",!r)},w=t=>{E(k(t.target))},b=t=>{E(k(t.target))},v=t=>{const e=o.get(t.target);e&&e.size&&e.forEach((t=>{t.constructor.formAssociated&&t.formResetCallback&&t.formResetCallback.apply(t)}))},T=(t,e,a)=>{if(e){const r=o.get(e);if(r)r.add(t);else{const a=new Set;a.add(t),o.set(e,a),(t=>{const e=":is(:is(button, input)[type=submit], button:not([type])):not([disabled])";let a=`${e}:not([form])`;t.id&&(a+=`,${e}[form='${t.id}']`),t.addEventListener("click",(e=>{if(e.target.closest(a)){const a=o.get(t);if(t.noValidate)return;a.size&&Array.from(a).reverse().map((t=>s.get(t).reportValidity())).includes(!1)&&e.preventDefault()}}))})(e),e.addEventListener("reset",v),e.addEventListener("input",w),e.addEventListener("change",b)}n.set(e,{ref:t,internals:a}),t.constructor.formAssociated&&t.formAssociatedCallback&&setTimeout((()=>{t.formAssociatedCallback.apply(t,[e])}),0),E(e)}},k=t=>{let e=t.parentNode;return e&&"FORM"!==e.tagName&&(e=k(e)),e},R=(t,e,a=DOMException)=>{if(!t.constructor.formAssociated)throw new a(e)},_=(t,e,a)=>{const r=o.get(t);return r&&r.size&&r.forEach((t=>{s.get(t)[a]()||(e=!1)})),e},O=t=>{if(t.constructor.formAssociated){const e=s.get(t),{labels:a,form:r}=e;y(t,a),T(t,r,e)}},$={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"};class M{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const S=t=>{let e=!0;for(let a in t)"valid"!==a&&!1!==t[a]&&(e=!1);return e};function P(t){const e=s.get(t),{form:a}=e;T(t,a,e),y(t,e.labels)}function A(t){t.forEach((t=>{const{addedNodes:e,removedNodes:r}=t,n=Array.from(e),l=Array.from(r);n.forEach((t=>{if(s.has(t)&&t.constructor.formAssociated&&P(t),c.has(t)){const e=c.get(t);Object.keys($).filter((t=>null!==e[t])).forEach((a=>{t.setAttribute($[a],e[a])})),c.delete(t)}if("form"===t.localName){const e=o.get(t),a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:t=>!s.has(t)||e||e.has(t)?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT});let r=a.nextNode();for(;r;)P(r),r=a.nextNode()}})),l.forEach((t=>{const e=s.get(t);if(e&&a.get(e)&&f(e),i.has(t)){i.get(t).disconnect()}}))}))}function L(t){t.forEach((t=>{const{removedNodes:e}=t;e.forEach((e=>{const a=m.get(t.target);s.has(e)&&O(e),a.disconnect()}))}))}new MutationObserver(A);const I={childList:!0,subtree:!0},x=new WeakMap;class F extends Set{static get isPolyfilled(){return!0}constructor(t){if(super(),!t||!t.tagName||-1===t.tagName.indexOf("-"))throw new TypeError("Illegal constructor");x.set(this,t)}add(t){if(!/^--/.test(t)||"string"!=typeof t)throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);const e=super.add(t),a=x.get(this);return a.toggleAttribute(`state${t}`,!0),a.part&&a.part.add(`state${t}`),e}clear(){for(let[t]of this.entries())this.delete(t);super.clear()}delete(t){const e=super.delete(t),a=x.get(this);return a.toggleAttribute(`state${t}`,!1),a.part&&a.part.remove(`state${t}`),e}}class q{constructor(r){if(!r||!r.tagName||-1===r.tagName.indexOf("-"))throw new TypeError("Illegal constructor");const n=r.getRootNode(),i=new M;this.states=new F(r),t.set(this,r),e.set(this,i),s.set(r,this),((t,e)=>{for(let a in $){e[a]=null;let s=null;const r=$[a];Object.defineProperty(e,a,{get:()=>s,set(a){s=a,t.isConnected?t.setAttribute(r,a):c.set(t,e)}})}})(r,this),((t,e)=>{a.set(e,[]);const s=t.hasAttribute("disabled");t.toggleAttribute("internals-disabled",s),p.observe(t,h)})(r,this),Object.seal(this),O(r),n instanceof DocumentFragment&&(t=>{const e=new MutationObserver(L);e.observe(t,{childList:!0}),m.set(t,e)})(n)}static get isPolyfilled(){return!0}checkValidity(){const a=t.get(this);if(R(a,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const s=e.get(this);if(!s.valid){const t=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});a.dispatchEvent(t)}return s.valid}get form(){const e=t.get(this);let a;return R(e,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element."),!0===e.constructor.formAssociated&&(a=k(e)),a}get labels(){const e=t.get(this);R(e,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const a=e.getAttribute("id"),s=e.getRootNode();return s&&a?s.querySelectorAll(`[for="${a}"]`):[]}reportValidity(){const e=t.get(this);if(R(e,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const a=this.checkValidity(),s=u.get(this);if(s&&!e.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!a&&s&&(e.focus(),s.focus()),a}setFormValue(e){const a=t.get(this);if(R(a,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),f(this),null==e||e instanceof FormData)null!=e&&e instanceof FormData&&Array.from(e).reverse().forEach((([t,e])=>{if("string"==typeof e){const s=g(a,this);s.name=t,s.value=e}}));else if(a.getAttribute("name")){g(a,this).value=e}l.set(a,e)}setValidity(a,s,n){const i=t.get(this);if(R(i,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!a)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");u.set(this,n);const o=e.get(this),l={};for(const t in a)l[t]=a[t];var c;0===Object.keys(l).length&&((c=o).badInput=!1,c.customError=!1,c.patternMismatch=!1,c.rangeOverflow=!1,c.rangeUnderflow=!1,c.stepMismatch=!1,c.tooLong=!1,c.tooShort=!1,c.typeMismatch=!1,c.valid=!0,c.valueMissing=!1);const d={...o,...l};delete d.valid;const{valid:m}=((t,e,a)=>(t.valid=S(e),Object.keys(e).forEach((a=>t[a]=e[a])),a&&E(a),t))(o,d,this.form);if(!m&&!s)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");r.set(this,m?"":s),i.toggleAttribute("internals-invalid",!m),i.toggleAttribute("internals-valid",m),i.setAttribute("aria-invalid",`${!m}`)}get shadowRoot(){const e=t.get(this),a=d.get(e);return a||null}get validationMessage(){const e=t.get(this);return R(e,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),r.get(this)}get validity(){const a=t.get(this);R(a,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element.");return e.get(this)}get willValidate(){const e=t.get(this);return R(e,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(e.disabled||e.hasAttribute("disabled")||e.hasAttribute("readonly"))}}if(function(){if(!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class t extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const e=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(e,t);const a=new t;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every((t=>t in a.internals))}()){if(!window.CustomStateSet){window.CustomStateSet=F;const t=HTMLElement.prototype.attachInternals;HTMLElement.prototype.attachInternals=function(...e){const a=t.call(this,e);return a.states=new F(this),a}}}else{window.ElementInternals=q,HTMLElement.prototype.attachInternals=function(){if(!this.tagName)return{};if(-1===this.tagName.indexOf("-"))throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.");if(s.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new q(this)};const t=Element.prototype.attachShadow;Element.prototype.attachShadow=function(...e){const a=t.apply(this,e),s=new MutationObserver(A);return d.set(this,a),window.ShadyDOM?s.observe(this,I):s.observe(a,I),i.set(this,s),a};new MutationObserver(A).observe(document.documentElement,I);const e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=function(...t){let a=e.apply(this,t);return _(this,a,"checkValidity")};const a=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=function(...t){let e=a.apply(this,t);return _(this,e,"reportValidity")},window.CustomStateSet||(window.CustomStateSet=F)}}();class c extends t{static get properties(){return{RTL:{type:String},locale:{type:String},apiRoot:{type:String,reflect:!1},postType:{type:String,reflect:!1},postID:{type:String,reflect:!1}}}get _focusTarget(){return this.shadowRoot.children[0]instanceof Element?this.shadowRoot.children[0]:null}constructor(){super(),r(this),this.addEventListener("focus",this._proxyFocus.bind(this))}connectedCallback(){super.connectedCallback(),this.apiRoot=this.apiRoot?`${this.apiRoot}/`.replace("//","/"):"/",this.api=new l(this.nonce,this.apiRoot)}willUpdate(t){if(void 0===this.RTL){const t=this.closest("[dir]");if(t){const e=t.getAttribute("dir");e&&(this.RTL="rtl"===e.toLowerCase())}}if(!this.locale){const t=this.closest("[lang]");if(t){const e=t.getAttribute("lang");e&&(this.locale=e)}}if(t&&t.has("locale")&&this.locale)try{o(this.locale)}catch(t){console.error(t)}}_proxyFocus(){this._focusTarget&&this._focusTarget.focus()}}export{l as A,c as D}; //# sourceMappingURL=dt-base.js.map diff --git a/dt-assets/build/components/form/dt-button/dt-button.js b/dt-assets/build/components/form/dt-button/dt-button.js index d49e65896e..2247ecfafb 100644 --- a/dt-assets/build/components/form/dt-button/dt-button.js +++ b/dt-assets/build/components/form/dt-button/dt-button.js @@ -1,56 +1,2 @@ -import { i as t, y as o } from '../../lit-element-2409d5fe.js'; -import { o as n } from '../../class-map-8d921948.js'; -import { D as r } from '../../dt-base.js'; -import '../../directive-de55b00a.js'; -import '../../lit-localize-763e4978.js'; -window.customElements.define( - 'dt-button', - class extends r { - static get styles() { - return t`:host{display:inline-flex;width:fit-content;height:fit-content}.dt-button{cursor:pointer;display:flex;padding:var(--dt-button-padding-y,10px) var(--dt-button-padding-x,10px);font-family:var(--dt-button-font-family);font-size:var(--dt-button-font-size,14px);line-height:var(--dt-button-line-height,inherit);font-weight:var(--dt-button-font-weight,700);background-color:var(--dt-button-context-background-color,var(--dt-button-background-color));border:var(--dt-button-border-width,1px) solid var(--dt-button-context-border-color,var(--dt-button-border-color));border-radius:var(--dt-button-border-radius,10px);box-shadow:var(--dt-button-box-shadow,--dt-button-context-box-shadow(0 2px 4px rgb(0 0 0 / 25%)));color:var(--dt-button-context-text-color,var(--dt-button-text-color));text-rendering:optimizeLegibility;gap:var(--dt-button-gap,10px);justify-content:var(--dt-button-justify-content,center);align-content:var(--dt-button-align-content,center);align-items:var(--dt-button-align-items,center);text-decoration:var(--dt-button-text-decoration,var(--dt-button-context-text-decoration,none));text-transform:var(--dt-button-text-transform,none);letter-spacing:var(--dt-button-letter-spacing,normal);width:var(--dt-button-width,100%);height:var(--dt-button-height,auto);aspect-ratio:var(--dt-button-aspect-ratio,auto);position:relative}.dt-button.dt-button--outline{background-color:transparent;color:var(--dt-button-context-text-color,var(--text-color-inverse))}.dt-button--primary:not(.dt-button--outline){--dt-button-context-border-color:var(--primary-color);--dt-button-context-background-color:var(--primary-color);--dt-button-context-text-color:var(--dt-button-text-color-light)}.dt-button--link:not(.dt-button--outline){--dt-button-context-text-decoration:underline;--dt-button-context-box-shadow:none;--dt-button-context-border-color:transparent;--dt-button-context-background-color:transparent;--dt-button-context-text-color:var(--dt-button-text-color-dark)}.dt-button--alert:not(.dt-button--outline){--dt-button-context-border-color:var(--alert-color);--dt-button-context-background-color:var(--alert-color);--dt-button-context-text-color:var(--dt-button-text-color-light)}.dt-button--caution:not(.dt-button--outline){--dt-button-context-border-color:var(--caution-color);--dt-button-context-background-color:var(--caution-color);--dt-button-context-text-color:var(--dt-button-text-color-dark)}.dt-button--success:not(.dt-button--outline){--dt-button-context-border-color:var(--success-color);--dt-button-context-background-color:var(--success-color);--dt-button-context-text-color:var(--dt-button-text-color-light)}.dt-button--inactive:not(.dt-button--outline){--dt-button-context-border-color:var(--inactive-color);--dt-button-context-background-color:var(--inactive-color);--dt-button-context-text-color:var(--dt-button-text-color-light)}.dt-button--disabled:not(.dt-button--outline){--dt-button-context-border-color:var(--disabled-color);--dt-button-context-background-color:var(--disabled-color);--dt-button-context-text-color:var(--dt-button-text-color-dark)}.dt-button--primary.dt-button--outline{--dt-button-context-border-color:var(--primary-color);--dt-button-context-text-color:var(--primary-color)}.dt-button--alert.dt-button--outline{--dt-button-context-border-color:var(--alert-color);--dt-button-context-text-color:var(--alert-color)}.dt-button--caution.dt-button--outline{--dt-button-context-border-color:var(--caution-color);--dt-button-context-text-color:var(--caution-color)}.dt-button--success.dt-button--outline{--dt-button-context-border-color:var(--success-color);--dt-button-context-text-color:var(--success-color)}.dt-button--inactive.dt-button--outline{--dt-button-context-border-color:var(--inactive-color)}.dt-button--disabled.dt-button--outline{--dt-button-context-border-color:var(--disabled-color)}.dt-button.dt-button--rounded{--dt-button-border-radius:50%;--dt-button-padding-x:0px;--dt-button-padding-y:0px;--dt-button-aspect-ratio:var(--dt-button-rounded-aspect-ratio, 1/1)}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none;color:inherit;cursor:pointer;display:flex;align-items:center}`; - } - static get properties() { - return { - context: { type: String }, - type: { type: String }, - outline: { type: Boolean }, - href: { type: String }, - title: { type: String }, - onClick: { type: Function }, - rounded: { type: Boolean }, - confirm: { type: String }, - }; - } - get classes() { - const t = { - 'dt-button': !0, - 'dt-button--outline': this.outline, - 'dt-button--rounded': this.rounded, - }; - return (t[`dt-button--${this.context}`] = !0), t; - } - constructor() { - super(), (this.context = 'default'); - } - handleClick(t) { - if (!this.confirm || confirm(this.confirm)) - if (this.onClick) t.preventDefault(), this.onClick(t); - else { - const t = this.closest('form'); - t && t.submit(); - } - else t.preventDefault(); - } - _dismiss() { - this.hide = !0; - } - render() { - return this.hide - ? o`` - : this.href - ? o`
    ` - : o``; - } - }, -); +import{i as t,y as o}from"../../lit-element-2409d5fe.js";import{o as n}from"../../class-map-8d921948.js";import{D as r}from"../../dt-base.js";import"../../directive-de55b00a.js";import"../../lit-localize-763e4978.js";window.customElements.define("dt-button",class extends r{static get styles(){return t`:host{display:inline-flex;width:fit-content;height:fit-content}.dt-button{cursor:pointer;display:flex;padding:var(--dt-button-padding-y,10px) var(--dt-button-padding-x,10px);font-family:var(--dt-button-font-family);font-size:var(--dt-button-font-size,14px);line-height:var(--dt-button-line-height,inherit);font-weight:var(--dt-button-font-weight,700);background-color:var(--dt-button-context-background-color,var(--dt-button-background-color));border:var(--dt-button-border-width,1px) solid var(--dt-button-context-border-color,var(--dt-button-border-color));border-radius:var(--dt-button-border-radius,10px);box-shadow:var(--dt-button-box-shadow,--dt-button-context-box-shadow(0 2px 4px rgb(0 0 0 / 25%)));color:var(--dt-button-context-text-color,var(--dt-button-text-color));text-rendering:optimizeLegibility;gap:var(--dt-button-gap,10px);justify-content:var(--dt-button-justify-content,center);align-content:var(--dt-button-align-content,center);align-items:var(--dt-button-align-items,center);text-decoration:var(--dt-button-text-decoration,var(--dt-button-context-text-decoration,none));text-transform:var(--dt-button-text-transform,none);letter-spacing:var(--dt-button-letter-spacing,normal);width:var(--dt-button-width,100%);height:var(--dt-button-height,auto);aspect-ratio:var(--dt-button-aspect-ratio,auto);position:relative}.dt-button.dt-button--outline{background-color:transparent;color:var(--dt-button-context-text-color,var(--text-color-inverse))}.dt-button--primary:not(.dt-button--outline){--dt-button-context-border-color:var(--primary-color);--dt-button-context-background-color:var(--primary-color);--dt-button-context-text-color:var(--dt-button-text-color-light)}.dt-button--link:not(.dt-button--outline){--dt-button-context-text-decoration:underline;--dt-button-context-box-shadow:none;--dt-button-context-border-color:transparent;--dt-button-context-background-color:transparent;--dt-button-context-text-color:var(--dt-button-text-color-dark)}.dt-button--alert:not(.dt-button--outline){--dt-button-context-border-color:var(--alert-color);--dt-button-context-background-color:var(--alert-color);--dt-button-context-text-color:var(--dt-button-text-color-light)}.dt-button--caution:not(.dt-button--outline){--dt-button-context-border-color:var(--caution-color);--dt-button-context-background-color:var(--caution-color);--dt-button-context-text-color:var(--dt-button-text-color-dark)}.dt-button--success:not(.dt-button--outline){--dt-button-context-border-color:var(--success-color);--dt-button-context-background-color:var(--success-color);--dt-button-context-text-color:var(--dt-button-text-color-light)}.dt-button--inactive:not(.dt-button--outline){--dt-button-context-border-color:var(--inactive-color);--dt-button-context-background-color:var(--inactive-color);--dt-button-context-text-color:var(--dt-button-text-color-light)}.dt-button--disabled:not(.dt-button--outline){--dt-button-context-border-color:var(--disabled-color);--dt-button-context-background-color:var(--disabled-color);--dt-button-context-text-color:var(--dt-button-text-color-dark)}.dt-button--primary.dt-button--outline{--dt-button-context-border-color:var(--primary-color);--dt-button-context-text-color:var(--primary-color)}.dt-button--alert.dt-button--outline{--dt-button-context-border-color:var(--alert-color);--dt-button-context-text-color:var(--alert-color)}.dt-button--caution.dt-button--outline{--dt-button-context-border-color:var(--caution-color);--dt-button-context-text-color:var(--caution-color)}.dt-button--success.dt-button--outline{--dt-button-context-border-color:var(--success-color);--dt-button-context-text-color:var(--success-color)}.dt-button--inactive.dt-button--outline{--dt-button-context-border-color:var(--inactive-color)}.dt-button--disabled.dt-button--outline{--dt-button-context-border-color:var(--disabled-color)}.dt-button.dt-button--rounded{--dt-button-border-radius:50%;--dt-button-padding-x:0px;--dt-button-padding-y:0px;--dt-button-aspect-ratio:var(--dt-button-rounded-aspect-ratio, 1/1)}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none;color:inherit;cursor:pointer;display:flex;align-items:center}`}static get properties(){return{context:{type:String},type:{type:String},outline:{type:Boolean},href:{type:String},title:{type:String},onClick:{type:Function},rounded:{type:Boolean},confirm:{type:String}}}get classes(){const t={"dt-button":!0,"dt-button--outline":this.outline,"dt-button--rounded":this.rounded};return t[`dt-button--${this.context}`]=!0,t}constructor(){super(),this.context="default"}handleClick(t){if(!this.confirm||confirm(this.confirm))if(this.onClick)t.preventDefault(),this.onClick(t);else{const t=this.closest("form");t&&t.submit()}else t.preventDefault()}_dismiss(){this.hide=!0}render(){return this.hide?o``:this.href?o`
    `:o``}}); //# sourceMappingURL=dt-button.js.map diff --git a/dt-assets/build/components/form/dt-church-health-circle/dt-church-health-circle-icon.js b/dt-assets/build/components/form/dt-church-health-circle/dt-church-health-circle-icon.js index 813c45d387..a0358a4fc8 100644 --- a/dt-assets/build/components/form/dt-church-health-circle/dt-church-health-circle-icon.js +++ b/dt-assets/build/components/form/dt-church-health-circle/dt-church-health-circle-icon.js @@ -1,49 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { o as i } from '../../class-map-8d921948.js'; -import { D as s } from '../../dt-base.js'; -import '../../directive-de55b00a.js'; -import '../../lit-localize-763e4978.js'; -window.customElements.define( - 'dt-church-health-icon', - class extends s { - static get styles() { - return t`root{display:block}.health-item img{width:var(--d);height:var(--d);filter:grayscale(1) opacity(.75)}.health-item--active img{filter:none!important}`; - } - static get properties() { - return { - key: { type: String }, - metric: { type: Object }, - group: { type: Object }, - active: { type: Boolean, reflect: !0 }, - missingIcon: { type: String }, - handleSave: { type: Function }, - }; - } - render() { - const { - metric: t, - active: s, - missingIcon: - r = `${window.wpApiShare.template_dir}/dt-assets/images/groups/missing.svg`, - } = this; - return e`
    `; - } - async _handleClick() { - if (!this.handleSave) return; - const t = !this.active; - this.active = t; - const e = { - health_metrics: { values: [{ value: this.key, delete: !t }] }, - }; - try { - await this.handleSave(this.group.ID, e); - } catch (t) { - return void console.error(t); - } - t - ? this.group.health_metrics.push(this.key) - : this.group.health_metrics.pop(this.key); - } - }, -); +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{o as i}from"../../class-map-8d921948.js";import{D as s}from"../../dt-base.js";import"../../directive-de55b00a.js";import"../../lit-localize-763e4978.js";window.customElements.define("dt-church-health-icon",class extends s{static get styles(){return t`root{display:block}.health-item img{width:var(--d);height:var(--d);filter:grayscale(1) opacity(.75)}.health-item--active img{filter:none!important}`}static get properties(){return{key:{type:String},metric:{type:Object},group:{type:Object},active:{type:Boolean,reflect:!0},missingIcon:{type:String},handleSave:{type:Function}}}render(){const{metric:t,active:s,missingIcon:r=`${window.wpApiShare.template_dir}/dt-assets/images/groups/missing.svg`}=this;return e`
    `}async _handleClick(){if(!this.handleSave)return;const t=!this.active;this.active=t;const e={health_metrics:{values:[{value:this.key,delete:!t}]}};try{await this.handleSave(this.group.ID,e)}catch(t){return void console.error(t)}t?this.group.health_metrics.push(this.key):this.group.health_metrics.pop(this.key)}}); //# sourceMappingURL=dt-church-health-circle-icon.js.map diff --git a/dt-assets/build/components/form/dt-church-health-circle/dt-church-health-circle.js b/dt-assets/build/components/form/dt-church-health-circle/dt-church-health-circle.js index cbdff9101d..9d3f64cb05 100644 --- a/dt-assets/build/components/form/dt-church-health-circle/dt-church-health-circle.js +++ b/dt-assets/build/components/form/dt-church-health-circle/dt-church-health-circle.js @@ -1,117 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { o as i } from '../../class-map-8d921948.js'; -import { D as r } from '../../dt-base.js'; -import './dt-church-health-circle-icon.js'; -import '../../directive-de55b00a.js'; -import '../../lit-localize-763e4978.js'; -window.customElements.define( - 'dt-church-health-circle', - class extends r { - static get styles() { - return t`.health-circle__container{--d:55px;--rel:1;--r:calc(1 * var(--d) / var(--tan));--s:calc(3 * var(--r));margin:1rem auto;display:flex;justify-content:center;align-items:baseline;padding-top:100%;height:0;position:relative;overflow:visible}.health-circle{display:block;border-radius:100%;border:3px #a9a9a9 dashed;max-width:100%;position:absolute;transform:translate(-50%,-50%);left:50%;top:50%;width:100%;height:100%}@media (max-width:519px){.health-circle__container{--d:40px}.health-circle{max-width:300px;max-height:300px}}@media (max-width:400px){.health-circle__container{--d:30px}.health-circle{max-width:250px;max-height:250px}}@media (max-width:321px){.health-circle__container{--d:25px}.health-circle{max-width:225px;max-height:225px}}.health-circle__grid{display:inline-block;position:relative;height:100%;width:100%;margin-left:auto;margin-right:auto;position:relative;width:var(--s);max-width:100%}.health-circle--committed{border:3px #4caf50 solid!important}dt-church-health-icon{position:absolute;border-radius:100%;font-size:16px;color:#000;text-align:center;font-style:italic;cursor:pointer;top:50%;left:50%;margin:calc(-.5 * var(--d));width:var(--d);height:var(--d);--az:calc(var(--i) * 1turn / var(--m));transform:rotate(var(--az)) translate(var(--r)) rotate(calc(-1 * var(--az)))}`; - } - static get properties() { - return { - groupId: { type: Number }, - group: { type: Object, reflect: !1 }, - settings: { type: Object, reflect: !1 }, - errorMessage: { type: String, attribute: !1 }, - missingIcon: { type: String }, - handleSave: { type: Function }, - }; - } - get metrics() { - const t = this.settings || []; - if (!Object.values(t).length) return []; - return Object.entries(t).filter(([t, e]) => 'church_commitment' !== t); - } - get isCommited() { - return ( - !!this.group && - !!this.group.health_metrics && - this.group.health_metrics.includes('church_commitment') - ); - } - connectedCallback() { - super.connectedCallback(), this.fetch(); - } - adoptedCallback() { - this.distributeItems(); - } - updated() { - this.distributeItems(); - } - async fetch() { - try { - const t = [this.fetchSettings(), this.fetchGroup()]; - let [e, i] = await Promise.all(t); - (this.settings = e), - (this.post = i), - e || (this.errorMessage = 'Error loading settings'), - i || (this.errorMessage = 'Error loading group'); - } catch (t) { - console.error(t); - } - } - fetchGroup() { - if (this.group) return Promise.resolve(this.group); - fetch(`/wp-json/dt-posts/v2/groups/${this.groupId}`).then((t) => - t.json(), - ); - } - fetchSettings() { - return this.settings - ? Promise.resolve(this.settings) - : fetch('/wp-json/dt-posts/v2/groups/settings').then((t) => t.json()); - } - findMetric(t) { - const e = this.metrics.find((e) => e.key === t); - return e ? e.value : null; - } - render() { - if (!this.group || !this.metrics.length) - return e``; - const t = this.group.health_metrics || []; - return ( - this.errorMessage && - e`${this.errorMessage}`, - e`
    ${this.metrics.map(([i, r], s) => e``)}
    ` - ); - } - distributeItems() { - const t = this.renderRoot.querySelector('.health-circle__container'); - let e = t.querySelectorAll('dt-church-health-icon').length, - i = Math.tan(Math.PI / e); - t.style.setProperty('--m', e), - t.style.setProperty('--tan', +i.toFixed(2)); - } - async toggleClick(t) { - const { handleSave: e } = this; - if (!e) return; - let i = this.renderRoot.querySelector('dt-toggle'), - r = i.toggleAttribute('checked'); - this.group.health_metrics || (this.group.health_metrics = []); - const s = { - health_metrics: { - values: [{ value: 'church_commitment', delete: !r }], - }, - }; - try { - await e(this.group.ID, s); - } catch (t) { - return i.toggleAttribute('checked', !r), void console.error(t); - } - r - ? this.group.health_metrics.push('church_commitment') - : this.group.health_metrics.pop('church_commitment'), - this.requestUpdate(); - } - _isChecked() { - return Object.hasOwn(this.group, 'health_metrics') && - this.group.health_metrics.includes('church_commitment') - ? (this.isChurch = !0) - : (this.isChurch = !1); - } - }, -); +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{o as i}from"../../class-map-8d921948.js";import{D as r}from"../../dt-base.js";import"./dt-church-health-circle-icon.js";import"../../directive-de55b00a.js";import"../../lit-localize-763e4978.js";window.customElements.define("dt-church-health-circle",class extends r{static get styles(){return t`.health-circle__container{--d:55px;--rel:1;--r:calc(1 * var(--d) / var(--tan));--s:calc(3 * var(--r));margin:1rem auto;display:flex;justify-content:center;align-items:baseline;padding-top:100%;height:0;position:relative;overflow:visible}.health-circle{display:block;border-radius:100%;border:3px #a9a9a9 dashed;max-width:100%;position:absolute;transform:translate(-50%,-50%);left:50%;top:50%;width:100%;height:100%}@media (max-width:519px){.health-circle__container{--d:40px}.health-circle{max-width:300px;max-height:300px}}@media (max-width:400px){.health-circle__container{--d:30px}.health-circle{max-width:250px;max-height:250px}}@media (max-width:321px){.health-circle__container{--d:25px}.health-circle{max-width:225px;max-height:225px}}.health-circle__grid{display:inline-block;position:relative;height:100%;width:100%;margin-left:auto;margin-right:auto;position:relative;width:var(--s);max-width:100%}.health-circle--committed{border:3px #4caf50 solid!important}dt-church-health-icon{position:absolute;border-radius:100%;font-size:16px;color:#000;text-align:center;font-style:italic;cursor:pointer;top:50%;left:50%;margin:calc(-.5 * var(--d));width:var(--d);height:var(--d);--az:calc(var(--i) * 1turn / var(--m));transform:rotate(var(--az)) translate(var(--r)) rotate(calc(-1 * var(--az)))}`}static get properties(){return{groupId:{type:Number},group:{type:Object,reflect:!1},settings:{type:Object,reflect:!1},errorMessage:{type:String,attribute:!1},missingIcon:{type:String},handleSave:{type:Function}}}get metrics(){const t=this.settings||[];if(!Object.values(t).length)return[];return Object.entries(t).filter((([t,e])=>"church_commitment"!==t))}get isCommited(){return!!this.group&&(!!this.group.health_metrics&&this.group.health_metrics.includes("church_commitment"))}connectedCallback(){super.connectedCallback(),this.fetch()}adoptedCallback(){this.distributeItems()}updated(){this.distributeItems()}async fetch(){try{const t=[this.fetchSettings(),this.fetchGroup()];let[e,i]=await Promise.all(t);this.settings=e,this.post=i,e||(this.errorMessage="Error loading settings"),i||(this.errorMessage="Error loading group")}catch(t){console.error(t)}}fetchGroup(){if(this.group)return Promise.resolve(this.group);fetch(`/wp-json/dt-posts/v2/groups/${this.groupId}`).then((t=>t.json()))}fetchSettings(){return this.settings?Promise.resolve(this.settings):fetch("/wp-json/dt-posts/v2/groups/settings").then((t=>t.json()))}findMetric(t){const e=this.metrics.find((e=>e.key===t));return e?e.value:null}render(){if(!this.group||!this.metrics.length)return e``;const t=this.group.health_metrics||[];return this.errorMessage&&e`${this.errorMessage}`,e`
    ${this.metrics.map((([i,r],s)=>e``))}
    `}distributeItems(){const t=this.renderRoot.querySelector(".health-circle__container");let e=t.querySelectorAll("dt-church-health-icon").length,i=Math.tan(Math.PI/e);t.style.setProperty("--m",e),t.style.setProperty("--tan",+i.toFixed(2))}async toggleClick(t){const{handleSave:e}=this;if(!e)return;let i=this.renderRoot.querySelector("dt-toggle"),r=i.toggleAttribute("checked");this.group.health_metrics||(this.group.health_metrics=[]);const s={health_metrics:{values:[{value:"church_commitment",delete:!r}]}};try{await e(this.group.ID,s)}catch(t){return i.toggleAttribute("checked",!r),void console.error(t)}r?this.group.health_metrics.push("church_commitment"):this.group.health_metrics.pop("church_commitment"),this.requestUpdate()}_isChecked(){return Object.hasOwn(this.group,"health_metrics")&&this.group.health_metrics.includes("church_commitment")?this.isChurch=!0:this.isChurch=!1}}); //# sourceMappingURL=dt-church-health-circle.js.map diff --git a/dt-assets/build/components/form/dt-communication-channel/dt-comm-channel.js b/dt-assets/build/components/form/dt-communication-channel/dt-comm-channel.js index dadaf42186..9e99fea52d 100644 --- a/dt-assets/build/components/form/dt-communication-channel/dt-comm-channel.js +++ b/dt-assets/build/components/form/dt-communication-channel/dt-comm-channel.js @@ -1,81 +1,2 @@ -import { i as e, y as t } from '../../lit-element-2409d5fe.js'; -import { o as i } from '../../class-map-8d921948.js'; -import { D as l } from '../dt-text/dt-text.js'; -import '../../directive-de55b00a.js'; -import '../dt-form-base.js'; -import '../../dt-base.js'; -import '../../lit-localize-763e4978.js'; -import '../dt-label/dt-label.js'; -import '../../icons/dt-spinner.js'; -import '../../icons/dt-checkmark.js'; -import '../../icons/dt-exclamation-circle.js'; -window.customElements.define( - 'dt-comm-channel', - class extends l { - static get styles() { - return [ - ...super.styles, - e`:host{display:block}.label-wrapper{display:flex;flex-direction:row;flex-wrap:wrap;width:100%;align-items:center}.add-btn{background-color:transparent;border:none}.add-icon{color:var(--dt-comm-channel-add-btn-color,var(--success-color));height:1.75rem;margin:0 1rem}.input-group{display:flex;list-style-type:none;margin:0;padding:0}.input-group li{display:flex;width:100%;flex-direction:row;align-content:center;justify-content:center;align-items:center}#path0_fill{fill:red}.delete-button{background-color:transparent;border:none}.delete-button svg{width:100%;height:20px}`, - ]; - } - static get properties() { - return { ...super.properties, value: { type: Array, reflect: !0 } }; - } - _addClick() { - const e = { - verified: !1, - value: '', - key: `new-${this.name}-${Math.floor(100 * Math.random())}`, - }; - (this.value = [...this.value, e]), this.requestUpdate(); - } - _deleteField(e) { - const t = this.value.findIndex((t) => t.key === e.key); - -1 !== t && this.value.splice(t, 1), - (this.value = [...this.value]), - this.requestUpdate(); - } - labelTemplate() { - return this.label - ? t`${this.icon ? null : t``} ${this.label}` - : ''; - } - _inputFieldTemplate(e) { - const l = - e.key === `new-${this.name}-0` - ? '' - : t``; - return t`
    ${l} ${this.touched && this.invalid ? t`` : null} ${this.error ? t`` : null} ${this.loading ? t`` : null} ${this.saved ? t`` : null}
    `; - } - _setFormValue(e) { - super._setFormValue(e), - this.internals.setFormValue(JSON.stringify(e)), - (this.value = [...this.value]); - } - _change(e) { - const t = e.target.id, - { value: i } = e.target, - l = this.value; - this.value.find( - (e, s) => - e.key === t && ((l[s] = { verified: !1, value: i, key: t }), !0), - ); - const s = new CustomEvent('change', { - detail: { field: this.name, oldValue: this.value, newValue: l }, - }); - (this.value = l), this._setFormValue(this.value), this.dispatchEvent(s); - } - _renderInputFields() { - return this.value - ? t`${this.value.map((e) => this._inputFieldTemplate(e))}` - : ((this.value = [ - { verified: !1, value: '', key: `new-${this.name}-0` }, - ]), - this._inputFieldTemplate(this.value[0])); - } - render() { - return t`
    ${this.labelTemplate()}
    ${this._renderInputFields()}`; - } - }, -); +import{i as e,y as t}from"../../lit-element-2409d5fe.js";import{o as i}from"../../class-map-8d921948.js";import{D as l}from"../dt-text/dt-text.js";import"../../directive-de55b00a.js";import"../dt-form-base.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";import"../../icons/dt-exclamation-circle.js";window.customElements.define("dt-comm-channel",class extends l{static get styles(){return[...super.styles,e`:host{display:block}.label-wrapper{display:flex;flex-direction:row;flex-wrap:wrap;width:100%;align-items:center}.add-btn{background-color:transparent;border:none}.add-icon{color:var(--dt-comm-channel-add-btn-color,var(--success-color));height:1.75rem;margin:0 1rem}.input-group{display:flex;list-style-type:none;margin:0;padding:0}.input-group li{display:flex;width:100%;flex-direction:row;align-content:center;justify-content:center;align-items:center}#path0_fill{fill:red}.delete-button{background-color:transparent;border:none}.delete-button svg{width:100%;height:20px}`]}static get properties(){return{...super.properties,value:{type:Array,reflect:!0}}}_addClick(){const e={verified:!1,value:"",key:`new-${this.name}-${Math.floor(100*Math.random())}`};this.value=[...this.value,e],this.requestUpdate()}_deleteField(e){const t=this.value.findIndex((t=>t.key===e.key));-1!==t&&this.value.splice(t,1),this.value=[...this.value],this.requestUpdate()}labelTemplate(){return this.label?t`${this.icon?null:t``} ${this.label}`:""}_inputFieldTemplate(e){const l=e.key===`new-${this.name}-0`?"":t``;return t`
    ${l} ${this.touched&&this.invalid?t``:null} ${this.error?t``:null} ${this.loading?t``:null} ${this.saved?t``:null}
    `}_setFormValue(e){super._setFormValue(e),this.internals.setFormValue(JSON.stringify(e)),this.value=[...this.value]}_change(e){const t=e.target.id,{value:i}=e.target,l=this.value;this.value.find(((e,s)=>e.key===t&&(l[s]={verified:!1,value:i,key:t},!0)));const s=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value,newValue:l}});this.value=l,this._setFormValue(this.value),this.dispatchEvent(s)}_renderInputFields(){return this.value?t`${this.value.map((e=>this._inputFieldTemplate(e)))}`:(this.value=[{verified:!1,value:"",key:`new-${this.name}-0`}],this._inputFieldTemplate(this.value[0]))}render(){return t`
    ${this.labelTemplate()}
    ${this._renderInputFields()}`}}); //# sourceMappingURL=dt-comm-channel.js.map diff --git a/dt-assets/build/components/form/dt-connection/dt-connection.js b/dt-assets/build/components/form/dt-connection/dt-connection.js index 6915eaf7c6..93b6d79130 100644 --- a/dt-assets/build/components/form/dt-connection/dt-connection.js +++ b/dt-assets/build/components/form/dt-connection/dt-connection.js @@ -1,112 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { D as i } from '../dt-tags/dt-tags.js'; -import '../dt-multi-select/dt-multi-select.js'; -import '../../style-map-ac85d91b.js'; -import '../../directive-de55b00a.js'; -import '../../lit-localize-763e4978.js'; -import '../dt-form-base.js'; -import '../../dt-base.js'; -import '../dt-label/dt-label.js'; -import '../mixins/hasOptionsList.js'; -import '../../icons/dt-spinner.js'; -import '../../icons/dt-checkmark.js'; -window.customElements.define( - 'dt-connection', - class extends i { - static get styles() { - return [ - ...super.styles, - t`.selected-option a{border-inline-start:solid 3px transparent}li button *{pointer-events:none}li{border-inline-start:solid 5px transparent}li button .status{font-style:italic;opacity:.6}li button .status:before{content:'[';font-style:normal}li button .status:after{content:']';font-style:normal}li button svg{width:20px;height:auto;margin-bottom:-4px}li button svg use{fill:var(--dt-connection-icon-fill,var(--primary-color))}`, - ]; - } - _clickOption(t) { - if (t.target && t.target.value) { - const e = parseInt(t.target.value, 10), - i = this.filteredOptions.reduce( - (t, i) => (t || i.id != e ? t : i), - null, - ); - i && this._select(i), this._clearSearch(); - } - } - _clickAddNew(t) { - if (t.target) { - this._select({ - id: t.target.dataset?.label, - label: t.target.dataset?.label, - isNew: !0, - }); - const e = this.shadowRoot.querySelector('input'); - e && (e.value = ''); - } - } - _keyboardSelectOption() { - this.activeIndex > -1 && - (this.activeIndex + 1 > this.filteredOptions.length - ? this._select({ id: this.query, label: this.query, isNew: !0 }) - : this._select(this.filteredOptions[this.activeIndex]), - this._clearSearch()); - } - _remove(t) { - if (t.target && t.target.dataset && t.target.dataset.value) { - const e = new CustomEvent('change', { - detail: { field: this.name, oldValue: this.value }, - }); - (this.value = (this.value || []).map((e) => { - const i = { ...e }; - return e.id === t.target.dataset.value && (i.delete = !0), i; - })), - (e.detail.newValue = this.value), - this.dispatchEvent(e), - this.open && this.shadowRoot.querySelector('input').focus(); - } - } - _filterOptions() { - const t = (this.value || []).filter((t) => !t.delete).map((t) => t?.id); - if (this.options?.length) - this.filteredOptions = (this.options || []).filter( - (e) => - !t.includes(e.id) && - (!this.query || - e.label - .toLocaleLowerCase() - .includes(this.query.toLocaleLowerCase())), - ); - else if (this.open) { - (this.loading = !0), (this.filteredOptions = []); - const e = this, - i = new CustomEvent('load', { - bubbles: !0, - detail: { - field: this.name, - postType: this.postType, - query: this.query, - onSuccess: (i) => { - (e.loading = !1), - (e.filteredOptions = i.filter((e) => !t.includes(e.id))); - }, - onError: (t) => { - console.warn(t), (e.loading = !1); - }, - }, - }); - this.dispatchEvent(i); - } - return this.filteredOptions; - } - _renderSelectedOptions() { - return (this.value || []) - .filter((t) => !t.delete) - .map( - (t) => - e``, - ); - } - _renderOption(t, i) { - const s = e`circle-08 2Created using Figma`, - l = t.status || { key: '', label: '', color: '' }; - return e`
  • `; - } - }, -); +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{D as i}from"../dt-tags/dt-tags.js";import"../dt-multi-select/dt-multi-select.js";import"../../style-map-ac85d91b.js";import"../../directive-de55b00a.js";import"../../lit-localize-763e4978.js";import"../dt-form-base.js";import"../../dt-base.js";import"../dt-label/dt-label.js";import"../mixins/hasOptionsList.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";window.customElements.define("dt-connection",class extends i{static get styles(){return[...super.styles,t`.selected-option a{border-inline-start:solid 3px transparent}li button *{pointer-events:none}li{border-inline-start:solid 5px transparent}li button .status{font-style:italic;opacity:.6}li button .status:before{content:'[';font-style:normal}li button .status:after{content:']';font-style:normal}li button svg{width:20px;height:auto;margin-bottom:-4px}li button svg use{fill:var(--dt-connection-icon-fill,var(--primary-color))}`]}_clickOption(t){if(t.target&&t.target.value){const e=parseInt(t.target.value,10),i=this.filteredOptions.reduce(((t,i)=>t||i.id!=e?t:i),null);i&&this._select(i),this._clearSearch()}}_clickAddNew(t){if(t.target){this._select({id:t.target.dataset?.label,label:t.target.dataset?.label,isNew:!0});const e=this.shadowRoot.querySelector("input");e&&(e.value="")}}_keyboardSelectOption(){this.activeIndex>-1&&(this.activeIndex+1>this.filteredOptions.length?this._select({id:this.query,label:this.query,isNew:!0}):this._select(this.filteredOptions[this.activeIndex]),this._clearSearch())}_remove(t){if(t.target&&t.target.dataset&&t.target.dataset.value){const e=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value}});this.value=(this.value||[]).map((e=>{const i={...e};return e.id===t.target.dataset.value&&(i.delete=!0),i})),e.detail.newValue=this.value,this.dispatchEvent(e),this.open&&this.shadowRoot.querySelector("input").focus()}}_filterOptions(){const t=(this.value||[]).filter((t=>!t.delete)).map((t=>t?.id));if(this.options?.length)this.filteredOptions=(this.options||[]).filter((e=>!t.includes(e.id)&&(!this.query||e.label.toLocaleLowerCase().includes(this.query.toLocaleLowerCase()))));else if(this.open){this.loading=!0,this.filteredOptions=[];const e=this,i=new CustomEvent("load",{bubbles:!0,detail:{field:this.name,postType:this.postType,query:this.query,onSuccess:i=>{e.loading=!1,e.filteredOptions=i.filter((e=>!t.includes(e.id)))},onError:t=>{console.warn(t),e.loading=!1}}});this.dispatchEvent(i)}return this.filteredOptions}_renderSelectedOptions(){return(this.value||[]).filter((t=>!t.delete)).map((t=>e``))}_renderOption(t,i){const s=e`circle-08 2Created using Figma`,l=t.status||{key:"",label:"",color:""};return e`
  • `}}); //# sourceMappingURL=dt-connection.js.map diff --git a/dt-assets/build/components/form/dt-copy-text/dt-copy-text.js b/dt-assets/build/components/form/dt-copy-text/dt-copy-text.js index b5a579fd0f..d84450c73d 100644 --- a/dt-assets/build/components/form/dt-copy-text/dt-copy-text.js +++ b/dt-assets/build/components/form/dt-copy-text/dt-copy-text.js @@ -1,57 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { i as o } from '../../style-map-ac85d91b.js'; -import { D as r } from '../../dt-base.js'; -import '../dt-label/dt-label.js'; -import '../../directive-de55b00a.js'; -import '../../lit-localize-763e4978.js'; -window.customElements.define( - 'dt-copy-text', - class extends r { - static get styles() { - return t`:root{font-size:inherit}.copy-text{--dt-form-text-color:#575757;display:flex;align-items:center;position:relative;width:calc(100% + 20px)}.copy-text__input{flex:1}.copy_icon{cursor:copy;font-size:16px;display:block;transform:translate(-24px,-5px);width:20px}:host([dir=rtl]) .copy_icon{transform:translate(24px,-5px)}`; - } - static get properties() { - return { - value: { type: String }, - success: { type: Boolean }, - error: { type: Boolean }, - }; - } - get inputStyles() { - return this.success - ? { - '--dt-text-border-color': - 'var(--copy-text-success-color, var(--success-color))', - '--dt-form-text-color': - 'var( --copy-text-success-color, var(--success-color))', - color: 'var( --copy-text-success-color, var(--success-color))', - } - : this.error - ? { - '---dt-text-border-color': - 'var(--copy-text-alert-color, var(--alert-color))', - '--dt-form-text-color': - 'var(--copy-text-alert-color, var(--alert-color))', - } - : {}; - } - get icon() { - return this.success ? 'ic:round-check' : 'ic:round-content-copy'; - } - async copy() { - try { - (this.success = !1), - (this.error = !1), - await navigator.clipboard.writeText(this.value), - (this.success = !0), - (this.error = !1); - } catch (t) { - console.log(t), (this.success = !1), (this.error = !0); - } - } - render() { - return e`
    `; - } - }, -); +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{i as o}from"../../style-map-ac85d91b.js";import{D as r}from"../../dt-base.js";import"../dt-label/dt-label.js";import"../../directive-de55b00a.js";import"../../lit-localize-763e4978.js";window.customElements.define("dt-copy-text",class extends r{static get styles(){return t`:root{font-size:inherit}.copy-text{--dt-form-text-color:#575757;display:flex;align-items:center;position:relative;width:calc(100% + 20px)}.copy-text__input{flex:1}.copy_icon{cursor:copy;font-size:16px;display:block;transform:translate(-24px,-5px);width:20px}:host([dir=rtl]) .copy_icon{transform:translate(24px,-5px)}`}static get properties(){return{value:{type:String},success:{type:Boolean},error:{type:Boolean}}}get inputStyles(){return this.success?{"--dt-text-border-color":"var(--copy-text-success-color, var(--success-color))","--dt-form-text-color":"var( --copy-text-success-color, var(--success-color))",color:"var( --copy-text-success-color, var(--success-color))"}:this.error?{"---dt-text-border-color":"var(--copy-text-alert-color, var(--alert-color))","--dt-form-text-color":"var(--copy-text-alert-color, var(--alert-color))"}:{}}get icon(){return this.success?"ic:round-check":"ic:round-content-copy"}async copy(){try{this.success=!1,this.error=!1,await navigator.clipboard.writeText(this.value),this.success=!0,this.error=!1}catch(t){console.log(t),this.success=!1,this.error=!0}}render(){return e`
    `}}); //# sourceMappingURL=dt-copy-text.js.map diff --git a/dt-assets/build/components/form/dt-date/dt-date.js b/dt-assets/build/components/form/dt-date/dt-date.js index 042de01a07..5dbb4163af 100644 --- a/dt-assets/build/components/form/dt-date/dt-date.js +++ b/dt-assets/build/components/form/dt-date/dt-date.js @@ -1,59 +1,2 @@ -import { i as e, y as t } from '../../lit-element-2409d5fe.js'; -import { D as i } from '../dt-form-base.js'; -import '../../dt-base.js'; -import '../../lit-localize-763e4978.js'; -import '../dt-label/dt-label.js'; -class r extends i { - static get styles() { - return [ - ...super.styles, - e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-form-background-color,#cecece);border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;box-shadow:var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:inline-flex;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);width:100%}.input-group button:disabled,input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-form-disabled-background-color,#e6e6e6);cursor:not-allowed}input::-webkit-calendar-picker-indicator{color:red}.input-group{position:relative;display:inline-flex;margin:0 0 1.0666666667rem;width:100%}.input-group .input-group-button{font-size:.75rem;line-height:1em;display:inline-flex}.input-group .button{display:inline-block;background:var(--dt-form-background-color,#cecece);border:1px solid var(--dt-form-border-color,#cecece);color:var(--alert-color,#cc4b37);align-self:stretch;font-size:1rem;height:auto;padding:0 1em;margin:0}.input-group .button:hover:not([disabled]){background-color:var(--alert-color,#cc4b37);color:var(--text-color-inverse,#fefefe)}.icon-overlay{inset-inline-end:5rem}`, - ]; - } - static get properties() { - return { - ...super.properties, - id: { type: String }, - value: { type: String, reflect: !0 }, - timestamp: { - converter: (e) => { - let t = Number(e); - if ((t < 1e12 && (t *= 1e3), t)) return t; - }, - reflect: !0, - }, - onchange: { type: String }, - }; - } - updateTimestamp(e) { - const t = new Date(e).getTime(), - i = t / 1e3, - r = new CustomEvent('change', { - detail: { field: this.name, oldValue: this.timestamp, newValue: i }, - }); - (this.timestamp = t), - (this.value = e), - this._setFormValue(e), - this.dispatchEvent(r); - } - _change(e) { - this.updateTimestamp(e.target.value); - } - clearInput() { - this.updateTimestamp(''); - } - showDatePicker() { - this.shadowRoot.querySelector('input').showPicker(); - } - render() { - return ( - this.timestamp - ? (this.value = new Date(this.timestamp).toISOString().substring(0, 10)) - : this.value && (this.timestamp = new Date(this.value).getTime()), - t`${this.labelTemplate()}
    ${(this.touched && this.invalid) || this.error ? t`` : null} ${this.loading ? t`` : null} ${this.saved ? t`` : null}
    ` - ); - } -} -window.customElements.define('dt-date', r); -export { r as D }; +import{i as e,y as t}from"../../lit-element-2409d5fe.js";import{D as i}from"../dt-form-base.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";class r extends i{static get styles(){return[...super.styles,e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-form-background-color,#cecece);border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;box-shadow:var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:inline-flex;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);width:100%}.input-group button:disabled,input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-form-disabled-background-color,#e6e6e6);cursor:not-allowed}input::-webkit-calendar-picker-indicator{color:red}.input-group{position:relative;display:inline-flex;margin:0 0 1.0666666667rem;width:100%}.input-group .input-group-button{font-size:.75rem;line-height:1em;display:inline-flex}.input-group .button{display:inline-block;background:var(--dt-form-background-color,#cecece);border:1px solid var(--dt-form-border-color,#cecece);color:var(--alert-color,#cc4b37);align-self:stretch;font-size:1rem;height:auto;padding:0 1em;margin:0}.input-group .button:hover:not([disabled]){background-color:var(--alert-color,#cc4b37);color:var(--text-color-inverse,#fefefe)}.icon-overlay{inset-inline-end:5rem}`]}static get properties(){return{...super.properties,id:{type:String},value:{type:String,reflect:!0},timestamp:{converter:e=>{let t=Number(e);if(t<1e12&&(t*=1e3),t)return t},reflect:!0},onchange:{type:String}}}updateTimestamp(e){const t=new Date(e).getTime(),i=t/1e3,r=new CustomEvent("change",{detail:{field:this.name,oldValue:this.timestamp,newValue:i}});this.timestamp=t,this.value=e,this._setFormValue(e),this.dispatchEvent(r)}_change(e){this.updateTimestamp(e.target.value)}clearInput(){this.updateTimestamp("")}showDatePicker(){this.shadowRoot.querySelector("input").showPicker()}render(){return this.timestamp?this.value=new Date(this.timestamp).toISOString().substring(0,10):this.value&&(this.timestamp=new Date(this.value).getTime()),t`${this.labelTemplate()}
    ${this.touched&&this.invalid||this.error?t``:null} ${this.loading?t``:null} ${this.saved?t``:null}
    `}}window.customElements.define("dt-date",r);export{r as D}; //# sourceMappingURL=dt-date.js.map diff --git a/dt-assets/build/components/form/dt-datetime/dt-datetime.js b/dt-assets/build/components/form/dt-datetime/dt-datetime.js index c082ae1e96..dad54b8f58 100644 --- a/dt-assets/build/components/form/dt-datetime/dt-datetime.js +++ b/dt-assets/build/components/form/dt-datetime/dt-datetime.js @@ -1,28 +1,2 @@ -import { y as t } from '../../lit-element-2409d5fe.js'; -import { D as e } from '../dt-date/dt-date.js'; -import '../dt-form-base.js'; -import '../../dt-base.js'; -import '../../lit-localize-763e4978.js'; -import '../dt-label/dt-label.js'; -window.customElements.define( - 'dt-datetime', - class extends e { - static get properties() { - return { ...super.properties, tzoffset: { type: Number } }; - } - constructor() { - super(), (this.tzoffset = 6e4 * new Date().getTimezoneOffset()); - } - render() { - return ( - this.timestamp - ? (this.value = new Date(this.timestamp - this.tzoffset) - .toISOString() - .substring(0, 16)) - : this.value && (this.timestamp = new Date(this.value).getTime()), - t`${this.labelTemplate()}
    ${(this.touched && this.invalid) || this.error ? t`` : null} ${this.loading ? t`` : null} ${this.saved ? t`` : null}
    ` - ); - } - }, -); +import{y as t}from"../../lit-element-2409d5fe.js";import{D as e}from"../dt-date/dt-date.js";import"../dt-form-base.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";window.customElements.define("dt-datetime",class extends e{static get properties(){return{...super.properties,tzoffset:{type:Number}}}constructor(){super(),this.tzoffset=6e4*(new Date).getTimezoneOffset()}render(){return this.timestamp?this.value=new Date(this.timestamp-this.tzoffset).toISOString().substring(0,16):this.value&&(this.timestamp=new Date(this.value).getTime()),t`${this.labelTemplate()}
    ${this.touched&&this.invalid||this.error?t``:null} ${this.loading?t``:null} ${this.saved?t``:null}
    `}}); //# sourceMappingURL=dt-datetime.js.map diff --git a/dt-assets/build/components/form/dt-form-base.js b/dt-assets/build/components/form/dt-form-base.js index bd8d3f0b3f..f0a9adeb82 100644 --- a/dt-assets/build/components/form/dt-form-base.js +++ b/dt-assets/build/components/form/dt-form-base.js @@ -1,83 +1,2 @@ -import { i as t, y as e } from '../lit-element-2409d5fe.js'; -import { D as i } from '../dt-base.js'; -import './dt-label/dt-label.js'; -import '../lit-localize-763e4978.js'; -class a extends i { - static get formAssociated() { - return !0; - } - static get styles() { - return [ - t`.input-group{position:relative}.input-group.disabled{background-color:var(--disabled-color)}.icon-overlay{position:absolute;inset-inline-end:2rem;top:0;height:100%;display:flex;justify-content:center;align-items:center}.icon-overlay.alert{color:var(--alert-color);cursor:pointer}.icon-overlay.success{color:var(--success-color)}`, - ]; - } - static get properties() { - return { - ...super.properties, - name: { type: String }, - label: { type: String }, - icon: { type: String }, - iconAltText: { type: String }, - private: { type: Boolean }, - privateLabel: { type: String }, - disabled: { type: Boolean }, - required: { type: Boolean }, - requiredMessage: { type: String }, - touched: { type: Boolean, state: !0 }, - invalid: { type: Boolean, state: !0 }, - error: { type: String }, - loading: { type: Boolean }, - saved: { type: Boolean }, - }; - } - get _field() { - return this.shadowRoot.querySelector('input, textarea, select'); - } - get _focusTarget() { - return this._field; - } - constructor() { - super(), - (this.touched = !1), - (this.invalid = !1), - (this.internals = this.attachInternals()), - this.addEventListener('invalid', () => { - (this.touched = !0), this._validateRequired(); - }); - } - firstUpdated(...t) { - super.firstUpdated(...t); - const e = a._jsonToFormData(this.value, this.name); - this.internals.setFormValue(e), this._validateRequired(); - } - static _buildFormData(t, e, i) { - if (!e || 'object' != typeof e || e instanceof Date || e instanceof File) { - const a = e ?? ''; - t.append(i, a); - } else - Object.keys(e).forEach((a) => { - this._buildFormData(t, e[a], i ? `${i}[${a}]` : a); - }); - } - static _jsonToFormData(t, e) { - const i = new FormData(); - return a._buildFormData(i, t, e), i; - } - _setFormValue(t) { - const e = a._jsonToFormData(t, this.name); - this.internals.setFormValue(e, t), - this._validateRequired(), - (this.touched = !0); - } - _validateRequired() {} - labelTemplate() { - return this.label - ? e`${this.icon ? null : e``} ${this.label}` - : ''; - } - render() { - return e`${this.labelTemplate()}`; - } -} -export { a as D }; +import{i as t,y as e}from"../lit-element-2409d5fe.js";import{D as i}from"../dt-base.js";import"./dt-label/dt-label.js";import"../lit-localize-763e4978.js";class a extends i{static get formAssociated(){return!0}static get styles(){return[t`.input-group{position:relative}.input-group.disabled{background-color:var(--disabled-color)}.icon-overlay{position:absolute;inset-inline-end:2rem;top:0;height:100%;display:flex;justify-content:center;align-items:center}.icon-overlay.alert{color:var(--alert-color);cursor:pointer}.icon-overlay.success{color:var(--success-color)}`]}static get properties(){return{...super.properties,name:{type:String},label:{type:String},icon:{type:String},iconAltText:{type:String},private:{type:Boolean},privateLabel:{type:String},disabled:{type:Boolean},required:{type:Boolean},requiredMessage:{type:String},touched:{type:Boolean,state:!0},invalid:{type:Boolean,state:!0},error:{type:String},loading:{type:Boolean},saved:{type:Boolean}}}get _field(){return this.shadowRoot.querySelector("input, textarea, select")}get _focusTarget(){return this._field}constructor(){super(),this.touched=!1,this.invalid=!1,this.internals=this.attachInternals(),this.addEventListener("invalid",(()=>{this.touched=!0,this._validateRequired()}))}firstUpdated(...t){super.firstUpdated(...t);const e=a._jsonToFormData(this.value,this.name);this.internals.setFormValue(e),this._validateRequired()}static _buildFormData(t,e,i){if(!e||"object"!=typeof e||e instanceof Date||e instanceof File){const a=e??"";t.append(i,a)}else Object.keys(e).forEach((a=>{this._buildFormData(t,e[a],i?`${i}[${a}]`:a)}))}static _jsonToFormData(t,e){const i=new FormData;return a._buildFormData(i,t,e),i}_setFormValue(t){const e=a._jsonToFormData(t,this.name);this.internals.setFormValue(e,t),this._validateRequired(),this.touched=!0}_validateRequired(){}labelTemplate(){return this.label?e`${this.icon?null:e``} ${this.label}`:""}render(){return e`${this.labelTemplate()}`}}export{a as D}; //# sourceMappingURL=dt-form-base.js.map diff --git a/dt-assets/build/components/form/dt-label/dt-label.js b/dt-assets/build/components/form/dt-label/dt-label.js index ceb53e8ea2..0004976f3c 100644 --- a/dt-assets/build/components/form/dt-label/dt-label.js +++ b/dt-assets/build/components/form/dt-label/dt-label.js @@ -1,35 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { m as o } from '../../lit-localize-763e4978.js'; -import { D as i } from '../../dt-base.js'; -window.customElements.define( - 'dt-label', - class extends i { - static get styles() { - return t`:host{font-family:var(--font-family);font-size:var(--dt-label-font-size,14px);font-weight:var(--dt-label-font-weight,700);color:var(--dt-label-color,#000);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon{height:var(--dt-label-font-size,14px);width:auto;display:inline-block}.icon.private{position:relative}.icon.private:hover .tooltip{display:block}.tooltip{display:none;position:absolute;color:var(--dt-label-tooltip-color,#666);background:var(--dt-label-tooltip-background,#eee);top:calc(100% + .5rem);inset-inline-start:-1rem;font-weight:400;padding:.4rem}.tooltip:before{content:'';position:absolute;inset-inline-start:1rem;top:-.5rem;height:0;width:0;border-bottom:.5rem solid var(--dt-label-tooltip-background,#eee);border-inline-start:.5rem solid transparent;border-inline-end:.5rem solid transparent}`; - } - static get properties() { - return { - icon: { type: String }, - iconAltText: { type: String }, - private: { type: Boolean }, - privateLabel: { type: String }, - }; - } - firstUpdated() { - const t = this.shadowRoot - .querySelector('slot[name=icon-start]') - .assignedElements({ flatten: !0 }); - for (const e of t) (e.style.height = '100%'), (e.style.width = 'auto'); - } - get _slottedChildren() { - return this.shadowRoot - .querySelector('slot') - .assignedElements({ flatten: !0 }); - } - render() { - const t = e``; - return e`
    ${this.icon ? e`${this.iconAltText}` : null}${this.private ? e`${t} ${this.privateLabel || o('Private Field: Only I can see its content')}` : null}
    `; - } - }, -); +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{m as o}from"../../lit-localize-763e4978.js";import{D as i}from"../../dt-base.js";window.customElements.define("dt-label",class extends i{static get styles(){return t`:host{font-family:var(--font-family);font-size:var(--dt-label-font-size,14px);font-weight:var(--dt-label-font-weight,700);color:var(--dt-label-color,#000);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon{height:var(--dt-label-font-size,14px);width:auto;display:inline-block}.icon.private{position:relative}.icon.private:hover .tooltip{display:block}.tooltip{display:none;position:absolute;color:var(--dt-label-tooltip-color,#666);background:var(--dt-label-tooltip-background,#eee);top:calc(100% + .5rem);inset-inline-start:-1rem;font-weight:400;padding:.4rem}.tooltip:before{content:'';position:absolute;inset-inline-start:1rem;top:-.5rem;height:0;width:0;border-bottom:.5rem solid var(--dt-label-tooltip-background,#eee);border-inline-start:.5rem solid transparent;border-inline-end:.5rem solid transparent}`}static get properties(){return{icon:{type:String},iconAltText:{type:String},private:{type:Boolean},privateLabel:{type:String}}}firstUpdated(){const t=this.shadowRoot.querySelector("slot[name=icon-start]").assignedElements({flatten:!0});for(const e of t)e.style.height="100%",e.style.width="auto"}get _slottedChildren(){return this.shadowRoot.querySelector("slot").assignedElements({flatten:!0})}render(){const t=e``;return e`
    ${this.icon?e`${this.iconAltText}`:null}${this.private?e`${t} ${this.privateLabel||o("Private Field: Only I can see its content")}`:null}
    `}}); //# sourceMappingURL=dt-label.js.map diff --git a/dt-assets/build/components/form/dt-location-map/dt-location-map-item.js b/dt-assets/build/components/form/dt-location-map/dt-location-map-item.js index f5069964e8..adddf2ce13 100644 --- a/dt-assets/build/components/form/dt-location-map/dt-location-map-item.js +++ b/dt-assets/build/components/form/dt-location-map/dt-location-map-item.js @@ -1,389 +1,2 @@ -import { s as t, i as e, y as o } from '../../lit-element-2409d5fe.js'; -import { i } from '../../style-map-ac85d91b.js'; -import { m as a } from '../../lit-localize-763e4978.js'; -import '../../icons/dt-icon.js'; -import './dt-map-modal.js'; -import '../../directive-de55b00a.js'; -import '../../dt-base.js'; -import '../../layout/dt-modal/dt-modal.js'; -import '../../class-map-8d921948.js'; -class s { - constructor(t) { - this.token = t; - } - async searchPlaces(t, e = 'en') { - const o = new URLSearchParams({ - types: [ - 'country', - 'region', - 'postcode', - 'district', - 'place', - 'locality', - 'neighborhood', - 'address', - ], - limit: 6, - access_token: this.token, - language: e, - }), - i = `https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURI(t)}.json?${o}`, - a = await fetch(i, { - method: 'GET', - headers: { 'Content-Type': 'application/json' }, - }); - return (await a.json())?.features; - } - async reverseGeocode(t, e, o = 'en') { - const i = new URLSearchParams({ - types: [ - 'country', - 'region', - 'postcode', - 'district', - 'place', - 'locality', - 'neighborhood', - 'address', - ], - access_token: this.token, - language: o, - }), - a = `https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURI(t)},${encodeURI(e)}.json?${i}`, - s = await fetch(a, { - method: 'GET', - headers: { 'Content-Type': 'application/json' }, - }); - return (await s.json())?.features; - } -} -class n { - constructor(t, e, o) { - if ( - ((this.token = t), - (this.window = e), - !e.google?.maps?.places?.AutocompleteService) - ) { - let e = o.createElement('script'); - (e.src = `https://maps.googleapis.com/maps/api/js?libraries=places&key=${t}`), - o.body.appendChild(e); - } - } - async getPlacePredictions(t, e = 'en') { - if (this.window.google) { - const o = new this.window.google.maps.places.AutocompleteService(), - { predictions: i } = await o.getPlacePredictions({ - input: t, - language: e, - }); - return i; - } - return null; - } - async getPlaceDetails(t, e = 'en') { - const o = `https://maps.googleapis.com/maps/api/geocode/json?${new URLSearchParams({ key: this.token, address: t, language: e })}`, - i = await fetch(o, { method: 'GET' }), - a = await i.json(); - let s = []; - if ('OK' === a.status) s = a.results; - return s && s.length ? s[0] : null; - } - async reverseGeocode(t, e, o = 'en') { - const i = `https://maps.googleapis.com/maps/api/geocode/json?${new URLSearchParams({ key: this.token, latlng: `${e},${t}`, language: o, result_type: ['point_of_interest', 'establishment', 'premise', 'street_address', 'neighborhood', 'sublocality', 'locality', 'colloquial_area', 'political', 'country'].join('|') })}`, - a = await fetch(i, { method: 'GET' }); - return (await a.json())?.results; - } -} -window.customElements.define( - 'dt-location-map-item', - class extends t { - static get properties() { - return { - id: { type: String, reflect: !0 }, - placeholder: { type: String }, - mapboxToken: { type: String, attribute: 'mapbox-token' }, - googleToken: { type: String, attribute: 'google-token' }, - metadata: { type: Object }, - disabled: { type: Boolean }, - open: { type: Boolean, state: !0 }, - query: { type: String, state: !0 }, - activeIndex: { type: Number, state: !0 }, - containerHeight: { type: Number, state: !0 }, - loading: { type: Boolean }, - saved: { type: Boolean }, - filteredOptions: { type: Array, state: !0 }, - }; - } - static get styles() { - return [ - e`:host{position:relative;font-family:Helvetica,Arial,sans-serif;display:block}.input-group{color:var(--dt-multi-select-text-color,#0a0a0a);margin-bottom:1rem}.input-group.disabled .field-container,.input-group.disabled input{background-color:var(--disabled-color)}.input-group.disabled a,.input-group.disabled button{cursor:not-allowed;pointer-events:none}.input-group.disabled :hover{cursor:not-allowed}.option-list{list-style:none;margin:0;padding:0;border:1px solid var(--dt-form-border-color,#cacaca);background:var(--dt-form-background-color,#fefefe);z-index:10;position:absolute;width:var(--container-width,100%);width:100%;top:0;left:0;box-shadow:var(--shadow-1);max-height:150px;overflow-y:scroll}.option-list li{border-block-start:1px solid var(--dt-form-border-color,#cacaca);outline:0}.option-list li button,.option-list li div{padding:.5rem .75rem;color:var(--dt-multi-select-text-color,#0a0a0a);font-weight:100;font-size:1rem;text-decoration:none;text-align:inherit}.option-list li button{display:block;width:100%;border:0;background:0 0}.option-list li button.active,.option-list li button:hover{cursor:pointer;background:var(--dt-multi-select-option-hover-background,#f5f5f5)}`, - e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-location-map-background-color,#fefefe);border:1px solid var(--dt-location-map-border-color,#fefefe);border-radius:var(--dt-location-map-border-radius,0);box-shadow:var(--dt-location-map-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;line-height:1.5;margin:0;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out)}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-text-disabled-background-color,var(--dt-form-disabled-background-color,#e6e6e6));cursor:not-allowed}input.disabled{color:var(--dt-text-placeholder-color,#999)}input:focus-visible,input:focus-within{outline:0}input::placeholder{color:var(--dt-text-placeholder-color,#999);text-transform:var(--dt-text-placeholder-transform,none);font-size:var(--dt-text-placeholder-font-size,1rem);font-weight:var(--dt-text-placeholder-font-weight,400);letter-spacing:var(--dt-text-placeholder-letter-spacing,normal)}input.invalid{border-color:var(--dt-text-border-color-alert,var(--alert-color))}.field-container{display:flex;margin-bottom:.5rem}.field-container input{flex-grow:1}.field-container .input-addon{flex-shrink:1;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1;padding:10px;border:solid 1px gray;border-collapse:collapse;color:var(--dt-location-map-button-color,#cc4b37);background-color:var(--dt-location-map-background-color,buttonface);border:1px solid var(--dt-location-map-border-color,#fefefe);border-radius:var(--dt-location-map-border-radius,0);box-shadow:var(--dt-location-map-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)))}.field-container .input-addon:hover{background-color:var(--dt-location-map-button-hover-background-color,#cc4b37);color:var(--dt-location-map-button-hover-color,#fff)}.input-addon:disabled{background-color:var(--dt-form-disabled-background-color);color:var(--dt-text-placeholder-color,#999)}.input-addon:disabled:hover{background-color:var(--dt-form-disabled-background-color);color:var(--dt-text-placeholder-color,#999);cursor:not-allowed}`, - e`.icon-overlay{position:absolute;inset-inline-end:1rem;top:0;inset-inline-end:3rem;height:100%;display:flex;justify-content:center;align-items:center}.icon-overlay.alert{color:var(--alert-color)}.icon-overlay.success{color:var(--success-color)}`, - ]; - } - constructor() { - super(), - (this.activeIndex = -1), - (this.filteredOptions = []), - (this.detectTap = !1), - (this.debounceTimer = null); - } - connectedCallback() { - super.connectedCallback(), - this.addEventListener('autofocus', async (t) => { - await this.updateComplete; - const e = this.shadowRoot.querySelector('input'); - e && e.focus(); - }), - this.mapboxToken && (this.mapboxService = new s(this.mapboxToken)), - this.googleToken && - (this.googleGeocodeService = new n( - this.googleToken, - window, - document, - )); - } - updated(t) { - this._scrollOptionListToActive(); - const e = this.shadowRoot.querySelector('.input-group'); - e.style.getPropertyValue('--container-width') || - e.style.setProperty('--container-width', `${e.clientWidth}px`); - } - _scrollOptionListToActive() { - const t = this.shadowRoot.querySelector('.option-list'), - e = this.shadowRoot.querySelector('button.active'); - if (t && e) { - const o = e.offsetTop, - i = e.offsetTop + e.clientHeight, - a = t.scrollTop; - i > t.scrollTop + t.clientHeight - ? t.scrollTo({ top: i - t.clientHeight, behavior: 'smooth' }) - : o < a && t.scrollTo({ top: o, behavior: 'smooth' }); - } - } - _clickOption(t) { - const e = t.currentTarget ?? t.target; - e && e.value && this._select(JSON.parse(e.value)); - } - _touchStart(t) { - t.target && (this.detectTap = !1); - } - _touchMove(t) { - t.target && (this.detectTap = !0); - } - _touchEnd(t) { - this.detectTap || - (t.target && t.target.value && this._clickOption(t), - (this.detectTap = !1)); - } - _keyboardSelectOption() { - this.activeIndex > -1 && - (this.activeIndex < this.filteredOptions.length - ? this._select(this.filteredOptions[this.activeIndex]) - : this._select({ value: this.query, label: this.query })); - } - async _select(t) { - if (t.place_id && this.googleGeocodeService) { - this.loading = !0; - const e = await this.googleGeocodeService.getPlaceDetails( - t.label, - this.locale, - ); - (this.loading = !1), - e && - ((t.lat = e.geometry.location.lat), - (t.lng = e.geometry.location.lng), - (t.level = e.types && e.types.length ? e.types[0] : null)); - } - const e = { detail: { metadata: t }, bubbles: !1 }; - this.dispatchEvent(new CustomEvent('select', e)), (this.metadata = t); - const o = this.shadowRoot.querySelector('input'); - o && (o.value = t?.label), (this.open = !1), (this.activeIndex = -1); - } - get _focusTarget() { - let t = this._field; - return ( - this.metadata && (t = this.shadowRoot.querySelector('button') || t), t - ); - } - _inputFocusIn() { - this.activeIndex = -1; - } - _inputFocusOut(t) { - (t.relatedTarget && - ['BUTTON', 'LI'].includes(t.relatedTarget.nodeName)) || - (this.open = !1); - } - _inputKeyDown(t) { - switch (t.keyCode || t.which) { - case 38: - (this.open = !0), this._listHighlightPrevious(); - break; - case 40: - (this.open = !0), this._listHighlightNext(); - break; - case 9: - this.activeIndex < 0 ? (this.open = !1) : t.preventDefault(), - this._keyboardSelectOption(); - break; - case 13: - this._keyboardSelectOption(); - break; - case 27: - (this.open = !1), (this.activeIndex = -1); - break; - default: - this.open = !0; - } - } - _inputKeyUp(t) { - const e = t.keyCode || t.which; - t.target.value && ![9, 13].includes(e) && (this.open = !0), - (this.query = t.target.value); - } - _listHighlightNext() { - this.activeIndex = Math.min( - this.filteredOptions.length, - this.activeIndex + 1, - ); - } - _listHighlightPrevious() { - this.activeIndex = Math.max(0, this.activeIndex - 1); - } - async _filterOptions() { - if (this.query) - if (this.googleToken && this.googleGeocodeService) { - this.loading = !0; - try { - const t = await this.googleGeocodeService.getPlacePredictions( - this.query, - this.locale, - ); - (this.filteredOptions = (t || []).map((t) => ({ - label: t.description, - place_id: t.place_id, - source: 'user', - raw: t, - }))), - (this.loading = !1); - } catch (t) { - return ( - console.error(t), (this.error = !0), void (this.loading = !1) - ); - } - } else if (this.mapboxToken && this.mapboxService) { - this.loading = !0; - const t = await this.mapboxService.searchPlaces( - this.query, - this.locale, - ); - (this.filteredOptions = t.map((t) => ({ - lng: t.center[0], - lat: t.center[1], - level: t.place_type[0], - label: t.place_name, - source: 'user', - }))), - (this.loading = !1); - } - return this.filteredOptions; - } - willUpdate(t) { - if ((super.willUpdate(t), t)) { - if ( - (t.has('query') && - ((this.error = !1), - clearTimeout(this.debounceTimer), - (this.debounceTimer = setTimeout( - () => this._filterOptions(), - 300, - ))), - !this.containerHeight && - this.shadowRoot.children && - this.shadowRoot.children.length) - ) { - const t = this.shadowRoot.querySelector('.input-group'); - t && (this.containerHeight = t.offsetHeight); - } - } - } - _change() {} - _delete() { - const t = { detail: { metadata: this.metadata }, bubbles: !1 }; - this.dispatchEvent(new CustomEvent('delete', t)); - } - _openMapModal() { - this.shadowRoot - .querySelector('dt-map-modal') - .dispatchEvent(new Event('open')); - } - async _onMapModalSubmit(t) { - if (t?.detail?.location?.lat) { - const { location: e } = t?.detail, - { lat: o, lng: i } = e; - if (this.googleGeocodeService) { - const t = await this.googleGeocodeService.reverseGeocode( - i, - o, - this.locale, - ); - if (t && t.length) { - const e = t[0]; - this._select({ - lng: e.geometry.location.lng, - lat: e.geometry.location.lat, - level: e.types && e.types.length ? e.types[0] : null, - label: e.formatted_address, - source: 'user', - }); - } - } else if (this.mapboxService) { - const t = await this.mapboxService.reverseGeocode(i, o, this.locale); - if (t && t.length) { - const e = t[0]; - this._select({ - lng: e.center[0], - lat: e.center[1], - level: e.place_type[0], - label: e.place_name, - source: 'user', - }); - } - } - } - } - _renderOption(t, e, i) { - return o`
  • `; - } - _renderOptions() { - let t = []; - return ( - this.filteredOptions.length - ? t.push( - ...this.filteredOptions.map((t, e) => this._renderOption(t, e)), - ) - : this.loading - ? t.push(o`
  • ${a('Loading...')}
  • `) - : t.push(o`
  • ${a('No Data Available')}
  • `), - t.push( - this._renderOption( - { value: this.query, label: this.query }, - (this.filteredOptions || []).length, - o`${a('Use')}: "${this.query}"`, - ), - ), - t - ); - } - render() { - const t = { - display: this.open ? 'block' : 'none', - top: this.containerHeight ? `${this.containerHeight}px` : '2.5rem', - }, - e = !!this.metadata?.label, - a = this.metadata?.lat && this.metadata?.lng; - return o`
    ${e && a ? o`` : null} ${e ? o`` : o``}
      ${this._renderOptions()}
    ${(this.touched && this.invalid) || this.error ? o`` : null} ${this.loading ? o`` : null} ${this.saved ? o`` : null}
    `; - } - }, -); +import{s as t,i as e,y as o}from"../../lit-element-2409d5fe.js";import{i}from"../../style-map-ac85d91b.js";import{m as a}from"../../lit-localize-763e4978.js";import"../../icons/dt-icon.js";import"./dt-map-modal.js";import"../../directive-de55b00a.js";import"../../dt-base.js";import"../../layout/dt-modal/dt-modal.js";import"../../class-map-8d921948.js";class s{constructor(t){this.token=t}async searchPlaces(t,e="en"){const o=new URLSearchParams({types:["country","region","postcode","district","place","locality","neighborhood","address"],limit:6,access_token:this.token,language:e}),i=`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURI(t)}.json?${o}`,a=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"}});return(await a.json())?.features}async reverseGeocode(t,e,o="en"){const i=new URLSearchParams({types:["country","region","postcode","district","place","locality","neighborhood","address"],access_token:this.token,language:o}),a=`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURI(t)},${encodeURI(e)}.json?${i}`,s=await fetch(a,{method:"GET",headers:{"Content-Type":"application/json"}});return(await s.json())?.features}}class n{constructor(t,e,o){if(this.token=t,this.window=e,!e.google?.maps?.places?.AutocompleteService){let e=o.createElement("script");e.src=`https://maps.googleapis.com/maps/api/js?libraries=places&key=${t}`,o.body.appendChild(e)}}async getPlacePredictions(t,e="en"){if(this.window.google){const o=new this.window.google.maps.places.AutocompleteService,{predictions:i}=await o.getPlacePredictions({input:t,language:e});return i}return null}async getPlaceDetails(t,e="en"){const o=`https://maps.googleapis.com/maps/api/geocode/json?${new URLSearchParams({key:this.token,address:t,language:e})}`,i=await fetch(o,{method:"GET"}),a=await i.json();let s=[];if("OK"===a.status)s=a.results;return s&&s.length?s[0]:null}async reverseGeocode(t,e,o="en"){const i=`https://maps.googleapis.com/maps/api/geocode/json?${new URLSearchParams({key:this.token,latlng:`${e},${t}`,language:o,result_type:["point_of_interest","establishment","premise","street_address","neighborhood","sublocality","locality","colloquial_area","political","country"].join("|")})}`,a=await fetch(i,{method:"GET"});return(await a.json())?.results}}window.customElements.define("dt-location-map-item",class extends t{static get properties(){return{id:{type:String,reflect:!0},placeholder:{type:String},mapboxToken:{type:String,attribute:"mapbox-token"},googleToken:{type:String,attribute:"google-token"},metadata:{type:Object},disabled:{type:Boolean},open:{type:Boolean,state:!0},query:{type:String,state:!0},activeIndex:{type:Number,state:!0},containerHeight:{type:Number,state:!0},loading:{type:Boolean},saved:{type:Boolean},filteredOptions:{type:Array,state:!0}}}static get styles(){return[e`:host{position:relative;font-family:Helvetica,Arial,sans-serif;display:block}.input-group{color:var(--dt-multi-select-text-color,#0a0a0a);margin-bottom:1rem}.input-group.disabled .field-container,.input-group.disabled input{background-color:var(--disabled-color)}.input-group.disabled a,.input-group.disabled button{cursor:not-allowed;pointer-events:none}.input-group.disabled :hover{cursor:not-allowed}.option-list{list-style:none;margin:0;padding:0;border:1px solid var(--dt-form-border-color,#cacaca);background:var(--dt-form-background-color,#fefefe);z-index:10;position:absolute;width:var(--container-width,100%);width:100%;top:0;left:0;box-shadow:var(--shadow-1);max-height:150px;overflow-y:scroll}.option-list li{border-block-start:1px solid var(--dt-form-border-color,#cacaca);outline:0}.option-list li button,.option-list li div{padding:.5rem .75rem;color:var(--dt-multi-select-text-color,#0a0a0a);font-weight:100;font-size:1rem;text-decoration:none;text-align:inherit}.option-list li button{display:block;width:100%;border:0;background:0 0}.option-list li button.active,.option-list li button:hover{cursor:pointer;background:var(--dt-multi-select-option-hover-background,#f5f5f5)}`,e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-location-map-background-color,#fefefe);border:1px solid var(--dt-location-map-border-color,#fefefe);border-radius:var(--dt-location-map-border-radius,0);box-shadow:var(--dt-location-map-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;line-height:1.5;margin:0;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out)}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-text-disabled-background-color,var(--dt-form-disabled-background-color,#e6e6e6));cursor:not-allowed}input.disabled{color:var(--dt-text-placeholder-color,#999)}input:focus-visible,input:focus-within{outline:0}input::placeholder{color:var(--dt-text-placeholder-color,#999);text-transform:var(--dt-text-placeholder-transform,none);font-size:var(--dt-text-placeholder-font-size,1rem);font-weight:var(--dt-text-placeholder-font-weight,400);letter-spacing:var(--dt-text-placeholder-letter-spacing,normal)}input.invalid{border-color:var(--dt-text-border-color-alert,var(--alert-color))}.field-container{display:flex;margin-bottom:.5rem}.field-container input{flex-grow:1}.field-container .input-addon{flex-shrink:1;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1;padding:10px;border:solid 1px gray;border-collapse:collapse;color:var(--dt-location-map-button-color,#cc4b37);background-color:var(--dt-location-map-background-color,buttonface);border:1px solid var(--dt-location-map-border-color,#fefefe);border-radius:var(--dt-location-map-border-radius,0);box-shadow:var(--dt-location-map-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)))}.field-container .input-addon:hover{background-color:var(--dt-location-map-button-hover-background-color,#cc4b37);color:var(--dt-location-map-button-hover-color,#fff)}.input-addon:disabled{background-color:var(--dt-form-disabled-background-color);color:var(--dt-text-placeholder-color,#999)}.input-addon:disabled:hover{background-color:var(--dt-form-disabled-background-color);color:var(--dt-text-placeholder-color,#999);cursor:not-allowed}`,e`.icon-overlay{position:absolute;inset-inline-end:1rem;top:0;inset-inline-end:3rem;height:100%;display:flex;justify-content:center;align-items:center}.icon-overlay.alert{color:var(--alert-color)}.icon-overlay.success{color:var(--success-color)}`]}constructor(){super(),this.activeIndex=-1,this.filteredOptions=[],this.detectTap=!1,this.debounceTimer=null}connectedCallback(){super.connectedCallback(),this.addEventListener("autofocus",(async t=>{await this.updateComplete;const e=this.shadowRoot.querySelector("input");e&&e.focus()})),this.mapboxToken&&(this.mapboxService=new s(this.mapboxToken)),this.googleToken&&(this.googleGeocodeService=new n(this.googleToken,window,document))}updated(t){this._scrollOptionListToActive();const e=this.shadowRoot.querySelector(".input-group");e.style.getPropertyValue("--container-width")||e.style.setProperty("--container-width",`${e.clientWidth}px`)}_scrollOptionListToActive(){const t=this.shadowRoot.querySelector(".option-list"),e=this.shadowRoot.querySelector("button.active");if(t&&e){const o=e.offsetTop,i=e.offsetTop+e.clientHeight,a=t.scrollTop;i>t.scrollTop+t.clientHeight?t.scrollTo({top:i-t.clientHeight,behavior:"smooth"}):o-1&&(this.activeIndex({label:t.description,place_id:t.place_id,source:"user",raw:t}))),this.loading=!1}catch(t){return console.error(t),this.error=!0,void(this.loading=!1)}}else if(this.mapboxToken&&this.mapboxService){this.loading=!0;const t=await this.mapboxService.searchPlaces(this.query,this.locale);this.filteredOptions=t.map((t=>({lng:t.center[0],lat:t.center[1],level:t.place_type[0],label:t.place_name,source:"user"}))),this.loading=!1}return this.filteredOptions}willUpdate(t){if(super.willUpdate(t),t){if(t.has("query")&&(this.error=!1,clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>this._filterOptions()),300)),!this.containerHeight&&this.shadowRoot.children&&this.shadowRoot.children.length){const t=this.shadowRoot.querySelector(".input-group");t&&(this.containerHeight=t.offsetHeight)}}}_change(){}_delete(){const t={detail:{metadata:this.metadata},bubbles:!1};this.dispatchEvent(new CustomEvent("delete",t))}_openMapModal(){this.shadowRoot.querySelector("dt-map-modal").dispatchEvent(new Event("open"))}async _onMapModalSubmit(t){if(t?.detail?.location?.lat){const{location:e}=t?.detail,{lat:o,lng:i}=e;if(this.googleGeocodeService){const t=await this.googleGeocodeService.reverseGeocode(i,o,this.locale);if(t&&t.length){const e=t[0];this._select({lng:e.geometry.location.lng,lat:e.geometry.location.lat,level:e.types&&e.types.length?e.types[0]:null,label:e.formatted_address,source:"user"})}}else if(this.mapboxService){const t=await this.mapboxService.reverseGeocode(i,o,this.locale);if(t&&t.length){const e=t[0];this._select({lng:e.center[0],lat:e.center[1],level:e.place_type[0],label:e.place_name,source:"user"})}}}}_renderOption(t,e,i){return o`
  • `}_renderOptions(){let t=[];return this.filteredOptions.length?t.push(...this.filteredOptions.map(((t,e)=>this._renderOption(t,e)))):this.loading?t.push(o`
  • ${a("Loading...")}
  • `):t.push(o`
  • ${a("No Data Available")}
  • `),t.push(this._renderOption({value:this.query,label:this.query},(this.filteredOptions||[]).length,o`${a("Use")}: "${this.query}"`)),t}render(){const t={display:this.open?"block":"none",top:this.containerHeight?`${this.containerHeight}px`:"2.5rem"},e=!!this.metadata?.label,a=this.metadata?.lat&&this.metadata?.lng;return o`
    ${e&&a?o``:null} ${e?o``:o``}
      ${this._renderOptions()}
    ${this.touched&&this.invalid||this.error?o``:null} ${this.loading?o``:null} ${this.saved?o``:null}
    `}}); //# sourceMappingURL=dt-location-map-item.js.map diff --git a/dt-assets/build/components/form/dt-location-map/dt-location-map.js b/dt-assets/build/components/form/dt-location-map/dt-location-map.js index d570f7743a..564898998a 100644 --- a/dt-assets/build/components/form/dt-location-map/dt-location-map.js +++ b/dt-assets/build/components/form/dt-location-map/dt-location-map.js @@ -1,120 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { c as i } from '../../repeat-1a2b8966.js'; -import { D as a } from '../dt-form-base.js'; -import './dt-location-map-item.js'; -import '../../directive-de55b00a.js'; -import '../../dt-base.js'; -import '../../lit-localize-763e4978.js'; -import '../dt-label/dt-label.js'; -import '../../style-map-ac85d91b.js'; -import '../../icons/dt-icon.js'; -import './dt-map-modal.js'; -import '../../layout/dt-modal/dt-modal.js'; -import '../../class-map-8d921948.js'; -window.customElements.define( - 'dt-location-map', - class extends a { - static get properties() { - return { - ...super.properties, - placeholder: { type: String }, - value: { type: Array, reflect: !0 }, - locations: { type: Array, state: !0 }, - open: { type: Boolean, state: !0 }, - onchange: { type: String }, - mapboxToken: { type: String, attribute: 'mapbox-token' }, - googleToken: { type: String, attribute: 'google-token' }, - }; - } - static get styles() { - return [ - ...super.styles, - t`:host{font-family:Helvetica,Arial,sans-serif}.input-group{display:flex}.field-container{position:relative}`, - ]; - } - constructor() { - super(), (this.value = []), (this.locations = [{ id: Date.now() }]); - } - _setFormValue(t) { - super._setFormValue(t), this.internals.setFormValue(JSON.stringify(t)); - } - willUpdate(...t) { - super.willUpdate(...t), - this.value && - this.value.filter((t) => !t.id) && - (this.value = [ - ...this.value.map((t) => ({ ...t, id: t.grid_meta_id })), - ]), - this.updateLocationList(); - } - firstUpdated(...t) { - super.firstUpdated(...t), - this.internals.setFormValue(JSON.stringify(this.value)); - } - updated(t) { - if (t.has('value')) { - const e = t.get('value'); - e && e?.length !== this.value?.length && this.focusNewLocation(); - } - if (t.has('locations')) { - const e = t.get('locations'); - e && e?.length !== this.locations?.length && this.focusNewLocation(); - } - } - focusNewLocation() { - const t = this.shadowRoot.querySelectorAll('dt-location-map-item'); - t && t.length && t[t.length - 1].dispatchEvent(new Event('autofocus')); - } - updateLocationList() { - this.disabled || (!this.open && this.value && this.value.length) - ? (this.locations = [...(this.value || []).filter((t) => t.label)]) - : ((this.open = !0), - (this.locations = [ - ...(this.value || []).filter((t) => t.label), - { id: Date.now() }, - ])); - } - selectLocation(t) { - const e = new CustomEvent('change', { - detail: { field: this.name, oldValue: this.value }, - }), - i = { ...t.detail.metadata, id: Date.now() }; - (this.value = [...(this.value || []).filter((t) => t.label), i]), - this.updateLocationList(), - (e.detail.newValue = this.value), - this.dispatchEvent(e), - this._setFormValue(this.value); - } - deleteItem(t) { - const e = new CustomEvent('change', { - detail: { field: this.name, oldValue: this.value }, - }), - i = t.detail?.metadata, - a = i?.grid_meta_id; - (this.value = a - ? (this.value || []).filter((t) => t.grid_meta_id !== a) - : (this.value || []).filter((t) => t.lat !== i.lat && t.lng !== i.lng)), - this.updateLocationList(), - (e.detail.newValue = this.value), - this.dispatchEvent(e), - this._setFormValue(this.value); - } - addNew() { - (this.open = !0), this.updateLocationList(); - } - renderItem(t) { - return e``; - } - render() { - return ( - this.value, - e`${this.labelTemplate()} ${i( - this.locations || [], - (t) => t.id, - (t, e) => this.renderItem(t, e), - )} ${this.open ? null : e``}` - ); - } - }, -); +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{c as i}from"../../repeat-1a2b8966.js";import{D as a}from"../dt-form-base.js";import"./dt-location-map-item.js";import"../../directive-de55b00a.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";import"../../style-map-ac85d91b.js";import"../../icons/dt-icon.js";import"./dt-map-modal.js";import"../../layout/dt-modal/dt-modal.js";import"../../class-map-8d921948.js";window.customElements.define("dt-location-map",class extends a{static get properties(){return{...super.properties,placeholder:{type:String},value:{type:Array,reflect:!0},locations:{type:Array,state:!0},open:{type:Boolean,state:!0},onchange:{type:String},mapboxToken:{type:String,attribute:"mapbox-token"},googleToken:{type:String,attribute:"google-token"}}}static get styles(){return[...super.styles,t`:host{font-family:Helvetica,Arial,sans-serif}.input-group{display:flex}.field-container{position:relative}`]}constructor(){super(),this.value=[],this.locations=[{id:Date.now()}]}_setFormValue(t){super._setFormValue(t),this.internals.setFormValue(JSON.stringify(t))}willUpdate(...t){super.willUpdate(...t),this.value&&this.value.filter((t=>!t.id))&&(this.value=[...this.value.map((t=>({...t,id:t.grid_meta_id})))]),this.updateLocationList()}firstUpdated(...t){super.firstUpdated(...t),this.internals.setFormValue(JSON.stringify(this.value))}updated(t){if(t.has("value")){const e=t.get("value");e&&e?.length!==this.value?.length&&this.focusNewLocation()}if(t.has("locations")){const e=t.get("locations");e&&e?.length!==this.locations?.length&&this.focusNewLocation()}}focusNewLocation(){const t=this.shadowRoot.querySelectorAll("dt-location-map-item");t&&t.length&&t[t.length-1].dispatchEvent(new Event("autofocus"))}updateLocationList(){this.disabled||!this.open&&this.value&&this.value.length?this.locations=[...(this.value||[]).filter((t=>t.label))]:(this.open=!0,this.locations=[...(this.value||[]).filter((t=>t.label)),{id:Date.now()}])}selectLocation(t){const e=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value}}),i={...t.detail.metadata,id:Date.now()};this.value=[...(this.value||[]).filter((t=>t.label)),i],this.updateLocationList(),e.detail.newValue=this.value,this.dispatchEvent(e),this._setFormValue(this.value)}deleteItem(t){const e=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value}}),i=t.detail?.metadata,a=i?.grid_meta_id;this.value=a?(this.value||[]).filter((t=>t.grid_meta_id!==a)):(this.value||[]).filter((t=>t.lat!==i.lat&&t.lng!==i.lng)),this.updateLocationList(),e.detail.newValue=this.value,this.dispatchEvent(e),this._setFormValue(this.value)}addNew(){this.open=!0,this.updateLocationList()}renderItem(t){return e``}render(){return this.value,e`${this.labelTemplate()} ${i(this.locations||[],(t=>t.id),((t,e)=>this.renderItem(t,e)))} ${this.open?null:e``}`}}); //# sourceMappingURL=dt-location-map.js.map diff --git a/dt-assets/build/components/form/dt-location-map/dt-map-modal.js b/dt-assets/build/components/form/dt-location-map/dt-map-modal.js index 0f46e48184..2cf19c4a85 100644 --- a/dt-assets/build/components/form/dt-location-map/dt-map-modal.js +++ b/dt-assets/build/components/form/dt-location-map/dt-map-modal.js @@ -1,121 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { m as a } from '../../lit-localize-763e4978.js'; -import { D as i } from '../../dt-base.js'; -import '../../layout/dt-modal/dt-modal.js'; -import '../../class-map-8d921948.js'; -import '../../directive-de55b00a.js'; -import '../../style-map-ac85d91b.js'; -window.customElements.define( - 'dt-map-modal', - class extends i { - static get properties() { - return { - ...super.properties, - title: { type: String }, - isOpen: { type: Boolean }, - canEdit: { type: Boolean, state: !0 }, - metadata: { type: Object }, - center: { type: Array }, - mapboxToken: { type: String, attribute: 'mapbox-token' }, - }; - } - static get styles() { - return [t`.map{width:100%;min-width:50vw;min-height:50dvb}`]; - } - constructor() { - super(), - this.addEventListener('open', (t) => { - this.shadowRoot - .querySelector('dt-modal') - .dispatchEvent(new Event('open')), - (this.isOpen = !0); - }), - this.addEventListener('close', (t) => { - this.shadowRoot - .querySelector('dt-modal') - .dispatchEvent(new Event('close')), - (this.isOpen = !1); - }); - } - connectedCallback() { - if ( - (super.connectedCallback(), - (this.canEdit = !this.metadata), - window.mapboxgl) - ) - this.initMap(); - else { - let t = document.createElement('script'); - (t.src = 'https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.js'), - (t.onload = this.initMap.bind(this)), - document.body.appendChild(t), - console.log('injected script'); - } - } - initMap() { - if (!this.isOpen || !window.mapboxgl || !this.mapboxToken) return; - const t = this.shadowRoot.querySelector('#map'); - if (t && !this.map) { - (this.map = new window.mapboxgl.Map({ - accessToken: this.mapboxToken, - container: t, - style: 'mapbox://styles/mapbox/streets-v12', - minZoom: 1, - })), - this.map.on('load', () => this.map.resize()), - this.center && - this.center.length && - (this.map.setCenter(this.center), this.map.setZoom(15)); - const e = new mapboxgl.NavigationControl(); - this.map.addControl(e, 'bottom-right'), - this.addPinFromMetadata(), - this.map.on('click', (t) => { - this.canEdit && - (this.marker - ? this.marker.setLngLat(t.lngLat) - : (this.marker = new mapboxgl.Marker() - .setLngLat(t.lngLat) - .addTo(this.map))); - }); - } - } - addPinFromMetadata() { - if (this.metadata) { - const { lng: t, lat: e, level: a } = this.metadata; - let i = 15; - 'admin0' === a - ? (i = 3) - : 'admin1' === a - ? (i = 6) - : 'admin2' === a && (i = 10), - this.map && - (this.map.setCenter([t, e]), - this.map.setZoom(i), - (this.marker = new mapboxgl.Marker() - .setLngLat([t, e]) - .addTo(this.map))); - } - } - updated(t) { - window.mapboxgl && - (t.has('metadata') && - this.metadata && - this.metadata.lat && - this.addPinFromMetadata(), - t.has('isOpen') && this.isOpen && this.initMap()); - } - onClose(t) { - 'button' === t?.detail?.action && - this.marker && - this.dispatchEvent( - new CustomEvent('submit', { - detail: { location: this.marker.getLngLat() }, - }), - ); - } - render() { - return e`
    ${this.canEdit ? e`
    ${a('Save')}
    ` : null}
    `; - } - }, -); +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{m as a}from"../../lit-localize-763e4978.js";import{D as i}from"../../dt-base.js";import"../../layout/dt-modal/dt-modal.js";import"../../class-map-8d921948.js";import"../../directive-de55b00a.js";import"../../style-map-ac85d91b.js";window.customElements.define("dt-map-modal",class extends i{static get properties(){return{...super.properties,title:{type:String},isOpen:{type:Boolean},canEdit:{type:Boolean,state:!0},metadata:{type:Object},center:{type:Array},mapboxToken:{type:String,attribute:"mapbox-token"}}}static get styles(){return[t`.map{width:100%;min-width:50vw;min-height:50dvb}`]}constructor(){super(),this.addEventListener("open",(t=>{this.shadowRoot.querySelector("dt-modal").dispatchEvent(new Event("open")),this.isOpen=!0})),this.addEventListener("close",(t=>{this.shadowRoot.querySelector("dt-modal").dispatchEvent(new Event("close")),this.isOpen=!1}))}connectedCallback(){if(super.connectedCallback(),this.canEdit=!this.metadata,window.mapboxgl)this.initMap();else{let t=document.createElement("script");t.src="https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.js",t.onload=this.initMap.bind(this),document.body.appendChild(t),console.log("injected script")}}initMap(){if(!this.isOpen||!window.mapboxgl||!this.mapboxToken)return;const t=this.shadowRoot.querySelector("#map");if(t&&!this.map){this.map=new window.mapboxgl.Map({accessToken:this.mapboxToken,container:t,style:"mapbox://styles/mapbox/streets-v12",minZoom:1}),this.map.on("load",(()=>this.map.resize())),this.center&&this.center.length&&(this.map.setCenter(this.center),this.map.setZoom(15));const e=new mapboxgl.NavigationControl;this.map.addControl(e,"bottom-right"),this.addPinFromMetadata(),this.map.on("click",(t=>{this.canEdit&&(this.marker?this.marker.setLngLat(t.lngLat):this.marker=(new mapboxgl.Marker).setLngLat(t.lngLat).addTo(this.map))}))}}addPinFromMetadata(){if(this.metadata){const{lng:t,lat:e,level:a}=this.metadata;let i=15;"admin0"===a?i=3:"admin1"===a?i=6:"admin2"===a&&(i=10),this.map&&(this.map.setCenter([t,e]),this.map.setZoom(i),this.marker=(new mapboxgl.Marker).setLngLat([t,e]).addTo(this.map))}}updated(t){window.mapboxgl&&(t.has("metadata")&&this.metadata&&this.metadata.lat&&this.addPinFromMetadata(),t.has("isOpen")&&this.isOpen&&this.initMap())}onClose(t){"button"===t?.detail?.action&&this.marker&&this.dispatchEvent(new CustomEvent("submit",{detail:{location:this.marker.getLngLat()}}))}render(){return e`
    ${this.canEdit?e`
    ${a("Save")}
    `:null}
    `}}); //# sourceMappingURL=dt-map-modal.js.map diff --git a/dt-assets/build/components/form/dt-location/dt-location.js b/dt-assets/build/components/form/dt-location/dt-location.js index 041fc6b6fe..27a25a8a6a 100644 --- a/dt-assets/build/components/form/dt-location/dt-location.js +++ b/dt-assets/build/components/form/dt-location/dt-location.js @@ -1,137 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { i } from '../../style-map-ac85d91b.js'; -import { o as s } from '../../map-c0e24c36.js'; -import { D as l } from '../dt-tags/dt-tags.js'; -import '../../directive-de55b00a.js'; -import '../dt-multi-select/dt-multi-select.js'; -import '../../lit-localize-763e4978.js'; -import '../dt-form-base.js'; -import '../../dt-base.js'; -import '../dt-label/dt-label.js'; -import '../mixins/hasOptionsList.js'; -import '../../icons/dt-spinner.js'; -import '../../icons/dt-checkmark.js'; -window.customElements.define( - 'dt-location', - class extends l { - static get properties() { - return { - ...super.properties, - filters: { type: Array }, - mapboxKey: { type: String }, - dtMapbox: { type: Object }, - }; - } - static get styles() { - return [ - ...super.styles, - t`.input-group{display:flex}.field-container{position:relative}select{border:1px solid var(--dt-form-border-color,#cacaca);outline:0}.selected-option>:first-child{max-width:calc(var(--container-width) - var(--select-width) - var(--container-padding) - var(--option-padding) - var(--option-button) - 8px)}`, - ]; - } - _clickOption(t) { - if (t.target && t.target.value) { - const e = t.target.value, - i = this.filteredOptions.reduce( - (t, i) => (t || i.id !== e ? t : i), - null, - ); - this._select(i); - } - } - _clickAddNew(t) { - if (t.target) { - this._select({ - id: t.target.dataset?.label, - label: t.target.dataset?.label, - isNew: !0, - }); - const e = this.shadowRoot.querySelector('input'); - e && (e.value = ''); - } - } - _keyboardSelectOption() { - this.activeIndex > -1 && - (this.activeIndex + 1 > this.filteredOptions.length - ? this._select({ id: this.query, label: this.query, isNew: !0 }) - : this._select(this.filteredOptions[this.activeIndex])); - } - _remove(t) { - if (t.target && t.target.dataset && t.target.dataset.value) { - const e = new CustomEvent('change', { - detail: { field: this.name, oldValue: this.value }, - }); - (this.value = (this.value || []).map((e) => { - const i = { ...e }; - return e.id === t.target.dataset.value && (i.delete = !0), i; - })), - (e.detail.newValue = this.value), - this.dispatchEvent(e), - this.open && this.shadowRoot.querySelector('input').focus(); - } - } - updated() { - super.updated(); - const t = this.shadowRoot.querySelector('.input-group'), - e = t.style.getPropertyValue('--select-width'), - i = this.shadowRoot.querySelector('select'); - !e && - i?.clientWidth > 0 && - t.style.setProperty('--select-width', `${i.clientWidth}px`); - } - _filterOptions() { - const t = (this.value || []).filter((t) => !t.delete).map((t) => t?.id); - if (this.options?.length) - this.filteredOptions = (this.options || []).filter( - (e) => - !t.includes(e.id) && - (!this.query || - e.label - .toLocaleLowerCase() - .includes(this.query.toLocaleLowerCase())), - ); - else { - (this.loading = !0), (this.filteredOptions = []); - const e = this, - i = this.shadowRoot.querySelector('select'), - s = new CustomEvent('load', { - bubbles: !0, - detail: { - field: this.name, - query: this.query, - filter: i?.value, - onSuccess: (i) => { - (e.loading = !1), - (e.filteredOptions = i.filter((e) => !t.includes(e.id))); - }, - onError: (t) => { - console.warn(t), (e.loading = !1); - }, - }, - }); - this.dispatchEvent(s); - } - return this.filteredOptions; - } - _renderOption(t, i) { - return e`
  • `; - } - _renderSelectedOptions() { - return (this.value || []) - .filter((t) => !t.delete) - .map( - (t) => - e``, - ); - } - render() { - const t = { - display: this.open ? 'block' : 'none', - top: `${this.containerHeight}px`, - }; - return this.mapboxKey - ? e`${this.labelTemplate()}
    ` - : e`${this.labelTemplate()}
    ${this._renderSelectedOptions()} ${this.loading ? e`` : null} ${this.saved ? e`` : null}
      ${this._renderOptions()}
    `; - } - }, -); +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{i}from"../../style-map-ac85d91b.js";import{o as s}from"../../map-c0e24c36.js";import{D as l}from"../dt-tags/dt-tags.js";import"../../directive-de55b00a.js";import"../dt-multi-select/dt-multi-select.js";import"../../lit-localize-763e4978.js";import"../dt-form-base.js";import"../../dt-base.js";import"../dt-label/dt-label.js";import"../mixins/hasOptionsList.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";window.customElements.define("dt-location",class extends l{static get properties(){return{...super.properties,filters:{type:Array},mapboxKey:{type:String},dtMapbox:{type:Object}}}static get styles(){return[...super.styles,t`.input-group{display:flex}.field-container{position:relative}select{border:1px solid var(--dt-form-border-color,#cacaca);outline:0}.selected-option>:first-child{max-width:calc(var(--container-width) - var(--select-width) - var(--container-padding) - var(--option-padding) - var(--option-button) - 8px)}`]}_clickOption(t){if(t.target&&t.target.value){const e=t.target.value,i=this.filteredOptions.reduce(((t,i)=>t||i.id!==e?t:i),null);this._select(i)}}_clickAddNew(t){if(t.target){this._select({id:t.target.dataset?.label,label:t.target.dataset?.label,isNew:!0});const e=this.shadowRoot.querySelector("input");e&&(e.value="")}}_keyboardSelectOption(){this.activeIndex>-1&&(this.activeIndex+1>this.filteredOptions.length?this._select({id:this.query,label:this.query,isNew:!0}):this._select(this.filteredOptions[this.activeIndex]))}_remove(t){if(t.target&&t.target.dataset&&t.target.dataset.value){const e=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value}});this.value=(this.value||[]).map((e=>{const i={...e};return e.id===t.target.dataset.value&&(i.delete=!0),i})),e.detail.newValue=this.value,this.dispatchEvent(e),this.open&&this.shadowRoot.querySelector("input").focus()}}updated(){super.updated();const t=this.shadowRoot.querySelector(".input-group"),e=t.style.getPropertyValue("--select-width"),i=this.shadowRoot.querySelector("select");!e&&i?.clientWidth>0&&t.style.setProperty("--select-width",`${i.clientWidth}px`)}_filterOptions(){const t=(this.value||[]).filter((t=>!t.delete)).map((t=>t?.id));if(this.options?.length)this.filteredOptions=(this.options||[]).filter((e=>!t.includes(e.id)&&(!this.query||e.label.toLocaleLowerCase().includes(this.query.toLocaleLowerCase()))));else{this.loading=!0,this.filteredOptions=[];const e=this,i=this.shadowRoot.querySelector("select"),s=new CustomEvent("load",{bubbles:!0,detail:{field:this.name,query:this.query,filter:i?.value,onSuccess:i=>{e.loading=!1,e.filteredOptions=i.filter((e=>!t.includes(e.id)))},onError:t=>{console.warn(t),e.loading=!1}}});this.dispatchEvent(s)}return this.filteredOptions}_renderOption(t,i){return e`
  • `}_renderSelectedOptions(){return(this.value||[]).filter((t=>!t.delete)).map((t=>e``))}render(){const t={display:this.open?"block":"none",top:`${this.containerHeight}px`};return this.mapboxKey?e`${this.labelTemplate()}
    `:e`${this.labelTemplate()}
    ${this._renderSelectedOptions()} ${this.loading?e``:null} ${this.saved?e``:null}
      ${this._renderOptions()}
    `}}); //# sourceMappingURL=dt-location.js.map diff --git a/dt-assets/build/components/form/dt-multi-select/dt-multi-select.js b/dt-assets/build/components/form/dt-multi-select/dt-multi-select.js index e44b3c661e..088b1ba11b 100644 --- a/dt-assets/build/components/form/dt-multi-select/dt-multi-select.js +++ b/dt-assets/build/components/form/dt-multi-select/dt-multi-select.js @@ -1,112 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { i } from '../../style-map-ac85d91b.js'; -import '../../lit-localize-763e4978.js'; -import { D as o } from '../dt-form-base.js'; -import { H as r } from '../mixins/hasOptionsList.js'; -import '../../icons/dt-spinner.js'; -import '../../icons/dt-checkmark.js'; -import '../../directive-de55b00a.js'; -import '../../dt-base.js'; -import '../dt-label/dt-label.js'; -class l extends r(o) { - static get styles() { - return [ - ...super.styles, - t`:host{position:relative;font-family:Helvetica,Arial,sans-serif}.input-group{color:var(--dt-multi-select-text-color,#0a0a0a);margin-bottom:1rem}.input-group.disabled .field-container,.input-group.disabled input{background-color:var(--disabled-color)}.input-group.disabled a,.input-group.disabled button{cursor:not-allowed;pointer-events:none}.input-group.disabled :hover{cursor:not-allowed}.field-container{background-color:var(--dt-multi-select-background-color,#fefefe);border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;color:var(--dt-multi-select-text-color,#0a0a0a);font-size:1rem;font-weight:300;min-height:2.5rem;line-height:1.5;margin:0;padding-top:calc(.5rem - .375rem);padding-bottom:.5rem;padding-inline:.5rem 1.6rem;box-sizing:border-box;width:100%;text-transform:none;display:flex;flex-wrap:wrap}.field-container .selected-option,.field-container input{height:1.25rem}.selected-option{border:1px solid var(--dt-multi-select-tag-border-color,#c2e0ff);background-color:var(--dt-multi-select-tag-background-color,#c2e0ff);display:flex;font-size:.875rem;position:relative;border-radius:2px;margin-inline-end:4px;margin-block-start:.375rem;box-sizing:border-box}.selected-option>:first-child{padding-inline-start:4px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;--container-padding:calc(0.5rem + 1.6rem + 2px);--option-padding:8px;--option-button:20px;max-width:calc(var(--container-width) - var(--container-padding) - var(--option-padding) - var(--option-button))}.selected-option *{align-self:center}.selected-option button{background:0 0;outline:0;border:0;border-inline-start:1px solid var(--dt-multi-select-tag-border-color,#c2e0ff);color:var(--dt-multi-select-text-color,#0a0a0a);margin-inline-start:4px}.selected-option button:hover{cursor:pointer}.field-container input{background-color:var(--dt-form-background-color,#fff);color:var(--dt-form-text-color,#000);flex-grow:1;min-width:50px;border:0;margin-block-start:.375rem}.field-container input:active,.field-container input:focus,.field-container input:focus-visible{border:0;outline:0}.field-container input::placeholder{color:var(--dt-text-placeholder-color,#999);opacity:1}.option-list{list-style:none;margin:0;padding:0;border:1px solid var(--dt-form-border-color,#cacaca);background:var(--dt-form-background-color,#fefefe);z-index:10;position:absolute;width:100%;top:0;left:0;box-shadow:var(--shadow-1);max-height:150px;overflow-y:scroll}.option-list li{border-block-start:1px solid var(--dt-form-border-color,#cacaca);outline:0}.option-list li button,.option-list li div{padding:.5rem .75rem;color:var(--dt-multi-select-text-color,#0a0a0a);font-weight:100;font-size:1rem;text-decoration:none;text-align:inherit}.option-list li button{display:block;width:100%;border:0;background:0 0}.option-list li button.active,.option-list li button:hover{cursor:pointer;background:var(--dt-multi-select-option-hover-background,#f5f5f5)}`, - ]; - } - static get properties() { - return { - ...super.properties, - placeholder: { type: String }, - containerHeight: { type: Number, state: !0 }, - onchange: { type: String }, - }; - } - connectedCallback() { - super.connectedCallback(), - this.value && - this.value.length && - (this.value = this.value.map((t) => (t.id ? t.label : t))); - } - _select(t) { - const e = new CustomEvent('change', { - bubbles: !0, - detail: { field: this.name, oldValue: this.value }, - }); - if (this.value && this.value.length) - if ('string' == typeof this.value[0]) - this.value = [...this.value.filter((e) => e !== `-${t}`), t]; - else { - let e = !1; - const i = this.value.map((i) => { - const o = { ...i }; - return i.id === t.id && i.delete && (delete o.delete, (e = !0)), o; - }); - e || i.push(t), (this.value = i); - } - else this.value = [t]; - (e.detail.newValue = this.value), - (this.open = !1), - (this.activeIndex = -1), - this.dispatchEvent(e), - this._setFormValue(this.value); - } - _remove(t) { - if (t.target && t.target.dataset && t.target.dataset.value) { - const e = new CustomEvent('change', { - bubbles: !0, - detail: { field: this.name, oldValue: this.value }, - }); - (this.value = (this.value || []).map((e) => - e === t.target.dataset.value ? `-${e}` : e, - )), - (e.detail.newValue = this.value), - this.dispatchEvent(e), - this._setFormValue(this.value), - this.open && this.shadowRoot.querySelector('input').focus(); - } - } - _filterOptions() { - return ( - (this.filteredOptions = (this.options || []).filter( - (t) => - !(this.value || []).includes(t.id) && - (!this.query || - t.label - .toLocaleLowerCase() - .includes(this.query.toLocaleLowerCase())), - )), - this.filteredOptions - ); - } - willUpdate(t) { - if ((super.willUpdate(t), t)) { - const e = t.has('value'), - i = t.has('query'), - o = t.has('options'); - (e || i || o) && this._filterOptions(); - } - } - _renderSelectedOptions() { - return ( - this.options && - this.options - .filter((t) => this.value && this.value.indexOf(t.id) > -1) - .map( - (t) => - e`
    ${t.label}
    `, - ) - ); - } - render() { - const t = { - display: this.open ? 'block' : 'none', - top: this.containerHeight ? `${this.containerHeight}px` : '2.5rem', - }; - return e`${this.labelTemplate()}
    ${this._renderSelectedOptions()}
      ${this._renderOptions()}
    ${this.loading ? e`` : null} ${this.saved ? e`` : null} ${this.error ? e`` : null}
    `; - } -} -window.customElements.define('dt-multi-select', l); -export { l as D }; +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{i}from"../../style-map-ac85d91b.js";import"../../lit-localize-763e4978.js";import{D as o}from"../dt-form-base.js";import{H as r}from"../mixins/hasOptionsList.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";import"../../directive-de55b00a.js";import"../../dt-base.js";import"../dt-label/dt-label.js";class l extends(r(o)){static get styles(){return[...super.styles,t`:host{position:relative;font-family:Helvetica,Arial,sans-serif}.input-group{color:var(--dt-multi-select-text-color,#0a0a0a);margin-bottom:1rem}.input-group.disabled .field-container,.input-group.disabled input{background-color:var(--disabled-color)}.input-group.disabled a,.input-group.disabled button{cursor:not-allowed;pointer-events:none}.input-group.disabled :hover{cursor:not-allowed}.field-container{background-color:var(--dt-multi-select-background-color,#fefefe);border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;color:var(--dt-multi-select-text-color,#0a0a0a);font-size:1rem;font-weight:300;min-height:2.5rem;line-height:1.5;margin:0;padding-top:calc(.5rem - .375rem);padding-bottom:.5rem;padding-inline:.5rem 1.6rem;box-sizing:border-box;width:100%;text-transform:none;display:flex;flex-wrap:wrap}.field-container .selected-option,.field-container input{height:1.25rem}.selected-option{border:1px solid var(--dt-multi-select-tag-border-color,#c2e0ff);background-color:var(--dt-multi-select-tag-background-color,#c2e0ff);display:flex;font-size:.875rem;position:relative;border-radius:2px;margin-inline-end:4px;margin-block-start:.375rem;box-sizing:border-box}.selected-option>:first-child{padding-inline-start:4px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;--container-padding:calc(0.5rem + 1.6rem + 2px);--option-padding:8px;--option-button:20px;max-width:calc(var(--container-width) - var(--container-padding) - var(--option-padding) - var(--option-button))}.selected-option *{align-self:center}.selected-option button{background:0 0;outline:0;border:0;border-inline-start:1px solid var(--dt-multi-select-tag-border-color,#c2e0ff);color:var(--dt-multi-select-text-color,#0a0a0a);margin-inline-start:4px}.selected-option button:hover{cursor:pointer}.field-container input{background-color:var(--dt-form-background-color,#fff);color:var(--dt-form-text-color,#000);flex-grow:1;min-width:50px;border:0;margin-block-start:.375rem}.field-container input:active,.field-container input:focus,.field-container input:focus-visible{border:0;outline:0}.field-container input::placeholder{color:var(--dt-text-placeholder-color,#999);opacity:1}.option-list{list-style:none;margin:0;padding:0;border:1px solid var(--dt-form-border-color,#cacaca);background:var(--dt-form-background-color,#fefefe);z-index:10;position:absolute;width:100%;top:0;left:0;box-shadow:var(--shadow-1);max-height:150px;overflow-y:scroll}.option-list li{border-block-start:1px solid var(--dt-form-border-color,#cacaca);outline:0}.option-list li button,.option-list li div{padding:.5rem .75rem;color:var(--dt-multi-select-text-color,#0a0a0a);font-weight:100;font-size:1rem;text-decoration:none;text-align:inherit}.option-list li button{display:block;width:100%;border:0;background:0 0}.option-list li button.active,.option-list li button:hover{cursor:pointer;background:var(--dt-multi-select-option-hover-background,#f5f5f5)}`]}static get properties(){return{...super.properties,placeholder:{type:String},containerHeight:{type:Number,state:!0},onchange:{type:String}}}connectedCallback(){super.connectedCallback(),this.value&&this.value.length&&(this.value=this.value.map((t=>t.id?t.label:t)))}_select(t){const e=new CustomEvent("change",{bubbles:!0,detail:{field:this.name,oldValue:this.value}});if(this.value&&this.value.length)if("string"==typeof this.value[0])this.value=[...this.value.filter((e=>e!==`-${t}`)),t];else{let e=!1;const i=this.value.map((i=>{const o={...i};return i.id===t.id&&i.delete&&(delete o.delete,e=!0),o}));e||i.push(t),this.value=i}else this.value=[t];e.detail.newValue=this.value,this.open=!1,this.activeIndex=-1,this.dispatchEvent(e),this._setFormValue(this.value)}_remove(t){if(t.target&&t.target.dataset&&t.target.dataset.value){const e=new CustomEvent("change",{bubbles:!0,detail:{field:this.name,oldValue:this.value}});this.value=(this.value||[]).map((e=>e===t.target.dataset.value?`-${e}`:e)),e.detail.newValue=this.value,this.dispatchEvent(e),this._setFormValue(this.value),this.open&&this.shadowRoot.querySelector("input").focus()}}_filterOptions(){return this.filteredOptions=(this.options||[]).filter((t=>!(this.value||[]).includes(t.id)&&(!this.query||t.label.toLocaleLowerCase().includes(this.query.toLocaleLowerCase())))),this.filteredOptions}willUpdate(t){if(super.willUpdate(t),t){const e=t.has("value"),i=t.has("query"),o=t.has("options");(e||i||o)&&this._filterOptions()}}_renderSelectedOptions(){return this.options&&this.options.filter((t=>this.value&&this.value.indexOf(t.id)>-1)).map((t=>e`
    ${t.label}
    `))}render(){const t={display:this.open?"block":"none",top:this.containerHeight?`${this.containerHeight}px`:"2.5rem"};return e`${this.labelTemplate()}
    ${this._renderSelectedOptions()}
      ${this._renderOptions()}
    ${this.loading?e``:null} ${this.saved?e``:null} ${this.error?e``:null}
    `}}window.customElements.define("dt-multi-select",l);export{l as D}; //# sourceMappingURL=dt-multi-select.js.map diff --git a/dt-assets/build/components/form/dt-number/dt-number.js b/dt-assets/build/components/form/dt-number/dt-number.js index e575aa1c75..4ebae73e4b 100644 --- a/dt-assets/build/components/form/dt-number/dt-number.js +++ b/dt-assets/build/components/form/dt-number/dt-number.js @@ -1,67 +1,2 @@ -import { i as e, y as t } from '../../lit-element-2409d5fe.js'; -import { l as r } from '../../if-defined-11ddebeb.js'; -import { D as o } from '../dt-form-base.js'; -import { A as a } from '../../dt-base.js'; -import '../dt-label/dt-label.js'; -import '../../lit-localize-763e4978.js'; -window.customElements.define( - 'dt-number', - class extends o { - static get styles() { - return [ - ...super.styles, - e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-form-background-color,#fff);border:1px solid var(--dt-form-border-color,#ccc);border-radius:0;box-shadow:var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out)}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-form-disabled-background-color,#e6e6e6);cursor:not-allowed}input:invalid{border-color:var(--dt-form-invalid-border-color,#dc3545)}`, - ]; - } - static get properties() { - return { - ...super.properties, - id: { type: String }, - value: { type: String, reflect: !0 }, - oldValue: { type: String }, - min: { type: Number }, - max: { type: Number }, - loading: { type: Boolean }, - saved: { type: Boolean }, - onchange: { type: String }, - }; - } - connectedCallback() { - super.connectedCallback(), (this.oldValue = this.value); - } - _checkValue(e) { - return !(e < this.min || e > this.max); - } - async onChange(e) { - if (this._checkValue(e.target.value)) { - const t = new CustomEvent('change', { - detail: { - field: this.name, - oldValue: this.value, - newValue: e.target.value, - }, - bubbles: !0, - composed: !0, - }); - (this.value = e.target.value), - this._field.setCustomValidity(''), - this.dispatchEvent(t), - (this.api = new a(this.nonce, `${this.apiRoot}`)); - } else e.currentTarget.value = ''; - } - handleError(e = 'An error occurred.') { - let t = e; - t instanceof Error - ? (console.error(t), (t = t.message)) - : console.error(t), - (this.error = t), - this._field.setCustomValidity(t), - (this.invalid = !0), - (this.value = this.oldValue); - } - render() { - return t`${this.labelTemplate()} `; - } - }, -); +import{i as e,y as t}from"../../lit-element-2409d5fe.js";import{l as r}from"../../if-defined-11ddebeb.js";import{D as o}from"../dt-form-base.js";import{A as a}from"../../dt-base.js";import"../dt-label/dt-label.js";import"../../lit-localize-763e4978.js";window.customElements.define("dt-number",class extends o{static get styles(){return[...super.styles,e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-form-background-color,#fff);border:1px solid var(--dt-form-border-color,#ccc);border-radius:0;box-shadow:var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out)}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-form-disabled-background-color,#e6e6e6);cursor:not-allowed}input:invalid{border-color:var(--dt-form-invalid-border-color,#dc3545)}`]}static get properties(){return{...super.properties,id:{type:String},value:{type:String,reflect:!0},oldValue:{type:String},min:{type:Number},max:{type:Number},loading:{type:Boolean},saved:{type:Boolean},onchange:{type:String}}}connectedCallback(){super.connectedCallback(),this.oldValue=this.value}_checkValue(e){return!(ethis.max)}async onChange(e){if(this._checkValue(e.target.value)){const t=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value,newValue:e.target.value},bubbles:!0,composed:!0});this.value=e.target.value,this._field.setCustomValidity(""),this.dispatchEvent(t),this.api=new a(this.nonce,`${this.apiRoot}`)}else e.currentTarget.value=""}handleError(e="An error occurred."){let t=e;t instanceof Error?(console.error(t),t=t.message):console.error(t),this.error=t,this._field.setCustomValidity(t),this.invalid=!0,this.value=this.oldValue}render(){return t`${this.labelTemplate()} `}}); //# sourceMappingURL=dt-number.js.map diff --git a/dt-assets/build/components/form/dt-single-select/dt-single-select.js b/dt-assets/build/components/form/dt-single-select/dt-single-select.js index cf70c320f7..aaa9905ed5 100644 --- a/dt-assets/build/components/form/dt-single-select/dt-single-select.js +++ b/dt-assets/build/components/form/dt-single-select/dt-single-select.js @@ -1,56 +1,2 @@ -import { i as e, y as t } from '../../lit-element-2409d5fe.js'; -import { D as o } from '../dt-form-base.js'; -import '../../icons/dt-spinner.js'; -import '../../icons/dt-checkmark.js'; -import '../../dt-base.js'; -import '../../lit-localize-763e4978.js'; -import '../dt-label/dt-label.js'; -window.customElements.define( - 'dt-single-select', - class extends o { - static get styles() { - return [ - ...super.styles, - e`:host{position:relative}select{appearance:none;background-color:var(--dt-form-background-color,#fefefe);background-image:linear-gradient(45deg,transparent 50%,var(--dt-single-select-text-color) 50%),linear-gradient(135deg,var(--dt-single-select-text-color) 50%,transparent 50%);background-position:calc(100% - 20px) calc(1em + 2px),calc(100% - 15px) calc(1em + 2px),calc(100% - 2.5em) .5em;background-size:5px 5px,5px 5px,1px 1.5em;background-repeat:no-repeat;border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;color:var(--dt-single-select-text-color,#0a0a0a);font-family:var(--font-family,sans-serif);font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1rem;padding:.53rem;padding-inline-end:1.6rem;transition:border-color .25s ease-in-out;transition:box-shadow .5s,border-color .25s ease-in-out;box-sizing:border-box;width:100%;text-transform:none}[dir=rtl] select{background-position:15px calc(1em + 2px),20px calc(1em + 2px),2.5em .5em}select.color-select{background-image:url("data:image/svg+xml;utf8,");background-color:var(--dt-form-border-color,#cacaca);border:none;border-radius:10px;color:var(--dt-single-select-text-color-inverse,#fff);font-weight:700;text-shadow:rgb(0 0 0 / 45%) 0 0 6px}.icon-overlay{inset-inline-end:2.5rem}`, - ]; - } - static get properties() { - return { - ...super.properties, - placeholder: { type: String }, - options: { type: Array }, - value: { type: String, reflect: !0 }, - color: { type: String, state: !0 }, - onchange: { type: String }, - }; - } - updateColor() { - if (this.value && this.options) { - const e = this.options.filter((e) => e.id === this.value); - e && e.length && (this.color = e[0].color); - } - } - isColorSelect() { - return (this.options || []).reduce((e, t) => e || t.color, !1); - } - willUpdate(e) { - super.willUpdate(e), e.has('value') && this.updateColor(); - } - _change(e) { - const t = new CustomEvent('change', { - detail: { - field: this.name, - oldValue: this.value, - newValue: e.target.value, - }, - }); - (this.value = e.target.value), - this._setFormValue(this.value), - this.dispatchEvent(t); - } - render() { - return t`${this.labelTemplate()}
    ${this.loading ? t`` : null} ${this.saved ? t`` : null}
    `; - } - }, -); +import{i as e,y as t}from"../../lit-element-2409d5fe.js";import{D as o}from"../dt-form-base.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";window.customElements.define("dt-single-select",class extends o{static get styles(){return[...super.styles,e`:host{position:relative}select{appearance:none;background-color:var(--dt-form-background-color,#fefefe);background-image:linear-gradient(45deg,transparent 50%,var(--dt-single-select-text-color) 50%),linear-gradient(135deg,var(--dt-single-select-text-color) 50%,transparent 50%);background-position:calc(100% - 20px) calc(1em + 2px),calc(100% - 15px) calc(1em + 2px),calc(100% - 2.5em) .5em;background-size:5px 5px,5px 5px,1px 1.5em;background-repeat:no-repeat;border:1px solid var(--dt-form-border-color,#cacaca);border-radius:0;color:var(--dt-single-select-text-color,#0a0a0a);font-family:var(--font-family,sans-serif);font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1rem;padding:.53rem;padding-inline-end:1.6rem;transition:border-color .25s ease-in-out;transition:box-shadow .5s,border-color .25s ease-in-out;box-sizing:border-box;width:100%;text-transform:none}[dir=rtl] select{background-position:15px calc(1em + 2px),20px calc(1em + 2px),2.5em .5em}select.color-select{background-image:url("data:image/svg+xml;utf8,");background-color:var(--dt-form-border-color,#cacaca);border:none;border-radius:10px;color:var(--dt-single-select-text-color-inverse,#fff);font-weight:700;text-shadow:rgb(0 0 0 / 45%) 0 0 6px}.icon-overlay{inset-inline-end:2.5rem}`]}static get properties(){return{...super.properties,placeholder:{type:String},options:{type:Array},value:{type:String,reflect:!0},color:{type:String,state:!0},onchange:{type:String}}}updateColor(){if(this.value&&this.options){const e=this.options.filter((e=>e.id===this.value));e&&e.length&&(this.color=e[0].color)}}isColorSelect(){return(this.options||[]).reduce(((e,t)=>e||t.color),!1)}willUpdate(e){super.willUpdate(e),e.has("value")&&this.updateColor()}_change(e){const t=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value,newValue:e.target.value}});this.value=e.target.value,this._setFormValue(this.value),this.dispatchEvent(t)}render(){return t`${this.labelTemplate()}
    ${this.loading?t``:null} ${this.saved?t``:null}
    `}}); //# sourceMappingURL=dt-single-select.js.map diff --git a/dt-assets/build/components/form/dt-tags/dt-tags.js b/dt-assets/build/components/form/dt-tags/dt-tags.js index 31f9f4769e..8008742dc7 100644 --- a/dt-assets/build/components/form/dt-tags/dt-tags.js +++ b/dt-assets/build/components/form/dt-tags/dt-tags.js @@ -1,100 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { D as i } from '../dt-multi-select/dt-multi-select.js'; -import '../../style-map-ac85d91b.js'; -import '../../directive-de55b00a.js'; -import '../../lit-localize-763e4978.js'; -import '../dt-form-base.js'; -import '../../dt-base.js'; -import '../dt-label/dt-label.js'; -import '../mixins/hasOptionsList.js'; -import '../../icons/dt-spinner.js'; -import '../../icons/dt-checkmark.js'; -class s extends i { - static get properties() { - return { - ...super.properties, - allowAdd: { type: Boolean }, - onload: { type: String }, - }; - } - static get styles() { - return [ - ...super.styles, - t`.selected-option a,.selected-option a:active,.selected-option a:visited{text-decoration:none;color:var(--primary-color,#3f729b)}`, - ]; - } - willUpdate(t) { - if ((super.willUpdate(t), t)) { - !t.has('open') || - !this.open || - (this.filteredOptions && this.filteredOptions.length) || - this._filterOptions(); - } - } - _filterOptions() { - const t = (this.value || []).filter((t) => !t.startsWith('-')); - if (this.options?.length) - this.filteredOptions = (this.options || []).filter( - (e) => - !t.includes(e.id) && - (!this.query || - e.id.toLocaleLowerCase().includes(this.query.toLocaleLowerCase())), - ); - else if (this.open) { - (this.loading = !0), (this.filteredOptions = []); - const e = this, - i = new CustomEvent('load', { - bubbles: !0, - detail: { - field: this.name, - postType: this.postType, - query: this.query, - onSuccess: (i) => { - e.loading = !1; - let s = i; - s.length && - 'string' == typeof s[0] && - (s = s.map((t) => ({ id: t }))), - (e.allOptions = s), - (e.filteredOptions = s.filter((e) => !t.includes(e.id))); - }, - onError: (t) => { - console.warn(t), (e.loading = !1); - }, - }, - }); - this.dispatchEvent(i); - } - return this.filteredOptions; - } - _renderOption(t, i) { - return e`
  • `; - } - _renderSelectedOptions() { - const t = this.options || this.allOptions; - return (this.value || []) - .filter((t) => !t.startsWith('-')) - .map((i) => { - let s, - o = i.label || i.id || i; - if (t) { - const e = t.filter((t) => t === i || t.id === i); - e.length && (o = e[0].label || e[0].id || i); - } - if (!s && window?.SHAREDFUNCTIONS?.createCustomFilter) { - const t = window.SHAREDFUNCTIONS.createCustomFilter(this.name, [i]), - e = this.label || this.name, - o = [{ id: `${this.name}_${i}`, name: `${e}: ${i}` }]; - s = window.SHAREDFUNCTIONS.create_url_for_list_query( - this.postType, - t, - o, - ); - } - return e``; - }); - } -} -window.customElements.define('dt-tags', s); -export { s as D }; +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{D as i}from"../dt-multi-select/dt-multi-select.js";import"../../style-map-ac85d91b.js";import"../../directive-de55b00a.js";import"../../lit-localize-763e4978.js";import"../dt-form-base.js";import"../../dt-base.js";import"../dt-label/dt-label.js";import"../mixins/hasOptionsList.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";class s extends i{static get properties(){return{...super.properties,allowAdd:{type:Boolean},onload:{type:String}}}static get styles(){return[...super.styles,t`.selected-option a,.selected-option a:active,.selected-option a:visited{text-decoration:none;color:var(--primary-color,#3f729b)}`]}willUpdate(t){if(super.willUpdate(t),t){!t.has("open")||!this.open||this.filteredOptions&&this.filteredOptions.length||this._filterOptions()}}_filterOptions(){const t=(this.value||[]).filter((t=>!t.startsWith("-")));if(this.options?.length)this.filteredOptions=(this.options||[]).filter((e=>!t.includes(e.id)&&(!this.query||e.id.toLocaleLowerCase().includes(this.query.toLocaleLowerCase()))));else if(this.open){this.loading=!0,this.filteredOptions=[];const e=this,i=new CustomEvent("load",{bubbles:!0,detail:{field:this.name,postType:this.postType,query:this.query,onSuccess:i=>{e.loading=!1;let s=i;s.length&&"string"==typeof s[0]&&(s=s.map((t=>({id:t})))),e.allOptions=s,e.filteredOptions=s.filter((e=>!t.includes(e.id)))},onError:t=>{console.warn(t),e.loading=!1}}});this.dispatchEvent(i)}return this.filteredOptions}_renderOption(t,i){return e`
  • `}_renderSelectedOptions(){const t=this.options||this.allOptions;return(this.value||[]).filter((t=>!t.startsWith("-"))).map((i=>{let s,o=i.label||i.id||i;if(t){const e=t.filter((t=>t===i||t.id===i));e.length&&(o=e[0].label||e[0].id||i)}if(!s&&window?.SHAREDFUNCTIONS?.createCustomFilter){const t=window.SHAREDFUNCTIONS.createCustomFilter(this.name,[i]),e=this.label||this.name,o=[{id:`${this.name}_${i}`,name:`${e}: ${i}`}];s=window.SHAREDFUNCTIONS.create_url_for_list_query(this.postType,t,o)}return e``}))}}window.customElements.define("dt-tags",s);export{s as D}; //# sourceMappingURL=dt-tags.js.map diff --git a/dt-assets/build/components/form/dt-text/dt-text.js b/dt-assets/build/components/form/dt-text/dt-text.js index 80d54a4b7b..a49965d686 100644 --- a/dt-assets/build/components/form/dt-text/dt-text.js +++ b/dt-assets/build/components/form/dt-text/dt-text.js @@ -1,69 +1,2 @@ -import { i as e, y as t } from '../../lit-element-2409d5fe.js'; -import { o as i } from '../../class-map-8d921948.js'; -import { D as r } from '../dt-form-base.js'; -import '../../icons/dt-spinner.js'; -import '../../icons/dt-checkmark.js'; -import '../../icons/dt-exclamation-circle.js'; -import '../../directive-de55b00a.js'; -import '../../dt-base.js'; -import '../../lit-localize-763e4978.js'; -import '../dt-label/dt-label.js'; -class a extends r { - static get styles() { - return [ - ...super.styles, - e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-text-background-color,#fefefe);border:1px solid var(--dt-text-border-color,#fefefe);border-radius:var(--dt-text-border-radius,0);box-shadow:var(--dt-text-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);width:100%}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-text-disabled-background-color,var(--dt-form-disabled-background-color,#e6e6e6));cursor:copy}input:focus-visible,input:focus-within{outline:0}input::placeholder{color:var(--dt-text-placeholder-color,#999);text-transform:var(--dt-text-placeholder-transform,none);font-size:var(--dt-text-placeholder-font-size,1rem);font-weight:var(--dt-text-placeholder-font-weight,400);letter-spacing:var(--dt-text-placeholder-letter-spacing,normal)}input.invalid{border-color:var(--dt-text-border-color-alert,var(--alert-color))}`, - ]; - } - static get properties() { - return { - ...super.properties, - id: { type: String }, - type: { type: String }, - maxlength: { type: Number }, - placeholder: { type: String }, - value: { type: String, reflect: !0 }, - onchange: { type: String }, - }; - } - _change(e) { - const t = new CustomEvent('change', { - bubbles: !0, - detail: { - field: this.name, - oldValue: this.value, - newValue: e.target.value, - }, - }); - (this.value = e.target.value), - this._setFormValue(this.value), - this.dispatchEvent(t); - } - implicitFormSubmit(e) { - if (13 === (e.keyCode || e.which) && this.internals.form) { - const e = this.internals.form.querySelector('button'); - e && e.click(); - } - } - _validateRequired() { - const { value: e } = this, - t = this.shadowRoot.querySelector('input'); - '' === e && this.required - ? ((this.invalid = !0), - this.internals.setValidity( - { valueMissing: !0 }, - this.requiredMessage || 'This field is required', - t, - )) - : ((this.invalid = !1), this.internals.setValidity({})); - } - get classes() { - return { 'text-input': !0, invalid: this.touched && this.invalid }; - } - render() { - return t`${this.labelTemplate()}
    ${this.touched && this.invalid ? t`` : null} ${this.error ? t`` : null} ${this.loading ? t`` : null} ${this.saved ? t`` : null}
    `; - } -} -window.customElements.define('dt-text', a); -export { a as D }; +import{i as e,y as t}from"../../lit-element-2409d5fe.js";import{o as i}from"../../class-map-8d921948.js";import{D as r}from"../dt-form-base.js";import"../../icons/dt-spinner.js";import"../../icons/dt-checkmark.js";import"../../icons/dt-exclamation-circle.js";import"../../directive-de55b00a.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";class a extends r{static get styles(){return[...super.styles,e`input{color:var(--dt-form-text-color,#000);appearance:none;background-color:var(--dt-text-background-color,#fefefe);border:1px solid var(--dt-text-border-color,#fefefe);border-radius:var(--dt-text-border-radius,0);box-shadow:var(--dt-text-box-shadow,var(--dt-form-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%)));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:2.5rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);width:100%}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-text-disabled-background-color,var(--dt-form-disabled-background-color,#e6e6e6));cursor:copy}input:focus-visible,input:focus-within{outline:0}input::placeholder{color:var(--dt-text-placeholder-color,#999);text-transform:var(--dt-text-placeholder-transform,none);font-size:var(--dt-text-placeholder-font-size,1rem);font-weight:var(--dt-text-placeholder-font-weight,400);letter-spacing:var(--dt-text-placeholder-letter-spacing,normal)}input.invalid{border-color:var(--dt-text-border-color-alert,var(--alert-color))}`]}static get properties(){return{...super.properties,id:{type:String},type:{type:String},maxlength:{type:Number},placeholder:{type:String},value:{type:String,reflect:!0},onchange:{type:String}}}_change(e){const t=new CustomEvent("change",{bubbles:!0,detail:{field:this.name,oldValue:this.value,newValue:e.target.value}});this.value=e.target.value,this._setFormValue(this.value),this.dispatchEvent(t)}implicitFormSubmit(e){if(13===(e.keyCode||e.which)&&this.internals.form){const e=this.internals.form.querySelector("button");e&&e.click()}}_validateRequired(){const{value:e}=this,t=this.shadowRoot.querySelector("input");""===e&&this.required?(this.invalid=!0,this.internals.setValidity({valueMissing:!0},this.requiredMessage||"This field is required",t)):(this.invalid=!1,this.internals.setValidity({}))}get classes(){return{"text-input":!0,invalid:this.touched&&this.invalid}}render(){return t`${this.labelTemplate()}
    ${this.touched&&this.invalid?t``:null} ${this.error?t``:null} ${this.loading?t``:null} ${this.saved?t``:null}
    `}}window.customElements.define("dt-text",a);export{a as D}; //# sourceMappingURL=dt-text.js.map diff --git a/dt-assets/build/components/form/dt-textarea/dt-textarea.js b/dt-assets/build/components/form/dt-textarea/dt-textarea.js index 4c59c6584e..a920fda973 100644 --- a/dt-assets/build/components/form/dt-textarea/dt-textarea.js +++ b/dt-assets/build/components/form/dt-textarea/dt-textarea.js @@ -1,40 +1,2 @@ -import { i as e, y as t } from '../../lit-element-2409d5fe.js'; -import { D as a } from '../dt-form-base.js'; -import '../../dt-base.js'; -import '../../lit-localize-763e4978.js'; -import '../dt-label/dt-label.js'; -window.customElements.define( - 'dt-textarea', - class extends a { - static get styles() { - return [ - ...super.styles, - e`textarea{color:var(--dt-textarea-text-color,#0a0a0a);appearance:none;background-color:var(--dt-textarea-background-color,#fefefe);border:1px solid var(--dt-textarea-border-color,#cecece);border-radius:3px;box-shadow:var(--dt-textarea-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:10rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);overflow:hidden;position:relative;outline:0;resize:none}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-textarea-disabled-background-color,#e6e6e6);cursor:not-allowed}`, - ]; - } - static get properties() { - return { - ...super.properties, - id: { type: String }, - value: { type: String, reflect: !0 }, - loading: { type: Boolean }, - saved: { type: Boolean }, - onchange: { type: String }, - }; - } - onChange(e) { - const t = new CustomEvent('change', { - detail: { - field: this.name, - oldValue: this.value, - newValue: e.target.value, - }, - }); - (this.value = e.target.value), this.dispatchEvent(t); - } - render() { - return t`${this.labelTemplate()} `; - } - }, -); +import{i as e,y as t}from"../../lit-element-2409d5fe.js";import{D as a}from"../dt-form-base.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";window.customElements.define("dt-textarea",class extends a{static get styles(){return[...super.styles,e`textarea{color:var(--dt-textarea-text-color,#0a0a0a);appearance:none;background-color:var(--dt-textarea-background-color,#fefefe);border:1px solid var(--dt-textarea-border-color,#cecece);border-radius:3px;box-shadow:var(--dt-textarea-input-box-shadow,inset 0 1px 2px hsl(0deg 0 4% / 10%));box-sizing:border-box;display:block;font-family:inherit;font-size:1rem;font-weight:300;height:10rem;line-height:1.5;margin:0 0 1.0666666667rem;padding:var(--dt-form-padding,.5333333333rem);transition:var(--dt-form-transition,box-shadow .5s,border-color .25s ease-in-out);overflow:hidden;position:relative;outline:0;resize:none}input:disabled,input[readonly],textarea:disabled,textarea[readonly]{background-color:var(--dt-textarea-disabled-background-color,#e6e6e6);cursor:not-allowed}`]}static get properties(){return{...super.properties,id:{type:String},value:{type:String,reflect:!0},loading:{type:Boolean},saved:{type:Boolean},onchange:{type:String}}}onChange(e){const t=new CustomEvent("change",{detail:{field:this.name,oldValue:this.value,newValue:e.target.value}});this.value=e.target.value,this.dispatchEvent(t)}render(){return t`${this.labelTemplate()} `}}); //# sourceMappingURL=dt-textarea.js.map diff --git a/dt-assets/build/components/form/dt-toggle/dt-toggle.js b/dt-assets/build/components/form/dt-toggle/dt-toggle.js index dca5d8830e..a1fbbaf082 100644 --- a/dt-assets/build/components/form/dt-toggle/dt-toggle.js +++ b/dt-assets/build/components/form/dt-toggle/dt-toggle.js @@ -1,46 +1,2 @@ -import { i as e, y as o } from '../../lit-element-2409d5fe.js'; -import { D as t } from '../dt-form-base.js'; -import '../../dt-base.js'; -import '../../lit-localize-763e4978.js'; -import '../dt-label/dt-label.js'; -window.customElements.define( - 'dt-toggle', - class extends t { - static get styles() { - return [ - ...super.styles, - e`:host{display:inline-block}.Toggle{display:flex;flex-wrap:wrap;align-items:center;position:relative;margin-bottom:1em;cursor:pointer;gap:1ch}button.Toggle{border:0;padding:0;background-color:transparent;font:inherit}.Toggle__input{position:absolute;opacity:0;width:100%;height:100%}.Toggle__display{--offset:0.25em;--diameter:1.2em;display:inline-flex;align-items:center;justify-content:space-around;box-sizing:content-box;width:calc(var(--diameter) * 2 + var(--offset) * 2);height:calc(var(--diameter) + var(--offset) * 2);border:.1em solid rgb(0 0 0 / .2);position:relative;border-radius:100vw;background-color:var(--dt-toggle-background-color-off,#ecf5fc);transition:250ms}.Toggle__display::before{content:'';z-index:2;position:absolute;top:50%;left:var(--offset);box-sizing:border-box;width:var(--diameter);height:var(--diameter);border:.1em solid rgb(0 0 0 / .2);border-radius:50%;background-color:#fff;transform:translate(0,-50%);will-change:transform;transition:inherit}.Toggle:focus .Toggle__display,.Toggle__input:focus+.Toggle__display{outline:1px dotted #212121;outline:1px auto -webkit-focus-ring-color;outline-offset:2px}.Toggle:focus,.Toggle:focus:not(:focus-visible) .Toggle__display,.Toggle__input:focus:not(:focus-visible)+.Toggle__display{outline:0}.Toggle[aria-pressed=true] .Toggle__display,.Toggle__input:checked+.Toggle__display{background-color:var(--primary-color)}.Toggle[aria-pressed=true] .Toggle__display::before,.Toggle__input:checked+.Toggle__display::before{transform:translate(100%,-50%)}.Toggle[disabled] .Toggle__display,.Toggle__input:disabled+.Toggle__display{opacity:.6;filter:grayscale(40%);cursor:not-allowed}[dir=rtl] .Toggle__display::before{left:auto;right:var(--offset)}[dir=rtl] .Toggle[aria-pressed=true]+.Toggle__display::before,[dir=rtl] .Toggle__input:checked+.Toggle__display::before{transform:translate(-100%,-50%)}.Toggle__icon{display:inline-block;width:1em;height:1em;color:inherit;fill:currentcolor;vertical-align:middle;overflow:hidden}.Toggle__icon--cross{color:var(--alert-color);font-size:65%}.Toggle__icon--checkmark{color:var(--success-color)}`, - ]; - } - static get properties() { - return { - ...super.properties, - id: { type: String }, - checked: { type: Boolean, reflect: !0 }, - onchange: { type: String }, - hideIcons: { type: Boolean, default: !0 }, - }; - } - constructor() { - super(), (this.hideIcons = !1); - } - onChange(e) { - const o = new CustomEvent('change', { - detail: { - field: this.name, - oldValue: this.checked, - newValue: e.target.checked, - }, - }); - (this.checked = e.target.checked), - this._setFormValue(this.checked), - this.dispatchEvent(o); - } - render() { - const e = o``, - t = o``; - return o``; - } - }, -); +import{i as e,y as o}from"../../lit-element-2409d5fe.js";import{D as t}from"../dt-form-base.js";import"../../dt-base.js";import"../../lit-localize-763e4978.js";import"../dt-label/dt-label.js";window.customElements.define("dt-toggle",class extends t{static get styles(){return[...super.styles,e`:host{display:inline-block}.Toggle{display:flex;flex-wrap:wrap;align-items:center;position:relative;margin-bottom:1em;cursor:pointer;gap:1ch}button.Toggle{border:0;padding:0;background-color:transparent;font:inherit}.Toggle__input{position:absolute;opacity:0;width:100%;height:100%}.Toggle__display{--offset:0.25em;--diameter:1.2em;display:inline-flex;align-items:center;justify-content:space-around;box-sizing:content-box;width:calc(var(--diameter) * 2 + var(--offset) * 2);height:calc(var(--diameter) + var(--offset) * 2);border:.1em solid rgb(0 0 0 / .2);position:relative;border-radius:100vw;background-color:var(--dt-toggle-background-color-off,#ecf5fc);transition:250ms}.Toggle__display::before{content:'';z-index:2;position:absolute;top:50%;left:var(--offset);box-sizing:border-box;width:var(--diameter);height:var(--diameter);border:.1em solid rgb(0 0 0 / .2);border-radius:50%;background-color:#fff;transform:translate(0,-50%);will-change:transform;transition:inherit}.Toggle:focus .Toggle__display,.Toggle__input:focus+.Toggle__display{outline:1px dotted #212121;outline:1px auto -webkit-focus-ring-color;outline-offset:2px}.Toggle:focus,.Toggle:focus:not(:focus-visible) .Toggle__display,.Toggle__input:focus:not(:focus-visible)+.Toggle__display{outline:0}.Toggle[aria-pressed=true] .Toggle__display,.Toggle__input:checked+.Toggle__display{background-color:var(--primary-color)}.Toggle[aria-pressed=true] .Toggle__display::before,.Toggle__input:checked+.Toggle__display::before{transform:translate(100%,-50%)}.Toggle[disabled] .Toggle__display,.Toggle__input:disabled+.Toggle__display{opacity:.6;filter:grayscale(40%);cursor:not-allowed}[dir=rtl] .Toggle__display::before{left:auto;right:var(--offset)}[dir=rtl] .Toggle[aria-pressed=true]+.Toggle__display::before,[dir=rtl] .Toggle__input:checked+.Toggle__display::before{transform:translate(-100%,-50%)}.Toggle__icon{display:inline-block;width:1em;height:1em;color:inherit;fill:currentcolor;vertical-align:middle;overflow:hidden}.Toggle__icon--cross{color:var(--alert-color);font-size:65%}.Toggle__icon--checkmark{color:var(--success-color)}`]}static get properties(){return{...super.properties,id:{type:String},checked:{type:Boolean,reflect:!0},onchange:{type:String},hideIcons:{type:Boolean,default:!0}}}constructor(){super(),this.hideIcons=!1}onChange(e){const o=new CustomEvent("change",{detail:{field:this.name,oldValue:this.checked,newValue:e.target.checked}});this.checked=e.target.checked,this._setFormValue(this.checked),this.dispatchEvent(o)}render(){const e=o``,t=o``;return o``}}); //# sourceMappingURL=dt-toggle.js.map diff --git a/dt-assets/build/components/form/index.js b/dt-assets/build/components/form/index.js index ed7d490487..bf8e71c049 100644 --- a/dt-assets/build/components/form/index.js +++ b/dt-assets/build/components/form/index.js @@ -1,35 +1,2 @@ -import './dt-button/dt-button.js'; -import './dt-church-health-circle/dt-church-health-circle.js'; -import './dt-connection/dt-connection.js'; -import './dt-date/dt-date.js'; -import './dt-label/dt-label.js'; -import './dt-location/dt-location.js'; -import './dt-location-map/dt-location-map.js'; -import './dt-multi-select/dt-multi-select.js'; -import './dt-number/dt-number.js'; -import './dt-single-select/dt-single-select.js'; -import './dt-tags/dt-tags.js'; -import './dt-text/dt-text.js'; -import './dt-textarea/dt-textarea.js'; -import './dt-toggle/dt-toggle.js'; -import './dt-communication-channel/dt-comm-channel.js'; -import '../lit-element-2409d5fe.js'; -import '../class-map-8d921948.js'; -import '../directive-de55b00a.js'; -import '../dt-base.js'; -import '../lit-localize-763e4978.js'; -import './dt-church-health-circle/dt-church-health-circle-icon.js'; -import '../style-map-ac85d91b.js'; -import './dt-form-base.js'; -import './mixins/hasOptionsList.js'; -import '../icons/dt-spinner.js'; -import '../icons/dt-checkmark.js'; -import '../map-c0e24c36.js'; -import '../repeat-1a2b8966.js'; -import './dt-location-map/dt-location-map-item.js'; -import '../icons/dt-icon.js'; -import './dt-location-map/dt-map-modal.js'; -import '../layout/dt-modal/dt-modal.js'; -import '../if-defined-11ddebeb.js'; -import '../icons/dt-exclamation-circle.js'; +import"./dt-button/dt-button.js";import"./dt-church-health-circle/dt-church-health-circle.js";import"./dt-connection/dt-connection.js";import"./dt-date/dt-date.js";import"./dt-label/dt-label.js";import"./dt-location/dt-location.js";import"./dt-location-map/dt-location-map.js";import"./dt-multi-select/dt-multi-select.js";import"./dt-number/dt-number.js";import"./dt-single-select/dt-single-select.js";import"./dt-tags/dt-tags.js";import"./dt-text/dt-text.js";import"./dt-textarea/dt-textarea.js";import"./dt-toggle/dt-toggle.js";import"./dt-communication-channel/dt-comm-channel.js";import"../lit-element-2409d5fe.js";import"../class-map-8d921948.js";import"../directive-de55b00a.js";import"../dt-base.js";import"../lit-localize-763e4978.js";import"./dt-church-health-circle/dt-church-health-circle-icon.js";import"../style-map-ac85d91b.js";import"./dt-form-base.js";import"./mixins/hasOptionsList.js";import"../icons/dt-spinner.js";import"../icons/dt-checkmark.js";import"../map-c0e24c36.js";import"../repeat-1a2b8966.js";import"./dt-location-map/dt-location-map-item.js";import"../icons/dt-icon.js";import"./dt-location-map/dt-map-modal.js";import"../layout/dt-modal/dt-modal.js";import"../if-defined-11ddebeb.js";import"../icons/dt-exclamation-circle.js"; //# sourceMappingURL=index.js.map diff --git a/dt-assets/build/components/form/mixins/hasOptionsList.js b/dt-assets/build/components/form/mixins/hasOptionsList.js index 94fd8b9e4f..f05a59222f 100644 --- a/dt-assets/build/components/form/mixins/hasOptionsList.js +++ b/dt-assets/build/components/form/mixins/hasOptionsList.js @@ -1,170 +1,2 @@ -import { y as t } from '../../lit-element-2409d5fe.js'; -import { m as e } from '../../lit-localize-763e4978.js'; -const i = (i) => - class extends i { - constructor() { - super(), - (this.activeIndex = -1), - (this.filteredOptions = []), - (this.detectTap = !1); - } - static get properties() { - return { - ...super.properties, - value: { type: Array, reflect: !0 }, - query: { type: String, state: !0 }, - options: { type: Array }, - filteredOptions: { type: Array, state: !0 }, - open: { type: Boolean, state: !0 }, - activeIndex: { type: Number, state: !0 }, - containerHeight: { type: Number, state: !0 }, - loading: { type: Boolean }, - }; - } - willUpdate(t) { - if ( - (super.willUpdate(t), - t && - !this.containerHeight && - this.shadowRoot.children && - this.shadowRoot.children.length) - ) { - const t = this.shadowRoot.querySelector('.input-group'); - t && (this.containerHeight = t.offsetHeight); - } - } - updated() { - this._scrollOptionListToActive(); - const t = this.shadowRoot.querySelector('.input-group'); - !t.style.getPropertyValue('--container-width') && - t.clientWidth > 0 && - t.style.setProperty('--container-width', `${t.clientWidth}px`); - } - _select() { - console.error('Must implement `_select(value)` function'); - } - static _focusInput(t) { - t.target === t.currentTarget && - t.target.getElementsByTagName('input')[0].focus(); - } - _inputFocusIn(t) { - (t.relatedTarget && - ['BUTTON', 'LI'].includes(t.relatedTarget.nodeName)) || - ((this.open = !0), (this.activeIndex = -1)); - } - _inputFocusOut(t) { - (t.relatedTarget && - ['BUTTON', 'LI'].includes(t.relatedTarget.nodeName)) || - (this.open = !1); - } - _inputKeyDown(t) { - switch (t.keyCode || t.which) { - case 8: - '' === t.target.value - ? (this.value = this.value.slice(0, -1)) - : (this.open = !0); - break; - case 38: - (this.open = !0), this._listHighlightPrevious(); - break; - case 40: - (this.open = !0), this._listHighlightNext(); - break; - case 9: - this.activeIndex < 0 ? (this.open = !1) : t.preventDefault(), - this._keyboardSelectOption(); - break; - case 13: - this._keyboardSelectOption(); - break; - case 27: - (this.open = !1), (this.activeIndex = -1); - break; - default: - this.open = !0; - } - } - _inputKeyUp(t) { - this.query = t.target.value; - } - _scrollOptionListToActive() { - const t = this.shadowRoot.querySelector('.option-list'), - e = this.shadowRoot.querySelector('button.active'); - if (t && e) { - const i = e.offsetTop, - s = e.offsetTop + e.clientHeight, - o = t.scrollTop; - s > t.scrollTop + t.clientHeight - ? t.scrollTo({ top: s - t.clientHeight, behavior: 'smooth' }) - : i < o && t.scrollTo({ top: i, behavior: 'smooth' }); - } - } - _touchStart(t) { - t.target && (this.detectTap = !1); - } - _touchMove(t) { - t.target && (this.detectTap = !0); - } - _touchEnd(t) { - this.detectTap || - (t.target && t.target.value && this._clickOption(t), - (this.detectTap = !1)); - } - _keyboardSelectOption() { - this.activeIndex > -1 && - (this.activeIndex + 1 > this.filteredOptions.length - ? this._select(this.query) - : this._select(this.filteredOptions[this.activeIndex].id), - this._clearSearch()); - } - _clickOption(t) { - t.target && - t.target.value && - (this._select(t.target.value), this._clearSearch()); - } - _clickAddNew(t) { - t.target && (this._select(t.target.dataset?.label), this._clearSearch()); - } - _clearSearch() { - const t = this.shadowRoot.querySelector('input'); - t && (t.value = ''); - } - _listHighlightNext() { - this.allowAdd - ? (this.activeIndex = Math.min( - this.filteredOptions.length, - this.activeIndex + 1, - )) - : (this.activeIndex = Math.min( - this.filteredOptions.length - 1, - this.activeIndex + 1, - )); - } - _listHighlightPrevious() { - this.activeIndex = Math.max(0, this.activeIndex - 1); - } - _renderOption(e, i) { - return t`
  • `; - } - _baseRenderOptions() { - return this.filteredOptions.length - ? this.filteredOptions.map((t, e) => this._renderOption(t, e)) - : this.loading - ? t`
  • ${e('Loading options...')}
  • ` - : t`
  • ${e('No Data Available')}
  • `; - } - _renderOptions() { - let i = this._baseRenderOptions(); - return ( - this.allowAdd && - this.query && - (Array.isArray(i) || (i = [i]), - i.push( - t`
  • `, - )), - i - ); - } - }; -export { i as H }; +import{y as t}from"../../lit-element-2409d5fe.js";import{m as e}from"../../lit-localize-763e4978.js";const i=i=>class extends i{constructor(){super(),this.activeIndex=-1,this.filteredOptions=[],this.detectTap=!1}static get properties(){return{...super.properties,value:{type:Array,reflect:!0},query:{type:String,state:!0},options:{type:Array},filteredOptions:{type:Array,state:!0},open:{type:Boolean,state:!0},activeIndex:{type:Number,state:!0},containerHeight:{type:Number,state:!0},loading:{type:Boolean}}}willUpdate(t){if(super.willUpdate(t),t&&!this.containerHeight&&this.shadowRoot.children&&this.shadowRoot.children.length){const t=this.shadowRoot.querySelector(".input-group");t&&(this.containerHeight=t.offsetHeight)}}updated(){this._scrollOptionListToActive();const t=this.shadowRoot.querySelector(".input-group");!t.style.getPropertyValue("--container-width")&&t.clientWidth>0&&t.style.setProperty("--container-width",`${t.clientWidth}px`)}_select(){console.error("Must implement `_select(value)` function")}static _focusInput(t){t.target===t.currentTarget&&t.target.getElementsByTagName("input")[0].focus()}_inputFocusIn(t){t.relatedTarget&&["BUTTON","LI"].includes(t.relatedTarget.nodeName)||(this.open=!0,this.activeIndex=-1)}_inputFocusOut(t){t.relatedTarget&&["BUTTON","LI"].includes(t.relatedTarget.nodeName)||(this.open=!1)}_inputKeyDown(t){switch(t.keyCode||t.which){case 8:""===t.target.value?this.value=this.value.slice(0,-1):this.open=!0;break;case 38:this.open=!0,this._listHighlightPrevious();break;case 40:this.open=!0,this._listHighlightNext();break;case 9:this.activeIndex<0?this.open=!1:t.preventDefault(),this._keyboardSelectOption();break;case 13:this._keyboardSelectOption();break;case 27:this.open=!1,this.activeIndex=-1;break;default:this.open=!0}}_inputKeyUp(t){this.query=t.target.value}_scrollOptionListToActive(){const t=this.shadowRoot.querySelector(".option-list"),e=this.shadowRoot.querySelector("button.active");if(t&&e){const i=e.offsetTop,s=e.offsetTop+e.clientHeight,o=t.scrollTop;s>t.scrollTop+t.clientHeight?t.scrollTo({top:s-t.clientHeight,behavior:"smooth"}):i-1&&(this.activeIndex+1>this.filteredOptions.length?this._select(this.query):this._select(this.filteredOptions[this.activeIndex].id),this._clearSearch())}_clickOption(t){t.target&&t.target.value&&(this._select(t.target.value),this._clearSearch())}_clickAddNew(t){t.target&&(this._select(t.target.dataset?.label),this._clearSearch())}_clearSearch(){const t=this.shadowRoot.querySelector("input");t&&(t.value="")}_listHighlightNext(){this.allowAdd?this.activeIndex=Math.min(this.filteredOptions.length,this.activeIndex+1):this.activeIndex=Math.min(this.filteredOptions.length-1,this.activeIndex+1)}_listHighlightPrevious(){this.activeIndex=Math.max(0,this.activeIndex-1)}_renderOption(e,i){return t`
  • `}_baseRenderOptions(){return this.filteredOptions.length?this.filteredOptions.map(((t,e)=>this._renderOption(t,e))):this.loading?t`
  • ${e("Loading options...")}
  • `:t`
  • ${e("No Data Available")}
  • `}_renderOptions(){let i=this._baseRenderOptions();return this.allowAdd&&this.query&&(Array.isArray(i)||(i=[i]),i.push(t`
  • `)),i}};export{i as H}; //# sourceMappingURL=hasOptionsList.js.map diff --git a/dt-assets/build/components/generated/am_ET.js b/dt-assets/build/components/generated/am_ET.js index edda49a4f1..6e5ef25661 100644 --- a/dt-assets/build/components/generated/am_ET.js +++ b/dt-assets/build/components/generated/am_ET.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=am_ET.js.map diff --git a/dt-assets/build/components/generated/ar.js b/dt-assets/build/components/generated/ar.js index 8ae62d69e6..3536e0dff4 100644 --- a/dt-assets/build/components/generated/ar.js +++ b/dt-assets/build/components/generated/ar.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=ar.js.map diff --git a/dt-assets/build/components/generated/ar_MA.js b/dt-assets/build/components/generated/ar_MA.js index 376251e3ce..60c93e1c55 100644 --- a/dt-assets/build/components/generated/ar_MA.js +++ b/dt-assets/build/components/generated/ar_MA.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=ar_MA.js.map diff --git a/dt-assets/build/components/generated/bg_BG.js b/dt-assets/build/components/generated/bg_BG.js index 4549aee76c..f2244bff9e 100644 --- a/dt-assets/build/components/generated/bg_BG.js +++ b/dt-assets/build/components/generated/bg_BG.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=bg_BG.js.map diff --git a/dt-assets/build/components/generated/bn_BD.js b/dt-assets/build/components/generated/bn_BD.js index 3cce0ea1cf..53685425e5 100644 --- a/dt-assets/build/components/generated/bn_BD.js +++ b/dt-assets/build/components/generated/bn_BD.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=bn_BD.js.map diff --git a/dt-assets/build/components/generated/bs_BA.js b/dt-assets/build/components/generated/bs_BA.js index 0455852baf..6ac54f173b 100644 --- a/dt-assets/build/components/generated/bs_BA.js +++ b/dt-assets/build/components/generated/bs_BA.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=bs_BA.js.map diff --git a/dt-assets/build/components/generated/cs.js b/dt-assets/build/components/generated/cs.js index a77ec3d62f..2c44eab8f2 100644 --- a/dt-assets/build/components/generated/cs.js +++ b/dt-assets/build/components/generated/cs.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=cs.js.map diff --git a/dt-assets/build/components/generated/de_DE.js b/dt-assets/build/components/generated/de_DE.js index 5d14490037..0543664bf0 100644 --- a/dt-assets/build/components/generated/de_DE.js +++ b/dt-assets/build/components/generated/de_DE.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=de_DE.js.map diff --git a/dt-assets/build/components/generated/el.js b/dt-assets/build/components/generated/el.js index b944496383..17367f6291 100644 --- a/dt-assets/build/components/generated/el.js +++ b/dt-assets/build/components/generated/el.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=el.js.map diff --git a/dt-assets/build/components/generated/en_US.js b/dt-assets/build/components/generated/en_US.js index d408f524e7..413d1c05d1 100644 --- a/dt-assets/build/components/generated/en_US.js +++ b/dt-assets/build/components/generated/en_US.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=en_US.js.map diff --git a/dt-assets/build/components/generated/es-419.js b/dt-assets/build/components/generated/es-419.js index 2fe7af91f5..5a63306bb9 100644 --- a/dt-assets/build/components/generated/es-419.js +++ b/dt-assets/build/components/generated/es-419.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=es-419.js.map diff --git a/dt-assets/build/components/generated/es_419.js b/dt-assets/build/components/generated/es_419.js index 00ba6030cb..f5dd071c5f 100644 --- a/dt-assets/build/components/generated/es_419.js +++ b/dt-assets/build/components/generated/es_419.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=es_419.js.map diff --git a/dt-assets/build/components/generated/es_ES.js b/dt-assets/build/components/generated/es_ES.js index 0bdfce860a..79f8f53d48 100644 --- a/dt-assets/build/components/generated/es_ES.js +++ b/dt-assets/build/components/generated/es_ES.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=es_ES.js.map diff --git a/dt-assets/build/components/generated/fa_IR.js b/dt-assets/build/components/generated/fa_IR.js index 32437c6ae4..617fb99d7a 100644 --- a/dt-assets/build/components/generated/fa_IR.js +++ b/dt-assets/build/components/generated/fa_IR.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=fa_IR.js.map diff --git a/dt-assets/build/components/generated/fr_FR.js b/dt-assets/build/components/generated/fr_FR.js index 2dfb041c61..db948bb3f6 100644 --- a/dt-assets/build/components/generated/fr_FR.js +++ b/dt-assets/build/components/generated/fr_FR.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=fr_FR.js.map diff --git a/dt-assets/build/components/generated/hi_IN.js b/dt-assets/build/components/generated/hi_IN.js index 28303e461d..5ea40083f6 100644 --- a/dt-assets/build/components/generated/hi_IN.js +++ b/dt-assets/build/components/generated/hi_IN.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=hi_IN.js.map diff --git a/dt-assets/build/components/generated/hr.js b/dt-assets/build/components/generated/hr.js index 128501dcf6..d88a5b9ac7 100644 --- a/dt-assets/build/components/generated/hr.js +++ b/dt-assets/build/components/generated/hr.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=hr.js.map diff --git a/dt-assets/build/components/generated/hu_HU.js b/dt-assets/build/components/generated/hu_HU.js index 6c35d2cc9a..e05d27c685 100644 --- a/dt-assets/build/components/generated/hu_HU.js +++ b/dt-assets/build/components/generated/hu_HU.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=hu_HU.js.map diff --git a/dt-assets/build/components/generated/id_ID.js b/dt-assets/build/components/generated/id_ID.js index 31a4fd3d78..cafe17d4a0 100644 --- a/dt-assets/build/components/generated/id_ID.js +++ b/dt-assets/build/components/generated/id_ID.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=id_ID.js.map diff --git a/dt-assets/build/components/generated/it_IT.js b/dt-assets/build/components/generated/it_IT.js index 777b693999..8f60f9bb17 100644 --- a/dt-assets/build/components/generated/it_IT.js +++ b/dt-assets/build/components/generated/it_IT.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=it_IT.js.map diff --git a/dt-assets/build/components/generated/ja.js b/dt-assets/build/components/generated/ja.js index cfa0ee5741..a566794762 100644 --- a/dt-assets/build/components/generated/ja.js +++ b/dt-assets/build/components/generated/ja.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=ja.js.map diff --git a/dt-assets/build/components/generated/ko_KR.js b/dt-assets/build/components/generated/ko_KR.js index fd81a78a86..e832036dc8 100644 --- a/dt-assets/build/components/generated/ko_KR.js +++ b/dt-assets/build/components/generated/ko_KR.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=ko_KR.js.map diff --git a/dt-assets/build/components/generated/mk_MK.js b/dt-assets/build/components/generated/mk_MK.js index f2bc538f4a..c692fdc932 100644 --- a/dt-assets/build/components/generated/mk_MK.js +++ b/dt-assets/build/components/generated/mk_MK.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=mk_MK.js.map diff --git a/dt-assets/build/components/generated/mr.js b/dt-assets/build/components/generated/mr.js index 94d8c58125..d4dd258b1a 100644 --- a/dt-assets/build/components/generated/mr.js +++ b/dt-assets/build/components/generated/mr.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=mr.js.map diff --git a/dt-assets/build/components/generated/my_MM.js b/dt-assets/build/components/generated/my_MM.js index 325ce77ae8..e3aaf9dcfb 100644 --- a/dt-assets/build/components/generated/my_MM.js +++ b/dt-assets/build/components/generated/my_MM.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=my_MM.js.map diff --git a/dt-assets/build/components/generated/ne_NP.js b/dt-assets/build/components/generated/ne_NP.js index b3c3cf4619..9484bd4abd 100644 --- a/dt-assets/build/components/generated/ne_NP.js +++ b/dt-assets/build/components/generated/ne_NP.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=ne_NP.js.map diff --git a/dt-assets/build/components/generated/nl_NL.js b/dt-assets/build/components/generated/nl_NL.js index e7db83b0de..d89c20f19c 100644 --- a/dt-assets/build/components/generated/nl_NL.js +++ b/dt-assets/build/components/generated/nl_NL.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=nl_NL.js.map diff --git a/dt-assets/build/components/generated/pa_IN.js b/dt-assets/build/components/generated/pa_IN.js index 954455840f..d61605b41b 100644 --- a/dt-assets/build/components/generated/pa_IN.js +++ b/dt-assets/build/components/generated/pa_IN.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=pa_IN.js.map diff --git a/dt-assets/build/components/generated/pl.js b/dt-assets/build/components/generated/pl.js index a51754fdd8..c058de80b3 100644 --- a/dt-assets/build/components/generated/pl.js +++ b/dt-assets/build/components/generated/pl.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=pl.js.map diff --git a/dt-assets/build/components/generated/pt_BR.js b/dt-assets/build/components/generated/pt_BR.js index 299fa8ebd7..4560ad04e7 100644 --- a/dt-assets/build/components/generated/pt_BR.js +++ b/dt-assets/build/components/generated/pt_BR.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=pt_BR.js.map diff --git a/dt-assets/build/components/generated/ro_RO.js b/dt-assets/build/components/generated/ro_RO.js index 653e1f094c..a7c5ddad84 100644 --- a/dt-assets/build/components/generated/ro_RO.js +++ b/dt-assets/build/components/generated/ro_RO.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=ro_RO.js.map diff --git a/dt-assets/build/components/generated/ru_RU.js b/dt-assets/build/components/generated/ru_RU.js index 173e7acbb9..fc954a9f11 100644 --- a/dt-assets/build/components/generated/ru_RU.js +++ b/dt-assets/build/components/generated/ru_RU.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=ru_RU.js.map diff --git a/dt-assets/build/components/generated/sl_SI.js b/dt-assets/build/components/generated/sl_SI.js index 6b6f15b98d..fad66f2013 100644 --- a/dt-assets/build/components/generated/sl_SI.js +++ b/dt-assets/build/components/generated/sl_SI.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=sl_SI.js.map diff --git a/dt-assets/build/components/generated/sr_BA.js b/dt-assets/build/components/generated/sr_BA.js index a4364f7f56..2b9cb3213b 100644 --- a/dt-assets/build/components/generated/sr_BA.js +++ b/dt-assets/build/components/generated/sr_BA.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=sr_BA.js.map diff --git a/dt-assets/build/components/generated/sw.js b/dt-assets/build/components/generated/sw.js index 55dd1982b4..67cc692040 100644 --- a/dt-assets/build/components/generated/sw.js +++ b/dt-assets/build/components/generated/sw.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=sw.js.map diff --git a/dt-assets/build/components/generated/th.js b/dt-assets/build/components/generated/th.js index f178eb5eeb..538a6e354b 100644 --- a/dt-assets/build/components/generated/th.js +++ b/dt-assets/build/components/generated/th.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=th.js.map diff --git a/dt-assets/build/components/generated/tl.js b/dt-assets/build/components/generated/tl.js index 1f352940cf..5bd0fbf30c 100644 --- a/dt-assets/build/components/generated/tl.js +++ b/dt-assets/build/components/generated/tl.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=tl.js.map diff --git a/dt-assets/build/components/generated/tr_TR.js b/dt-assets/build/components/generated/tr_TR.js index 6af9f92feb..99e5469ced 100644 --- a/dt-assets/build/components/generated/tr_TR.js +++ b/dt-assets/build/components/generated/tr_TR.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=tr_TR.js.map diff --git a/dt-assets/build/components/generated/uk.js b/dt-assets/build/components/generated/uk.js index 55bc39dc14..dcdadae58d 100644 --- a/dt-assets/build/components/generated/uk.js +++ b/dt-assets/build/components/generated/uk.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=uk.js.map diff --git a/dt-assets/build/components/generated/vi.js b/dt-assets/build/components/generated/vi.js index a812fc6584..330ea34c37 100644 --- a/dt-assets/build/components/generated/vi.js +++ b/dt-assets/build/components/generated/vi.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=vi.js.map diff --git a/dt-assets/build/components/generated/zh_CN.js b/dt-assets/build/components/generated/zh_CN.js index ed8813fb40..7f77651926 100644 --- a/dt-assets/build/components/generated/zh_CN.js +++ b/dt-assets/build/components/generated/zh_CN.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=zh_CN.js.map diff --git a/dt-assets/build/components/generated/zh_TW.js b/dt-assets/build/components/generated/zh_TW.js index b6a214915b..dd8dae77cf 100644 --- a/dt-assets/build/components/generated/zh_TW.js +++ b/dt-assets/build/components/generated/zh_TW.js @@ -1,2 +1,2 @@ -import '../lit-localize-763e4978.js'; +import"../lit-localize-763e4978.js"; //# sourceMappingURL=zh_TW.js.map diff --git a/dt-assets/build/components/icons/dt-checkmark.js b/dt-assets/build/components/icons/dt-checkmark.js index 4a74c48fb8..acbc490bbb 100644 --- a/dt-assets/build/components/icons/dt-checkmark.js +++ b/dt-assets/build/components/icons/dt-checkmark.js @@ -1,10 +1,2 @@ -import { s as t, i as e } from '../lit-element-2409d5fe.js'; -window.customElements.define( - 'dt-checkmark', - class extends t { - static get styles() { - return e`@keyframes fadeOut{0%{opacity:1}75%{opacity:1}100%{opacity:0}}:host{margin-top:-.25rem}:host::before{content:'';transform:rotate(45deg);height:1rem;width:.5rem;opacity:0;color:inherit;border-bottom:var(--dt-checkmark-width) solid currentcolor;border-right:var(--dt-checkmark-width) solid currentcolor;animation:fadeOut 4s}`; - } - }, -); +import{s as t,i as e}from"../lit-element-2409d5fe.js";window.customElements.define("dt-checkmark",class extends t{static get styles(){return e`@keyframes fadeOut{0%{opacity:1}75%{opacity:1}100%{opacity:0}}:host{margin-top:-.25rem}:host::before{content:'';transform:rotate(45deg);height:1rem;width:.5rem;opacity:0;color:inherit;border-bottom:var(--dt-checkmark-width) solid currentcolor;border-right:var(--dt-checkmark-width) solid currentcolor;animation:fadeOut 4s}`}}); //# sourceMappingURL=dt-checkmark.js.map diff --git a/dt-assets/build/components/icons/dt-exclamation-circle.js b/dt-assets/build/components/icons/dt-exclamation-circle.js index 5f103f8080..a32c991e49 100644 --- a/dt-assets/build/components/icons/dt-exclamation-circle.js +++ b/dt-assets/build/components/icons/dt-exclamation-circle.js @@ -1,13 +1,2 @@ -import { s as e, i as t, y as r } from '../lit-element-2409d5fe.js'; -window.customElements.define( - 'dt-exclamation-circle', - class extends e { - static get styles() { - return t`svg use{fill:currentcolor}`; - } - render() { - return r``; - } - }, -); +import{s as e,i as t,y as r}from"../lit-element-2409d5fe.js";window.customElements.define("dt-exclamation-circle",class extends e{static get styles(){return t`svg use{fill:currentcolor}`}render(){return r``}}); //# sourceMappingURL=dt-exclamation-circle.js.map diff --git a/dt-assets/build/components/icons/dt-icon.js b/dt-assets/build/components/icons/dt-icon.js index 35978f212e..10c763a5b8 100644 --- a/dt-assets/build/components/icons/dt-icon.js +++ b/dt-assets/build/components/icons/dt-icon.js @@ -1,1363 +1,13 @@ -import { i as t, y as e } from '../lit-element-2409d5fe.js'; -import { D as n } from '../dt-base.js'; -import '../lit-localize-763e4978.js'; +import{i as t,y as e}from"../lit-element-2409d5fe.js";import{D as n}from"../dt-base.js";import"../lit-localize-763e4978.js"; /** - * (c) Iconify - * - * For the full copyright and license information, please view the license.txt - * files at https://github.com/iconify/iconify - * - * Licensed under MIT. - * - * @license MIT - * @version 1.0.2 - */ const o = Object.freeze({ left: 0, top: 0, width: 16, height: 16 }), - i = Object.freeze({ rotate: 0, vFlip: !1, hFlip: !1 }), - r = Object.freeze({ ...o, ...i }), - s = Object.freeze({ ...r, body: '', hidden: !1 }), - c = Object.freeze({ width: null, height: null }), - a = Object.freeze({ ...c, ...i }); -const l = /[\s,]+/; -const u = { ...a, preserveAspectRatio: '' }; -function f(t) { - const e = { ...u }, - n = (e, n) => t.getAttribute(e) || n; - var o; - return ( - (e.width = n('width', null)), - (e.height = n('height', null)), - (e.rotate = (function (t, e = 0) { - const n = t.replace(/^-?[0-9.]*/, ''); - function o(t) { - for (; t < 0; ) t += 4; - return t % 4; - } - if ('' === n) { - const e = parseInt(t); - return isNaN(e) ? 0 : o(e); - } - if (n !== t) { - let e = 0; - switch (n) { - case '%': - e = 25; - break; - case 'deg': - e = 90; - } - if (e) { - let i = parseFloat(t.slice(0, t.length - n.length)); - return isNaN(i) ? 0 : ((i /= e), i % 1 == 0 ? o(i) : 0); - } - } - return e; - })(n('rotate', ''))), - (o = e), - n('flip', '') - .split(l) - .forEach((t) => { - switch (t.trim()) { - case 'horizontal': - o.hFlip = !0; - break; - case 'vertical': - o.vFlip = !0; - } - }), - (e.preserveAspectRatio = n( - 'preserveAspectRatio', - n('preserveaspectratio', ''), - )), - e - ); -} -const d = /^[a-z0-9]+(-[a-z0-9]+)*$/, - p = (t, e, n, o = '') => { - const i = t.split(':'); - if ('@' === t.slice(0, 1)) { - if (i.length < 2 || i.length > 3) return null; - o = i.shift().slice(1); - } - if (i.length > 3 || !i.length) return null; - if (i.length > 1) { - const t = i.pop(), - n = i.pop(), - r = { provider: i.length > 0 ? i[0] : o, prefix: n, name: t }; - return e && !h(r) ? null : r; - } - const r = i[0], - s = r.split('-'); - if (s.length > 1) { - const t = { provider: o, prefix: s.shift(), name: s.join('-') }; - return e && !h(t) ? null : t; - } - if (n && '' === o) { - const t = { provider: o, prefix: '', name: r }; - return e && !h(t, n) ? null : t; - } - return null; - }, - h = (t, e) => - !!t && - !( - ('' !== t.provider && !t.provider.match(d)) || - !((e && '' === t.prefix) || t.prefix.match(d)) || - !t.name.match(d) - ); -function g(t, e) { - const n = (function (t, e) { - const n = {}; - !t.hFlip != !e.hFlip && (n.hFlip = !0), - !t.vFlip != !e.vFlip && (n.vFlip = !0); - const o = ((t.rotate || 0) + (e.rotate || 0)) % 4; - return o && (n.rotate = o), n; - })(t, e); - for (const o in s) - o in i - ? o in t && !(o in n) && (n[o] = i[o]) - : o in e - ? (n[o] = e[o]) - : o in t && (n[o] = t[o]); - return n; -} -function m(t, e, n) { - const o = t.icons, - i = t.aliases || Object.create(null); - let r = {}; - function s(t) { - r = g(o[t] || i[t], r); - } - return s(e), n.forEach(s), g(t, r); -} -function b(t, e) { - const n = []; - if ('object' != typeof t || 'object' != typeof t.icons) return n; - t.not_found instanceof Array && - t.not_found.forEach((t) => { - e(t, null), n.push(t); - }); - const o = (function (t, e) { - const n = t.icons, - o = t.aliases || Object.create(null), - i = Object.create(null); - return ( - (e || Object.keys(n).concat(Object.keys(o))).forEach(function t(e) { - if (n[e]) return (i[e] = []); - if (!(e in i)) { - i[e] = null; - const n = o[e] && o[e].parent, - r = n && t(n); - r && (i[e] = [n].concat(r)); - } - return i[e]; - }), - i - ); - })(t); - for (const i in o) { - const r = o[i]; - r && (e(i, m(t, i, r)), n.push(i)); - } - return n; -} -const y = { provider: '', aliases: {}, not_found: {}, ...o }; -function v(t, e) { - for (const n in e) if (n in t && typeof t[n] != typeof e[n]) return !1; - return !0; -} -function x(t) { - if ('object' != typeof t || null === t) return null; - const e = t; - if ('string' != typeof e.prefix || !t.icons || 'object' != typeof t.icons) - return null; - if (!v(t, y)) return null; - const n = e.icons; - for (const t in n) { - const e = n[t]; - if (!t.match(d) || 'string' != typeof e.body || !v(e, s)) return null; - } - const o = e.aliases || Object.create(null); - for (const t in o) { - const e = o[t], - i = e.parent; - if (!t.match(d) || 'string' != typeof i || (!n[i] && !o[i]) || !v(e, s)) - return null; - } - return e; -} -const w = Object.create(null); -function k(t, e) { - const n = w[t] || (w[t] = Object.create(null)); - return ( - n[e] || - (n[e] = (function (t, e) { - return { - provider: t, - prefix: e, - icons: Object.create(null), - missing: new Set(), - }; - })(t, e)) - ); -} -function j(t, e) { - return x(e) - ? b(e, (e, n) => { - n ? (t.icons[e] = n) : t.missing.add(e); - }) - : []; -} -function _(t, e) { - let n = []; - return ( - ('string' == typeof t ? [t] : Object.keys(w)).forEach((t) => { - ('string' == typeof t && 'string' == typeof e - ? [e] - : Object.keys(w[t] || {}) - ).forEach((e) => { - const o = k(t, e); - n = n.concat( - Object.keys(o.icons).map( - (n) => ('' !== t ? '@' + t + ':' : '') + e + ':' + n, - ), - ); - }); - }), - n - ); -} -let A = !1; -function S(t) { - return 'boolean' == typeof t && (A = t), A; -} -function O(t) { - const e = 'string' == typeof t ? p(t, !0, A) : t; - if (e) { - const t = k(e.provider, e.prefix), - n = e.name; - return t.icons[n] || (t.missing.has(n) ? null : void 0); - } -} -function C(t, e) { - const n = p(t, !0, A); - if (!n) return !1; - return (function (t, e, n) { - try { - if ('string' == typeof n.body) return (t.icons[e] = { ...n }), !0; - } catch (t) {} - return !1; - })(k(n.provider, n.prefix), n.name, e); -} -function E(t, e) { - if ('object' != typeof t) return !1; - if (('string' != typeof e && (e = t.provider || ''), A && !e && !t.prefix)) { - let e = !1; - return ( - x(t) && - ((t.prefix = ''), - b(t, (t, n) => { - n && C(t, n) && (e = !0); - })), - e - ); - } - const n = t.prefix; - if (!h({ provider: e, prefix: n, name: 'a' })) return !1; - return !!j(k(e, n), t); -} -function I(t) { - return !!O(t); -} -function M(t) { - const e = O(t); - return e ? { ...r, ...e } : null; -} -function T(t, e) { - t.forEach((t) => { - const n = t.loaderCallbacks; - n && (t.loaderCallbacks = n.filter((t) => t.id !== e)); - }); -} -let F = 0; -const N = Object.create(null); -function P(t, e) { - N[t] = e; -} -function R(t) { - return N[t] || N['']; -} -var z = { - resources: [], - index: 0, - timeout: 2e3, - rotate: 750, - random: !1, - dataAfterTimeout: !1, -}; -function L(t, e, n, o) { - const i = t.resources.length, - r = t.random ? Math.floor(Math.random() * i) : t.index; - let s; - if (t.random) { - let e = t.resources.slice(0); - for (s = []; e.length > 1; ) { - const t = Math.floor(Math.random() * e.length); - s.push(e[t]), (e = e.slice(0, t).concat(e.slice(t + 1))); - } - s = s.concat(e); - } else s = t.resources.slice(r).concat(t.resources.slice(0, r)); - const c = Date.now(); - let a, - l = 'pending', - u = 0, - f = null, - d = [], - p = []; - function h() { - f && (clearTimeout(f), (f = null)); - } - function g() { - 'pending' === l && (l = 'aborted'), - h(), - d.forEach((t) => { - 'pending' === t.status && (t.status = 'aborted'); - }), - (d = []); - } - function m(t, e) { - e && (p = []), 'function' == typeof t && p.push(t); - } - function b() { - (l = 'failed'), - p.forEach((t) => { - t(void 0, a); - }); - } - function y() { - d.forEach((t) => { - 'pending' === t.status && (t.status = 'aborted'); - }), - (d = []); - } - function v() { - if ('pending' !== l) return; - h(); - const o = s.shift(); - if (void 0 === o) - return d.length - ? void (f = setTimeout(() => { - h(), 'pending' === l && (y(), b()); - }, t.timeout)) - : void b(); - const i = { - status: 'pending', - resource: o, - callback: (e, n) => { - !(function (e, n, o) { - const i = 'success' !== n; - switch (((d = d.filter((t) => t !== e)), l)) { - case 'pending': - break; - case 'failed': - if (i || !t.dataAfterTimeout) return; - break; - default: - return; - } - if ('abort' === n) return (a = o), void b(); - if (i) return (a = o), void (d.length || (s.length ? v() : b())); - if ((h(), y(), !t.random)) { - const n = t.resources.indexOf(e.resource); - -1 !== n && n !== t.index && (t.index = n); - } - (l = 'completed'), - p.forEach((t) => { - t(o); - }); - })(i, e, n); - }, - }; - d.push(i), u++, (f = setTimeout(v, t.rotate)), n(o, e, i.callback); - } - return ( - 'function' == typeof o && p.push(o), - setTimeout(v), - function () { - return { - startTime: c, - payload: e, - status: l, - queriesSent: u, - queriesPending: d.length, - subscribe: m, - abort: g, - }; - } - ); -} -function Q(t) { - const e = { ...z, ...t }; - let n = []; - function o() { - n = n.filter((t) => 'pending' === t().status); - } - return { - query: function (t, i, r) { - const s = L(e, t, i, (t, e) => { - o(), r && r(t, e); - }); - return n.push(s), s; - }, - find: function (t) { - return n.find((e) => t(e)) || null; - }, - setIndex: (t) => { - e.index = t; - }, - getIndex: () => e.index, - cleanup: o, - }; -} -function $(t) { - let e; - if ('string' == typeof t.resources) e = [t.resources]; - else if (((e = t.resources), !(e instanceof Array && e.length))) return null; - return { - resources: e, - path: t.path || '/', - maxURL: t.maxURL || 500, - rotate: t.rotate || 750, - timeout: t.timeout || 5e3, - random: !0 === t.random, - index: t.index || 0, - dataAfterTimeout: !1 !== t.dataAfterTimeout, - }; -} -const D = Object.create(null), - q = ['https://api.simplesvg.com', 'https://api.unisvg.com'], - U = []; -for (; q.length > 0; ) - 1 === q.length || Math.random() > 0.5 ? U.push(q.shift()) : U.push(q.pop()); -function J(t, e) { - const n = $(e); - return null !== n && ((D[t] = n), !0); -} -function B(t) { - return D[t]; -} -function H() { - return Object.keys(D); -} -function G() {} -D[''] = $({ resources: ['https://api.iconify.design'].concat(U) }); -const V = Object.create(null); -function K(t, e, n) { - let o, i; - if ('string' == typeof t) { - const e = R(t); - if (!e) return n(void 0, 424), G; - i = e.send; - const r = (function (t) { - if (!V[t]) { - const e = B(t); - if (!e) return; - const n = { config: e, redundancy: Q(e) }; - V[t] = n; - } - return V[t]; - })(t); - r && (o = r.redundancy); - } else { - const e = $(t); - if (e) { - o = Q(e); - const n = R(t.resources ? t.resources[0] : ''); - n && (i = n.send); - } - } - return o && i ? o.query(e, i, n)().abort : (n(void 0, 424), G); -} -function W(t, e) { - try { - return t.getItem(e); - } catch (t) {} -} -function X(t, e, n) { - try { - return t.setItem(e, n), !0; - } catch (t) {} -} -function Y(t, e) { - try { - t.removeItem(e); - } catch (t) {} -} -function Z(t, e) { - return X(t, 'iconify-count', e.toString()); -} -function tt(t) { - return parseInt(W(t, 'iconify-count')) || 0; -} -const et = { local: !0, session: !0 }, - nt = { local: new Set(), session: new Set() }; -let ot = !1; -let it = 'undefined' == typeof window ? {} : window; -function rt(t) { - const e = t + 'Storage'; - try { - if (it && it[e] && 'number' == typeof it[e].length) return it[e]; - } catch (t) {} - et[t] = !1; -} -function st(t, e) { - const n = rt(t); - if (!n) return; - const o = W(n, 'iconify-version'); - if ('iconify2' !== o) { - if (o) { - const t = tt(n); - for (let e = 0; e < t; e++) Y(n, 'iconify' + e.toString()); - } - return X(n, 'iconify-version', 'iconify2'), void Z(n, 0); - } - const i = Math.floor(Date.now() / 36e5) - 168, - r = (t) => { - const o = 'iconify' + t.toString(), - r = W(n, o); - if ('string' == typeof r) { - try { - const n = JSON.parse(r); - if ( - 'object' == typeof n && - 'number' == typeof n.cached && - n.cached > i && - 'string' == typeof n.provider && - 'object' == typeof n.data && - 'string' == typeof n.data.prefix && - e(n, t) - ) - return !0; - } catch (t) {} - Y(n, o); - } - }; - let s = tt(n); - for (let e = s - 1; e >= 0; e--) - r(e) || (e === s - 1 ? (s--, Z(n, s)) : nt[t].add(e)); -} -function ct() { - if (!ot) { - ot = !0; - for (const t in et) - st(t, (t) => { - const e = t.data, - n = k(t.provider, e.prefix); - if (!j(n, e).length) return !1; - const o = e.lastModified || -1; - return ( - (n.lastModifiedCached = n.lastModifiedCached - ? Math.min(n.lastModifiedCached, o) - : o), - !0 - ); - }); - } -} -function at(t, e) { - function n(n) { - let o; - if (!et[n] || !(o = rt(n))) return; - const i = nt[n]; - let r; - if (i.size) i.delete((r = Array.from(i).shift())); - else if (((r = tt(o)), !Z(o, r + 1))) return; - const s = { - cached: Math.floor(Date.now() / 36e5), - provider: t.provider, - data: e, - }; - return X(o, 'iconify' + r.toString(), JSON.stringify(s)); - } - ot || ct(), - (e.lastModified && - !(function (t, e) { - const n = t.lastModifiedCached; - if (n && n >= e) return n === e; - if (((t.lastModifiedCached = e), n)) - for (const n in et) - st(n, (n) => { - const o = n.data; - return ( - n.provider !== t.provider || - o.prefix !== t.prefix || - o.lastModified === e - ); - }); - return !0; - })(t, e.lastModified)) || - (Object.keys(e.icons).length && - (e.not_found && delete (e = Object.assign({}, e)).not_found, - n('local') || n('session'))); -} -function lt() {} -function ut(t) { - t.iconsLoaderFlag || - ((t.iconsLoaderFlag = !0), - setTimeout(() => { - (t.iconsLoaderFlag = !1), - (function (t) { - t.pendingCallbacksFlag || - ((t.pendingCallbacksFlag = !0), - setTimeout(() => { - t.pendingCallbacksFlag = !1; - const e = t.loaderCallbacks ? t.loaderCallbacks.slice(0) : []; - if (!e.length) return; - let n = !1; - const o = t.provider, - i = t.prefix; - e.forEach((e) => { - const r = e.icons, - s = r.pending.length; - (r.pending = r.pending.filter((e) => { - if (e.prefix !== i) return !0; - const s = e.name; - if (t.icons[s]) - r.loaded.push({ provider: o, prefix: i, name: s }); - else { - if (!t.missing.has(s)) return (n = !0), !0; - r.missing.push({ provider: o, prefix: i, name: s }); - } - return !1; - })), - r.pending.length !== s && - (n || T([t], e.id), - e.callback( - r.loaded.slice(0), - r.missing.slice(0), - r.pending.slice(0), - e.abort, - )); - }); - })); - })(t); - })); -} -const ft = (t, e) => { - const n = (function (t, e = !0, n = !1) { - const o = []; - return ( - t.forEach((t) => { - const i = 'string' == typeof t ? p(t, e, n) : t; - i && o.push(i); - }), - o - ); - })(t, !0, S()), - o = (function (t) { - const e = { loaded: [], missing: [], pending: [] }, - n = Object.create(null); - t.sort((t, e) => - t.provider !== e.provider - ? t.provider.localeCompare(e.provider) - : t.prefix !== e.prefix - ? t.prefix.localeCompare(e.prefix) - : t.name.localeCompare(e.name), - ); - let o = { provider: '', prefix: '', name: '' }; - return ( - t.forEach((t) => { - if ( - o.name === t.name && - o.prefix === t.prefix && - o.provider === t.provider - ) - return; - o = t; - const i = t.provider, - r = t.prefix, - s = t.name, - c = n[i] || (n[i] = Object.create(null)), - a = c[r] || (c[r] = k(i, r)); - let l; - l = - s in a.icons - ? e.loaded - : '' === r || a.missing.has(s) - ? e.missing - : e.pending; - const u = { provider: i, prefix: r, name: s }; - l.push(u); - }), - e - ); - })(n); - if (!o.pending.length) { - let t = !0; - return ( - e && - setTimeout(() => { - t && e(o.loaded, o.missing, o.pending, lt); - }), - () => { - t = !1; - } - ); - } - const i = Object.create(null), - r = []; - let s, c; - return ( - o.pending.forEach((t) => { - const { provider: e, prefix: n } = t; - if (n === c && e === s) return; - (s = e), (c = n), r.push(k(e, n)); - const o = i[e] || (i[e] = Object.create(null)); - o[n] || (o[n] = []); - }), - o.pending.forEach((t) => { - const { provider: e, prefix: n, name: o } = t, - r = k(e, n), - s = r.pendingIcons || (r.pendingIcons = new Set()); - s.has(o) || (s.add(o), i[e][n].push(o)); - }), - r.forEach((t) => { - const { provider: e, prefix: n } = t; - i[e][n].length && - (function (t, e) { - t.iconsToLoad - ? (t.iconsToLoad = t.iconsToLoad.concat(e).sort()) - : (t.iconsToLoad = e), - t.iconsQueueFlag || - ((t.iconsQueueFlag = !0), - setTimeout(() => { - t.iconsQueueFlag = !1; - const { provider: e, prefix: n } = t, - o = t.iconsToLoad; - let i; - delete t.iconsToLoad, - o && - (i = R(e)) && - i.prepare(e, n, o).forEach((n) => { - K(e, n, (e) => { - if ('object' != typeof e) - n.icons.forEach((e) => { - t.missing.add(e); - }); - else - try { - const n = j(t, e); - if (!n.length) return; - const o = t.pendingIcons; - o && - n.forEach((t) => { - o.delete(t); - }), - at(t, e); - } catch (t) { - console.error(t); - } - ut(t); - }); - }); - })); - })(t, i[e][n]); - }), - e - ? (function (t, e, n) { - const o = F++, - i = T.bind(null, n, o); - if (!e.pending.length) return i; - const r = { id: o, icons: e, callback: t, abort: i }; - return ( - n.forEach((t) => { - (t.loaderCallbacks || (t.loaderCallbacks = [])).push(r); - }), - i - ); - })(e, o, r) - : lt - ); - }, - dt = (t) => - new Promise((e, n) => { - const o = 'string' == typeof t ? p(t, !0) : t; - o - ? ft([o || t], (i) => { - if (i.length && o) { - const t = O(o); - if (t) return void e({ ...r, ...t }); - } - n(t); - }) - : n(t); - }); -function pt(t, e) { - const n = 'string' == typeof t ? p(t, !0, !0) : null; - if (!n) { - const e = (function (t) { - try { - const e = 'string' == typeof t ? JSON.parse(t) : t; - if ('string' == typeof e.body) return { ...e }; - } catch (t) {} - })(t); - return { value: t, data: e }; - } - const o = O(n); - if (void 0 !== o || !n.prefix) return { value: t, name: n, data: o }; - const i = ft([n], () => e(t, n, O(n))); - return { value: t, name: n, loading: i }; -} -function ht(t) { - return t.hasAttribute('inline'); -} -let gt = !1; -try { - gt = 0 === navigator.vendor.indexOf('Apple'); -} catch (t) {} -const mt = /(-?[0-9.]*[0-9]+[0-9.]*)/g, - bt = /^-?[0-9.]*[0-9]+[0-9.]*$/g; -function yt(t, e, n) { - if (1 === e) return t; - if (((n = n || 100), 'number' == typeof t)) return Math.ceil(t * e * n) / n; - if ('string' != typeof t) return t; - const o = t.split(mt); - if (null === o || !o.length) return t; - const i = []; - let r = o.shift(), - s = bt.test(r); - for (;;) { - if (s) { - const t = parseFloat(r); - isNaN(t) ? i.push(r) : i.push(Math.ceil(t * e * n) / n); - } else i.push(r); - if (((r = o.shift()), void 0 === r)) return i.join(''); - s = !s; - } -} -function vt(t, e) { - const n = { ...r, ...t }, - o = { ...a, ...e }, - i = { left: n.left, top: n.top, width: n.width, height: n.height }; - let s = n.body; - [n, o].forEach((t) => { - const e = [], - n = t.hFlip, - o = t.vFlip; - let r, - c = t.rotate; - switch ( - (n - ? o - ? (c += 2) - : (e.push( - 'translate(' + - (i.width + i.left).toString() + - ' ' + - (0 - i.top).toString() + - ')', - ), - e.push('scale(-1 1)'), - (i.top = i.left = 0)) - : o && - (e.push( - 'translate(' + - (0 - i.left).toString() + - ' ' + - (i.height + i.top).toString() + - ')', - ), - e.push('scale(1 -1)'), - (i.top = i.left = 0)), - c < 0 && (c -= 4 * Math.floor(c / 4)), - (c %= 4), - c) - ) { - case 1: - (r = i.height / 2 + i.top), - e.unshift('rotate(90 ' + r.toString() + ' ' + r.toString() + ')'); - break; - case 2: - e.unshift( - 'rotate(180 ' + - (i.width / 2 + i.left).toString() + - ' ' + - (i.height / 2 + i.top).toString() + - ')', - ); - break; - case 3: - (r = i.width / 2 + i.left), - e.unshift('rotate(-90 ' + r.toString() + ' ' + r.toString() + ')'); - } - c % 2 == 1 && - (i.left !== i.top && ((r = i.left), (i.left = i.top), (i.top = r)), - i.width !== i.height && - ((r = i.width), (i.width = i.height), (i.height = r))), - e.length && (s = '' + s + ''); - }); - const c = o.width, - l = o.height, - u = i.width, - f = i.height; - let d, p; - null === c - ? ((p = null === l ? '1em' : 'auto' === l ? f : l), (d = yt(p, u / f))) - : ((d = 'auto' === c ? u : c), - (p = null === l ? yt(d, f / u) : 'auto' === l ? f : l)); - return { - attributes: { - width: d.toString(), - height: p.toString(), - viewBox: - i.left.toString() + - ' ' + - i.top.toString() + - ' ' + - u.toString() + - ' ' + - f.toString(), - }, - body: s, - }; -} -let xt = (() => { - let t; - try { - if (((t = fetch), 'function' == typeof t)) return t; - } catch (t) {} -})(); -function wt(t) { - xt = t; -} -function kt() { - return xt; -} -const jt = { - prepare: (t, e, n) => { - const o = [], - i = (function (t, e) { - const n = B(t); - if (!n) return 0; - let o; - if (n.maxURL) { - let t = 0; - n.resources.forEach((e) => { - const n = e; - t = Math.max(t, n.length); - }); - const i = e + '.json?icons='; - o = n.maxURL - t - n.path.length - i.length; - } else o = 0; - return o; - })(t, e), - r = 'icons'; - let s = { type: r, provider: t, prefix: e, icons: [] }, - c = 0; - return ( - n.forEach((n, a) => { - (c += n.length + 1), - c >= i && - a > 0 && - (o.push(s), - (s = { type: r, provider: t, prefix: e, icons: [] }), - (c = n.length)), - s.icons.push(n); - }), - o.push(s), - o - ); - }, - send: (t, e, n) => { - if (!xt) return void n('abort', 424); - let o = (function (t) { - if ('string' == typeof t) { - const e = B(t); - if (e) return e.path; - } - return '/'; - })(e.provider); - switch (e.type) { - case 'icons': { - const t = e.prefix, - n = e.icons.join(','); - o += t + '.json?' + new URLSearchParams({ icons: n }).toString(); - break; - } - case 'custom': { - const t = e.uri; - o += '/' === t.slice(0, 1) ? t.slice(1) : t; - break; - } - default: - return void n('abort', 400); - } - let i = 503; - xt(t + o) - .then((t) => { - const e = t.status; - if (200 === e) return (i = 501), t.json(); - setTimeout(() => { - n( - (function (t) { - return 404 === t; - })(e) - ? 'abort' - : 'next', - e, - ); - }); - }) - .then((t) => { - 'object' == typeof t && null !== t - ? setTimeout(() => { - n('success', t); - }) - : setTimeout(() => { - 404 === t ? n('abort', t) : n('next', i); - }); - }) - .catch(() => { - n('next', i); - }); - }, -}; -function _t(t, e) { - switch (t) { - case 'local': - case 'session': - et[t] = e; - break; - case 'all': - for (const t in et) et[t] = e; - } -} -function At() { - let t; - P('', jt), S(!0); - try { - t = window; - } catch (t) {} - if (t) { - if ((ct(), void 0 !== t.IconifyPreload)) { - const e = t.IconifyPreload, - n = 'Invalid IconifyPreload syntax.'; - 'object' == typeof e && - null !== e && - (e instanceof Array ? e : [e]).forEach((t) => { - try { - ('object' != typeof t || - null === t || - t instanceof Array || - 'object' != typeof t.icons || - 'string' != typeof t.prefix || - !E(t)) && - console.error(n); - } catch (t) { - console.error(n); - } - }); - } - if (void 0 !== t.IconifyProviders) { - const e = t.IconifyProviders; - if ('object' == typeof e && null !== e) - for (const t in e) { - const n = 'IconifyProviders[' + t + '] is invalid.'; - try { - const o = e[t]; - if ('object' != typeof o || !o || void 0 === o.resources) continue; - J(t, o) || console.error(n); - } catch (t) { - console.error(n); - } - } - } - } - return { - enableCache: (t) => _t(t, !0), - disableCache: (t) => _t(t, !1), - iconExists: I, - getIcon: M, - listIcons: _, - addIcon: C, - addCollection: E, - calculateSize: yt, - buildIcon: vt, - loadIcons: ft, - loadIcon: dt, - addAPIProvider: J, - _api: { - getAPIConfig: B, - setAPIModule: P, - sendAPIQuery: K, - setFetch: wt, - getFetch: kt, - listAPIProviders: H, - }, - }; -} -function St(t, e) { - let n = - -1 === t.indexOf('xlink:') - ? '' - : ' xmlns:xlink="http://www.w3.org/1999/xlink"'; - for (const t in e) n += ' ' + t + '="' + e[t] + '"'; - return '' + t + ''; -} -const Ot = { 'background-color': 'currentColor' }, - Ct = { 'background-color': 'transparent' }, - Et = { image: 'var(--svg)', repeat: 'no-repeat', size: '100% 100%' }, - It = { '-webkit-mask': Ot, mask: Ot, background: Ct }; -for (const t in It) { - const e = It[t]; - for (const n in Et) e[t + '-' + n] = Et[n]; -} -function Mt(t) { - return t + (t.match(/^[-0-9.]+$/) ? 'px' : ''); -} -function Tt(t, e) { - const n = e.icon.data, - o = e.customisations, - i = vt(n, o); - o.preserveAspectRatio && - (i.attributes.preserveAspectRatio = o.preserveAspectRatio); - const s = e.renderedMode; - let c; - if ('svg' === s) - c = (function (t) { - const e = document.createElement('span'); - return (e.innerHTML = St(t.body, t.attributes)), e.firstChild; - })(i); - else - c = (function (t, e, n) { - const o = document.createElement('span'); - let i = t.body; - -1 !== i.indexOf('/g, '%3E') - .replace(/\s+/g, ' ') + '")'), - c = o.style, - a = { - '--svg': s, - width: Mt(r.width), - height: Mt(r.height), - ...(n ? Ot : Ct), - }; - var l; - for (const t in a) c.setProperty(t, a[t]); - return o; - })(i, { ...r, ...n }, 'mask' === s); - const a = Array.from(t.childNodes).find((t) => { - const e = t.tagName && t.tagName.toUpperCase(); - return 'SPAN' === e || 'SVG' === e; - }); - a - ? 'SPAN' === c.tagName && a.tagName === c.tagName - ? a.setAttribute('style', c.getAttribute('style')) - : t.replaceChild(c, a) - : t.appendChild(c); -} -function Ft(t, e) { - let n = Array.from(t.childNodes).find( - (t) => t.hasAttribute && t.hasAttribute('data-style'), - ); - n || - ((n = document.createElement('style')), - n.setAttribute('data-style', 'data-style'), - t.appendChild(n)), - (n.textContent = - ':host{display:inline-block;vertical-align:' + - (e ? '-0.125em' : '0') + - '}span,svg{display:block}'); -} -function Nt(t, e, n) { - return { - rendered: !1, - inline: e, - icon: t, - lastRender: n && (n.rendered ? n : n.lastRender), - }; -} -(function (t = 'iconify-icon') { - let e, n; - try { - (e = window.customElements), (n = window.HTMLElement); - } catch (t) { - return; - } - if (!e || !n) return; - const o = e.get(t); - if (o) return o; - const i = ['icon', 'mode', 'inline', 'width', 'height', 'rotate', 'flip'], - r = class extends n { - _shadowRoot; - _state; - _checkQueued = !1; - constructor() { - super(); - const t = (this._shadowRoot = this.attachShadow({ mode: 'open' })), - e = ht(this); - Ft(t, e), (this._state = Nt({ value: '' }, e)), this._queueCheck(); - } - static get observedAttributes() { - return i.slice(0); - } - attributeChangedCallback(t) { - if ('inline' === t) { - const t = ht(this), - e = this._state; - t !== e.inline && ((e.inline = t), Ft(this._shadowRoot, t)); - } else this._queueCheck(); - } - get icon() { - const t = this.getAttribute('icon'); - if (t && '{' === t.slice(0, 1)) - try { - return JSON.parse(t); - } catch (t) {} - return t; - } - set icon(t) { - 'object' == typeof t && (t = JSON.stringify(t)), - this.setAttribute('icon', t); - } - get inline() { - return ht(this); - } - set inline(t) { - this.setAttribute('inline', t ? 'true' : null); - } - restartAnimation() { - const t = this._state; - if (t.rendered) { - const e = this._shadowRoot; - if ('svg' === t.renderedMode) - try { - return void e.lastChild.setCurrentTime(0); - } catch (t) {} - Tt(e, t); - } - } - get status() { - const t = this._state; - return t.rendered - ? 'rendered' - : null === t.icon.data - ? 'failed' - : 'loading'; - } - _queueCheck() { - this._checkQueued || - ((this._checkQueued = !0), - setTimeout(() => { - this._check(); - })); - } - _check() { - if (!this._checkQueued) return; - this._checkQueued = !1; - const t = this._state, - e = this.getAttribute('icon'); - if (e !== t.icon.value) return void this._iconChanged(e); - if (!t.rendered) return; - const n = this.getAttribute('mode'), - o = f(this); - (t.attrMode !== n || - (function (t, e) { - for (const n in u) if (t[n] !== e[n]) return !0; - return !1; - })(t.customisations, o)) && - this._renderIcon(t.icon, o, n); - } - _iconChanged(t) { - const e = pt(t, (t, e, n) => { - const o = this._state; - if (o.rendered || this.getAttribute('icon') !== t) return; - const i = { value: t, name: e, data: n }; - i.data ? this._gotIconData(i) : (o.icon = i); - }); - e.data - ? this._gotIconData(e) - : (this._state = Nt(e, this._state.inline, this._state)); - } - _gotIconData(t) { - (this._checkQueued = !1), - this._renderIcon(t, f(this), this.getAttribute('mode')); - } - _renderIcon(t, e, n) { - const o = (function (t, e) { - switch (e) { - case 'svg': - case 'bg': - case 'mask': - return e; - } - return 'style' === e || (!gt && -1 !== t.indexOf(' { - t in r.prototype || - Object.defineProperty(r.prototype, t, { - get: function () { - return this.getAttribute(t); - }, - set: function (e) { - this.setAttribute(t, e); - }, - }); - }); - const s = At(); - for (const t in s) r[t] = r.prototype[t] = s[t]; - return e.define(t, r), r; -})() || At(); -window.customElements.define( - 'dt-icon', - class extends n { - static get styles() { - return t`:root{font-size:inherit;color:inherit;display:inline-flex;width:fit-content;height:fit-content;position:relative}.tooltip{position:absolute;right:20px;top:-50%;min-width:max-content;border:solid 1px currentcolor;background-color:var(--dt-form-background-color,var(--surface-1));padding:.25rem;border-radius:.25rem;text-align:end;z-index:1;display:block}.tooltip:before{position:absolute;right:.7rem;top:1.45rem;content:" ";border-width:.25rem;border-style:solid;border-color:transparent transparent currentcolor transparent}.tooltip[hidden]{display:none}`; - } - static get properties() { - return { - ...super.properties, - icon: { type: String }, - tooltip: { type: String }, - tooltip_open: { type: Boolean }, - size: { type: String }, - }; - } - _showTooltip() { - this.tooltip_open ? (this.tooltip_open = !1) : (this.tooltip_open = !0); - } - render() { - const t = this.tooltip - ? e`
    ${this.tooltip}
    ` - : null; - return e`${t}`; - } - }, -); +* (c) Iconify +* +* For the full copyright and license information, please view the license.txt +* files at https://github.com/iconify/iconify +* +* Licensed under MIT. +* +* @license MIT +* @version 1.0.2 +*/const o=Object.freeze({left:0,top:0,width:16,height:16}),i=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),r=Object.freeze({...o,...i}),s=Object.freeze({...r,body:"",hidden:!1}),c=Object.freeze({width:null,height:null}),a=Object.freeze({...c,...i});const l=/[\s,]+/;const u={...a,preserveAspectRatio:""};function f(t){const e={...u},n=(e,n)=>t.getAttribute(e)||n;var o;return e.width=n("width",null),e.height=n("height",null),e.rotate=function(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function o(t){for(;t<0;)t+=4;return t%4}if(""===n){const e=parseInt(t);return isNaN(e)?0:o(e)}if(n!==t){let e=0;switch(n){case"%":e=25;break;case"deg":e=90}if(e){let i=parseFloat(t.slice(0,t.length-n.length));return isNaN(i)?0:(i/=e,i%1==0?o(i):0)}}return e}(n("rotate","")),o=e,n("flip","").split(l).forEach((t=>{switch(t.trim()){case"horizontal":o.hFlip=!0;break;case"vertical":o.vFlip=!0}})),e.preserveAspectRatio=n("preserveAspectRatio",n("preserveaspectratio","")),e}const d=/^[a-z0-9]+(-[a-z0-9]+)*$/,p=(t,e,n,o="")=>{const i=t.split(":");if("@"===t.slice(0,1)){if(i.length<2||i.length>3)return null;o=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const t=i.pop(),n=i.pop(),r={provider:i.length>0?i[0]:o,prefix:n,name:t};return e&&!h(r)?null:r}const r=i[0],s=r.split("-");if(s.length>1){const t={provider:o,prefix:s.shift(),name:s.join("-")};return e&&!h(t)?null:t}if(n&&""===o){const t={provider:o,prefix:"",name:r};return e&&!h(t,n)?null:t}return null},h=(t,e)=>!!t&&!(""!==t.provider&&!t.provider.match(d)||!(e&&""===t.prefix||t.prefix.match(d))||!t.name.match(d));function g(t,e){const n=function(t,e){const n={};!t.hFlip!=!e.hFlip&&(n.hFlip=!0),!t.vFlip!=!e.vFlip&&(n.vFlip=!0);const o=((t.rotate||0)+(e.rotate||0))%4;return o&&(n.rotate=o),n}(t,e);for(const o in s)o in i?o in t&&!(o in n)&&(n[o]=i[o]):o in e?n[o]=e[o]:o in t&&(n[o]=t[o]);return n}function m(t,e,n){const o=t.icons,i=t.aliases||Object.create(null);let r={};function s(t){r=g(o[t]||i[t],r)}return s(e),n.forEach(s),g(t,r)}function b(t,e){const n=[];if("object"!=typeof t||"object"!=typeof t.icons)return n;t.not_found instanceof Array&&t.not_found.forEach((t=>{e(t,null),n.push(t)}));const o=function(t,e){const n=t.icons,o=t.aliases||Object.create(null),i=Object.create(null);return(e||Object.keys(n).concat(Object.keys(o))).forEach((function t(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;const n=o[e]&&o[e].parent,r=n&&t(n);r&&(i[e]=[n].concat(r))}return i[e]})),i}(t);for(const i in o){const r=o[i];r&&(e(i,m(t,i,r)),n.push(i))}return n}const y={provider:"",aliases:{},not_found:{},...o};function v(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function x(t){if("object"!=typeof t||null===t)return null;const e=t;if("string"!=typeof e.prefix||!t.icons||"object"!=typeof t.icons)return null;if(!v(t,y))return null;const n=e.icons;for(const t in n){const e=n[t];if(!t.match(d)||"string"!=typeof e.body||!v(e,s))return null}const o=e.aliases||Object.create(null);for(const t in o){const e=o[t],i=e.parent;if(!t.match(d)||"string"!=typeof i||!n[i]&&!o[i]||!v(e,s))return null}return e}const w=Object.create(null);function k(t,e){const n=w[t]||(w[t]=Object.create(null));return n[e]||(n[e]=function(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}(t,e))}function j(t,e){return x(e)?b(e,((e,n)=>{n?t.icons[e]=n:t.missing.add(e)})):[]}function _(t,e){let n=[];return("string"==typeof t?[t]:Object.keys(w)).forEach((t=>{("string"==typeof t&&"string"==typeof e?[e]:Object.keys(w[t]||{})).forEach((e=>{const o=k(t,e);n=n.concat(Object.keys(o.icons).map((n=>(""!==t?"@"+t+":":"")+e+":"+n)))}))})),n}let A=!1;function S(t){return"boolean"==typeof t&&(A=t),A}function O(t){const e="string"==typeof t?p(t,!0,A):t;if(e){const t=k(e.provider,e.prefix),n=e.name;return t.icons[n]||(t.missing.has(n)?null:void 0)}}function C(t,e){const n=p(t,!0,A);if(!n)return!1;return function(t,e,n){try{if("string"==typeof n.body)return t.icons[e]={...n},!0}catch(t){}return!1}(k(n.provider,n.prefix),n.name,e)}function E(t,e){if("object"!=typeof t)return!1;if("string"!=typeof e&&(e=t.provider||""),A&&!e&&!t.prefix){let e=!1;return x(t)&&(t.prefix="",b(t,((t,n)=>{n&&C(t,n)&&(e=!0)}))),e}const n=t.prefix;if(!h({provider:e,prefix:n,name:"a"}))return!1;return!!j(k(e,n),t)}function I(t){return!!O(t)}function M(t){const e=O(t);return e?{...r,...e}:null}function T(t,e){t.forEach((t=>{const n=t.loaderCallbacks;n&&(t.loaderCallbacks=n.filter((t=>t.id!==e)))}))}let F=0;const N=Object.create(null);function P(t,e){N[t]=e}function R(t){return N[t]||N[""]}var z={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function L(t,e,n,o){const i=t.resources.length,r=t.random?Math.floor(Math.random()*i):t.index;let s;if(t.random){let e=t.resources.slice(0);for(s=[];e.length>1;){const t=Math.floor(Math.random()*e.length);s.push(e[t]),e=e.slice(0,t).concat(e.slice(t+1))}s=s.concat(e)}else s=t.resources.slice(r).concat(t.resources.slice(0,r));const c=Date.now();let a,l="pending",u=0,f=null,d=[],p=[];function h(){f&&(clearTimeout(f),f=null)}function g(){"pending"===l&&(l="aborted"),h(),d.forEach((t=>{"pending"===t.status&&(t.status="aborted")})),d=[]}function m(t,e){e&&(p=[]),"function"==typeof t&&p.push(t)}function b(){l="failed",p.forEach((t=>{t(void 0,a)}))}function y(){d.forEach((t=>{"pending"===t.status&&(t.status="aborted")})),d=[]}function v(){if("pending"!==l)return;h();const o=s.shift();if(void 0===o)return d.length?void(f=setTimeout((()=>{h(),"pending"===l&&(y(),b())}),t.timeout)):void b();const i={status:"pending",resource:o,callback:(e,n)=>{!function(e,n,o){const i="success"!==n;switch(d=d.filter((t=>t!==e)),l){case"pending":break;case"failed":if(i||!t.dataAfterTimeout)return;break;default:return}if("abort"===n)return a=o,void b();if(i)return a=o,void(d.length||(s.length?v():b()));if(h(),y(),!t.random){const n=t.resources.indexOf(e.resource);-1!==n&&n!==t.index&&(t.index=n)}l="completed",p.forEach((t=>{t(o)}))}(i,e,n)}};d.push(i),u++,f=setTimeout(v,t.rotate),n(o,e,i.callback)}return"function"==typeof o&&p.push(o),setTimeout(v),function(){return{startTime:c,payload:e,status:l,queriesSent:u,queriesPending:d.length,subscribe:m,abort:g}}}function Q(t){const e={...z,...t};let n=[];function o(){n=n.filter((t=>"pending"===t().status))}return{query:function(t,i,r){const s=L(e,t,i,((t,e)=>{o(),r&&r(t,e)}));return n.push(s),s},find:function(t){return n.find((e=>t(e)))||null},setIndex:t=>{e.index=t},getIndex:()=>e.index,cleanup:o}}function $(t){let e;if("string"==typeof t.resources)e=[t.resources];else if(e=t.resources,!(e instanceof Array&&e.length))return null;return{resources:e,path:t.path||"/",maxURL:t.maxURL||500,rotate:t.rotate||750,timeout:t.timeout||5e3,random:!0===t.random,index:t.index||0,dataAfterTimeout:!1!==t.dataAfterTimeout}}const D=Object.create(null),q=["https://api.simplesvg.com","https://api.unisvg.com"],U=[];for(;q.length>0;)1===q.length||Math.random()>.5?U.push(q.shift()):U.push(q.pop());function J(t,e){const n=$(e);return null!==n&&(D[t]=n,!0)}function B(t){return D[t]}function H(){return Object.keys(D)}function G(){}D[""]=$({resources:["https://api.iconify.design"].concat(U)});const V=Object.create(null);function K(t,e,n){let o,i;if("string"==typeof t){const e=R(t);if(!e)return n(void 0,424),G;i=e.send;const r=function(t){if(!V[t]){const e=B(t);if(!e)return;const n={config:e,redundancy:Q(e)};V[t]=n}return V[t]}(t);r&&(o=r.redundancy)}else{const e=$(t);if(e){o=Q(e);const n=R(t.resources?t.resources[0]:"");n&&(i=n.send)}}return o&&i?o.query(e,i,n)().abort:(n(void 0,424),G)}function W(t,e){try{return t.getItem(e)}catch(t){}}function X(t,e,n){try{return t.setItem(e,n),!0}catch(t){}}function Y(t,e){try{t.removeItem(e)}catch(t){}}function Z(t,e){return X(t,"iconify-count",e.toString())}function tt(t){return parseInt(W(t,"iconify-count"))||0}const et={local:!0,session:!0},nt={local:new Set,session:new Set};let ot=!1;let it="undefined"==typeof window?{}:window;function rt(t){const e=t+"Storage";try{if(it&&it[e]&&"number"==typeof it[e].length)return it[e]}catch(t){}et[t]=!1}function st(t,e){const n=rt(t);if(!n)return;const o=W(n,"iconify-version");if("iconify2"!==o){if(o){const t=tt(n);for(let e=0;e{const o="iconify"+t.toString(),r=W(n,o);if("string"==typeof r){try{const n=JSON.parse(r);if("object"==typeof n&&"number"==typeof n.cached&&n.cached>i&&"string"==typeof n.provider&&"object"==typeof n.data&&"string"==typeof n.data.prefix&&e(n,t))return!0}catch(t){}Y(n,o)}};let s=tt(n);for(let e=s-1;e>=0;e--)r(e)||(e===s-1?(s--,Z(n,s)):nt[t].add(e))}function ct(){if(!ot){ot=!0;for(const t in et)st(t,(t=>{const e=t.data,n=k(t.provider,e.prefix);if(!j(n,e).length)return!1;const o=e.lastModified||-1;return n.lastModifiedCached=n.lastModifiedCached?Math.min(n.lastModifiedCached,o):o,!0}))}}function at(t,e){function n(n){let o;if(!et[n]||!(o=rt(n)))return;const i=nt[n];let r;if(i.size)i.delete(r=Array.from(i).shift());else if(r=tt(o),!Z(o,r+1))return;const s={cached:Math.floor(Date.now()/36e5),provider:t.provider,data:e};return X(o,"iconify"+r.toString(),JSON.stringify(s))}ot||ct(),e.lastModified&&!function(t,e){const n=t.lastModifiedCached;if(n&&n>=e)return n===e;if(t.lastModifiedCached=e,n)for(const n in et)st(n,(n=>{const o=n.data;return n.provider!==t.provider||o.prefix!==t.prefix||o.lastModified===e}));return!0}(t,e.lastModified)||Object.keys(e.icons).length&&(e.not_found&&delete(e=Object.assign({},e)).not_found,n("local")||n("session"))}function lt(){}function ut(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout((()=>{t.iconsLoaderFlag=!1,function(t){t.pendingCallbacksFlag||(t.pendingCallbacksFlag=!0,setTimeout((()=>{t.pendingCallbacksFlag=!1;const e=t.loaderCallbacks?t.loaderCallbacks.slice(0):[];if(!e.length)return;let n=!1;const o=t.provider,i=t.prefix;e.forEach((e=>{const r=e.icons,s=r.pending.length;r.pending=r.pending.filter((e=>{if(e.prefix!==i)return!0;const s=e.name;if(t.icons[s])r.loaded.push({provider:o,prefix:i,name:s});else{if(!t.missing.has(s))return n=!0,!0;r.missing.push({provider:o,prefix:i,name:s})}return!1})),r.pending.length!==s&&(n||T([t],e.id),e.callback(r.loaded.slice(0),r.missing.slice(0),r.pending.slice(0),e.abort))}))})))}(t)})))}const ft=(t,e)=>{const n=function(t,e=!0,n=!1){const o=[];return t.forEach((t=>{const i="string"==typeof t?p(t,e,n):t;i&&o.push(i)})),o}(t,!0,S()),o=function(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort(((t,e)=>t.provider!==e.provider?t.provider.localeCompare(e.provider):t.prefix!==e.prefix?t.prefix.localeCompare(e.prefix):t.name.localeCompare(e.name)));let o={provider:"",prefix:"",name:""};return t.forEach((t=>{if(o.name===t.name&&o.prefix===t.prefix&&o.provider===t.provider)return;o=t;const i=t.provider,r=t.prefix,s=t.name,c=n[i]||(n[i]=Object.create(null)),a=c[r]||(c[r]=k(i,r));let l;l=s in a.icons?e.loaded:""===r||a.missing.has(s)?e.missing:e.pending;const u={provider:i,prefix:r,name:s};l.push(u)})),e}(n);if(!o.pending.length){let t=!0;return e&&setTimeout((()=>{t&&e(o.loaded,o.missing,o.pending,lt)})),()=>{t=!1}}const i=Object.create(null),r=[];let s,c;return o.pending.forEach((t=>{const{provider:e,prefix:n}=t;if(n===c&&e===s)return;s=e,c=n,r.push(k(e,n));const o=i[e]||(i[e]=Object.create(null));o[n]||(o[n]=[])})),o.pending.forEach((t=>{const{provider:e,prefix:n,name:o}=t,r=k(e,n),s=r.pendingIcons||(r.pendingIcons=new Set);s.has(o)||(s.add(o),i[e][n].push(o))})),r.forEach((t=>{const{provider:e,prefix:n}=t;i[e][n].length&&function(t,e){t.iconsToLoad?t.iconsToLoad=t.iconsToLoad.concat(e).sort():t.iconsToLoad=e,t.iconsQueueFlag||(t.iconsQueueFlag=!0,setTimeout((()=>{t.iconsQueueFlag=!1;const{provider:e,prefix:n}=t,o=t.iconsToLoad;let i;delete t.iconsToLoad,o&&(i=R(e))&&i.prepare(e,n,o).forEach((n=>{K(e,n,(e=>{if("object"!=typeof e)n.icons.forEach((e=>{t.missing.add(e)}));else try{const n=j(t,e);if(!n.length)return;const o=t.pendingIcons;o&&n.forEach((t=>{o.delete(t)})),at(t,e)}catch(t){console.error(t)}ut(t)}))}))})))}(t,i[e][n])})),e?function(t,e,n){const o=F++,i=T.bind(null,n,o);if(!e.pending.length)return i;const r={id:o,icons:e,callback:t,abort:i};return n.forEach((t=>{(t.loaderCallbacks||(t.loaderCallbacks=[])).push(r)})),i}(e,o,r):lt},dt=t=>new Promise(((e,n)=>{const o="string"==typeof t?p(t,!0):t;o?ft([o||t],(i=>{if(i.length&&o){const t=O(o);if(t)return void e({...r,...t})}n(t)})):n(t)}));function pt(t,e){const n="string"==typeof t?p(t,!0,!0):null;if(!n){const e=function(t){try{const e="string"==typeof t?JSON.parse(t):t;if("string"==typeof e.body)return{...e}}catch(t){}}(t);return{value:t,data:e}}const o=O(n);if(void 0!==o||!n.prefix)return{value:t,name:n,data:o};const i=ft([n],(()=>e(t,n,O(n))));return{value:t,name:n,loading:i}}function ht(t){return t.hasAttribute("inline")}let gt=!1;try{gt=0===navigator.vendor.indexOf("Apple")}catch(t){}const mt=/(-?[0-9.]*[0-9]+[0-9.]*)/g,bt=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function yt(t,e,n){if(1===e)return t;if(n=n||100,"number"==typeof t)return Math.ceil(t*e*n)/n;if("string"!=typeof t)return t;const o=t.split(mt);if(null===o||!o.length)return t;const i=[];let r=o.shift(),s=bt.test(r);for(;;){if(s){const t=parseFloat(r);isNaN(t)?i.push(r):i.push(Math.ceil(t*e*n)/n)}else i.push(r);if(r=o.shift(),void 0===r)return i.join("");s=!s}}function vt(t,e){const n={...r,...t},o={...a,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let s=n.body;[n,o].forEach((t=>{const e=[],n=t.hFlip,o=t.vFlip;let r,c=t.rotate;switch(n?o?c+=2:(e.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),e.push("scale(-1 1)"),i.top=i.left=0):o&&(e.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),e.push("scale(1 -1)"),i.top=i.left=0),c<0&&(c-=4*Math.floor(c/4)),c%=4,c){case 1:r=i.height/2+i.top,e.unshift("rotate(90 "+r.toString()+" "+r.toString()+")");break;case 2:e.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:r=i.width/2+i.left,e.unshift("rotate(-90 "+r.toString()+" "+r.toString()+")")}c%2==1&&(i.left!==i.top&&(r=i.left,i.left=i.top,i.top=r),i.width!==i.height&&(r=i.width,i.width=i.height,i.height=r)),e.length&&(s=''+s+"")}));const c=o.width,l=o.height,u=i.width,f=i.height;let d,p;null===c?(p=null===l?"1em":"auto"===l?f:l,d=yt(p,u/f)):(d="auto"===c?u:c,p=null===l?yt(d,f/u):"auto"===l?f:l);return{attributes:{width:d.toString(),height:p.toString(),viewBox:i.left.toString()+" "+i.top.toString()+" "+u.toString()+" "+f.toString()},body:s}}let xt=(()=>{let t;try{if(t=fetch,"function"==typeof t)return t}catch(t){}})();function wt(t){xt=t}function kt(){return xt}const jt={prepare:(t,e,n)=>{const o=[],i=function(t,e){const n=B(t);if(!n)return 0;let o;if(n.maxURL){let t=0;n.resources.forEach((e=>{const n=e;t=Math.max(t,n.length)}));const i=e+".json?icons=";o=n.maxURL-t-n.path.length-i.length}else o=0;return o}(t,e),r="icons";let s={type:r,provider:t,prefix:e,icons:[]},c=0;return n.forEach(((n,a)=>{c+=n.length+1,c>=i&&a>0&&(o.push(s),s={type:r,provider:t,prefix:e,icons:[]},c=n.length),s.icons.push(n)})),o.push(s),o},send:(t,e,n)=>{if(!xt)return void n("abort",424);let o=function(t){if("string"==typeof t){const e=B(t);if(e)return e.path}return"/"}(e.provider);switch(e.type){case"icons":{const t=e.prefix,n=e.icons.join(",");o+=t+".json?"+new URLSearchParams({icons:n}).toString();break}case"custom":{const t=e.uri;o+="/"===t.slice(0,1)?t.slice(1):t;break}default:return void n("abort",400)}let i=503;xt(t+o).then((t=>{const e=t.status;if(200===e)return i=501,t.json();setTimeout((()=>{n(function(t){return 404===t}(e)?"abort":"next",e)}))})).then((t=>{"object"==typeof t&&null!==t?setTimeout((()=>{n("success",t)})):setTimeout((()=>{404===t?n("abort",t):n("next",i)}))})).catch((()=>{n("next",i)}))}};function _t(t,e){switch(t){case"local":case"session":et[t]=e;break;case"all":for(const t in et)et[t]=e}}function At(){let t;P("",jt),S(!0);try{t=window}catch(t){}if(t){if(ct(),void 0!==t.IconifyPreload){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";"object"==typeof e&&null!==e&&(e instanceof Array?e:[e]).forEach((t=>{try{("object"!=typeof t||null===t||t instanceof Array||"object"!=typeof t.icons||"string"!=typeof t.prefix||!E(t))&&console.error(n)}catch(t){console.error(n)}}))}if(void 0!==t.IconifyProviders){const e=t.IconifyProviders;if("object"==typeof e&&null!==e)for(const t in e){const n="IconifyProviders["+t+"] is invalid.";try{const o=e[t];if("object"!=typeof o||!o||void 0===o.resources)continue;J(t,o)||console.error(n)}catch(t){console.error(n)}}}}return{enableCache:t=>_t(t,!0),disableCache:t=>_t(t,!1),iconExists:I,getIcon:M,listIcons:_,addIcon:C,addCollection:E,calculateSize:yt,buildIcon:vt,loadIcons:ft,loadIcon:dt,addAPIProvider:J,_api:{getAPIConfig:B,setAPIModule:P,sendAPIQuery:K,setFetch:wt,getFetch:kt,listAPIProviders:H}}}function St(t,e){let n=-1===t.indexOf("xlink:")?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const t in e)n+=" "+t+'="'+e[t]+'"';return'"+t+""}const Ot={"background-color":"currentColor"},Ct={"background-color":"transparent"},Et={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},It={"-webkit-mask":Ot,mask:Ot,background:Ct};for(const t in It){const e=It[t];for(const n in Et)e[t+"-"+n]=Et[n]}function Mt(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}function Tt(t,e){const n=e.icon.data,o=e.customisations,i=vt(n,o);o.preserveAspectRatio&&(i.attributes.preserveAspectRatio=o.preserveAspectRatio);const s=e.renderedMode;let c;if("svg"===s)c=function(t){const e=document.createElement("span");return e.innerHTML=St(t.body,t.attributes),e.firstChild}(i);else c=function(t,e,n){const o=document.createElement("span");let i=t.body;-1!==i.indexOf("/g,"%3E").replace(/\s+/g," ")+'")'),c=o.style,a={"--svg":s,width:Mt(r.width),height:Mt(r.height),...n?Ot:Ct};var l;for(const t in a)c.setProperty(t,a[t]);return o}(i,{...r,...n},"mask"===s);const a=Array.from(t.childNodes).find((t=>{const e=t.tagName&&t.tagName.toUpperCase();return"SPAN"===e||"SVG"===e}));a?"SPAN"===c.tagName&&a.tagName===c.tagName?a.setAttribute("style",c.getAttribute("style")):t.replaceChild(c,a):t.appendChild(c)}function Ft(t,e){let n=Array.from(t.childNodes).find((t=>t.hasAttribute&&t.hasAttribute("data-style")));n||(n=document.createElement("style"),n.setAttribute("data-style","data-style"),t.appendChild(n)),n.textContent=":host{display:inline-block;vertical-align:"+(e?"-0.125em":"0")+"}span,svg{display:block}"}function Nt(t,e,n){return{rendered:!1,inline:e,icon:t,lastRender:n&&(n.rendered?n:n.lastRender)}}(function(t="iconify-icon"){let e,n;try{e=window.customElements,n=window.HTMLElement}catch(t){return}if(!e||!n)return;const o=e.get(t);if(o)return o;const i=["icon","mode","inline","width","height","rotate","flip"],r=class extends n{_shadowRoot;_state;_checkQueued=!1;constructor(){super();const t=this._shadowRoot=this.attachShadow({mode:"open"}),e=ht(this);Ft(t,e),this._state=Nt({value:""},e),this._queueCheck()}static get observedAttributes(){return i.slice(0)}attributeChangedCallback(t){if("inline"===t){const t=ht(this),e=this._state;t!==e.inline&&(e.inline=t,Ft(this._shadowRoot,t))}else this._queueCheck()}get icon(){const t=this.getAttribute("icon");if(t&&"{"===t.slice(0,1))try{return JSON.parse(t)}catch(t){}return t}set icon(t){"object"==typeof t&&(t=JSON.stringify(t)),this.setAttribute("icon",t)}get inline(){return ht(this)}set inline(t){this.setAttribute("inline",t?"true":null)}restartAnimation(){const t=this._state;if(t.rendered){const e=this._shadowRoot;if("svg"===t.renderedMode)try{return void e.lastChild.setCurrentTime(0)}catch(t){}Tt(e,t)}}get status(){const t=this._state;return t.rendered?"rendered":null===t.icon.data?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout((()=>{this._check()})))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const t=this._state,e=this.getAttribute("icon");if(e!==t.icon.value)return void this._iconChanged(e);if(!t.rendered)return;const n=this.getAttribute("mode"),o=f(this);(t.attrMode!==n||function(t,e){for(const n in u)if(t[n]!==e[n])return!0;return!1}(t.customisations,o))&&this._renderIcon(t.icon,o,n)}_iconChanged(t){const e=pt(t,((t,e,n)=>{const o=this._state;if(o.rendered||this.getAttribute("icon")!==t)return;const i={value:t,name:e,data:n};i.data?this._gotIconData(i):o.icon=i}));e.data?this._gotIconData(e):this._state=Nt(e,this._state.inline,this._state)}_gotIconData(t){this._checkQueued=!1,this._renderIcon(t,f(this),this.getAttribute("mode"))}_renderIcon(t,e,n){const o=function(t,e){switch(e){case"svg":case"bg":case"mask":return e}return"style"===e||!gt&&-1!==t.indexOf("{t in r.prototype||Object.defineProperty(r.prototype,t,{get:function(){return this.getAttribute(t)},set:function(e){this.setAttribute(t,e)}})}));const s=At();for(const t in s)r[t]=r.prototype[t]=s[t];return e.define(t,r),r})()||At();window.customElements.define("dt-icon",class extends n{static get styles(){return t`:root{font-size:inherit;color:inherit;display:inline-flex;width:fit-content;height:fit-content;position:relative}.tooltip{position:absolute;right:20px;top:-50%;min-width:max-content;border:solid 1px currentcolor;background-color:var(--dt-form-background-color,var(--surface-1));padding:.25rem;border-radius:.25rem;text-align:end;z-index:1;display:block}.tooltip:before{position:absolute;right:.7rem;top:1.45rem;content:" ";border-width:.25rem;border-style:solid;border-color:transparent transparent currentcolor transparent}.tooltip[hidden]{display:none}`}static get properties(){return{...super.properties,icon:{type:String},tooltip:{type:String},tooltip_open:{type:Boolean},size:{type:String}}}_showTooltip(){this.tooltip_open?this.tooltip_open=!1:this.tooltip_open=!0}render(){const t=this.tooltip?e`
    ${this.tooltip}
    `:null;return e`${t}`}}); //# sourceMappingURL=dt-icon.js.map diff --git a/dt-assets/build/components/icons/dt-spinner.js b/dt-assets/build/components/icons/dt-spinner.js index 3e71a77c35..c79de5030a 100644 --- a/dt-assets/build/components/icons/dt-spinner.js +++ b/dt-assets/build/components/icons/dt-spinner.js @@ -1,10 +1,2 @@ -import { s as e, i as r } from '../lit-element-2409d5fe.js'; -window.customElements.define( - 'dt-spinner', - class extends e { - static get styles() { - return r`@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}:host::before{content:'';animation:spin 1s linear infinite;border:.25rem solid var(--dt-spinner-color-1,#919191);border-radius:50%;border-top-color:var(--dt-spinner-color-2,#000);display:inline-block;height:1rem;width:1rem}`; - } - }, -); +import{s as e,i as r}from"../lit-element-2409d5fe.js";window.customElements.define("dt-spinner",class extends e{static get styles(){return r`@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}:host::before{content:'';animation:spin 1s linear infinite;border:.25rem solid var(--dt-spinner-color-1,#919191);border-radius:50%;border-top-color:var(--dt-spinner-color-2,#000);display:inline-block;height:1rem;width:1rem}`}}); //# sourceMappingURL=dt-spinner.js.map diff --git a/dt-assets/build/components/icons/dt-star.js b/dt-assets/build/components/icons/dt-star.js index 10dec086bf..67e2be3b79 100644 --- a/dt-assets/build/components/icons/dt-star.js +++ b/dt-assets/build/components/icons/dt-star.js @@ -1,29 +1,2 @@ -import { s as e, i as t, y as s } from '../lit-element-2409d5fe.js'; -window.customElements.define( - 'dt-star', - class extends e { - static get styles() { - return t`:host{fill:var(--star-unselected-color,#c7c6c1)}:host([selected]){fill:var(--star-unselected-color,#ffc005)}`; - } - static get properties() { - return { - postID: { type: Number }, - selected: { type: Boolean, reflect: !0 }, - }; - } - _onclick() { - this.selected = !this.selected; - const e = new CustomEvent('change', { - detail: { postID: this.postID, favorited: this.selected }, - }); - this.dispatchEvent(e); - } - _keyUp(e) { - 13 === (e.keyCode || e.which) && this._onclick(); - } - render() { - return s``; - } - }, -); +import{s as e,i as t,y as s}from"../lit-element-2409d5fe.js";window.customElements.define("dt-star",class extends e{static get styles(){return t`:host{fill:var(--star-unselected-color,#c7c6c1)}:host([selected]){fill:var(--star-unselected-color,#ffc005)}`}static get properties(){return{postID:{type:Number},selected:{type:Boolean,reflect:!0}}}_onclick(){this.selected=!this.selected;const e=new CustomEvent("change",{detail:{postID:this.postID,favorited:this.selected}});this.dispatchEvent(e)}_keyUp(e){13===(e.keyCode||e.which)&&this._onclick()}render(){return s``}}); //# sourceMappingURL=dt-star.js.map diff --git a/dt-assets/build/components/icons/index.js b/dt-assets/build/components/icons/index.js index 93ce32827c..1e12594643 100644 --- a/dt-assets/build/components/icons/index.js +++ b/dt-assets/build/components/icons/index.js @@ -1,9 +1,2 @@ -import './dt-checkmark.js'; -import './dt-exclamation-circle.js'; -import './dt-icon.js'; -import './dt-spinner.js'; -import './dt-star.js'; -import '../lit-element-2409d5fe.js'; -import '../dt-base.js'; -import '../lit-localize-763e4978.js'; +import"./dt-checkmark.js";import"./dt-exclamation-circle.js";import"./dt-icon.js";import"./dt-spinner.js";import"./dt-star.js";import"../lit-element-2409d5fe.js";import"../dt-base.js";import"../lit-localize-763e4978.js"; //# sourceMappingURL=index.js.map diff --git a/dt-assets/build/components/if-defined-11ddebeb.js b/dt-assets/build/components/if-defined-11ddebeb.js index ff0325fc8f..b77d5790d8 100644 --- a/dt-assets/build/components/if-defined-11ddebeb.js +++ b/dt-assets/build/components/if-defined-11ddebeb.js @@ -1,8 +1,7 @@ -import { b as e } from './lit-element-2409d5fe.js'; +import{b as e}from"./lit-element-2409d5fe.js"; /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */ const t = (t) => (null != t ? t : e); -export { t as l }; + */const t=t=>null!=t?t:e;export{t as l}; //# sourceMappingURL=if-defined-11ddebeb.js.map diff --git a/dt-assets/build/components/index.js b/dt-assets/build/components/index.js index 245da49600..c610ab158e 100644 --- a/dt-assets/build/components/index.js +++ b/dt-assets/build/components/index.js @@ -1,39 +1,2 @@ -import './form/dt-button/dt-button.js'; -import './form/dt-church-health-circle/dt-church-health-circle.js'; -import './form/dt-connection/dt-connection.js'; -import './form/dt-date/dt-date.js'; -import './form/dt-label/dt-label.js'; -import './form/dt-location/dt-location.js'; -import './form/dt-location-map/dt-location-map.js'; -import './form/dt-multi-select/dt-multi-select.js'; -import './form/dt-number/dt-number.js'; -import './form/dt-single-select/dt-single-select.js'; -import './form/dt-tags/dt-tags.js'; -import './form/dt-text/dt-text.js'; -import './form/dt-textarea/dt-textarea.js'; -import './form/dt-toggle/dt-toggle.js'; -import './form/dt-communication-channel/dt-comm-channel.js'; -import './icons/dt-checkmark.js'; -import './icons/dt-exclamation-circle.js'; -import './icons/dt-icon.js'; -import './icons/dt-spinner.js'; -import './icons/dt-star.js'; -import './layout/dt-alert/dt-alert.js'; -import './layout/dt-list/dt-list.js'; -import './layout/dt-modal/dt-modal.js'; -import './layout/dt-tile/dt-tile.js'; -import './lit-element-2409d5fe.js'; -import './class-map-8d921948.js'; -import './directive-de55b00a.js'; -import './dt-base.js'; -import './lit-localize-763e4978.js'; -import './form/dt-church-health-circle/dt-church-health-circle-icon.js'; -import './form/dt-form-base.js'; -import './style-map-ac85d91b.js'; -import './map-c0e24c36.js'; -import './repeat-1a2b8966.js'; -import './form/dt-location-map/dt-location-map-item.js'; -import './form/dt-location-map/dt-map-modal.js'; -import './form/mixins/hasOptionsList.js'; -import './if-defined-11ddebeb.js'; +import"./form/dt-button/dt-button.js";import"./form/dt-church-health-circle/dt-church-health-circle.js";import"./form/dt-connection/dt-connection.js";import"./form/dt-date/dt-date.js";import"./form/dt-label/dt-label.js";import"./form/dt-location/dt-location.js";import"./form/dt-location-map/dt-location-map.js";import"./form/dt-multi-select/dt-multi-select.js";import"./form/dt-number/dt-number.js";import"./form/dt-single-select/dt-single-select.js";import"./form/dt-tags/dt-tags.js";import"./form/dt-text/dt-text.js";import"./form/dt-textarea/dt-textarea.js";import"./form/dt-toggle/dt-toggle.js";import"./form/dt-communication-channel/dt-comm-channel.js";import"./icons/dt-checkmark.js";import"./icons/dt-exclamation-circle.js";import"./icons/dt-icon.js";import"./icons/dt-spinner.js";import"./icons/dt-star.js";import"./layout/dt-alert/dt-alert.js";import"./layout/dt-list/dt-list.js";import"./layout/dt-modal/dt-modal.js";import"./layout/dt-tile/dt-tile.js";import"./lit-element-2409d5fe.js";import"./class-map-8d921948.js";import"./directive-de55b00a.js";import"./dt-base.js";import"./lit-localize-763e4978.js";import"./form/dt-church-health-circle/dt-church-health-circle-icon.js";import"./form/dt-form-base.js";import"./style-map-ac85d91b.js";import"./map-c0e24c36.js";import"./repeat-1a2b8966.js";import"./form/dt-location-map/dt-location-map-item.js";import"./form/dt-location-map/dt-map-modal.js";import"./form/mixins/hasOptionsList.js";import"./if-defined-11ddebeb.js"; //# sourceMappingURL=index.js.map diff --git a/dt-assets/build/components/layout/dt-alert/dt-alert.js b/dt-assets/build/components/layout/dt-alert/dt-alert.js index a4bff3b819..76ab3a9c07 100644 --- a/dt-assets/build/components/layout/dt-alert/dt-alert.js +++ b/dt-assets/build/components/layout/dt-alert/dt-alert.js @@ -1,45 +1,2 @@ -import { i as t, y as r } from '../../lit-element-2409d5fe.js'; -import { o as e } from '../../class-map-8d921948.js'; -import { D as o } from '../../dt-base.js'; -import '../../directive-de55b00a.js'; -import '../../lit-localize-763e4978.js'; -window.customElements.define( - 'dt-alert', - class extends o { - static get styles() { - return t`:host{display:block}.dt-alert{padding:var(--dt-alert-padding,10px);font-family:var(--dt-alert-font-family);font-size:var(--dt-alert-font-size,14px);font-weight:var(--dt-alert-font-weight,700);background-color:var(--dt-alert-context-background-color,var(--dt-alert-background-color));border:var(--dt-alert-border-width,1px) solid var(--dt-alert-context-border-color,var(--dt-alert-border-color));border-radius:var(--dt-alert-border-radius,10px);box-shadow:var(--dt-alert-box-shadow,0 2px 4px rgb(0 0 0 / 25%));color:var(--dt-alert-context-text-color,var(--dt-alert-text-color));text-rendering:optimizeLegibility;display:flex;gap:var(--dt-alert-gap,10px);justify-content:space-between;align-content:center;align-items:center;white-space:initial}.dt-alert.dt-alert--outline{background-color:transparent;color:var(--dt-alert-context-text-color,var(--text-color-inverse))}.dt-alert--primary:not(.dt-alert--outline){--dt-alert-context-border-color:var(--primary-color);--dt-alert-context-background-color:var(--primary-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--alert:not(.dt-alert--outline){--dt-alert-context-border-color:var(--alert-color);--dt-alert-context-background-color:var(--alert-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--caution:not(.dt-alert--outline){--dt-alert-context-border-color:var(--caution-color);--dt-alert-context-background-color:var(--caution-color);--dt-alert-context-text-color:var(--dt-alert-text-color-dark)}.dt-alert--success:not(.dt-alert--outline){--dt-alert-context-border-color:var(--success-color);--dt-alert-context-background-color:var(--success-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--inactive:not(.dt-alert--outline){--dt-alert-context-border-color:var(--inactive-color);--dt-alert-context-background-color:var(--inactive-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--disabled:not(.dt-alert--outline){--dt-alert-context-border-color:var(--disabled-color);--dt-alert-context-background-color:var(--disabled-color);--dt-alert-context-text-color:var(--dt-alert-text-color-dark)}.dt-alert--primary.dt-alert--outline{--dt-alert-context-border-color:var(--primary-color);--dt-alert-context-text-color:var(--primary-color)}.dt-alert--alert.dt-alert--outline{--dt-alert-context-border-color:var(--alert-color);--dt-alert-context-text-color:var(--alert-color)}.dt-alert--caution.dt-alert--outline{--dt-alert-context-border-color:var(--caution-color);--dt-alert-context-text-color:var(--caution-color)}.dt-alert--success.dt-alert--outline{--dt-alert-context-border-color:var(--success-color);--dt-alert-context-text-color:var(--success-color)}.dt-alert--inactive.dt-alert--outline{--dt-alert-context-border-color:var(--inactive-color)}.dt-alert--disabled.dt-alert--outline{--dt-alert-context-border-color:var(--disabled-color)}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none;color:inherit;cursor:pointer;display:flex;align-items:center}`; - } - static get properties() { - return { - context: { type: String }, - dismissable: { type: Boolean }, - timeout: { type: Number }, - hide: { type: Boolean }, - outline: { type: Boolean }, - }; - } - get classes() { - const t = { 'dt-alert': !0, 'dt-alert--outline': this.outline }; - return (t[`dt-alert--${this.context}`] = !0), t; - } - constructor() { - super(), (this.context = 'default'); - } - connectedCallback() { - super.connectedCallback(), - this.timeout && - setTimeout(() => { - this._dismiss(); - }, this.timeout); - } - _dismiss() { - this.hide = !0; - } - render() { - if (this.hide) return r``; - const t = r`xmlns="http://www.w3.org/2000/svg">`; - return r``; - } - }, -); +import{i as t,y as r}from"../../lit-element-2409d5fe.js";import{o as e}from"../../class-map-8d921948.js";import{D as o}from"../../dt-base.js";import"../../directive-de55b00a.js";import"../../lit-localize-763e4978.js";window.customElements.define("dt-alert",class extends o{static get styles(){return t`:host{display:block}.dt-alert{padding:var(--dt-alert-padding,10px);font-family:var(--dt-alert-font-family);font-size:var(--dt-alert-font-size,14px);font-weight:var(--dt-alert-font-weight,700);background-color:var(--dt-alert-context-background-color,var(--dt-alert-background-color));border:var(--dt-alert-border-width,1px) solid var(--dt-alert-context-border-color,var(--dt-alert-border-color));border-radius:var(--dt-alert-border-radius,10px);box-shadow:var(--dt-alert-box-shadow,0 2px 4px rgb(0 0 0 / 25%));color:var(--dt-alert-context-text-color,var(--dt-alert-text-color));text-rendering:optimizeLegibility;display:flex;gap:var(--dt-alert-gap,10px);justify-content:space-between;align-content:center;align-items:center;white-space:initial}.dt-alert.dt-alert--outline{background-color:transparent;color:var(--dt-alert-context-text-color,var(--text-color-inverse))}.dt-alert--primary:not(.dt-alert--outline){--dt-alert-context-border-color:var(--primary-color);--dt-alert-context-background-color:var(--primary-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--alert:not(.dt-alert--outline){--dt-alert-context-border-color:var(--alert-color);--dt-alert-context-background-color:var(--alert-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--caution:not(.dt-alert--outline){--dt-alert-context-border-color:var(--caution-color);--dt-alert-context-background-color:var(--caution-color);--dt-alert-context-text-color:var(--dt-alert-text-color-dark)}.dt-alert--success:not(.dt-alert--outline){--dt-alert-context-border-color:var(--success-color);--dt-alert-context-background-color:var(--success-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--inactive:not(.dt-alert--outline){--dt-alert-context-border-color:var(--inactive-color);--dt-alert-context-background-color:var(--inactive-color);--dt-alert-context-text-color:var(--dt-alert-text-color-light)}.dt-alert--disabled:not(.dt-alert--outline){--dt-alert-context-border-color:var(--disabled-color);--dt-alert-context-background-color:var(--disabled-color);--dt-alert-context-text-color:var(--dt-alert-text-color-dark)}.dt-alert--primary.dt-alert--outline{--dt-alert-context-border-color:var(--primary-color);--dt-alert-context-text-color:var(--primary-color)}.dt-alert--alert.dt-alert--outline{--dt-alert-context-border-color:var(--alert-color);--dt-alert-context-text-color:var(--alert-color)}.dt-alert--caution.dt-alert--outline{--dt-alert-context-border-color:var(--caution-color);--dt-alert-context-text-color:var(--caution-color)}.dt-alert--success.dt-alert--outline{--dt-alert-context-border-color:var(--success-color);--dt-alert-context-text-color:var(--success-color)}.dt-alert--inactive.dt-alert--outline{--dt-alert-context-border-color:var(--inactive-color)}.dt-alert--disabled.dt-alert--outline{--dt-alert-context-border-color:var(--disabled-color)}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none;color:inherit;cursor:pointer;display:flex;align-items:center}`}static get properties(){return{context:{type:String},dismissable:{type:Boolean},timeout:{type:Number},hide:{type:Boolean},outline:{type:Boolean}}}get classes(){const t={"dt-alert":!0,"dt-alert--outline":this.outline};return t[`dt-alert--${this.context}`]=!0,t}constructor(){super(),this.context="default"}connectedCallback(){super.connectedCallback(),this.timeout&&setTimeout((()=>{this._dismiss()}),this.timeout)}_dismiss(){this.hide=!0}render(){if(this.hide)return r``;const t=r`xmlns="http://www.w3.org/2000/svg">`;return r``}}); //# sourceMappingURL=dt-alert.js.map diff --git a/dt-assets/build/components/layout/dt-list/dt-list.js b/dt-assets/build/components/layout/dt-list/dt-list.js index dbfb881750..c167392803 100644 --- a/dt-assets/build/components/layout/dt-list/dt-list.js +++ b/dt-assets/build/components/layout/dt-list/dt-list.js @@ -1,175 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { m as i, s } from '../../lit-localize-763e4978.js'; -import { o } from '../../map-c0e24c36.js'; -import { c as r } from '../../repeat-1a2b8966.js'; -import { l } from '../../if-defined-11ddebeb.js'; -import { o as n } from '../../class-map-8d921948.js'; -import { D as a, A as d } from '../../dt-base.js'; -import '../../icons/dt-star.js'; -import '../../directive-de55b00a.js'; -window.customElements.define( - 'dt-list', - class extends a { - static get styles() { - return t`:host{--number-of-columns:7;font-family:var(--dt-list-font-family,var(--font-family));font-size:var(--dt-list-font-size,15px);font-weight:var(--dt-list-font-weight,300);line-height:var(--dt-list-line-height,1.5);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.section{container-type:inline-size;background-color:var(--dt-list-background-color,#fefefe);border:1px solid var(--dt-list-border-color,#f1f1f1);border-radius:var(--dt-list-border-radius,10px);box-shadow:var(--dt-list-box-shadow,0 2px 4px rgb(0 0 0 / 25%));padding:var(--dt-list-section-padding,1rem)}.header{display:flex;justify-content:flex-start;align-items:baseline;gap:var(--dt-list-header-gap,1.5em);flex-wrap:wrap}.section-header{color:var(--dt-list-header-color,var(--primary-color));font-size:1.5rem;display:inline-block;text-transform:capitalize}.toggleButton{color:var(--dt-list-header-color,var(--primary-color));font-size:1rem;background:0 0;border:var(--dt-list-toggleButton,.1em solid rgb(0 0 0 / .2));border-radius:.25em;padding:.25em .5em;cursor:pointer}.toggleButton svg{height:.9rem;transform:translateY(-2px);vertical-align:bottom;width:1rem;fill:var(--dt-list-header-color,var(--primary-color));stroke:var(--dt-list-header-color,var(--primary-color))}.list_action_section{background-color:var(--dt-list-action-section-background-color,#ecf5fc);border-radius:var(--dt-list-border-radius,10px);margin:var(--dt-list-action-section-margin,30px 0);padding:var(--dt-list-action-section-padding,20px)}.list_action_section_header{display:flex;flex-direction:row;justify-content:space-between}.close-button{outline:0;font-size:2.5em;line-height:1;color:var(--dt-list-action-close-button,var(--inactive-color));background:0 0;border:none;cursor:pointer}.fieldsList{list-style-type:none;column-count:1}.list-field-picker-item{list-style-type:none}.list-field-picker-item input{margin:1rem}.list-field-picker-item .dt-icon{height:var(--dt-list-field-picker-icon-size,1rem);width:var(--dt-list-field-picker-icon-size,1rem)}table{display:grid;border:1px solid var(--dt-list-border-color,#f1f1f1);border-top:0;border-collapse:collapse;min-width:100%;grid-template-columns:minmax(32px,.1fr) minmax(32px,.1fr) minmax(50px,.8fr)}table td:last-child{border-bottom:1px solid var(--dt-list-border-color,#f1f1f1);padding-bottom:2rem}tbody,thead,tr{display:contents}tr{cursor:pointer}tr:nth-child(2n + 1){background:#f1f1f1}tr:hover{background-color:var(--dt-list-hover-background-color,#ecf5fc)}tr a{color:var(--dt-list-link-color,var(--primary-color))}th{display:none}.column-name{pointer-events:none}#sort-arrows{grid-template-columns:4fr 1fr;display:flex;flex-direction:column;height:1.5em;justify-content:space-evenly}th.all span.sort-arrow-up{border-color:transparent transparent var(--dt-list-sort-arrow-color,grey) transparent;border-style:solid;border-width:0 .5em .5em .5em}th.all span.sort-arrow-down{content:'';border-color:var(--dt-list-sort-arrow-color,grey) transparent transparent;border-style:solid;border-width:.5em .5em 0}th.all span.sort-arrow-up.sortedBy{border-color:transparent transparent var(--dt-list-sort-arrow-color-highlight,#999) transparent}th.all span.sort-arrow-down.sortedBy{border-color:var(--dt-list-sort-arrow-color-highlight,#999) transparent transparent}td{border:0;grid-column:1/span 3;padding-inline-start:1em}td::before{content:attr(title) ': ';padding-inline-end:1em}td.no-title{grid-column:auto}td.line-count{padding-block-start:.8em;padding-inline-start:1em}td.bulk_edit_checkbox{grid-column:1/auto}td.no-title::before{content:'';padding-inline-end:.25em}td.bulk_edit_checkbox,th.bulk_edit_checkbox{grid-column:none}.bulk_edit_checkbox input{display:none}.bulk_editing td.bulk_edit_checkbox,.bulk_editing th.bulk_edit_checkbox{grid-column:1/auto}.bulk_editing .bulk_edit_checkbox input{display:initial}ul{margin:0;padding:0}ul li{list-style-type:none}input[type=checkbox]{margin:1rem}table{grid-template-columns:minmax(32px,.5fr) minmax(32px,.5fr) minmax(32px,.5fr) repeat(var(--number-of-columns,7),minmax(50px,1fr))}th{position:sticky;top:0;background:var(--dt-list-header-background-color,var(--dt-tile-background-color,#fefefe));text-align:start;justify-self:start;font-weight:400;font-size:1.1rem;color:var(--dt-list-header-color,#0a0a0a);white-space:pre-wrap;display:grid;place-items:center;grid-template-columns:2fr 1fr}th:last-child{border:0}td{display:flex;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-top:.5rem;padding-bottom:.5rem;padding-inline-start:0;color:var(--text-color-mid);border-bottom:1px solid var(--dt-list-border-color,#f1f1f1);grid-column:auto}td::before{content:'';display:none}`; - } - static get properties() { - return { - postType: { type: String }, - postTypeLabel: { type: String }, - postTypeSettings: { type: Object, attribute: !0 }, - posts: { type: Array }, - total: { type: Number }, - columns: { type: Array }, - sortedBy: { type: String }, - loading: { type: Boolean, default: !0 }, - offset: { type: Number }, - showArchived: { type: Boolean, default: !1 }, - showFieldsSelector: { type: Boolean, default: !1 }, - showBulkEditSelector: { type: Boolean, default: !1 }, - nonce: { type: String }, - }; - } - constructor() { - super(), (this.sortedBy = 'name'); - } - firstUpdated() { - this.nonce && !this.api && (this.api = new d(this.nonce)); - } - async _getPosts(t = 0, e = 'name', i = 'desc') { - (this.loading = !0), (this.filteredOptions = []); - const s = encodeURI( - `?offset=${t}&sortBy=${`${'desc' === i ? '-' : ''}${e}`}&offset=${t}${this.columns.map((t) => `&fields_to_return=${t}`).join('')}`, - ); - return await this.api.makeRequestOnPosts('GET', `${this.postType}${s}`); - } - _headerClick(t) { - const e = t.target.dataset.id; - this._getPosts(this.offset ? this.offset : 0, e).then((t) => { - (this.posts = t), (this.sortedBy = e); - }); - } - _bulkEdit() { - this.showBulkEditSelector = !this.showBulkEditSelector; - } - _fieldsEdit() { - this.showFieldsSelector = !this.showFieldsSelector; - } - _toggleShowArchived() { - this.showArchived = !this.showArchived; - } - _sortArrowsClass(t) { - return this.sortedBy === t ? 'sortedBy' : ''; - } - _sortArrowsToggle(t) { - return this.sortedBy !== `-${t}` ? `-${t}` : t; - } - _headerTemplate() { - return e`${o(this.columns, (t) => e`${this.postTypeSettings[t].name} `)}`; - } - _rowTemplate() { - return o(this.posts, (t, i) => - this.showArchived || - (!this.showArchived && 'closed' !== t.overall_status.key) - ? e`${i + 1}.${this._cellTemplate(t)}` - : null, - ); - } - _cellTemplate(t) { - return o(this.columns, (i) => { - if ( - ['text', 'textarea', 'number'].includes(this.postTypeSettings[i].type) - ) - return e`${t[i]}`; - if ('date' === this.postTypeSettings[i].type) - return e`${t[i].formatted}`; - if ( - 'user_select' === this.postTypeSettings[i].type && - t[i] && - t[i].display - ) - return e`${l(t[i].display)}`; - if ( - 'key_select' === this.postTypeSettings[i].type && - t[i] && - (t[i].label || t[i].name) - ) - return e`${t[i].label || t[i].name}`; - if ( - 'multi_select' === this.postTypeSettings[i].type || - ('tags' === this.postTypeSettings[i].type && t[i] && t[i].length > 0) - ) - return e`
      ${o(t[i], (t) => e`
    • ${this.postTypeSettings[i].default[t].label}
    • `)}
    `; - if ( - 'location' === this.postTypeSettings[i].type || - 'location_meta' === this.postTypeSettings[i].type - ) - return e`${l(t[i].label)}`; - if ('communication_channel' === this.postTypeSettings[i].type) - return e`${l(t[i].value)}`; - if ('connection' === this.postTypeSettings[i].type) - return e`${l(t[i].value)}`; - if ('boolean' === this.postTypeSettings[i].type) { - if ('favorite' === i) - return e``; - if (!0 === this.postTypeSettings[i]) - return e`['✓']`; - } - return e``; - }); - } - _fieldListIconTemplate(t) { - return this.postTypeSettings[t].icon - ? e`${this.postTypeSettings[t].name}` - : null; - } - _fieldsListTemplate() { - return r( - Object.keys(this.postTypeSettings).sort((t, e) => { - const i = this.postTypeSettings[t].name.toUpperCase(), - s = this.postTypeSettings[e].name.toUpperCase(); - return i < s ? -1 : i > s ? 1 : 0; - }), - (t) => t, - (t) => - this.postTypeSettings[t].hidden - ? null - : e`
  • `, - ); - } - _fieldsSelectorTemplate() { - return this.showFieldsSelector - ? e`

    ${i('Choose which fields to display as columns in the list')}

      ${this._fieldsListTemplate()}
    ` - : null; - } - _updateFields(t) { - const e = t.target.value, - i = this.columns; - i.includes(e) - ? (i.filter((t) => t !== e), i.splice(i.indexOf(e), 1)) - : i.push(e), - (this.columns = i), - this.style.setProperty('--number-of-columns', this.columns.length - 1), - this.requestUpdate(); - } - _bulkSelectorTemplate() { - return this.showBulkEditSelector - ? e`

    ${i(s`Select all the ${this.postType} you want to update from the list, and update them below`)}

      This is where the bulk edit form will go.
    ` - : null; - } - connectedCallback() { - super.connectedCallback(), - this.posts || - this._getPosts().then((t) => { - this.posts = t; - }); - } - render() { - const t = { bulk_editing: this.showBulkEditSelector, hidden: !1 }, - o = e``, - r = e``; - return e`
    ${i(s`${this.postTypeLabel ? this.postTypeLabel : this.postType} List`)}
    ${i(s`Showing 1 of ${this.total}`)}
    ${this._fieldsSelectorTemplate()} ${this._bulkSelectorTemplate()}${this._headerTemplate()} ${this.posts ? this._rowTemplate() : i('Loading')}
    `; - } - }, -); +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{m as i,s}from"../../lit-localize-763e4978.js";import{o}from"../../map-c0e24c36.js";import{c as r}from"../../repeat-1a2b8966.js";import{l}from"../../if-defined-11ddebeb.js";import{o as n}from"../../class-map-8d921948.js";import{D as a,A as d}from"../../dt-base.js";import"../../icons/dt-star.js";import"../../directive-de55b00a.js";window.customElements.define("dt-list",class extends a{static get styles(){return t`:host{--number-of-columns:7;font-family:var(--dt-list-font-family,var(--font-family));font-size:var(--dt-list-font-size,15px);font-weight:var(--dt-list-font-weight,300);line-height:var(--dt-list-line-height,1.5);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.section{container-type:inline-size;background-color:var(--dt-list-background-color,#fefefe);border:1px solid var(--dt-list-border-color,#f1f1f1);border-radius:var(--dt-list-border-radius,10px);box-shadow:var(--dt-list-box-shadow,0 2px 4px rgb(0 0 0 / 25%));padding:var(--dt-list-section-padding,1rem)}.header{display:flex;justify-content:flex-start;align-items:baseline;gap:var(--dt-list-header-gap,1.5em);flex-wrap:wrap}.section-header{color:var(--dt-list-header-color,var(--primary-color));font-size:1.5rem;display:inline-block;text-transform:capitalize}.toggleButton{color:var(--dt-list-header-color,var(--primary-color));font-size:1rem;background:0 0;border:var(--dt-list-toggleButton,.1em solid rgb(0 0 0 / .2));border-radius:.25em;padding:.25em .5em;cursor:pointer}.toggleButton svg{height:.9rem;transform:translateY(-2px);vertical-align:bottom;width:1rem;fill:var(--dt-list-header-color,var(--primary-color));stroke:var(--dt-list-header-color,var(--primary-color))}.list_action_section{background-color:var(--dt-list-action-section-background-color,#ecf5fc);border-radius:var(--dt-list-border-radius,10px);margin:var(--dt-list-action-section-margin,30px 0);padding:var(--dt-list-action-section-padding,20px)}.list_action_section_header{display:flex;flex-direction:row;justify-content:space-between}.close-button{outline:0;font-size:2.5em;line-height:1;color:var(--dt-list-action-close-button,var(--inactive-color));background:0 0;border:none;cursor:pointer}.fieldsList{list-style-type:none;column-count:1}.list-field-picker-item{list-style-type:none}.list-field-picker-item input{margin:1rem}.list-field-picker-item .dt-icon{height:var(--dt-list-field-picker-icon-size,1rem);width:var(--dt-list-field-picker-icon-size,1rem)}table{display:grid;border:1px solid var(--dt-list-border-color,#f1f1f1);border-top:0;border-collapse:collapse;min-width:100%;grid-template-columns:minmax(32px,.1fr) minmax(32px,.1fr) minmax(50px,.8fr)}table td:last-child{border-bottom:1px solid var(--dt-list-border-color,#f1f1f1);padding-bottom:2rem}tbody,thead,tr{display:contents}tr{cursor:pointer}tr:nth-child(2n + 1){background:#f1f1f1}tr:hover{background-color:var(--dt-list-hover-background-color,#ecf5fc)}tr a{color:var(--dt-list-link-color,var(--primary-color))}th{display:none}.column-name{pointer-events:none}#sort-arrows{grid-template-columns:4fr 1fr;display:flex;flex-direction:column;height:1.5em;justify-content:space-evenly}th.all span.sort-arrow-up{border-color:transparent transparent var(--dt-list-sort-arrow-color,grey) transparent;border-style:solid;border-width:0 .5em .5em .5em}th.all span.sort-arrow-down{content:'';border-color:var(--dt-list-sort-arrow-color,grey) transparent transparent;border-style:solid;border-width:.5em .5em 0}th.all span.sort-arrow-up.sortedBy{border-color:transparent transparent var(--dt-list-sort-arrow-color-highlight,#999) transparent}th.all span.sort-arrow-down.sortedBy{border-color:var(--dt-list-sort-arrow-color-highlight,#999) transparent transparent}td{border:0;grid-column:1/span 3;padding-inline-start:1em}td::before{content:attr(title) ': ';padding-inline-end:1em}td.no-title{grid-column:auto}td.line-count{padding-block-start:.8em;padding-inline-start:1em}td.bulk_edit_checkbox{grid-column:1/auto}td.no-title::before{content:'';padding-inline-end:.25em}td.bulk_edit_checkbox,th.bulk_edit_checkbox{grid-column:none}.bulk_edit_checkbox input{display:none}.bulk_editing td.bulk_edit_checkbox,.bulk_editing th.bulk_edit_checkbox{grid-column:1/auto}.bulk_editing .bulk_edit_checkbox input{display:initial}ul{margin:0;padding:0}ul li{list-style-type:none}input[type=checkbox]{margin:1rem}table{grid-template-columns:minmax(32px,.5fr) minmax(32px,.5fr) minmax(32px,.5fr) repeat(var(--number-of-columns,7),minmax(50px,1fr))}th{position:sticky;top:0;background:var(--dt-list-header-background-color,var(--dt-tile-background-color,#fefefe));text-align:start;justify-self:start;font-weight:400;font-size:1.1rem;color:var(--dt-list-header-color,#0a0a0a);white-space:pre-wrap;display:grid;place-items:center;grid-template-columns:2fr 1fr}th:last-child{border:0}td{display:flex;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-top:.5rem;padding-bottom:.5rem;padding-inline-start:0;color:var(--text-color-mid);border-bottom:1px solid var(--dt-list-border-color,#f1f1f1);grid-column:auto}td::before{content:'';display:none}`}static get properties(){return{postType:{type:String},postTypeLabel:{type:String},postTypeSettings:{type:Object,attribute:!0},posts:{type:Array},total:{type:Number},columns:{type:Array},sortedBy:{type:String},loading:{type:Boolean,default:!0},offset:{type:Number},showArchived:{type:Boolean,default:!1},showFieldsSelector:{type:Boolean,default:!1},showBulkEditSelector:{type:Boolean,default:!1},nonce:{type:String}}}constructor(){super(),this.sortedBy="name"}firstUpdated(){this.nonce&&!this.api&&(this.api=new d(this.nonce))}async _getPosts(t=0,e="name",i="desc"){this.loading=!0,this.filteredOptions=[];const s=encodeURI(`?offset=${t}&sortBy=${`${"desc"===i?"-":""}${e}`}&offset=${t}${this.columns.map((t=>`&fields_to_return=${t}`)).join("")}`);return await this.api.makeRequestOnPosts("GET",`${this.postType}${s}`)}_headerClick(t){const e=t.target.dataset.id;this._getPosts(this.offset?this.offset:0,e).then((t=>{this.posts=t,this.sortedBy=e}))}_bulkEdit(){this.showBulkEditSelector=!this.showBulkEditSelector}_fieldsEdit(){this.showFieldsSelector=!this.showFieldsSelector}_toggleShowArchived(){this.showArchived=!this.showArchived}_sortArrowsClass(t){return this.sortedBy===t?"sortedBy":""}_sortArrowsToggle(t){return this.sortedBy!==`-${t}`?`-${t}`:t}_headerTemplate(){return e`${o(this.columns,(t=>e`${this.postTypeSettings[t].name} `))}`}_rowTemplate(){return o(this.posts,((t,i)=>this.showArchived||!this.showArchived&&"closed"!==t.overall_status.key?e`${i+1}.${this._cellTemplate(t)}`:null))}_cellTemplate(t){return o(this.columns,(i=>{if(["text","textarea","number"].includes(this.postTypeSettings[i].type))return e`${t[i]}`;if("date"===this.postTypeSettings[i].type)return e`${t[i].formatted}`;if("user_select"===this.postTypeSettings[i].type&&t[i]&&t[i].display)return e`${l(t[i].display)}`;if("key_select"===this.postTypeSettings[i].type&&t[i]&&(t[i].label||t[i].name))return e`${t[i].label||t[i].name}`;if("multi_select"===this.postTypeSettings[i].type||"tags"===this.postTypeSettings[i].type&&t[i]&&t[i].length>0)return e`
      ${o(t[i],(t=>e`
    • ${this.postTypeSettings[i].default[t].label}
    • `))}
    `;if("location"===this.postTypeSettings[i].type||"location_meta"===this.postTypeSettings[i].type)return e`${l(t[i].label)}`;if("communication_channel"===this.postTypeSettings[i].type)return e`${l(t[i].value)}`;if("connection"===this.postTypeSettings[i].type)return e`${l(t[i].value)}`;if("boolean"===this.postTypeSettings[i].type){if("favorite"===i)return e``;if(!0===this.postTypeSettings[i])return e`['✓']`}return e``}))}_fieldListIconTemplate(t){return this.postTypeSettings[t].icon?e`${this.postTypeSettings[t].name}`:null}_fieldsListTemplate(){return r(Object.keys(this.postTypeSettings).sort(((t,e)=>{const i=this.postTypeSettings[t].name.toUpperCase(),s=this.postTypeSettings[e].name.toUpperCase();return is?1:0})),(t=>t),(t=>this.postTypeSettings[t].hidden?null:e`
  • `))}_fieldsSelectorTemplate(){return this.showFieldsSelector?e`

    ${i("Choose which fields to display as columns in the list")}

      ${this._fieldsListTemplate()}
    `:null}_updateFields(t){const e=t.target.value,i=this.columns;i.includes(e)?(i.filter((t=>t!==e)),i.splice(i.indexOf(e),1)):i.push(e),this.columns=i,this.style.setProperty("--number-of-columns",this.columns.length-1),this.requestUpdate()}_bulkSelectorTemplate(){return this.showBulkEditSelector?e`

    ${i(s`Select all the ${this.postType} you want to update from the list, and update them below`)}

      This is where the bulk edit form will go.
    `:null}connectedCallback(){super.connectedCallback(),this.posts||this._getPosts().then((t=>{this.posts=t}))}render(){const t={bulk_editing:this.showBulkEditSelector,hidden:!1},o=e``,r=e``;return e`
    ${i(s`${this.postTypeLabel?this.postTypeLabel:this.postType} List`)}
    ${i(s`Showing 1 of ${this.total}`)}
    ${this._fieldsSelectorTemplate()} ${this._bulkSelectorTemplate()}${this._headerTemplate()} ${this.posts?this._rowTemplate():i("Loading")}
    `}}); //# sourceMappingURL=dt-list.js.map diff --git a/dt-assets/build/components/layout/dt-modal/dt-modal.js b/dt-assets/build/components/layout/dt-modal/dt-modal.js index 2299d58cee..c7e87b3919 100644 --- a/dt-assets/build/components/layout/dt-modal/dt-modal.js +++ b/dt-assets/build/components/layout/dt-modal/dt-modal.js @@ -1,81 +1,2 @@ -import { i as t, y as e } from '../../lit-element-2409d5fe.js'; -import { m as o } from '../../lit-localize-763e4978.js'; -import { o as a } from '../../class-map-8d921948.js'; -import { i } from '../../style-map-ac85d91b.js'; -import { D as r } from '../../dt-base.js'; -import '../../directive-de55b00a.js'; -window.customElements.define( - 'dt-modal', - class extends r { - static get styles() { - return t`:host{display:block;font-family:var(--font-family)}:host:has(dialog[open]){overflow:hidden}.dt-modal{display:block;background:var(--dt-modal-background-color,#fff);color:var(--dt-modal-color,#000);max-inline-size:min(90vw,100%);max-block-size:min(80vh,100%);max-block-size:min(80dvb,100%);margin:auto;height:fit-content;padding:var(--dt-modal-padding,1em);position:fixed;inset:0;border-radius:1em;border:none;box-shadow:var(--shadow-6);z-index:1000;transition:opacity .1s ease-in-out}dialog:not([open]){pointer-events:none;opacity:0}dialog::backdrop{background:var(--dt-modal-backdrop-color,rgba(0,0,0,.25));animation:var(--dt-modal-animation,fade-in .75s)}@keyframes fade-in{from{opacity:0}to{opacity:1}}h1,h2,h3,h4,h5,h6{line-height:1.4;text-rendering:optimizeLegibility;color:inherit;font-style:normal;font-weight:300;margin:0}form{display:grid;height:fit-content;grid-template-columns:1fr;grid-template-rows:100px auto 100px;grid-template-areas:'header' 'main' 'footer';position:relative}form.no-header{grid-template-rows:auto auto;grid-template-areas:'main' 'footer'}header{grid-area:header;display:flex;justify-content:space-between}.button{color:var(--dt-modal-button-color,#fff);background:var(--dt-modal-button-background,#000);font-size:1rem;border:.1em solid var(--dt-modal-button-background,#000);border-radius:.25em;padding:.25rem .5rem;cursor:pointer;text-decoration:none}.button.opener{color:var(--dt-modal-button-opener-color,var(--dt-modal-button-color,#fff));background:var(--dt-modal-button-opener-background,var(--dt-modal-button-background,#000));border:.1em solid var(--dt-modal-button-opener-background,#000)}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none;color:inherit;cursor:pointer;display:flex;align-items:flex-start}article{grid-area:main;overflow:auto}footer{grid-area:footer;display:flex;justify-content:space-between}.help-more h5{font-size:.75rem;display:block}.help-more .button{font-size:.75rem;display:block}`; - } - static get properties() { - return { - title: { type: String }, - context: { type: String }, - isHelp: { type: Boolean }, - isOpen: { type: Boolean }, - hideHeader: { type: Boolean }, - hideButton: { type: Boolean }, - buttonClass: { type: Object }, - buttonStyle: { type: Object }, - }; - } - constructor() { - super(), - (this.context = 'default'), - this.addEventListener('open', (t) => this._openModal()), - this.addEventListener('close', (t) => this._closeModal()); - } - _openModal() { - (this.isOpen = !0), - this.shadowRoot.querySelector('dialog').showModal(), - (document.querySelector('body').style.overflow = 'hidden'); - } - _dialogHeader(t) { - return this.hideHeader - ? e`` - : e`

    ${this.title}

    `; - } - _closeModal() { - (this.isOpen = !1), - this.shadowRoot.querySelector('dialog').close(), - (document.querySelector('body').style.overflow = 'initial'); - } - _cancelModal() { - this._triggerClose('cancel'); - } - _triggerClose(t) { - this.dispatchEvent(new CustomEvent('close', { detail: { action: t } })); - } - _dialogClick(t) { - if ('DIALOG' !== t.target.tagName) return; - const e = t.target.getBoundingClientRect(); - !1 === - (e.top <= t.clientY && - t.clientY <= e.top + e.height && - e.left <= t.clientX && - t.clientX <= e.left + e.width) && this._cancelModal(); - } - _dialogKeypress(t) { - 'Escape' === t.key && this._cancelModal(); - } - _helpMore() { - return this.isHelp - ? e`
    ${o('Need more help?')}
    ${o('Read the documentation')}
    ` - : null; - } - firstUpdated() { - this.isOpen && this._openModal(); - } - _onButtonClick() { - this._triggerClose('button'); - } - render() { - const t = e`xmlns="http://www.w3.org/2000/svg">`; - return e`
    ${this._dialogHeader(t)}
    ${this._helpMore()}
    ${this.hideButton ? null : e``}`; - } - }, -); +import{i as t,y as e}from"../../lit-element-2409d5fe.js";import{m as o}from"../../lit-localize-763e4978.js";import{o as a}from"../../class-map-8d921948.js";import{i}from"../../style-map-ac85d91b.js";import{D as r}from"../../dt-base.js";import"../../directive-de55b00a.js";window.customElements.define("dt-modal",class extends r{static get styles(){return t`:host{display:block;font-family:var(--font-family)}:host:has(dialog[open]){overflow:hidden}.dt-modal{display:block;background:var(--dt-modal-background-color,#fff);color:var(--dt-modal-color,#000);max-inline-size:min(90vw,100%);max-block-size:min(80vh,100%);max-block-size:min(80dvb,100%);margin:auto;height:fit-content;padding:var(--dt-modal-padding,1em);position:fixed;inset:0;border-radius:1em;border:none;box-shadow:var(--shadow-6);z-index:1000;transition:opacity .1s ease-in-out}dialog:not([open]){pointer-events:none;opacity:0}dialog::backdrop{background:var(--dt-modal-backdrop-color,rgba(0,0,0,.25));animation:var(--dt-modal-animation,fade-in .75s)}@keyframes fade-in{from{opacity:0}to{opacity:1}}h1,h2,h3,h4,h5,h6{line-height:1.4;text-rendering:optimizeLegibility;color:inherit;font-style:normal;font-weight:300;margin:0}form{display:grid;height:fit-content;grid-template-columns:1fr;grid-template-rows:100px auto 100px;grid-template-areas:'header' 'main' 'footer';position:relative}form.no-header{grid-template-rows:auto auto;grid-template-areas:'main' 'footer'}header{grid-area:header;display:flex;justify-content:space-between}.button{color:var(--dt-modal-button-color,#fff);background:var(--dt-modal-button-background,#000);font-size:1rem;border:.1em solid var(--dt-modal-button-background,#000);border-radius:.25em;padding:.25rem .5rem;cursor:pointer;text-decoration:none}.button.opener{color:var(--dt-modal-button-opener-color,var(--dt-modal-button-color,#fff));background:var(--dt-modal-button-opener-background,var(--dt-modal-button-background,#000));border:.1em solid var(--dt-modal-button-opener-background,#000)}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none;color:inherit;cursor:pointer;display:flex;align-items:flex-start}article{grid-area:main;overflow:auto}footer{grid-area:footer;display:flex;justify-content:space-between}.help-more h5{font-size:.75rem;display:block}.help-more .button{font-size:.75rem;display:block}`}static get properties(){return{title:{type:String},context:{type:String},isHelp:{type:Boolean},isOpen:{type:Boolean},hideHeader:{type:Boolean},hideButton:{type:Boolean},buttonClass:{type:Object},buttonStyle:{type:Object}}}constructor(){super(),this.context="default",this.addEventListener("open",(t=>this._openModal())),this.addEventListener("close",(t=>this._closeModal()))}_openModal(){this.isOpen=!0,this.shadowRoot.querySelector("dialog").showModal(),document.querySelector("body").style.overflow="hidden"}_dialogHeader(t){return this.hideHeader?e``:e`

    ${this.title}

    `}_closeModal(){this.isOpen=!1,this.shadowRoot.querySelector("dialog").close(),document.querySelector("body").style.overflow="initial"}_cancelModal(){this._triggerClose("cancel")}_triggerClose(t){this.dispatchEvent(new CustomEvent("close",{detail:{action:t}}))}_dialogClick(t){if("DIALOG"!==t.target.tagName)return;const e=t.target.getBoundingClientRect();!1===(e.top<=t.clientY&&t.clientY<=e.top+e.height&&e.left<=t.clientX&&t.clientX<=e.left+e.width)&&this._cancelModal()}_dialogKeypress(t){"Escape"===t.key&&this._cancelModal()}_helpMore(){return this.isHelp?e`
    ${o("Need more help?")}
    ${o("Read the documentation")}
    `:null}firstUpdated(){this.isOpen&&this._openModal()}_onButtonClick(){this._triggerClose("button")}render(){const t=e`xmlns="http://www.w3.org/2000/svg">`;return e`
    ${this._dialogHeader(t)}
    ${this._helpMore()}
    ${this.hideButton?null:e``}`}}); //# sourceMappingURL=dt-modal.js.map diff --git a/dt-assets/build/components/layout/dt-tile/dt-tile.js b/dt-assets/build/components/layout/dt-tile/dt-tile.js index 7167ac33f9..e78ccaa94d 100644 --- a/dt-assets/build/components/layout/dt-tile/dt-tile.js +++ b/dt-assets/build/components/layout/dt-tile/dt-tile.js @@ -1,33 +1,2 @@ -import { i as e, b as t, y as o } from '../../lit-element-2409d5fe.js'; -import { D as r } from '../../dt-base.js'; -import '../../lit-localize-763e4978.js'; -window.customElements.define( - 'dt-tile', - class extends r { - static get styles() { - return e`:host{font-family:var(--dt-tile-font-family,var(--font-family));font-size:var(--dt-tile-font-size,14px);font-weight:var(--dt-tile-font-weight,700);overflow:hidden;text-overflow:ellipsis}section{background-color:var(--dt-tile-background-color,#fefefe);border-top:var(--dt-tile-border-top,1px solid #cecece);border-bottom:var(--dt-tile-border-bottom,1px solid #cecece);border-right:var(--dt-tile-border-right,1px solid #cecece);border-left:var(--dt-tile-border-left,1px solid #cecece);border-radius:var(--dt-tile-border-radius,10px);box-shadow:var(--dt-tile-box-shadow,0 2px 4px rgb(0 0 0 / 25%));padding:1rem;margin:var(--dt-tile-margin,0)}h3{line-height:1.4;margin:var(--dt-tile-header-margin,0 0 .5rem 0);text-rendering:optimizeLegibility;font-family:var(--dt-tile-font-family,var(--font-family));font-style:normal;font-weight:var(--dt-tile-header-font-weight,300)}.section-header{color:var(--dt-tile-header-color,#3f729b);font-size:1.5rem;display:flex;text-transform:var(--dt-tile-header-text-transform,capitalize);justify-content:var(--dt-tile-header-justify-content)}.section-body{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));column-gap:1.4rem;transition:height 1s ease 0s;height:auto}.section-body.collapsed{height:0!important;overflow:hidden}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none}.chevron::before{border-color:var(--dt-tile-header-color,var(--primary-color));border-style:solid;border-width:2px 2px 0 0;content:'';display:inline-block;height:1em;width:1em;left:.15em;position:relative;top:.15em;transform:rotate(-45deg);vertical-align:top}.chevron.down:before{top:0;transform:rotate(135deg)}`; - } - static get properties() { - return { - title: { type: String }, - expands: { type: Boolean }, - collapsed: { type: Boolean }, - }; - } - get hasHeading() { - return this.title || this.expands; - } - _toggle() { - this.collapsed = !this.collapsed; - } - renderHeading() { - return this.hasHeading - ? o`

    ${this.title} ${this.expands ? o`` : null}

    ` - : t; - } - render() { - return o`
    ${this.renderHeading()}
    `; - } - }, -); +import{i as e,b as t,y as o}from"../../lit-element-2409d5fe.js";import{D as r}from"../../dt-base.js";import"../../lit-localize-763e4978.js";window.customElements.define("dt-tile",class extends r{static get styles(){return e`:host{font-family:var(--dt-tile-font-family,var(--font-family));font-size:var(--dt-tile-font-size,14px);font-weight:var(--dt-tile-font-weight,700);overflow:hidden;text-overflow:ellipsis}section{background-color:var(--dt-tile-background-color,#fefefe);border-top:var(--dt-tile-border-top,1px solid #cecece);border-bottom:var(--dt-tile-border-bottom,1px solid #cecece);border-right:var(--dt-tile-border-right,1px solid #cecece);border-left:var(--dt-tile-border-left,1px solid #cecece);border-radius:var(--dt-tile-border-radius,10px);box-shadow:var(--dt-tile-box-shadow,0 2px 4px rgb(0 0 0 / 25%));padding:1rem;margin:var(--dt-tile-margin,0)}h3{line-height:1.4;margin:var(--dt-tile-header-margin,0 0 .5rem 0);text-rendering:optimizeLegibility;font-family:var(--dt-tile-font-family,var(--font-family));font-style:normal;font-weight:var(--dt-tile-header-font-weight,300)}.section-header{color:var(--dt-tile-header-color,#3f729b);font-size:1.5rem;display:flex;text-transform:var(--dt-tile-header-text-transform,capitalize);justify-content:var(--dt-tile-header-justify-content)}.section-body{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));column-gap:1.4rem;transition:height 1s ease 0s;height:auto}.section-body.collapsed{height:0!important;overflow:hidden}button.toggle{margin-inline-end:0;margin-inline-start:auto;background:0 0;border:none}.chevron::before{border-color:var(--dt-tile-header-color,var(--primary-color));border-style:solid;border-width:2px 2px 0 0;content:'';display:inline-block;height:1em;width:1em;left:.15em;position:relative;top:.15em;transform:rotate(-45deg);vertical-align:top}.chevron.down:before{top:0;transform:rotate(135deg)}`}static get properties(){return{title:{type:String},expands:{type:Boolean},collapsed:{type:Boolean}}}get hasHeading(){return this.title||this.expands}_toggle(){this.collapsed=!this.collapsed}renderHeading(){return this.hasHeading?o`

    ${this.title} ${this.expands?o``:null}

    `:t}render(){return o`
    ${this.renderHeading()}
    `}}); //# sourceMappingURL=dt-tile.js.map diff --git a/dt-assets/build/components/layout/index.js b/dt-assets/build/components/layout/index.js index e5e0c4f96c..14cdd84b96 100644 --- a/dt-assets/build/components/layout/index.js +++ b/dt-assets/build/components/layout/index.js @@ -1,15 +1,2 @@ -import './dt-alert/dt-alert.js'; -import './dt-list/dt-list.js'; -import './dt-modal/dt-modal.js'; -import './dt-tile/dt-tile.js'; -import '../lit-element-2409d5fe.js'; -import '../class-map-8d921948.js'; -import '../directive-de55b00a.js'; -import '../dt-base.js'; -import '../lit-localize-763e4978.js'; -import '../map-c0e24c36.js'; -import '../repeat-1a2b8966.js'; -import '../if-defined-11ddebeb.js'; -import '../icons/dt-star.js'; -import '../style-map-ac85d91b.js'; +import"./dt-alert/dt-alert.js";import"./dt-list/dt-list.js";import"./dt-modal/dt-modal.js";import"./dt-tile/dt-tile.js";import"../lit-element-2409d5fe.js";import"../class-map-8d921948.js";import"../directive-de55b00a.js";import"../dt-base.js";import"../lit-localize-763e4978.js";import"../map-c0e24c36.js";import"../repeat-1a2b8966.js";import"../if-defined-11ddebeb.js";import"../icons/dt-star.js";import"../style-map-ac85d91b.js"; //# sourceMappingURL=index.js.map diff --git a/dt-assets/build/components/lit-element-2409d5fe.js b/dt-assets/build/components/lit-element-2409d5fe.js index 490ce98823..4bd1bcfa79 100644 --- a/dt-assets/build/components/lit-element-2409d5fe.js +++ b/dt-assets/build/components/lit-element-2409d5fe.js @@ -3,956 +3,22 @@ * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const t = window, - e = - t.ShadowRoot && - (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && - 'adoptedStyleSheets' in Document.prototype && - 'replace' in CSSStyleSheet.prototype, - s = Symbol(), - i = new WeakMap(); -class n { - constructor(t, e, i) { - if (((this._$cssResult$ = !0), i !== s)) - throw Error( - 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.', - ); - (this.cssText = t), (this.t = e); - } - get styleSheet() { - let t = this.o; - const s = this.t; - if (e && void 0 === t) { - const e = void 0 !== s && 1 === s.length; - e && (t = i.get(s)), - void 0 === t && - ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), - e && i.set(s, t)); - } - return t; - } - toString() { - return this.cssText; - } -} -const o = (t, ...e) => { - const i = - 1 === t.length - ? t[0] - : e.reduce( - (e, s, i) => - e + - ((t) => { - if (!0 === t._$cssResult$) return t.cssText; - if ('number' == typeof t) return t; - throw Error( - "Value passed to 'css' function must be a 'css' function result: " + - t + - ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.", - ); - })(s) + - t[i + 1], - t[0], - ); - return new n(i, t, s); - }, - r = e - ? (t) => t - : (t) => - t instanceof CSSStyleSheet - ? ((t) => { - let e = ''; - for (const s of t.cssRules) e += s.cssText; - return ((t) => - new n('string' == typeof t ? t : t + '', void 0, s))(e); - })(t) - : t; +const t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),i=new WeakMap;class n{constructor(t,e,i){if(this._$cssResult$=!0,i!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=i.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&i.set(s,t))}return t}toString(){return this.cssText}}const o=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,s,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[i+1]),t[0]);return new n(i,t,s)},r=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,s))(e)})(t):t /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */ var l; -const h = window, - a = h.trustedTypes, - d = a ? a.emptyScript : '', - c = h.reactiveElementPolyfillSupport, - u = { - toAttribute(t, e) { - switch (e) { - case Boolean: - t = t ? d : null; - break; - case Object: - case Array: - t = null == t ? t : JSON.stringify(t); - } - return t; - }, - fromAttribute(t, e) { - let s = t; - switch (e) { - case Boolean: - s = null !== t; - break; - case Number: - s = null === t ? null : Number(t); - break; - case Object: - case Array: - try { - s = JSON.parse(t); - } catch (t) { - s = null; - } - } - return s; - }, - }, - p = (t, e) => e !== t && (e == e || t == t), - $ = { attribute: !0, type: String, converter: u, reflect: !1, hasChanged: p }; -class v extends HTMLElement { - constructor() { - super(), - (this._$Ei = new Map()), - (this.isUpdatePending = !1), - (this.hasUpdated = !1), - (this._$El = null), - this.u(); - } - static addInitializer(t) { - var e; - (null !== (e = this.h) && void 0 !== e) || (this.h = []), this.h.push(t); - } - static get observedAttributes() { - this.finalize(); - const t = []; - return ( - this.elementProperties.forEach((e, s) => { - const i = this._$Ep(s, e); - void 0 !== i && (this._$Ev.set(i, s), t.push(i)); - }), - t - ); - } - static createProperty(t, e = $) { - if ( - (e.state && (e.attribute = !1), - this.finalize(), - this.elementProperties.set(t, e), - !e.noAccessor && !this.prototype.hasOwnProperty(t)) - ) { - const s = 'symbol' == typeof t ? Symbol() : '__' + t, - i = this.getPropertyDescriptor(t, s, e); - void 0 !== i && Object.defineProperty(this.prototype, t, i); - } - } - static getPropertyDescriptor(t, e, s) { - return { - get() { - return this[e]; - }, - set(i) { - const n = this[t]; - (this[e] = i), this.requestUpdate(t, n, s); - }, - configurable: !0, - enumerable: !0, - }; - } - static getPropertyOptions(t) { - return this.elementProperties.get(t) || $; - } - static finalize() { - if (this.hasOwnProperty('finalized')) return !1; - this.finalized = !0; - const t = Object.getPrototypeOf(this); - if ( - (t.finalize(), - (this.elementProperties = new Map(t.elementProperties)), - (this._$Ev = new Map()), - this.hasOwnProperty('properties')) - ) { - const t = this.properties, - e = [ - ...Object.getOwnPropertyNames(t), - ...Object.getOwnPropertySymbols(t), - ]; - for (const s of e) this.createProperty(s, t[s]); - } - return (this.elementStyles = this.finalizeStyles(this.styles)), !0; - } - static finalizeStyles(t) { - const e = []; - if (Array.isArray(t)) { - const s = new Set(t.flat(1 / 0).reverse()); - for (const t of s) e.unshift(r(t)); - } else void 0 !== t && e.push(r(t)); - return e; - } - static _$Ep(t, e) { - const s = e.attribute; - return !1 === s - ? void 0 - : 'string' == typeof s - ? s - : 'string' == typeof t - ? t.toLowerCase() - : void 0; - } - u() { - var t; - (this._$E_ = new Promise((t) => (this.enableUpdating = t))), - (this._$AL = new Map()), - this._$Eg(), - this.requestUpdate(), - null === (t = this.constructor.h) || - void 0 === t || - t.forEach((t) => t(this)); - } - addController(t) { - var e, s; - (null !== (e = this._$ES) && void 0 !== e ? e : (this._$ES = [])).push(t), - void 0 !== this.renderRoot && - this.isConnected && - (null === (s = t.hostConnected) || void 0 === s || s.call(t)); - } - removeController(t) { - var e; - null === (e = this._$ES) || - void 0 === e || - e.splice(this._$ES.indexOf(t) >>> 0, 1); - } - _$Eg() { - this.constructor.elementProperties.forEach((t, e) => { - this.hasOwnProperty(e) && (this._$Ei.set(e, this[e]), delete this[e]); - }); - } - createRenderRoot() { - var s; - const i = - null !== (s = this.shadowRoot) && void 0 !== s - ? s - : this.attachShadow(this.constructor.shadowRootOptions); - return ( - ((s, i) => { - e - ? (s.adoptedStyleSheets = i.map((t) => - t instanceof CSSStyleSheet ? t : t.styleSheet, - )) - : i.forEach((e) => { - const i = document.createElement('style'), - n = t.litNonce; - void 0 !== n && i.setAttribute('nonce', n), - (i.textContent = e.cssText), - s.appendChild(i); - }); - })(i, this.constructor.elementStyles), - i - ); - } - connectedCallback() { - var t; - void 0 === this.renderRoot && (this.renderRoot = this.createRenderRoot()), - this.enableUpdating(!0), - null === (t = this._$ES) || - void 0 === t || - t.forEach((t) => { - var e; - return null === (e = t.hostConnected) || void 0 === e - ? void 0 - : e.call(t); - }); - } - enableUpdating(t) {} - disconnectedCallback() { - var t; - null === (t = this._$ES) || - void 0 === t || - t.forEach((t) => { - var e; - return null === (e = t.hostDisconnected) || void 0 === e - ? void 0 - : e.call(t); - }); - } - attributeChangedCallback(t, e, s) { - this._$AK(t, s); - } - _$EO(t, e, s = $) { - var i; - const n = this.constructor._$Ep(t, s); - if (void 0 !== n && !0 === s.reflect) { - const o = ( - void 0 !== - (null === (i = s.converter) || void 0 === i ? void 0 : i.toAttribute) - ? s.converter - : u - ).toAttribute(e, s.type); - (this._$El = t), - null == o ? this.removeAttribute(n) : this.setAttribute(n, o), - (this._$El = null); - } - } - _$AK(t, e) { - var s; - const i = this.constructor, - n = i._$Ev.get(t); - if (void 0 !== n && this._$El !== n) { - const t = i.getPropertyOptions(n), - o = - 'function' == typeof t.converter - ? { fromAttribute: t.converter } - : void 0 !== - (null === (s = t.converter) || void 0 === s - ? void 0 - : s.fromAttribute) - ? t.converter - : u; - (this._$El = n), - (this[n] = o.fromAttribute(e, t.type)), - (this._$El = null); - } - } - requestUpdate(t, e, s) { - let i = !0; - void 0 !== t && - (((s = s || this.constructor.getPropertyOptions(t)).hasChanged || p)( - this[t], - e, - ) - ? (this._$AL.has(t) || this._$AL.set(t, e), - !0 === s.reflect && - this._$El !== t && - (void 0 === this._$EC && (this._$EC = new Map()), - this._$EC.set(t, s))) - : (i = !1)), - !this.isUpdatePending && i && (this._$E_ = this._$Ej()); - } - async _$Ej() { - this.isUpdatePending = !0; - try { - await this._$E_; - } catch (t) { - Promise.reject(t); - } - const t = this.scheduleUpdate(); - return null != t && (await t), !this.isUpdatePending; - } - scheduleUpdate() { - return this.performUpdate(); - } - performUpdate() { - var t; - if (!this.isUpdatePending) return; - this.hasUpdated, - this._$Ei && - (this._$Ei.forEach((t, e) => (this[e] = t)), (this._$Ei = void 0)); - let e = !1; - const s = this._$AL; - try { - (e = this.shouldUpdate(s)), - e - ? (this.willUpdate(s), - null === (t = this._$ES) || - void 0 === t || - t.forEach((t) => { - var e; - return null === (e = t.hostUpdate) || void 0 === e - ? void 0 - : e.call(t); - }), - this.update(s)) - : this._$Ek(); - } catch (t) { - throw ((e = !1), this._$Ek(), t); - } - e && this._$AE(s); - } - willUpdate(t) {} - _$AE(t) { - var e; - null === (e = this._$ES) || - void 0 === e || - e.forEach((t) => { - var e; - return null === (e = t.hostUpdated) || void 0 === e - ? void 0 - : e.call(t); - }), - this.hasUpdated || ((this.hasUpdated = !0), this.firstUpdated(t)), - this.updated(t); - } - _$Ek() { - (this._$AL = new Map()), (this.isUpdatePending = !1); - } - get updateComplete() { - return this.getUpdateComplete(); - } - getUpdateComplete() { - return this._$E_; - } - shouldUpdate(t) { - return !0; - } - update(t) { - void 0 !== this._$EC && - (this._$EC.forEach((t, e) => this._$EO(e, this[e], t)), - (this._$EC = void 0)), - this._$Ek(); - } - updated(t) {} - firstUpdated(t) {} -} + */;var l;const h=window,a=h.trustedTypes,d=a?a.emptyScript:"",c=h.reactiveElementPolyfillSupport,u={toAttribute(t,e){switch(e){case Boolean:t=t?d:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},p=(t,e)=>e!==t&&(e==e||t==t),$={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:p};class v extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;null!==(e=this.h)&&void 0!==e||(this.h=[]),this.h.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,s)=>{const i=this._$Ep(s,e);void 0!==i&&(this._$Ev.set(i,s),t.push(i))})),t}static createProperty(t,e=$){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const s="symbol"==typeof t?Symbol():"__"+t,i=this.getPropertyDescriptor(t,s,e);void 0!==i&&Object.defineProperty(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){return{get(){return this[e]},set(i){const n=this[t];this[e]=i,this.requestUpdate(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||$}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of e)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(r(t))}else void 0!==t&&e.push(r(t));return e}static _$Ep(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,s;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var s;const i=null!==(s=this.shadowRoot)&&void 0!==s?s:this.attachShadow(this.constructor.shadowRootOptions);return((s,i)=>{e?s.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):i.forEach((e=>{const i=document.createElement("style"),n=t.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,s.appendChild(i)}))})(i,this.constructor.elementStyles),i}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e,s=$){var i;const n=this.constructor._$Ep(t,s);if(void 0!==n&&!0===s.reflect){const o=(void 0!==(null===(i=s.converter)||void 0===i?void 0:i.toAttribute)?s.converter:u).toAttribute(e,s.type);this._$El=t,null==o?this.removeAttribute(n):this.setAttribute(n,o),this._$El=null}}_$AK(t,e){var s;const i=this.constructor,n=i._$Ev.get(t);if(void 0!==n&&this._$El!==n){const t=i.getPropertyOptions(n),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(s=t.converter)||void 0===s?void 0:s.fromAttribute)?t.converter:u;this._$El=n,this[n]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,s){let i=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||p)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===s.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(s)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(s)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -var _; -(v.finalized = !0), - (v.elementProperties = new Map()), - (v.elementStyles = []), - (v.shadowRootOptions = { mode: 'open' }), - null == c || c({ ReactiveElement: v }), - (null !== (l = h.reactiveElementVersions) && void 0 !== l - ? l - : (h.reactiveElementVersions = []) - ).push('1.4.1'); -const A = window, - f = A.trustedTypes, - g = f ? f.createPolicy('lit-html', { createHTML: (t) => t }) : void 0, - y = `lit$${(Math.random() + '').slice(9)}$`, - m = '?' + y, - E = `<${m}>`, - S = document, - b = (t = '') => S.createComment(t), - C = (t) => null === t || ('object' != typeof t && 'function' != typeof t), - w = Array.isArray, - x = (t) => - w(t) || 'function' == typeof (null == t ? void 0 : t[Symbol.iterator]), - U = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, - P = /-->/g, - H = />/g, - O = RegExp( - '>|[ \t\n\f\r](?:([^\\s"\'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r"\'`<>=]|("|\')|))|$)', - 'g', - ), - N = /'/g, - T = /"/g, - R = /^(?:script|style|textarea|title)$/i, - M = ( - (t) => - (e, ...s) => ({ _$litType$: t, strings: e, values: s }) - )(1), - k = Symbol.for('lit-noChange'), - L = Symbol.for('lit-nothing'), - j = new WeakMap(), - B = S.createTreeWalker(S, 129, null, !1), - z = (t, e) => { - const s = t.length - 1, - i = []; - let n, - o = 2 === e ? '' : '', - r = U; - for (let e = 0; e < s; e++) { - const s = t[e]; - let l, - h, - a = -1, - d = 0; - for (; d < s.length && ((r.lastIndex = d), (h = r.exec(s)), null !== h); ) - (d = r.lastIndex), - r === U - ? '!--' === h[1] - ? (r = P) - : void 0 !== h[1] - ? (r = H) - : void 0 !== h[2] - ? (R.test(h[2]) && (n = RegExp('' === h[0] - ? ((r = null != n ? n : U), (a = -1)) - : void 0 === h[1] - ? (a = -2) - : ((a = r.lastIndex - h[2].length), - (l = h[1]), - (r = void 0 === h[3] ? O : '"' === h[3] ? T : N)) - : r === T || r === N - ? (r = O) - : r === P || r === H - ? (r = U) - : ((r = O), (n = void 0)); - const c = r === O && t[e + 1].startsWith('/>') ? ' ' : ''; - o += - r === U - ? s + E - : a >= 0 - ? (i.push(l), s.slice(0, a) + '$lit$' + s.slice(a) + y + c) - : s + y + (-2 === a ? (i.push(void 0), e) : c); - } - const l = o + (t[s] || '') + (2 === e ? '' : ''); - if (!Array.isArray(t) || !t.hasOwnProperty('raw')) - throw Error('invalid template strings array'); - return [void 0 !== g ? g.createHTML(l) : l, i]; - }; -class D { - constructor({ strings: t, _$litType$: e }, s) { - let i; - this.parts = []; - let n = 0, - o = 0; - const r = t.length - 1, - l = this.parts, - [h, a] = z(t, e); - if ( - ((this.el = D.createElement(h, s)), - (B.currentNode = this.el.content), - 2 === e) - ) { - const t = this.el.content, - e = t.firstChild; - e.remove(), t.append(...e.childNodes); - } - for (; null !== (i = B.nextNode()) && l.length < r; ) { - if (1 === i.nodeType) { - if (i.hasAttributes()) { - const t = []; - for (const e of i.getAttributeNames()) - if (e.endsWith('$lit$') || e.startsWith(y)) { - const s = a[o++]; - if ((t.push(e), void 0 !== s)) { - const t = i.getAttribute(s.toLowerCase() + '$lit$').split(y), - e = /([.?@])?(.*)/.exec(s); - l.push({ - type: 1, - index: n, - name: e[2], - strings: t, - ctor: - '.' === e[1] ? J : '?' === e[1] ? Z : '@' === e[1] ? F : q, - }); - } else l.push({ type: 6, index: n }); - } - for (const e of t) i.removeAttribute(e); - } - if (R.test(i.tagName)) { - const t = i.textContent.split(y), - e = t.length - 1; - if (e > 0) { - i.textContent = f ? f.emptyScript : ''; - for (let s = 0; s < e; s++) - i.append(t[s], b()), - B.nextNode(), - l.push({ type: 2, index: ++n }); - i.append(t[e], b()); - } - } - } else if (8 === i.nodeType) - if (i.data === m) l.push({ type: 2, index: n }); - else { - let t = -1; - for (; -1 !== (t = i.data.indexOf(y, t + 1)); ) - l.push({ type: 7, index: n }), (t += y.length - 1); - } - n++; - } - } - static createElement(t, e) { - const s = S.createElement('template'); - return (s.innerHTML = t), s; - } -} -function I(t, e, s = t, i) { - var n, o, r, l; - if (e === k) return e; - let h = - void 0 !== i - ? null === (n = s._$Co) || void 0 === n - ? void 0 - : n[i] - : s._$Cl; - const a = C(e) ? void 0 : e._$litDirective$; - return ( - (null == h ? void 0 : h.constructor) !== a && - (null === (o = null == h ? void 0 : h._$AO) || - void 0 === o || - o.call(h, !1), - void 0 === a ? (h = void 0) : ((h = new a(t)), h._$AT(t, s, i)), - void 0 !== i - ? ((null !== (r = (l = s)._$Co) && void 0 !== r ? r : (l._$Co = []))[ - i - ] = h) - : (s._$Cl = h)), - void 0 !== h && (e = I(t, h._$AS(t, e.values), h, i)), - e - ); -} -class V { - constructor(t, e) { - (this.u = []), (this._$AN = void 0), (this._$AD = t), (this._$AM = e); - } - get parentNode() { - return this._$AM.parentNode; - } - get _$AU() { - return this._$AM._$AU; - } - v(t) { - var e; - const { - el: { content: s }, - parts: i, - } = this._$AD, - n = ( - null !== (e = null == t ? void 0 : t.creationScope) && void 0 !== e - ? e - : S - ).importNode(s, !0); - B.currentNode = n; - let o = B.nextNode(), - r = 0, - l = 0, - h = i[0]; - for (; void 0 !== h; ) { - if (r === h.index) { - let e; - 2 === h.type - ? (e = new W(o, o.nextSibling, this, t)) - : 1 === h.type - ? (e = new h.ctor(o, h.name, h.strings, this, t)) - : 6 === h.type && (e = new G(o, this, t)), - this.u.push(e), - (h = i[++l]); - } - r !== (null == h ? void 0 : h.index) && ((o = B.nextNode()), r++); - } - return n; - } - p(t) { - let e = 0; - for (const s of this.u) - void 0 !== s && - (void 0 !== s.strings - ? (s._$AI(t, s, e), (e += s.strings.length - 2)) - : s._$AI(t[e])), - e++; - } -} -class W { - constructor(t, e, s, i) { - var n; - (this.type = 2), - (this._$AH = L), - (this._$AN = void 0), - (this._$AA = t), - (this._$AB = e), - (this._$AM = s), - (this.options = i), - (this._$Cm = - null === (n = null == i ? void 0 : i.isConnected) || void 0 === n || n); - } - get _$AU() { - var t, e; - return null !== - (e = null === (t = this._$AM) || void 0 === t ? void 0 : t._$AU) && - void 0 !== e - ? e - : this._$Cm; - } - get parentNode() { - let t = this._$AA.parentNode; - const e = this._$AM; - return void 0 !== e && 11 === t.nodeType && (t = e.parentNode), t; - } - get startNode() { - return this._$AA; - } - get endNode() { - return this._$AB; - } - _$AI(t, e = this) { - (t = I(this, t, e)), - C(t) - ? t === L || null == t || '' === t - ? (this._$AH !== L && this._$AR(), (this._$AH = L)) - : t !== this._$AH && t !== k && this.g(t) - : void 0 !== t._$litType$ - ? this.$(t) - : void 0 !== t.nodeType - ? this.T(t) - : x(t) - ? this.k(t) - : this.g(t); - } - O(t, e = this._$AB) { - return this._$AA.parentNode.insertBefore(t, e); - } - T(t) { - this._$AH !== t && (this._$AR(), (this._$AH = this.O(t))); - } - g(t) { - this._$AH !== L && C(this._$AH) - ? (this._$AA.nextSibling.data = t) - : this.T(S.createTextNode(t)), - (this._$AH = t); - } - $(t) { - var e; - const { values: s, _$litType$: i } = t, - n = - 'number' == typeof i - ? this._$AC(t) - : (void 0 === i.el && (i.el = D.createElement(i.h, this.options)), i); - if ((null === (e = this._$AH) || void 0 === e ? void 0 : e._$AD) === n) - this._$AH.p(s); - else { - const t = new V(n, this), - e = t.v(this.options); - t.p(s), this.T(e), (this._$AH = t); - } - } - _$AC(t) { - let e = j.get(t.strings); - return void 0 === e && j.set(t.strings, (e = new D(t))), e; - } - k(t) { - w(this._$AH) || ((this._$AH = []), this._$AR()); - const e = this._$AH; - let s, - i = 0; - for (const n of t) - i === e.length - ? e.push((s = new W(this.O(b()), this.O(b()), this, this.options))) - : (s = e[i]), - s._$AI(n), - i++; - i < e.length && (this._$AR(s && s._$AB.nextSibling, i), (e.length = i)); - } - _$AR(t = this._$AA.nextSibling, e) { - var s; - for ( - null === (s = this._$AP) || void 0 === s || s.call(this, !1, !0, e); - t && t !== this._$AB; - - ) { - const e = t.nextSibling; - t.remove(), (t = e); - } - } - setConnected(t) { - var e; - void 0 === this._$AM && - ((this._$Cm = t), - null === (e = this._$AP) || void 0 === e || e.call(this, t)); - } -} -class q { - constructor(t, e, s, i, n) { - (this.type = 1), - (this._$AH = L), - (this._$AN = void 0), - (this.element = t), - (this.name = e), - (this._$AM = i), - (this.options = n), - s.length > 2 || '' !== s[0] || '' !== s[1] - ? ((this._$AH = Array(s.length - 1).fill(new String())), - (this.strings = s)) - : (this._$AH = L); - } - get tagName() { - return this.element.tagName; - } - get _$AU() { - return this._$AM._$AU; - } - _$AI(t, e = this, s, i) { - const n = this.strings; - let o = !1; - if (void 0 === n) - (t = I(this, t, e, 0)), - (o = !C(t) || (t !== this._$AH && t !== k)), - o && (this._$AH = t); - else { - const i = t; - let r, l; - for (t = n[0], r = 0; r < n.length - 1; r++) - (l = I(this, i[s + r], e, r)), - l === k && (l = this._$AH[r]), - o || (o = !C(l) || l !== this._$AH[r]), - l === L ? (t = L) : t !== L && (t += (null != l ? l : '') + n[r + 1]), - (this._$AH[r] = l); - } - o && !i && this.j(t); - } - j(t) { - t === L - ? this.element.removeAttribute(this.name) - : this.element.setAttribute(this.name, null != t ? t : ''); - } -} -class J extends q { - constructor() { - super(...arguments), (this.type = 3); - } - j(t) { - this.element[this.name] = t === L ? void 0 : t; - } -} -const K = f ? f.emptyScript : ''; -class Z extends q { - constructor() { - super(...arguments), (this.type = 4); - } - j(t) { - t && t !== L - ? this.element.setAttribute(this.name, K) - : this.element.removeAttribute(this.name); - } -} -class F extends q { - constructor(t, e, s, i, n) { - super(t, e, s, i, n), (this.type = 5); - } - _$AI(t, e = this) { - var s; - if ((t = null !== (s = I(this, t, e, 0)) && void 0 !== s ? s : L) === k) - return; - const i = this._$AH, - n = - (t === L && i !== L) || - t.capture !== i.capture || - t.once !== i.once || - t.passive !== i.passive, - o = t !== L && (i === L || n); - n && this.element.removeEventListener(this.name, this, i), - o && this.element.addEventListener(this.name, this, t), - (this._$AH = t); - } - handleEvent(t) { - var e, s; - 'function' == typeof this._$AH - ? this._$AH.call( - null !== - (s = - null === (e = this.options) || void 0 === e ? void 0 : e.host) && - void 0 !== s - ? s - : this.element, - t, - ) - : this._$AH.handleEvent(t); - } -} -class G { - constructor(t, e, s) { - (this.element = t), - (this.type = 6), - (this._$AN = void 0), - (this._$AM = e), - (this.options = s); - } - get _$AU() { - return this._$AM._$AU; - } - _$AI(t) { - I(this, t); - } -} -const Q = { - P: '$lit$', - A: y, - M: m, - C: 1, - L: z, - R: V, - D: x, - V: I, - I: W, - H: q, - N: Z, - U: F, - B: J, - F: G, - }, - X = A.litHtmlPolyfillSupport; -null == X || X(D, W), - (null !== (_ = A.litHtmlVersions) && void 0 !== _ - ? _ - : (A.litHtmlVersions = []) - ).push('2.4.0'); +var _;v.finalized=!0,v.elementProperties=new Map,v.elementStyles=[],v.shadowRootOptions={mode:"open"},null==c||c({ReactiveElement:v}),(null!==(l=h.reactiveElementVersions)&&void 0!==l?l:h.reactiveElementVersions=[]).push("1.4.1");const A=window,f=A.trustedTypes,g=f?f.createPolicy("lit-html",{createHTML:t=>t}):void 0,y=`lit$${(Math.random()+"").slice(9)}$`,m="?"+y,E=`<${m}>`,S=document,b=(t="")=>S.createComment(t),C=t=>null===t||"object"!=typeof t&&"function"!=typeof t,w=Array.isArray,x=t=>w(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,P=/-->/g,H=/>/g,O=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),N=/'/g,T=/"/g,R=/^(?:script|style|textarea|title)$/i,M=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),k=Symbol.for("lit-noChange"),L=Symbol.for("lit-nothing"),j=new WeakMap,B=S.createTreeWalker(S,129,null,!1),z=(t,e)=>{const s=t.length-1,i=[];let n,o=2===e?"":"",r=U;for(let e=0;e"===h[0]?(r=null!=n?n:U,a=-1):void 0===h[1]?a=-2:(a=r.lastIndex-h[2].length,l=h[1],r=void 0===h[3]?O:'"'===h[3]?T:N):r===T||r===N?r=O:r===P||r===H?r=U:(r=O,n=void 0);const c=r===O&&t[e+1].startsWith("/>")?" ":"";o+=r===U?s+E:a>=0?(i.push(l),s.slice(0,a)+"$lit$"+s.slice(a)+y+c):s+y+(-2===a?(i.push(void 0),e):c)}const l=o+(t[s]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==g?g.createHTML(l):l,i]};class D{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let n=0,o=0;const r=t.length-1,l=this.parts,[h,a]=z(t,e);if(this.el=D.createElement(h,s),B.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(i=B.nextNode())&&l.length0){i.textContent=f?f.emptyScript:"";for(let s=0;s2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=L}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,i){const n=this.strings;let o=!1;if(void 0===n)t=I(this,t,e,0),o=!C(t)||t!==this._$AH&&t!==k,o&&(this._$AH=t);else{const i=t;let r,l;for(t=n[0],r=0;r { - var i, n; - const o = - null !== (i = null == s ? void 0 : s.renderBefore) && void 0 !== i - ? i - : e; - let r = o._$litPart$; - if (void 0 === r) { - const t = - null !== (n = null == s ? void 0 : s.renderBefore) && void 0 !== n - ? n - : null; - o._$litPart$ = r = new W( - e.insertBefore(b(), t), - t, - void 0, - null != s ? s : {}, - ); - } - return r._$AI(t), r; - })(e, this.renderRoot, this.renderOptions)); - } - connectedCallback() { - var t; - super.connectedCallback(), - null === (t = this._$Do) || void 0 === t || t.setConnected(!0); - } - disconnectedCallback() { - var t; - super.disconnectedCallback(), - null === (t = this._$Do) || void 0 === t || t.setConnected(!1); - } - render() { - return k; - } -} -(et.finalized = !0), - (et._$litElement$ = !0), - null === (Y = globalThis.litElementHydrateSupport) || - void 0 === Y || - Y.call(globalThis, { LitElement: et }); -const st = globalThis.litElementPolyfillSupport; -null == st || st({ LitElement: et }), - (null !== (tt = globalThis.litElementVersions) && void 0 !== tt - ? tt - : (globalThis.litElementVersions = []) - ).push('3.2.2'); -export { Q as L, L as b, o as i, et as s, k as x, M as y }; +var Y,tt;class et extends v{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const s=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=s.firstChild),s}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{var i,n;const o=null!==(i=null==s?void 0:s.renderBefore)&&void 0!==i?i:e;let r=o._$litPart$;if(void 0===r){const t=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:null;o._$litPart$=r=new W(e.insertBefore(b(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return k}}et.finalized=!0,et._$litElement$=!0,null===(Y=globalThis.litElementHydrateSupport)||void 0===Y||Y.call(globalThis,{LitElement:et});const st=globalThis.litElementPolyfillSupport;null==st||st({LitElement:et}),(null!==(tt=globalThis.litElementVersions)&&void 0!==tt?tt:globalThis.litElementVersions=[]).push("3.2.2");export{Q as L,L as b,o as i,et as s,k as x,M as y}; //# sourceMappingURL=lit-element-2409d5fe.js.map diff --git a/dt-assets/build/components/lit-localize-763e4978.js b/dt-assets/build/components/lit-localize-763e4978.js index b4c48d62a6..7516cd36bf 100644 --- a/dt-assets/build/components/lit-localize-763e4978.js +++ b/dt-assets/build/components/lit-localize-763e4978.js @@ -3,190 +3,37 @@ * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const e = (e, ...t) => ({ strTag: !0, strings: e, values: t }), - t = (e, t, r) => { - let s = e[0]; - for (let o = 1; o < e.length; o++) - (s += t[r ? r[o - 1] : o - 1]), (s += e[o]); - return s; - }, - r = (e) => { - return 'string' != typeof (r = e) && 'strTag' in r - ? t(e.strings, e.values) - : e; - var r; - }, - s = 'lit-localize-status'; +const e=(e,...t)=>({strTag:!0,strings:e,values:t}),t=(e,t,r)=>{let s=e[0];for(let o=1;o{return"string"!=typeof(r=e)&&"strTag"in r?t(e.strings,e.values):e;var r},s="lit-localize-status"; /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -class o { - constructor() { - (this.settled = !1), - (this.promise = new Promise((e, t) => { - (this._resolve = e), (this._reject = t); - })); - } - resolve(e) { - (this.settled = !0), this._resolve(e); - } - reject(e) { - (this.settled = !0), this._reject(e); - } -} +class o{constructor(){this.settled=!1,this.promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}} /** * @license * Copyright 2014 Travis Webb * SPDX-License-Identifier: MIT - */ const n = []; -for (let e = 0; e < 256; e++) - n[e] = ((e >> 4) & 15).toString(16) + (15 & e).toString(16); -function l(e, t) { - return ( - (t ? 'h' : 's') + - (function (e) { - let t = 0, - r = 8997, - s = 0, - o = 33826, - l = 0, - i = 40164, - a = 0, - c = 52210; - for (let n = 0; n < e.length; n++) - (r ^= e.charCodeAt(n)), - (t = 435 * r), - (s = 435 * o), - (l = 435 * i), - (a = 435 * c), - (l += r << 8), - (a += o << 8), - (s += t >>> 16), - (r = 65535 & t), - (l += s >>> 16), - (o = 65535 & s), - (c = (a + (l >>> 16)) & 65535), - (i = 65535 & l); - return ( - n[c >> 8] + - n[255 & c] + - n[i >> 8] + - n[255 & i] + - n[o >> 8] + - n[255 & o] + - n[r >> 8] + - n[255 & r] - ); - })( - /** - * @license - * Copyright 2020 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ 'string' == typeof e ? e : e.join(''), - ) - ); -} + */const n=[];for(let e=0;e<256;e++)n[e]=(e>>4&15).toString(16)+(15&e).toString(16);function l(e,t){return(t?"h":"s")+function(e){let t=0,r=8997,s=0,o=33826,l=0,i=40164,a=0,c=52210;for(let n=0;n>>16,r=65535&t,l+=s>>>16,o=65535&s,c=a+(l>>>16)&65535,i=65535&l;return n[c>>8]+n[255&c]+n[i>>8]+n[255&i]+n[o>>8]+n[255&o]+n[r>>8]+n[255&r]} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */("string"==typeof e?e:e.join(""))} +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const i=new WeakMap,a=new Map;function c(e,s,o){var n;if(e){const r=null!==(n=null==o?void 0:o.id)&&void 0!==n?n:function(e){const t="string"==typeof e?e:e.strings;let r=a.get(t);void 0===r&&(r=l(t,"string"!=typeof e&&!("strTag"in e)),a.set(t,r));return r} /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */ const i = new WeakMap(), - a = new Map(); -function c(e, s, o) { - var n; - if (e) { - const r = - null !== (n = null == o ? void 0 : o.id) && void 0 !== n - ? n - : (function (e) { - const t = 'string' == typeof e ? e : e.strings; - let r = a.get(t); - void 0 === r && - ((r = l(t, 'string' != typeof e && !('strTag' in e))), - a.set(t, r)); - return r; - })( - /** - * @license - * Copyright 2021 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ s, - ), - c = e[r]; - if (c) { - if ('string' == typeof c) return c; - if ('strTag' in c) return t(c.strings, s.values, c.values); - { - let e = i.get(c); - return ( - void 0 === e && ((e = c.values), i.set(c, e)), - { ...c, values: e.map((e) => s.values[e]) } - ); - } - } - } - return r(s); -} -function u(e) { - window.dispatchEvent(new CustomEvent('lit-localize-status', { detail: e })); -} -let g, - d, - v, - f, - h, - p = '', - w = new o(); -w.resolve(); -let m = 0; -const L = (e) => ( - (function (e) { - if (S) throw new Error('lit-localize can only be configured once'); - (E = e), (S = !0); - })((e, t) => c(h, e, t)), - (p = d = e.sourceLocale), - (v = new Set(e.targetLocales)), - v.add(e.sourceLocale), - (f = e.loadLocale), - { getLocale: y, setLocale: j } - ), - y = () => p, - j = (e) => { - if (e === (null != g ? g : p)) return w.promise; - if (!v || !f) throw new Error('Internal error'); - if (!v.has(e)) throw new Error('Invalid locale code'); - m++; - const t = m; - (g = e), - w.settled && (w = new o()), - u({ status: 'loading', loadingLocale: e }); - return ( - (e === d ? Promise.resolve({ templates: void 0 }) : f(e)).then( - (r) => { - m === t && - ((p = e), - (g = void 0), - (h = r.templates), - u({ status: 'ready', readyLocale: e }), - w.resolve()); - }, - (r) => { - m === t && - (u({ status: 'error', errorLocale: e, errorMessage: r.toString() }), - w.reject(r)); - }, - ), - w.promise - ); - }; + */(s),c=e[r];if(c){if("string"==typeof c)return c;if("strTag"in c)return t(c.strings,s.values,c.values);{let e=i.get(c);return void 0===e&&(e=c.values,i.set(c,e)),{...c,values:e.map((e=>s.values[e]))}}}}return r(s)}function u(e){window.dispatchEvent(new CustomEvent("lit-localize-status",{detail:e}))}let g,d,v,f,h,p="",w=new o;w.resolve();let m=0;const L=e=>(function(e){if(S)throw new Error("lit-localize can only be configured once");E=e,S=!0}(((e,t)=>c(h,e,t))),p=d=e.sourceLocale,v=new Set(e.targetLocales),v.add(e.sourceLocale),f=e.loadLocale,{getLocale:y,setLocale:j}),y=()=>p,j=e=>{if(e===(null!=g?g:p))return w.promise;if(!v||!f)throw new Error("Internal error");if(!v.has(e))throw new Error("Invalid locale code");m++;const t=m;g=e,w.settled&&(w=new o),u({status:"loading",loadingLocale:e});return(e===d?Promise.resolve({templates:void 0}):f(e)).then((r=>{m===t&&(p=e,g=void 0,h=r.templates,u({status:"ready",readyLocale:e}),w.resolve())}),(r=>{m===t&&(u({status:"error",errorLocale:e,errorMessage:r.toString()}),w.reject(r))})),w.promise}; /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -let E = r, - S = !1; -export { s as L, L as c, E as m, e as s }; +let E=r,S=!1;export{s as L,L as c,E as m,e as s}; //# sourceMappingURL=lit-localize-763e4978.js.map diff --git a/dt-assets/build/components/map-c0e24c36.js b/dt-assets/build/components/map-c0e24c36.js index 11936482bf..4bf5b68555 100644 --- a/dt-assets/build/components/map-c0e24c36.js +++ b/dt-assets/build/components/map-c0e24c36.js @@ -3,11 +3,5 @@ * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -function* o(o, f) { - if (void 0 !== o) { - let i = 0; - for (const t of o) yield f(t, i++); - } -} -export { o }; +function*o(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++)}}export{o}; //# sourceMappingURL=map-c0e24c36.js.map diff --git a/dt-assets/build/components/repeat-1a2b8966.js b/dt-assets/build/components/repeat-1a2b8966.js index 19b8057cf8..9e47f6f415 100644 --- a/dt-assets/build/components/repeat-1a2b8966.js +++ b/dt-assets/build/components/repeat-1a2b8966.js @@ -1,130 +1,12 @@ -import { L as e, x as t } from './lit-element-2409d5fe.js'; -import { e as n, i as s, t as o } from './directive-de55b00a.js'; +import{L as e,x as t}from"./lit-element-2409d5fe.js";import{e as n,i as s,t as o}from"./directive-de55b00a.js"; /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */ const { I: l } = e, - r = () => document.createComment(''), - i = (e, t, n) => { - var s; - const o = e._$AA.parentNode, - i = void 0 === t ? e._$AB : t._$AA; - if (void 0 === n) { - const t = o.insertBefore(r(), i), - s = o.insertBefore(r(), i); - n = new l(t, s, e, e.options); - } else { - const t = n._$AB.nextSibling, - l = n._$AM, - r = l !== e; - if (r) { - let t; - null === (s = n._$AQ) || void 0 === s || s.call(n, e), - (n._$AM = e), - void 0 !== n._$AP && (t = e._$AU) !== l._$AU && n._$AP(t); - } - if (t !== i || r) { - let e = n._$AA; - for (; e !== t; ) { - const t = e.nextSibling; - o.insertBefore(e, i), (e = t); - } - } - } - return n; - }, - f = (e, t, n = e) => (e._$AI(t, n), e), - u = {}, - c = (e) => { - var t; - null === (t = e._$AP) || void 0 === t || t.call(e, !1, !0); - let n = e._$AA; - const s = e._$AB.nextSibling; - for (; n !== s; ) { - const e = n.nextSibling; - n.remove(), (n = e); - } - }, - A = (e, t, n) => { - const s = new Map(); - for (let o = t; o <= n; o++) s.set(e[o], o); - return s; - }, - a = n( - class extends s { - constructor(e) { - if ((super(e), e.type !== o.CHILD)) - throw Error('repeat() can only be used in text expressions'); - } - ht(e, t, n) { - let s; - void 0 === n ? (n = t) : void 0 !== t && (s = t); - const o = [], - l = []; - let r = 0; - for (const t of e) (o[r] = s ? s(t, r) : r), (l[r] = n(t, r)), r++; - return { values: l, keys: o }; - } - render(e, t, n) { - return this.ht(e, t, n).values; - } - update(e, [n, s, o]) { - var l; - const r = e._$AH, - { values: a, keys: d } = this.ht(n, s, o); - if (!Array.isArray(r)) return (this.ut = d), a; - const v = null !== (l = this.ut) && void 0 !== l ? l : (this.ut = []), - $ = []; - let _, - h, - p = 0, - m = r.length - 1, - x = 0, - g = a.length - 1; - for (; p <= m && x <= g; ) - if (null === r[p]) p++; - else if (null === r[m]) m--; - else if (v[p] === d[x]) ($[x] = f(r[p], a[x])), p++, x++; - else if (v[m] === d[g]) ($[g] = f(r[m], a[g])), m--, g--; - else if (v[p] === d[g]) - ($[g] = f(r[p], a[g])), i(e, $[g + 1], r[p]), p++, g--; - else if (v[m] === d[x]) - ($[x] = f(r[m], a[x])), i(e, r[p], r[m]), m--, x++; - else if ( - (void 0 === _ && ((_ = A(d, x, g)), (h = A(v, p, m))), _.has(v[p])) - ) - if (_.has(v[m])) { - const t = h.get(d[x]), - n = void 0 !== t ? r[t] : null; - if (null === n) { - const t = i(e, r[p]); - f(t, a[x]), ($[x] = t); - } else ($[x] = f(n, a[x])), i(e, r[p], n), (r[t] = null); - x++; - } else c(r[m]), m--; - else c(r[p]), p++; - for (; x <= g; ) { - const t = i(e, $[g + 1]); - f(t, a[x]), ($[x++] = t); - } - for (; p <= m; ) { - const e = r[p++]; - null !== e && c(e); - } - return ( - (this.ut = d), - ((e, t = u) => { - e._$AH = t; - })(e, $), - t - ); - } - }, - ); + */const{I:l}=e,r=()=>document.createComment(""),i=(e,t,n)=>{var s;const o=e._$AA.parentNode,i=void 0===t?e._$AB:t._$AA;if(void 0===n){const t=o.insertBefore(r(),i),s=o.insertBefore(r(),i);n=new l(t,s,e,e.options)}else{const t=n._$AB.nextSibling,l=n._$AM,r=l!==e;if(r){let t;null===(s=n._$AQ)||void 0===s||s.call(n,e),n._$AM=e,void 0!==n._$AP&&(t=e._$AU)!==l._$AU&&n._$AP(t)}if(t!==i||r){let e=n._$AA;for(;e!==t;){const t=e.nextSibling;o.insertBefore(e,i),e=t}}}return n},f=(e,t,n=e)=>(e._$AI(t,n),e),u={},c=e=>{var t;null===(t=e._$AP)||void 0===t||t.call(e,!1,!0);let n=e._$AA;const s=e._$AB.nextSibling;for(;n!==s;){const e=n.nextSibling;n.remove(),n=e}},A=(e,t,n)=>{const s=new Map;for(let o=t;o<=n;o++)s.set(e[o],o);return s},a=n(class extends s{constructor(e){if(super(e),e.type!==o.CHILD)throw Error("repeat() can only be used in text expressions")}ht(e,t,n){let s;void 0===n?n=t:void 0!==t&&(s=t);const o=[],l=[];let r=0;for(const t of e)o[r]=s?s(t,r):r,l[r]=n(t,r),r++;return{values:l,keys:o}}render(e,t,n){return this.ht(e,t,n).values}update(e,[n,s,o]){var l;const r=e._$AH,{values:a,keys:d}=this.ht(n,s,o);if(!Array.isArray(r))return this.ut=d,a;const v=null!==(l=this.ut)&&void 0!==l?l:this.ut=[],$=[];let _,h,p=0,m=r.length-1,x=0,g=a.length-1;for(;p<=m&&x<=g;)if(null===r[p])p++;else if(null===r[m])m--;else if(v[p]===d[x])$[x]=f(r[p],a[x]),p++,x++;else if(v[m]===d[g])$[g]=f(r[m],a[g]),m--,g--;else if(v[p]===d[g])$[g]=f(r[p],a[g]),i(e,$[g+1],r[p]),p++,g--;else if(v[m]===d[x])$[x]=f(r[m],a[x]),i(e,r[p],r[m]),m--,x++;else if(void 0===_&&(_=A(d,x,g),h=A(v,p,m)),_.has(v[p]))if(_.has(v[m])){const t=h.get(d[x]),n=void 0!==t?r[t]:null;if(null===n){const t=i(e,r[p]);f(t,a[x]),$[x]=t}else $[x]=f(n,a[x]),i(e,r[p],n),r[t]=null;x++}else c(r[m]),m--;else c(r[p]),p++;for(;x<=g;){const t=i(e,$[g+1]);f(t,a[x]),$[x++]=t}for(;p<=m;){const e=r[p++];null!==e&&c(e)}return this.ut=d,((e,t=u)=>{e._$AH=t})(e,$),t}}); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */ export { a as c }; + */export{a as c}; //# sourceMappingURL=repeat-1a2b8966.js.map diff --git a/dt-assets/build/components/style-map-ac85d91b.js b/dt-assets/build/components/style-map-ac85d91b.js index 8011df60f0..237cc5dab0 100644 --- a/dt-assets/build/components/style-map-ac85d91b.js +++ b/dt-assets/build/components/style-map-ac85d91b.js @@ -1,52 +1,7 @@ -import { x as t } from './lit-element-2409d5fe.js'; -import { e, i as r, t as s } from './directive-de55b00a.js'; +import{x as t}from"./lit-element-2409d5fe.js";import{e,i as r,t as s}from"./directive-de55b00a.js"; /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */ const n = e( - class extends r { - constructor(t) { - var e; - if ( - (super(t), - t.type !== s.ATTRIBUTE || - 'style' !== t.name || - (null === (e = t.strings) || void 0 === e ? void 0 : e.length) > 2) - ) - throw Error( - 'The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.', - ); - } - render(t) { - return Object.keys(t).reduce((e, r) => { - const s = t[r]; - return null == s - ? e - : e + - `${(r = r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&').toLowerCase())}:${s};`; - }, ''); - } - update(e, [r]) { - const { style: s } = e.element; - if (void 0 === this.vt) { - this.vt = new Set(); - for (const t in r) this.vt.add(t); - return this.render(r); - } - this.vt.forEach((t) => { - null == r[t] && - (this.vt.delete(t), - t.includes('-') ? s.removeProperty(t) : (s[t] = '')); - }); - for (const t in r) { - const e = r[t]; - null != e && - (this.vt.add(t), t.includes('-') ? s.setProperty(t, e) : (s[t] = e)); - } - return t; - } - }, -); -export { n as i }; + */const n=e(class extends r{constructor(t){var e;if(super(t),t.type!==s.ATTRIBUTE||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.vt){this.vt=new Set;for(const t in r)this.vt.add(t);return this.render(r)}this.vt.forEach((t=>{null==r[t]&&(this.vt.delete(t),t.includes("-")?s.removeProperty(t):s[t]="")}));for(const t in r){const e=r[t];null!=e&&(this.vt.add(t),t.includes("-")?s.setProperty(t,e):s[t]=e)}return t}});export{n as i}; //# sourceMappingURL=style-map-ac85d91b.js.map