From 4565dc4515a04d10902c3ea9e25a3cc99a1ff874 Mon Sep 17 00:00:00 2001 From: Jonathan Pyle Date: Thu, 18 Jul 2024 22:43:11 -0400 Subject: [PATCH] regenerate documentation --- .../docassemble/base/functions.py | 2 + docassemble_base/docassemble/base/parse.py | 6 ++- .../docassemble/base/standardformatter.py | 29 ++++++++---- docassemble_base/docassemble/base/util.py | 2 + .../questions/examples/testaccordion4.yml | 45 +++++++++++++++++++ .../demo/data/static/accordion.css | 8 ++++ .../docassemble/demo/progressivedisclosure.py | 2 +- .../docassemble/webapp/server.py | 9 +++- .../docassemble/webapp/static/app/bundle.js | 2 +- .../webapp/static/app/bundlenojquery.js | 2 +- .../webapp/static/app/bundlewrapjquery.js | 2 +- .../labelauty/source/jquery-labelauty.js | 25 +++++------ .../labelauty/source/jquery-labelauty.min.js | 2 +- 13 files changed, 105 insertions(+), 31 deletions(-) create mode 100644 docassemble_demo/docassemble/demo/data/questions/examples/testaccordion4.yml create mode 100644 docassemble_demo/docassemble/demo/data/static/accordion.css diff --git a/docassemble_base/docassemble/base/functions.py b/docassemble_base/docassemble/base/functions.py index 749b2e20e..481a27ebd 100644 --- a/docassemble_base/docassemble/base/functions.py +++ b/docassemble_base/docassemble/base/functions.py @@ -122,7 +122,9 @@ def __str__(self): def filename_invalid(filename): + logmessage("filename is " + repr(filename)) if '../' in filename or filename.startswith('/'): + logmessage("Returning invalid") return True if re.search(r'[^A-Za-z0-9\_\.\-\/ ]', filename): return True diff --git a/docassemble_base/docassemble/base/parse.py b/docassemble_base/docassemble/base/parse.py index 5340f325d..0f21e6e59 100644 --- a/docassemble_base/docassemble/base/parse.py +++ b/docassemble_base/docassemble/base/parse.py @@ -4647,6 +4647,10 @@ def __init__(self, orig_data, caller, **kwargs): if 'extras' not in field_info: field_info['extras'] = {} field_info['extras'][key] = TextObject(definitions + str(field[key]), question=self) + elif key == 'css class': + if 'extras' not in field_info: + field_info['extras'] = {} + field_info['extras'][key] = TextObject(definitions + str(field[key]), question=self) elif key == 'show if': if not isinstance(field[key], list): field_list = [field[key]] @@ -6066,7 +6070,7 @@ def ask(self, user_dict, old_user_dict, the_x, iterators, sought, orig_sought, p continue else: extras['field metadata'][field.number] = recursive_eval_textobject_or_primitive(field.extras['field metadata'], user_dict) - for key in ('note', 'html', 'raw html', 'min', 'max', 'minlength', 'maxlength', 'step', 'scale', 'inline', 'inline width', 'currency symbol', 'pen color', 'file css class'): # 'script', 'css', + for key in ('note', 'html', 'raw html', 'css class'): if key in field.extras: if key not in extras: extras[key] = {} diff --git a/docassemble_base/docassemble/base/standardformatter.py b/docassemble_base/docassemble/base/standardformatter.py index 0ada4f2d0..752b6d804 100644 --- a/docassemble_base/docassemble/base/standardformatter.py +++ b/docassemble_base/docassemble/base/standardformatter.py @@ -822,7 +822,7 @@ def as_html(status, debug, root, validation_rules, field_error, the_progress_bar continue_button_color = status.extras.get('continuecolor', None) or BUTTON_COLOR back_button_val = status.extras.get('back_button', None) if (back_button_val or (back_button_val is None and status.question.interview.question_back_button)) and status.question.can_go_back and steps > 1: - back_button = '\n ' else: @@ -1048,6 +1048,9 @@ def as_html(status, debug, root, validation_rules, field_error, the_progress_bar if hasattr(status.question, 'review_saveas'): datatypes[safeid(status.question.review_saveas)] = "boolean" for field in status.get_field_list(): + extra_container_class = None + if 'css class' in status.extras and field.number in status.extras['css class']: + extra_container_class = ' ' + clean_whitespace(status.extras['css class'][field.number]) if 'html' in status.extras and field.number in status.extras['html']: side_note_content = status.extras['html'][field.number].rstrip() elif 'raw html' in status.extras and field.number in status.extras['raw html']: @@ -1078,12 +1081,12 @@ def as_html(status, debug, root, validation_rules, field_error, the_progress_bar if tabular: fieldlist.append(' ' + help_wrap(side_note_content, status.helptexts[field.number], status) + '\n') else: - fieldlist.append('
' + help_wrap(side_note_content, status.helptexts[field.number], status) + '
\n') + fieldlist.append('
' + help_wrap(side_note_content, status.helptexts[field.number], status) + '
\n') else: if tabular: fieldlist.append(' ' + side_note_content + '\n') else: - fieldlist.append('
' + side_note_content + '
\n') + fieldlist.append('
' + side_note_content + '
\n') continue if field.datatype == 'raw html' and 'raw html' in status.extras and field.number in status.extras['raw html'] and side_note_content: fieldlist.append(' ' + side_note_content + '\n') @@ -1093,12 +1096,12 @@ def as_html(status, debug, root, validation_rules, field_error, the_progress_bar if tabular: fieldlist.append(' ' + help_wrap(side_note_content, status.helptexts[field.number], status) + '\n') else: - fieldlist.append('
' + help_wrap(side_note_content, status.helptexts[field.number], status) + '
\n') + fieldlist.append('
' + help_wrap(side_note_content, status.helptexts[field.number], status) + '
\n') else: if tabular: fieldlist.append(' ' + side_note_content + '\n') else: - fieldlist.append('
' + side_note_content + '
\n') + fieldlist.append('
' + side_note_content + '
\n') continue # elif field.datatype in ['script', 'css']: # continue @@ -1120,7 +1123,7 @@ def as_html(status, debug, root, validation_rules, field_error, the_progress_bar if tabular: fieldlist.append(' ' + markdown_to_html(status.helptexts[field.number], status=status, strip_newlines=True) + '' + icon + markdown_to_html(status.labels[field.number], trim=True, status=status, strip_newlines=True) + '' + side_note + '\n') else: - fieldlist.append('
' + icon + markdown_to_html(status.labels[field.number], trim=True, status=status, strip_newlines=True) + '' + markdown_to_html(status.helptexts[field.number], status=status, strip_newlines=True) + '
' + side_note + '
\n') + fieldlist.append('
' + icon + markdown_to_html(status.labels[field.number], trim=True, status=status, strip_newlines=True) + '' + markdown_to_html(status.helptexts[field.number], status=status, strip_newlines=True) + '
' + side_note + '
\n') continue if hasattr(field, 'label'): if tabular: @@ -1352,6 +1355,10 @@ def as_html(status, debug, root, validation_rules, field_error, the_progress_bar else: field_class = ' da-field-container da-field-container-datatype-' + field.datatype if field.datatype == 'html': + if 'css class' in status.extras and field.number in status.extras['css class']: + note_css_class = ' ' + clean_whitespace(status.extras['css class'][field.number]) + else: + note_css_class = '' if hasattr(field, 'collect_type'): if not seen_first: if status.extras['list_collect_length'] <= 1: @@ -1394,10 +1401,10 @@ def as_html(status, debug, root, validation_rules, field_error, the_progress_bar fieldlist.append(note_fields[field.number]) else: if field.number in status.helptexts: - fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, classes='da-field-container da-field-container-note' + class_def + extra_container_class, content_classes='col', content=help_wrap(note_fields[field.number], status.helptexts[field.number], status), under_text=under_text)) + fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, classes='da-field-container da-field-container-note' + note_css_class + class_def + extra_container_class, content_classes='col', content=help_wrap(note_fields[field.number], status.helptexts[field.number], status), under_text=under_text)) # fieldlist.append('
' + help_wrap(note_fields[field.number], status.helptexts[field.number], status) + '
\n') else: - fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, classes='da-field-container da-field-container-note' + class_def + extra_container_class, content_classes='col', content='
' + note_fields[field.number] + '
', under_text=under_text)) + fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, classes='da-field-container da-field-container-note' + note_css_class + class_def + extra_container_class, content_classes='col', content='
' + note_fields[field.number] + '
', under_text=under_text)) # fieldlist.append('
' + note_fields[field.number] + '
\n') # continue elif field.datatype == 'raw html': @@ -1406,7 +1413,11 @@ def as_html(status, debug, root, validation_rules, field_error, the_progress_bar elif field.datatype == 'note': if field.number in note_fields: if field.number in status.helptexts: - fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, classes='da-field-container da-field-container-note' + class_def + extra_container_class, content_classes='col', content=help_wrap(note_fields[field.number], status.helptexts[field.number], status), under_text=under_text)) + if 'css class' in status.extras and field.number in status.extras['css class']: + note_css_class = ' ' + clean_whitespace(status.extras['css class'][field.number]) + else: + note_css_class = '' + fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, classes='da-field-container da-field-container-note' + note_css_class + class_def + extra_container_class, content_classes='col', content=help_wrap(note_fields[field.number], status.helptexts[field.number], status), under_text=under_text)) # fieldlist.append('
' + help_wrap(note_fields[field.number], status.helptexts[field.number], status) + '
\n') else: fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, classes='da-field-container da-field-container-note' + class_def + extra_container_class, content_classes='col', content=note_fields[field.number], under_text=under_text)) diff --git a/docassemble_base/docassemble/base/util.py b/docassemble_base/docassemble/base/util.py index 932087f4d..5e9000685 100644 --- a/docassemble_base/docassemble/base/util.py +++ b/docassemble_base/docassemble/base/util.py @@ -1813,6 +1813,8 @@ def init(self, *pargs, **kwargs): self.complete_attribute = None if 'ask_object_type' in kwargs and kwargs['ask_object_type']: self.ask_object_type = True + self.object_type = None + self.object_type_parameters = {} del kwargs['ask_object_type'] if not hasattr(self, 'ask_object_type'): self.ask_object_type = False diff --git a/docassemble_demo/docassemble/demo/data/questions/examples/testaccordion4.yml b/docassemble_demo/docassemble/demo/data/questions/examples/testaccordion4.yml new file mode 100644 index 000000000..123e6f6df --- /dev/null +++ b/docassemble_demo/docassemble/demo/data/questions/examples/testaccordion4.yml @@ -0,0 +1,45 @@ +metadata: + title: Accordion Fields + short title: Accordion + documentation: "https://docassemble.org/docs/recipes.html#accordion" + example start: 1 + example end: 4 +--- +modules: + - docassemble.demo.accordion +--- +features: + css: docassemble.demo:data/static/accordion.css +--- +question: | + Tell me about your preferences +fields: + - raw html: | + ${ start_accordion('Pets', showing=True) } + - Favorite cat: favorite_cat + show if: + code: ask_about_pets + - Favorite dog: favorite_dog + show if: + code: ask_about_pets + - raw html: | + ${ next_accordion('Food') } + - Favorite fruit: favorite_fruit + required: False + - Favorite vegetable: favorite_vegetable + required: False + - raw html: | + ${ next_accordion('Aesthetics') } + - Fashion aesthetic: fashion_aesthetic + required: False + - Decor aesthetic: decor_aesthetic + required: False + - raw html: ${ end_accordion() } +--- +code: | + ask_about_pets = False +--- +mandatory: True +question: | + Your favorite vegetable is ${ favorite_vegetable } and + your fashion aesthetic is ${ fashion_aesthetic }. diff --git a/docassemble_demo/docassemble/demo/data/static/accordion.css b/docassemble_demo/docassemble/demo/data/static/accordion.css new file mode 100644 index 000000000..460fc2218 --- /dev/null +++ b/docassemble_demo/docassemble/demo/data/static/accordion.css @@ -0,0 +1,8 @@ +div.accordion-item:has(.accordion-body:empty) h2 { + display: none; +} + +div.accordion-item:has(.accordion-body:empty) div { + display: none; +} + diff --git a/docassemble_demo/docassemble/demo/progressivedisclosure.py b/docassemble_demo/docassemble/demo/progressivedisclosure.py index 94981a394..4f6db953b 100644 --- a/docassemble_demo/docassemble/demo/progressivedisclosure.py +++ b/docassemble_demo/docassemble/demo/progressivedisclosure.py @@ -5,7 +5,7 @@ def prog_disclose(template, classname=None): if classname is None: - classname = ' bg-light' + classname = ' bg-secondary-subtle' else: classname = ' ' + classname.strip() the_id = re.sub(r'[^A-Za-z0-9]', '', template.instanceName) diff --git a/docassemble_webapp/docassemble/webapp/server.py b/docassemble_webapp/docassemble/webapp/server.py index 1dc9cd06e..38ae23079 100644 --- a/docassemble_webapp/docassemble/webapp/server.py +++ b/docassemble_webapp/docassemble/webapp/server.py @@ -1544,7 +1544,7 @@ def get_twilio_config(): else: app.config['BUTTON_STYLE'] = 'btn-' BUTTON_COLOR_NAV_LOGIN = daconfig['button colors'].get('navigation bar login', 'primary') -app.config['FOOTER_CLASS'] = str(daconfig.get('footer css class', 'bg-light')).strip() + ' dafooter' +app.config['FOOTER_CLASS'] = str(daconfig.get('footer css class', 'bg-secondary-subtle')).strip() + ' dafooter' def get_page_parts(): @@ -3397,6 +3397,9 @@ def make_navbar(status, steps, show_login, chat_info, debug_mode, index_params, navbar += '\n ' + word('Sign in') + '' navbar += """ """ + else: + if status.nav_item: + navbar += '' navbar += """ @@ -11454,6 +11457,8 @@ def index(action_argument=None, refer=None): } $(".da-to-labelauty").labelauty({ class: "labelauty da-active-invisible dafullwidth" }); $(".da-to-labelauty-icon").labelauty({ label: false }); + $("input[type=radio].da-to-labelauty:checked").trigger('change'); + $("input[type=radio].da-to-labelauty-icon:checked").trigger('change'); $("button").on('click', function(){ daWhichButton = this; return true; @@ -30400,7 +30405,7 @@ def manage_api(): flash(word("Could not create new key"), 'error') return render_template('pages/manage_api.html', **argu) argu['description'] = Markup( - """
+ """

""" + (word("Your new API key, known internally as %s, is:
%s
") % (form.name.data, '
' + api_key + '')) + """ diff --git a/docassemble_webapp/docassemble/webapp/static/app/bundle.js b/docassemble_webapp/docassemble/webapp/static/app/bundle.js index 367a43aa6..c9b3300b9 100644 --- a/docassemble_webapp/docassemble/webapp/static/app/bundle.js +++ b/docassemble_webapp/docassemble/webapp/static/app/bundle.js @@ -226,7 +226,7 @@ $.bridget(NAMESPACE_ALTERNATE,Slider);$(function(){$("input[data-provide=slider] * @author: Francisco Neves (@fntneves) * @site: www.francisconeves.com * @license: MIT License - */(function(e){e.fn.labelauty=function(t){function a(){PPP}var i=e.extend({development:!1,class:"labelauty",icon:!0,label:!0,separator:"|",checked_label:"Checked",unchecked_label:"Unchecked",force_random_id:!1,minimum_width:!1,same_width:!1},t);return this.each(function(){var a,r,c,l,d,h,m,f,p,g,v,b,t=e(this),w=t.is(":checked"),y=t.attr("type"),j=!0,u=!0,_=t.attr("aria-label");if(t.attr("aria-hidden",!0),t.is(":checkbox")===!1&&t.is(":radio")===!1)return this;if(p=t.attr("class").split(/\s+/).filter(function(e){return e!="da-to-labelauty"}),t.addClass(i.class),h=t.attr("data-labelauty"),c=t.attr("data-color"),u=i.label,j=i.icon,u===!0&&(h==null||h.length===0?l=[i.unchecked_label,i.checked_label]:(l=h.split(i.separator),l.length>2?(u=!1,n(i.development,"There's more than two labels. LABELAUTY will not use labels.")):l.length===1&&n(i.development,"There's just one label. LABELAUTY will use this one for both cases."))),t.css({display:"none"}),t.removeAttr("data-labelauty"),r=t.attr("id"),i.force_random_id||r==null||r.trim()===""){for(m=1+Math.floor(Math.random()*1024e3),r="labelauty-"+m;e(r).length!==0;)m++,r="labelauty-"+m,n(i.development,"Holy crap, between 1024 thousand numbers, one raised a conflict. Trying again.");t.attr("id",r)}for(a=jQuery(o(r,_,w,y,l,u,j)),f=0;fb?d.find("span.labelauty-checked").width(v):d.find("span.labelauty-unchecked").width(b))})};function s(e){var n=0,t=e,s="hidden_element",t=t.clone().attr("class",s).appendTo("body"),n=t.width(!0);return t.remove(),n}function n(e,t){e&&window.console&&window.console.log&&window.console.log("jQuery-LABELAUTY: "+t)}function t(e){return e=e.replace(/&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/"/g,'"'),e}function o(e,n,s,o,i,a,r){var c,l,u,h,m,d="";return i==null?c=l="":(c=i[0],i[1]==null?l=c:l=i[1]),o=="checkbox"?h='':h='',o=="checkbox"?m='':m='',n==null?d="":d='tabindex="0" role="'+o+'" aria-checked="'+s+'" aria-label="'+n+'"',a==!0&&r==!0?u='":a==!0?u='":u='",u}})(window.jQuery) + */(function(e){e.fn.labelauty=function(t){function a(){PPP}var i=e.extend({development:!1,class:"labelauty",icon:!0,label:!0,separator:"|",checked_label:"Checked",unchecked_label:"Unchecked",force_random_id:!1,minimum_width:!1,same_width:!1},t);return this.each(function(){var a,r,c,l,d,h,m,f,p,g,v,b,t=e(this),w=t.is(":checked"),y=t.attr("type"),j=!0,u=!0,_=t.attr("aria-label");if(t.attr("aria-hidden",!0),t.is(":checkbox")===!1&&t.is(":radio")===!1)return this;if(p=t.attr("class").split(/\s+/).filter(function(e){return e!="da-to-labelauty"}),t.addClass(i.class),h=t.attr("data-labelauty"),c=t.attr("data-color"),u=i.label,j=i.icon,u===!0&&(h==null||h.length===0?l=[i.unchecked_label,i.checked_label]:(l=h.split(i.separator),l.length>2?(u=!1,n(i.development,"There's more than two labels. LABELAUTY will not use labels.")):l.length===1&&n(i.development,"There's just one label. LABELAUTY will use this one for both cases."))),t.css({display:"none"}),t.removeAttr("data-labelauty"),r=t.attr("id"),i.force_random_id||r==null||r.trim()===""){for(m=1+Math.floor(Math.random()*1024e3),r="labelauty-"+m;e(r).length!==0;)m++,r="labelauty-"+m,n(i.development,"Holy crap, between 1024 thousand numbers, one raised a conflict. Trying again.");t.attr("id",r)}for(a=jQuery(o(r,_,w,y,l,u,j)),f=0;fb?d.find("span.labelauty-checked").width(v):d.find("span.labelauty-unchecked").width(b))})};function s(e){var n=0,t=e,s="hidden_element",t=t.clone().attr("class",s).appendTo("body"),n=t.width(!0);return t.remove(),n}function n(e,t){e&&window.console&&window.console.log&&window.console.log("jQuery-LABELAUTY: "+t)}function t(e){return e=e.replace(/&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/"/g,'"'),e}function o(e,n,s,o,i,a,r){var c,l,u,h,m,d="";return i==null?c=l="":(c=i[0],i[1]==null?l=c:l=i[1]),o=="checkbox"?h='':h='',o=="checkbox"?m='':m='',n==null?d="":d='tabindex="0" role="'+o+'" aria-checked="'+s+'" aria-label="'+n+'"',a==!0&&r==!0?u='":a==!0?u='":u='",u}})(window.jQuery) !function(){"use strict";function e(e){return JSON.parse(JSON.stringify(e))}function t(e){for(var t=y(e);"ÿà"<=t[1].slice(0,2)&&t[1].slice(0,2)<="ÿï";)t=[t[0]].concat(t.slice(2));return t.join("")}function a(e){return s(">"+p("B",e.length),e)}function i(e){return s(">"+p("H",e.length),e)}function n(e){return s(">"+p("L",e.length),e)}function r(e,t,r){var o,l,m,y,c="",S="";if("Byte"==t)o=e.length,4>=o?S=a(e)+p("\x00",4-o):(S=s(">L",[r]),c=a(e));else if("Short"==t)o=e.length,2>=o?S=i(e)+p("\x00\x00",2-o):(S=s(">L",[r]),c=i(e));else if("Long"==t)o=e.length,1>=o?S=n(e):(S=s(">L",[r]),c=n(e));else if("Ascii"==t)l=e+"\x00",o=l.length,o>4?(S=s(">L",[r]),c=l):S=l+p("\x00",4-o);else if("Rational"==t){if("number"==typeof e[0])o=1,m=e[0],y=e[1],l=s(">L",[m])+s(">L",[y]);else{o=e.length,l="";for(var f=0;o>f;f++)m=e[f][0],y=e[f][1],l+=s(">L",[m])+s(">L",[y])}S=s(">L",[r]),c=l}else if("SRational"==t){if("number"==typeof e[0])o=1,m=e[0],y=e[1],l=s(">l",[m])+s(">l",[y]);else{o=e.length,l="";for(var f=0;o>f;f++)m=e[f][0],y=e[f][1],l+=s(">l",[m])+s(">l",[y])}S=s(">L",[r]),c=l}else"Undefined"==t&&(o=e.length,o>4?(S=s(">L",[r]),c=e):S=e+p("\x00",4-o));var h=s(">L",[o]);return[h,S,c]}function o(e,t,a){var i,n=8,o=Object.keys(e).length,l=s(">H",[o]);i=["0th","1st"].indexOf(t)>-1?2+12*o+4:2+12*o;var m,p="",y="";for(var m in e)if("string"==typeof m&&(m=parseInt(m)),!("0th"==t&&[34665,34853].indexOf(m)>-1||"Exif"==t&&40965==m||"1st"==t&&[513,514].indexOf(m)>-1)){var c=e[m],S=s(">H",[m]),f=u[t][m].type,h=s(">H",[g[f]]);"number"==typeof c&&(c=[c]);var d=n+i+a+y.length,P=r(c,f,d),C=P[0],R=P[1],L=P[2];p+=S+h+C+R,y+=L}return[l+p,y]}function l(e){var t,a;if("ÿØ"==e.slice(0,2))t=y(e),a=c(t),a?this.tiftag=a.slice(10):this.tiftag=null;else if(["II","MM"].indexOf(e.slice(0,2))>-1)this.tiftag=e;else{if("Exif"!=e.slice(0,4))throw"Given file is neither JPEG nor TIFF.";this.tiftag=e.slice(6)}}function s(e,t){if(!(t instanceof Array))throw"'pack' error. Got invalid type argument.";if(e.length-1!=t.length)throw"'pack' error. "+(e.length-1)+" marks, "+t.length+" elements.";var a;if("<"==e[0])a=!0;else{if(">"!=e[0])throw"";a=!1}for(var i="",n=1,r=null,o=null,l=null;o=e[n];){if("b"==o.toLowerCase()){if(r=t[n-1],"b"==o&&0>r&&(r+=256),r>255||0>r)throw"'pack' error.";l=String.fromCharCode(r)}else if("H"==o){if(r=t[n-1],r>65535||0>r)throw"'pack' error.";l=String.fromCharCode(Math.floor(r%65536/256))+String.fromCharCode(r%256),a&&(l=l.split("").reverse().join(""))}else{if("l"!=o.toLowerCase())throw"'pack' error.";if(r=t[n-1],"l"==o&&0>r&&(r+=4294967296),r>4294967295||0>r)throw"'pack' error.";l=String.fromCharCode(Math.floor(r/16777216))+String.fromCharCode(Math.floor(r%16777216/65536))+String.fromCharCode(Math.floor(r%65536/256))+String.fromCharCode(r%256),a&&(l=l.split("").reverse().join(""))}i+=l,n+=1}return i}function m(e,t){if("string"!=typeof t)throw"'unpack' error. Got invalid type argument.";for(var a=0,i=1;i"!=e[0])throw"'unpack' error.";n=!1}for(var r=[],o=0,l=1,s=null,m=null,p=null,y="";m=e[l];){if("b"==m.toLowerCase())p=1,y=t.slice(o,o+p),s=y.charCodeAt(0),"b"==m&&s>=128&&(s-=256);else if("H"==m)p=2,y=t.slice(o,o+p),n&&(y=y.split("").reverse().join("")),s=256*y.charCodeAt(0)+y.charCodeAt(1);else{if("l"!=m.toLowerCase())throw"'unpack' error. "+m;p=4,y=t.slice(o,o+p),n&&(y=y.split("").reverse().join("")),s=16777216*y.charCodeAt(0)+65536*y.charCodeAt(1)+256*y.charCodeAt(2)+y.charCodeAt(3),"l"==m&&s>=2147483648&&(s-=4294967296)}r.push(s),o+=p,l+=1}return r}function p(e,t){for(var a="",i=0;t>i;i++)a+=e;return a}function y(e){if("ÿØ"!=e.slice(0,2))throw"Given data isn't JPEG.";for(var t=2,a=["ÿØ"];;){if("ÿÚ"==e.slice(t,t+2)){a.push(e.slice(t));break}var i=m(">H",e.slice(t+2,t+4))[0],n=t+i+2;if(a.push(e.slice(t,n)),t=n,t>=e.length)throw"Wrong JPEG data."}return a}function c(e){for(var t,a=0;aH",[e.length+2])+e,n=y(t),r=S(n,i);return a&&(r="data:image/jpeg;base64,"+h(r)),r},f.load=function(e){var t;if("string"!=typeof e)throw"'load' gots invalid type argument.";if("ÿØ"==e.slice(0,2))t=e;else if("data:image/jpeg;base64,"==e.slice(0,23)||"data:image/jpg;base64,"==e.slice(0,22))t=d(e.split(",")[1]);else{if("Exif"!=e.slice(0,4))throw"'load' gots invalid file data.";t=e.slice(6)}var a={"0th":{},Exif:{},GPS:{},Interop:{},"1st":{},thumbnail:null},i=new l(t);if(null===i.tiftag)return a;"II"==i.tiftag.slice(0,2)?i.endian_mark="<":i.endian_mark=">";var n=m(i.endian_mark+"L",i.tiftag.slice(4,8))[0];a["0th"]=i.get_ifd(n,"0th");var r=a["0th"].first_ifd_pointer;if(delete a["0th"].first_ifd_pointer,34665 in a["0th"]&&(n=a["0th"][34665],a.Exif=i.get_ifd(n,"Exif")),34853 in a["0th"]&&(n=a["0th"][34853],a.GPS=i.get_ifd(n,"GPS")),40965 in a.Exif&&(n=a.Exif[40965],a.Interop=i.get_ifd(n,"Interop")),"\x00\x00\x00\x00"!=r&&(n=m(i.endian_mark+"L",r)[0],a["1st"]=i.get_ifd(n,"1st"),513 in a["1st"]&&514 in a["1st"])){var o=a["1st"][513]+a["1st"][514],s=i.tiftag.slice(a["1st"][513],o);a.thumbnail=s}return a},f.dump=function(a){var i,n,r,l,m,p=8,y=e(a),c="Exif\x00\x00MM\x00*\x00\x00\x00\b",S=!1,h=!1,d=!1,u=!1;i="0th"in y?y["0th"]:{},"Exif"in y&&Object.keys(y.Exif).length||"Interop"in y&&Object.keys(y.Interop).length?(i[34665]=1,S=!0,n=y.Exif,"Interop"in y&&Object.keys(y.Interop).length?(n[40965]=1,d=!0,r=y.Interop):Object.keys(n).indexOf(f.ExifIFD.InteroperabilityTag.toString())>-1&&delete n[40965]):Object.keys(i).indexOf(f.ImageIFD.ExifTag.toString())>-1&&delete i[34665],"GPS"in y&&Object.keys(y.GPS).length?(i[f.ImageIFD.GPSTag]=1,h=!0,l=y.GPS):Object.keys(i).indexOf(f.ImageIFD.GPSTag.toString())>-1&&delete i[f.ImageIFD.GPSTag],"1st"in y&&"thumbnail"in y&&null!=y.thumbnail&&(u=!0,y["1st"][513]=1,y["1st"][514]=1,m=y["1st"]);var P,C,R,L,x,I=o(i,"0th",0),D=I[0].length+12*S+12*h+4+I[1].length,G="",A=0,v="",b=0,T="",k=0,w="";if(S&&(P=o(n,"Exif",D),A=P[0].length+12*d+P[1].length),h&&(C=o(l,"GPS",D+A),v=C.join(""),b=v.length),d){var F=D+A+b;R=o(r,"Interop",F),T=R.join(""),k=T.length}if(u){var F=D+A+b+k;if(L=o(m,"1st",F),x=t(y.thumbnail),x.length>64e3)throw"Given thumbnail is too large. max 64kB"}var B="",E="",M="",O="\x00\x00\x00\x00";if(S){var N=p+D,U=s(">L",[N]),_=34665,H=s(">H",[_]),j=s(">H",[g.Long]),V=s(">L",[1]);B=H+j+V+U}if(h){var N=p+D+A,U=s(">L",[N]),_=34853,H=s(">H",[_]),j=s(">H",[g.Long]),V=s(">L",[1]);E=H+j+V+U}if(d){var N=p+D+A+b,U=s(">L",[N]),_=40965,H=s(">H",[_]),j=s(">H",[g.Long]),V=s(">L",[1]);M=H+j+V+U}if(u){var N=p+D+A+b+k;O=s(">L",[N]);var J=N+L[0].length+24+4+L[1].length,X="\x00\x00\x00\x00"+s(">L",[J]),z="\x00\x00\x00\x00"+s(">L",[x.length]);w=L[0]+X+z+"\x00\x00\x00\x00"+L[1]+x}var Y=I[0]+B+E+O+I[1];return S&&(G=P[0]+M+P[1]),c+Y+G+v+T+w},l.prototype={get_ifd:function(e,t){var a,i={},n=m(this.endian_mark+"H",this.tiftag.slice(e,e+2))[0],r=e+2;a=["0th","1st"].indexOf(t)>-1?"Image":t;for(var o=0;n>o;o++){e=r+12*o;var l=m(this.endian_mark+"H",this.tiftag.slice(e,e+2))[0],s=m(this.endian_mark+"H",this.tiftag.slice(e+2,e+4))[0],p=m(this.endian_mark+"L",this.tiftag.slice(e+4,e+8))[0],y=this.tiftag.slice(e+8,e+12),c=[s,p,y];l in u[a]&&(i[l]=this.convert_value(c))}return"0th"==t&&(e=r+12*n,i.first_ifd_pointer=this.tiftag.slice(e,e+4)),i},convert_value:function(e){var t,a=null,i=e[0],n=e[1],r=e[2];if(1==i)n>4?(t=m(this.endian_mark+"L",r)[0],a=m(this.endian_mark+p("B",n),this.tiftag.slice(t,t+n))):a=m(this.endian_mark+p("B",n),r.slice(0,n));else if(2==i)n>4?(t=m(this.endian_mark+"L",r)[0],a=this.tiftag.slice(t,t+n-1)):a=r.slice(0,n-1);else if(3==i)n>2?(t=m(this.endian_mark+"L",r)[0],a=m(this.endian_mark+p("H",n),this.tiftag.slice(t,t+2*n))):a=m(this.endian_mark+p("H",n),r.slice(0,2*n));else if(4==i)n>1?(t=m(this.endian_mark+"L",r)[0],a=m(this.endian_mark+p("L",n),this.tiftag.slice(t,t+4*n))):a=m(this.endian_mark+p("L",n),r);else if(5==i)if(t=m(this.endian_mark+"L",r)[0],n>1){a=[];for(var o=0;n>o;o++)a.push([m(this.endian_mark+"L",this.tiftag.slice(t+8*o,t+4+8*o))[0],m(this.endian_mark+"L",this.tiftag.slice(t+4+8*o,t+8+8*o))[0]])}else a=[m(this.endian_mark+"L",this.tiftag.slice(t,t+4))[0],m(this.endian_mark+"L",this.tiftag.slice(t+4,t+8))[0]];else if(7==i)n>4?(t=m(this.endian_mark+"L",r)[0],a=this.tiftag.slice(t,t+n)):a=r.slice(0,n);else{if(10!=i)throw"Exif might be wrong. Got incorrect value type to decode. type:"+i;if(t=m(this.endian_mark+"L",r)[0],n>1){a=[];for(var o=0;n>o;o++)a.push([m(this.endian_mark+"l",this.tiftag.slice(t+8*o,t+4+8*o))[0],m(this.endian_mark+"l",this.tiftag.slice(t+4+8*o,t+8+8*o))[0]])}else a=[m(this.endian_mark+"l",this.tiftag.slice(t,t+4))[0],m(this.endian_mark+"l",this.tiftag.slice(t+4,t+8))[0]]}return a instanceof Array&&1==a.length?a[0]:a}},"undefined"!=typeof window&&"function"==typeof window.btoa)var h=window.btoa;if("undefined"==typeof h)var h=function(e){for(var t,a,i,n,r,o,l,s="",m=0,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";m>2,r=(3&t)<<4|a>>4,o=(15&a)<<2|i>>6,l=63&i,isNaN(a)?o=l=64:isNaN(i)&&(l=64),s=s+p.charAt(n)+p.charAt(r)+p.charAt(o)+p.charAt(l);return s};if("undefined"!=typeof window&&"function"==typeof window.atob)var d=window.atob;if("undefined"==typeof d)var d=function(e){var t,a,i,n,r,o,l,s="",m=0,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");m>4,a=(15&r)<<4|o>>2,i=(3&o)<<6|l,s+=String.fromCharCode(t),64!=o&&(s+=String.fromCharCode(a)),64!=l&&(s+=String.fromCharCode(i));return s};var g={Byte:1,Ascii:2,Short:3,Long:4,Rational:5,Undefined:7,SLong:9,SRational:10},u={Image:{11:{name:"ProcessingSoftware",type:"Ascii"},254:{name:"NewSubfileType",type:"Long"},255:{name:"SubfileType",type:"Short"},256:{name:"ImageWidth",type:"Long"},257:{name:"ImageLength",type:"Long"},258:{name:"BitsPerSample",type:"Short"},259:{name:"Compression",type:"Short"},262:{name:"PhotometricInterpretation",type:"Short"},263:{name:"Threshholding",type:"Short"},264:{name:"CellWidth",type:"Short"},265:{name:"CellLength",type:"Short"},266:{name:"FillOrder",type:"Short"},269:{name:"DocumentName",type:"Ascii"},270:{name:"ImageDescription",type:"Ascii"},271:{name:"Make",type:"Ascii"},272:{name:"Model",type:"Ascii"},273:{name:"StripOffsets",type:"Long"},274:{name:"Orientation",type:"Short"},277:{name:"SamplesPerPixel",type:"Short"},278:{name:"RowsPerStrip",type:"Long"},279:{name:"StripByteCounts",type:"Long"},282:{name:"XResolution",type:"Rational"},283:{name:"YResolution",type:"Rational"},284:{name:"PlanarConfiguration",type:"Short"},290:{name:"GrayResponseUnit",type:"Short"},291:{name:"GrayResponseCurve",type:"Short"},292:{name:"T4Options",type:"Long"},293:{name:"T6Options",type:"Long"},296:{name:"ResolutionUnit",type:"Short"},301:{name:"TransferFunction",type:"Short"},305:{name:"Software",type:"Ascii"},306:{name:"DateTime",type:"Ascii"},315:{name:"Artist",type:"Ascii"},316:{name:"HostComputer",type:"Ascii"},317:{name:"Predictor",type:"Short"},318:{name:"WhitePoint",type:"Rational"},319:{name:"PrimaryChromaticities",type:"Rational"},320:{name:"ColorMap",type:"Short"},321:{name:"HalftoneHints",type:"Short"},322:{name:"TileWidth",type:"Short"},323:{name:"TileLength",type:"Short"},324:{name:"TileOffsets",type:"Short"},325:{name:"TileByteCounts",type:"Short"},330:{name:"SubIFDs",type:"Long"},332:{name:"InkSet",type:"Short"},333:{name:"InkNames",type:"Ascii"},334:{name:"NumberOfInks",type:"Short"},336:{name:"DotRange",type:"Byte"},337:{name:"TargetPrinter",type:"Ascii"},338:{name:"ExtraSamples",type:"Short"},339:{name:"SampleFormat",type:"Short"},340:{name:"SMinSampleValue",type:"Short"},341:{name:"SMaxSampleValue",type:"Short"},342:{name:"TransferRange",type:"Short"},343:{name:"ClipPath",type:"Byte"},344:{name:"XClipPathUnits",type:"Long"},345:{name:"YClipPathUnits",type:"Long"},346:{name:"Indexed",type:"Short"},347:{name:"JPEGTables",type:"Undefined"},351:{name:"OPIProxy",type:"Short"},512:{name:"JPEGProc",type:"Long"},513:{name:"JPEGInterchangeFormat",type:"Long"},514:{name:"JPEGInterchangeFormatLength",type:"Long"},515:{name:"JPEGRestartInterval",type:"Short"},517:{name:"JPEGLosslessPredictors",type:"Short"},518:{name:"JPEGPointTransforms",type:"Short"},519:{name:"JPEGQTables",type:"Long"},520:{name:"JPEGDCTables",type:"Long"},521:{name:"JPEGACTables",type:"Long"},529:{name:"YCbCrCoefficients",type:"Rational"},530:{name:"YCbCrSubSampling",type:"Short"},531:{name:"YCbCrPositioning",type:"Short"},532:{name:"ReferenceBlackWhite",type:"Rational"},700:{name:"XMLPacket",type:"Byte"},18246:{name:"Rating",type:"Short"},18249:{name:"RatingPercent",type:"Short"},32781:{name:"ImageID",type:"Ascii"},33421:{name:"CFARepeatPatternDim",type:"Short"},33422:{name:"CFAPattern",type:"Byte"},33423:{name:"BatteryLevel",type:"Rational"},33432:{name:"Copyright",type:"Ascii"},33434:{name:"ExposureTime",type:"Rational"},34377:{name:"ImageResources",type:"Byte"},34665:{name:"ExifTag",type:"Long"},34675:{name:"InterColorProfile",type:"Undefined"},34853:{name:"GPSTag",type:"Long"},34857:{name:"Interlace",type:"Short"},34858:{name:"TimeZoneOffset",type:"Long"},34859:{name:"SelfTimerMode",type:"Short"},37387:{name:"FlashEnergy",type:"Rational"},37388:{name:"SpatialFrequencyResponse",type:"Undefined"},37389:{name:"Noise",type:"Undefined"},37390:{name:"FocalPlaneXResolution",type:"Rational"},37391:{name:"FocalPlaneYResolution",type:"Rational"},37392:{name:"FocalPlaneResolutionUnit",type:"Short"},37393:{name:"ImageNumber",type:"Long"},37394:{name:"SecurityClassification",type:"Ascii"},37395:{name:"ImageHistory",type:"Ascii"},37397:{name:"ExposureIndex",type:"Rational"},37398:{name:"TIFFEPStandardID",type:"Byte"},37399:{name:"SensingMethod",type:"Short"},40091:{name:"XPTitle",type:"Byte"},40092:{name:"XPComment",type:"Byte"},40093:{name:"XPAuthor",type:"Byte"},40094:{name:"XPKeywords",type:"Byte"},40095:{name:"XPSubject",type:"Byte"},50341:{name:"PrintImageMatching",type:"Undefined"},50706:{name:"DNGVersion",type:"Byte"},50707:{name:"DNGBackwardVersion",type:"Byte"},50708:{name:"UniqueCameraModel",type:"Ascii"},50709:{name:"LocalizedCameraModel",type:"Byte"},50710:{name:"CFAPlaneColor",type:"Byte"},50711:{name:"CFALayout",type:"Short"},50712:{name:"LinearizationTable",type:"Short"},50713:{name:"BlackLevelRepeatDim",type:"Short"},50714:{name:"BlackLevel",type:"Rational"},50715:{name:"BlackLevelDeltaH",type:"SRational"},50716:{name:"BlackLevelDeltaV",type:"SRational"},50717:{name:"WhiteLevel",type:"Short"},50718:{name:"DefaultScale",type:"Rational"},50719:{name:"DefaultCropOrigin",type:"Short"},50720:{name:"DefaultCropSize",type:"Short"},50721:{name:"ColorMatrix1",type:"SRational"},50722:{name:"ColorMatrix2",type:"SRational"},50723:{name:"CameraCalibration1",type:"SRational"},50724:{name:"CameraCalibration2",type:"SRational"},50725:{name:"ReductionMatrix1",type:"SRational"},50726:{name:"ReductionMatrix2",type:"SRational"},50727:{name:"AnalogBalance",type:"Rational"},50728:{name:"AsShotNeutral",type:"Short"},50729:{name:"AsShotWhiteXY",type:"Rational"},50730:{name:"BaselineExposure",type:"SRational"},50731:{name:"BaselineNoise",type:"Rational"},50732:{name:"BaselineSharpness",type:"Rational"},50733:{name:"BayerGreenSplit",type:"Long"},50734:{name:"LinearResponseLimit",type:"Rational"},50735:{name:"CameraSerialNumber",type:"Ascii"},50736:{name:"LensInfo",type:"Rational"},50737:{name:"ChromaBlurRadius",type:"Rational"},50738:{name:"AntiAliasStrength",type:"Rational"},50739:{name:"ShadowScale",type:"SRational"},50740:{name:"DNGPrivateData",type:"Byte"},50741:{name:"MakerNoteSafety",type:"Short"},50778:{name:"CalibrationIlluminant1",type:"Short"},50779:{name:"CalibrationIlluminant2",type:"Short"},50780:{name:"BestQualityScale",type:"Rational"},50781:{name:"RawDataUniqueID",type:"Byte"},50827:{name:"OriginalRawFileName",type:"Byte"},50828:{name:"OriginalRawFileData",type:"Undefined"},50829:{name:"ActiveArea",type:"Short"},50830:{name:"MaskedAreas",type:"Short"},50831:{name:"AsShotICCProfile",type:"Undefined"},50832:{name:"AsShotPreProfileMatrix",type:"SRational"},50833:{name:"CurrentICCProfile",type:"Undefined"},50834:{name:"CurrentPreProfileMatrix",type:"SRational"},50879:{name:"ColorimetricReference",type:"Short"},50931:{name:"CameraCalibrationSignature",type:"Byte"},50932:{name:"ProfileCalibrationSignature",type:"Byte"},50934:{name:"AsShotProfileName",type:"Byte"},50935:{name:"NoiseReductionApplied",type:"Rational"},50936:{name:"ProfileName",type:"Byte"},50937:{name:"ProfileHueSatMapDims",type:"Long"},50938:{name:"ProfileHueSatMapData1",type:"Float"},50939:{name:"ProfileHueSatMapData2",type:"Float"},50940:{name:"ProfileToneCurve",type:"Float"},50941:{name:"ProfileEmbedPolicy",type:"Long"},50942:{name:"ProfileCopyright",type:"Byte"},50964:{name:"ForwardMatrix1",type:"SRational"},50965:{name:"ForwardMatrix2",type:"SRational"},50966:{name:"PreviewApplicationName",type:"Byte"},50967:{name:"PreviewApplicationVersion",type:"Byte"},50968:{name:"PreviewSettingsName",type:"Byte"},50969:{name:"PreviewSettingsDigest",type:"Byte"},50970:{name:"PreviewColorSpace",type:"Long"},50971:{name:"PreviewDateTime",type:"Ascii"},50972:{name:"RawImageDigest",type:"Undefined"},50973:{name:"OriginalRawFileDigest",type:"Undefined"},50974:{name:"SubTileBlockSize",type:"Long"},50975:{name:"RowInterleaveFactor",type:"Long"},50981:{name:"ProfileLookTableDims",type:"Long"},50982:{name:"ProfileLookTableData",type:"Float"},51008:{name:"OpcodeList1",type:"Undefined"},51009:{name:"OpcodeList2",type:"Undefined"},51022:{name:"OpcodeList3",type:"Undefined"}},Exif:{33434:{name:"ExposureTime",type:"Rational"},33437:{name:"FNumber",type:"Rational"},34850:{name:"ExposureProgram",type:"Short"},34852:{name:"SpectralSensitivity",type:"Ascii"},34855:{name:"ISOSpeedRatings",type:"Short"},34856:{name:"OECF",type:"Undefined"},34864:{name:"SensitivityType",type:"Short"},34865:{name:"StandardOutputSensitivity",type:"Long"},34866:{name:"RecommendedExposureIndex",type:"Long"},34867:{name:"ISOSpeed",type:"Long"},34868:{name:"ISOSpeedLatitudeyyy",type:"Long"},34869:{name:"ISOSpeedLatitudezzz",type:"Long"},36864:{name:"ExifVersion",type:"Undefined"},36867:{name:"DateTimeOriginal",type:"Ascii"},36868:{name:"DateTimeDigitized",type:"Ascii"},37121:{name:"ComponentsConfiguration",type:"Undefined"},37122:{name:"CompressedBitsPerPixel",type:"Rational"},37377:{name:"ShutterSpeedValue",type:"SRational"},37378:{name:"ApertureValue",type:"Rational"},37379:{name:"BrightnessValue",type:"SRational"},37380:{name:"ExposureBiasValue",type:"SRational"},37381:{name:"MaxApertureValue",type:"Rational"},37382:{name:"SubjectDistance",type:"Rational"},37383:{name:"MeteringMode",type:"Short"},37384:{name:"LightSource",type:"Short"},37385:{name:"Flash",type:"Short"},37386:{name:"FocalLength",type:"Rational"},37396:{name:"SubjectArea",type:"Short"},37500:{name:"MakerNote",type:"Undefined"},37510:{name:"UserComment",type:"Ascii"},37520:{name:"SubSecTime",type:"Ascii"},37521:{name:"SubSecTimeOriginal",type:"Ascii"},37522:{name:"SubSecTimeDigitized",type:"Ascii"},40960:{name:"FlashpixVersion",type:"Undefined"},40961:{name:"ColorSpace",type:"Short"},40962:{name:"PixelXDimension",type:"Long"},40963:{name:"PixelYDimension",type:"Long"},40964:{name:"RelatedSoundFile",type:"Ascii"},40965:{name:"InteroperabilityTag",type:"Long"},41483:{name:"FlashEnergy",type:"Rational"},41484:{name:"SpatialFrequencyResponse",type:"Undefined"},41486:{name:"FocalPlaneXResolution",type:"Rational"},41487:{name:"FocalPlaneYResolution",type:"Rational"},41488:{name:"FocalPlaneResolutionUnit",type:"Short"},41492:{name:"SubjectLocation",type:"Short"},41493:{name:"ExposureIndex",type:"Rational"},41495:{name:"SensingMethod",type:"Short"},41728:{name:"FileSource",type:"Undefined"},41729:{name:"SceneType",type:"Undefined"},41730:{name:"CFAPattern",type:"Undefined"},41985:{name:"CustomRendered",type:"Short"},41986:{name:"ExposureMode",type:"Short"},41987:{name:"WhiteBalance",type:"Short"},41988:{name:"DigitalZoomRatio",type:"Rational"},41989:{name:"FocalLengthIn35mmFilm",type:"Short"},41990:{name:"SceneCaptureType",type:"Short"},41991:{name:"GainControl",type:"Short"},41992:{name:"Contrast",type:"Short"},41993:{name:"Saturation",type:"Short"},41994:{name:"Sharpness",type:"Short"},41995:{name:"DeviceSettingDescription",type:"Undefined"},41996:{name:"SubjectDistanceRange",type:"Short"},42016:{name:"ImageUniqueID",type:"Ascii"},42032:{name:"CameraOwnerName",type:"Ascii"},42033:{name:"BodySerialNumber",type:"Ascii"},42034:{name:"LensSpecification",type:"Rational"},42035:{name:"LensMake",type:"Ascii"},42036:{name:"LensModel",type:"Ascii"},42037:{name:"LensSerialNumber",type:"Ascii"},42240:{name:"Gamma",type:"Rational"}},GPS:{0:{name:"GPSVersionID",type:"Byte"},1:{name:"GPSLatitudeRef",type:"Ascii"},2:{name:"GPSLatitude",type:"Rational"},3:{name:"GPSLongitudeRef",type:"Ascii"},4:{name:"GPSLongitude",type:"Rational"},5:{name:"GPSAltitudeRef",type:"Byte"},6:{name:"GPSAltitude",type:"Rational"},7:{name:"GPSTimeStamp",type:"Rational"},8:{name:"GPSSatellites",type:"Ascii"},9:{name:"GPSStatus",type:"Ascii"},10:{name:"GPSMeasureMode",type:"Ascii"},11:{name:"GPSDOP",type:"Rational"},12:{name:"GPSSpeedRef",type:"Ascii"},13:{name:"GPSSpeed",type:"Rational"},14:{name:"GPSTrackRef",type:"Ascii"},15:{name:"GPSTrack",type:"Rational"},16:{name:"GPSImgDirectionRef",type:"Ascii"},17:{name:"GPSImgDirection",type:"Rational"},18:{name:"GPSMapDatum",type:"Ascii"},19:{name:"GPSDestLatitudeRef",type:"Ascii"},20:{name:"GPSDestLatitude",type:"Rational"},21:{name:"GPSDestLongitudeRef",type:"Ascii"},22:{name:"GPSDestLongitude",type:"Rational"},23:{name:"GPSDestBearingRef",type:"Ascii"},24:{name:"GPSDestBearing",type:"Rational"},25:{name:"GPSDestDistanceRef",type:"Ascii"},26:{name:"GPSDestDistance",type:"Rational"},27:{name:"GPSProcessingMethod",type:"Undefined"},28:{name:"GPSAreaInformation",type:"Undefined"},29:{name:"GPSDateStamp",type:"Ascii"},30:{name:"GPSDifferential",type:"Short"},31:{name:"GPSHPositioningError",type:"Rational"}},Interop:{1:{name:"InteroperabilityIndex",type:"Ascii"}}};u["0th"]=u.Image,u["1st"]=u.Image,f.TAGS=u,f.ImageIFD={ProcessingSoftware:11,NewSubfileType:254,SubfileType:255,ImageWidth:256,ImageLength:257,BitsPerSample:258,Compression:259,PhotometricInterpretation:262,Threshholding:263,CellWidth:264,CellLength:265,FillOrder:266,DocumentName:269,ImageDescription:270,Make:271,Model:272,StripOffsets:273,Orientation:274,SamplesPerPixel:277,RowsPerStrip:278,StripByteCounts:279,XResolution:282,YResolution:283,PlanarConfiguration:284,GrayResponseUnit:290,GrayResponseCurve:291,T4Options:292,T6Options:293,ResolutionUnit:296,TransferFunction:301,Software:305,DateTime:306,Artist:315,HostComputer:316,Predictor:317,WhitePoint:318,PrimaryChromaticities:319,ColorMap:320,HalftoneHints:321,TileWidth:322,TileLength:323,TileOffsets:324,TileByteCounts:325,SubIFDs:330,InkSet:332,InkNames:333,NumberOfInks:334,DotRange:336,TargetPrinter:337,ExtraSamples:338,SampleFormat:339,SMinSampleValue:340,SMaxSampleValue:341,TransferRange:342,ClipPath:343,XClipPathUnits:344,YClipPathUnits:345,Indexed:346,JPEGTables:347,OPIProxy:351,JPEGProc:512,JPEGInterchangeFormat:513,JPEGInterchangeFormatLength:514,JPEGRestartInterval:515,JPEGLosslessPredictors:517,JPEGPointTransforms:518,JPEGQTables:519,JPEGDCTables:520,JPEGACTables:521,YCbCrCoefficients:529,YCbCrSubSampling:530,YCbCrPositioning:531,ReferenceBlackWhite:532,XMLPacket:700,Rating:18246,RatingPercent:18249,ImageID:32781,CFARepeatPatternDim:33421,CFAPattern:33422,BatteryLevel:33423,Copyright:33432,ExposureTime:33434,ImageResources:34377,ExifTag:34665,InterColorProfile:34675,GPSTag:34853,Interlace:34857,TimeZoneOffset:34858,SelfTimerMode:34859,FlashEnergy:37387,SpatialFrequencyResponse:37388,Noise:37389,FocalPlaneXResolution:37390,FocalPlaneYResolution:37391,FocalPlaneResolutionUnit:37392,ImageNumber:37393,SecurityClassification:37394,ImageHistory:37395,ExposureIndex:37397,TIFFEPStandardID:37398,SensingMethod:37399,XPTitle:40091,XPComment:40092,XPAuthor:40093,XPKeywords:40094,XPSubject:40095,PrintImageMatching:50341,DNGVersion:50706,DNGBackwardVersion:50707,UniqueCameraModel:50708,LocalizedCameraModel:50709,CFAPlaneColor:50710,CFALayout:50711,LinearizationTable:50712,BlackLevelRepeatDim:50713,BlackLevel:50714,BlackLevelDeltaH:50715,BlackLevelDeltaV:50716,WhiteLevel:50717,DefaultScale:50718,DefaultCropOrigin:50719,DefaultCropSize:50720,ColorMatrix1:50721,ColorMatrix2:50722,CameraCalibration1:50723,CameraCalibration2:50724,ReductionMatrix1:50725,ReductionMatrix2:50726,AnalogBalance:50727,AsShotNeutral:50728,AsShotWhiteXY:50729,BaselineExposure:50730,BaselineNoise:50731,BaselineSharpness:50732,BayerGreenSplit:50733,LinearResponseLimit:50734,CameraSerialNumber:50735,LensInfo:50736,ChromaBlurRadius:50737,AntiAliasStrength:50738,ShadowScale:50739,DNGPrivateData:50740,MakerNoteSafety:50741,CalibrationIlluminant1:50778,CalibrationIlluminant2:50779,BestQualityScale:50780,RawDataUniqueID:50781,OriginalRawFileName:50827,OriginalRawFileData:50828,ActiveArea:50829,MaskedAreas:50830,AsShotICCProfile:50831,AsShotPreProfileMatrix:50832,CurrentICCProfile:50833,CurrentPreProfileMatrix:50834,ColorimetricReference:50879,CameraCalibrationSignature:50931,ProfileCalibrationSignature:50932,AsShotProfileName:50934,NoiseReductionApplied:50935,ProfileName:50936,ProfileHueSatMapDims:50937,ProfileHueSatMapData1:50938,ProfileHueSatMapData2:50939,ProfileToneCurve:50940,ProfileEmbedPolicy:50941,ProfileCopyright:50942,ForwardMatrix1:50964,ForwardMatrix2:50965,PreviewApplicationName:50966,PreviewApplicationVersion:50967,PreviewSettingsName:50968,PreviewSettingsDigest:50969,PreviewColorSpace:50970,PreviewDateTime:50971,RawImageDigest:50972,OriginalRawFileDigest:50973,SubTileBlockSize:50974,RowInterleaveFactor:50975,ProfileLookTableDims:50981,ProfileLookTableData:50982,OpcodeList1:51008,OpcodeList2:51009,OpcodeList3:51022,NoiseProfile:51041},f.ExifIFD={ExposureTime:33434,FNumber:33437,ExposureProgram:34850,SpectralSensitivity:34852,ISOSpeedRatings:34855,OECF:34856,SensitivityType:34864,StandardOutputSensitivity:34865,RecommendedExposureIndex:34866,ISOSpeed:34867,ISOSpeedLatitudeyyy:34868,ISOSpeedLatitudezzz:34869,ExifVersion:36864,DateTimeOriginal:36867,DateTimeDigitized:36868,ComponentsConfiguration:37121,CompressedBitsPerPixel:37122,ShutterSpeedValue:37377,ApertureValue:37378,BrightnessValue:37379,ExposureBiasValue:37380,MaxApertureValue:37381,SubjectDistance:37382,MeteringMode:37383,LightSource:37384,Flash:37385,FocalLength:37386,SubjectArea:37396,MakerNote:37500,UserComment:37510,SubSecTime:37520,SubSecTimeOriginal:37521,SubSecTimeDigitized:37522,FlashpixVersion:40960,ColorSpace:40961,PixelXDimension:40962,PixelYDimension:40963,RelatedSoundFile:40964,InteroperabilityTag:40965,FlashEnergy:41483,SpatialFrequencyResponse:41484,FocalPlaneXResolution:41486,FocalPlaneYResolution:41487,FocalPlaneResolutionUnit:41488,SubjectLocation:41492,ExposureIndex:41493,SensingMethod:41495,FileSource:41728,SceneType:41729,CFAPattern:41730,CustomRendered:41985,ExposureMode:41986,WhiteBalance:41987,DigitalZoomRatio:41988,FocalLengthIn35mmFilm:41989,SceneCaptureType:41990,GainControl:41991,Contrast:41992,Saturation:41993,Sharpness:41994,DeviceSettingDescription:41995,SubjectDistanceRange:41996,ImageUniqueID:42016,CameraOwnerName:42032,BodySerialNumber:42033,LensSpecification:42034,LensMake:42035,LensModel:42036,LensSerialNumber:42037,Gamma:42240},f.GPSIFD={GPSVersionID:0,GPSLatitudeRef:1,GPSLatitude:2,GPSLongitudeRef:3,GPSLongitude:4,GPSAltitudeRef:5,GPSAltitude:6,GPSTimeStamp:7,GPSSatellites:8,GPSStatus:9,GPSMeasureMode:10,GPSDOP:11,GPSSpeedRef:12,GPSSpeed:13,GPSTrackRef:14,GPSTrack:15,GPSImgDirectionRef:16,GPSImgDirection:17,GPSMapDatum:18,GPSDestLatitudeRef:19,GPSDestLatitude:20,GPSDestLongitudeRef:21,GPSDestLongitude:22,GPSDestBearingRef:23,GPSDestBearing:24,GPSDestDistanceRef:25,GPSDestDistance:26,GPSProcessingMethod:27,GPSAreaInformation:28,GPSDateStamp:29,GPSDifferential:30,GPSHPositioningError:31},f.InteropIFD={InteroperabilityIndex:1},f.GPSHelper={degToDmsRational:function(e){var t=e%1*60,a=t%1*60,i=Math.floor(e),n=Math.floor(t),r=Math.round(100*a);return[[i,1],[n,1],[r,100]]}},"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=f),exports.piexif=f):window.piexif=f}(); /*! * bootstrap-fileinput v5.1.3 diff --git a/docassemble_webapp/docassemble/webapp/static/app/bundlenojquery.js b/docassemble_webapp/docassemble/webapp/static/app/bundlenojquery.js index 9138679df..c3c5fe72a 100644 --- a/docassemble_webapp/docassemble/webapp/static/app/bundlenojquery.js +++ b/docassemble_webapp/docassemble/webapp/static/app/bundlenojquery.js @@ -342,7 +342,7 @@ if(typeof $=="undefined")var $=jQuery.noConflict(),daCtx,daColor,daTheWidth,daAs * @author: Francisco Neves (@fntneves) * @site: www.francisconeves.com * @license: MIT License - */(function(e){e.fn.labelauty=function(t){function a(){PPP}var i=e.extend({development:!1,class:"labelauty",icon:!0,label:!0,separator:"|",checked_label:"Checked",unchecked_label:"Unchecked",force_random_id:!1,minimum_width:!1,same_width:!1},t);return this.each(function(){var a,r,c,l,d,h,m,f,p,g,v,b,t=e(this),w=t.is(":checked"),y=t.attr("type"),j=!0,u=!0,_=t.attr("aria-label");if(t.attr("aria-hidden",!0),t.is(":checkbox")===!1&&t.is(":radio")===!1)return this;if(p=t.attr("class").split(/\s+/).filter(function(e){return e!="da-to-labelauty"}),t.addClass(i.class),h=t.attr("data-labelauty"),c=t.attr("data-color"),u=i.label,j=i.icon,u===!0&&(h==null||h.length===0?l=[i.unchecked_label,i.checked_label]:(l=h.split(i.separator),l.length>2?(u=!1,n(i.development,"There's more than two labels. LABELAUTY will not use labels.")):l.length===1&&n(i.development,"There's just one label. LABELAUTY will use this one for both cases."))),t.css({display:"none"}),t.removeAttr("data-labelauty"),r=t.attr("id"),i.force_random_id||r==null||r.trim()===""){for(m=1+Math.floor(Math.random()*1024e3),r="labelauty-"+m;e(r).length!==0;)m++,r="labelauty-"+m,n(i.development,"Holy crap, between 1024 thousand numbers, one raised a conflict. Trying again.");t.attr("id",r)}for(a=jQuery(o(r,_,w,y,l,u,j)),f=0;fb?d.find("span.labelauty-checked").width(v):d.find("span.labelauty-unchecked").width(b))})};function s(e){var n=0,t=e,s="hidden_element",t=t.clone().attr("class",s).appendTo("body"),n=t.width(!0);return t.remove(),n}function n(e,t){e&&window.console&&window.console.log&&window.console.log("jQuery-LABELAUTY: "+t)}function t(e){return e=e.replace(/&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/"/g,'"'),e}function o(e,n,s,o,i,a,r){var c,l,u,h,m,d="";return i==null?c=l="":(c=i[0],i[1]==null?l=c:l=i[1]),o=="checkbox"?h='':h='',o=="checkbox"?m='':m='',n==null?d="":d='tabindex="0" role="'+o+'" aria-checked="'+s+'" aria-label="'+n+'"',a==!0&&r==!0?u='":a==!0?u='":u='",u}})(window.jQuery) + */(function(e){e.fn.labelauty=function(t){function a(){PPP}var i=e.extend({development:!1,class:"labelauty",icon:!0,label:!0,separator:"|",checked_label:"Checked",unchecked_label:"Unchecked",force_random_id:!1,minimum_width:!1,same_width:!1},t);return this.each(function(){var a,r,c,l,d,h,m,f,p,g,v,b,t=e(this),w=t.is(":checked"),y=t.attr("type"),j=!0,u=!0,_=t.attr("aria-label");if(t.attr("aria-hidden",!0),t.is(":checkbox")===!1&&t.is(":radio")===!1)return this;if(p=t.attr("class").split(/\s+/).filter(function(e){return e!="da-to-labelauty"}),t.addClass(i.class),h=t.attr("data-labelauty"),c=t.attr("data-color"),u=i.label,j=i.icon,u===!0&&(h==null||h.length===0?l=[i.unchecked_label,i.checked_label]:(l=h.split(i.separator),l.length>2?(u=!1,n(i.development,"There's more than two labels. LABELAUTY will not use labels.")):l.length===1&&n(i.development,"There's just one label. LABELAUTY will use this one for both cases."))),t.css({display:"none"}),t.removeAttr("data-labelauty"),r=t.attr("id"),i.force_random_id||r==null||r.trim()===""){for(m=1+Math.floor(Math.random()*1024e3),r="labelauty-"+m;e(r).length!==0;)m++,r="labelauty-"+m,n(i.development,"Holy crap, between 1024 thousand numbers, one raised a conflict. Trying again.");t.attr("id",r)}for(a=jQuery(o(r,_,w,y,l,u,j)),f=0;fb?d.find("span.labelauty-checked").width(v):d.find("span.labelauty-unchecked").width(b))})};function s(e){var n=0,t=e,s="hidden_element",t=t.clone().attr("class",s).appendTo("body"),n=t.width(!0);return t.remove(),n}function n(e,t){e&&window.console&&window.console.log&&window.console.log("jQuery-LABELAUTY: "+t)}function t(e){return e=e.replace(/&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/"/g,'"'),e}function o(e,n,s,o,i,a,r){var c,l,u,h,m,d="";return i==null?c=l="":(c=i[0],i[1]==null?l=c:l=i[1]),o=="checkbox"?h='':h='',o=="checkbox"?m='':m='',n==null?d="":d='tabindex="0" role="'+o+'" aria-checked="'+s+'" aria-label="'+n+'"',a==!0&&r==!0?u='":a==!0?u='":u='",u}})(window.jQuery) (function(e){"use strict";var t=function(t,n){this.options=e.extend({},e.fn.combobox.defaults,n),this.template=this.options.template||this.template,this.$source=e(t),this.$container=this.setup(),this.$element=this.$container.find("input[type=text]"),this.$target=this.$container.find("input[type=hidden]"),this.mousedover=!1,this.$source.attr("disabled")!==void 0&&this.$target.prop("disabled",!0),this.$button=this.$container.find(".dacomboboxtoggle"),this.$menu=e(this.options.menu).insertAfter(this.$element),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.clearIfNoMatch=this.options.clearIfNoMatch,this.shown=!1,this.selected=!1,this.refresh(),this.transferAttributes(),this.listen()};t.prototype={constructor:t,setup:function(){var t=e(this.template());return this.$source.before(t),this.$source.hide(),t},template:function(){return this.options.bsVersion=="2"?'

':'
'},disable:function(){console.log("disable"),this.$element.prop("disabled",!0),this.$button.attr("disabled",!0),this.$target.prop("disabled",!0),this.$source.prop("disabled",!0),this.disabled=!0,this.$container.addClass("combobox-disabled")},enable:function(){console.log("enable"),this.$element.prop("disabled",!1),this.$button.attr("disabled",!1),this.$target.prop("disabled",!1),this.$source.prop("disabled",!1),this.disabled=!1,this.$container.removeClass("combobox-disabled")},parse:function(){var n,o,i,l=this,a={},r={},c=[],t=!1,s="";return this.$source.find("option").each(function(){var n=e(this);if(n.val()===""){l.options.placeholder=n.text();return}a[n.text()]=n.val(),r[n.val()]=n.text(),c.push(n.text()),n.prop("selected")&&(t=n.text(),s=n.val())}),this.map=a,this.revMap=r,t?(o=!1,i=!1,n=this.$element.val(),n!==t&&(this.$element.val(t),o=!0),n=this.$target.val(),n!==s&&(this.$target.val(s),i=!0),this.$container.addClass("combobox-selected"),this.selected=!0,i&&this.$target.trigger("change"),o&&this.$element.trigger("change")):(this.$container.removeClass("combobox-selected"),this.selected=!1),c},transferAttributes:function(){if(this.options.placeholder=this.$source.attr("data-placeholder")||this.options.placeholder,this.options.appendId!=="undefined"&&(this.$element.attr("id",this.$source.attr("id")),this.$source.attr("id",this.$source.attr("id")+this.options.appendId),daComboBoxes[this.$element.attr("id")]=this),this.$menu.attr("id",this.$element.attr("id")+"menu"),this.$element.attr("aria-controls",this.$menu.attr("id")),this.$element.attr("aria-owns",this.$menu.attr("id")),this.$button.attr("aria-controls",this.$menu.attr("id")),this.$button.attr("aria-label",this.$source.attr("aria-label")),this.$source.attr("aria-labelledby")?this.$element.attr("aria-labelledby",this.$source.attr("aria-labelledby")):this.$source.attr("aria-labelledby","daMainQuestion"),this.$button.attr("aria-labelledby",this.$source.attr("aria-labelledby")),this.$button.attr("aria-describedby",this.$source.attr("aria-describedby")),this.$element.attr("placeholder",this.options.placeholder),this.$target.prop("name",this.$source.prop("name")),this.$target.val(this.$source.val()),this.$source.removeAttr("name"),this.$element.attr("required",this.$source.attr("required")),this.$element.attr("rel",this.$source.attr("rel")),this.$element.attr("title",this.$source.attr("title")),this.$element.attr("class",this.$source.attr("class")),this.$element.attr("tabindex",this.$source.attr("tabindex")),this.$source.removeAttr("tabindex"),!this.$target.val()&&this.$source.data("default")){var e=this.$source.data("default");this.$element.val(e),this.$target.val(e)}this.$source.attr("disabled")!==void 0&&this.disable()},select:function(){var e,n,t=this.$menu.find(".active").attr("data-value"),s=!1,o=!1,i=!1;this.$container.parent().find(".da-has-error").remove(),e=this.$element.val(),n=this.updater(t),e!==n&&(this.$element.val(n),s=!0),e=this.$target.val(),e!==this.map[t]&&(this.$target.val(this.map[t]),o=!0),e=this.$source.val(),e!==this.map[t]&&(this.$source.val(this.map[t]),i=!0),this.$container.addClass("combobox-selected"),this.selected=!0,this.hide(),o&&this.$target.trigger("change"),s&&this.$element.trigger("change"),i&&this.$source.trigger("change")},manualSelect:function(e){var t,n=!1,s=!1,o=!1;this.$container.parent().find(".da-has-error").remove(),e!==""&&this.revMap[e]!==void 0?(this.$element.val(this.revMap[e]),n=!0):this.$element.val(e),t=this.$target.val(),t!==e&&(this.$target.val(e),o=!0),t=this.$source.val(),t!==e&&(this.$source.val(e),s=!0),e!==""&&n&&(this.$container.addClass("combobox-selected"),this.selected=!0),o&&this.$target.trigger("change"),this.$element.trigger("change"),s&&this.$source.trigger("change")},updater:function(e){return e},show:function(){var t=e.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),this.hidden=!1,this.$element.attr("aria-expanded",!0),this.$button.attr("aria-expanded",!0),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.hidden=!0,this.$element.on("blur",e.proxy(this.blur,this)),this.$element.attr("aria-expanded",!1),this.$button.attr("aria-expanded",!1),this.shown=!1,this},lookup:function(){this.query=this.$element.val(),this.process(this.source)},process:function(t){var n=this;return t=e.grep(t,function(e){return n.matcher(e)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(e){return~e.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){for(var t,n=[],s=[],o=[];t=e.shift();)t.toLowerCase().indexOf(this.query.toLowerCase())?~t.indexOf(this.query)?s.push(t):o.push(t):n.push(t);return n.concat(s,o)},highlighter:function(e){var t=this.query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");return t?e.replace(new RegExp("("+t+")","ig"),function(e,t){return""+t+""}):e},render:function(t){var n=this;return t=e(t).map(function(t,s){return t=e(n.options.item).attr("data-value",s).attr("aria-label",s),t.attr("id",n.$element.attr("id")+"-option-"+s),t.html(n.highlighter(s)),t[0]}),this.setActive(t.first()),this.$menu.html(t),this},setActive:function(e){e.addClass("active").attr("aria-selected",!0),this.$element.attr("aria-activedescendant",e.attr("id"))},swapActive:function(e,t){e.removeClass("active").attr("aria-selected",!1),this.setActive(t)},next:function(){var s=this.$menu.find('[aria-selected="true"]'),n=s.next();n.length||(n=e(this.$menu.find("li")[0])),this.swapActive(s,n)},prev:function(){var n=this.$menu.find('[aria-selected="true"]'),t=n.prev();t.length||(t=this.$menu.find("li").last()),this.swapActive(n,t)},toggle:function(e){return this.disabled||(this.$container.hasClass("combobox-selected")?(this.clearAll(),this.$element.attr("aria-expanded",!1),this.$button.attr("aria-expanded",!1)):this.shown?(this.$element.attr("aria-expanded",!1),this.$button.attr("aria-expanded",!1),this.hide()):(this.$element.attr("aria-expanded",!0),this.$button.attr("aria-expanded",!0),this.clearElement(),this.lookup())),e&&(e.preventDefault(),e.stopPropagation()),!1},clearAll:function(){var t=!1,n=!1,s=!1,e=this.$element.val();e!==""&&(this.$element.val(""),t=!0),e=this.$source.val(),e!==""&&(this.$source.val(""),n=!0),e=this.$target.val(),e!==""&&(this.$target.val(""),s=!0),this.$container.removeClass("combobox-selected"),s&&this.$target.trigger("change"),t&&this.$element.trigger("change"),n&&this.$source.trigger("change")},clearElement:function(){this.$element.val("").focus()},clearTarget:function(){this.$source.val(""),this.$target.val(""),this.$container.removeClass("combobox-selected"),this.selected=!1},refresh:function(){this.source=this.parse(),this.options.items=this.source.length},listen:function(){this.$element.on("focus",e.proxy(this.focus,this)).on("change",e.proxy(this.change,this)).on("blur",e.proxy(this.blur,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",e.proxy(this.keydown,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this)).on("mouseleave","li",e.proxy(this.mouseleave,this)).on("mousedown","li",e.proxy(this.mousedown,this)),this.$button.on("click touchend",e.proxy(this.toggle,this))},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t=typeof this.$element[e]=="function"),t},move:function(e){if(!this.shown)return;switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),this.prev(),this.fixMenuScroll();break;case 40:e.preventDefault(),this.next(),this.fixMenuScroll();break}e.stopPropagation()},fixMenuScroll:function(){var t,n,s,o,e=this.$menu.find(".active");e.length&&(this.$element.attr("aria-activedescendant",e.attr("id")),t=e.position().top,n=t+e.height(),s=this.$menu.scrollTop(),o=this.$menu.height(),n>o?this.$menu.scrollTop(s+n-o):t<0&&this.$menu.scrollTop(s+t))},setActiveDescendant:function(t){this.mousedover&&this.swapActive(this.$menu.find(".active"),e(t.currentTarget))},keydown:function(t){this.suppressKeyPressRepeat=~e.inArray(t.keyCode,[40,38,9,13,27]),this.move(t)},keypress:function(e){if(this.suppressKeyPressRepeat)return;this.move(e)},keyup:function(t){switch(t.keyCode){case 40:this.shown||this.toggle();break;case 39:case 38:case 37:case 36:case 35:case 16:case 17:case 18:break;case 9:case 13:if(t&&(t.stopPropagation(),t.preventDefault()),daFetchAjaxTimeoutFetchAfter=!1,daFetchAcceptIncoming=!1,!this.shown)return;if(this.selected){for(var i=this.$element.val(),s=this.$menu.find("li"),o=s.length,n=0;n',item:'',appendId:"combobox",buttonLabel:"dropdown",clearIfNoMatch:!1},e.fn.combobox.Constructor=t})(window.jQuery) /*! * Socket.IO v4.5.4 diff --git a/docassemble_webapp/docassemble/webapp/static/app/bundlewrapjquery.js b/docassemble_webapp/docassemble/webapp/static/app/bundlewrapjquery.js index 78ccbb9fa..76a960a52 100644 --- a/docassemble_webapp/docassemble/webapp/static/app/bundlewrapjquery.js +++ b/docassemble_webapp/docassemble/webapp/static/app/bundlewrapjquery.js @@ -428,7 +428,7 @@ if(typeof $=="undefined")var $=jQuery.noConflict(),daCtx,daColor,daTheWidth,daAs * @author: Francisco Neves (@fntneves) * @site: www.francisconeves.com * @license: MIT License - */(function(e){e.fn.labelauty=function(t){function a(){PPP}var i=e.extend({development:!1,class:"labelauty",icon:!0,label:!0,separator:"|",checked_label:"Checked",unchecked_label:"Unchecked",force_random_id:!1,minimum_width:!1,same_width:!1},t);return this.each(function(){var a,r,c,l,d,h,m,f,p,g,v,b,t=e(this),w=t.is(":checked"),y=t.attr("type"),j=!0,u=!0,_=t.attr("aria-label");if(t.attr("aria-hidden",!0),t.is(":checkbox")===!1&&t.is(":radio")===!1)return this;if(p=t.attr("class").split(/\s+/).filter(function(e){return e!="da-to-labelauty"}),t.addClass(i.class),h=t.attr("data-labelauty"),c=t.attr("data-color"),u=i.label,j=i.icon,u===!0&&(h==null||h.length===0?l=[i.unchecked_label,i.checked_label]:(l=h.split(i.separator),l.length>2?(u=!1,n(i.development,"There's more than two labels. LABELAUTY will not use labels.")):l.length===1&&n(i.development,"There's just one label. LABELAUTY will use this one for both cases."))),t.css({display:"none"}),t.removeAttr("data-labelauty"),r=t.attr("id"),i.force_random_id||r==null||r.trim()===""){for(m=1+Math.floor(Math.random()*1024e3),r="labelauty-"+m;e(r).length!==0;)m++,r="labelauty-"+m,n(i.development,"Holy crap, between 1024 thousand numbers, one raised a conflict. Trying again.");t.attr("id",r)}for(a=jQuery(o(r,_,w,y,l,u,j)),f=0;fb?d.find("span.labelauty-checked").width(v):d.find("span.labelauty-unchecked").width(b))})};function s(e){var n=0,t=e,s="hidden_element",t=t.clone().attr("class",s).appendTo("body"),n=t.width(!0);return t.remove(),n}function n(e,t){e&&window.console&&window.console.log&&window.console.log("jQuery-LABELAUTY: "+t)}function t(e){return e=e.replace(/&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/"/g,'"'),e}function o(e,n,s,o,i,a,r){var c,l,u,h,m,d="";return i==null?c=l="":(c=i[0],i[1]==null?l=c:l=i[1]),o=="checkbox"?h='':h='',o=="checkbox"?m='':m='',n==null?d="":d='tabindex="0" role="'+o+'" aria-checked="'+s+'" aria-label="'+n+'"',a==!0&&r==!0?u='":a==!0?u='":u='",u}})(window.jQuery) + */(function(e){e.fn.labelauty=function(t){function a(){PPP}var i=e.extend({development:!1,class:"labelauty",icon:!0,label:!0,separator:"|",checked_label:"Checked",unchecked_label:"Unchecked",force_random_id:!1,minimum_width:!1,same_width:!1},t);return this.each(function(){var a,r,c,l,d,h,m,f,p,g,v,b,t=e(this),w=t.is(":checked"),y=t.attr("type"),j=!0,u=!0,_=t.attr("aria-label");if(t.attr("aria-hidden",!0),t.is(":checkbox")===!1&&t.is(":radio")===!1)return this;if(p=t.attr("class").split(/\s+/).filter(function(e){return e!="da-to-labelauty"}),t.addClass(i.class),h=t.attr("data-labelauty"),c=t.attr("data-color"),u=i.label,j=i.icon,u===!0&&(h==null||h.length===0?l=[i.unchecked_label,i.checked_label]:(l=h.split(i.separator),l.length>2?(u=!1,n(i.development,"There's more than two labels. LABELAUTY will not use labels.")):l.length===1&&n(i.development,"There's just one label. LABELAUTY will use this one for both cases."))),t.css({display:"none"}),t.removeAttr("data-labelauty"),r=t.attr("id"),i.force_random_id||r==null||r.trim()===""){for(m=1+Math.floor(Math.random()*1024e3),r="labelauty-"+m;e(r).length!==0;)m++,r="labelauty-"+m,n(i.development,"Holy crap, between 1024 thousand numbers, one raised a conflict. Trying again.");t.attr("id",r)}for(a=jQuery(o(r,_,w,y,l,u,j)),f=0;fb?d.find("span.labelauty-checked").width(v):d.find("span.labelauty-unchecked").width(b))})};function s(e){var n=0,t=e,s="hidden_element",t=t.clone().attr("class",s).appendTo("body"),n=t.width(!0);return t.remove(),n}function n(e,t){e&&window.console&&window.console.log&&window.console.log("jQuery-LABELAUTY: "+t)}function t(e){return e=e.replace(/&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/"/g,'"'),e}function o(e,n,s,o,i,a,r){var c,l,u,h,m,d="";return i==null?c=l="":(c=i[0],i[1]==null?l=c:l=i[1]),o=="checkbox"?h='':h='',o=="checkbox"?m='':m='',n==null?d="":d='tabindex="0" role="'+o+'" aria-checked="'+s+'" aria-label="'+n+'"',a==!0&&r==!0?u='":a==!0?u='":u='",u}})(window.jQuery) (function(e){"use strict";var t=function(t,n){this.options=e.extend({},e.fn.combobox.defaults,n),this.template=this.options.template||this.template,this.$source=e(t),this.$container=this.setup(),this.$element=this.$container.find("input[type=text]"),this.$target=this.$container.find("input[type=hidden]"),this.mousedover=!1,this.$source.attr("disabled")!==void 0&&this.$target.prop("disabled",!0),this.$button=this.$container.find(".dacomboboxtoggle"),this.$menu=e(this.options.menu).insertAfter(this.$element),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.clearIfNoMatch=this.options.clearIfNoMatch,this.shown=!1,this.selected=!1,this.refresh(),this.transferAttributes(),this.listen()};t.prototype={constructor:t,setup:function(){var t=e(this.template());return this.$source.before(t),this.$source.hide(),t},template:function(){return this.options.bsVersion=="2"?'
':'
'},disable:function(){console.log("disable"),this.$element.prop("disabled",!0),this.$button.attr("disabled",!0),this.$target.prop("disabled",!0),this.$source.prop("disabled",!0),this.disabled=!0,this.$container.addClass("combobox-disabled")},enable:function(){console.log("enable"),this.$element.prop("disabled",!1),this.$button.attr("disabled",!1),this.$target.prop("disabled",!1),this.$source.prop("disabled",!1),this.disabled=!1,this.$container.removeClass("combobox-disabled")},parse:function(){var n,o,i,l=this,a={},r={},c=[],t=!1,s="";return this.$source.find("option").each(function(){var n=e(this);if(n.val()===""){l.options.placeholder=n.text();return}a[n.text()]=n.val(),r[n.val()]=n.text(),c.push(n.text()),n.prop("selected")&&(t=n.text(),s=n.val())}),this.map=a,this.revMap=r,t?(o=!1,i=!1,n=this.$element.val(),n!==t&&(this.$element.val(t),o=!0),n=this.$target.val(),n!==s&&(this.$target.val(s),i=!0),this.$container.addClass("combobox-selected"),this.selected=!0,i&&this.$target.trigger("change"),o&&this.$element.trigger("change")):(this.$container.removeClass("combobox-selected"),this.selected=!1),c},transferAttributes:function(){if(this.options.placeholder=this.$source.attr("data-placeholder")||this.options.placeholder,this.options.appendId!=="undefined"&&(this.$element.attr("id",this.$source.attr("id")),this.$source.attr("id",this.$source.attr("id")+this.options.appendId),daComboBoxes[this.$element.attr("id")]=this),this.$menu.attr("id",this.$element.attr("id")+"menu"),this.$element.attr("aria-controls",this.$menu.attr("id")),this.$element.attr("aria-owns",this.$menu.attr("id")),this.$button.attr("aria-controls",this.$menu.attr("id")),this.$button.attr("aria-label",this.$source.attr("aria-label")),this.$source.attr("aria-labelledby")?this.$element.attr("aria-labelledby",this.$source.attr("aria-labelledby")):this.$source.attr("aria-labelledby","daMainQuestion"),this.$button.attr("aria-labelledby",this.$source.attr("aria-labelledby")),this.$button.attr("aria-describedby",this.$source.attr("aria-describedby")),this.$element.attr("placeholder",this.options.placeholder),this.$target.prop("name",this.$source.prop("name")),this.$target.val(this.$source.val()),this.$source.removeAttr("name"),this.$element.attr("required",this.$source.attr("required")),this.$element.attr("rel",this.$source.attr("rel")),this.$element.attr("title",this.$source.attr("title")),this.$element.attr("class",this.$source.attr("class")),this.$element.attr("tabindex",this.$source.attr("tabindex")),this.$source.removeAttr("tabindex"),!this.$target.val()&&this.$source.data("default")){var e=this.$source.data("default");this.$element.val(e),this.$target.val(e)}this.$source.attr("disabled")!==void 0&&this.disable()},select:function(){var e,n,t=this.$menu.find(".active").attr("data-value"),s=!1,o=!1,i=!1;this.$container.parent().find(".da-has-error").remove(),e=this.$element.val(),n=this.updater(t),e!==n&&(this.$element.val(n),s=!0),e=this.$target.val(),e!==this.map[t]&&(this.$target.val(this.map[t]),o=!0),e=this.$source.val(),e!==this.map[t]&&(this.$source.val(this.map[t]),i=!0),this.$container.addClass("combobox-selected"),this.selected=!0,this.hide(),o&&this.$target.trigger("change"),s&&this.$element.trigger("change"),i&&this.$source.trigger("change")},manualSelect:function(e){var t,n=!1,s=!1,o=!1;this.$container.parent().find(".da-has-error").remove(),e!==""&&this.revMap[e]!==void 0?(this.$element.val(this.revMap[e]),n=!0):this.$element.val(e),t=this.$target.val(),t!==e&&(this.$target.val(e),o=!0),t=this.$source.val(),t!==e&&(this.$source.val(e),s=!0),e!==""&&n&&(this.$container.addClass("combobox-selected"),this.selected=!0),o&&this.$target.trigger("change"),this.$element.trigger("change"),s&&this.$source.trigger("change")},updater:function(e){return e},show:function(){var t=e.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),this.hidden=!1,this.$element.attr("aria-expanded",!0),this.$button.attr("aria-expanded",!0),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.hidden=!0,this.$element.on("blur",e.proxy(this.blur,this)),this.$element.attr("aria-expanded",!1),this.$button.attr("aria-expanded",!1),this.shown=!1,this},lookup:function(){this.query=this.$element.val(),this.process(this.source)},process:function(t){var n=this;return t=e.grep(t,function(e){return n.matcher(e)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(e){return~e.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){for(var t,n=[],s=[],o=[];t=e.shift();)t.toLowerCase().indexOf(this.query.toLowerCase())?~t.indexOf(this.query)?s.push(t):o.push(t):n.push(t);return n.concat(s,o)},highlighter:function(e){var t=this.query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");return t?e.replace(new RegExp("("+t+")","ig"),function(e,t){return""+t+""}):e},render:function(t){var n=this;return t=e(t).map(function(t,s){return t=e(n.options.item).attr("data-value",s).attr("aria-label",s),t.attr("id",n.$element.attr("id")+"-option-"+s),t.html(n.highlighter(s)),t[0]}),this.setActive(t.first()),this.$menu.html(t),this},setActive:function(e){e.addClass("active").attr("aria-selected",!0),this.$element.attr("aria-activedescendant",e.attr("id"))},swapActive:function(e,t){e.removeClass("active").attr("aria-selected",!1),this.setActive(t)},next:function(){var s=this.$menu.find('[aria-selected="true"]'),n=s.next();n.length||(n=e(this.$menu.find("li")[0])),this.swapActive(s,n)},prev:function(){var n=this.$menu.find('[aria-selected="true"]'),t=n.prev();t.length||(t=this.$menu.find("li").last()),this.swapActive(n,t)},toggle:function(e){return this.disabled||(this.$container.hasClass("combobox-selected")?(this.clearAll(),this.$element.attr("aria-expanded",!1),this.$button.attr("aria-expanded",!1)):this.shown?(this.$element.attr("aria-expanded",!1),this.$button.attr("aria-expanded",!1),this.hide()):(this.$element.attr("aria-expanded",!0),this.$button.attr("aria-expanded",!0),this.clearElement(),this.lookup())),e&&(e.preventDefault(),e.stopPropagation()),!1},clearAll:function(){var t=!1,n=!1,s=!1,e=this.$element.val();e!==""&&(this.$element.val(""),t=!0),e=this.$source.val(),e!==""&&(this.$source.val(""),n=!0),e=this.$target.val(),e!==""&&(this.$target.val(""),s=!0),this.$container.removeClass("combobox-selected"),s&&this.$target.trigger("change"),t&&this.$element.trigger("change"),n&&this.$source.trigger("change")},clearElement:function(){this.$element.val("").focus()},clearTarget:function(){this.$source.val(""),this.$target.val(""),this.$container.removeClass("combobox-selected"),this.selected=!1},refresh:function(){this.source=this.parse(),this.options.items=this.source.length},listen:function(){this.$element.on("focus",e.proxy(this.focus,this)).on("change",e.proxy(this.change,this)).on("blur",e.proxy(this.blur,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",e.proxy(this.keydown,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this)).on("mouseleave","li",e.proxy(this.mouseleave,this)).on("mousedown","li",e.proxy(this.mousedown,this)),this.$button.on("click touchend",e.proxy(this.toggle,this))},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t=typeof this.$element[e]=="function"),t},move:function(e){if(!this.shown)return;switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),this.prev(),this.fixMenuScroll();break;case 40:e.preventDefault(),this.next(),this.fixMenuScroll();break}e.stopPropagation()},fixMenuScroll:function(){var t,n,s,o,e=this.$menu.find(".active");e.length&&(this.$element.attr("aria-activedescendant",e.attr("id")),t=e.position().top,n=t+e.height(),s=this.$menu.scrollTop(),o=this.$menu.height(),n>o?this.$menu.scrollTop(s+n-o):t<0&&this.$menu.scrollTop(s+t))},setActiveDescendant:function(t){this.mousedover&&this.swapActive(this.$menu.find(".active"),e(t.currentTarget))},keydown:function(t){this.suppressKeyPressRepeat=~e.inArray(t.keyCode,[40,38,9,13,27]),this.move(t)},keypress:function(e){if(this.suppressKeyPressRepeat)return;this.move(e)},keyup:function(t){switch(t.keyCode){case 40:this.shown||this.toggle();break;case 39:case 38:case 37:case 36:case 35:case 16:case 17:case 18:break;case 9:case 13:if(t&&(t.stopPropagation(),t.preventDefault()),daFetchAjaxTimeoutFetchAfter=!1,daFetchAcceptIncoming=!1,!this.shown)return;if(this.selected){for(var i=this.$element.val(),s=this.$menu.find("li"),o=s.length,n=0;n',item:'',appendId:"combobox",buttonLabel:"dropdown",clearIfNoMatch:!1},e.fn.combobox.Constructor=t})(window.jQuery) /*! * Socket.IO v4.5.4 diff --git a/docassemble_webapp/docassemble/webapp/static/labelauty/source/jquery-labelauty.js b/docassemble_webapp/docassemble/webapp/static/labelauty/source/jquery-labelauty.js index beddd1ac2..9f03ad2fc 100644 --- a/docassemble_webapp/docassemble/webapp/static/labelauty/source/jquery-labelauty.js +++ b/docassemble_webapp/docassemble/webapp/static/labelauty/source/jquery-labelauty.js @@ -15,9 +15,6 @@ * Our default settings * Hope you don't need to change anything, with these settings */ - function removeTabIndex(elem, thisLabel) { - PPP; - } var settings = $.extend( { // Development Mode @@ -198,11 +195,11 @@ } if ($object.is(":checked")) { $(element).addClass("btn-" + color); - $(element).removeClass("btn-light"); + $(element).removeClass("bg-secondary-subtle"); $(element).attr("aria-checked", true); } else { $(element).removeClass("btn-" + color); - $(element).addClass("btn-light"); + $(element).addClass("bg-secondary-subtle"); $(element).attr("aria-checked", false); } var the_name = $object.attr("name"); @@ -216,14 +213,14 @@ $(this) .next() .addClass("btn-" + color); - $(this).next().removeClass("btn-light"); + $(this).next().removeClass("bg-secondary-subtle"); $(this).next().attr("aria-checked", true); anyChecked = true; } else { $(this) .next() .removeClass("btn-" + color); - $(this).next().addClass("btn-light"); + $(this).next().addClass("bg-secondary-subtle"); $(this).next().attr("aria-checked", false); } }, @@ -247,13 +244,13 @@ $(this) .next() .addClass("btn-" + color); - $(this).next().removeClass("btn-light"); + $(this).next().removeClass("bg-secondary-subtle"); $(this).next().attr("aria-checked", true); } else { $(this) .next() .removeClass("btn-" + color); - $(this).next().addClass("btn-light"); + $(this).next().addClass("bg-secondary-subtle"); $(this).next().attr("aria-checked", false); } }); @@ -284,12 +281,12 @@ event.preventDefault(); if ($object.is(":checked")) { $(this).addClass("btn-" + color); - $(this).removeClass("btn-light"); + $(this).removeClass("bg-secondary-subtle"); $object.prop("checked", false); $(this).attr("aria-checked", true); } else { $(this).addClass("btn-" + color); - $(this).removeClass("btn-light"); + $(this).removeClass("bg-secondary-subtle"); $object.prop("checked", true); $(this).attr("aria-checked", false); } @@ -401,7 +398,7 @@ if (label == true && icon == true) { block = - '