@nyaruka/temba-components 0.129.10 → 0.129.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/demo/data/flows/sample-flow.json +96 -56
- package/dist/temba-components.js +278 -268
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/events.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +9 -6
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_channel.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_field.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_field.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_language.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_language.js.map +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js +1 -1
- package/out-tsc/src/flow/actions/set_contact_status.js.map +1 -1
- package/out-tsc/src/flow/config.js +2 -8
- package/out-tsc/src/flow/config.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_llm.js +101 -0
- package/out-tsc/src/flow/nodes/split_by_llm.js.map +1 -0
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +4 -89
- package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_subflow.js +123 -3
- package/out-tsc/src/flow/nodes/split_by_subflow.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_ticket.js +115 -13
- package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_webhook.js +160 -12
- package/out-tsc/src/flow/nodes/split_by_webhook.js.map +1 -1
- package/out-tsc/src/live/ContactChat.js +48 -66
- package/out-tsc/src/live/ContactChat.js.map +1 -1
- package/out-tsc/src/utils.js +115 -0
- package/out-tsc/src/utils.js.map +1 -1
- package/out-tsc/test/nodes/split_by_llm.test.js +174 -0
- package/out-tsc/test/nodes/split_by_llm.test.js.map +1 -0
- package/package.json +1 -1
- package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/multiple-groups.png +0 -0
- package/screenshots/truth/actions/add_contact_groups/editor/single-group.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/information-extraction.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/sentiment-analysis.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/summarization.png +0 -0
- package/screenshots/truth/actions/call_llm/editor/translation-task.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/cleanup-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/multiple-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
- package/screenshots/truth/actions/remove_contact_groups/editor/single-group.png +0 -0
- package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/empty-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/long-subject.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiline-body.png +0 -0
- package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
- package/screenshots/truth/actions/send_email/editor/simple-email.png +0 -0
- package/screenshots/truth/actions/send_email/editor/with-expressions.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
- package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
- package/screenshots/truth/checkbox/checkbox-label-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-no-label-no-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-whitespace-label-no-background-hover.png +0 -0
- package/screenshots/truth/checkbox/checkbox-with-help-text.png +0 -0
- package/screenshots/truth/checkbox/checked.png +0 -0
- package/screenshots/truth/checkbox/default.png +0 -0
- package/screenshots/truth/colorpicker/default.png +0 -0
- package/screenshots/truth/colorpicker/focused.png +0 -0
- package/screenshots/truth/colorpicker/initialized.png +0 -0
- package/screenshots/truth/colorpicker/selected.png +0 -0
- package/screenshots/truth/compose/attachments-tab.png +0 -0
- package/screenshots/truth/compose/attachments-with-files.png +0 -0
- package/screenshots/truth/compose/intial-text.png +0 -0
- package/screenshots/truth/compose/no-counter.png +0 -0
- package/screenshots/truth/compose/wraps-text-and-spaces.png +0 -0
- package/screenshots/truth/compose/wraps-text-and-url.png +0 -0
- package/screenshots/truth/compose/wraps-text-no-spaces.png +0 -0
- package/screenshots/truth/contacts/chat-failure.png +0 -0
- package/screenshots/truth/contacts/chat-for-active-contact.png +0 -0
- package/screenshots/truth/contacts/chat-sends-attachments-only.png +0 -0
- package/screenshots/truth/contacts/chat-sends-text-and-attachments.png +0 -0
- package/screenshots/truth/contacts/chat-sends-text-only.png +0 -0
- package/screenshots/truth/counter/summary.png +0 -0
- package/screenshots/truth/counter/text.png +0 -0
- package/screenshots/truth/counter/unicode-variables.png +0 -0
- package/screenshots/truth/counter/unicode.png +0 -0
- package/screenshots/truth/counter/variable.png +0 -0
- package/screenshots/truth/datepicker/date-truncated-time.png +0 -0
- package/screenshots/truth/datepicker/date.png +0 -0
- package/screenshots/truth/datepicker/initial-timezone.png +0 -0
- package/screenshots/truth/datepicker/range-picker-editing-start.png +0 -0
- package/screenshots/truth/datepicker/updated-keyboard-date.png +0 -0
- package/screenshots/truth/dialog/focused.png +0 -0
- package/screenshots/truth/dropdown/right-edge-collision.png +0 -0
- package/screenshots/truth/editor/router.png +0 -0
- package/screenshots/truth/editor/send_msg.png +0 -0
- package/screenshots/truth/editor/set_contact_language.png +0 -0
- package/screenshots/truth/editor/set_contact_name.png +0 -0
- package/screenshots/truth/editor/set_run_result.png +0 -0
- package/screenshots/truth/editor/wait.png +0 -0
- package/screenshots/truth/field-renderer/checkbox-checked.png +0 -0
- package/screenshots/truth/field-renderer/checkbox-unchecked.png +0 -0
- package/screenshots/truth/field-renderer/checkbox-with-errors.png +0 -0
- package/screenshots/truth/field-renderer/context-comparison.png +0 -0
- package/screenshots/truth/field-renderer/key-value-with-label.png +0 -0
- package/screenshots/truth/field-renderer/message-editor-with-label.png +0 -0
- package/screenshots/truth/field-renderer/select-multi.png +0 -0
- package/screenshots/truth/field-renderer/select-no-label.png +0 -0
- package/screenshots/truth/field-renderer/select-with-label.png +0 -0
- package/screenshots/truth/field-renderer/text-evaluated.png +0 -0
- package/screenshots/truth/field-renderer/text-no-label.png +0 -0
- package/screenshots/truth/field-renderer/text-with-errors.png +0 -0
- package/screenshots/truth/field-renderer/text-with-label.png +0 -0
- package/screenshots/truth/field-renderer/textarea-evaluated.png +0 -0
- package/screenshots/truth/field-renderer/textarea-with-label.png +0 -0
- package/screenshots/truth/integration/checkbox-markdown-errors.png +0 -0
- package/screenshots/truth/list/fields-dragging.png +0 -0
- package/screenshots/truth/list/fields-filtered.png +0 -0
- package/screenshots/truth/list/fields-hovered.png +0 -0
- package/screenshots/truth/list/fields.png +0 -0
- package/screenshots/truth/list/items-selected.png +0 -0
- package/screenshots/truth/list/items-updated.png +0 -0
- package/screenshots/truth/list/items.png +0 -0
- package/screenshots/truth/menu/menu-focused-with items.png +0 -0
- package/screenshots/truth/menu/menu-refresh-1.png +0 -0
- package/screenshots/truth/menu/menu-refresh-2.png +0 -0
- package/screenshots/truth/menu/menu-submenu.png +0 -0
- package/screenshots/truth/menu/menu-tasks-nextup.png +0 -0
- package/screenshots/truth/menu/menu-tasks.png +0 -0
- package/screenshots/truth/message-editor/autogrow-initial-content.png +0 -0
- package/screenshots/truth/message-editor/default.png +0 -0
- package/screenshots/truth/message-editor/drag-highlight.png +0 -0
- package/screenshots/truth/message-editor/filtered-attachments.png +0 -0
- package/screenshots/truth/message-editor/with-completion.png +0 -0
- package/screenshots/truth/message-editor/with-properties.png +0 -0
- package/screenshots/truth/modax/form.png +0 -0
- package/screenshots/truth/modax/simple.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/editor/translation-task.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/information-extraction.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/sentiment-analysis.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/summarization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm/render/translation-task.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
- package/screenshots/truth/omnibox/selected.png +0 -0
- package/screenshots/truth/options/block.png +0 -0
- package/screenshots/truth/run-list/basic.png +0 -0
- package/screenshots/truth/select/disabled-multi-selection.png +0 -0
- package/screenshots/truth/select/disabled-selection.png +0 -0
- package/screenshots/truth/select/disabled.png +0 -0
- package/screenshots/truth/select/embedded.png +0 -0
- package/screenshots/truth/select/empty-options.png +0 -0
- package/screenshots/truth/select/expression-selected.png +0 -0
- package/screenshots/truth/select/expressions.png +0 -0
- package/screenshots/truth/select/functions.png +0 -0
- package/screenshots/truth/select/local-options.png +0 -0
- package/screenshots/truth/select/multi-with-endpoint.png +0 -0
- package/screenshots/truth/select/multiple-initial-values.png +0 -0
- package/screenshots/truth/select/remote-options.png +0 -0
- package/screenshots/truth/select/search-enabled.png +0 -0
- package/screenshots/truth/select/search-multi-no-matches.png +0 -0
- package/screenshots/truth/select/search-selected-focus.png +0 -0
- package/screenshots/truth/select/search-selected.png +0 -0
- package/screenshots/truth/select/search-with-selected.png +0 -0
- package/screenshots/truth/select/searching.png +0 -0
- package/screenshots/truth/select/selected-multi-maxitems-reached.png +0 -0
- package/screenshots/truth/select/selected-multi.png +0 -0
- package/screenshots/truth/select/selected-single.png +0 -0
- package/screenshots/truth/select/selection-clearable.png +0 -0
- package/screenshots/truth/select/static-initial-value.png +0 -0
- package/screenshots/truth/select/static-initial-via-selected.png +0 -0
- package/screenshots/truth/select/truncated-selection.png +0 -0
- package/screenshots/truth/select/with-placeholder.png +0 -0
- package/screenshots/truth/select/without-placeholder.png +0 -0
- package/screenshots/truth/slider/update-slider-on-circle-dragged.png +0 -0
- package/screenshots/truth/templates/default.png +0 -0
- package/screenshots/truth/templates/unapproved.png +0 -0
- package/screenshots/truth/textinput/autogrow-initial.png +0 -0
- package/screenshots/truth/textinput/input-disabled.png +0 -0
- package/screenshots/truth/textinput/input-focused.png +0 -0
- package/screenshots/truth/textinput/input-form.png +0 -0
- package/screenshots/truth/textinput/input-inserted.png +0 -0
- package/screenshots/truth/textinput/input-placeholder.png +0 -0
- package/screenshots/truth/textinput/input-updated.png +0 -0
- package/screenshots/truth/textinput/input.png +0 -0
- package/screenshots/truth/textinput/textarea-focused.png +0 -0
- package/screenshots/truth/textinput/textarea.png +0 -0
- package/src/events.ts +4 -2
- package/src/flow/Editor.ts +6 -3
- package/src/flow/actions/set_contact_channel.ts +1 -1
- package/src/flow/actions/set_contact_field.ts +1 -1
- package/src/flow/actions/set_contact_language.ts +1 -1
- package/src/flow/actions/set_contact_status.ts +1 -1
- package/src/flow/config.ts +2 -8
- package/src/flow/nodes/split_by_llm.ts +119 -0
- package/src/flow/nodes/split_by_llm_categorize.ts +13 -116
- package/src/flow/nodes/split_by_subflow.ts +153 -3
- package/src/flow/nodes/split_by_ticket.ts +135 -12
- package/src/flow/nodes/split_by_webhook.ts +187 -12
- package/src/live/ContactChat.ts +56 -58
- package/src/store/flow-definition.d.ts +2 -1
- package/src/utils.ts +192 -0
- package/test/nodes/split_by_llm.test.ts +232 -0
- package/test-assets/style.css +36 -234
- package/web-dev-server.config.mjs +26 -0
- package/web-test-runner.config.mjs +1 -1
- package/out-tsc/src/flow/actions/call_llm.js +0 -64
- package/out-tsc/src/flow/actions/call_llm.js.map +0 -1
- package/out-tsc/src/flow/actions/call_webhook.js +0 -131
- package/out-tsc/src/flow/actions/call_webhook.js.map +0 -1
- package/out-tsc/src/flow/actions/enter_flow.js +0 -14
- package/out-tsc/src/flow/actions/enter_flow.js.map +0 -1
- package/out-tsc/src/flow/actions/open_ticket.js +0 -73
- package/out-tsc/src/flow/actions/open_ticket.js.map +0 -1
- package/out-tsc/test/actions/call_llm.test.js +0 -103
- package/out-tsc/test/actions/call_llm.test.js.map +0 -1
- package/src/flow/actions/call_llm.ts +0 -66
- package/src/flow/actions/call_webhook.ts +0 -143
- package/src/flow/actions/enter_flow.ts +0 -15
- package/src/flow/actions/open_ticket.ts +0 -83
- package/test/actions/call_llm.test.ts +0 -137
package/out-tsc/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAIhD,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAE1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAE3D,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;AAIzC,MAAM,CAAC,MAAM,WAAW,GACtB,gNAAgN,CAAC;AAgBnN,MAAM,CAAN,IAAY,KAKX;AALD,WAAY,KAAK;IACf,gCAAuB,CAAA;IACvB,iCAAwB,CAAA;IACxB,+BAAsB,CAAA;IACtB,kCAAyB,CAAA;AAC3B,CAAC,EALW,KAAK,KAAL,KAAK,QAKhB;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,OAAwB,EAAE,OAAO,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE;IAC1E,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,IAAI,OAAO,OAAO,KAAK,QAAQ,E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AE,QAAQ,CAAC,CAAC;AAC7C,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,IAAY,EAAU,EAAE;IAChE,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,IAAI;aACR,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,sBAAsB;aACtD,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,sBAAsB;aACtD,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,aAAa;aAC7C,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,sBAAsB;aAChD,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,WAAW;IACzC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAU,EAAE,CAAU,EAAE,EAAE;IAClD,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;AAC5C,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAU,EAAE,CAAU,EAAE,EAAE;IAClD,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,iDAAiD;AACjD,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-this-alias */\nimport { html, TemplateResult } from 'lit-html';\nimport { Button } from './display/Button';\nimport { Dialog } from './layout/Dialog';\nimport { Attachment, ContactField, Shortcut, Ticket, User } from './interfaces';\nimport ColorHash from 'color-hash';\nimport { Toast } from './display/Toast';\nimport { v4 as generateUUID } from 'uuid';\n\nexport const DEFAULT_MEDIA_ENDPOINT = '/api/v2/media.json';\n\nexport const colorHash = new ColorHash();\n\nexport type Asset = KeyedAsset & Ticket & ContactField & Shortcut;\n\nexport const DATE_FORMAT =\n /(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))/;\n\ninterface KeyedAsset {\n key?: string;\n}\n\ninterface AssetPage {\n assets: Asset[];\n next: string;\n}\n\nexport interface ResultsPage {\n results: any[];\n next: string;\n}\n\nexport enum Color {\n BLUE = 'color:#5078b5;',\n GREEN = 'color:#62bd6a;',\n RED = 'color:#e36049;',\n PURPLE = 'color:#a626a4;'\n}\n\nexport const log = (message: string | object, styling = '', details = []) => {\n if (styling === '') {\n // eslint-disable-next-line no-console\n console.log(message);\n return;\n }\n\n if (typeof message === 'object') {\n // eslint-disable-next-line no-console\n console.log('%c' + JSON.stringify(message, null, 2), styling);\n return;\n }\n // eslint-disable-next-line no-console\n console.log('%c' + message, styling, ...details);\n};\n\n/** Get the value for a named cookie */\nexport const getHTTPCookie = (name: string): string => {\n for (const cookie of document.cookie.split(';')) {\n const idx = cookie.indexOf('=');\n let key = cookie.substr(0, idx);\n let value = cookie.substr(idx + 1);\n\n // no spaces allowed\n key = key.trim();\n value = value.trim();\n\n if (key === name) {\n return value;\n }\n }\n return null;\n};\n\nexport const getHeaders = (headers: any = {}) => {\n let csrf = getHTTPCookie('csrftoken');\n if (!csrf) {\n const tokenEle = document.querySelector(\n '[name=csrfmiddlewaretoken]'\n ) as HTMLInputElement;\n if (tokenEle) {\n csrf = tokenEle.value;\n }\n }\n\n const fetchHeaders: any = csrf ? { 'X-CSRFToken': csrf } : {};\n\n // include the current org id\n const org_id = (window as any).org_id;\n if (org_id) {\n fetchHeaders['X-Temba-Org'] = org_id;\n }\n\n // mark us as ajax\n fetchHeaders['X-Requested-With'] = 'XMLHttpRequest';\n\n Object.keys(headers).forEach((key) => {\n // if we are adding a service org, we omit temba-org\n if (key === 'X-Temba-Service-Org') {\n delete fetchHeaders['X-Temba-Org'];\n }\n\n fetchHeaders[key] = headers[key];\n });\n return fetchHeaders;\n};\n\nexport const getUrl = (\n url: string,\n controller: AbortController = null,\n headers: { [key: string]: string } = {}\n): Promise<WebResponse> => {\n return new Promise<WebResponse>((resolve, reject) => {\n const options = {\n method: 'GET',\n headers: getHeaders(headers)\n };\n\n if (controller) {\n options['signal'] = controller.signal;\n }\n\n fetch(url, options)\n .then((response) => {\n if (response.status < 200 || response.status >= 300) {\n reject(response);\n return;\n }\n\n response.text().then((body: string) => {\n let json = {};\n try {\n json = JSON.parse(body);\n // eslint-disable-next-line no-empty\n } catch (err) {}\n resolve({\n controller,\n body,\n json,\n url: response.url,\n headers: response.headers,\n status: response.status\n });\n });\n })\n .catch((error) => {\n reject(error);\n });\n });\n};\n\nexport type ClassMap = {\n [className: string]: boolean;\n};\n\nexport const getClasses = (map: ClassMap): string => {\n const classNames: string[] = [];\n Object.keys(map).forEach((className: string) => {\n if (map[className]) {\n classNames.push(className);\n }\n });\n\n let result = classNames.join(' ');\n if (result.trim().length > 0) {\n result = ' ' + result;\n }\n return result.trim();\n};\n\nexport const fetchResultsPage = (\n url: string,\n controller: AbortController = null,\n headers: { [key: string]: string } = {}\n): Promise<ResultsPage> => {\n return new Promise<ResultsPage>((resolve, reject) => {\n getUrl(url, controller, headers)\n .then((response: WebResponse) => {\n resolve({\n results: response.json.results,\n next: response.json.next\n });\n })\n .catch((error) => {\n return reject(error);\n });\n });\n};\n\nexport const fetchResults = async (\n url: string,\n headers: { [key: string]: string } = {}\n): Promise<any[]> => {\n if (!url) {\n return new Promise<any[]>((resolve) => resolve([]));\n }\n\n let results: any[] = [];\n let pageUrl = url;\n while (pageUrl) {\n const resultsPage = await fetchResultsPage(pageUrl, null, headers);\n if (resultsPage.results) {\n results = results.concat(resultsPage.results);\n }\n pageUrl = resultsPage.next;\n }\n return results;\n};\n\nexport const getAssetPage = (url: string): Promise<AssetPage> => {\n return new Promise<AssetPage>((resolve, reject) => {\n getUrl(url)\n .then((response: WebResponse) => {\n if (response.status >= 200 && response.status < 300) {\n resolve({\n assets: response.json.results,\n next: response.json.next\n });\n } else {\n reject(response);\n }\n })\n .catch((error) => reject(error));\n });\n};\n\nexport const getAssets = async (url: string): Promise<Asset[]> => {\n if (!url) {\n return new Promise<Asset[]>((resolve) => resolve([]));\n }\n\n let assets: Asset[] = [];\n let pageUrl = url;\n while (pageUrl) {\n const assetPage = await getAssetPage(pageUrl);\n if (assetPage.assets) {\n assets = assets.concat(assetPage.assets);\n pageUrl = assetPage.next;\n } else {\n pageUrl = null;\n }\n }\n return assets;\n};\n\nexport interface WebResponse {\n json: any;\n body?: string;\n status: number;\n url?: string;\n headers: Headers;\n controller?: AbortController;\n redirected?: boolean;\n}\n\nexport const postUrl = (\n url: string,\n payload: any,\n headers: any = {},\n contentType = null\n): Promise<WebResponse> => {\n const fetchHeaders = getHeaders(headers);\n\n if (contentType) {\n fetchHeaders['Content-Type'] = contentType;\n }\n\n const options = {\n method: 'POST',\n headers: fetchHeaders,\n body: payload\n };\n\n return new Promise<WebResponse>((resolve, reject) => {\n fetch(url, options)\n .then(async (response) => {\n if (response.status >= 500) {\n reject(response);\n return;\n }\n\n const toasts = response.headers.get('X-Temba-Toasts');\n if (toasts) {\n const toastEle = document.querySelector('temba-toast') as Toast;\n if (toastEle) {\n toastEle.addMessages(JSON.parse(toasts));\n }\n }\n\n response.text().then((body: string) => {\n let json = {};\n try {\n json = JSON.parse(body);\n // eslint-disable-next-line no-empty\n } catch (err) {}\n resolve({\n body,\n json,\n headers: response.headers,\n status: response.status,\n redirected: response.redirected,\n url: response.url\n });\n });\n })\n .catch((error) => {\n reject(error);\n });\n });\n};\n\nexport const postJSON = (url: string, payload: any): Promise<WebResponse> => {\n return postUrl(url, JSON.stringify(payload), false, 'application/json');\n};\n\nexport const postFormData = (\n url: string,\n formData: FormData,\n headers: any = {}\n): Promise<WebResponse> => {\n return new Promise<WebResponse>((resolve, reject) => {\n postUrl(url, formData, headers)\n .then((response) => {\n if (response.status >= 200 && response.status < 400) {\n resolve(response);\n } else {\n if (url === DEFAULT_MEDIA_ENDPOINT) {\n reject(response);\n } else {\n reject('Server failure');\n }\n }\n })\n .catch((err) => {\n reject(err);\n });\n });\n};\n\nexport const postForm = (\n url: string,\n payload: any | FormData,\n headers: any = {}\n): Promise<WebResponse> => {\n const formData = new FormData();\n Object.keys(payload).forEach((key: string) => {\n formData.append(key, payload[key]);\n });\n return postFormData(url, formData, headers);\n};\n\n/**\n */\nexport const renderIf =\n (predicate: boolean | any) =>\n (then: () => TemplateResult, otherwise?: () => TemplateResult) => {\n return predicate ? then() : otherwise ? otherwise() : html``;\n };\n\nexport const hexToRgb = (hex: string): { r: number; g: number; b: number } => {\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result\n ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16)\n }\n : null;\n};\n\nexport const getElementOffset = (\n ele: HTMLElement\n): {\n top: number;\n left: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n} => {\n const rect = ele.getBoundingClientRect();\n const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;\n const scrollTop = window.pageYOffset || document.documentElement.scrollTop;\n return {\n top: rect.top + scrollTop,\n left: rect.left + scrollLeft,\n bottom: rect.top + rect.height,\n right: rect.left + rect.width,\n width: rect.width,\n height: rect.height\n };\n};\n\nexport const plural = (count: number, singular: string, plural: string) => {\n return count === 1 ? singular : plural;\n};\n\nexport const range = (start: number, end: number) =>\n Array.from({ length: end - start }, (v: number, k: number) => k + start);\n\nexport const fillTemplate = (\n template: string,\n replacements: { [key: string]: string | number }\n): TemplateResult => {\n for (const key in replacements) {\n const className = key + '-replaced';\n replacements[\n key\n ] = `<span class=\"${className}\">${replacements[key]}</span>`;\n }\n\n const templateDiv = document.createElement('div');\n // templateDiv.innerHTML = dynamicTemplate(template, replacements);\n return html` ${templateDiv} `;\n};\n\n/*!\n * Serialize all form data into a query string\n * (c) 2018 Chris Ferdinandi, MIT License, https://gomakethings.com\n * @param {Node} form The form to serialize\n * @return {String} The serialized form data\n */\nexport const serialize = function (form: any) {\n // Setup our serialized data\n const serialized = [];\n\n // Loop through each field in the form\n for (let i = 0; i < form.elements.length; i++) {\n const field = form.elements[i];\n\n // Don't serialize fields without a name, submits, buttons, file and reset inputs, and disabled fields\n if (\n !field.name ||\n field.disabled ||\n field.type === 'file' ||\n field.type === 'reset' ||\n field.type === 'submit' ||\n field.type === 'button'\n )\n continue;\n\n // If a multi-select, get all selections\n if (field.type === 'select-multiple') {\n for (let n = 0; n < field.options.length; n++) {\n if (!field.options[n].selected) continue;\n if (field.options[n].value) {\n serialized.push(\n encodeURIComponent(field.name) +\n '=' +\n encodeURIComponent(field.options[n].value)\n );\n }\n }\n }\n\n // Convert field data to a query string\n else if (\n (field.type !== 'checkbox' && field.type !== 'radio') ||\n field.checked\n ) {\n let value = field.value;\n if (!value && field.checked) {\n value = '1';\n }\n\n if (value) {\n serialized.push(\n encodeURIComponent(field.name) + '=' + encodeURIComponent(value)\n );\n }\n }\n }\n return serialized.join('&');\n};\n\nexport const getScrollParent = (node: any): any => {\n const parent = node.parentNode || node.host;\n if (parent) {\n const isElement = parent instanceof HTMLElement;\n const overflowY = isElement && window.getComputedStyle(parent).overflowY;\n const isScrollable =\n overflowY &&\n !(overflowY.includes('hidden') || overflowY.includes('visible'));\n\n if (!parent) {\n return null;\n } else if (isScrollable && parent.scrollHeight >= parent.clientHeight) {\n return parent;\n }\n\n return getScrollParent(parent);\n }\n return null;\n};\n\nexport const isElementVisible = (el: any, holder?: any) => {\n holder = holder || document.body;\n const { top, bottom } = el.getBoundingClientRect();\n const holderRect = holder.getBoundingClientRect();\n\n return top <= holderRect.top\n ? bottom > holderRect.top\n : bottom < holderRect.bottom;\n};\n\nconst HOUR = 3600;\nconst DAY = HOUR * 24;\nconst MONTH = DAY * 30;\n\nexport class Stubbable {\n public getCurrentDate() {\n return new Date();\n }\n}\n\nexport const stubbable = new Stubbable();\n\nexport const spreadAttributes = (obj): TemplateResult[] => {\n return Object.entries(obj).map(([key, value]) => {\n if (key.startsWith('@')) {\n return html`@${key.slice(1)}=${value}`;\n } else if (key.startsWith('.')) {\n return html`.${key.slice(1)}=${value}`;\n } else {\n return html`${key}=${value}`;\n }\n });\n};\n\nexport const timeSince = (\n date: Date,\n options: { compareDate?: Date; hideRecentText?: boolean; suffix?: string } = {\n suffix: ''\n }\n) => {\n const { compareDate, hideRecentText, suffix } = options;\n const now = compareDate || stubbable.getCurrentDate();\n const secondsPast = Math.floor((now.getTime() - date.getTime()) / 1000);\n\n if (secondsPast < 60) {\n if (compareDate) {\n return secondsPast + 's' + suffix;\n }\n\n if (!hideRecentText && suffix) {\n return suffix;\n }\n return 'just now';\n }\n\n if (secondsPast < HOUR) {\n return Math.round(secondsPast / 60) + 'm' + suffix;\n }\n\n if (secondsPast <= DAY) {\n return Math.round(secondsPast / HOUR) + 'h' + suffix;\n }\n\n if (secondsPast <= MONTH) {\n return Math.round(secondsPast / DAY) + 'd' + suffix;\n }\n\n if (secondsPast < MONTH * 6) {\n return Math.round(secondsPast / MONTH) + 'mth' + suffix;\n } else {\n const day = date.getDate();\n const month = date\n .toDateString()\n .match(/ [a-zA-Z]*/)[0]\n .replace(' ', '');\n const year =\n date.getFullYear() == now.getFullYear() ? '' : ' ' + date.getFullYear();\n return day + ' ' + month + year;\n }\n};\n\nexport const isDate = (value: any): boolean => {\n if (toString.call(value) === '[object Date]') {\n return true;\n }\n /* c8 ignore next 3 */\n if (typeof value.replace === 'function') {\n value.replace(/^\\s+|\\s+$/gm, '');\n }\n\n // value = value.split(\"+\")[0];\n return DATE_FORMAT.test(value);\n};\n\nexport const debounce = (fn: any, millis: number, immediate = false) => {\n let timeout: any;\n return function (...args: any) {\n const context = this;\n const later = function () {\n timeout = null;\n if (!immediate) {\n fn.apply(context, args);\n }\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, millis);\n if (callNow) {\n fn.apply(context, args);\n }\n };\n};\n\nexport const throttle = (fn: any, millis: number) => {\n let ready = true;\n return function (...args: any) {\n const context = this;\n if (!ready) {\n return;\n }\n\n ready = false;\n fn.apply(context, args);\n setTimeout(() => {\n ready = true;\n }, millis);\n };\n};\n\nexport interface NamedObject {\n name: string;\n}\n\nexport const truncate = (input: string, max: number): string => {\n if (input.length > max) {\n return input.substring(0, max) + '...';\n }\n\n return input;\n};\n\nexport const oxford = (items: any[], joiner = 'and'): any => {\n if (items.length === 0) {\n return '';\n }\n\n if (items.length === 1) {\n return items[0];\n }\n\n if (items.length === 2) {\n // TemplateResults get a different treatment\n if (typeof items[0] === 'object') {\n return html`${items[0]} ${joiner} ${items[1]}`;\n }\n return items.join(' ' + joiner + ' ');\n }\n\n // TemplateResults get a different treatment\n if (typeof items[0] === 'object') {\n return items.map((tr: TemplateResult, idx: number) => {\n if (idx < items.length - 1) {\n return html`${tr}, `;\n }\n return html`${joiner} ${tr}`;\n });\n }\n\n const allButLast = items.slice(0, -1);\n const last = items[items.length - 1];\n return allButLast.join(', ') + ', ' + joiner + ' ' + last;\n};\n\nexport const oxfordFn = (\n items: any[],\n fn: (item: any) => any,\n joiner = 'and'\n): any => {\n return oxford(items.map(fn), joiner);\n};\n\nexport const oxfordNamed = (items: NamedObject[], joiner = 'and'): any => {\n return oxfordFn(items, (value: any) => value.name, joiner);\n};\n\nexport const getDialog = (button: Button): Dialog => {\n return (button.getRootNode() as ShadowRoot).host as Dialog;\n};\n\nexport const setCookie = (name: string, value: any, path = undefined) => {\n if (!path) {\n // default path is the first word in the url\n const url = document.location.pathname;\n path = url.substring(0, url.indexOf('/', 1));\n }\n const now = new Date();\n now.setTime(now.getTime() + 60 * 1000 * 60 * 24 * 30);\n document.cookie = `${name}=${value};expires=${now.toUTCString()};path=${path}`;\n};\n\nexport const getCookie = (name: string) => {\n let cookieValue = null;\n if (document.cookie && document.cookie != '') {\n const cookies = document.cookie.split(';');\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i].trim();\n // Does this cookie string begin with the name we want?\n if (cookie.substring(0, name.length + 1) == name + '=') {\n cookieValue = decodeURIComponent(cookie.substring(name.length + 1));\n break;\n }\n }\n }\n return cookieValue;\n};\n\nexport const getCookieBoolean = (name: string) => {\n return (getCookie(name) || '') === 'true';\n};\n\nexport enum COOKIE_KEYS {\n SETTINGS = 'settings',\n MENU_COLLAPSED = 'menu-collapsed',\n TICKET_SHOW_DETAILS = 'tickets.show-details'\n}\n\nexport const capitalize = (\n [first, ...rest]: string[] | string,\n locale = navigator.language\n) =>\n first === undefined ? '' : first.toLocaleUpperCase(locale) + rest.join('');\n\nexport const formatFileType = (type: string): string => {\n return type.split('/')[1];\n};\nexport const formatFileSize = (\n bytes: number,\n decimalPoint?: number\n): string => {\n if (bytes == 0) return '0 KB';\n const k = 1024,\n dm = decimalPoint || 2,\n sizes = ['B', 'KB', 'MB', 'GB'], //, 'TB', 'PB', 'EB', 'ZB', 'YB'],\n i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];\n};\n\nexport const isImageAttachment = (attachment: Attachment) => {\n if (attachment) {\n return attachment.content_type.split('/')[0] === 'image';\n }\n return false;\n};\n\nexport const stopEvent = (event: Event) => {\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n};\n\n/**\n * Extracts 2-letter initials from text like a workspace or user name\n * @param text the input text\n * @returns the initials\n */\nexport const extractInitials = (text: string) => {\n text = text.trim();\n\n // split into words, first allowing hypens inside words,\n // then splitting by hypen to try to get more than one word\n let words =\n text.match(/(([\\p{L}\\p{N}]+-[\\p{L}\\p{N}]+)|([\\p{L}\\p{N}]+))/gu) || [];\n if (words.length == 1) {\n words = text.match(/[\\p{L}\\p{N}]+/gu);\n }\n\n // for the case of no words use ? and for only one word take first 2 characters\n if (words.length == 0) {\n return '?';\n } else if (words.length == 1) {\n return words[0].substring(0, 2).toUpperCase();\n }\n\n // use initial letters of words with preference to first word and capital letters\n const firstLetters = words.map((w) => w.substring(0, 1));\n const firstCapitals = firstLetters.filter(\n (l, index) => l == l.toUpperCase() || index == 0\n );\n if (firstCapitals.length >= 2) {\n return (firstCapitals[0] + firstCapitals[1]).toUpperCase();\n } else {\n return (firstLetters[0] + firstLetters[1]).toUpperCase();\n }\n};\n\nexport const hslToHex = (h, s, l) => {\n l /= 100;\n const a = (s * Math.min(l, 1 - l)) / 100;\n const f = (n) => {\n const k = (n + h / 30) % 12;\n const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n return Math.round(255 * color)\n .toString(16)\n .padStart(2, '0'); // convert to Hex and prefix \"0\" if needed\n };\n return `#${f(0)}${f(8)}${f(4)}`;\n};\n\nexport const darkenColor = (color: string, factor: number): string => {\n // If rgba or rgb\n const rgbaMatch = color.match(\n /rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*([0-9.]+))?\\)/\n );\n if (rgbaMatch) {\n // eslint-disable-next-line prefer-const\n let [r, g, b, a] = rgbaMatch\n .slice(1)\n .map((v, i) => (i < 3 ? parseInt(v) : parseFloat(v)));\n r = Math.max(0, Math.floor(r * (1 - factor)));\n g = Math.max(0, Math.floor(g * (1 - factor)));\n b = Math.max(0, Math.floor(b * (1 - factor)));\n if (rgbaMatch[4] !== undefined) {\n return `rgba(${r},${g},${b},${a})`;\n }\n return `rgb(${r},${g},${b})`;\n }\n // If hex\n if (color.startsWith('#')) {\n let hex = color.replace('#', '');\n if (hex.length === 3) {\n hex = hex\n .split('')\n .map((c) => c + c)\n .join('');\n }\n const num = parseInt(hex, 16);\n let r = (num >> 16) & 255;\n let g = (num >> 8) & 255;\n let b = num & 255;\n r = Math.max(0, Math.floor(r * (1 - factor)));\n g = Math.max(0, Math.floor(g * (1 - factor)));\n b = Math.max(0, Math.floor(b * (1 - factor)));\n return `rgb(${r},${g},${b})`;\n }\n // fallback\n return color;\n};\n\nexport const renderAvatar = (input: {\n name?: string;\n user?: User;\n icon?: string;\n position?: string;\n scale?: number;\n}) => {\n if (!input.position) {\n input.position = 'right';\n }\n\n let text = input.name;\n if (input.user && input.user.first_name && input.user.last_name) {\n text = `${input.user.first_name} ${input.user.last_name}`;\n }\n\n let initials = '';\n let color = '';\n\n // just a url\n if (input.user && input.user.avatar) {\n color = `url('${input.user.avatar}') center / contain no-repeat`;\n } else if (text) {\n color = colorHash.hex(text);\n initials = extractInitials(text);\n }\n\n const avatar = html`\n <div\n style=\"display:flex; flex-direction: column; align-items:center;transform:scale(${input.scale ||\n 1});\"\n >\n <div\n class=\"avatar-circle\"\n style=\"\n display: flex;\n height: 30px;\n width: 30px;\n flex-direction: row;\n align-items: center;\n color: #fff;\n border-radius: 100%;\n font-weight: 400;\n overflow: hidden;\n font-size: 12px;\n box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.1);\n background:${color}\"\n >\n ${initials\n ? html` <div\n style=\"border: 0px solid red; display:flex; flex-direction: column; align-items:center;flex-grow:1\"\n >\n <div style=\"border:0px solid blue;\">${initials}</div>\n </div>`\n : null}\n </div>\n </div>\n `;\n return avatar;\n};\n\nexport const hashCode = (s) => {\n return s.split('').reduce((a, b) => {\n a = (a << 5) - a + b.charCodeAt(0);\n return a & a;\n }, 0);\n};\n\nexport const showModax = (title: string, endpoint: string) => {\n (window as any).showModax(title, endpoint);\n};\nexport const sanitizeUnintendedUnicode = (text: string): string => {\n if (text) {\n return text\n .replace(/[\\u2018\\u2019]/g, \"'\") // Smart single quotes\n .replace(/[\\u201C\\u201D]/g, '\"') // Smart double quotes\n .replace(/[\\u2013\\u2014]/g, '-') // En/em dash\n .replace(/\\u2026/g, '...') // Horizontal ellipsis\n .replace(/\\u2002/g, ' '); // En space\n }\n return text;\n};\nexport const getCenter = (a: DOMRect, b: DOMRect) => {\n return a.left + a.width / 2 - b.width / 2;\n};\nexport const getMiddle = (a: DOMRect, b: DOMRect) => {\n return a.top + a.height / 2 - b.height / 2;\n};\n\n// Export the UUID function from the uuid package\nexport { generateUUID };\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAIhD,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,EAAE,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AAE1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAE3D,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;AAIzC,MAAM,CAAC,MAAM,WAAW,GACtB,gNAAgN,CAAC;AAgBnN,MAAM,CAAN,IAAY,KAKX;AALD,WAAY,KAAK;IACf,gCAAuB,CAAA;IACvB,iCAAwB,CAAA;IACxB,+BAAsB,CAAA;IACtB,kCAAyB,CAAA;AAC3B,CAAC,EALW,KAAK,KAAL,KAAK,QAKhB;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,OAAwB,EAAE,OAAO,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE;IAC1E,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAC9D,OAAO;IACT,CAAC;IACD,sCAAsC;IACtC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,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,iCAAiC;IACjC,MAAM,KAAK,GAAG,wBAAwB,CAAC;QACrC,IAAI,EAAE,OAAO;QACb,kBAAkB;QAClB,aAAa;KACd,CAAC,CAAC;IACH,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEvB,yBAAyB;IACzB,MAAM,OAAO,GAAG,wBAAwB,CAAC;QACvC,IAAI,EAAE,SAAS;QACf,kBAAkB;QAClB,aAAa;QACb,aAAa;QACb,UAAU,EAAE;YACV,IAAI,EAAE,eAAe;YACrB,SAAS,EAAE,CAAC,SAAS,CAAC;SACvB;KACF,CAAC,CAAC;IACH,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,MAAM,EAAE;YACN,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE,UAAU;YACtB,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI;YAC1C,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,KAAK;SACb;QACD,KAAK,EAAE,KAAK;KACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-this-alias */\nimport { html, TemplateResult } from 'lit-html';\nimport { Button } from './display/Button';\nimport { Dialog } from './layout/Dialog';\nimport { Attachment, ContactField, Shortcut, Ticket, User } from './interfaces';\nimport ColorHash from 'color-hash';\nimport { Toast } from './display/Toast';\nimport { v4 as generateUUID } from 'uuid';\n\nexport const DEFAULT_MEDIA_ENDPOINT = '/api/v2/media.json';\n\nexport const colorHash = new ColorHash();\n\nexport type Asset = KeyedAsset & Ticket & ContactField & Shortcut;\n\nexport const DATE_FORMAT =\n /(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))/;\n\ninterface KeyedAsset {\n key?: string;\n}\n\ninterface AssetPage {\n assets: Asset[];\n next: string;\n}\n\nexport interface ResultsPage {\n results: any[];\n next: string;\n}\n\nexport enum Color {\n BLUE = 'color:#5078b5;',\n GREEN = 'color:#62bd6a;',\n RED = 'color:#e36049;',\n PURPLE = 'color:#a626a4;'\n}\n\nexport const log = (message: string | object, styling = '', details = []) => {\n if (styling === '') {\n // eslint-disable-next-line no-console\n console.log(message);\n return;\n }\n\n if (typeof message === 'object') {\n // eslint-disable-next-line no-console\n console.log('%c' + JSON.stringify(message, null, 2), styling);\n return;\n }\n // eslint-disable-next-line no-console\n console.log('%c' + message, styling, ...details);\n};\n\n/** Get the value for a named cookie */\nexport const getHTTPCookie = (name: string): string => {\n for (const cookie of document.cookie.split(';')) {\n const idx = cookie.indexOf('=');\n let key = cookie.substr(0, idx);\n let value = cookie.substr(idx + 1);\n\n // no spaces allowed\n key = key.trim();\n value = value.trim();\n\n if (key === name) {\n return value;\n }\n }\n return null;\n};\n\nexport const getHeaders = (headers: any = {}) => {\n let csrf = getHTTPCookie('csrftoken');\n if (!csrf) {\n const tokenEle = document.querySelector(\n '[name=csrfmiddlewaretoken]'\n ) as HTMLInputElement;\n if (tokenEle) {\n csrf = tokenEle.value;\n }\n }\n\n const fetchHeaders: any = csrf ? { 'X-CSRFToken': csrf } : {};\n\n // include the current org id\n const org_id = (window as any).org_id;\n if (org_id) {\n fetchHeaders['X-Temba-Org'] = org_id;\n }\n\n // mark us as ajax\n fetchHeaders['X-Requested-With'] = 'XMLHttpRequest';\n\n Object.keys(headers).forEach((key) => {\n // if we are adding a service org, we omit temba-org\n if (key === 'X-Temba-Service-Org') {\n delete fetchHeaders['X-Temba-Org'];\n }\n\n fetchHeaders[key] = headers[key];\n });\n return fetchHeaders;\n};\n\nexport const getUrl = (\n url: string,\n controller: AbortController = null,\n headers: { [key: string]: string } = {}\n): Promise<WebResponse> => {\n return new Promise<WebResponse>((resolve, reject) => {\n const options = {\n method: 'GET',\n headers: getHeaders(headers)\n };\n\n if (controller) {\n options['signal'] = controller.signal;\n }\n\n fetch(url, options)\n .then((response) => {\n if (response.status < 200 || response.status >= 300) {\n reject(response);\n return;\n }\n\n response.text().then((body: string) => {\n let json = {};\n try {\n json = JSON.parse(body);\n // eslint-disable-next-line no-empty\n } catch (err) {}\n resolve({\n controller,\n body,\n json,\n url: response.url,\n headers: response.headers,\n status: response.status\n });\n });\n })\n .catch((error) => {\n reject(error);\n });\n });\n};\n\nexport type ClassMap = {\n [className: string]: boolean;\n};\n\nexport const getClasses = (map: ClassMap): string => {\n const classNames: string[] = [];\n Object.keys(map).forEach((className: string) => {\n if (map[className]) {\n classNames.push(className);\n }\n });\n\n let result = classNames.join(' ');\n if (result.trim().length > 0) {\n result = ' ' + result;\n }\n return result.trim();\n};\n\nexport const fetchResultsPage = (\n url: string,\n controller: AbortController = null,\n headers: { [key: string]: string } = {}\n): Promise<ResultsPage> => {\n return new Promise<ResultsPage>((resolve, reject) => {\n getUrl(url, controller, headers)\n .then((response: WebResponse) => {\n resolve({\n results: response.json.results,\n next: response.json.next\n });\n })\n .catch((error) => {\n return reject(error);\n });\n });\n};\n\nexport const fetchResults = async (\n url: string,\n headers: { [key: string]: string } = {}\n): Promise<any[]> => {\n if (!url) {\n return new Promise<any[]>((resolve) => resolve([]));\n }\n\n let results: any[] = [];\n let pageUrl = url;\n while (pageUrl) {\n const resultsPage = await fetchResultsPage(pageUrl, null, headers);\n if (resultsPage.results) {\n results = results.concat(resultsPage.results);\n }\n pageUrl = resultsPage.next;\n }\n return results;\n};\n\nexport const getAssetPage = (url: string): Promise<AssetPage> => {\n return new Promise<AssetPage>((resolve, reject) => {\n getUrl(url)\n .then((response: WebResponse) => {\n if (response.status >= 200 && response.status < 300) {\n resolve({\n assets: response.json.results,\n next: response.json.next\n });\n } else {\n reject(response);\n }\n })\n .catch((error) => reject(error));\n });\n};\n\nexport const getAssets = async (url: string): Promise<Asset[]> => {\n if (!url) {\n return new Promise<Asset[]>((resolve) => resolve([]));\n }\n\n let assets: Asset[] = [];\n let pageUrl = url;\n while (pageUrl) {\n const assetPage = await getAssetPage(pageUrl);\n if (assetPage.assets) {\n assets = assets.concat(assetPage.assets);\n pageUrl = assetPage.next;\n } else {\n pageUrl = null;\n }\n }\n return assets;\n};\n\nexport interface WebResponse {\n json: any;\n body?: string;\n status: number;\n url?: string;\n headers: Headers;\n controller?: AbortController;\n redirected?: boolean;\n}\n\nexport const postUrl = (\n url: string,\n payload: any,\n headers: any = {},\n contentType = null\n): Promise<WebResponse> => {\n const fetchHeaders = getHeaders(headers);\n\n if (contentType) {\n fetchHeaders['Content-Type'] = contentType;\n }\n\n const options = {\n method: 'POST',\n headers: fetchHeaders,\n body: payload\n };\n\n return new Promise<WebResponse>((resolve, reject) => {\n fetch(url, options)\n .then(async (response) => {\n if (response.status >= 500) {\n reject(response);\n return;\n }\n\n const toasts = response.headers.get('X-Temba-Toasts');\n if (toasts) {\n const toastEle = document.querySelector('temba-toast') as Toast;\n if (toastEle) {\n toastEle.addMessages(JSON.parse(toasts));\n }\n }\n\n response.text().then((body: string) => {\n let json = {};\n try {\n json = JSON.parse(body);\n // eslint-disable-next-line no-empty\n } catch (err) {}\n resolve({\n body,\n json,\n headers: response.headers,\n status: response.status,\n redirected: response.redirected,\n url: response.url\n });\n });\n })\n .catch((error) => {\n reject(error);\n });\n });\n};\n\nexport const postJSON = (url: string, payload: any): Promise<WebResponse> => {\n return postUrl(url, JSON.stringify(payload), false, 'application/json');\n};\n\nexport const postFormData = (\n url: string,\n formData: FormData,\n headers: any = {}\n): Promise<WebResponse> => {\n return new Promise<WebResponse>((resolve, reject) => {\n postUrl(url, formData, headers)\n .then((response) => {\n if (response.status >= 200 && response.status < 400) {\n resolve(response);\n } else {\n if (url === DEFAULT_MEDIA_ENDPOINT) {\n reject(response);\n } else {\n reject('Server failure');\n }\n }\n })\n .catch((err) => {\n reject(err);\n });\n });\n};\n\nexport const postForm = (\n url: string,\n payload: any | FormData,\n headers: any = {}\n): Promise<WebResponse> => {\n const formData = new FormData();\n Object.keys(payload).forEach((key: string) => {\n formData.append(key, payload[key]);\n });\n return postFormData(url, formData, headers);\n};\n\n/**\n */\nexport const renderIf =\n (predicate: boolean | any) =>\n (then: () => TemplateResult, otherwise?: () => TemplateResult) => {\n return predicate ? then() : otherwise ? otherwise() : html``;\n };\n\nexport const hexToRgb = (hex: string): { r: number; g: number; b: number } => {\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result\n ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16)\n }\n : null;\n};\n\nexport const getElementOffset = (\n ele: HTMLElement\n): {\n top: number;\n left: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n} => {\n const rect = ele.getBoundingClientRect();\n const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;\n const scrollTop = window.pageYOffset || document.documentElement.scrollTop;\n return {\n top: rect.top + scrollTop,\n left: rect.left + scrollLeft,\n bottom: rect.top + rect.height,\n right: rect.left + rect.width,\n width: rect.width,\n height: rect.height\n };\n};\n\nexport const plural = (count: number, singular: string, plural: string) => {\n return count === 1 ? singular : plural;\n};\n\nexport const range = (start: number, end: number) =>\n Array.from({ length: end - start }, (v: number, k: number) => k + start);\n\nexport const fillTemplate = (\n template: string,\n replacements: { [key: string]: string | number }\n): TemplateResult => {\n for (const key in replacements) {\n const className = key + '-replaced';\n replacements[\n key\n ] = `<span class=\"${className}\">${replacements[key]}</span>`;\n }\n\n const templateDiv = document.createElement('div');\n // templateDiv.innerHTML = dynamicTemplate(template, replacements);\n return html` ${templateDiv} `;\n};\n\n/*!\n * Serialize all form data into a query string\n * (c) 2018 Chris Ferdinandi, MIT License, https://gomakethings.com\n * @param {Node} form The form to serialize\n * @return {String} The serialized form data\n */\nexport const serialize = function (form: any) {\n // Setup our serialized data\n const serialized = [];\n\n // Loop through each field in the form\n for (let i = 0; i < form.elements.length; i++) {\n const field = form.elements[i];\n\n // Don't serialize fields without a name, submits, buttons, file and reset inputs, and disabled fields\n if (\n !field.name ||\n field.disabled ||\n field.type === 'file' ||\n field.type === 'reset' ||\n field.type === 'submit' ||\n field.type === 'button'\n )\n continue;\n\n // If a multi-select, get all selections\n if (field.type === 'select-multiple') {\n for (let n = 0; n < field.options.length; n++) {\n if (!field.options[n].selected) continue;\n if (field.options[n].value) {\n serialized.push(\n encodeURIComponent(field.name) +\n '=' +\n encodeURIComponent(field.options[n].value)\n );\n }\n }\n }\n\n // Convert field data to a query string\n else if (\n (field.type !== 'checkbox' && field.type !== 'radio') ||\n field.checked\n ) {\n let value = field.value;\n if (!value && field.checked) {\n value = '1';\n }\n\n if (value) {\n serialized.push(\n encodeURIComponent(field.name) + '=' + encodeURIComponent(value)\n );\n }\n }\n }\n return serialized.join('&');\n};\n\nexport const getScrollParent = (node: any): any => {\n const parent = node.parentNode || node.host;\n if (parent) {\n const isElement = parent instanceof HTMLElement;\n const overflowY = isElement && window.getComputedStyle(parent).overflowY;\n const isScrollable =\n overflowY &&\n !(overflowY.includes('hidden') || overflowY.includes('visible'));\n\n if (!parent) {\n return null;\n } else if (isScrollable && parent.scrollHeight >= parent.clientHeight) {\n return parent;\n }\n\n return getScrollParent(parent);\n }\n return null;\n};\n\nexport const isElementVisible = (el: any, holder?: any) => {\n holder = holder || document.body;\n const { top, bottom } = el.getBoundingClientRect();\n const holderRect = holder.getBoundingClientRect();\n\n return top <= holderRect.top\n ? bottom > holderRect.top\n : bottom < holderRect.bottom;\n};\n\nconst HOUR = 3600;\nconst DAY = HOUR * 24;\nconst MONTH = DAY * 30;\n\nexport class Stubbable {\n public getCurrentDate() {\n return new Date();\n }\n}\n\nexport const stubbable = new Stubbable();\n\nexport const spreadAttributes = (obj): TemplateResult[] => {\n return Object.entries(obj).map(([key, value]) => {\n if (key.startsWith('@')) {\n return html`@${key.slice(1)}=${value}`;\n } else if (key.startsWith('.')) {\n return html`.${key.slice(1)}=${value}`;\n } else {\n return html`${key}=${value}`;\n }\n });\n};\n\nexport const timeSince = (\n date: Date,\n options: { compareDate?: Date; hideRecentText?: boolean; suffix?: string } = {\n suffix: ''\n }\n) => {\n const { compareDate, hideRecentText, suffix } = options;\n const now = compareDate || stubbable.getCurrentDate();\n const secondsPast = Math.floor((now.getTime() - date.getTime()) / 1000);\n\n if (secondsPast < 60) {\n if (compareDate) {\n return secondsPast + 's' + suffix;\n }\n\n if (!hideRecentText && suffix) {\n return suffix;\n }\n return 'just now';\n }\n\n if (secondsPast < HOUR) {\n return Math.round(secondsPast / 60) + 'm' + suffix;\n }\n\n if (secondsPast <= DAY) {\n return Math.round(secondsPast / HOUR) + 'h' + suffix;\n }\n\n if (secondsPast <= MONTH) {\n return Math.round(secondsPast / DAY) + 'd' + suffix;\n }\n\n if (secondsPast < MONTH * 6) {\n return Math.round(secondsPast / MONTH) + 'mth' + suffix;\n } else {\n const day = date.getDate();\n const month = date\n .toDateString()\n .match(/ [a-zA-Z]*/)[0]\n .replace(' ', '');\n const year =\n date.getFullYear() == now.getFullYear() ? '' : ' ' + date.getFullYear();\n return day + ' ' + month + year;\n }\n};\n\nexport const isDate = (value: any): boolean => {\n if (toString.call(value) === '[object Date]') {\n return true;\n }\n /* c8 ignore next 3 */\n if (typeof value.replace === 'function') {\n value.replace(/^\\s+|\\s+$/gm, '');\n }\n\n // value = value.split(\"+\")[0];\n return DATE_FORMAT.test(value);\n};\n\nexport const debounce = (fn: any, millis: number, immediate = false) => {\n let timeout: any;\n return function (...args: any) {\n const context = this;\n const later = function () {\n timeout = null;\n if (!immediate) {\n fn.apply(context, args);\n }\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, millis);\n if (callNow) {\n fn.apply(context, args);\n }\n };\n};\n\nexport const throttle = (fn: any, millis: number) => {\n let ready = true;\n return function (...args: any) {\n const context = this;\n if (!ready) {\n return;\n }\n\n ready = false;\n fn.apply(context, args);\n setTimeout(() => {\n ready = true;\n }, millis);\n };\n};\n\nexport interface NamedObject {\n name: string;\n}\n\nexport const truncate = (input: string, max: number): string => {\n if (input.length > max) {\n return input.substring(0, max) + '...';\n }\n\n return input;\n};\n\nexport const oxford = (items: any[], joiner = 'and'): any => {\n if (items.length === 0) {\n return '';\n }\n\n if (items.length === 1) {\n return items[0];\n }\n\n if (items.length === 2) {\n // TemplateResults get a different treatment\n if (typeof items[0] === 'object') {\n return html`${items[0]} ${joiner} ${items[1]}`;\n }\n return items.join(' ' + joiner + ' ');\n }\n\n // TemplateResults get a different treatment\n if (typeof items[0] === 'object') {\n return items.map((tr: TemplateResult, idx: number) => {\n if (idx < items.length - 1) {\n return html`${tr}, `;\n }\n return html`${joiner} ${tr}`;\n });\n }\n\n const allButLast = items.slice(0, -1);\n const last = items[items.length - 1];\n return allButLast.join(', ') + ', ' + joiner + ' ' + last;\n};\n\nexport const oxfordFn = (\n items: any[],\n fn: (item: any) => any,\n joiner = 'and'\n): any => {\n return oxford(items.map(fn), joiner);\n};\n\nexport const oxfordNamed = (items: NamedObject[], joiner = 'and'): any => {\n return oxfordFn(items, (value: any) => value.name, joiner);\n};\n\nexport const getDialog = (button: Button): Dialog => {\n return (button.getRootNode() as ShadowRoot).host as Dialog;\n};\n\nexport const setCookie = (name: string, value: any, path = undefined) => {\n if (!path) {\n // default path is the first word in the url\n const url = document.location.pathname;\n path = url.substring(0, url.indexOf('/', 1));\n }\n const now = new Date();\n now.setTime(now.getTime() + 60 * 1000 * 60 * 24 * 30);\n document.cookie = `${name}=${value};expires=${now.toUTCString()};path=${path}`;\n};\n\nexport const getCookie = (name: string) => {\n let cookieValue = null;\n if (document.cookie && document.cookie != '') {\n const cookies = document.cookie.split(';');\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i].trim();\n // Does this cookie string begin with the name we want?\n if (cookie.substring(0, name.length + 1) == name + '=') {\n cookieValue = decodeURIComponent(cookie.substring(name.length + 1));\n break;\n }\n }\n }\n return cookieValue;\n};\n\nexport const getCookieBoolean = (name: string) => {\n return (getCookie(name) || '') === 'true';\n};\n\nexport enum COOKIE_KEYS {\n SETTINGS = 'settings',\n MENU_COLLAPSED = 'menu-collapsed',\n TICKET_SHOW_DETAILS = 'tickets.show-details'\n}\n\nexport const capitalize = (\n [first, ...rest]: string[] | string,\n locale = navigator.language\n) =>\n first === undefined ? '' : first.toLocaleUpperCase(locale) + rest.join('');\n\nexport const formatFileType = (type: string): string => {\n return type.split('/')[1];\n};\nexport const formatFileSize = (\n bytes: number,\n decimalPoint?: number\n): string => {\n if (bytes == 0) return '0 KB';\n const k = 1024,\n dm = decimalPoint || 2,\n sizes = ['B', 'KB', 'MB', 'GB'], //, 'TB', 'PB', 'EB', 'ZB', 'YB'],\n i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];\n};\n\nexport const isImageAttachment = (attachment: Attachment) => {\n if (attachment) {\n return attachment.content_type.split('/')[0] === 'image';\n }\n return false;\n};\n\nexport const stopEvent = (event: Event) => {\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n};\n\n/**\n * Extracts 2-letter initials from text like a workspace or user name\n * @param text the input text\n * @returns the initials\n */\nexport const extractInitials = (text: string) => {\n text = text.trim();\n\n // split into words, first allowing hypens inside words,\n // then splitting by hypen to try to get more than one word\n let words =\n text.match(/(([\\p{L}\\p{N}]+-[\\p{L}\\p{N}]+)|([\\p{L}\\p{N}]+))/gu) || [];\n if (words.length == 1) {\n words = text.match(/[\\p{L}\\p{N}]+/gu);\n }\n\n // for the case of no words use ? and for only one word take first 2 characters\n if (words.length == 0) {\n return '?';\n } else if (words.length == 1) {\n return words[0].substring(0, 2).toUpperCase();\n }\n\n // use initial letters of words with preference to first word and capital letters\n const firstLetters = words.map((w) => w.substring(0, 1));\n const firstCapitals = firstLetters.filter(\n (l, index) => l == l.toUpperCase() || index == 0\n );\n if (firstCapitals.length >= 2) {\n return (firstCapitals[0] + firstCapitals[1]).toUpperCase();\n } else {\n return (firstLetters[0] + firstLetters[1]).toUpperCase();\n }\n};\n\nexport const hslToHex = (h, s, l) => {\n l /= 100;\n const a = (s * Math.min(l, 1 - l)) / 100;\n const f = (n) => {\n const k = (n + h / 30) % 12;\n const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n return Math.round(255 * color)\n .toString(16)\n .padStart(2, '0'); // convert to Hex and prefix \"0\" if needed\n };\n return `#${f(0)}${f(8)}${f(4)}`;\n};\n\nexport const darkenColor = (color: string, factor: number): string => {\n // If rgba or rgb\n const rgbaMatch = color.match(\n /rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*([0-9.]+))?\\)/\n );\n if (rgbaMatch) {\n // eslint-disable-next-line prefer-const\n let [r, g, b, a] = rgbaMatch\n .slice(1)\n .map((v, i) => (i < 3 ? parseInt(v) : parseFloat(v)));\n r = Math.max(0, Math.floor(r * (1 - factor)));\n g = Math.max(0, Math.floor(g * (1 - factor)));\n b = Math.max(0, Math.floor(b * (1 - factor)));\n if (rgbaMatch[4] !== undefined) {\n return `rgba(${r},${g},${b},${a})`;\n }\n return `rgb(${r},${g},${b})`;\n }\n // If hex\n if (color.startsWith('#')) {\n let hex = color.replace('#', '');\n if (hex.length === 3) {\n hex = hex\n .split('')\n .map((c) => c + c)\n .join('');\n }\n const num = parseInt(hex, 16);\n let r = (num >> 16) & 255;\n let g = (num >> 8) & 255;\n let b = num & 255;\n r = Math.max(0, Math.floor(r * (1 - factor)));\n g = Math.max(0, Math.floor(g * (1 - factor)));\n b = Math.max(0, Math.floor(b * (1 - factor)));\n return `rgb(${r},${g},${b})`;\n }\n // fallback\n return color;\n};\n\nexport const renderAvatar = (input: {\n name?: string;\n user?: User;\n icon?: string;\n position?: string;\n scale?: number;\n}) => {\n if (!input.position) {\n input.position = 'right';\n }\n\n let text = input.name;\n if (input.user && input.user.first_name && input.user.last_name) {\n text = `${input.user.first_name} ${input.user.last_name}`;\n }\n\n let initials = '';\n let color = '';\n\n // just a url\n if (input.user && input.user.avatar) {\n color = `url('${input.user.avatar}') center / contain no-repeat`;\n } else if (text) {\n color = colorHash.hex(text);\n initials = extractInitials(text);\n }\n\n const avatar = html`\n <div\n style=\"display:flex; flex-direction: column; align-items:center;transform:scale(${input.scale ||\n 1});\"\n >\n <div\n class=\"avatar-circle\"\n style=\"\n display: flex;\n height: 30px;\n width: 30px;\n flex-direction: row;\n align-items: center;\n color: #fff;\n border-radius: 100%;\n font-weight: 400;\n overflow: hidden;\n font-size: 12px;\n box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.1);\n background:${color}\"\n >\n ${initials\n ? html` <div\n style=\"border: 0px solid red; display:flex; flex-direction: column; align-items:center;flex-grow:1\"\n >\n <div style=\"border:0px solid blue;\">${initials}</div>\n </div>`\n : null}\n </div>\n </div>\n `;\n return avatar;\n};\n\nexport const hashCode = (s) => {\n return s.split('').reduce((a, b) => {\n a = (a << 5) - a + b.charCodeAt(0);\n return a & a;\n }, 0);\n};\n\nexport const showModax = (title: string, endpoint: string) => {\n (window as any).showModax(title, endpoint);\n};\nexport const sanitizeUnintendedUnicode = (text: string): string => {\n if (text) {\n return text\n .replace(/[\\u2018\\u2019]/g, \"'\") // Smart single quotes\n .replace(/[\\u201C\\u201D]/g, '\"') // Smart double quotes\n .replace(/[\\u2013\\u2014]/g, '-') // En/em dash\n .replace(/\\u2026/g, '...') // Horizontal ellipsis\n .replace(/\\u2002/g, ' '); // En space\n }\n return text;\n};\nexport const getCenter = (a: DOMRect, b: DOMRect) => {\n return a.left + a.width / 2 - b.width / 2;\n};\nexport const getMiddle = (a: DOMRect, b: DOMRect) => {\n return a.top + a.height / 2 - b.height / 2;\n};\n\n// Export the UUID function from the uuid package\nexport { generateUUID };\n\n// Helper types for router creation\nexport interface RouterCategory {\n uuid: string;\n name: string;\n exit_uuid: string;\n}\n\nexport interface RouterExit {\n uuid: string;\n destination_uuid: string | null;\n}\n\nexport interface RouterCase {\n uuid: string;\n type: string;\n arguments: string[];\n category_uuid: string;\n}\n\nexport interface CreateCategoryParams {\n name: string;\n existingCategories: any[];\n existingExits: any[];\n existingCases?: any[];\n caseConfig?: {\n type: string;\n arguments: string[];\n };\n}\n\n// Helper function to create or preserve a category with its exit and case\nexport const createOrPreserveCategory = (\n params: CreateCategoryParams\n): {\n category: RouterCategory;\n exit: RouterExit;\n case?: RouterCase;\n} => {\n const { name, existingCategories, existingExits, existingCases, caseConfig } =\n params;\n\n // Find existing category\n const existingCategory = existingCategories.find((cat) => cat.name === name);\n const existingExit = existingCategory\n ? existingExits.find((exit) => exit.uuid === existingCategory.exit_uuid)\n : null;\n const existingCase =\n existingCategory && existingCases\n ? existingCases.find(\n (case_) => case_.category_uuid === existingCategory.uuid\n )\n : null;\n\n // Use existing UUIDs or generate new ones\n const categoryUuid = existingCategory?.uuid || generateUUID();\n const exitUuid = existingExit?.uuid || generateUUID();\n const caseUuid = existingCase?.uuid || generateUUID();\n\n const category: RouterCategory = {\n uuid: categoryUuid,\n name: name,\n exit_uuid: exitUuid\n };\n\n const exit: RouterExit = {\n uuid: exitUuid,\n destination_uuid: existingExit?.destination_uuid || null\n };\n\n const result: {\n category: RouterCategory;\n exit: RouterExit;\n case?: RouterCase;\n } = { category, exit };\n\n if (caseConfig) {\n result.case = {\n uuid: caseUuid,\n type: caseConfig.type,\n arguments: caseConfig.arguments,\n category_uuid: categoryUuid\n };\n }\n\n return result;\n};\n\n// Helper function to create a complete router with standard Success/Failure categories\nexport const createSuccessFailureRouter = (\n operand: string,\n successCaseConfig: { type: string; arguments: string[] },\n existingCategories: any[] = [],\n existingExits: any[] = [],\n existingCases: any[] = []\n) => {\n const success = createOrPreserveCategory({\n name: 'Success',\n existingCategories,\n existingExits,\n existingCases,\n caseConfig: successCaseConfig\n });\n\n const failure = createOrPreserveCategory({\n name: 'Failure',\n existingCategories,\n existingExits\n });\n\n return {\n router: {\n type: 'switch' as const,\n categories: [success.category, failure.category],\n default_category_uuid: failure.category.uuid,\n operand: operand,\n cases: success.case ? [success.case] : []\n },\n exits: [success.exit, failure.exit]\n };\n};\n\n// Helper function to create a multi-category router with Other/Failure defaults\nexport const createMultiCategoryRouter = (\n operand: string,\n userCategories: string[],\n categoryToCaseMap: (categoryName: string) => {\n type: string;\n arguments: string[];\n },\n existingCategories: any[] = [],\n existingExits: any[] = [],\n existingCases: any[] = []\n) => {\n const categories: RouterCategory[] = [];\n const exits: RouterExit[] = [];\n const cases: RouterCase[] = [];\n\n // Add user categories\n userCategories.forEach((categoryName) => {\n const result = createOrPreserveCategory({\n name: categoryName,\n existingCategories,\n existingExits,\n existingCases,\n caseConfig: categoryToCaseMap(categoryName)\n });\n\n categories.push(result.category);\n exits.push(result.exit);\n if (result.case) {\n cases.push(result.case);\n }\n });\n\n // Add \"Other\" category (default)\n const other = createOrPreserveCategory({\n name: 'Other',\n existingCategories,\n existingExits\n });\n categories.push(other.category);\n exits.push(other.exit);\n\n // Add \"Failure\" category\n const failure = createOrPreserveCategory({\n name: 'Failure',\n existingCategories,\n existingExits,\n existingCases,\n caseConfig: {\n type: 'has_only_text',\n arguments: ['<ERROR>']\n }\n });\n categories.push(failure.category);\n exits.push(failure.exit);\n if (failure.case) {\n cases.push(failure.case);\n }\n\n return {\n router: {\n type: 'switch' as const,\n categories: categories,\n default_category_uuid: other.category.uuid,\n operand: operand,\n cases: cases\n },\n exits: exits\n };\n};\n"]}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { expect } from '@open-wc/testing';
|
|
2
|
+
import { split_by_llm } from '../../src/flow/nodes/split_by_llm';
|
|
3
|
+
import { NodeTest } from '../NodeHelper';
|
|
4
|
+
/**
|
|
5
|
+
* Test suite for the split_by_llm node configuration.
|
|
6
|
+
*/
|
|
7
|
+
describe('split_by_llm node config', () => {
|
|
8
|
+
const helper = new NodeTest(split_by_llm, 'split_by_llm');
|
|
9
|
+
describe('basic properties', () => {
|
|
10
|
+
helper.testBasicProperties();
|
|
11
|
+
it('has correct name', () => {
|
|
12
|
+
expect(split_by_llm.name).to.equal('Call AI');
|
|
13
|
+
});
|
|
14
|
+
it('has form configuration', () => {
|
|
15
|
+
expect(split_by_llm.form).to.exist;
|
|
16
|
+
expect(split_by_llm.form.llm).to.exist;
|
|
17
|
+
expect(split_by_llm.form.instructions).to.exist;
|
|
18
|
+
expect(split_by_llm.form.input).to.exist;
|
|
19
|
+
});
|
|
20
|
+
it('has layout configuration', () => {
|
|
21
|
+
expect(split_by_llm.layout).to.exist;
|
|
22
|
+
expect(split_by_llm.layout).to.deep.equal([
|
|
23
|
+
'llm',
|
|
24
|
+
'input',
|
|
25
|
+
'instructions'
|
|
26
|
+
]);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
describe('toFormData', () => {
|
|
30
|
+
it('extracts data from node with call_llm action', () => {
|
|
31
|
+
const node = {
|
|
32
|
+
uuid: 'test-node',
|
|
33
|
+
actions: [
|
|
34
|
+
{
|
|
35
|
+
uuid: 'test-action',
|
|
36
|
+
type: 'call_llm',
|
|
37
|
+
llm: { uuid: 'gpt-4', name: 'GPT 4.1' },
|
|
38
|
+
instructions: 'Translate to French',
|
|
39
|
+
input: '@input',
|
|
40
|
+
output_local: '_llm_output'
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
exits: []
|
|
44
|
+
};
|
|
45
|
+
const formData = split_by_llm.toFormData(node);
|
|
46
|
+
expect(formData.uuid).to.equal('test-node');
|
|
47
|
+
expect(formData.llm).to.deep.equal([{ value: 'gpt-4', name: 'GPT 4.1' }]);
|
|
48
|
+
expect(formData.input).to.equal('@input');
|
|
49
|
+
expect(formData.instructions).to.equal('Translate to French');
|
|
50
|
+
});
|
|
51
|
+
it('handles empty node', () => {
|
|
52
|
+
const node = {
|
|
53
|
+
uuid: 'test-node',
|
|
54
|
+
actions: [],
|
|
55
|
+
exits: []
|
|
56
|
+
};
|
|
57
|
+
const formData = split_by_llm.toFormData(node);
|
|
58
|
+
expect(formData.uuid).to.equal('test-node');
|
|
59
|
+
expect(formData.llm).to.deep.equal([]);
|
|
60
|
+
expect(formData.input).to.equal('@input');
|
|
61
|
+
expect(formData.instructions).to.equal('');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('fromFormData', () => {
|
|
65
|
+
it('creates node with call_llm action and router', () => {
|
|
66
|
+
const formData = {
|
|
67
|
+
uuid: 'test-node',
|
|
68
|
+
llm: [{ value: 'gpt-4', name: 'GPT 4.1' }],
|
|
69
|
+
input: '@input',
|
|
70
|
+
instructions: 'Translate to French'
|
|
71
|
+
};
|
|
72
|
+
const originalNode = {
|
|
73
|
+
uuid: 'test-node',
|
|
74
|
+
actions: [],
|
|
75
|
+
exits: []
|
|
76
|
+
};
|
|
77
|
+
const node = split_by_llm.fromFormData(formData, originalNode);
|
|
78
|
+
expect(node.uuid).to.equal('test-node');
|
|
79
|
+
expect(node.actions).to.have.length(1);
|
|
80
|
+
expect(node.actions[0].type).to.equal('call_llm');
|
|
81
|
+
expect(node.actions[0].llm).to.deep.equal({
|
|
82
|
+
uuid: 'gpt-4',
|
|
83
|
+
name: 'GPT 4.1'
|
|
84
|
+
});
|
|
85
|
+
expect(node.actions[0].instructions).to.equal('Translate to French');
|
|
86
|
+
expect(node.actions[0].input).to.equal('@input');
|
|
87
|
+
expect(node.actions[0].output_local).to.equal('_llm_output');
|
|
88
|
+
expect(node.router).to.exist;
|
|
89
|
+
expect(node.router.type).to.equal('switch');
|
|
90
|
+
expect(node.router.operand).to.equal('@locals._llm_output');
|
|
91
|
+
expect(node.router.categories).to.have.length(2);
|
|
92
|
+
expect(node.router.categories[0].name).to.equal('Success');
|
|
93
|
+
expect(node.router.categories[1].name).to.equal('Failure');
|
|
94
|
+
expect(node.exits).to.have.length(2);
|
|
95
|
+
});
|
|
96
|
+
it('handles empty form data', () => {
|
|
97
|
+
const formData = {
|
|
98
|
+
uuid: 'test-node',
|
|
99
|
+
llm: [],
|
|
100
|
+
input: '',
|
|
101
|
+
instructions: ''
|
|
102
|
+
};
|
|
103
|
+
const originalNode = {
|
|
104
|
+
uuid: 'test-node',
|
|
105
|
+
actions: [],
|
|
106
|
+
exits: []
|
|
107
|
+
};
|
|
108
|
+
const node = split_by_llm.fromFormData(formData, originalNode);
|
|
109
|
+
const action = node.actions[0];
|
|
110
|
+
expect(action.llm).to.deep.equal({ uuid: '', name: '' });
|
|
111
|
+
expect(action.instructions).to.equal('');
|
|
112
|
+
expect(action.input).to.equal('@input');
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
describe('node scenarios', () => {
|
|
116
|
+
const createTestNode = (llm, instructions, input = '@input') => ({
|
|
117
|
+
uuid: 'test-node',
|
|
118
|
+
actions: [
|
|
119
|
+
{
|
|
120
|
+
uuid: 'test-action',
|
|
121
|
+
type: 'call_llm',
|
|
122
|
+
llm,
|
|
123
|
+
instructions,
|
|
124
|
+
input,
|
|
125
|
+
output_local: '_llm_output'
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
router: {
|
|
129
|
+
type: 'switch',
|
|
130
|
+
operand: '@locals._llm_output',
|
|
131
|
+
categories: [
|
|
132
|
+
{
|
|
133
|
+
uuid: 'success-category',
|
|
134
|
+
name: 'Success',
|
|
135
|
+
exit_uuid: 'success-exit'
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
uuid: 'failure-category',
|
|
139
|
+
name: 'Failure',
|
|
140
|
+
exit_uuid: 'failure-exit'
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
default_category_uuid: 'failure-category',
|
|
144
|
+
cases: [
|
|
145
|
+
{
|
|
146
|
+
uuid: 'success-case',
|
|
147
|
+
type: 'has_text',
|
|
148
|
+
arguments: [],
|
|
149
|
+
category_uuid: 'success-category'
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
exits: [
|
|
154
|
+
{
|
|
155
|
+
uuid: 'success-exit',
|
|
156
|
+
destination_uuid: null
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
uuid: 'failure-exit',
|
|
160
|
+
destination_uuid: null
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
});
|
|
164
|
+
const nodeUI = {
|
|
165
|
+
type: 'split_by_llm',
|
|
166
|
+
position: { left: 50, top: 50 }
|
|
167
|
+
};
|
|
168
|
+
helper.testNode(createTestNode({ uuid: 'gpt-4', name: 'GPT 4.1' }, 'Translate to French'), nodeUI, 'translation-task');
|
|
169
|
+
helper.testNode(createTestNode({ uuid: 'gpt-5', name: 'GPT 5' }, 'Analyze the sentiment of the following message and classify it as positive, negative, or neutral. Provide a brief explanation for your classification.'), nodeUI, 'sentiment-analysis');
|
|
170
|
+
helper.testNode(createTestNode({ uuid: 'gpt-4', name: 'GPT 4.1' }, 'Summarize the key points from the conversation above in bullet format.'), nodeUI, 'summarization');
|
|
171
|
+
helper.testNode(createTestNode({ uuid: 'gpt-5', name: 'GPT 5' }, 'Extract any contact information (phone numbers, email addresses) from the text and format them as a JSON object.'), nodeUI, 'information-extraction');
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
//# sourceMappingURL=split_by_llm.test.js.map
|
|
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,eAAe,CAChB,CAAC;QAEF,MAAM,CAAC,QAAQ,CACb,cAAc,CACZ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EAChC,kHAAkH,CACnH,EACD,MAAM,EACN,wBAAwB,CACzB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { split_by_llm } from '../../src/flow/nodes/split_by_llm';\nimport { Node, CallLLM } from '../../src/store/flow-definition';\nimport { NodeTest } from '../NodeHelper';\n\n/**\n * Test suite for the split_by_llm node configuration.\n */\ndescribe('split_by_llm node config', () => {\n const helper = new NodeTest(split_by_llm, 'split_by_llm');\n\n describe('basic properties', () => {\n helper.testBasicProperties();\n\n it('has correct name', () => {\n expect(split_by_llm.name).to.equal('Call AI');\n });\n\n it('has form configuration', () => {\n expect(split_by_llm.form).to.exist;\n expect(split_by_llm.form.llm).to.exist;\n expect(split_by_llm.form.instructions).to.exist;\n expect(split_by_llm.form.input).to.exist;\n });\n\n it('has layout configuration', () => {\n expect(split_by_llm.layout).to.exist;\n expect(split_by_llm.layout).to.deep.equal([\n 'llm',\n 'input',\n 'instructions'\n ]);\n });\n });\n\n describe('toFormData', () => {\n it('extracts data from node with call_llm action', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [\n {\n uuid: 'test-action',\n type: 'call_llm',\n llm: { uuid: 'gpt-4', name: 'GPT 4.1' },\n instructions: 'Translate to French',\n input: '@input',\n output_local: '_llm_output'\n } as CallLLM\n ],\n exits: []\n };\n\n const formData = split_by_llm.toFormData(node);\n\n expect(formData.uuid).to.equal('test-node');\n expect(formData.llm).to.deep.equal([{ value: 'gpt-4', name: 'GPT 4.1' }]);\n expect(formData.input).to.equal('@input');\n expect(formData.instructions).to.equal('Translate to French');\n });\n\n it('handles empty node', () => {\n const node: Node = {\n uuid: 'test-node',\n actions: [],\n exits: []\n };\n\n const formData = split_by_llm.toFormData(node);\n\n expect(formData.uuid).to.equal('test-node');\n expect(formData.llm).to.deep.equal([]);\n expect(formData.input).to.equal('@input');\n expect(formData.instructions).to.equal('');\n });\n });\n\n describe('fromFormData', () => {\n it('creates node with call_llm action and router', () => {\n const formData = {\n uuid: 'test-node',\n llm: [{ value: 'gpt-4', name: 'GPT 4.1' }],\n input: '@input',\n instructions: 'Translate to French'\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: []\n };\n\n const node = split_by_llm.fromFormData(formData, originalNode);\n\n expect(node.uuid).to.equal('test-node');\n expect(node.actions).to.have.length(1);\n expect(node.actions[0].type).to.equal('call_llm');\n expect((node.actions[0] as CallLLM).llm).to.deep.equal({\n uuid: 'gpt-4',\n name: 'GPT 4.1'\n });\n expect((node.actions[0] as CallLLM).instructions).to.equal(\n 'Translate to French'\n );\n expect((node.actions[0] as CallLLM).input).to.equal('@input');\n expect((node.actions[0] as CallLLM).output_local).to.equal('_llm_output');\n\n expect(node.router).to.exist;\n expect(node.router.type).to.equal('switch');\n expect(node.router.operand).to.equal('@locals._llm_output');\n expect(node.router.categories).to.have.length(2);\n expect(node.router.categories[0].name).to.equal('Success');\n expect(node.router.categories[1].name).to.equal('Failure');\n\n expect(node.exits).to.have.length(2);\n });\n\n it('handles empty form data', () => {\n const formData = {\n uuid: 'test-node',\n llm: [],\n input: '',\n instructions: ''\n };\n\n const originalNode: Node = {\n uuid: 'test-node',\n actions: [],\n exits: []\n };\n\n const node = split_by_llm.fromFormData(formData, originalNode);\n\n const action = node.actions[0] as CallLLM;\n expect(action.llm).to.deep.equal({ uuid: '', name: '' });\n expect(action.instructions).to.equal('');\n expect(action.input).to.equal('@input');\n });\n });\n\n describe('node scenarios', () => {\n const createTestNode = (\n llm: any,\n instructions: string,\n input: string = '@input'\n ): Node => ({\n uuid: 'test-node',\n actions: [\n {\n uuid: 'test-action',\n type: 'call_llm',\n llm,\n instructions,\n input,\n output_local: '_llm_output'\n } as CallLLM\n ],\n router: {\n type: 'switch',\n operand: '@locals._llm_output',\n categories: [\n {\n uuid: 'success-category',\n name: 'Success',\n exit_uuid: 'success-exit'\n },\n {\n uuid: 'failure-category',\n name: 'Failure',\n exit_uuid: 'failure-exit'\n }\n ],\n default_category_uuid: 'failure-category',\n cases: [\n {\n uuid: 'success-case',\n type: 'has_text',\n arguments: [],\n category_uuid: 'success-category'\n }\n ]\n },\n exits: [\n {\n uuid: 'success-exit',\n destination_uuid: null\n },\n {\n uuid: 'failure-exit',\n destination_uuid: null\n }\n ]\n });\n\n const nodeUI = {\n type: 'split_by_llm',\n position: { left: 50, top: 50 }\n };\n\n helper.testNode(\n createTestNode({ uuid: 'gpt-4', name: 'GPT 4.1' }, 'Translate to French'),\n nodeUI,\n 'translation-task'\n );\n\n helper.testNode(\n createTestNode(\n { uuid: 'gpt-5', name: 'GPT 5' },\n 'Analyze the sentiment of the following message and classify it as positive, negative, or neutral. Provide a brief explanation for your classification.'\n ),\n nodeUI,\n 'sentiment-analysis'\n );\n\n helper.testNode(\n createTestNode(\n { uuid: 'gpt-4', name: 'GPT 4.1' },\n 'Summarize the key points from the conversation above in bullet format.'\n ),\n nodeUI,\n 'summarization'\n );\n\n helper.testNode(\n createTestNode(\n { uuid: 'gpt-5', name: 'GPT 5' },\n 'Extract any contact information (phone numbers, email addresses) from the text and format them as a JSON object.'\n ),\n nodeUI,\n 'information-extraction'\n );\n });\n});\n"]}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|