4845-4845.js 44 KB

12
  1. "use strict";(self.webpackChunknextcloud=self.webpackChunknextcloud||[]).push([[4845],{235:(t,e,i)=>{i.d(e,{A:()=>l});var n=i(71354),a=i.n(n),s=i(76314),r=i.n(s)()(a());r.push([t.id,"/**\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n/**\n * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n/*\n* Ensure proper alignment of the vue material icons\n*/\n.material-design-icon[data-v-e01fcb1e] {\n display: flex;\n align-self: center;\n justify-self: center;\n align-items: center;\n justify-content: center;\n}\n.nc-chip[data-v-e01fcb1e] {\n --chip-size: 24px;\n --chip-radius: calc(var(--chip-size) / 2);\n height: var(--chip-size);\n max-width: fit-content;\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: var(--default-grid-baseline);\n border-radius: var(--chip-radius);\n background-color: var(--color-background-hover);\n}\n.nc-chip--primary[data-v-e01fcb1e] {\n background-color: var(--color-primary-element);\n color: var(--color-primary-text);\n}\n.nc-chip--secondary[data-v-e01fcb1e] {\n background-color: var(--color-primary-element-light);\n color: var(--color-primary-element-light-text);\n}\n.nc-chip--no-actions .nc-chip__text[data-v-e01fcb1e] {\n padding-inline-end: calc(1.5 * var(--default-grid-baseline));\n}\n.nc-chip__text[data-v-e01fcb1e] {\n flex: 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.nc-chip__icon[data-v-e01fcb1e] {\n flex: 0 0 var(--chip-size);\n line-height: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n height: var(--chip-size);\n width: var(--chip-size);\n}\n.nc-chip__actions[data-v-e01fcb1e] {\n flex: 0 0 var(--chip-size);\n --default-clickable-area: var(--chip-size);\n --border-radius-element: var(--chip-radius);\n}","",{version:3,sources:["webpack://./node_modules/@nextcloud/vue/dist/assets/NcChip-CQm1mq2C.css"],names:[],mappings:"AAAA;;;EAGE;AACF;;;EAGE;AACF;;CAEC;AACD;EACE,aAAa;EACb,kBAAkB;EAClB,oBAAoB;EACpB,mBAAmB;EACnB,uBAAuB;AACzB;AACA;EACE,iBAAiB;EACjB,yCAAyC;EACzC,wBAAwB;EACxB,sBAAsB;EACtB,aAAa;EACb,mBAAmB;EACnB,mBAAmB;EACnB,iCAAiC;EACjC,iCAAiC;EACjC,+CAA+C;AACjD;AACA;EACE,8CAA8C;EAC9C,gCAAgC;AAClC;AACA;EACE,oDAAoD;EACpD,8CAA8C;AAChD;AACA;EACE,4DAA4D;AAC9D;AACA;EACE,YAAY;EACZ,gBAAgB;EAChB,uBAAuB;AACzB;AACA;EACE,0BAA0B;EAC1B,cAAc;EACd,aAAa;EACb,mBAAmB;EACnB,uBAAuB;EACvB,gBAAgB;EAChB,wBAAwB;EACxB,uBAAuB;AACzB;AACA;EACE,0BAA0B;EAC1B,0CAA0C;EAC1C,2CAA2C;AAC7C",sourcesContent:["/**\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n/**\n * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n/*\n* Ensure proper alignment of the vue material icons\n*/\n.material-design-icon[data-v-e01fcb1e] {\n display: flex;\n align-self: center;\n justify-self: center;\n align-items: center;\n justify-content: center;\n}\n.nc-chip[data-v-e01fcb1e] {\n --chip-size: 24px;\n --chip-radius: calc(var(--chip-size) / 2);\n height: var(--chip-size);\n max-width: fit-content;\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: var(--default-grid-baseline);\n border-radius: var(--chip-radius);\n background-color: var(--color-background-hover);\n}\n.nc-chip--primary[data-v-e01fcb1e] {\n background-color: var(--color-primary-element);\n color: var(--color-primary-text);\n}\n.nc-chip--secondary[data-v-e01fcb1e] {\n background-color: var(--color-primary-element-light);\n color: var(--color-primary-element-light-text);\n}\n.nc-chip--no-actions .nc-chip__text[data-v-e01fcb1e] {\n padding-inline-end: calc(1.5 * var(--default-grid-baseline));\n}\n.nc-chip__text[data-v-e01fcb1e] {\n flex: 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.nc-chip__icon[data-v-e01fcb1e] {\n flex: 0 0 var(--chip-size);\n line-height: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n height: var(--chip-size);\n width: var(--chip-size);\n}\n.nc-chip__actions[data-v-e01fcb1e] {\n flex: 0 0 var(--chip-size);\n --default-clickable-area: var(--chip-size);\n --border-radius-element: var(--chip-radius);\n}"],sourceRoot:""}]);const l=r},12103:(t,e,i)=>{i.d(e,{A:()=>l});var n=i(71354),a=i.n(n),s=i(76314),r=i.n(s)()(a());r.push([t.id,".file-request-dialog[data-v-3fbb7161]{--margin: 36px;--secondary-margin: 18px}.file-request-dialog__header[data-v-3fbb7161]{margin:0 var(--margin)}.file-request-dialog__form[data-v-3fbb7161]{position:relative;overflow:auto;padding:var(--secondary-margin) var(--margin);margin-top:calc(-1*var(--secondary-margin))}.file-request-dialog[data-v-3fbb7161] fieldset{display:flex;flex-direction:column;width:100%;margin-top:var(--secondary-margin)}.file-request-dialog[data-v-3fbb7161] fieldset :deep(legend){display:flex;align-items:center;width:100%}.file-request-dialog[data-v-3fbb7161] .dialog__actions{width:auto;margin-inline:12px;margin-left:0}.file-request-dialog[data-v-3fbb7161] .dialog__actions span.dialog__actions-separator{margin-left:auto}.file-request-dialog[data-v-3fbb7161] .input-field__helper-text-message{color:var(--color-text-maxcontrast)}","",{version:3,sources:["webpack://./apps/files_sharing/src/components/NewFileRequestDialog.vue"],names:[],mappings:"AACA,sCACC,cAAA,CACA,wBAAA,CAEA,8CACC,sBAAA,CAGD,4CACC,iBAAA,CACA,aAAA,CACA,6CAAA,CAEA,2CAAA,CAGD,+CACC,YAAA,CACA,qBAAA,CACA,UAAA,CACA,kCAAA,CAEA,6DACC,YAAA,CACA,kBAAA,CACA,UAAA,CAIF,uDACC,UAAA,CACA,kBAAA,CAEA,aAAA,CACA,sFACC,gBAAA,CAIF,wEAEC,mCAAA",sourcesContent:["\n.file-request-dialog {\n\t--margin: 36px;\n\t--secondary-margin: 18px;\n\n\t&__header {\n\t\tmargin: 0 var(--margin);\n\t}\n\n\t&__form {\n\t\tposition: relative;\n\t\toverflow: auto;\n\t\tpadding: var(--secondary-margin) var(--margin);\n\t\t// overlap header bottom padding\n\t\tmargin-top: calc(-1 * var(--secondary-margin));\n\t}\n\n\t:deep(fieldset) {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\twidth: 100%;\n\t\tmargin-top: var(--secondary-margin);\n\n\t\t:deep(legend) {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\twidth: 100%;\n\t\t}\n\t}\n\n\t:deep(.dialog__actions) {\n\t\twidth: auto;\n\t\tmargin-inline: 12px;\n\t\t// align left and remove margin\n\t\tmargin-left: 0;\n\t\tspan.dialog__actions-separator {\n\t\t\tmargin-left: auto;\n\t\t}\n\t}\n\n\t:deep(.input-field__helper-text-message) {\n\t\t// reduce helper text standing out\n\t\tcolor: var(--color-text-maxcontrast);\n\t}\n}\n"],sourceRoot:""}]);const l=r},28587:(t,e,i)=>{i.d(e,{A:()=>l});var n=i(71354),a=i.n(n),s=i(76314),r=i.n(s)()(a());r.push([t.id,".file-request-dialog__password-field[data-v-7877828d]{display:flex;align-items:flex-start;gap:8px}","",{version:3,sources:["webpack://./apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue"],names:[],mappings:"AACA,sDACC,YAAA,CACA,sBAAA,CACA,OAAA",sourcesContent:["\n.file-request-dialog__password-field {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 8px;\n}\n"],sourceRoot:""}]);const l=r},25684:(t,e,i)=>{i.d(e,{A:()=>l});var n=i(71354),a=i.n(n),s=i(76314),r=i.n(s)()(a());r.push([t.id,"\n.input-field[data-v-1ec2f06f],\n.file-request-dialog__emails[data-v-1ec2f06f] {\n\tmargin-top: var(--secondary-margin);\n}\n.file-request-dialog__emails[data-v-1ec2f06f] {\n\tdisplay: flex;\n\tgap: var(--default-grid-baseline);\n\tflex-wrap: wrap;\n}\n","",{version:3,sources:["webpack://./apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue"],names:[],mappings:";AAqNA;;CAEA,mCAAA;AACA;AAEA;CACA,aAAA;CACA,iCAAA;CACA,eAAA;AACA",sourcesContent:["\x3c!--\n - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n--\x3e\n\n<template>\n\t<div>\n\t\t\x3c!-- Request note --\x3e\n\t\t<NcNoteCard type=\"success\">\n\t\t\t{{ t('files_sharing', 'Once created, you can share the link below to allow people to upload files to your directory.') }}\n\t\t</NcNoteCard>\n\n\t\t\x3c!-- Copy share link --\x3e\n\t\t<NcInputField ref=\"clipboard\"\n\t\t\t:value=\"shareLink\"\n\t\t\t:label=\"t('files_sharing', 'Share link')\"\n\t\t\t:readonly=\"true\"\n\t\t\t:show-trailing-button=\"true\"\n\t\t\t:trailing-button-label=\"t('files_sharing', 'Copy to clipboard')\"\n\t\t\t@click=\"copyShareLink\"\n\t\t\t@click-trailing-button=\"copyShareLink\">\n\t\t\t<template #trailing-button-icon>\n\t\t\t\t<IconCheck v-if=\"isCopied\" :size=\"20\" />\n\t\t\t\t<IconClipboard v-else :size=\"20\" />\n\t\t\t</template>\n\t\t</NcInputField>\n\n\t\t<template v-if=\"isShareByMailEnabled\">\n\t\t\t\x3c!-- Email share--\x3e\n\t\t\t<NcTextField :value.sync=\"email\"\n\t\t\t\t:label=\"t('files_sharing', 'Send link via email')\"\n\t\t\t\t:placeholder=\"t('files_sharing', 'Enter an email address or paste a list')\"\n\t\t\t\ttype=\"email\"\n\t\t\t\t@keypress.enter.stop=\"addNewEmail\"\n\t\t\t\t@paste.stop.prevent=\"onPasteEmails\" />\n\n\t\t\t\x3c!-- Email list --\x3e\n\t\t\t<div v-if=\"emails.length > 0\" class=\"file-request-dialog__emails\">\n\t\t\t\t<NcChip v-for=\"mail in emails\"\n\t\t\t\t\t:key=\"mail\"\n\t\t\t\t\t:aria-label-close=\"t('files_sharing', 'Remove email')\"\n\t\t\t\t\t:text=\"mail\"\n\t\t\t\t\t@close=\"$emit('remove-email', mail)\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<NcAvatar :disable-menu=\"true\"\n\t\t\t\t\t\t\t:disable-tooltip=\"true\"\n\t\t\t\t\t\t\t:is-guest=\"true\"\n\t\t\t\t\t\t\t:size=\"24\"\n\t\t\t\t\t\t\t:user=\"mail\" />\n\t\t\t\t\t</template>\n\t\t\t\t</NcChip>\n\t\t\t</div>\n\t\t</template>\n\t</div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport Share from '../../models/Share'\n\nimport { defineComponent } from 'vue'\nimport { generateUrl, getBaseUrl } from '@nextcloud/router'\nimport { showError, showSuccess } from '@nextcloud/dialogs'\nimport { translate, translatePlural } from '@nextcloud/l10n'\n\nimport NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'\nimport NcInputField from '@nextcloud/vue/dist/Components/NcInputField.js'\nimport NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'\nimport NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'\nimport NcChip from '@nextcloud/vue/dist/Components/NcChip.js'\n\nimport IconCheck from 'vue-material-design-icons/Check.vue'\nimport IconClipboard from 'vue-material-design-icons/Clipboard.vue'\n\nexport default defineComponent({\n\tname: 'NewFileRequestDialogFinish',\n\n\tcomponents: {\n\t\tIconCheck,\n\t\tIconClipboard,\n\t\tNcAvatar,\n\t\tNcInputField,\n\t\tNcNoteCard,\n\t\tNcTextField,\n\t\tNcChip,\n\t},\n\n\tprops: {\n\t\tshare: {\n\t\t\ttype: Object as PropType<Share>,\n\t\t\trequired: true,\n\t\t},\n\t\temails: {\n\t\t\ttype: Array as PropType<string[]>,\n\t\t\trequired: true,\n\t\t},\n\t\tisShareByMailEnabled: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true,\n\t\t},\n\t},\n\n\temits: ['add-email', 'remove-email'],\n\n\tsetup() {\n\t\treturn {\n\t\t\tn: translatePlural,\n\t\t\tt: translate,\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tisCopied: false,\n\t\t\temail: '',\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tshareLink() {\n\t\t\treturn generateUrl('/s/{token}', { token: this.share.token }, { baseURL: getBaseUrl() })\n\t\t},\n\t},\n\n\tmethods: {\n\t\tasync copyShareLink(event: MouseEvent) {\n\t\t\tif (this.isCopied) {\n\t\t\t\tthis.isCopied = false\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!navigator.clipboard) {\n\t\t\t\t// Clipboard API not available\n\t\t\t\twindow.prompt(this.t('files_sharing', 'Automatically copying failed, please copy the share link manually'), this.shareLink)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tawait navigator.clipboard.writeText(this.shareLink)\n\n\t\t\tshowSuccess(this.t('files_sharing', 'Link copied to clipboard'))\n\t\t\tthis.isCopied = true\n\t\t\tevent.target?.select?.()\n\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.isCopied = false\n\t\t\t}, 3000)\n\t\t},\n\n\t\taddNewEmail(e: KeyboardEvent) {\n\t\t\tif (e.target instanceof HTMLInputElement) {\n\t\t\t\tif (e.target.checkValidity() === false) {\n\t\t\t\t\te.target.reportValidity()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// The email is already in the list\n\t\t\t\tif (this.emails.includes(this.email.trim())) {\n\t\t\t\t\te.target.setCustomValidity(this.t('files_sharing', 'Email already added'))\n\t\t\t\t\te.target.reportValidity()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif (!this.isValidEmail(this.email.trim())) {\n\t\t\t\t\te.target.setCustomValidity(this.t('files_sharing', 'Invalid email address'))\n\t\t\t\t\te.target.reportValidity()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tthis.$emit('add-email', this.email.trim())\n\t\t\t\tthis.email = ''\n\t\t\t}\n\t\t},\n\n\t\t// Handle dumping a list of emails\n\t\tonPasteEmails(e: ClipboardEvent) {\n\t\t\tconst clipboardData = e.clipboardData\n\t\t\tif (!clipboardData) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst pastedText = clipboardData.getData('text')\n\t\t\tconst emails = pastedText.split(/[\\s,;]+/).filter(Boolean).map((email) => email.trim())\n\n\t\t\tconst duplicateEmails = emails.filter((email) => this.emails.includes(email))\n\t\t\tconst validEmails = emails.filter((email) => this.isValidEmail(email) && !duplicateEmails.includes(email))\n\t\t\tconst invalidEmails = emails.filter((email) => !this.isValidEmail(email))\n\t\t\tvalidEmails.forEach((email) => this.$emit('add-email', email))\n\n\t\t\t// Warn about invalid emails\n\t\t\tif (invalidEmails.length > 0) {\n\t\t\t\tshowError(this.n('files_sharing', 'The following email address is not valid: {emails}', 'The following email addresses are not valid: {emails}', invalidEmails.length, { emails: invalidEmails.join(', ') }))\n\t\t\t}\n\n\t\t\t// Warn about duplicate emails\n\t\t\tif (duplicateEmails.length > 0) {\n\t\t\t\tshowError(this.n('files_sharing', '1 email address already added', '{count} email addresses already added', duplicateEmails.length, { count: duplicateEmails.length }))\n\t\t\t}\n\n\t\t\tif (validEmails.length > 0) {\n\t\t\t\tshowSuccess(this.n('files_sharing', '1 email address added', '{count} email addresses added', validEmails.length, { count: validEmails.length }))\n\t\t\t}\n\n\t\t\tthis.email = ''\n\t\t},\n\n\t\tisValidEmail(email) {\n\t\t\tconst regExpEmail = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\t\t\treturn regExpEmail.test(email)\n\t\t},\n\t},\n})\n<\/script>\n<style scoped>\n.input-field,\n.file-request-dialog__emails {\n\tmargin-top: var(--secondary-margin);\n}\n\n.file-request-dialog__emails {\n\tdisplay: flex;\n\tgap: var(--default-grid-baseline);\n\tflex-wrap: wrap;\n}\n</style>\n"],sourceRoot:""}]);const l=r},12640:(t,e,i)=>{i.d(e,{A:()=>l});var n=i(71354),a=i.n(n),s=i(76314),r=i.n(s)()(a());r.push([t.id,"\n.file-request-dialog__note[data-v-28f44d6d] textarea {\n\twidth: 100% !important;\n\tmin-height: 80px;\n}\n","",{version:3,sources:["webpack://./apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogIntro.vue"],names:[],mappings:";AAoJA;CACA,sBAAA;CACA,gBAAA;AACA",sourcesContent:["\x3c!--\n - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n--\x3e\n\n<template>\n\t<div>\n\t\t\x3c!-- Request label --\x3e\n\t\t<fieldset class=\"file-request-dialog__label\" data-cy-file-request-dialog-fieldset=\"label\">\n\t\t\t<legend>\n\t\t\t\t{{ t('files_sharing', 'What are you requesting?') }}\n\t\t\t</legend>\n\t\t\t<NcTextField :value=\"label\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:label=\"t('files_sharing', 'Request subject')\"\n\t\t\t\t:placeholder=\"t('files_sharing', 'Birthday party photos, History assignment…')\"\n\t\t\t\t:required=\"false\"\n\t\t\t\tname=\"label\"\n\t\t\t\t@update:value=\"$emit('update:label', $event)\" />\n\t\t</fieldset>\n\n\t\t\x3c!-- Request destination --\x3e\n\t\t<fieldset class=\"file-request-dialog__destination\" data-cy-file-request-dialog-fieldset=\"destination\">\n\t\t\t<legend>\n\t\t\t\t{{ t('files_sharing', 'Where should these files go?') }}\n\t\t\t</legend>\n\t\t\t<NcTextField :value=\"destination\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:helper-text=\"t('files_sharing', 'The uploaded files are visible only to you unless you choose to share them.')\"\n\t\t\t\t:label=\"t('files_sharing', 'Upload destination')\"\n\t\t\t\t:minlength=\"2/* cannot share root */\"\n\t\t\t\t:placeholder=\"t('files_sharing', 'Select a destination')\"\n\t\t\t\t:readonly=\"false /* cannot validate a readonly input */\"\n\t\t\t\t:required=\"true /* cannot be empty */\"\n\t\t\t\t:show-trailing-button=\"destination !== context.path\"\n\t\t\t\t:trailing-button-icon=\"'undo'\"\n\t\t\t\t:trailing-button-label=\"t('files_sharing', 'Revert to default')\"\n\t\t\t\tname=\"destination\"\n\t\t\t\t@click=\"onPickDestination\"\n\t\t\t\t@keypress.prevent.stop=\"/* prevent typing in the input, we use the picker */\"\n\t\t\t\t@paste.prevent.stop=\"/* prevent pasting in the input, we use the picker */\"\n\t\t\t\t@trailing-button-click=\"$emit('update:destination', '')\">\n\t\t\t\t<IconFolder :size=\"18\" />\n\t\t\t</NcTextField>\n\t\t</fieldset>\n\n\t\t\x3c!-- Request note --\x3e\n\t\t<fieldset class=\"file-request-dialog__note\" data-cy-file-request-dialog-fieldset=\"note\">\n\t\t\t<legend>\n\t\t\t\t{{ t('files_sharing', 'Add a note') }}\n\t\t\t</legend>\n\t\t\t<NcTextArea :value=\"note\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:label=\"t('files_sharing', 'Note for recipient')\"\n\t\t\t\t:placeholder=\"t('files_sharing', 'Add a note to help people understand what you are requesting.')\"\n\t\t\t\t:required=\"false\"\n\t\t\t\tname=\"note\"\n\t\t\t\t@update:value=\"$emit('update:note', $event)\" />\n\t\t</fieldset>\n\t</div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { Folder, Node } from '@nextcloud/files'\n\nimport { defineComponent } from 'vue'\nimport { getFilePickerBuilder } from '@nextcloud/dialogs'\nimport { translate } from '@nextcloud/l10n'\n\nimport IconFolder from 'vue-material-design-icons/Folder.vue'\nimport NcTextArea from '@nextcloud/vue/dist/Components/NcTextArea.js'\nimport NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'\n\nexport default defineComponent({\n\tname: 'NewFileRequestDialogIntro',\n\n\tcomponents: {\n\t\tIconFolder,\n\t\tNcTextArea,\n\t\tNcTextField,\n\t},\n\n\tprops: {\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false,\n\t\t\tdefault: false,\n\t\t},\n\t\tcontext: {\n\t\t\ttype: Object as PropType<Folder>,\n\t\t\trequired: true,\n\t\t},\n\t\tlabel: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tdestination: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tnote: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t},\n\n\temits: [\n\t\t'update:destination',\n\t\t'update:label',\n\t\t'update:note',\n\t],\n\n\tsetup() {\n\t\treturn {\n\t\t\tt: translate,\n\t\t}\n\t},\n\n\tmethods: {\n\t\tonPickDestination() {\n\t\t\tconst filepicker = getFilePickerBuilder(this.t('files_sharing', 'Select a destination'))\n\t\t\t\t.addMimeTypeFilter('httpd/unix-directory')\n\t\t\t\t.allowDirectories(true)\n\t\t\t\t.addButton({\n\t\t\t\t\tlabel: this.t('files_sharing', 'Select'),\n\t\t\t\t\tcallback: this.onPickedDestination,\n\t\t\t\t})\n\t\t\t\t.setFilter(node => node.path !== '/')\n\t\t\t\t.startAt(this.destination)\n\t\t\t\t.build()\n\t\t\ttry {\n\t\t\t\tfilepicker.pick()\n\t\t\t} catch (e) {\n\t\t\t\t// ignore cancel\n\t\t\t}\n\t\t},\n\n\t\tonPickedDestination(nodes: Node[]) {\n\t\t\tconst node = nodes[0]\n\t\t\tif (node) {\n\t\t\t\tthis.$emit('update:destination', node.path)\n\t\t\t}\n\t\t},\n\t},\n})\n<\/script>\n<style scoped>\n.file-request-dialog__note :deep(textarea) {\n\twidth: 100% !important;\n\tmin-height: 80px;\n}\n</style>\n"],sourceRoot:""}]);const l=r},34845:(t,e,i)=>{i.r(e),i.d(e,{default:()=>yt});var n=i(85471),a=i(61338),s=i(63814),r=i(49584),l=i(77905),o=i(85168),d=i(53334),c=i(65043),u=i(54332),p=i(94219),h=i(84237),f=i(52201),m=i(85338),g=i(9191),A=i(7145),v=i(32073),C=i(31126),_=i(16044);const y={name:"AutoFixIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var b=i(14486);const x=(0,b.A)(y,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon auto-fix-icon",attrs:{"aria-hidden":!t.title||null,"aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M7.5,5.6L5,7L6.4,4.5L5,2L7.5,3.4L10,2L8.6,4.5L10,7L7.5,5.6M19.5,15.4L22,14L20.6,16.5L22,19L19.5,17.6L17,19L18.4,16.5L17,14L19.5,15.4M22,2L20.6,4.5L22,7L19.5,5.6L17,7L18.4,4.5L17,2L19.5,3.4L22,2M13.34,12.78L15.78,10.34L13.66,8.22L11.22,10.66L13.34,12.78M14.37,7.29L16.71,9.63C17.1,10 17.1,10.65 16.71,11.04L5.04,22.71C4.65,23.1 4,23.1 3.63,22.71L1.29,20.37C0.9,20 0.9,19.35 1.29,18.96L12.96,7.29C13.35,6.9 14,6.9 14.37,7.29Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports;var w=i(98215);const E=new A.A,N=(0,n.pM)({name:"NewFileRequestDialogDatePassword",components:{IconPasswordGen:x,NcButton:u.A,NcCheckboxRadioSwitch:v.A,NcDateTimePickerNative:C.A,NcNoteCard:f.A,NcPasswordField:_.A},props:{disabled:{type:Boolean,required:!1,default:!1},expirationDate:{type:Date,required:!1,default:null},password:{type:String,required:!1,default:null}},emits:["update:expirationDate","update:password"],setup:()=>({t:d.Tl,defaultExpireDate:E.defaultExpireDate,defaultExpireDateEnabled:E.isDefaultExpireDateEnabled,defaultExpireDateEnforced:E.isDefaultExpireDateEnforced,enableLinkPasswordByDefault:E.enableLinkPasswordByDefault,enforcePasswordForPublicLink:E.enforcePasswordForPublicLink}),data:()=>({maxDate:null,minDate:new Date((new Date).setDate((new Date).getDate()+1))}),computed:{passwordAndExpirationSummary(){return this.expirationDate&&this.password?this.t("files_sharing","The request will expire on {date} at midnight and will be password protected.",{date:this.expirationDate.toLocaleDateString()}):this.expirationDate?this.t("files_sharing","The request will expire on {date} at midnight.",{date:this.expirationDate.toLocaleDateString()}):this.password?this.t("files_sharing","The request will be password protected."):""}},mounted(){this.defaultExpireDate&&this.$emit("update:expirationDate",E.defaultExpirationDate),this.defaultExpireDateEnforced&&(this.maxDate=E.defaultExpirationDate),this.enableLinkPasswordByDefault&&this.generatePassword()},methods:{onToggleDeadline(t){this.$emit("update:expirationDate",t?new Date:null)},async onTogglePassword(t){t?this.generatePassword():this.$emit("update:password",null)},async onGeneratePassword(){await this.generatePassword(),this.showPassword()},async generatePassword(){await(0,w.A)().then((t=>{this.$emit("update:password",t)}))},showPassword(){this.$refs.passwordField.isPasswordHidden=!1}}});var S=i(85072),k=i.n(S),D=i(97825),q=i.n(D),P=i(77659),T=i.n(P),B=i(55056),L=i.n(B),F=i(10540),I=i.n(F),R=i(41113),z=i.n(R),$=i(28587),M={};M.styleTagTransform=z(),M.setAttributes=L(),M.insert=T().bind(null,"head"),M.domAPI=q(),M.insertStyleElement=I(),k()($.A,M),$.A&&$.A.locals&&$.A.locals;const j=(0,b.A)(N,(function(){var t=this,e=t._self._c;return t._self._setupProxy,e("div",[t.passwordAndExpirationSummary?e("NcNoteCard",{attrs:{type:"success"}},[t._v("\n\t\t"+t._s(t.passwordAndExpirationSummary)+"\n\t")]):t._e(),t._v(" "),e("fieldset",{staticClass:"file-request-dialog__expiration",attrs:{"data-cy-file-request-dialog-fieldset":"expiration"}},[t.defaultExpireDateEnforced?e("NcNoteCard",{attrs:{type:"info"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Your administrator has enforced a default expiration date with a maximum {days} days.",{days:t.defaultExpireDate}))+"\n\t\t")]):t._e(),t._v(" "),e("legend",[t._v(t._s(t.t("files_sharing","When should the request expire?")))]),t._v(" "),e("NcCheckboxRadioSwitch",{directives:[{name:"show",rawName:"v-show",value:!t.defaultExpireDateEnforced,expression:"!defaultExpireDateEnforced"}],attrs:{checked:t.defaultExpireDateEnforced||null!==t.expirationDate,disabled:t.disabled||t.defaultExpireDateEnforced},on:{"update:checked":t.onToggleDeadline}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Set a submission expirationDate"))+"\n\t\t")]),t._v(" "),null!==t.expirationDate?e("NcDateTimePickerNative",{attrs:{id:"file-request-dialog-expirationDate",disabled:t.disabled,"hide-label":!0,label:t.t("files_sharing","Expiration date"),max:t.maxDate,min:t.minDate,placeholder:t.t("files_sharing","Select a date"),required:t.defaultExpireDateEnforced,value:t.expirationDate,name:"expirationDate",type:"date"},on:{"update:value":function(e){return t.$emit("update:expirationDate",e)}}}):t._e()],1),t._v(" "),e("fieldset",{staticClass:"file-request-dialog__password",attrs:{"data-cy-file-request-dialog-fieldset":"password"}},[t.enforcePasswordForPublicLink?e("NcNoteCard",{attrs:{type:"info"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Your administrator has enforced a password protection."))+"\n\t\t")]):t._e(),t._v(" "),e("legend",[t._v(t._s(t.t("files_sharing","What password should be used for the request?")))]),t._v(" "),e("NcCheckboxRadioSwitch",{directives:[{name:"show",rawName:"v-show",value:!t.enforcePasswordForPublicLink,expression:"!enforcePasswordForPublicLink"}],attrs:{checked:t.enforcePasswordForPublicLink||null!==t.password,disabled:t.disabled||t.enforcePasswordForPublicLink},on:{"update:checked":t.onTogglePassword}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Set a password"))+"\n\t\t")]),t._v(" "),null!==t.password?e("div",{staticClass:"file-request-dialog__password-field"},[e("NcPasswordField",{ref:"passwordField",attrs:{"check-password-strength":!0,disabled:t.disabled,label:t.t("files_sharing","Password"),placeholder:t.t("files_sharing","Enter a valid password"),required:!1,value:t.password,name:"password"},on:{"update:value":function(e){return t.$emit("update:password",e)}}}),t._v(" "),e("NcButton",{attrs:{"aria-label":t.t("files_sharing","Generate a new password"),title:t.t("files_sharing","Generate a new password"),type:"tertiary-no-background"},on:{click:t.onGeneratePassword},scopedSlots:t._u([{key:"icon",fn:function(){return[e("IconPasswordGen",{attrs:{size:20}})]},proxy:!0}],null,!1,1334968784)})],1):t._e()],1)],1)}),[],!1,null,"7877828d",null).exports;var V=i(62405),G=i(41944),O=i(8369),H=i(82182),W=i(235),X={};X.styleTagTransform=z(),X.setAttributes=L(),X.insert=T().bind(null,"head"),X.domAPI=q(),X.insertStyleElement=I(),k()(W.A,X),W.A&&W.A.locals&&W.A.locals;var U=i(29453),Y=i(60597),Z=i(89257),Q=i(15676),J=i(85156);(0,U.r)(U.q);const K=(0,n.pM)({name:"NcChip",components:{NcActions:Y.N,NcActionButton:Z.A,NcIconSvgWrapper:Q.N},props:{ariaLabelClose:{type:String,default:(0,U.a)("Close")},text:{type:String,default:""},type:{type:String,default:"secondary",validator:t=>["primary","secondary","tertiary"].includes(t)},iconPath:{type:String,default:null},iconSvg:{type:String,default:null},noClose:{type:Boolean,default:!1}},emits:["close"],setup:()=>({mdiClose:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"}),computed:{canClose(){return!this.noClose},hasActions(){var t;return this.canClose||void 0!==(null==(t=this.$slots)?void 0:t.actions)||void 0!==this.$scopedSlots.actions}},methods:{t:U.a,onClose(){this.$emit("close")}}});var tt=function(){var t=this,e=t._self._c;return t._self._setupProxy,e("div",{staticClass:"nc-chip",class:{["nc-chip--".concat(t.type)]:!0,"nc-chip--no-actions":!t.hasActions}},[e("span",{staticClass:"nc-chip__icon"},[t._t("icon",(function(){return[t.iconPath||t.iconSvg?e("NcIconSvgWrapper",{attrs:{inline:"",path:t.iconPath,svg:t.iconPath?void 0:t.iconSvg,size:18}}):t._e()]}))],2),e("span",{staticClass:"nc-chip__text"},[t._t("default",(function(){return[t._v(t._s(t.text))]}))],2),t.hasActions?e("NcActions",{staticClass:"nc-chip__actions",attrs:{"force-menu":!t.canClose,type:"tertiary-no-background"}},[t.canClose?e("NcActionButton",{attrs:{"close-after-click":""},on:{click:t.onClose},scopedSlots:t._u([{key:"icon",fn:function(){return[e("NcIconSvgWrapper",{attrs:{path:t.mdiClose,size:20}})]},proxy:!0}],null,!1,2592946578)},[t._v(" "+t._s(t.ariaLabelClose)+" ")]):t._e(),t._t("actions")],2):t._e()],1)},et=[];const it=(0,J.n)(K,tt,et,!1,null,"e01fcb1e",null,null).exports,nt={name:"ClipboardIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},at=(0,b.A)(nt,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon clipboard-icon",attrs:{"aria-hidden":!t.title||null,"aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M19,3H14.82C14.4,1.84 13.3,1 12,1C10.7,1 9.6,1.84 9.18,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M12,3A1,1 0 0,1 13,4A1,1 0 0,1 12,5A1,1 0 0,1 11,4A1,1 0 0,1 12,3"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports,st=(0,n.pM)({name:"NewFileRequestDialogFinish",components:{IconCheck:m.A,IconClipboard:at,NcAvatar:G.A,NcInputField:O.A,NcNoteCard:f.A,NcTextField:H.A,NcChip:it},props:{share:{type:Object,required:!0},emails:{type:Array,required:!0},isShareByMailEnabled:{type:Boolean,required:!0}},emits:["add-email","remove-email"],setup:()=>({n:d.zw,t:d.Tl}),data:()=>({isCopied:!1,email:""}),computed:{shareLink(){return(0,s.Jv)("/s/{token}",{token:this.share.token},{baseURL:(0,s.$_)()})}},methods:{async copyShareLink(t){var e,i;this.isCopied?this.isCopied=!1:navigator.clipboard?(await navigator.clipboard.writeText(this.shareLink),(0,o.Te)(this.t("files_sharing","Link copied to clipboard")),this.isCopied=!0,null===(e=t.target)||void 0===e||null===(i=e.select)||void 0===i||i.call(e),setTimeout((()=>{this.isCopied=!1}),3e3)):window.prompt(this.t("files_sharing","Automatically copying failed, please copy the share link manually"),this.shareLink)},addNewEmail(t){if(t.target instanceof HTMLInputElement){if(!1===t.target.checkValidity())return void t.target.reportValidity();if(this.emails.includes(this.email.trim()))return t.target.setCustomValidity(this.t("files_sharing","Email already added")),void t.target.reportValidity();if(!this.isValidEmail(this.email.trim()))return t.target.setCustomValidity(this.t("files_sharing","Invalid email address")),void t.target.reportValidity();this.$emit("add-email",this.email.trim()),this.email=""}},onPasteEmails(t){const e=t.clipboardData;if(!e)return;const i=e.getData("text").split(/[\s,;]+/).filter(Boolean).map((t=>t.trim())),n=i.filter((t=>this.emails.includes(t))),a=i.filter((t=>this.isValidEmail(t)&&!n.includes(t))),s=i.filter((t=>!this.isValidEmail(t)));a.forEach((t=>this.$emit("add-email",t))),s.length>0&&(0,o.Qg)(this.n("files_sharing","The following email address is not valid: {emails}","The following email addresses are not valid: {emails}",s.length,{emails:s.join(", ")})),n.length>0&&(0,o.Qg)(this.n("files_sharing","1 email address already added","{count} email addresses already added",n.length,{count:n.length})),a.length>0&&(0,o.Te)(this.n("files_sharing","1 email address added","{count} email addresses added",a.length,{count:a.length})),this.email=""},isValidEmail:t=>/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t)}});var rt=i(25684),lt={};lt.styleTagTransform=z(),lt.setAttributes=L(),lt.insert=T().bind(null,"head"),lt.domAPI=q(),lt.insertStyleElement=I(),k()(rt.A,lt),rt.A&&rt.A.locals&&rt.A.locals;const ot=(0,b.A)(st,(function(){var t=this,e=t._self._c;return t._self._setupProxy,e("div",[e("NcNoteCard",{attrs:{type:"success"}},[t._v("\n\t\t"+t._s(t.t("files_sharing","Once created, you can share the link below to allow people to upload files to your directory."))+"\n\t")]),t._v(" "),e("NcInputField",{ref:"clipboard",attrs:{value:t.shareLink,label:t.t("files_sharing","Share link"),readonly:!0,"show-trailing-button":!0,"trailing-button-label":t.t("files_sharing","Copy to clipboard")},on:{click:t.copyShareLink,"click-trailing-button":t.copyShareLink},scopedSlots:t._u([{key:"trailing-button-icon",fn:function(){return[t.isCopied?e("IconCheck",{attrs:{size:20}}):e("IconClipboard",{attrs:{size:20}})]},proxy:!0}])}),t._v(" "),t.isShareByMailEnabled?[e("NcTextField",{attrs:{value:t.email,label:t.t("files_sharing","Send link via email"),placeholder:t.t("files_sharing","Enter an email address or paste a list"),type:"email"},on:{"update:value":function(e){t.email=e},keypress:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:(e.stopPropagation(),t.addNewEmail.apply(null,arguments))},paste:function(e){return e.stopPropagation(),e.preventDefault(),t.onPasteEmails.apply(null,arguments)}}}),t._v(" "),t.emails.length>0?e("div",{staticClass:"file-request-dialog__emails"},t._l(t.emails,(function(i){return e("NcChip",{key:i,attrs:{"aria-label-close":t.t("files_sharing","Remove email"),text:i},on:{close:function(e){return t.$emit("remove-email",i)}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("NcAvatar",{attrs:{"disable-menu":!0,"disable-tooltip":!0,"is-guest":!0,size:24,user:i}})]},proxy:!0}],null,!0)})})),1):t._e()]:t._e()],2)}),[],!1,null,"1ec2f06f",null).exports;var dt=i(11358),ct=i(42740);const ut=(0,n.pM)({name:"NewFileRequestDialogIntro",components:{IconFolder:dt.A,NcTextArea:ct.A,NcTextField:H.A},props:{disabled:{type:Boolean,required:!1,default:!1},context:{type:Object,required:!0},label:{type:String,required:!0},destination:{type:String,required:!0},note:{type:String,required:!0}},emits:["update:destination","update:label","update:note"],setup:()=>({t:d.Tl}),methods:{onPickDestination(){const t=(0,o.a1)(this.t("files_sharing","Select a destination")).addMimeTypeFilter("httpd/unix-directory").allowDirectories(!0).addButton({label:this.t("files_sharing","Select"),callback:this.onPickedDestination}).setFilter((t=>"/"!==t.path)).startAt(this.destination).build();try{t.pick()}catch(t){}},onPickedDestination(t){const e=t[0];e&&this.$emit("update:destination",e.path)}}});var pt=i(12640),ht={};ht.styleTagTransform=z(),ht.setAttributes=L(),ht.insert=T().bind(null,"head"),ht.domAPI=q(),ht.insertStyleElement=I(),k()(pt.A,ht),pt.A&&pt.A.locals&&pt.A.locals;const ft=(0,b.A)(ut,(function(){var t=this,e=t._self._c;return t._self._setupProxy,e("div",[e("fieldset",{staticClass:"file-request-dialog__label",attrs:{"data-cy-file-request-dialog-fieldset":"label"}},[e("legend",[t._v("\n\t\t\t"+t._s(t.t("files_sharing","What are you requesting?"))+"\n\t\t")]),t._v(" "),e("NcTextField",{attrs:{value:t.label,disabled:t.disabled,label:t.t("files_sharing","Request subject"),placeholder:t.t("files_sharing","Birthday party photos, History assignment…"),required:!1,name:"label"},on:{"update:value":function(e){return t.$emit("update:label",e)}}})],1),t._v(" "),e("fieldset",{staticClass:"file-request-dialog__destination",attrs:{"data-cy-file-request-dialog-fieldset":"destination"}},[e("legend",[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Where should these files go?"))+"\n\t\t")]),t._v(" "),e("NcTextField",{attrs:{value:t.destination,disabled:t.disabled,"helper-text":t.t("files_sharing","The uploaded files are visible only to you unless you choose to share them."),label:t.t("files_sharing","Upload destination"),minlength:2,placeholder:t.t("files_sharing","Select a destination"),readonly:!1,required:!0,"show-trailing-button":t.destination!==t.context.path,"trailing-button-icon":"undo","trailing-button-label":t.t("files_sharing","Revert to default"),name:"destination"},on:{click:t.onPickDestination,keypress:function(t){t.preventDefault(),t.stopPropagation()},paste:function(t){t.preventDefault(),t.stopPropagation()},"trailing-button-click":function(e){return t.$emit("update:destination","")}}},[e("IconFolder",{attrs:{size:18}})],1)],1),t._v(" "),e("fieldset",{staticClass:"file-request-dialog__note",attrs:{"data-cy-file-request-dialog-fieldset":"note"}},[e("legend",[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Add a note"))+"\n\t\t")]),t._v(" "),e("NcTextArea",{attrs:{value:t.note,disabled:t.disabled,label:t.t("files_sharing","Note for recipient"),placeholder:t.t("files_sharing","Add a note to help people understand what you are requesting."),required:!1,name:"note"},on:{"update:value":function(e){return t.$emit("update:note",e)}}})],1)])}),[],!1,null,"28f44d6d",null).exports;var mt,gt=i(62746);!function(t){t[t.FIRST=0]="FIRST",t[t.SECOND=1]="SECOND",t[t.LAST=2]="LAST"}(mt||(mt={}));const At=new A.A,vt=(0,n.pM)({name:"NewFileRequestDialog",components:{FileRequestDatePassword:j,FileRequestFinish:ot,FileRequestIntro:ft,IconCheck:m.A,IconNext:g.A,NcButton:u.A,NcDialog:p.A,NcLoadingIcon:h.A,NcNoteCard:f.A},props:{context:{type:Object,required:!0},content:{type:Array,required:!0}},setup:()=>({STEP:mt,n:d.zw,t:d.Tl,isShareByMailEnabled:At.isMailShareAllowed}),data(){return{currentStep:mt.FIRST,loading:!1,destination:this.context.path||"/",label:"",note:"",expirationDate:null,password:null,share:null,emails:[]}},computed:{finishButtonLabel(){return 0===this.emails.length?this.t("files_sharing","Close"):this.n("files_sharing","Close and send email","Close and send {count} emails",this.emails.length,{count:this.emails.length})}},methods:{onPageNext(){const t=this.$refs.form;if(t.checkValidity()||t.reportValidity(),"/"===this.destination||""===this.destination){const e=t.querySelector('input[name="destination"]');return null==e||e.setCustomValidity(this.t("files_sharing","Please select a folder, you cannot share the root directory.")),void t.reportValidity()}this.currentStep!==mt.FIRST?this.createShare():this.currentStep=mt.SECOND},onRemoveEmail(t){const e=this.emails.indexOf(t);this.emails.splice(e,1)},onCancel(){this.$emit("close")},async onFinish(){if(0===this.emails.length||!1===this.isShareByMailEnabled)return(0,o.Te)(this.t("files_sharing","File request created")),void this.$emit("close");await this.setShareEmails(),await this.sendEmails(),(0,o.Te)(this.t("files_sharing","File request created and emails sent")),this.$emit("close")},async createShare(){this.loading=!0;const t=this.expirationDate?this.expirationDate.toISOString().split("T")[0]:void 0,e=(0,s.KT)("apps/files_sharing/api/v1/shares");try{var i;const n=await c.Ay.post(e,{shareType:l.I.Email,permissions:r.aX.CREATE,label:this.label,path:this.destination,note:this.note,password:this.password||void 0,expireDate:t,shareWith:"",attributes:JSON.stringify([{value:!0,key:"enabled",scope:"fileRequest"}])});if(null==n||null===(i=n.data)||void 0===i||!i.ocs)throw n;const s=new V.A(n.data.ocs.data);this.share=s,gt.A.info("New file request created",{share:s}),(0,a.Ic)("files_sharing:share:created",{share:s}),this.currentStep=mt.LAST}catch(t){var n;const e=null==t||null===(n=t.response)||void 0===n||null===(n=n.data)||void 0===n||null===(n=n.ocs)||void 0===n||null===(n=n.meta)||void 0===n?void 0:n.message;throw(0,o.Qg)(e?this.t("files_sharing","Error creating the share: {errorMessage}",{errorMessage:e}):this.t("files_sharing","Error creating the share")),gt.A.error("Error while creating share",{error:t,errorMessage:e}),t}finally{this.loading=!1}},async setShareEmails(){var t;if(this.loading=!0,!this.share||null===(t=this.share)||void 0===t||!t.id)throw new Error("Share ID is missing");const e=(0,s.KT)("apps/files_sharing/api/v1/shares/{id}",{id:this.share.id});try{var i;const t=await c.Ay.put(e,{attributes:JSON.stringify([{value:this.emails,key:"emails",scope:"shareWith"}])});if(null==t||null===(i=t.data)||void 0===i||!i.ocs)throw t}catch(t){throw this.onEmailSendError(t),t}finally{this.loading=!1}},async sendEmails(){var t;if(this.loading=!0,!this.share||null===(t=this.share)||void 0===t||!t.id)throw new Error("Share ID is missing");const e=(0,s.KT)("apps/files_sharing/api/v1/shares/{id}/send-email",{id:this.share.id});try{var i;const t=await c.Ay.post(e,{password:this.password||void 0});if(null==t||null===(i=t.data)||void 0===i||!i.ocs)throw t}catch(t){throw this.onEmailSendError(t),t}finally{this.loading=!1}},onEmailSendError(t){var e;const i=null===(e=t.response)||void 0===e||null===(e=e.data)||void 0===e||null===(e=e.ocs)||void 0===e||null===(e=e.meta)||void 0===e?void 0:e.message;(0,o.Qg)(i?this.t("files_sharing","Error sending emails: {errorMessage}",{errorMessage:i}):this.t("files_sharing","Error sending emails")),gt.A.error("Error while sending emails",{error:t,errorMessage:i})}}});var Ct=i(12103),_t={};_t.styleTagTransform=z(),_t.setAttributes=L(),_t.insert=T().bind(null,"head"),_t.domAPI=q(),_t.insertStyleElement=I(),k()(Ct.A,_t),Ct.A&&Ct.A.locals&&Ct.A.locals;const yt=(0,b.A)(vt,(function(){var t=this,e=t._self._c;return t._self._setupProxy,e("NcDialog",{staticClass:"file-request-dialog",attrs:{"can-close":"","data-cy-file-request-dialog":"","close-on-click-outside":!1,name:t.currentStep!==t.STEP.LAST?t.t("files_sharing","Create a file request"):t.t("files_sharing","File request created"),size:"normal"},on:{closing:t.onCancel},scopedSlots:t._u([{key:"actions",fn:function(){return[e("NcButton",{attrs:{"aria-label":t.t("files_sharing","Cancel"),disabled:t.loading,title:t.t("files_sharing","Cancel the file request creation"),"data-cy-file-request-dialog-controls":"cancel",type:"tertiary"},on:{click:t.onCancel}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Cancel"))+"\n\t\t")]),t._v(" "),e("span",{staticClass:"dialog__actions-separator"}),t._v(" "),e("NcButton",{directives:[{name:"show",rawName:"v-show",value:t.currentStep===t.STEP.SECOND,expression:"currentStep === STEP.SECOND"}],attrs:{"aria-label":t.t("files_sharing","Previous step"),disabled:t.loading,"data-cy-file-request-dialog-controls":"back",type:"tertiary"},on:{click:function(e){t.currentStep=t.STEP.FIRST}}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Previous step"))+"\n\t\t")]),t._v(" "),t.currentStep!==t.STEP.LAST?e("NcButton",{attrs:{"aria-label":t.t("files_sharing","Continue"),disabled:t.loading,"data-cy-file-request-dialog-controls":"next"},on:{click:t.onPageNext},scopedSlots:t._u([{key:"icon",fn:function(){return[t.loading?e("NcLoadingIcon"):e("IconNext",{attrs:{size:20}})]},proxy:!0}],null,!1,3563923451)},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Continue"))+"\n\t\t")]):e("NcButton",{attrs:{"aria-label":t.finishButtonLabel,disabled:t.loading,"data-cy-file-request-dialog-controls":"finish",type:"primary"},on:{click:t.onFinish},scopedSlots:t._u([{key:"icon",fn:function(){return[t.loading?e("NcLoadingIcon"):e("IconCheck",{attrs:{size:20}})]},proxy:!0}])},[t._v("\n\t\t\t"+t._s(t.finishButtonLabel)+"\n\t\t")])]},proxy:!0}])},[e("NcNoteCard",{directives:[{name:"show",rawName:"v-show",value:t.currentStep===t.STEP.FIRST,expression:"currentStep === STEP.FIRST"}],staticClass:"file-request-dialog__header",attrs:{type:"info"}},[e("p",{staticClass:"file-request-dialog__description",attrs:{id:"file-request-dialog-description"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Collect files from others even if they do not have an account."))+"\n\t\t\t"+t._s(t.t("files_sharing","To ensure you can receive files, verify you have enough storage available."))+"\n\t\t")])]),t._v(" "),e("form",{ref:"form",staticClass:"file-request-dialog__form",attrs:{"aria-describedby":"file-request-dialog-description","aria-label":t.t("files_sharing","File request"),"aria-live":"polite","data-cy-file-request-dialog-form":""},on:{submit:function(t){t.preventDefault(),t.stopPropagation()}}},[e("FileRequestIntro",{directives:[{name:"show",rawName:"v-show",value:t.currentStep===t.STEP.FIRST,expression:"currentStep === STEP.FIRST"}],attrs:{context:t.context,destination:t.destination,disabled:t.loading,label:t.label,note:t.note},on:{"update:destination":function(e){t.destination=e},"update:label":function(e){t.label=e},"update:note":function(e){t.note=e}}}),t._v(" "),e("FileRequestDatePassword",{directives:[{name:"show",rawName:"v-show",value:t.currentStep===t.STEP.SECOND,expression:"currentStep === STEP.SECOND"}],attrs:{disabled:t.loading,"expiration-date":t.expirationDate,password:t.password},on:{"update:expirationDate":function(e){t.expirationDate=e},"update:expiration-date":function(e){t.expirationDate=e},"update:password":function(e){t.password=e}}}),t._v(" "),t.share?e("FileRequestFinish",{directives:[{name:"show",rawName:"v-show",value:t.currentStep===t.STEP.LAST,expression:"currentStep === STEP.LAST"}],attrs:{emails:t.emails,"is-share-by-mail-enabled":t.isShareByMailEnabled,share:t.share},on:{"add-email":e=>t.emails.push(e),"remove-email":t.onRemoveEmail}}):t._e()],1)],1)}),[],!1,null,"3fbb7161",null).exports}}]);
  2. //# sourceMappingURL=4845-4845.js.map?v=5373c3bb24c1259a5cb7