/*! third party licenses: js/vendor.LICENSE.txt */ import{n as I,f as et,h as hs,m as D,u as Rt,s as Ft,p as Oe,N as st,l as tt,y as at,z as ms,A as fs,t as qe,g as ps,x as gs,a as vs}from"./modulepreload-polyfill-D-3Y8PUR.chunk.mjs";import{N as ys,u as _s,I as mt,V as Bt,T as ze,Q as bs,a as ws,b as Cs,c as Ss,d as Dt,e as Ot,D as ks,O,f as ft,m as F,g as lt,F as B,h as $e,i as Ue,j as gt,k as Ye,P as ct,l as As,n as Qe,o as vt,p as qt,q as zt,r as xs,S as Es,s as Ns,t as Is,v as je,w as Ls,x as Ts,y as Hs,z as Ms}from"./Submit-CxkhgMYM.chunk.mjs";import{V as X,k as Ze,l as Ps}from"./vendor-7ECin3h9.chunk.mjs";import{ay as Rs,az as Fs,aA as Vs,aB as it,c as M,aC as yt,aD as ot,aE as H,l as L,s as R,g as j,aF as Bs,aG as Ke,a as Ds,aH as Os,aI as Q,aJ as qs,aK as zs,b as We,aL as $s,aM as Us}from"./NcSettingsSection-b_zSpTHq-B7eBL4C7.chunk.mjs";import{d as pt,F as Wt}from"./mdi-B0x15VqF.chunk.mjs";import{a as $t,b as Ut,N as Ys}from"./NcEmptyContent-DVq07An-.chunk.mjs";import{I as Qs,F as Yt}from"./FormsIcon-DzC_xl6W.chunk.mjs";const ht="forms";const js={name:"LockOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Zs=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon lock-outline-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M12,17C10.89,17 10,16.1 10,15C10,13.89 10.89,13 12,13A2,2 0 0,1 14,15A2,2 0 0,1 12,17M18,20V10H6V20H18M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10C4,8.89 4.89,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},Ks=[],Ws=I(js,Zs,Ks,!1,null,null);const Js=Ws.exports,Gs={name:"NcActionCaption",inject:{isInSemanticMenu:{from:"NcActions:isSemanticMenu",default:!1}},props:{name:{type:String,required:!0}}};var Xs=function(){var e=this,s=e._self._c;return s("li",{staticClass:"app-navigation-caption",attrs:{role:e.isInSemanticMenu&&"presentation"}},[e._v(" "+e._s(e.name)+" ")])},ti=[],ei=et(Gs,Xs,ti,!1,null,"7bf21eca");const si=ei.exports,ii={name:"NcAppNavigationList"};var oi=function(){var e=this,s=e._self._c;return s("ul",{staticClass:"app-navigation-list"},[e._t("default")],2)},ri=[],ni=et(ii,oi,ri,!1,null,"058e6060");const ai=ni.exports,li={name:"NcAppNavigation",components:{NcAppNavigationList:ai,NcAppNavigationToggle:ys},inject:{setHasAppNavigation:{default:()=>()=>X.util.warn("NcAppNavigation is not mounted inside NcContent, this is probably an error."),from:"NcContent:setHasAppNavigation"}},props:{ariaLabel:{type:String,default:""},ariaLabelledby:{type:String,default:""}},setup(){return{isMobile:Oe()}},data(){return{open:!this.isMobile,focusTrap:null}},watch:{isMobile(){this.open=!this.isMobile,this.toggleFocusTrap()},open(){this.toggleFocusTrap()}},mounted(){this.setHasAppNavigation(!0),Ft("toggle-navigation",this.toggleNavigationByEventBus),D("navigation-toggled",{open:this.open}),this.focusTrap=Fs(this.$refs.appNavigationContainer,{allowOutsideClick:!0,fallbackFocus:this.$refs.appNavigationContainer,trapStack:Vs(),escapeDeactivates:!1}),this.toggleFocusTrap(),_s("n",this.onKeyDown,{prevent:!0,stop:!0})},unmounted(){this.setHasAppNavigation(!1),Rt("toggle-navigation",this.toggleNavigationByEventBus),this.focusTrap.deactivate()},methods:{async toggleNavigation(e){if(this.open===e){D("navigation-toggled",{open:this.open});return}this.open=typeof e>"u"?!this.open:e;const s=getComputedStyle(document.body),i=parseInt(s.getPropertyValue("--animation-quick"))||100;this.open&&(await this.$nextTick(),this.focusFirstElement()),setTimeout(()=>{D("navigation-toggled",{open:this.open})},1.5*i)},toggleNavigationByEventBus({open:e}){this.toggleNavigation(e)},toggleFocusTrap(){this.isMobile&&this.open?this.focusTrap.activate():this.focusTrap.deactivate()},handleEsc(){this.isMobile&&this.open&&this.toggleNavigation(!1)},focusFirstElement(){const e=Rs(this.$refs.appNavigationContainer)[0];e&&(e.focus(),hs.debug("Focusing first element in the navigation",{element:e}))},onKeyDown(e){if(e.key==="n"){if(!this.open){this.toggleNavigation(!0);return}this.isFocusWithinNavigation()&&this.toggleNavigation(!1)}},isFocusWithinNavigation(){const e=document.activeElement;return this.$refs.appNavigationContainer?.contains(e)}}};var ci=function(){var e=this,s=e._self._c;return s("div",{ref:"appNavigationContainer",staticClass:"app-navigation",class:{"app-navigation--close":!e.open}},[s("nav",{staticClass:"app-navigation__content",attrs:{id:"app-navigation-vue","aria-hidden":e.open?"false":"true","aria-label":e.ariaLabel||void 0,"aria-labelledby":e.ariaLabelledby||void 0,inert:!e.open||void 0},on:{keydown:function(i){return!i.type.indexOf("key")&&e._k(i.keyCode,"esc",27,i.key,["Esc","Escape"])?null:e.handleEsc.apply(null,arguments)}}},[s("div",{staticClass:"app-navigation__search"},[e._t("search")],2),s("div",{staticClass:"app-navigation__body",class:{"app-navigation__body--no-list":!e.$scopedSlots.list}},[e._t("default")],2),e.$scopedSlots.list?s("NcAppNavigationList",{staticClass:"app-navigation__list"},[e._t("list")],2):e._e(),e._t("footer")],2),s("NcAppNavigationToggle",{attrs:{open:e.open},on:{"update:open":e.toggleNavigation}})],1)},ui=[],di=et(li,ci,ui,!1,null,"119f2aad");const hi=di.exports,mi={name:"NcAppNavigationCaption",components:{NcActions:it},inheritAttrs:!1,props:{name:{type:String,required:!0},headingId:{type:String,default:null},isHeading:{type:Boolean,default:!1},headingLevel:{type:Number,default:2}," ":{}},computed:{wrapperTag(){return this.isHeading?"div":"li"},captionTag(){const e=Math.max(2,this.headingLevel);return this.isHeading?`h${e}`:"span"},hasActions(){return!!this.$slots.actions}}};var fi=function(){var e=this,s=e._self._c;return s(e.wrapperTag,{tag:"component",staticClass:"app-navigation-caption",class:{"app-navigation-caption--heading":e.isHeading}},[s(e.captionTag,{tag:"component",staticClass:"app-navigation-caption__name",attrs:{id:e.headingId}},[e._v(" "+e._s(e.name)+" ")]),e.hasActions?s("div",{staticClass:"app-navigation-caption__actions"},[s("NcActions",e._g(e._b({scopedSlots:e._u([{key:"icon",fn:function(){return[e._t("actionsTriggerIcon")]},proxy:!0}],null,!0)},"NcActions",e.$attrs,!1),e.$listeners),[e._t("actions")],2)],1):e._e()],1)},pi=[],gi=et(mi,fi,pi,!1,null,"fac69d4a");const vi=gi.exports,yi={components:{NcButton:st},props:{buttonId:{type:String,required:!1,default:""},disabled:{type:Boolean,required:!1,default:!1},text:{type:String,required:!0},type:{type:String,default:"primary",validator(e){return["primary","secondary","tertiary"].indexOf(e)!==-1}},variant:{type:String,default:"primary",validator(e){return["primary","secondary","tertiary"].indexOf(e)!==-1}}},emits:["click"]};var _i=function(){var e=this,s=e._self._c;return s("div",{staticClass:"app-navigation-new"},[s("NcButton",{attrs:{id:e.buttonId,disabled:e.disabled,variant:e.type!=="primary"?e.type:e.variant},on:{click:function(i){return e.$emit("click")}},scopedSlots:e._u([{key:"icon",fn:function(){return[e._t("icon")]},proxy:!0}],null,!0)},[e._v(" "+e._s(e.text)+" ")])],1)},bi=[],wi=et(yi,_i,bi,!1,null,"6f255eb3");const Ci=wi.exports,Si={name:"NcAppSidebarTab",inject:["registerTab","unregisterTab","getActiveTab","isTablistShown"],props:{id:{type:String,required:!0},name:{type:String,required:!0},icon:{type:String,default:""},order:{type:Number,default:0}},emits:["bottom-reached","scroll"],expose:["id","name","icon","order","renderIcon"],computed:{isActive(){return this.getActiveTab()===this.id}},created(){this.registerTab(this)},beforeDestroy(){this.unregisterTab(this.id)},methods:{onScroll(e){this.$el.scrollHeight-this.$el.scrollTop===this.$el.clientHeight&&this.$emit("bottom-reached",e),this.$emit("scroll",e)},renderIcon(){return this.$scopedSlots.icon?.()}}};var ki=function(){var e=this,s=e._self._c;return s("section",{staticClass:"app-sidebar__tab",class:{"app-sidebar__tab--active":e.isActive},attrs:{id:`tab-${e.id}`,"aria-hidden":!e.isActive,"aria-label":e.isTablistShown()?void 0:e.name,"aria-labelledby":e.isTablistShown()?`tab-button-${e.id}`:void 0,tabindex:e.isTablistShown()?0:-1,role:e.isTablistShown()?"tabpanel":void 0},on:{scroll:e.onScroll}},[s("h3",{staticClass:"hidden-visually"},[e._v(" "+e._s(e.name)+" ")]),e._t("default")],2)},Ai=[],xi=et(Si,ki,Ai,!1,null,"bc553f62");const Ei=xi.exports;window.axios=M;const Ni={name:"Create",components:{Draggable:ks,IconLock:Js,IconPlus:Ot,NcActionButton:ot,NcActions:it,NcAppContent:Ut,NcEmptyContent:$t,NcLoadingIcon:yt,NcNoteCard:Dt,Question:Ss,QuestionLong:Cs,QuestionShort:ws,QuestionMultiple:bs,TopBar:ze},mixins:[Bt],data(){return{answerTypes:lt,isLoadingQuestions:!1,isDragging:!1,maxStringLengths:tt("forms","maxStringLengths"),questionMenuOpened:!1}},computed:{hasQuestions(){return this.form.questions&&this.form.questions.length===0},isRequiredUsed(){return this.form.questions.reduce((e,s)=>e||s.isRequired,!1)},isExpired(){return this.form.expires&&F().unix()>this.form.expires},isFormArchived(){return this.form.state===B.FormArchived},infoMessage(){let e="";return this.form.isAnonymous&&(e+=t("forms","Responses are anonymous.")),this.form.isAnonymous||(e+=t("forms","Responses are connected to your account.")),this.isRequiredUsed&&(e+=" "+t("forms","An asterisk (*) indicates mandatory questions.")),e},expirationMessage(){const e=F(this.form.expires,"X").fromNow();return this.isExpired?t("forms","Expired {relativeDate}.",{relativeDate:e}):t("forms","Expires {relativeDate}.",{relativeDate:e})},answerTypesFilter(){const{datetime:e,...s}=lt;return s},lockedUntilFormatted(){return F(this.form.lockedUntil,"X").fromNow()}},watch:{hash(){this.fetchFullForm(this.form.id)},"form.title"(){ft(this.formTitle)},isLoadingForm(e){e||(this.resizeTitle(),this.resizeDescription())}},mounted(){this.fetchFullForm(this.form.id),ft(this.formTitle)},methods:{onMoveUp(e){e>0&&([this.form.questions[e-1],this.form.questions[e]]=[this.form.questions[e],this.form.questions[e-1]],this.onQuestionOrderChange())},onMoveDown(e){e{const e=this.$refs.title;e.style.cssText="height: 0",e.style.cssText=`height: ${e.scrollHeight+4}px`})},resizeDescription(){this.$nextTick(()=>{const e=this.$refs.description;e.style.cssText="height: 0",e.style.cssText=`height: ${e.scrollHeight+4}px`})},updateDescription({target:e}){this.form.description=e.value,this.resizeDescription(),this.saveDescription()},saveTitle:pt(async function(){this.saveFormProperty("title")},mt),saveDescription:pt(async function(){this.saveFormProperty("description")},mt),async addQuestion(e){this.isLoadingQuestions=!0;try{const s=await M.post(H("apps/forms/api/v3/forms/{id}/questions",{id:this.form.id}),{type:e,text:""}),i=O(s);this.form.questions.push(Object.assign({text:"",type:e,answers:[]},i)),this.$nextTick(()=>{this.$refs.questions[this.$refs.questions.length-1].focus()}),D("forms:last-updated:set",this.form.id)}catch(s){L.error("Error while adding new question",{error:s}),R(t("forms","There was an error while adding the new question"))}finally{this.isLoadingQuestions=!1}},async deleteQuestion(e){this.isLoadingQuestions=!0;try{await M.delete(H("apps/forms/api/v3/forms/{id}/questions/{questionId}",{id:this.form.id,questionId:e}));const s=this.form.questions.findIndex(i=>i.id===e);this.form.questions.splice(s,1),D("forms:last-updated:set",this.form.id)}catch(s){L.error(`Error while removing question ${e}`,{error:s}),R(t("forms","There was an error while removing the question"))}finally{this.isLoadingQuestions=!1}},async cloneQuestion({id:e}){this.isLoadingQuestions=!0;try{const s=await M.post(H("apps/forms/api/v3/forms/{id}/questions?fromId={questionId}",{id:this.form.id,questionId:e})),i=O(s);this.form.questions.push(Object.assign({answers:[]},i)),this.$nextTick(()=>{this.$refs.questions[this.$refs.questions.length-1].focus()})}catch(s){L.error(`Error while duplicating question ${e}`,{error:s}),R("There was an error while duplicating the question")}finally{this.isLoadingQuestions=!1}},async onQuestionOrderChange(){this.isLoadingQuestions=!0;const e=this.form.questions.map(s=>s.id);try{await M.patch(H("apps/forms/api/v3/forms/{id}/questions",{id:this.form.id}),{newOrder:e}),D("forms:last-updated:set",this.form.id)}catch(s){L.error("Error while saving form",{error:s}),R(t("forms","Error while saving form"))}finally{this.isLoadingQuestions=!1}}}};var Ii=function(){var e=this,s=e._self._c;return s("NcAppContent",{attrs:{"page-heading":e.form.title?e.t("forms","Edit form"):e.t("forms","Create form")}},[s("TopBar",{attrs:{archived:e.isFormArchived,locked:e.isFormLocked,permissions:e.form?.permissions,"sidebar-opened":e.sidebarOpened,"submission-count":e.form?.submissionCount},on:{"share-form":e.onShareForm}}),e.isLoadingForm?s("NcEmptyContent",{staticClass:"emtpycontent",attrs:{name:e.t("forms","Loading {title} …",{title:e.form.title})},scopedSlots:e._u([{key:"icon",fn:function(){return[s("NcLoadingIcon",{attrs:{size:64}})]},proxy:!0}],null,!1,826850984)}):e.isFormArchived?s("NcEmptyContent",{staticClass:"emtpycontent",attrs:{name:e.t("forms","Form is archived"),description:e.t("forms","Form '{title}' is archived and cannot be modified.",{title:e.form.title})},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconLock",{attrs:{size:64}})]},proxy:!0}])}):e.isFormLocked?s("NcEmptyContent",{staticClass:"emtpycontent",attrs:{name:e.t("forms","Form is locked"),description:e.t("forms","Form '{title}' is locked by {lockedBy} and cannot be modified. The lock expires: {lockedUntil}",{title:e.form.title,lockedBy:e.form.lockedBy,lockedUntil:e.form.lockedUntil===0?e.t("forms","never"):e.lockedUntilFormatted})},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconLock",{attrs:{size:64}})]},proxy:!0}])}):[s("header",[s("h2",[s("label",{staticClass:"hidden-visually",attrs:{for:"form-title"}},[e._v(e._s(e.t("forms","Form title")))]),s("textarea",{directives:[{name:"model",rawName:"v-model",value:e.form.title,expression:"form.title"}],ref:"title",staticClass:"form-title",attrs:{id:"form-title",rows:"1",dir:"auto",maxlength:e.maxStringLengths.formTitle,placeholder:e.t("forms","Form title"),required:"",autofocus:""},domProps:{value:e.form.title},on:{keydown:function(i){if(!i.type.indexOf("key")&&e._k(i.keyCode,"enter",13,i.key,"Enter"))return null;i.preventDefault()},input:[function(i){i.target.composing||e.$set(e.form,"title",i.target.value)},e.onTitleChange]}})]),s("label",{staticClass:"hidden-visually",attrs:{for:"form-desc"}},[e._v(" "+e._s(e.t("forms","Description"))+" ")]),s("textarea",{ref:"description",staticClass:"form-desc",attrs:{id:"form-desc",rows:"1",dir:"auto",placeholder:e.t("forms","Description (formatting using Markdown is supported)"),maxlength:e.maxStringLengths.formDescription},domProps:{value:e.form.description},on:{input:e.updateDescription}}),e._v(" "),e.form.expires&&e.form.showExpiration?s("p",{staticClass:"info-message"},[e._v(" "+e._s(e.expirationMessage)+" ")]):e._e(),e.infoMessage?s("p",{staticClass:"info-message"},[e._v(" "+e._s(e.infoMessage)+" ")]):e._e()]),s("section",[s("Draggable",{attrs:{animation:200,tag:"ul",handle:".question__drag-handle"},on:{change:e.onQuestionOrderChange,start:function(i){e.isDragging=!0},end:function(i){e.isDragging=!1}},model:{value:e.form.questions,callback:function(i){e.$set(e.form,"questions",i)},expression:"form.questions"}},[s("transition-group",{attrs:{name:e.isDragging?"no-external-transition-on-drag":"question-list"}},e._l(e.form.questions,function(i,o){return s(e.answerTypes[i.type].component,e._b({key:i.id,ref:"questions",refInFor:!0,tag:"component",attrs:{"can-move-down":o0,"answer-type":e.answerTypes[i.type],index:o+1,"max-string-lengths":e.maxStringLengths},on:{clone:function(r){return e.cloneQuestion(i)},delete:function(r){return e.deleteQuestion(i.id)},"move-down":function(r){return e.onMoveDown(o)},"move-up":function(r){return e.onMoveUp(o)}}},"component",e.form.questions[o],!1,!0))}),1)],1),s("div",{staticClass:"question-menu"},[s("NcActions",{ref:"questionMenu",attrs:{open:e.questionMenuOpened,"menu-name":e.t("forms","Add a question"),"aria-label":e.t("forms","Add a question"),primary:""},on:{"update:open":function(i){e.questionMenuOpened=i}},scopedSlots:e._u([{key:"icon",fn:function(){return[e.isLoadingQuestions?s("NcLoadingIcon",{attrs:{size:20}}):s("IconPlus",{attrs:{size:20}})]},proxy:!0}])},e._l(e.answerTypesFilter,function(i,o){return s("NcActionButton",{key:i.label,staticClass:"question-menu__question",attrs:{"close-after-click":"",disabled:e.isLoadingQuestions},on:{click:function(r){return e.addQuestion(o)}},scopedSlots:e._u([{key:"icon",fn:function(){return[s(i.icon,{tag:"Icon",attrs:{size:20}})]},proxy:!0}],null,!0)},[e._v(" "+e._s(i.label)+" ")])}),1)],1)],1)]],2)},Li=[],Ti=I(Ni,Ii,Li,!1,null,"9c5ed0aa");const Hi=Ti.exports,Mi='',Pi={name:"TrayArrowDownIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Ri=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon tray-arrow-down-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},Fi=[],Vi=I(Pi,Ri,Fi,!1,null,null);const Bi=Vi.exports,Di={name:"FileDelimitedOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Oi=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon file-delimited-outline-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2M18 20H6V4H13V9H18V20M10 19L12 15H9V10H15V15L13 19H10"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},qi=[],zi=I(Di,Oi,qi,!1,null,null);const $i=zi.exports,Je='',Ui={name:"FileExcelOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Yi=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon file-excel-outline-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M14 2H6C4.89 2 4 2.9 4 4V20C4 21.11 4.89 22 6 22H18C19.11 22 20 21.11 20 20V8L14 2M18 20H6V4H13V9H18V20M12.9 14.5L15.8 19H14L12 15.6L10 19H8.2L11.1 14.5L8.2 10H10L12 13.4L14 10H15.8L12.9 14.5Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},Qi=[],ji=I(Ui,Yi,Qi,!1,null,null);const Zi=ji.exports,Ge='',Ki={name:"FolderOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Wi=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon folder-outline-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},Ji=[],Gi=I(Ki,Wi,Ji,!1,null,null);const Xi=Gi.exports,to={name:"LinkIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var eo=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon link-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},so=[],io=I(to,eo,so,!1,null,null);const Xe=io.exports,oo='',ro={name:"LinkOffIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var no=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon link-off-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.43 19.12,14.63 17.79,15L19.25,16.44C20.88,15.61 22,13.95 22,12A5,5 0 0,0 17,7M16,11H13.81L15.81,13H16V11M2,4.27L5.11,7.38C3.29,8.12 2,9.91 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12C3.9,10.41 5.11,9.1 6.66,8.93L8.73,11H8V13H10.73L13,15.27V17H14.73L18.74,21L20,19.74L3.27,3L2,4.27Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},ao=[],lo=I(ro,no,ao,!1,null,null);const co=lo.exports,uo='',ho={name:"PollIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var mo=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon poll-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M3,22V8H7V22H3M10,22V2H14V22H10M17,22V14H21V22H17Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},fo=[],po=I(ho,mo,fo,!1,null,null);const ts=po.exports,go={name:"RefreshIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var vo=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon refresh-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},yo=[],_o=I(go,vo,yo,!1,null,null);const bo=_o.exports,wo={name:"TableIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Co=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon table-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M5,4H19A2,2 0 0,1 21,6V18A2,2 0 0,1 19,20H5A2,2 0 0,1 3,18V6A2,2 0 0,1 5,4M5,8V12H11V8H5M13,8V12H19V8H13M5,14V18H11V14H5M13,14V18H19V14H13Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},So=[],ko=I(wo,Co,So,!1,null,null);const Ao=ko.exports,es='',xo={name:"MagnifyIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Eo=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon magnify-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},No=[],Io=I(xo,Eo,No,!1,null,null);const Lo=Io.exports,To={name:"ResultsSummary",components:{IconFile:$e},props:{submissions:{type:Array,required:!0},question:{type:Object,required:!0}},data(){return{answerTypes:lt}},computed:{questionTypeLabel(){const e=this.answerTypes[this.question.type].label;if(this.question.type==="linearscale"){const s=this.question.extraSettings?.optionsLabelLowest??t("forms","Strongly disagree"),i=this.question.extraSettings?.optionsLabelHighest??t("forms","Strongly agree"),o=this.question.extraSettings?.optionsLowest?.toString()??"1",r=this.question.extraSettings?.optionsHighest?.toString()??"5",n=[];s!==""&&n.push(`${o}: ${s}`),i!==""&&n.push(`${r}: ${i}`);const a=` (${n.join(", ")})`;return e+a}return e},questionOptions(){let e;return this.question.type!=="linearscale"?e=this.question.options.map(s=>({...s,count:0,percentage:0})):e=Array.from({length:(this.question.extraSettings?.optionsHighest??5)-(this.question.extraSettings?.optionsLowest??1)+1},(s,i)=>({text:(i+(this.question.extraSettings?.optionsLowest??1)).toString(),count:0,percentage:0})),this.question.extraSettings?.allowOtherAnswer&&e.unshift({text:t("forms","Other"),count:0,percentage:0}),e.unshift({text:t("forms","No response"),count:0,percentage:0}),this.submissions.forEach(s=>{const i=s.answers.filter(o=>o.questionId===this.question.id);i.length||e[0].count++,i.forEach(o=>{const r=e.findIndex(n=>n.text===o.text);r<0?this.question.extraSettings?.allowOtherAnswer?e[1].count++:e.push({text:o.text,count:1,percentage:0}):e[r].count++})}),this.question.type!=="linearscale"?e.sort((s,i)=>i.count-s.count):e.push(e.shift()),e.forEach(s=>{s.percentage=Math.round(100*s.count/this.submissions.length);const i=Math.max(...e.map(o=>o.count));s.best=s.count===i}),e},answers(){const e=[];let s=0;this.submissions.forEach(o=>{const r=o.answers.filter(n=>n.questionId===this.question.id);r.length||s++,["date","time"].includes(this.question.type)&&r.length===2?e.push({id:`${r[0].id}-${r[1].id}`,text:`${r[0].text} - ${r[1].text}`}):r.forEach(n=>{n.fileId?e.push({id:n.id,text:n.text,url:j("/f/{fileId}",{fileId:n.fileId})}):e.push({id:n.id,text:n.text})})});const i=Math.round(100*s/this.submissions.length);return e.unshift({id:0,text:s+" ("+i+"%): "+t("forms","No response")}),e}}};var Ho=function(){var e=this,s=e._self._c;return s("div",{staticClass:"section question-summary"},[s("h3",{attrs:{dir:"auto"}},[e._v(" "+e._s(e.question.text)+" ")]),s("p",{staticClass:"question-summary__detail"},[e._v(" "+e._s(e.questionTypeLabel)+" ")]),e.answerTypes[e.question.type].predefined?s("ol",{staticClass:"question-summary__statistic"},e._l(e.questionOptions,function(i){return s("li",{key:i.id},[s("label",{attrs:{for:`option-${i.questionId}-${i.id}`}},[e._v(" "+e._s(i.count)+" "),s("span",{staticClass:"question-summary__statistic-percentage"},[e._v(" ("+e._s(i.percentage)+"%): ")]),s("span",{class:{"question-summary__statistic-text--best":i.best}},[e._v(" "+e._s(i.text)+" ")])]),s("meter",{attrs:{id:`option-${i.questionId}-${i.id}`,min:"0",max:e.submissions.length,value:i.count}})])}),0):s("ul",{staticClass:"question-summary__text"},e._l(e.answers,function(i,o){return s("li",{key:i.id,attrs:{dir:"auto"}},[i.url?[s("a",{attrs:{href:i.url,target:"_blank"}},[s("IconFile",{staticClass:"question-summary__text-icon",attrs:{size:20}}),e._v(" "+e._s(i.text)+" ")],1)]:e.question.type==="color"?[s("div",{staticClass:"color__result"},[i.id!==0?s("div",{class:o===1?"color__field color__field__first":"color__field",style:{"background-color":i.text}}):e._e(),e._v(" "+e._s(i.text)+" ")])]:[e._v(" "+e._s(i.text)+" ")]],2)}),0)])},Mo=[],Po=I(To,Ho,Mo,!1,null,"28e1727e");const Ro=Po.exports,Fo={name:"Answer",components:{IconFile:$e,NcHighlight:Bs},props:{answers:{type:Array,required:!1,default:()=>[]},answerText:{type:String,required:!1,default:""},questionText:{type:String,required:!0},questionType:{type:String,required:!0},highlight:{type:String,required:!1,default:""}}};var Vo=function(){var e=this,s=e._self._c;return s("div",{staticClass:"answer"},[s("h4",{staticClass:"answer__question-text",attrs:{dir:"auto"}},[e._v(" "+e._s(e.questionText)+" ")]),e.answers.length?e._l(e.answers,function(i){return s("p",{key:i.id,staticClass:"answer__text",attrs:{dir:"auto"}},[s("a",{attrs:{href:i.url,target:"_blank"}},[s("IconFile",{staticClass:"answer__text-icon",attrs:{size:20}}),s("NcHighlight",{attrs:{text:i.text,search:e.highlight}})],1)])}):e.questionType==="color"?[s("div",{staticClass:"color__result"},[s("div",{staticClass:"color__field",style:{"background-color":e.answerText}}),s("NcHighlight",{attrs:{text:e.answerText,search:e.highlight}})],1)]:s("p",{staticClass:"answer__text",attrs:{dir:"auto"}},[s("NcHighlight",{attrs:{text:e.answerText,search:e.highlight}})],1)],2)},Bo=[],Do=I(Fo,Vo,Bo,!1,null,"5ba1c200");const Oo=Do.exports,qo={name:"Submission",components:{Answer:Oo,IconDelete:gt,IconPencil:Ue,NcActions:it,NcActionButton:ot,NcActionRouter:Ke},props:{formHash:{type:String,required:!0},submission:{type:Object,required:!0},questions:{type:Array,required:!0},canDeleteSubmission:{type:Boolean,required:!0},canEditSubmission:{type:Boolean,required:!0},highlight:{type:String,default:null}},computed:{submissionDateTime(){return F(this.submission.timestamp,"X").format("LLLL")},answeredQuestions(){const e=[];return this.questions.forEach(s=>{const i=this.submission.answers.filter(o=>o.questionId===s.id);if(i.length)if(s.type==="file")e.push({id:s.id,text:s.text,type:s.type,answers:i.map(o=>({id:o.id,text:o.text,url:j("/f/{fileId}",{fileId:o.fileId})}))});else if(["date","time"].includes(s.type)){const o=i.map(r=>r.text).join(" - ");e.push({id:s.id,text:s.text,type:s.type,squashedAnswers:o})}else{const o=i.map(r=>r.text).join("; ");e.push({id:s.id,text:s.text,type:s.type,squashedAnswers:o})}}),e}},methods:{onDelete(){this.$emit("delete")}}};var zo=function(){var e=this,s=e._self._c;return s("div",{staticClass:"section submission"},[s("div",{staticClass:"submission-head"},[s("h3",{attrs:{dir:"auto"}},[e._v(" "+e._s(e.submission.userDisplayName)+" ")]),s("NcActions",{staticClass:"submission-menu",attrs:{"force-menu":""}},[e.canEditSubmission?s("NcActionRouter",{attrs:{to:{name:"submit",params:{hash:e.formHash,submissionId:e.submission.id}}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconPencil",{attrs:{size:20}})]},proxy:!0}],null,!1,291764094)},[e._v(" "+e._s(e.t("forms","Edit this response"))+" ")]):e._e(),e.canDeleteSubmission?s("NcActionButton",{on:{click:e.onDelete},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconDelete",{attrs:{size:20}})]},proxy:!0}],null,!1,881161434)},[e._v(" "+e._s(e.t("forms","Delete this response"))+" ")]):e._e()],1)],1),s("p",{staticClass:"submission-date"},[e._v(" "+e._s(e.submissionDateTime)+" ")]),e._l(e.answeredQuestions,function(i){return s("Answer",{key:i.id,attrs:{highlight:e.highlight,"answer-text":i.squashedAnswers,answers:i.answers,"question-text":i.text,"question-type":i.type}})})],2)},$o=[],Uo=I(qo,zo,$o,!1,null,"5187ff48");const Yo=Uo.exports,Qo={name:"ChevronRightIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var jo=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon chevron-right-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},Zo=[],Ko=I(Qo,jo,Zo,!1,null,null);const Wo=Ko.exports,Jo={name:"PageFirstIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Go=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon page-first-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M18.41,16.59L13.82,12L18.41,7.41L17,6L11,12L17,18L18.41,16.59M6,6H8V18H6V6Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},Xo=[],tr=I(Jo,Go,Xo,!1,null,null);const er=tr.exports,sr={name:"PageLastIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var ir=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon page-last-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M5.59,7.41L10.18,12L5.59,16.59L7,18L13,12L7,6L5.59,7.41M16,6H18V18H16V6Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},or=[],rr=I(sr,ir,or,!1,null,null);const nr=rr.exports,ar={name:"PaginationToolbar",components:{IconChevronLeft:Ye,IconChevronRight:Wo,NcButton:st,NcSelect:Ds,PageFirstIcon:er,PageLastIcon:nr},props:{totalItemsCount:{type:Number,required:!0},limit:{type:Number,default:20},offset:{type:Number,default:0}},emits:["update:offset"],computed:{allPageNumbersArray(){return Array.from({length:this.totalPages},(e,s)=>1+s)},totalPages(){return Math.max(1,Math.ceil(this.totalItemsCount/this.limit))},pageNumber:{get(){return Math.floor(this.offset/this.limit)+1},set(e){this.$emit("update:offset",(e-1)*this.limit)}}}};var lr=function(){var e=this,s=e._self._c;return s("div",{staticClass:"pagination-block"},[s("div",{staticClass:"pagination-items"},[s("NcButton",{attrs:{type:"tertiary",disabled:e.totalPages===1||e.pageNumber<=1,"aria-label":e.t("forms","Go to first page")},on:{click:function(i){e.pageNumber=1}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("PageFirstIcon",{attrs:{size:20}})]},proxy:!0}])}),s("NcButton",{attrs:{type:"tertiary",disabled:e.totalPages===1||e.pageNumber<=1,"aria-label":e.t("forms","Go to previous page")},on:{click:function(i){e.pageNumber--}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconChevronLeft",{attrs:{size:20}})]},proxy:!0}])}),s("div",{staticClass:"page-number"},[s("NcSelect",{attrs:{options:e.allPageNumbersArray,"aria-label-combobox":e.t("forms","Page number")},scopedSlots:e._u([{key:"selected-option-container",fn:function({option:i}){return[s("span",{staticClass:"selected-page"},[e._v(" "+e._s(e.t("forms","{page} of {totalPages}",{page:i.label,totalPages:e.totalPages}))+" ")])]}}]),model:{value:e.pageNumber,callback:function(i){e.pageNumber=i},expression:"pageNumber"}})],1),s("NcButton",{attrs:{type:"tertiary",disabled:e.totalPages===1||e.pageNumber>=e.totalPages,"aria-label":e.t("forms","Go to next page")},on:{click:function(i){e.pageNumber++}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconChevronRight",{attrs:{size:20}})]},proxy:!0}])}),s("NcButton",{attrs:{type:"tertiary",disabled:e.totalPages===1||e.pageNumber>=e.totalPages,"aria-label":e.t("forms","Go to last page")},on:{click:function(i){e.pageNumber=e.totalPages}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("PageLastIcon",{attrs:{size:20}})]},proxy:!0}])})],1)])},cr=[],ur=I(ar,lr,cr,!1,null,"b3033246");const dr=ur.exports,Jt={ods:es,csv:Je,xlsx:Ge};let J="csv";const Gt=[{title:t("forms","Summary"),id:"summary"},{title:t("forms","Responses"),id:"responses"}],hr={name:"Results",components:{IconChevronLeft:Ye,IconDelete:gt,IconDownload:Bi,IconFileDelimited:$i,IconFileExcelOutline:Zi,IconFolder:Xi,IconLink:Xe,IconLinkVariantOff:co,IconPoll:ts,IconRefresh:bo,IconShareVariant:zt,IconTable:Ao,NcActionButton:ot,NcActionSeparator:qt,NcActions:it,NcAppContent:Ut,NcButton:st,NcDialog:vt,NcTextField:Qe,PaginationToolbar:dr,IconMagnify:Lo,NcEmptyContent:$t,NcLoadingIcon:yt,PillMenu:As,ResultsSummary:Ro,Submission:Yo,TopBar:ze},mixins:[ct,Bt],setup(){return{isMobile:fs(),responseViews:Gt}},data(){return{activeResponseView:Gt[0],questions:[],submissions:[],filteredSubmissionsCount:0,isDownloadActionOpened:!1,loadingResults:!0,skipReloadOnOffsetChange:!1,picker:null,showConfirmDeleteDialog:!1,submissionSearch:"",limit:20,offset:0,linkedFileNotAvailableButtons:[{label:t("forms","Unlink spreadsheet"),icon:uo,type:"error",callback:()=>{this.onUnlinkFile()}},{label:t("forms","Create spreadsheet"),icon:oo,type:"primary",callback:()=>{this.onLinkFile()}}],confirmDeleteButtons:[{label:t("forms","Cancel"),icon:xs,type:"tertiary",callback:()=>{this.showConfirmDeleteDialog=!1}},{label:t("forms","Delete submissions"),icon:Mi,type:"error",callback:()=>{this.deleteAllSubmissionsConfirmed()}}]}},computed:{isFormArchived(){return this.form.state===B.FormArchived},canExportSubmissions(){return this.form.permissions.includes(this.PERMISSION_TYPES.PERMISSION_RESULTS)},canDeleteSubmissions(){return this.form.permissions.includes(this.PERMISSION_TYPES.PERMISSION_RESULTS_DELETE)&&!this.isFormArchived},canEditForm(){return this.form.permissions.includes(this.PERMISSION_TYPES.PERMISSION_EDIT)},noSubmissions(){return this.form?.submissionCount===0},noFilteredSubmissions(){return this.submissions.length===0},fileUrl(){return this.form.fileId?j("/f/{fileId}",{fileId:this.form.fileId}):window.location.href},showLinkedFileNotAvailableDialog(){return this.form.partial?!1:this.canEditForm&&this.form.fileId&&!this.form.filePath&&!this.isFormLocked}},watch:{async hash(){await this.fetchFullForm(this.form.id),this.loadFormResults(),ft(this.formTitle)},limit(){this.loadFormResults()},offset(){this.skipReloadOnOffsetChange||this.loadFormResults()},submissionSearch:pt(function(){this.skipReloadOnOffsetChange=!0,this.offset=0,this.$nextTick(()=>{this.skipReloadOnOffsetChange=!1}),this.loadFormResults()},mt)},async beforeMount(){await this.fetchFullForm(this.form.id),this.loadFormResults(),ft(this.formTitle)},methods:{async onUnlinkFile(){await M.patch(H("apps/forms/api/v3/forms/{formId}",{formId:this.form.id}),{keyValuePairs:{fileId:null,fileFormat:null}});const e={...this.form,fileFormat:null,fileId:null,filePath:null};this.$emit("update:form",e),D("forms:last-updated:set",this.form.id)},async loadFormResults(){this.loadingResults=!0,L.debug(`Loading results for form ${this.form.hash}`);try{let e=null;this.activeResponseView.id==="summary"?e=await M.get(H("apps/forms/api/v3/forms/{id}/submissions",{id:this.form.id})):e=await M.get(H("apps/forms/api/v3/forms/{id}/submissions?limit={limit}&offset={offset}&query={query}",{id:this.form.id,limit:this.limit,offset:this.offset,query:this.submissionSearch}));const s=O(e);this.submissions=this.formatDateAnswers(s.submissions,s.questions),this.questions=s.questions,this.filteredSubmissionsCount=s.filteredSubmissionsCount}catch(e){L.error("Error while loading results",{error:e}),R(t("forms","There was an error while loading the results"))}finally{this.loadingResults=!1}},async onDownloadFile(e){const s=H("apps/forms/api/v3/forms/{id}/submissions",{id:this.form.id})+"?requesttoken="+encodeURIComponent(ms())+"&fileFormat="+e;window.open(s,"_self")},async onLinkFile(){try{await this.getPicker().pick().then(async e=>{try{await M.patch(H("apps/forms/api/v3/forms/{id}",{id:this.form.id}),{keyValuePairs:{path:e,fileFormat:J}}),await this.fetchFullForm(this.form.id),await this.loadFormResults(),Q(t("forms","File {file} successfully linked",{file:this.form.filePath.split("/").pop()})),D("forms:last-updated:set",this.form.id)}catch(s){L.error("Error while exporting to Files and linking",{error:s}),R(t("forms","There was an error while linking the file"))}})}catch(e){L.debug("No file selected",{error:e})}},async onStoreToFiles(){try{await this.getPicker().pick().then(async e=>{try{const s=await M.post(H("apps/forms/api/v3/forms/{id}/submissions/export",{id:this.form.id}),{path:e,fileFormat:J});Q(t("forms","Export successful to {file}",{file:O(s)}))}catch(s){L.error("Error while exporting to Files",{error:s}),R(t("forms","There was an error while exporting to Files"))}})}catch(e){L.debug("No file selected",{error:e})}},async onReExport(){if(!this.form.fileId){R(t("forms","File is not linked"));return}try{const e=await M.post(H("apps/forms/api/v3/forms/{id}/submissions/export",{id:this.form.id}),{path:this.form.filePath,fileFormat:this.form.fileFormat});Q(t("forms","Export successful to {file}",{file:O(e)}))}catch(e){L.error("Error while exporting to Files",{error:e}),R(t("forms","There was an error, while exporting to Files"))}},canDeleteSubmission(e){return this.canDeleteSubmissions||this.form.allowEditSubmissions&&at().uid===e},canEditSubmission(e){return this.form.allowEditSubmissions&&at().uid===e},async deleteSubmission(e){this.loadingResults=!0;try{await M.delete(H("apps/forms/api/v3/forms/{id}/submissions/{submissionId}",{id:this.form.id,submissionId:e})),Q(t("forms","Submission deleted"));const s=this.submissions.findIndex(i=>i.id===e);this.submissions.splice(s,1),D("forms:last-updated:set",this.form.id)}catch(s){L.error(`Error while removing response ${e}`,{error:s}),R(t("forms","There was an error while removing this response"))}finally{this.loadingResults=!1}},deleteAllSubmissions(){this.showConfirmDeleteDialog=!0},async deleteAllSubmissionsConfirmed(){this.showConfirmDeleteDialog=!1,this.loadingResults=!0;try{await M.delete(H("apps/forms/api/v3/forms/{id}/submissions",{id:this.form.id})),this.submissions=[],this.form.submissionCount=0,D("forms:last-updated:set",this.form.id)}catch(e){L.error("Error while removing responses",{error:e}),R(t("forms","There was an error while removing responses"))}finally{this.loadingResults=!1}},formatDateAnswers(e,s){const i=Object.fromEntries(s.filter(o=>o.type==="date"|o.type==="datetime"|o.type==="time").map(o=>[o.id,o.type]));return e.forEach(o=>{o.answers.filter(r=>r.questionId in i).forEach(r=>{const n=F(r.text,lt[i[r.questionId]].storageFormat);n.isValid()&&(r.text=n.format(lt[i[r.questionId]].momentFormat))})}),e},getPicker(){return this.picker!==null?this.picker:(this.picker=Os(t("forms","Choose spreadsheet location")).setMultiSelect(!1).allowDirectories(!0).setCanPick(e=>{if(e.type===Wt.Folder)return!0;const s=e.extension?.slice(1).toLowerCase();return!!s&&s in Jt}).setButtonFactory(e=>{const[s]=e;if(s&&s.type===Wt.File){const i=s.extension?.slice(1).toLowerCase();return[{label:t("forms","Select {file}",{file:e[0].basename}),icon:Jt[i],callback(){J=i},variant:"primary"}]}return[{label:t("forms","Create XLSX"),icon:Ge,callback(){J="xlsx"},variant:"secondary"},{label:t("forms","Create CSV"),icon:Je,callback(){J="csv"},variant:"secondary"},{label:t("forms","Create ODS"),icon:es,callback(){J="ods"},variant:"primary"}]}).build(),this.picker)}}};var mr=function(){var e=this,s=e._self._c;return s("NcAppContent",{attrs:{"page-heading":e.t("forms","Results")}},[s("NcDialog",{attrs:{open:e.showLinkedFileNotAvailableDialog,name:e.t("forms","Linked file not available"),message:e.t("forms","Linked file is not available, would you like to link a new file?"),buttons:e.linkedFileNotAvailableButtons,size:"normal","no-close":""},on:{"update:open":function(i){e.showLinkedFileNotAvailableDialog=i}}}),s("TopBar",{attrs:{archived:e.isFormArchived,locked:e.isFormLocked,permissions:e.form?.permissions,"sidebar-opened":e.sidebarOpened,"submission-count":e.form?.submissionCount},on:{"share-form":e.onShareForm}}),s("header",[s("h2",{attrs:{dir:"auto"}},[e._v(" "+e._s(e.formTitle)+" ")]),s("p",[e._v(" "+e._s(e.t("forms","{amount} responses",{amount:e.filteredSubmissionsCount}))+" ")]),s("div",{staticClass:"response-actions"},[s("PillMenu",{staticClass:"response-actions__toggle",attrs:{disabled:e.noSubmissions,options:e.responseViews,active:e.activeResponseView},on:{"update:active":[function(i){e.activeResponseView=i},e.loadFormResults]}}),e.canExportSubmissions?s("NcActions",{attrs:{"aria-label":e.t("forms","Options"),"force-name":"",inline:e.isMobile?0:1},on:{blur:function(i){e.isDownloadActionOpened=!1},close:function(i){e.isDownloadActionOpened=!1}}},[e.isDownloadActionOpened?[s("NcActionButton",{on:{click:function(i){e.isDownloadActionOpened=!1}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconChevronLeft",{attrs:{size:20}})]},proxy:!0}],null,!1,2507572403)},[e._v(" "+e._s(e.t("forms","Download"))+" ")]),s("NcActionSeparator"),s("NcActionButton",{attrs:{"close-after-click":""},on:{click:function(i){return e.onDownloadFile("csv")}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconFileDelimited",{attrs:{size:20}})]},proxy:!0}],null,!1,3683965200)},[e._v(" CSV ")]),s("NcActionButton",{attrs:{"close-after-click":""},on:{click:function(i){return e.onDownloadFile("ods")}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconTable",{attrs:{size:20}})]},proxy:!0}],null,!1,294719581)},[e._v(" ODS ")]),s("NcActionButton",{attrs:{"close-after-click":""},on:{click:function(i){return e.onDownloadFile("xlsx")}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconFileExcelOutline",{attrs:{size:20}})]},proxy:!0}],null,!1,2400540274)},[e._v(" XSLX ")])]:[e.canEditForm&&!e.form.fileId&&!e.isFormLocked?s("NcActionButton",{on:{click:e.onLinkFile},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconLink",{attrs:{size:20}})]},proxy:!0}],null,!1,3963853667)},[e._v(" "+e._s(e.t("forms","Create spreadsheet"))+" ")]):e._e(),e.canEditForm&&e.form.fileId?[s("NcActionButton",{attrs:{href:e.fileUrl,type:"tertiary-no-background"},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconTable",{attrs:{size:20}})]},proxy:!0}],null,!1,294719581)},[e._v(" "+e._s(e.t("forms","Open spreadsheet"))+" ")]),s("NcActionButton",{attrs:{"close-after-click":""},on:{click:e.onReExport},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconRefresh",{attrs:{size:20}})]},proxy:!0}],null,!1,3240524606)},[e._v(" "+e._s(e.t("forms","Re-export spreadsheet"))+" ")]),s("NcActionButton",{attrs:{"close-after-click":"",disabled:e.isFormLocked},on:{click:e.onUnlinkFile},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconLinkVariantOff",{attrs:{size:20}})]},proxy:!0}],null,!1,97002203)},[e._v(" "+e._s(e.t("forms","Unlink spreadsheet"))+" ")]),e.noSubmissions?e._e():s("NcActionSeparator")]:e._e(),e.noSubmissions?e._e():s("NcActionButton",{attrs:{"close-after-click":""},on:{click:e.onStoreToFiles},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconFolder",{attrs:{size:20}})]},proxy:!0}],null,!1,2686820117)},[e._v(" "+e._s(e.t("forms","Save copy to Files"))+" ")]),e.noSubmissions?e._e():s("NcActionButton",{attrs:{"close-after-click":!1,"is-menu":""},on:{click:function(i){e.isDownloadActionOpened=!0}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconDownload",{attrs:{size:20}})]},proxy:!0}],null,!1,2487097783)},[e._v(" "+e._s(e.t("forms","Download"))+" ")]),e.canDeleteSubmissions&&!e.noSubmissions?s("NcActionButton",{attrs:{"close-after-click":""},on:{click:e.deleteAllSubmissions},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconDelete",{attrs:{size:20}})]},proxy:!0}],null,!1,881161434)},[e._v(" "+e._s(e.t("forms","Delete all responses"))+" ")]):e._e()]],2):e._e(),(!e.noSubmissions||e.loadingResults||e.submissionSearch.length>0)&&e.activeResponseView.id!=="summary"?s("div",{staticClass:"search-wrapper"},[s("NcTextField",{attrs:{label:e.t("forms","Search"),"trailing-button-icon":"close","show-trailing-button":e.submissionSearch.length>0},on:{"trailing-button-click":function(i){e.submissionSearch=""}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconMagnify",{attrs:{size:20}})]},proxy:!0}],null,!1,1212505168),model:{value:e.submissionSearch,callback:function(i){e.submissionSearch=i},expression:"submissionSearch"}})],1):e._e()],1)]),e.loadingResults?s("NcEmptyContent",{staticClass:"forms-emptycontent",attrs:{name:e.t("forms","Loading responses …")},scopedSlots:e._u([{key:"icon",fn:function(){return[s("NcLoadingIcon",{attrs:{size:64}})]},proxy:!0}],null,!1,826850984)}):e.noFilteredSubmissions&&e.submissionSearch.length>0?s("NcEmptyContent",{staticClass:"forms-emptycontent",attrs:{name:e.t("forms","No results found"),description:e.t("forms","No results found for {submissionSearch}",{submissionSearch:e.submissionSearch})},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconPoll",{attrs:{size:64}})]},proxy:!0}])}):e.noSubmissions?s("NcEmptyContent",{staticClass:"forms-emptycontent",attrs:{name:e.t("forms","No responses yet"),description:e.t("forms","Results of submitted forms will show up here")},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconPoll",{attrs:{size:64}})]},proxy:!0},{key:"action",fn:function(){return[s("div",{staticClass:"response-actions"},[s("NcButton",{attrs:{variant:"primary"},on:{click:e.onShareForm},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconShareVariant",{attrs:{size:20,decorative:""}})]},proxy:!0}])},[e._v(" "+e._s(e.t("forms","Share form"))+" ")])],1)]},proxy:!0}])}):e.activeResponseView.id==="summary"?s("section",e._l(e.questions,function(i){return s("ResultsSummary",{key:i.id,attrs:{question:i,submissions:e.submissions}})}),1):s("section",[e._l(e.submissions,function(i){return s("Submission",{key:i.id,attrs:{"form-hash":e.form.hash,submission:i,questions:e.questions,highlight:e.submissionSearch,"can-delete-submission":e.canDeleteSubmission(i.userId),"can-edit-submission":e.canEditSubmission(i.userId)},on:{delete:function(o){return e.deleteSubmission(i.id)}}})}),s("PaginationToolbar",{staticClass:"bottom-pagination",attrs:{"total-items-count":e.filteredSubmissionsCount,limit:e.limit,offset:e.offset},on:{"update:limit":function(i){e.limit=i},"update:offset":function(i){e.offset=i}}})],2),s("NcDialog",{attrs:{open:e.showConfirmDeleteDialog,name:e.t("forms","Delete submissions"),message:e.t("forms","Are you sure you want to delete all responses of {title}?",{title:e.formTitle}),buttons:e.confirmDeleteButtons},on:{"update:open":function(i){e.showConfirmDeleteDialog=i}}})],1)},fr=[],pr=I(hr,mr,fr,!1,null,"ae95c2c9");const gr=pr.exports;X.use(Ze);const vr=new Ze({mode:"history",base:j("/apps/forms",""),linkActiveClass:"active",routes:[{path:"/",name:"root"},{path:"/:hash",redirect:{name:"submit"},name:"formRoot",props:!0},{path:"/:hash/edit",components:{default:Hi},name:"edit",props:{default:!0}},{path:"/:hash/results",components:{default:gr},name:"results",props:{default:!0}},{path:"/:hash/submit/:submissionId?",components:{default:Es},name:"submit",props:{default:!0}}]}),yr={name:"ArchiveOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var _r=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon archive-outline-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M20 21H4V10H6V19H18V10H20V21M3 3H21V9H3V3M9.5 11H14.5C14.78 11 15 11.22 15 11.5V13H9V11.5C9 11.22 9.22 11 9.5 11M5 5V7H19V5H5Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},br=[],wr=I(yr,_r,br,!1,null,null);const ss=wr.exports,Cr={name:"ArchiveOffOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Sr=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon archive-off-outline-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M8.2 5L6.2 3H21V9H12.2L10.2 7H19V5H8.2M20 16.8V10H18V14.8L20 16.8M20 19.35V19.34L18 17.34V17.35L9.66 9H9.66L7.66 7H7.66L6.13 5.47L2.39 1.73L1.11 3L3 4.89V9H7.11L17.11 19H6V10H4V21H19.11L20.84 22.73L22.11 21.46L20 19.35Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},kr=[],Ar=I(Cr,Sr,kr,!1,null,null);const xr=Ar.exports,Er={name:"AppNavigationForm",components:{FormsIcon:Yt,IconArchive:ss,IconArchiveOff:xr,IconCheck:Qs,IconContentCopy:Is,IconDelete:gt,IconPencil:Ue,IconPoll:ts,IconShareVariant:zt,NcActionButton:ot,NcActionRouter:Ke,NcActionSeparator:qt,NcListItem:Ns,NcLoadingIcon:yt},mixins:[ct],props:{form:{type:Object,required:!0},forceDisplayActions:{type:Boolean,default:!1,required:!1},readOnly:{type:Boolean,default:!0}},data(){return{loading:!1}},computed:{canEdit(){return this.form.permissions.includes(this.PERMISSION_TYPES.PERMISSION_EDIT)},canSeeResults(){return this.form.permissions.includes(this.PERMISSION_TYPES.PERMISSION_RESULTS)||this.form.submissionCount>0},isActive(){return this.form.hash===this.$route.params.hash},isArchived(){return this.form.state===B.FormArchived},isExpired(){return this.form.expires&&F().unix()>this.form.expires},isFormLocked(){return this.form.lockedUntil===0||this.form.lockedUntil>F().unix()&&this.form.lockedBy!==at().uid},formTitle(){return this.form.title?this.form.title:t("forms","New form")},formSubtitle(){if(this.form.state===B.FormClosed)return t("forms","Form closed");if(this.form.expires){const e=F(this.form.expires,"X").fromNow();return this.isExpired?t("forms","Expired {relativeDate}",{relativeDate:e}):t("forms","Expires {relativeDate}",{relativeDate:e})}return""},hasSubtitle(){return this.formSubtitle!==""},routerTarget(){return this.readOnly?"submit":"formRoot"}},methods:{mobileCloseNavigation(){this.$emit("mobile-close-navigation")},onShareForm(){this.$emit("open-sharing",this.form.hash)},onCloneForm(){this.$emit("clone",this.form.id)},async onConfirmDelete(){await qs({name:t("forms","Delete form"),text:t("forms","Are you sure you want to delete {title}?",{title:this.formTitle}),labelConfirm:t("forms","Delete form"),labelReject:t("forms","Cancel")})&&await this.onDeleteForm()},async onToggleArchive(){try{await M.patch(H("apps/forms/api/v3/forms/{id}",{id:this.form.id}),{keyValuePairs:{state:this.isArchived?B.FormClosed:B.FormArchived}}),this.$set(this.form,"state",this.isArchived?B.FormClosed:B.FormArchived)}catch(e){L.error("Error changing archived state of form",{error:e}),R(t("forms","Error changing archived state of form"))}},async onDeleteForm(){this.loading=!0;try{await M.delete(H("apps/forms/api/v3/forms/{id}",{id:this.form.id})),this.$emit("delete",this.form.id)}catch(e){L.error(`Error while deleting ${this.formTitle}`,{error:e.response}),R(t("forms","Error while deleting {title}",{title:this.formTitle}))}finally{this.loading=!1}}}};var Nr=function(){var e=this,s=e._self._c;return s("NcListItem",{ref:"navigationItem",attrs:{active:e.isActive,"actions-aria-label":e.t("forms","Form actions"),"counter-number":e.form.submissionCount,compact:"","force-display-actions":e.forceDisplayActions,name:e.formTitle,to:{name:e.routerTarget,params:{hash:e.form.hash}}},on:{click:e.mobileCloseNavigation},scopedSlots:e._u([{key:"icon",fn:function(){return[e.loading?s("NcLoadingIcon",{attrs:{size:16}}):e.isExpired?s("IconCheck",{attrs:{size:16}}):s("FormsIcon",{attrs:{size:16}})]},proxy:!0},e.hasSubtitle?{key:"subname",fn:function(){return[e._v(" "+e._s(e.formSubtitle)+" ")]},proxy:!0}:null,!e.loading&&(!e.readOnly||e.canEdit||e.canSeeResults)?{key:"actions",fn:function(){return[!e.isArchived&&e.canEdit?s("NcActionRouter",{attrs:{"close-after-click":"",disabled:e.isFormLocked,exact:"",to:{name:"edit",params:{hash:e.form.hash}}},on:{click:e.mobileCloseNavigation},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconPencil",{attrs:{size:20}})]},proxy:!0}],null,!1,291764094)},[e._v(" "+e._s(e.t("forms","Edit form"))+" ")]):e._e(),!e.isArchived&&!e.readOnly?s("NcActionButton",{attrs:{"close-after-click":""},on:{click:e.onShareForm},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconShareVariant",{attrs:{size:20}})]},proxy:!0}],null,!1,2701055865)},[e._v(" "+e._s(e.t("forms","Share form"))+" ")]):e._e(),e.canSeeResults?s("NcActionRouter",{attrs:{"close-after-click":"",exact:"",to:{name:"results",params:{hash:e.form.hash}}},on:{click:e.mobileCloseNavigation},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconPoll",{attrs:{size:20}})]},proxy:!0}],null,!1,1519423900)},[e._v(" "+e._s(e.t("forms","Results"))+" ")]):e._e(),e.canEdit?s("NcActionButton",{attrs:{"close-after-click":""},on:{click:e.onCloneForm},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconContentCopy",{attrs:{size:20}})]},proxy:!0}],null,!1,3598792143)},[e._v(" "+e._s(e.t("forms","Copy form"))+" ")]):e._e(),e.canEdit&&!e.readOnly?s("NcActionSeparator"):e._e(),e.canEdit&&!e.readOnly?s("NcActionButton",{attrs:{"close-after-click":"",disabled:e.isFormLocked},on:{click:e.onToggleArchive},scopedSlots:e._u([{key:"icon",fn:function(){return[e.isArchived?s("IconArchiveOff",{attrs:{size:20}}):s("IconArchive",{attrs:{size:20}})]},proxy:!0}],null,!1,2091663753)},[e._v(" "+e._s(e.isArchived?e.t("forms","Unarchive form"):e.t("forms","Archive form"))+" ")]):e._e(),e.canEdit&&!e.readOnly?s("NcActionButton",{attrs:{"close-after-click":"",disabled:e.isFormLocked},on:{click:e.onConfirmDelete},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconDelete",{attrs:{size:20}})]},proxy:!0}],null,!1,881161434)},[e._v(" "+e._s(e.t("forms","Delete form"))+" ")]):e._e()]},proxy:!0}:null],null,!0)})},Ir=[],Lr=I(Er,Nr,Ir,!1,null,null);const is=Lr.exports,Tr=Ps({name:"ArchivedFormsModal",components:{AppNavigationForm:is,NcDialog:vt},props:{open:{type:Boolean,required:!0},forms:{type:Array,required:!0}},emits:["update:open"],data(){return{shownForms:[]}},watch:{forms:{immediate:!0,handler(){this.shownForms=[...this.forms]}}},methods:{t:qe,onCloneForm(e){this.$emit("clone",e),this.$emit("update:open",!1)},onDelete(e){this.shownForms=this.shownForms.filter(({id:s})=>s!==e.id)}}});var Hr=function(){var e=this,s=e._self._c;return e._self._setupProxy,s("NcDialog",{attrs:{"content-classes":"archived-forms",name:e.t("forms","Archived forms"),open:e.open,size:"normal"},on:{"update:open":function(i){return e.$emit("update:open",i)}}},[s("ul",{attrs:{"aria-label":e.t("forms","Archived forms")}},e._l(e.shownForms,function(i,o){return s("AppNavigationForm",{key:o,attrs:{form:i,"read-only":!1,"force-display-actions":""},on:{clone:function(r){return e.onCloneForm(i.id)},delete:function(r){return e.onDelete(i)},"mobile-close-navigation":function(r){return e.$emit("update:open",!1)}}})}),1)])},Mr=[],Pr=I(Tr,Hr,Mr,!1,null,"1e02b9f7");const Rr=Pr.exports,Fr={name:"CogOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Vr=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon cog-outline-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10M10,22C9.75,22 9.54,21.82 9.5,21.58L9.13,18.93C8.5,18.68 7.96,18.34 7.44,17.94L4.95,18.95C4.73,19.03 4.46,18.95 4.34,18.73L2.34,15.27C2.21,15.05 2.27,14.78 2.46,14.63L4.57,12.97L4.5,12L4.57,11L2.46,9.37C2.27,9.22 2.21,8.95 2.34,8.73L4.34,5.27C4.46,5.05 4.73,4.96 4.95,5.05L7.44,6.05C7.96,5.66 8.5,5.32 9.13,5.07L9.5,2.42C9.54,2.18 9.75,2 10,2H14C14.25,2 14.46,2.18 14.5,2.42L14.87,5.07C15.5,5.32 16.04,5.66 16.56,6.05L19.05,5.05C19.27,4.96 19.54,5.05 19.66,5.27L21.66,8.73C21.79,8.95 21.73,9.22 21.54,9.37L19.43,11L19.5,12L19.43,13L21.54,14.63C21.73,14.78 21.79,15.05 21.66,15.27L19.66,18.73C19.54,18.95 19.27,19.04 19.05,18.95L16.56,17.95C16.04,18.34 15.5,18.68 14.87,18.93L14.5,21.58C14.46,21.82 14.25,22 14,22H10M11.25,4L10.88,6.61C9.68,6.86 8.62,7.5 7.85,8.39L5.44,7.35L4.69,8.65L6.8,10.2C6.4,11.37 6.4,12.64 6.8,13.8L4.68,15.36L5.43,16.66L7.86,15.62C8.63,16.5 9.68,17.14 10.87,17.38L11.24,20H12.76L13.13,17.39C14.32,17.14 15.37,16.5 16.14,15.62L18.57,16.66L19.32,15.36L17.2,13.81C17.6,12.64 17.6,11.37 17.2,10.2L19.31,8.65L18.56,7.35L16.15,8.39C15.38,7.5 14.32,6.86 13.12,6.62L12.75,4H11.25Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},Br=[],Dr=I(Fr,Vr,Br,!1,null,null);const Or=Dr.exports,qr={name:"AccountMultipleOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var zr=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon account-multiple-outline-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M13.07 10.41A5 5 0 0 0 13.07 4.59A3.39 3.39 0 0 1 15 4A3.5 3.5 0 0 1 15 11A3.39 3.39 0 0 1 13.07 10.41M5.5 7.5A3.5 3.5 0 1 1 9 11A3.5 3.5 0 0 1 5.5 7.5M7.5 7.5A1.5 1.5 0 1 0 9 6A1.5 1.5 0 0 0 7.5 7.5M16 17V19H2V17S2 13 9 13 16 17 16 17M14 17C13.86 16.22 12.67 15 9 15S4.07 16.31 4 17M15.95 13A5.32 5.32 0 0 1 18 17V19H22V17S22 13.37 15.94 13Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},$r=[],Ur=I(qr,zr,$r,!1,null,null);const Yr=Ur.exports,Qr={name:"CodeBracketsIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var jr=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon code-brackets-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},Zr=[],Kr=I(Qr,jr,Zr,!1,null,null);const Wr=Kr.exports,Jr={name:"LinkBoxOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var Gr=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon link-box-outline-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M19,19H5V5H19V19M11,16H10C8.39,16 6,14.94 6,12C6,9.07 8.39,8 10,8H11V10H10C9.54,10 8,10.17 8,12C8,13.9 9.67,14 10,14H11V16M14,16H13V14H14C14.46,14 16,13.83 16,12C16,10.1 14.33,10 14,10H13V8H14C15.61,8 18,9.07 18,12C18,14.94 15.61,16 14,16M15,13H9V11H15V13Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},Xr=[],tn=I(Jr,Gr,Xr,!1,null,null);const en=tn.exports,sn={name:"QrcodeIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var on=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon qrcode-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[s("path",{attrs:{d:"M3,11H5V13H3V11M11,5H13V9H11V5M9,11H13V15H11V13H9V11M15,11H17V13H19V11H21V13H19V15H21V19H19V21H17V19H13V21H11V17H15V15H17V13H15V11M19,19V15H17V19H19M15,3H21V9H15V3M17,5V7H19V5H17M3,3H9V9H3V3M5,5V7H7V5H5M3,15H9V21H3V15M5,17V19H7V17H5Z"}},[e.title?s("title",[e._v(e._s(e.title))]):e._e()])])])},rn=[],nn=I(sn,on,rn,!1,null,null);const an=nn.exports,ln={name:"IconCopyAll",props:{title:{type:String,default:""},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:20}}};var cn=function(){var e=this,s=e._self._c;return s("span",e._b({staticClass:"material-design-icon copy-all-icon",attrs:{"aria-hidden":!e.title,"aria-label":e.title,role:"img"},on:{click:function(i){return e.$emit("click",i)}}},"span",e.$attrs,!1),[s("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,height:e.size,width:e.size,viewBox:"0 0 16 16"}},[s("path",{attrs:{d:"M 13.5 0 h -8 C 4.67 0 4 0.67 4 1.5 v 10 C 4 12.33 4.67 13 5.5 13 h 8 c 0.83 0 1.5 -0.67 1.5 -1.5 v -10 C 15 0.67 14.33 0 13.5 0 z M 13.5 11.5 h -8 v -10 h 8 V 11.5 z M 1 10 v -1.5 h 1.5 V 10 H 1 z M 1 13 v -1.5 h 1.5 V 13 H 1 z M 7 14.5 h 1.5 V 16 H 7 V 14.5 z M 1 5.5 h 1.5 V 7 H 1 V 5.5 z M 5.5 16 H 4 v -1.5 h 1.5 V 16 z M 2.5 16 C 1.67 16 1 15.33 1 14.5 h 1.5 V 16 z M 2.5 4 H 1 c 0 -0.83 0.67 -1.5 1.5 -1.5 V 4 z M 11.49 14.5 c 0 0.83 -0.67 1.5 -1.5 1.5 h 0 v -1.5 L 11.49 14.5 L 11.49 14.5 z"}}),e.title?s("title",[e._v(e._s(e.title))]):e._e()])])},un=[],dn=I(ln,cn,un,!1,null,null);const hn=dn.exports,mn='',fn='',pn='',gn='',vn='',_t={data(){return{SHARE_TYPES:{SHARE_TYPE_USER:OC.Share.SHARE_TYPE_USER,SHARE_TYPE_GROUP:OC.Share.SHARE_TYPE_GROUP,SHARE_TYPE_LINK:OC.Share.SHARE_TYPE_LINK,SHARE_TYPE_EMAIL:OC.Share.SHARE_TYPE_EMAIL,SHARE_TYPE_REMOTE:OC.Share.SHARE_TYPE_REMOTE,SHARE_TYPE_CIRCLE:OC.Share.SHARE_TYPE_CIRCLE,SHARE_TYPE_GUEST:OC.Share.SHARE_TYPE_GUEST,SHARE_TYPE_REMOTE_GROUP:OC.Share.SHARE_TYPE_REMOTE_GROUP,SHARE_TYPE_ROOM:OC.Share.SHARE_TYPE_ROOM},SHARE_TYPES_USED:[OC.Share.SHARE_TYPE_USER,OC.Share.SHARE_TYPE_GROUP,OC.Share.SHARE_TYPE_LINK,OC.Share.SHARE_TYPE_CIRCLE]}},methods:{shareTypeToIcon(e){switch(e){case this.SHARE_TYPES.SHARE_TYPE_GUEST:return mn;case this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP:case this.SHARE_TYPES.SHARE_TYPE_GROUP:return fn;case this.SHARE_TYPES.SHARE_TYPE_EMAIL:return pn;case this.SHARE_TYPES.SHARE_TYPE_CIRCLE:return vn;case this.SHARE_TYPES.SHARE_TYPE_ROOM:return gn;default:return""}}}},os={mixins:[_t],data(){return{loading:!1,query:"",maxAutocompleteResults:parseInt(OC.config["sharing.maxAutocompleteResults"],10)||200,minSearchStringLength:parseInt(OC.config["sharing.minSearchStringLength"],10)||0,recommendations:[],suggestions:[]}},computed:{isValidQuery(){return this.query&&this.query.trim()!==""&&this.query.length>this.minSearchStringLength},noResultText(){return this.query?t("forms","No elements found."):t("forms","No recommendations. Start typing.")}},methods:{async asyncSearch(e,s){this.query=e.trim(),this.isValidQuery&&(this.loading=!0,this.debounceGetSuggestions(e,s))},debounceGetSuggestions:pt(function(...e){this.getSuggestions(...e)},mt),async getSuggestions(e,s){this.loading=!0,s??=this.SHARE_TYPES_USED.filter(i=>i!==this.SHARE_TYPES.SHARE_TYPE_LINK);try{const i=await M.get(H("apps/files_sharing/api/v1/sharees"),{params:{format:"json",itemType:"file",perPage:this.maxAutocompleteResults,search:e,shareType:s}}),o=O(i),r=o.exact;delete o.exact;const n=this.formatSearchResults(r),a=this.formatSearchResults(o);this.suggestions=n.concat(a)}catch(i){L.error("Loading Suggestions failed.",{error:i})}finally{this.loading=!1}},async getRecommendations(){this.loading=!0;try{const e=await M.get(H("apps/files_sharing/api/v1/sharees_recommended"),{params:{format:"json",itemType:"file"}});this.recommendations=this.formatSearchResults(O(e).exact)}catch(e){L.error("Fetching recommendations failed.",{error:e})}finally{this.loading=!1}},formatSearchResults(e){const s=Object.values(e).flat();return this.filterUnwantedShares(s).map(i=>this.formatForMultiselect(i)).sort((i,o)=>i.shareType-o.shareType)},filterUnwantedShares(e){return e.filter(s=>{if(typeof s!="object")return!1;try{return!(s.value.shareType===this.SHARE_TYPES.SHARE_TYPE_USER&&s.value.shareWith===at().uid)}catch{return!1}})},formatForMultiselect(e){return{shareWith:e.value.shareWith,shareType:e.value.shareType,user:e.value.shareWith,isNoUser:e.value.shareType!==this.SHARE_TYPES.SHARE_TYPE_USER,id:e.value.shareWith,displayName:e.label,subname:e.shareWithDisplayNameUnique,iconSvg:this.shareTypeToIcon(e.value.shareType),key:e.value.shareWith+"-"+e.value.shareType}}}},yn={components:{NcSelectUsers:je},mixins:[os],props:{currentShares:{type:Array,default:()=>[]},showLoading:{type:Boolean,default:!1},locked:{type:Boolean,required:!0}},computed:{options(){return this.isValidQuery?this.suggestions.filter(e=>!this.currentShares.find(s=>s.shareWith===e.shareWith&&s.shareType===e.shareType)):this.recommendations.filter(e=>!this.currentShares.find(s=>s.shareWith===e.shareWith&&s.shareType===e.shareType))},showLoadingCircle(){return this.showLoading||this.loading}},mounted(){this.getRecommendations()},methods:{addShare(e){const s={shareWith:e.shareWith,displayName:e.displayName,shareType:e.shareType};this.$emit("add-share",s)}}};var _n=function(){var e=this,s=e._self._c;return s("div",[s("NcSelectUsers",{attrs:{"keep-open":"",loading:e.showLoadingCircle,disabled:e.locked,options:e.options,placeholder:e.t("forms","Search for user, group or team …"),"aria-label-listbox":e.t("forms","Search for user, group or team …")},on:{search:e.asyncSearch,"update:modelValue":e.addShare},scopedSlots:e._u([{key:"no-options",fn:function(){return[e._v(" "+e._s(e.noResultText)+" ")]},proxy:!0}])})],1)},bn=[],wn=I(yn,_n,bn,!1,null,"525e61cc");const Cn=wn.exports,Sn={components:{IconClose:Ts,NcActions:it,NcActionButton:ot,NcActionCaption:si,NcActionCheckbox:Ls,NcActionSeparator:qt,NcAvatar:zs},mixins:[ct,_t],props:{share:{type:Object,required:!0},locked:{type:Boolean,required:!0}},computed:{canAccessResults(){return this.share.permissions.includes(this.PERMISSION_TYPES.PERMISSION_RESULTS)},canDeleteResults(){return this.share.permissions.includes(this.PERMISSION_TYPES.PERMISSION_RESULTS_DELETE)},canEditForm(){return this.share.permissions.includes(this.PERMISSION_TYPES.PERMISSION_EDIT)},isNoUser(){return this.share.shareType!==this.SHARE_TYPES.SHARE_TYPE_USER},displayName(){return this.share.displayName?this.share.displayName:this.share.shareWith},displayNameAppendix(){switch(this.share.shareType){case this.SHARE_TYPES.SHARE_TYPE_GROUP:return`(${t("forms","Group")})`;case this.SHARE_TYPES.SHARE_TYPE_CIRCLE:return`(${t("forms","Team")})`;default:return""}}},methods:{removeShare(){this.$emit("remove-share",this.share)},updatePermissionResults(e){return e===!1&&this.updatePermission(this.PERMISSION_TYPES.PERMISSION_RESULTS_DELETE,!1),this.updatePermission(this.PERMISSION_TYPES.PERMISSION_RESULTS,e)},updatePermissionDeleteResults(e){return this.updatePermission(this.PERMISSION_TYPES.PERMISSION_RESULTS_DELETE,e)},updatePermissionEdit(e){return this.updatePermission(this.PERMISSION_TYPES.PERMISSION_EDIT,e)},updatePermission(e,s){const i={...this.share};s?i.permissions=[...new Set([...i.permissions,e])]:i.permissions=i.permissions.filter(o=>o!==e),this.$emit("update:share",i)}}};var kn=function(){var e=this,s=e._self._c;return s("li",{staticClass:"share-div"},[s("NcAvatar",{attrs:{user:e.share.shareWith,"disable-menu":"","display-name":e.displayName,"is-no-user":e.isNoUser}}),s("div",{staticClass:"share-div__desc"},[s("span",[e._v(e._s(e.displayName))]),s("span",[e._v(e._s(e.displayNameAppendix))])]),s("NcActions",{staticClass:"share-div__actions"},[s("NcActionCaption",{attrs:{name:e.t("forms","Permissions")}}),s("NcActionCheckbox",{attrs:{"model-value":e.canEditForm,disabled:e.locked},on:{"update:model-value":e.updatePermissionEdit}},[e._v(" "+e._s(e.t("forms","Edit form"))+" ")]),s("NcActionCheckbox",{attrs:{"model-value":e.canAccessResults,disabled:e.locked},on:{"update:model-value":e.updatePermissionResults}},[e._v(" "+e._s(e.t("forms","View responses"))+" ")]),s("NcActionCheckbox",{attrs:{"model-value":e.canDeleteResults,disabled:!e.canAccessResults||e.locked},on:{"update:model-value":e.updatePermissionDeleteResults}},[e._v(" "+e._s(e.t("forms","Delete responses"))+" ")]),s("NcActionSeparator"),s("NcActionButton",{attrs:{disabled:e.locked},on:{click:e.removeShare},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconClose",{attrs:{size:20}})]},proxy:!0}])},[e._v(" "+e._s(e.t("forms","Delete"))+" ")])],1)],1)},An=[],xn=I(Sn,kn,An,!1,null,"9a5996a7");const En=xn.exports;var G={},Xt,te;function Nn(){return te||(te=1,Xt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Xt}var kt={},Y={},ee;function Z(){if(ee)return Y;ee=1;let e;const s=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Y.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},Y.getSymbolTotalCodewords=function(i){return s[i]},Y.getBCHDigit=function(i){let o=0;for(;i!==0;)o++,i>>>=1;return o},Y.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');e=i},Y.isKanjiModeEnabled=function(){return typeof e<"u"},Y.toSJIS=function(i){return e(i)},Y}var se={},ie;function Qt(){return ie||(ie=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function s(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+i)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,o){if(e.isValid(i))return i;try{return s(i)}catch{return o}}})(se)),se}var At,oe;function In(){if(oe)return At;oe=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(s){const i=Math.floor(s/8);return(this.buffer[i]>>>7-s%8&1)===1},put:function(s,i){for(let o=0;o>>i-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(s){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),s&&(this.buffer[i]|=128>>>this.length%8),this.length++}},At=e,At}var xt,re;function Ln(){if(re)return xt;re=1;function e(s){if(!s||s<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=s,this.data=new Uint8Array(s*s),this.reservedBit=new Uint8Array(s*s)}return e.prototype.set=function(s,i,o,r){const n=s*this.size+i;this.data[n]=o,r&&(this.reservedBit[n]=!0)},e.prototype.get=function(s,i){return this.data[s*this.size+i]},e.prototype.xor=function(s,i,o){this.data[s*this.size+i]^=o},e.prototype.isReserved=function(s,i){return this.reservedBit[s*this.size+i]},xt=e,xt}var ne={},ae;function Tn(){return ae||(ae=1,(function(e){const s=Z().getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const o=Math.floor(i/7)+2,r=s(i),n=r===145?26:Math.ceil((r-13)/(2*o-2))*2,a=[r-7];for(let l=1;l=0&&o<=7},e.from=function(o){return e.isValid(o)?parseInt(o,10):void 0},e.getPenaltyN1=function(o){const r=o.size;let n=0,a=0,l=0,d=null,m=null;for(let h=0;h=5&&(n+=s.N1+(a-5)),d=c,a=1),c=o.get(f,h),c===m?l++:(l>=5&&(n+=s.N1+(l-5)),m=c,l=1)}a>=5&&(n+=s.N1+(a-5)),l>=5&&(n+=s.N1+(l-5))}return n},e.getPenaltyN2=function(o){const r=o.size;let n=0;for(let a=0;a=10&&(a===1488||a===93)&&n++,l=l<<1&2047|o.get(m,d),m>=10&&(l===1488||l===93)&&n++}return n*s.N3},e.getPenaltyN4=function(o){let r=0;const n=o.data.length;for(let a=0;a=0;){const n=r[0];for(let l=0;l0){const a=new Uint8Array(this.degree);return a.set(r,n),a}return r},Nt=s,Nt}var ge={},ve={},ye={},_e;function ns(){return _e||(_e=1,ye.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}),ye}var q={},be;function as(){if(be)return q;be=1;const e="[0-9]+",s="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r ]))+`;q.KANJI=new RegExp(i,"g"),q.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),q.BYTE=new RegExp(o,"g"),q.NUMERIC=new RegExp(e,"g"),q.ALPHANUMERIC=new RegExp(s,"g");const r=new RegExp("^"+i+"$"),n=new RegExp("^"+e+"$"),a=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return q.testKanji=function(l){return r.test(l)},q.testNumeric=function(l){return n.test(l)},q.testAlphanumeric=function(l){return a.test(l)},q}var we;function K(){return we||(we=1,(function(e){const s=ns(),i=as();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(r,n){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!s.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?r.ccBits[0]:n<27?r.ccBits[1]:r.ccBits[2]},e.getBestModeForData=function(r){return i.testNumeric(r)?e.NUMERIC:i.testAlphanumeric(r)?e.ALPHANUMERIC:i.testKanji(r)?e.KANJI:e.BYTE},e.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},e.isValid=function(r){return r&&r.bit&&r.ccBits};function o(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+r)}}e.from=function(r,n){if(e.isValid(r))return r;try{return o(r)}catch{return n}}})(ve)),ve}var Ce;function Vn(){return Ce||(Ce=1,(function(e){const s=Z(),i=rs(),o=Qt(),r=K(),n=ns(),a=7973,l=s.getBCHDigit(a);function d(c,A,x){for(let T=1;T<=40;T++)if(A<=e.getCapacity(T,x,c))return T}function m(c,A){return r.getCharCountIndicator(c,A)+4}function h(c,A){let x=0;return c.forEach(function(T){const V=m(T.mode,A);x+=V+T.getBitsLength()}),x}function f(c,A){for(let x=1;x<=40;x++)if(h(c,x)<=e.getCapacity(x,A,r.MIXED))return x}e.from=function(c,A){return n.isValid(c)?parseInt(c,10):A},e.getCapacity=function(c,A,x){if(!n.isValid(c))throw new Error("Invalid QR Code version");typeof x>"u"&&(x=r.BYTE);const T=s.getSymbolTotalCodewords(c),V=i.getTotalCodewordsCount(c,A),S=(T-V)*8;if(x===r.MIXED)return S;const p=S-m(x,c);switch(x){case r.NUMERIC:return Math.floor(p/10*3);case r.ALPHANUMERIC:return Math.floor(p/11*2);case r.KANJI:return Math.floor(p/13);case r.BYTE:default:return Math.floor(p/8)}},e.getBestVersionForData=function(c,A){let x;const T=o.from(A,o.M);if(Array.isArray(c)){if(c.length>1)return f(c,T);if(c.length===0)return 1;x=c[0]}else x=c;return d(x.mode,x.getLength(),T)},e.getEncodedBits=function(c){if(!n.isValid(c)||c<7)throw new Error("Invalid QR Code version");let A=c<<12;for(;s.getBCHDigit(A)-l>=0;)A^=a<=0;)l^=s<0&&(r=this.data.substr(o),n=parseInt(r,10),i.put(n,a*3+1))},Lt=s,Lt}var Tt,xe;function On(){if(xe)return Tt;xe=1;const e=K(),s=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(o){this.mode=e.ALPHANUMERIC,this.data=o}return i.getBitsLength=function(o){return 11*Math.floor(o/2)+6*(o%2)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(o){let r;for(r=0;r+2<=this.data.length;r+=2){let n=s.indexOf(this.data[r])*45;n+=s.indexOf(this.data[r+1]),o.put(n,11)}this.data.length%2&&o.put(s.indexOf(this.data[r]),6)},Tt=i,Tt}var Ht,Ee;function qn(){if(Ee)return Ht;Ee=1;const e=K();function s(i){this.mode=e.BYTE,typeof i=="string"?this.data=new TextEncoder().encode(i):this.data=new Uint8Array(i)}return s.getBitsLength=function(i){return i*8},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(i){for(let o=0,r=this.data.length;o=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[r]+` Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),o.put(n,13)}},Mt=i,Mt}var Ie={exports:{}},Le;function $n(){return Le||(Le=1,(function(e){var s={single_source_shortest_paths:function(i,o,r){var n={},a={};a[o]=0;var l=s.PriorityQueue.make();l.push(o,0);for(var d,m,h,f,c,A,x,T,V;!l.empty();){d=l.pop(),m=d.value,f=d.cost,c=i[m]||{};for(h in c)c.hasOwnProperty(h)&&(A=c[h],x=f+A,T=a[h],V=typeof a[h]>"u",(V||T>x)&&(a[h]=x,l.push(h,x),n[h]=m))}if(typeof r<"u"&&typeof a[r]>"u"){var S=["Could not find a path from ",o," to ",r,"."].join("");throw new Error(S)}return n},extract_shortest_path_from_predecessor_list:function(i,o){for(var r=[],n=o;n;)r.push(n),i[n],n=i[n];return r.reverse(),r},find_path:function(i,o,r){var n=s.single_source_shortest_paths(i,o,r);return s.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(i){var o=s.PriorityQueue,r={},n;i=i||{};for(n in o)o.hasOwnProperty(n)&&(r[n]=o[n]);return r.queue=[],r.sorter=i.sorter||o.default_sorter,r},default_sorter:function(i,o){return i.cost-o.cost},push:function(i,o){var r={value:i,cost:o};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=s})(Ie)),Ie.exports}var Te;function Un(){return Te||(Te=1,(function(e){const s=K(),i=Dn(),o=On(),r=qn(),n=zn(),a=as(),l=Z(),d=$n();function m(S){return unescape(encodeURIComponent(S)).length}function h(S,p,v){const _=[];let P;for(;(P=S.exec(v))!==null;)_.push({data:P[0],index:P.index,mode:p,length:P[0].length});return _}function f(S){const p=h(a.NUMERIC,s.NUMERIC,S),v=h(a.ALPHANUMERIC,s.ALPHANUMERIC,S);let _,P;return l.isKanjiModeEnabled()?(_=h(a.BYTE,s.BYTE,S),P=h(a.KANJI,s.KANJI,S)):(_=h(a.BYTE_KANJI,s.BYTE,S),P=[]),p.concat(v,_,P).sort(function(u,y){return u.index-y.index}).map(function(u){return{data:u.data,mode:u.mode,length:u.length}})}function c(S,p){switch(p){case s.NUMERIC:return i.getBitsLength(S);case s.ALPHANUMERIC:return o.getBitsLength(S);case s.KANJI:return n.getBitsLength(S);case s.BYTE:return r.getBitsLength(S)}}function A(S){return S.reduce(function(p,v){const _=p.length-1>=0?p[p.length-1]:null;return _&&_.mode===v.mode?(p[p.length-1].data+=v.data,p):(p.push(v),p)},[])}function x(S){const p=[];for(let v=0;v=0&&w<=6&&(N===0||N===6)||N>=0&&N<=6&&(w===0||w===6)||w>=2&&w<=4&&N>=2&&N<=4?u.set(k+w,C+N,!0,!0):u.set(k+w,C+N,!1,!0))}}function x(u){const y=u.size;for(let b=8;b>w&1)===1,u.set(E,k,C,!0),u.set(k,E,C,!0)}function S(u,y,b){const g=u.size,E=h.getEncodedBits(y,b);let k,C;for(k=0;k<15;k++)C=(E>>k&1)===1,k<6?u.set(k,8,C,!0):k<8?u.set(k+1,8,C,!0):u.set(g-15+k,8,C,!0),k<8?u.set(8,g-k-1,C,!0):k<9?u.set(8,15-k-1+1,C,!0):u.set(8,15-k-1,C,!0);u.set(g-8,8,1,!0)}function p(u,y){const b=u.size;let g=-1,E=b-1,k=7,C=0;for(let w=b-1;w>0;w-=2)for(w===6&&w--;;){for(let N=0;N<2;N++)if(!u.isReserved(E,w-N)){let U=!1;C>>k&1)===1),u.set(E,w-N,U),k--,k===-1&&(C++,k=7)}if(E+=g,E<0||b<=E){E-=g,g=-g;break}}}function v(u,y,b){const g=new i;b.forEach(function(N){g.put(N.mode.bit,4),g.put(N.getLength(),f.getCharCountIndicator(N.mode,u)),N.write(g)});const E=e.getSymbolTotalCodewords(u),k=l.getTotalCodewordsCount(u,y),C=(E-k)*8;for(g.getLengthInBits()+4<=C&&g.put(0,4);g.getLengthInBits()%8!==0;)g.putBit(0);const w=(C-g.getLengthInBits())/8;for(let N=0;N=7&&V(N,y),p(N,C),isNaN(g)&&(g=a.getBestMask(N,S.bind(null,N,b))),a.applyMask(g,N),S(N,b,g),{modules:N,version:y,errorCorrectionLevel:b,maskPattern:g,segments:E}}return kt.create=function(u,y){if(typeof u>"u"||u==="")throw new Error("No input text");let b=s.M,g,E;return typeof y<"u"&&(b=s.from(y.errorCorrectionLevel,s.M),g=m.from(y.version),E=a.from(y.maskPattern),y.toSJISFunc&&e.setToSJISFunction(y.toSJISFunc)),P(u,g,b,E)},kt}var Me={},Pe={},Re;function ls(){return Re||(Re=1,(function(e){function s(i){if(typeof i=="number"&&(i=i.toString()),typeof i!="string")throw new Error("Color should be defined as hex string");let o=i.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+i);(o.length===3||o.length===4)&&(o=Array.prototype.concat.apply([],o.map(function(n){return[n,n]}))),o.length===6&&o.push("F","F");const r=parseInt(o.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+o.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const o=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,r=i.width&&i.width>=21?i.width:void 0,n=i.scale||4;return{width:r,scale:r?4:n,margin:o,color:{dark:s(i.color.dark||"#000000ff"),light:s(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,o){return o.width&&o.width>=i+o.margin*2?o.width/(i+o.margin*2):o.scale},e.getImageWidth=function(i,o){const r=e.getScale(i,o);return Math.floor((i+o.margin*2)*r)},e.qrToImageData=function(i,o,r){const n=o.modules.size,a=o.modules.data,l=e.getScale(n,r),d=Math.floor((n+r.margin*2)*l),m=r.margin*l,h=[r.color.light,r.color.dark];for(let f=0;f=m&&c>=m&&f"u"&&(!n||!n.getContext)&&(l=n,n=void 0),n||(d=o()),l=s.getOptions(l);const m=s.getImageWidth(r.modules.size,l),h=d.getContext("2d"),f=h.createImageData(m,m);return s.qrToImageData(f.data,r,l),i(h,d,m),h.putImageData(f,0,0),d},e.renderToDataURL=function(r,n,a){let l=a;typeof l>"u"&&(!n||!n.getContext)&&(l=n,n=void 0),l||(l={});const d=e.render(r,n,l),m=l.type||"image/png",h=l.rendererOpts||{};return d.toDataURL(m,h.quality)}})(Me)),Me}var Pt={},Ve;function jn(){if(Ve)return Pt;Ve=1;const e=ls();function s(r,n){const a=r.a/255,l=n+'="'+r.hex+'"';return a<1?l+" "+n+'-opacity="'+a.toFixed(2).slice(1)+'"':l}function i(r,n,a){let l=r+n;return typeof a<"u"&&(l+=" "+a),l}function o(r,n,a){let l="",d=0,m=!1,h=0;for(let f=0;f0&&c>0&&r[f-1]||(l+=m?i("M",c+a,.5+A+a):i("m",d,0),d=0,m=!1),c+1':"",c="',A='viewBox="0 0 '+h+" "+h+'"',x=''+f+c+` `;return typeof a=="function"&&a(null,x),x},Pt}var Be;function Zn(){if(Be)return G;Be=1;const e=Nn(),s=Yn(),i=Qn(),o=jn();function r(n,a,l,d,m){const h=[].slice.call(arguments,1),f=h.length,c=typeof h[f-1]=="function";if(!c&&!e())throw new Error("Callback required as last argument");if(c){if(f<2)throw new Error("Too few arguments provided");f===2?(m=l,l=a,a=d=void 0):f===3&&(a.getContext&&typeof m>"u"?(m=d,d=void 0):(m=d,d=l,l=a,a=void 0))}else{if(f<1)throw new Error("Too few arguments provided");return f===1?(l=a,a=d=void 0):f===2&&!a.getContext&&(d=l,l=a,a=void 0),new Promise(function(A,x){try{const T=s.create(l,d);A(n(T,a,d))}catch(T){x(T)}})}try{const A=s.create(l,d);m(null,n(A,a,d))}catch(A){m(A)}}return G.create=s.create,G.toCanvas=r.bind(null,i.render),G.toDataURL=r.bind(null,i.renderToDataURL),G.toString=r.bind(null,function(n,a,l){return o.render(n,l)}),G}var Kn=Zn();const Wn=ps(Kn),Jn={name:"QRDialog",components:{NcDialog:vt},props:{title:{type:String,default:""},text:{type:String,default:""}},emits:["closed"],data(){return{uri:{type:String,default:""},isOpen:{type:Boolean,default:!1}}},watch:{text:{immediate:!0,handler(){this.generateQr(),this.isOpen=!!this.text}}},methods:{async generateQr(){if(this.text)try{this.uri=await Wn.toDataURL(this.text,{width:256})}catch(e){console.error(e)}else this.uri=null}}};var Gn=function(){var e=this,s=e._self._c;return s("NcDialog",{attrs:{"close-on-click-outside":"",name:e.title,open:e.isOpen},on:{close:function(i){e.isOpen=!1},"update:open":function(i){return e.$emit("closed",!0)}}},[s("div",{staticClass:"qr-dialog__content"},[s("img",{attrs:{src:e.uri,title:e.text,alt:e.t("forms","QR code representation of {text}",{text:e.text})}})])])},Xn=[],ta=I(Jn,Gn,Xn,!1,null,null);const ea=ta.exports,sa={methods:{getInternalShareLink(e){return window.location.protocol+"//"+window.location.host+j(`/apps/forms/${this.form.hash}`)},getPublicShareLink(e){let s;return this.isEmbeddingAllowed(e)?s=j(`/apps/forms/embed/${e.shareWith}`):s=j(`/apps/forms/s/${e.shareWith}`),new URL(s,window.location).href},isEmbeddingAllowed(e){return e.shareType===this.SHARE_TYPES.SHARE_TYPE_LINK&&e.permissions?.includes(this.PERMISSION_TYPES.PERMISSION_EMBED)},async copyLink(e,s){try{await navigator.clipboard.writeText(s),Q(t("forms","Form link copied"))}catch(i){R(t("forms","Cannot copy, please copy the link manually")),L.error("Copy link failed",{error:i})}e.target.focus()},async copyEmbeddingCode(e){const s=``;try{await navigator.clipboard.writeText(s),Q(t("forms","Embedding code copied"))}catch(i){R(t("forms","Cannot copy the code")),L.error("Copy embedding code failed",{error:i})}event.target.focus()}}},ia={components:{FormsIcon:Yt,IconAccountMultiple:Yr,IconCodeBrackets:Wr,IconCopyAll:hn,IconDelete:gt,IconLinkBoxVariantOutline:en,IconLinkVariant:Xe,IconPlus:Ot,IconQr:an,NcActions:it,NcActionButton:ot,NcActionLink:$s,NcCheckboxRadioSwitch:We,NcNoteCard:Dt,QRDialog:ea,SharingSearchDiv:Cn,SharingShareDiv:En},mixins:[_t,sa,ct],props:{form:{type:Object,required:!0},locked:{type:Boolean,required:!0},lockedUntil:{type:String,default:""}},data(){return{isLoading:!1,appConfig:tt(ht,"appConfig"),qrDialogText:""}},computed:{sortedShares(){return this.form.shares.filter(e=>e.shareType!==this.SHARE_TYPES.SHARE_TYPE_LINK).sort(this.sortByTypeAndDisplayname)},hasPublicLink(){return this.publicLinkShares.length!==0},publicLinkShares(){const e=this.form.shares.filter(s=>s.shareType===this.SHARE_TYPES.SHARE_TYPE_LINK);return e.sort((s,i)=>this.isEmbeddingAllowed(s)?1:this.isEmbeddingAllowed(i)?-1:0),e}},methods:{async addShare(e){this.isLoading=!0;try{const s=await M.post(H("apps/forms/api/v3/forms/{id}/shares",{id:this.form.id}),{shareType:e.shareType,shareWith:e.shareWith}),i=O(s);this.$emit("add-share",i)}catch(s){L.error("Error while adding new share",{error:s,share:e}),R(t("forms","There was an error while adding the share"))}finally{this.isLoading=!1}},async addPublicLink(){this.isLoading=!0;try{const e=await M.post(H("apps/forms/api/v3/forms/{id}/shares",{id:this.form.id}),{shareType:this.SHARE_TYPES.SHARE_TYPE_LINK}),s=O(e);this.$emit("add-share",s)}catch(e){L.error("Error adding public link",{error:e}),R(t("forms","There was an error while adding the link"))}finally{this.isLoading=!1}},makeEmbeddable(e){this.updateShare({...e,permissions:[...e.permissions,this.PERMISSION_TYPES.PERMISSION_EMBED]})},async updateShare(e){this.isLoading=!0;try{const s=await M.patch(H("apps/forms/api/v3/forms/{id}/shares/{shareId}",{id:this.form.id,shareId:e.id}),{keyValuePairs:{permissions:e.permissions}}),i=Object.assign(e,{id:O(s)});this.$emit("update-share",i)}catch(s){L.error("Error while updating share",{error:s,share:e}),R(t("forms","There was an error while updating the share"))}finally{this.isLoading=!1}},async removeShare(e){this.isLoading=!0;try{await M.delete(H("apps/forms/api/v3/forms/{id}/shares/{shareId}",{id:this.form.id,shareId:e.id})),this.$emit("remove-share",e)}catch(s){L.error("Error while removing share",{error:s,share:e}),R(t("forms","There was an error while removing the share"))}finally{this.isLoading=!1}},sortByTypeAndDisplayname(e,s){return e.shareTypes.shareType?1:e.displayName.toLowerCase()s.displayName.toLowerCase()?1:0},onPermitAllUsersChange(e){const s={...this.form.access};s.permitAllUsers=e,this.$emit("update:formProp","access",s)},onShowToAllUsersChange(e){const s={...this.form.access};s.showToAllUsers=e,this.$emit("update:formProp","access",s)},openQrDialog(e){this.qrDialogText=this.getPublicShareLink(e)}}};var oa=function(){var e=this,s=e._self._c;return s("div",{staticClass:"sidebar-tabs__content"},[e.locked?s("NcNoteCard",{attrs:{type:"info",heading:e.t("forms","Form is locked"),text:e.t("forms","Lock by {lockedBy}, expires: {lockedUntil}",{lockedBy:e.form.lockedBy?e.form.lockedBy:e.form.ownerId,lockedUntil:e.lockedUntil===""?e.t("forms","never"):e.lockedUntil})}}):e._e(),s("SharingSearchDiv",{attrs:{"current-shares":e.form.shares,"show-loading":e.isLoading,locked:e.locked},on:{"add-share":e.addShare}}),!e.hasPublicLink&&e.appConfig.allowPublicLink?s("div",{staticClass:"share-div share-div--link"},[s("div",{staticClass:"share-div__avatar"},[s("IconLinkVariant",{attrs:{size:20}})],1),s("span",{staticClass:"share-div__desc"},[e._v(e._s(e.t("forms","Share link")))]),s("NcActions",[s("NcActionButton",{attrs:{disabled:e.locked},on:{click:e.addPublicLink},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconPlus",{attrs:{size:20}})]},proxy:!0}],null,!1,1991456921)},[e._v(" "+e._s(e.t("forms","Add link"))+" ")])],1)],1):s("TransitionGroup",{attrs:{tag:"div"}},e._l(e.publicLinkShares,function(i){return s("div",{key:"share-"+i.shareType+"-"+i.shareWith,staticClass:"share-div share-div--link",class:{"share-div--embeddable":e.isEmbeddingAllowed(i)},attrs:{set:void(e.isEmbeddable=e.isEmbeddingAllowed(i))}},[s("div",{staticClass:"share-div__avatar"},[e.isEmbeddable?s("IconLinkBoxVariantOutline",{attrs:{size:20}}):s("IconLinkVariant",{attrs:{size:20}})],1),s("span",{staticClass:"share-div__desc"},[e._v(e._s(e.isEmbeddable?e.t("forms","Embeddable link"):e.t("forms","Share link")))]),s("NcActions",{attrs:{inline:1}},[s("NcActionLink",{attrs:{href:e.getPublicShareLink(i)},on:{click:function(o){o.preventDefault(),e.copyLink(o,e.getPublicShareLink(i))}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconCopyAll",{attrs:{size:20}})]},proxy:!0}],null,!0)},[e._v(" "+e._s(e.t("forms","Copy to clipboard"))+" ")]),s("NcActionButton",{on:{click:function(o){return e.openQrDialog(i)}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconQr",{attrs:{size:20}})]},proxy:!0}],null,!0)},[e._v(" "+e._s(e.t("forms","Show QR code"))+" ")]),e.isEmbeddable?s("NcActionButton",{on:{click:function(o){return e.copyEmbeddingCode(i)}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconCodeBrackets",{attrs:{size:20}})]},proxy:!0}],null,!0)},[e._v(" "+e._s(e.t("forms","Copy embedding code"))+" ")]):s("NcActionButton",{attrs:{disabled:e.locked},on:{click:function(o){return e.makeEmbeddable(i)}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconLinkBoxVariantOutline",{attrs:{size:20}})]},proxy:!0}],null,!0)},[e._v(" "+e._s(e.t("forms","Convert to embeddable link"))+" ")]),s("NcActionButton",{attrs:{disabled:e.locked},on:{click:function(o){return e.removeShare(i)}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconDelete",{attrs:{size:20}})]},proxy:!0}],null,!0)},[e._v(" "+e._s(e.t("forms","Remove link"))+" ")]),e.appConfig.allowPublicLink?s("NcActionButton",{attrs:{"close-after-click":"",disabled:e.locked},on:{click:e.addPublicLink},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconPlus",{attrs:{size:20}})]},proxy:!0}],null,!0)},[e._v(" "+e._s(e.t("forms","Add link"))+" ")]):e._e()],1)],1)}),0),s("QRDialog",{attrs:{title:e.t("forms","Share {formTitle}",{formTitle:e.form.title},{escape:!1,sanitize:!1}),text:e.qrDialogText},on:{closed:function(i){e.qrDialogText=""}}}),s("div",{staticClass:"share-div"},[s("div",{staticClass:"share-div__avatar"},[s("IconLinkVariant",{attrs:{size:20}})],1),s("div",{staticClass:"share-div__desc share-div__desc--twoline"},[s("span",[e._v(e._s(e.t("forms","Internal link")))]),s("span",[e._v(e._s(e.t("forms","Only works for logged in accounts with access rights")))])]),s("NcActions",[s("NcActionLink",{attrs:{href:e.getInternalShareLink(e.form.hash)},on:{click:function(i){i.preventDefault(),e.copyLink(i,e.getInternalShareLink(e.form.hash))}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconCopyAll",{attrs:{size:20}})]},proxy:!0}])},[e._v(" "+e._s(e.t("forms","Copy to clipboard"))+" ")])],1)],1),e.appConfig.allowPermitAll?s("div",[s("div",{staticClass:"share-div"},[s("div",{staticClass:"share-div__avatar"},[s("IconAccountMultiple",{attrs:{size:20}})],1),s("label",{staticClass:"share-div__desc",attrs:{for:"share-switch__permit-all"}},[e._v(" "+e._s(e.t("forms","Permit access to all logged in accounts"))+" ")]),s("NcCheckboxRadioSwitch",{attrs:{id:"share-switch__permit-all",checked:e.form.access.permitAllUsers,disabled:e.locked,type:"switch"},on:{"update:checked":e.onPermitAllUsersChange}})],1),e.appConfig.allowShowToAll&&e.form.access.permitAllUsers?s("div",{staticClass:"share-div share-div--indent"},[s("div",{staticClass:"share-div__avatar"},[s("FormsIcon",{attrs:{size:16}})],1),s("label",{staticClass:"share-div__desc",attrs:{for:"share-switch__show-to-all"}},[e._v(" "+e._s(e.t("forms","Show to all accounts on sidebar"))+" ")]),s("NcCheckboxRadioSwitch",{attrs:{id:"share-switch__show-to-all",checked:e.form.access.showToAllUsers,disabled:e.locked,type:"switch"},on:{"update:checked":e.onShowToAllUsersChange}})],1):e._e()]):e._e(),s("TransitionGroup",{attrs:{tag:"ul"}},e._l(e.sortedShares,function(i){return s("SharingShareDiv",{key:"share-"+i.shareType+"-"+i.shareWith,attrs:{share:i,locked:e.locked},on:{"remove-share":e.removeShare,"update:share":e.updateShare}})}),1)],1)},ra=[],na=I(ia,oa,ra,!1,null,"77d05e93");const aa=na.exports,la={components:{NcButton:st,NcDialog:vt,NcTextField:Qe,NcSelectUsers:je},mixins:[os],props:{form:{type:Object,required:!0},isOwner:{type:Boolean,required:!0},locked:{type:Boolean,required:!0}},data(){return{selected:null,showModal:!1,confirmationInput:"",loading:!1}},computed:{canTransfer(){return this.confirmationInput===this.confirmationString&&!!this.selected},confirmationString(){return`${this.form.ownerId}/${this.form.title.replace(/\s/g," ").trim()}`},options(){return this.isValidQuery?this.suggestions:this.recommendations}},methods:{clearText(){this.confirmationInput=""},closeModal(){this.showModal=!1},escapedString(e){return""+e.replace("<","<").replace(">",">")},openModal(){this.showModal=!0},async onOwnershipTransfer(){if(this.showModal=!1,this.form.id&&this.selected.shareWith)try{D("forms:last-updated:set",this.form.id),await M.patch(H("apps/forms/api/v3/forms/{id}",{id:this.form.id}),{keyValuePairs:{ownerId:this.selected.shareWith}}),Q(`${t("forms","This form is now owned by")} ${this.selected.displayName}`),D("forms:ownership-transfered",this.form.id)}catch(e){L.error("Error while transfering form ownership",{error:e}),R(t("forms","An error occurred while transfering ownership"))}else L.error("Null parameters while transfering form ownership",{selectedUser:this.selected}),R(t("forms","An error occurred while transfering ownership"))}}};var ca=function(){var e=this,s=e._self._c;return s("div",[s("NcButton",{staticClass:"transfer-button",attrs:{alignment:"start",variant:"tertiary",wide:"",disabled:e.locked||!e.isOwner},on:{click:e.openModal}},[s("span",{staticClass:"transfer-button__text"},[e._v(e._s(e.t("forms","Transfer ownership")))])]),s("NcDialog",{attrs:{open:e.showModal,"content-classes":"modal-content",name:e.t("forms","Transfer ownership"),"out-transition":""},on:{"update:open":function(i){e.showModal=i},close:e.closeModal},scopedSlots:e._u([{key:"default",fn:function(){return[s("p",{domProps:{innerHTML:e._s(e.t("forms","You're going to transfer the ownership of {name} to another account. Please select the account to which you want to transfer ownership.",{name:`${e.escapedString(e.form.title)}`},void 0,{escape:!1}))}}),s("NcSelectUsers",{staticClass:"modal-content__select",attrs:{loading:e.loading,options:e.options,placeholder:e.t("forms","Search for a user")},on:{search:i=>e.asyncSearch(i,[e.SHARE_TYPES.SHARE_TYPE_USER])},scopedSlots:e._u([{key:"no-options",fn:function(){return[e._v(" "+e._s(e.noResultText)+" ")]},proxy:!0}]),model:{value:e.selected,callback:function(i){e.selected=i},expression:"selected"}}),s("br"),s("p",{domProps:{innerHTML:e._s(e.t("forms","Type {text} to confirm.",{text:`${e.escapedString(e.confirmationString)}`},void 0,{escape:!1}))}}),s("NcTextField",{attrs:{label:e.t("forms","Confirmation text"),value:e.confirmationInput,success:e.confirmationInput===e.confirmationString},on:{"update:value":function(i){e.confirmationInput=i}}}),s("br"),s("p",[s("strong",[e._v(e._s(e.t("forms","This can not be undone.")))])])]},proxy:!0},{key:"actions",fn:function(){return[s("NcButton",{attrs:{disabled:!e.canTransfer,variant:"error"},on:{click:e.onOwnershipTransfer}},[e._v(" "+e._s(e.t("forms","I understand, transfer this form"))+" ")])]},proxy:!0}])})],1)},ua=[],da=I(la,ca,ua,!1,null,"7b05bcf9");const ha=da.exports;var Vt={exports:{}},ma=Vt.exports,De;function fa(){return De||(De=1,(function(e,s){(function(i,o){e.exports=o()})(ma,function(){var i="__v-click-outside",o=typeof window<"u",r=typeof navigator<"u",n=o&&("ontouchstart"in window||r&&navigator.msMaxTouchPoints>0)?["touchstart"]:["click"];function a(h){var f=h.event,c=h.handler;(0,h.middleware)(f)&&c(f)}function l(h,f){var c=(function(p){var v=typeof p=="function";if(!v&&typeof p!="object")throw new Error("v-click-outside: Binding value must be a function or an object");return{handler:v?p:p.handler,middleware:p.middleware||function(_){return _},events:p.events||n,isActive:p.isActive!==!1,detectIframe:p.detectIframe!==!1,capture:!!p.capture}})(f.value),A=c.handler,x=c.middleware,T=c.detectIframe,V=c.capture;if(c.isActive){if(h[i]=c.events.map(function(p){return{event:p,srcTarget:document.documentElement,handler:function(v){return(function(_){var P=_.el,u=_.event,y=_.handler,b=_.middleware,g=u.composedPath&&u.composedPath()||u.path;(g?g.indexOf(P)<0:!P.contains(u.target))&&a({event:u,handler:y,middleware:b})})({el:h,event:v,handler:A,middleware:x})},capture:V}}),T){var S={event:"blur",srcTarget:window,handler:function(p){return(function(v){var _=v.el,P=v.event,u=v.handler,y=v.middleware;setTimeout(function(){var b=document.activeElement;b&&b.tagName==="IFRAME"&&!_.contains(b)&&a({event:P,handler:u,middleware:y})},0)})({el:h,event:p,handler:A,middleware:x})},capture:V};h[i]=[].concat(h[i],[S])}h[i].forEach(function(p){var v=p.event,_=p.srcTarget,P=p.handler;return setTimeout(function(){h[i]&&_.addEventListener(v,P,V)},0)})}}function d(h){(h[i]||[]).forEach(function(f){return f.srcTarget.removeEventListener(f.event,f.handler,f.capture)}),delete h[i]}var m=o?{bind:l,update:function(h,f){var c=f.value,A=f.oldValue;JSON.stringify(c)!==JSON.stringify(A)&&(d(h),l(h,{value:c}))},unbind:d}:{};return{install:function(h){h.directive("click-outside",m)},directive:m}})})(Vt)),Vt.exports}var pa=fa();const ga='',va={components:{NcButton:st,NcCheckboxRadioSwitch:We,NcDateTimePicker:Hs,NcIconSvgWrapper:gs,NcNoteCard:Dt,TransferOwnership:ha},directives:{ClickOutside:pa.directive},mixins:[_t],inject:["$markdownit"],props:{form:{type:Object,required:!0},locked:{type:Boolean,required:!0},lockedUntil:{type:String,default:""}},data(){return{formatter:{stringify:this.stringifyDate,parse:this.parseTimestampToDate},maxStringLengths:tt("forms","maxStringLengths"),editMessage:!1,svgLockOpen:ga}},computed:{isCurrentUserOwner(){return at().uid===this.form.ownerId},isFormLockedPermanently(){return this.locked&&this.form.lockedUntil===0},hasCustomSubmissionMessage(){return this.form?.submissionMessage!==void 0&&this.form?.submissionMessage!==null},disableSubmitMultiple(){return this.hasPublicLink||this.form.isAnonymous},disableSubmitMultipleExplanation(){return this.disableSubmitMultiple?t("forms","This can not be controlled, if the form has a public link or stores responses anonymously."):""},hasPublicLink(){return this.form.shares.filter(e=>e.shareType===this.SHARE_TYPES.SHARE_TYPE_LINK).length!==0},submitMultiple(){return this.disableSubmitMultiple||this.form.submitMultiple},formExpires(){return this.form.expires!==0},formArchived(){return this.form.state===B.FormArchived},formClosed(){return this.form.state!==B.FormActive},isExpired(){return this.form.expires&&F().unix()>this.form.expires},expirationDate(){return F(this.form.expires,"X").toDate()},submissionMessageHTML(){return this.$markdownit.render(this.form.submissionMessage||"")}},methods:{onAnonChange(e){this.$emit("update:formProp","isAnonymous",e)},onSubmitMultipleChange(e){this.$emit("update:formProp","submitMultiple",e)},onAllowEditSubmissionsChange(e){this.$emit("update:formProp","allowEditSubmissions",e)},onFormExpiresChange(e){e?this.$emit("update:formProp","expires",F().add(1,"hour").unix()):this.$emit("update:formProp","expires",0)},onShowExpirationChange(e){this.$emit("update:formProp","showExpiration",e)},onExpirationDateChange(e){this.$emit("update:formProp","expires",parseInt(F(e).format("X")))},onFormClosedChange(e){this.$emit("update:formProp","state",e?B.FormClosed:B.FormActive)},onFormLockChange(e){this.$emit("update:formProp","lockedUntil",e?0:null)},onFormArchivedChange(e){this.$emit("update:formProp","state",e?B.FormArchived:B.FormClosed)},onSubmissionMessageChange({target:e}){this.$emit("update:formProp","submissionMessage",e.value)},onUpdateHasCustomSubmissionMessage(){this.hasCustomSubmissionMessage?this.$emit("update:formProp","submissionMessage",null):this.$emit("update:formProp","submissionMessage","")},stringifyDate(e){const s=F(e).format("LLL");return this.isExpired?t("forms","Expired on {date}",{date:s}):t("forms","Expires on {date}",{date:s})},parseTimestampToDate(e){return F(e,"X").toDate()},notBeforeToday(e){return e{e.editMessage=!1}),expression:` () => { editMessage = false } `}],staticClass:"submission-message__input",attrs:{"aria-describedby":"forms-submission-message-description","aria-label":e.t("forms","Custom submission message"),disabled:e.locked,maxlength:e.maxStringLengths.submissionMessage,placeholder:e.t("forms","Message to show after a user submitted the form (formatting using Markdown is supported)")},domProps:{value:e.form.submissionMessage},on:{blur:function(i){e.editMessage=!1},change:e.onSubmissionMessageChange}}):s("div",{staticClass:"submission-message__output",attrs:{"aria-label":e.t("forms","Custom submission message")},domProps:{innerHTML:e._s(e.submissionMessageHTML)}}),s("div",{staticClass:"submission-message__description",attrs:{id:"forms-submission-message-description"}},[e._v(" "+e._s(e.t("forms","Message to show after a user submitted the form. Please note that the message will not be translated!"))+" ")])]),s("TransferOwnership",{attrs:{locked:e.locked,"is-owner":e.isCurrentUserOwner,form:e.form}})],1)},_a=[],ba=I(va,ya,_a,!1,null,"e656b071");const wa=ba.exports,Ca={name:"Sidebar",components:{IconSettings:Or,IconShareVariant:zt,NcAppSidebar:Ms,NcAppSidebarTab:Ei,SharingSidebarTab:aa,SettingsSidebarTab:wa},mixins:[Bt],props:{active:{type:String,default:"forms-sharing"}},computed:{lockedUntilFormatted(){return this.form.lockedUntil===0||this.form.lockedUntil===null?"":F(this.form.lockedUntil,"X").fromNow()}},methods:{onUpdateActive(e){this.$emit("update:active",e)},onPropertyChange(e,s){this.$set(this.form,e,s),this.saveFormProperty(e)},onAddShare(e){this.form.shares.push(e),D("forms:last-updated:set",this.form.id)},onRemoveShare(e){const s=this.form.shares.findIndex(i=>i.id===e.id);this.form.shares.splice(s,1),D("forms:last-updated:set",this.form.id)},onUpdateShare(e){const s=this.form.shares.findIndex(i=>i.id===e.id);this.form.shares.splice(s,1,e),D("forms:last-updated:set",this.form.id)}}};var Sa=function(){var e=this,s=e._self._c;return s("NcAppSidebar",{attrs:{open:e.sidebarOpened,active:e.active,name:e.t("forms","Form settings")},on:{"update:active":e.onUpdateActive,"update:open":function(i){return e.$emit("update:sidebarOpened",i)}}},[s("NcAppSidebarTab",{attrs:{id:"forms-sharing",order:0,name:e.t("forms","Sharing")},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconShareVariant",{attrs:{size:20}})]},proxy:!0}])},[s("SharingSidebarTab",{attrs:{form:e.form,locked:e.isFormLocked,"locked-until":e.lockedUntilFormatted},on:{"update:formProp":e.onPropertyChange,"add-share":e.onAddShare,"remove-share":e.onRemoveShare,"update-share":e.onUpdateShare}})],1),s("NcAppSidebarTab",{attrs:{id:"forms-settings",order:1,name:e.t("forms","Settings")},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconSettings",{attrs:{size:20}})]},proxy:!0}])},[s("SettingsSidebarTab",{attrs:{form:e.form,locked:e.isFormLocked,"locked-until":e.lockedUntilFormatted},on:{"update:formProp":e.onPropertyChange}})],1)],1)},ka=[],Aa=I(Ca,Sa,ka,!1,null,"186d862f");const xa=Aa.exports,Ea={name:"Forms",components:{AppNavigationForm:is,ArchivedFormsModal:Rr,FormsIcon:Yt,IconArchive:ss,IconPlus:Ot,NcAppContent:Ut,NcAppNavigation:hi,NcAppNavigationCaption:vi,NcAppNavigationNew:Ci,NcButton:st,NcContent:Ys,NcEmptyContent:$t,NcLoadingIcon:yt,Sidebar:xa},mixins:[ct],setup(){return{isMobile:Oe()}},data(){return{loading:!0,sidebarOpened:!1,sidebarActive:"forms-sharing",forms:[],allSharedForms:[],showArchivedForms:!1,canCreateForms:tt(ht,"appConfig").canCreateForms}},computed:{canEdit(){return this.selectedForm.permissions.includes(this.PERMISSION_TYPES.PERMISSION_EDIT)},hasForms(){return this.allSharedForms.length>0||this.forms.length>0},ownedForms(){return this.forms.filter(e=>e.state!==B.FormArchived)},sharedForms(){return this.allSharedForms.filter(e=>e.state!==B.FormArchived)},archivedForms(){return[...this.forms,...this.allSharedForms].filter(e=>e.state===B.FormArchived)},routeHash(){return this.$route.params.hash},routeAllowed(){if(this.loading&&tt(ht,"formId")==="invalid"||!this.routeHash)return!1;const e=[...this.forms,...this.allSharedForms].find(s=>s.hash===this.routeHash);return e===void 0?(this.fetchPartialForm(this.routeHash),!1):this.$route.name==="results"?e.permissions.includes(this.$route.name)||e.submissionCount>0:e.permissions.includes(this.$route.name)},selectedForm:{get(){return this.routeAllowed?this.forms.concat(this.allSharedForms).find(e=>e.hash===this.routeHash):{}},set(e){this.sidebarOpened=!1;let s=this.forms.findIndex(i=>i.hash===this.routeHash);if(s>-1){this.$set(this.forms,s,e);return}s=this.allSharedForms.findIndex(i=>i.hash===this.routeHash),s>-1&&this.$set(this.allSharedForms,s,e)}}},beforeMount(){this.loadForms()},mounted(){Ft("forms:last-updated:set",e=>this.onLastUpdatedByEventBus(e)),Ft("forms:ownership-transfered",e=>this.onDeleteForm(e))},unmounted(){Rt("forms:last-updated:set",e=>this.onLastUpdatedByEventBus(e)),Rt("forms:ownership-transfered",e=>this.onDeleteForm(e))},methods:{mobileCloseNavigation(){this.isMobile&&D("toggle-navigation",{open:!1})},openSharing(e){e!==this.routeHash&&this.$router.push({name:"edit",params:{hash:e}}),this.sidebarActive="forms-sharing",this.sidebarOpened=!0},async loadForms(){this.loading=!0;try{const e=await M.get(H("apps/forms/api/v3/forms"));this.forms=O(e)}catch(e){L.error("Error while loading owned forms list",{error:e}),R(t("forms","An error occurred while loading the forms list"))}try{const e=await M.get(H("apps/forms/api/v3/forms?type=shared"));this.allSharedForms=O(e)}catch(e){L.error("Error while loading shared forms list",{error:e}),R(t("forms","An error occurred while loading the forms list"))}this.loading=!1},async fetchPartialForm(e){if(await new Promise(s=>{const i=()=>{this.loading?window.setTimeout(i,250):s()};i()}),this.loading=!0,[...this.forms,...this.allSharedForms].find(s=>s.hash===e)===void 0)try{const s=await M.get(H("apps/forms/api/v3/forms/{id}",{id:tt(ht,"formId")})),i=O(s);i.permissions.includes(this.PERMISSION_TYPES.PERMISSION_SUBMIT)&&this.allSharedForms.push(i)}catch(s){L.error(`Form ${e} not found`,{error:s}),R(t("forms","Form not found")),[403,404].includes(s.response?.status)&&this.$route.name!=="root"&&this.$router.push({name:"root"})}this.loading=!1},async onNewForm(){try{const e=await M.post(H("apps/forms/api/v3/forms")),s=O(e);this.forms.unshift(s),this.$router.push({name:"edit",params:{hash:s.hash}}),this.mobileCloseNavigation()}catch(e){L.error("Unable to create new form",{error:e}),R(t("forms","Unable to create a new form"))}},async onCloneForm(e){try{const s=await M.post(H("apps/forms/api/v3/forms?fromId={id}",{id:e})),i=O(s);this.forms.unshift(i),this.$router.push({name:"edit",params:{hash:i.hash}}),this.mobileCloseNavigation()}catch(s){L.error(`Unable to copy form ${e}`,{error:s}),R(t("forms","Unable to copy form"))}},async onDeleteForm(e){const s=this.forms.findIndex(o=>o.id===e),i=this.forms[s].hash;this.forms.splice(s,1),i===this.routeHash&&this.$route.name!=="root"&&this.$router.push({name:"root"})},onLastUpdatedByEventBus(e){const s=this.forms.findIndex(i=>i.id===e);if(s!==-1)this.forms[s].lastUpdated=F().unix(),this.forms.sort((i,o)=>o.lastUpdated-i.lastUpdated);else{const i=this.allSharedForms.findIndex(o=>o.id===e);this.allSharedForms[i].lastUpdated=F().unix(),this.allSharedForms.sort((o,r)=>r.lastUpdated-o.lastUpdated)}}}};var Na=function(){var e=this,s=e._self._c;return s("NcContent",{attrs:{"app-name":"forms"}},[e.canCreateForms||e.hasForms?s("NcAppNavigation",{attrs:{"aria-label":e.t("forms","Forms navigation")},scopedSlots:e._u([{key:"footer",fn:function(){return[e.archivedForms.length>0?s("div",{staticClass:"forms-navigation-footer"},[s("NcButton",{staticClass:"forms__archived-forms-toggle",attrs:{alignment:"start",variant:"tertiary",wide:""},on:{click:function(i){e.showArchivedForms=!0}},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconArchive",{attrs:{size:20}})]},proxy:!0}],null,!1,1438813153)},[e._v(" "+e._s(e.t("forms","Archived forms"))+" ")])],1):e._e()]},proxy:!0}],null,!1,1570565164)},[e.canCreateForms?s("NcAppNavigationNew",{attrs:{text:e.t("forms","New form")},on:{click:e.onNewForm},scopedSlots:e._u([{key:"icon",fn:function(){return[s("IconPlus",{attrs:{size:20,decorative:""}})]},proxy:!0}],null,!1,1626299775)}):e._e(),e.ownedForms.length>0?[s("NcAppNavigationCaption",{staticClass:"forms-navigation__list-heading",attrs:{"is-heading":"","heading-id":"forms-navigation-your-forms",name:e.t("forms","Your forms")}}),s("ul",{attrs:{"aria-labelledby":"forms-navigation-your-forms"}},e._l(e.ownedForms,function(i){return s("AppNavigationForm",{key:i.id,attrs:{form:i,"read-only":!1},on:{"open-sharing":e.openSharing,"mobile-close-navigation":e.mobileCloseNavigation,clone:e.onCloneForm,delete:e.onDeleteForm}})}),1)]:e._e(),e.sharedForms.length>0?[s("NcAppNavigationCaption",{staticClass:"forms-navigation__list-heading",attrs:{"is-heading":"","heading-id":"forms-navigation-shared-forms",name:e.t("forms","Shared with you")}}),s("ul",{attrs:{"aria-labelledby":"forms-navigation-shared-forms"}},e._l(e.sharedForms,function(i){return s("AppNavigationForm",{key:i.id,attrs:{form:i,"read-only":""},on:{"open-sharing":e.openSharing,clone:e.onCloneForm,"mobile-close-navigation":e.mobileCloseNavigation}})}),1)]:e._e()],2):e._e(),e.loading||!e.routeHash||!e.routeAllowed?s("NcAppContent",[e.loading?s("NcEmptyContent",{staticClass:"forms-emptycontent",attrs:{name:e.t("forms","Loading forms …")},scopedSlots:e._u([{key:"icon",fn:function(){return[s("NcLoadingIcon",{attrs:{size:64}})]},proxy:!0}],null,!1,826850984)}):e.hasForms?s("NcEmptyContent",{staticClass:"forms-emptycontent",attrs:{name:e.canCreateForms?e.t("forms","Select a form or create a new one"):e.t("forms","Please select a form")},scopedSlots:e._u([{key:"icon",fn:function(){return[s("FormsIcon",{attrs:{size:64}})]},proxy:!0},e.canCreateForms?{key:"action",fn:function(){return[s("NcButton",{attrs:{variant:"primary"},on:{click:e.onNewForm}},[e._v(" "+e._s(e.t("forms","Create new form"))+" ")])]},proxy:!0}:null],null,!0)}):s("NcEmptyContent",{staticClass:"forms-emptycontent",attrs:{name:e.t("forms","No forms created yet")},scopedSlots:e._u([{key:"icon",fn:function(){return[s("FormsIcon",{attrs:{size:64}})]},proxy:!0},e.canCreateForms?{key:"action",fn:function(){return[s("NcButton",{attrs:{variant:"primary"},on:{click:e.onNewForm}},[e._v(" "+e._s(e.t("forms","Create a form"))+" ")])]},proxy:!0}:null],null,!0)})],1):[s("router-view",{attrs:{form:e.selectedForm,"sidebar-opened":e.sidebarOpened},on:{"update:form":function(i){e.selectedForm=i},"update:sidebarOpened":function(i){e.sidebarOpened=i},"update:sidebar-opened":function(i){e.sidebarOpened=i},"open-sharing":e.openSharing}}),!e.selectedForm.partial&&e.canEdit?s("Sidebar",{attrs:{form:e.selectedForm,"sidebar-opened":e.sidebarOpened,active:e.sidebarActive},on:{"update:sidebarOpened":function(i){e.sidebarOpened=i},"update:sidebar-opened":function(i){e.sidebarOpened=i},"update:active":function(i){e.sidebarActive=i}}}):e._e()],s("ArchivedFormsModal",{attrs:{open:e.showArchivedForms,forms:e.archivedForms},on:{"update:open":function(i){e.showArchivedForms=i},clone:e.onCloneForm}})],2)},Ia=[],La=I(Ea,Na,Ia,!1,null,"20c1d59e");const Ta=La.exports;X.directive("tooltip",Us),X.prototype.t=qe,X.prototype.n=vs,new X({el:"#content",name:"FormsRoot",router:vr,render:e=>e(Ta)}); //# sourceMappingURL=forms-main.mjs.map