text: this.Cms_Form=function(){function n(){}return n.options={check:{syntax:!0}},n.addonSelector=".mod-cms-body",n.render=function(){n.options.check.syntax&&Syntax_Checker.render(n,{afterCheck:n.afterSyntaxCheck}),Link_Checker.render(),Mobile_Size_Checker.render(),Form_Alert.addValidation(Form_Alert.clonedName),Form_Alert.addValidation(Form_Alert.closeConfirmation),n.options.check.syntax&&Form_Alert.addValidation(Form_Alert.validateSyntaxCheck),Form_Alert.addValidation(Mobile_Size_Checker.validateHtml),Form_Alert.render(),Form_Preview.render()},n.editorId="item_html",n.getEditorHtml=function(e){return null==e&&(e=null),e||(e=n.editorId),"undefined"!=typeof tinymce?"<div>"+tinymce.get(e).getContent()+"</div>":"undefined"!=typeof CKEDITOR?"<div>"+CKEDITOR.instances[e].getData()+"</div>":""},n.setEditorHtml=function(e,t){return t=t||{},id=t.id,null==id&&(id=null),id||(id=n.editorId),"undefined"!=typeof tinymce?tinymce.get(id).setContent(e):"undefined"!=typeof CKEDITOR?CKEDITOR.instances[id].setData(e):void 0},n.syntaxChecks={},n.addSyntaxCheck=function(e,t){n.syntaxChecks[e]=t},n.activateSyntaxChecks=function(){Syntax_Checker.resetChecks(),$.each(n.syntaxChecks,function(e,t){var n=$("#"+e)[0];n&&$(n).is(":visible")&&Syntax_Checker.addCheck(e,t)})},n.afterSyntaxCheck=function(){$("[data-check-presence]").each(function(){var e=$(this).attr("data-check-presence");if(e&&!$(this).val()){var t=null;t=(t=$(this).closest(".column-value").attr("id"))||$(this).closest(".addon-view").attr("id"),Syntax_Checker.errors.push({id:t,idx:0,code:e,msg:e+"\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002",ele:this})}});var e,t,n,o,r=[],i=[];if($("#addon-cms-agents-addons-form-page .column-value-cms-column-headline").each(function(){i.push($(this).attr("id")),r.push($(this).find('[name="item[column_values][][in_wrap][head]"]').val())}),e=[],r.length)for(n=o=0,t=r.length-1;0<=t?o<=t:t<=o;n=0<=t?++o:--o)0===n?/h[12]/i.test(r[n])||e.push(n):/h3/i.test(r[n])?/h[234]/i.test(r[n-1])||e.push(n):/h4/i.test(r[n])&&(/h[34]/i.test(r[n-1])||e.push(n));for(n=0;n<e.length;n++){var a=e[n];Syntax_Checker.errors.push({id:i[a],idx:0,code:r[a],msg:Syntax_Checker.message.invalidOrderOfH,detail:Syntax_Checker.detail.invalidOrderOfH})}},n.form_html_path=null,n.form_link_check_path=null,n.getHtml=function(t,o){if(".mod-cms-body"!==n.addonSelector)if(n.form_html_path){var e=n.getFormData($("#"+Form_Preview.form_id));e.append("route",Form_Preview.page_route),$.ajax({type:"POST",url:n.form_html_path,data:e,processData:!1,contentType:!1,cache:!1,success:function(e){t("<div>"+e+"</div>")},error:function(e,t,n){o&&o(e,t,n)}})}else o&&o(null,null,"form html path is not configured");else t(n.getEditorHtml())},n.getFormData=function(e,t){t||(t={});var n=new FormData;return $.each(e.serializeArray(),function(){(t.preserveMethod||"_method"!==this.name)&&n.append(this.name,this.value)}),n},n}(),this.Form_Alert=function(){function u(){}return(Cms_Form.alert=u).alerts={},u.validations=[],u.beforeSaves=[],u.render=function(){$("input:submit").on("click.form_alert",function(e){var t=this,n=$(t).closest("form"),o=function(e){u.validate(n,t,{html:e})?($(t).off(".form_alert"),$(t).trigger("click")):u.showAlert(n,t)},r=function(e,t,n){alert(n)};return Cms_Form.getHtml(o,r),e.preventDefault(),!1})},u.validate=function(e,t,n){return u.alerts={},$.each(u.validations,function(){this(e,t,n)}),$.isEmptyObject(u.alerts)},u.addValidation=function(e){return u.validations.push(e)},u.runBeforeSave=function(e,t){return $.each(u.beforeSaves,function(){return this(e,t)})},u.showAlert=function(e,t){var n=$('<div id="alertExplanation" class="errorExplanation">');n.append("<h2>\u8b66\u544a</h2>");var o=u.alerts;for(var r in o){var i=o[r];n.append("<p>"+r+"</p>");var a,s,c,l=$("<ul>").appendTo(n);for(a=s=0,c=i.length;s<c;a=++s){var d=i[a];d.msg&&l.append("<li>"+d.msg+"</li>")}}var h=$(document.createElement("footer")).addClass("send");h.append('<button name="button" type="button" class="btn-primary save">\u8b66\u544a\u3092\u7121\u8996\u3059\u308b</button>'),h.append('<button name="button" type="button" class="btn-default cancel">\u30ad\u30e3\u30f3\u30bb\u30eb</button>'),$.colorbox({html:n.get(0).outerHTML+h.get(0).outerHTML,maxHeight:"80%",fixed:!0}),$("#cboxLoadedContent").find(".save").on("click",function(){return u.runBeforeSave(e,t),$(t).off(".form_alert"),$(t).trigger("click")}),$("#cboxLoadedContent").find(".cancel").on("click",function(){return $.colorbox.close(),!1})},u.addBeforeSave=function(e){return u.beforeSaves.push(e)},u.validateSyntaxCheck=function(){Syntax_Checker.asyncCheck(),$.each(Syntax_Checker.errors,function(e,t){u.add("\u30a2\u30af\u30bb\u30b7\u30d3\u30ea\u30c6\u30a3\u30c1\u30a7\u30c3\u30af",t.ele,t.msg)})},u.presence=function(e){return $(e).find("input.presence,textarea.presence").each(function(){var e,t;if(""===$(this).val())return $(this).closest("dl").show(),e=$(this).closest(".addon-view").find("header").text(),t=u.justText($(this).closest("dd").prev("dt")),u.add(e,this,t+"\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002")})},u.clonedName=function(e,t){var n,o;if(o=$(e).find("#addon-basic #item_name"),$(t).hasClass("publish_save")&&/^\[\u8907\u88fd\]/.test($(o).val()))return n=$(o).closest(".addon-view").find("header").text(),u.justText($(o).closest("dd").prev("dt")),u.add(n,o,"\u30bf\u30a4\u30c8\u30eb\u306b[\u8907\u88fd]\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002")},u.closeConfirmation=function(e,t){var n,o;if($(t).attr("data-close-confirmation"))return n="\u975e\u516c\u958b\u72b6\u614b\u3067\u4fdd\u5b58\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059",o=null,$(t).attr("data-contain-links-path")&&(o='<a href="'+$(t).attr("data-contain-links-path")+'" target="_blank">\u3053\u306e\u30da\u30fc\u30b8\u3078\u306e\u30ea\u30f3\u30af\u3092\u78ba\u8a8d\u3059\u308b\u3002</a>'),u.add(n,null,o)},u.add=function(e,t,n){var o;return(o=u.alerts)[e]||(o[e]=[]),u.alerts[e].push({ele:t,msg:n})},u.justText=function(e){return $(e).clone().children().remove().end().text()},u.validateReplaceWord=function(e){var t,n,o,r,i,a;if(a=Syntax_Checker.config.replace_words){for(o in t=["#addon-basic","#addon-cms-agents-addons-meta","#addon-event-agents-addons-date","#addon-map-agents-addons-page"],n=['[name="item[basename]"]',"location-search.keyword"],r=[],a)i=a[o],r.push($(e).find(t.join(",")).find("input,textarea").not(n.join(",")).each(function(){var e,t,n;if((n=$(this).val())&&!$.isEmptyObject(n.match(RegExp(""+o.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),"g"))))return $(this).closest("dl").show(),e=$(this).closest(".addon-view").find(".addon-head").text(),t=u.justText($(this).closest("dd").prev("dt")),u.add(e,this,t+"\u306b\u4f7f\u7528\u304c\u597d\u307e\u3057\u304f\u306a\u3044\u5358\u8a9e\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u300c"+o+"\u300d\u2192\u300c"+i+"\u300d")}));return r}},u}(),this.Form_Preview=function(){function d(){}return d.form_preview_path,d.form_id="item-form",d.page_route,d.render=function(){return $("button.preview").on("click",function(){var e,t,n,o,r,i,a,s,c,l;if(i=$("#"+d.form_id+" input[name='item[name]']").val(),e=$("#"+d.form_id+" input[name='item[basename]']").val(),t=[],i||t.push("\u30bf\u30a4\u30c8\u30eb\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002"),e?/^[\w\-]+(\.html)?$/.test(e)||t.push("\u30d5\u30a1\u30a4\u30eb\u540d\u306f\u4e0d\u6b63\u306a\u5024\u3067\u3059\u3002"):t.push("\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002"),!$.isEmptyObject(t))return alert(t.join("\n")),!1;for(r in s=$('meta[name="csrf-token"]').attr("content"),n=$("<form>"),$(n).attr("method","post"),$(n).attr("action",d.form_preview_path),$(n).attr("target","FormPreview"),a=$("#"+d.form_id).serializeArray())c=a[r],/^item\[/.test(c.name)&&"item[html]"!==c.name&&"item[body_parts][]"!==c.name&&n.append($("<input/>",{name:c.name.replace(/^item\[/,"preview_item["),value:c.value,type:"hidden"}));return $("textarea[id^=item_html_part_]").each(function(){var e;return e=$(this).attr("id"),i=$(this).attr("name").replace(/^item\[/,"preview_item["),n.append($("<input/>",{name:i,value:Cms_Form.getEditorHtml(e),type:"hidden"}))}),n.append($("<input/>",{name:"preview_item[route]",value:d.page_route,type:"hidden"})),n.append($("<input/>",{name:"preview_item[html]",value:Cms_Form.getEditorHtml("item_html"),type:"hidden"})),n.append($("<input/>",{name:"authenticity_token",value:s,type:"hidden"})),l=$(window).width(),o=$(window).height(),window.open("about:blank","FormPreview","width="+l+",height="+o+",resizable=yes,scrollbars=yes"),n.appendTo("body"),n.submit(),!1})},d}(),this.Form_Save_Event=function(){function e(){}return e.render=function(){return document.onkeydown=function(){if((event.ctrlKey||event.metaKey)&&83===event.keyCode)return event.keyCode=0,$("#"+Form_Preview.form_id).submit(),!1}},e}(),this.Cms_Inplace_Form=function(){function o(){}return o.addonSelector=".inplace-checkers",o.resolveType="text",o.getFormData=Cms_Form.getFormData,o.options={check:{form:!0,syntax:!0,link:!0}},o.linkChecker=null,o.formChecker=null,o.render=function(){o.options.check.syntax&&Syntax_Checker.render(o,{afterCheck:o.afterSyntaxCheck}),o.options.check.link&&(o.linkChecker=Link_Checker.render(o)),o.options.check.form&&(o.formChecker=Form_Checker.render(o)),o.renderSaveIfNoAlerts()},o.setEditorHtml=function(e,t){t=t||{},o.setContent(e,t)},o.afterSyntaxCheck=function(){$("[data-check-presence]").each(function(){var e=$(this).attr("data-check-presence");if(e&&!$(this).val()){var t=null;t=$(this).closest(".column-value").attr("id"),Syntax_Checker.errors.push({id:t,idx:0,code:e,msg:e+"\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002",ele:this})}})},o.renderSaveIfNoAlerts=function(){$('input:submit[name="save_if_no_alerts"]').on("click.form_alert",function(e){var n=$(this),t=[];return o.options.check.syntax&&t.push(Syntax_Checker.asyncCheck()),o.options.check.link&&t.push(o.linkChecker.asyncCheck()),o.options.check.form&&t.push(o.formChecker.asyncCheck()),0===t.length||($.when.apply($,t).then(function(){for(var e=!0,t=0;t<arguments.length;t++)if("ok"!==arguments[t].status){e=!1;break}e&&(n.off(".form_alert"),n.trigger("click"))}),e.preventDefault(),!1)})},o}(),this.Syntax_Checker=function(){function n(e){this.$el=null,this.$elBody=null,this.form=e}function l(){}return n.prototype.init=function(){if(this.$el)return this;var e=$("#errorSyntaxChecker");if(e[0])return this.$el=e,this.$elBody=e.find(".errorExplanationBody"),this.moveLast();(e=$("<div/>",{id:"errorSyntaxChecker","class":"errorExplanation"})).append("<h2>\u30a2\u30af\u30bb\u30b7\u30d3\u30ea\u30c6\u30a3\u30c1\u30a7\u30c3\u30af</h2>");var t=$("<div/>",{"class":"errorExplanationBody"});return e.append(t),this.$el=e,this.$elBody=t,this.moveLast()},n.prototype.moveLast=function(){return $(this.form.addonSelector).append(this.$el),this},n.prototype.showMessage=function(e){return this.init(),this.$elBody.html(e),this.moveLast(),this},n.prototype.showChecking=function(){return this.showMessage(SS.loading)},n.prototype.showResult=function(e,t){if(0!=t.length){this.init();var n=$("<ul/>");return this.appendMessage(n,e,t),this.$elBody.html(""),this.$elBody.append("<p>\u6b21\u306e\u9805\u76ee\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002</p>"),this.$elBody.append(n),this.moveLast(),SS_Tooltips.render(".detail"),$(window).trigger("resize"),this}this.showMessage("<p>\u30a8\u30e9\u30fc\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002</p>")},n.prototype.appendMessage=function(t,e,n){var s,o,c,l,d,h,r;s=this;var u={};$.each(n,function(e,t){var n=t.id;u[n]=u[n]||[],u[n].push(t)}),$.each(e,function(i,a){(n=u[i])&&(a.name&&((r=$('<li class="column-name">')).text(a.name),t.append(r)),$.each(n,function(e,r){(h=$("<code>")).text(r.code),t.append('<li class="code">'),t.find("li:last").append(h),t.append("<ul>"),t.find("> ul:last").append("<li>"),l=t.find("> ul:last li:last"),d=$('<span class="message detail">'+r.msg+"</span>"),r.detail&&(c=$("<ul>").appendTo(d),$.each(r.detail,function(){c.append("<li>"+this+"</li>"),c.hide()})),l.append(d),r.correctContent&&((o=$('<a href="#" class="correct">\u81ea\u52d5\u4fee\u6b63</a>')).on("click",function(){var e,t,n,o;return n=r.correctContent,e=a.setContent,t=a.getContent,o=a.type,e(n(i,{content:t(),type:o},r)),$(s.form.addonSelector).find("button.syntax-check").trigger("click"),!1}),l.append(o))}))})},l.checks={},l.errors=[],l.errorCount=0,l.form=null,l.resultBox=null,l.afterCheck=null,l.render=function(e,t){e=e||Cms_Form,t=t||{},l.form=e,l.options=t,l.resultBox=new n(l.form),l.afterCheck=t.afterCheck,$(document).on("click","button.syntax-check",function(){var e=this;e.disabled=!0;var t=function(){e.disabled=!1};l.resultBox.init(),l.resultBox.showChecking(),l.asyncCheck().done(t).fail(t)})},l.config={},l.asyncCheck=function(){var t=$.Deferred();return function(){try{l.check(),l.resultBox.showResult(l.checks,l.errors),t.resolve({status:0==l.errors.length?"ok":"failed"})}catch(e){l.resultBox.showMessage("<p>"+e+"</p>"),t.reject(null,null,e)}}(),t.promise()},l.addCheck=function(e,t){var n=(t=t||{}).name||null,o=t.resolve||"text",r=t.type||"string",i=t.getContent,a=t.setContent,s=t.afterCheck;l.checks[e]={name:n,resolve:o,type:r,getContent:i,setContent:a,afterCheck:s}},l.resetChecks=function(){l.checks={},l.errors=[],l.errorCount=0},l.getContents=function(){var n={};return $.each(l.checks,function(e,t){n[e]={content:t.getContent(),resolve:t.resolve,type:t.type,afterCheck:t.afterCheck}}),n},l.check=function(){var e,n;return l.reset(),e=l.getContents(),$.each(e,function(e,t){"html"==t.resolve?l.checkHtml(e,t):l.checkText(e,t),(n=t.afterCheck)&&n(e,t)}),l.afterCheck&&l.afterCheck(),l.errors},l.reset=function(){this.errors=[]},l.checkHtml=function(e,t){l.checkDateFormat(e,t),l.checkInterwordSpace(e,t),l.checkKanaCharacter(e,t),l.checkMultibyteCharacter(e,t),l.checkReplaceWords(e,t),l.checkAdjacentA(e,t),l.checkAppletAlt(e,t),l.checkAreaAlt(e,t),l.checkEmbeddedMedia(e,t),l.checkImgAlt(e,t),l.checkImgDataUriScheme(e,t),l.checkLinkText(e,t),l.checkObjectText(e,t),l.checkOrderOfH(e,t),l.checkTable(e,t)},l.checkText=function(e,t){l.checkDateFormat(e,t),l.checkInterwordSpace(e,t),l.checkKanaCharacter(e,t),l.checkMultibyteCharacter(e,t),l.checkReplaceWords(e,t)},l.isValidDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)&&(!isNaN(e.getTime())&&0<e.getYear())},l.justText=function(e){return $(e).clone().children().remove().end().text()},l.outerHtmlSummary=function(e){return $(e).get(0).outerHTML.replace(/[\r\n]|&nbsp;/g,"")},l.message={notSetImgAlt:"\u753b\u50cf\u306e\u4ee3\u66ff\u30c6\u30ad\u30b9\u30c8\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002",notSetAppletAlt:"\u30a2\u30d7\u30ec\u30c3\u30c8\u8981\u7d20\u306e\u4ee3\u66ff\u30c6\u30ad\u30b9\u30c8\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002",notSetAreaAlt:"\u30a8\u30ea\u30a2\u8981\u7d20\u306e\u4ee3\u66ff\u30c6\u30ad\u30b9\u30c8\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002",invalidImgScheme:"\u753b\u50cf\u306eURI\u306b\u30d0\u30a4\u30ca\u30ea\u30fc\u6587\u5b57\u5217\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002",notSetTableCaption:"\u8868\u306b\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002",notSetThScope:"\u8868\u306e\u30d8\u30c3\u30c0\u30fc\u306b\u30b9\u30b3\u30fc\u30d7\u5c5e\u6027\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002",invalidOrderOfH:"\u898b\u51fa\u3057(H)\u306e\u9806\u756a\u304c\u4e0d\u6b63\u3067\u3059\u3002",invalidMultibyteCharacter:"\u82f1\u6570\u5b57\u306f\u534a\u89d2\u6587\u5b57\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002",invalidKanaCharacter:"\u534a\u89d2\u30ab\u30ca\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002",invalidDateFormat:"\u65e5\u4ed8\u306e\u8868\u8a18\u306f\u25cb\u5e74\u25cb\u6708\u25cb\u65e5\u3068\u3057\u3066\u304f\u3060\u3055\u3044\u3002",invalidAdjacentA:"\u96a3\u63a5\u3059\u308b\u540c\u3058\u30ea\u30f3\u30af\u3092\u4e00\u3064\u306e\u30ea\u30f3\u30af\u306b\u307e\u3068\u3081\u3066\u304f\u3060\u3055\u3044\u3002",checkInterwordSpace:"\u5358\u8a9e\u306e\u6587\u5b57\u9593\u306e\u30b9\u30da\u30fc\u30b9\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002",checkLinkText:"\u30ea\u30f3\u30af\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002",checkObjectText:"\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u8981\u7d20\u306e\u30dc\u30c7\u30a3\u306b\u9069\u5207\u306a\u4ee3\u66ff\u30c6\u30ad\u30b9\u30c8\u3092\u8a18\u8ff0\u3057\u3066\u304f\u3060\u3055\u3044\u3002",checkEmbeddedMedia:"\u52d5\u753b\u3084\u97f3\u58f0\u3092\u542b\u3080\u5834\u5408\u3001\u8aac\u660e\u304c\u3042\u308b\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002",replaceWord:"\u4f7f\u7528\u304c\u597d\u307e\u3057\u304f\u306a\u3044\u5358\u8a9e\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002"},l.detail={notSetImgAlt:["\u753b\u50cf\u306e\u5185\u5bb9\u3092\u793a\u3059\u4ee3\u66ff\u30c6\u30ad\u30b9\u30c8\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],notSetAppletAlt:["\u30a2\u30d7\u30ec\u30c3\u30c8\u306e\u5185\u5bb9\u3092\u793a\u3059\u4ee3\u66ff\u30c6\u30ad\u30b9\u30c8\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],notSetAreaAlt:["\u30a8\u30ea\u30a2\u8981\u7d20\u306e\u5185\u5bb9\u3092\u793a\u3059\u4ee3\u66ff\u30c6\u30ad\u30b9\u30c8\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],invalidImgScheme:["\u753b\u50cf\u306eSRC\u5c5e\u6027\u306b\u30c7\u30fc\u30bf\u5f62\u5f0f\u306eURI\u30b9\u30ad\u30fc\u30e0\u304c\u5b58\u5728\u3057\u307e\u3059\u3002","\u4ed6\u306eURI\u30b9\u30ad\u30fc\u30e0\u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],notSetTableCaption:["\u8868\u306b\u898b\u51fa\u3057(CAPTION)\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093","TABLE\u30bf\u30b0\u306e\u4e2d\u306bCAPTION\u30bf\u30b0\u3092\u8ffd\u8a18\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],notSetThScope:["\u8868\u306e\u30d8\u30c3\u30c0\u30fc(TH)\u306b\u898b\u51fa\u3057\u306e\u65b9\u5411\u3067\u3042\u308bSCOPE\u5c5e\u6027\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002",'\u884c\u65b9\u5411\u3067\u3042\u308c\u3070scope="col\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002','\u5217\u65b9\u5411\u3067\u3042\u308c\u3070scope="row"\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002'],invalidOrderOfH:["\u9069\u5207\u306a\u9806\u306b\u914d\u7f6e\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],invalidMultibyteCharacter:["\u672c\u6587\u306b\u5168\u89d2\u82f1\u6570\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002","\u534a\u89d2\u82f1\u6570\u306b\u7f6e\u304d\u63db\u3048\u308b\u304b\u524a\u9664\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],invalidKanaCharacter:["\u672c\u6587\u306b\u534a\u89d2\u30ab\u30ca\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002","\u5168\u89d2\u6587\u5b57\u306b\u7f6e\u304d\u63db\u3048\u308b\u304b\u524a\u9664\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],invalidDateFormat:["\u65e5\u4ed8\u306e\u5f62\u5f0f\u3092\u4fee\u6b63\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],invalidAdjacentA:["\u96a3\u308a\u5408\u3046\u30ea\u30f3\u30af(A)\u306b\u540c\u3058\u30ea\u30f3\u30af\u5148\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002","\u4e00\u3064\u306e\u30ea\u30f3\u30af(A)\u306b\u30de\u30fc\u30af\u30a2\u30c3\u30d7\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],checkInterwordSpace:["\u5358\u8a9e\u306e\u6587\u5b57\u9593\u306b\u4e0d\u8981\u306a\u30b9\u30da\u30fc\u30b9\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u524a\u9664\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],checkLinkText:["\u30ea\u30f3\u30af\u5185\u306e\u30c6\u30ad\u30b9\u30c8\u306f\u9077\u79fb\u5148\u3092\u8868\u3059\u3082\u306e\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],checkObjectText:["\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u8981\u7d20\u304c\u6b63\u3057\u304f\u8aad\u307f\u8fbc\u307e\u308c\u306a\u304b\u3063\u305f\u5834\u5408\u306e\u8aac\u660e\u3092\u8981\u7d20\u5185\u306b\u8a18\u8ff0\u3057\u3066\u304f\u3060\u3055\u3044\u3002"],checkEmbeddedMedia:["\u52d5\u753b\u3084\u97f3\u58f0\u3092\u672c\u6587\u306b\u57cb\u3081\u8fbc\u3080\u5834\u5408\u306f\u8aac\u660e\u3092\u8a18\u8ff0\u3057\u3066\u304f\u3060\u3055\u3044\u3002"]},l.mediaExtensions=["aac","aif","aiff","au","avi","flac","flv","mid","midi","mp3","m4a","mp4","mpg","mpeg","oga","ogg","tta","vdo","wav","wma","wmv"],l.formatContent=function(e){var t=e.content,n=e.resolve,o=e.type,r=[];return"array"==o?$.each(t,function(e,t){t=t||"","html"==n?r.push(t):r.push("<div>"+t+"</div>")}):(t=t||"","html"==n?r.push(t):r.push("<div>"+t+"</div>")),r},l.checkMultibyteCharacter=function(n,e){var t,o;t=l.formatContent(e),$.each(t,function(e,t){o=[],$(t).find(":not(iframe)").addBack().contents().filter(function(){return 3==this.nodeType}).each(function(){var e;if(e=this.textContent.match(/[\uff21-\uff3a\uff41-\uff5a\uff10-\uff19]/g))return o.push(e)}),$.isEmptyObject(o)||l.errors.push({id:n,idx:e,code:o.join(","),ele:t,msg:l.message.invalidMultibyteCharacter,detail:l.detail.invalidMultibyteCharacter,correctContent:l.correctMultibyteCharacter})})},l.correctMultibyteCharacter=function(e,t){var n,o;return o=[],n=l.formatContent(t),$.each(n,function(e,t){(t=$(t)).find(":not(iframe)").addBack().contents().filter(function(){return 3==this.nodeType}).each(function(){var e;return e=this.textContent.replace(/[\uff21-\uff3a\uff41-\uff5a\uff10-\uff19]/g,function(e){return String.fromCharCode(e.charCodeAt(0)-65248)}),this.textContent=e}),o.push(t.html())}),"array"==t.type?o:o[0]},l.checkKanaCharacter=function(n,e){var t,o;t=l.formatContent(e),$.each(t,function(e,t){o=t.match(/[\uff61-\uff9f]/g),$.isEmptyObject(o)||l.errors.push({id:n,idx:e,code:o.join(","),ele:t,msg:l.message.invalidKanaCharacter,detail:l.detail.invalidKanaCharacter,correctContent:l.correctKanaCharacter})})},l.correctKanaCharacter=function(e,t){var n,o,r,i;return o=[],n=l.formatContent(t),r={"\uff61":"\u3002","\uff62":"\u300c","\uff63":"\u300d","\uff64":"\u3001","\uff65":"\u30fb","\uff66":"\u30f2","\uff67":"\u30a1","\uff68":"\u30a3","\uff69":"\u30a5","\uff6a":"\u30a7","\uff6b":"\u30a9","\uff6c":"\u30e3","\uff6d":"\u30e5","\uff6e":"\u30e7","\uff6f":"\u30c3","\uff70":"\u30fc","\uff71":"\u30a2","\uff72":"\u30a4","\uff73":"\u30a6","\uff74":"\u30a8","\uff75":"\u30aa","\uff76":"\u30ab","\uff77":"\u30ad","\uff78":"\u30af","\uff79":"\u30b1","\uff7a":"\u30b3","\uff7b":"\u30b5","\uff7c":"\u30b7","\uff7d":"\u30b9","\uff7e":"\u30bb","\uff7f":"\u30bd","\uff80":"\u30bf","\uff81":"\u30c1","\uff82":"\u30c4","\uff83":"\u30c6","\uff84":"\u30c8","\uff85":"\u30ca","\uff86":"\u30cb","\uff87":"\u30cc","\uff88":"\u30cd","\uff89":"\u30ce","\uff8a":"\u30cf","\uff8b":"\u30d2","\uff8c":"\u30d5","\uff8d":"\u30d8","\uff8e":"\u30db","\uff8f":"\u30de","\uff90":"\u30df","\uff91":"\u30e0","\uff92":"\u30e1","\uff93":"\u30e2","\uff94":"\u30e4","\uff95":"\u30e6","\uff96":"\u30e8","\uff97":"\u30e9","\uff98":"\u30ea","\uff99":"\u30eb","\uff9a":"\u30ec","\uff9b":"\u30ed","\uff9c":"\u30ef","\uff9d":"\u30f3","\uff9e":"\u309b","\uff9f":"\u309c"},i={"\uff76\uff9e":"\u30ac","\uff77\uff9e":"\u30ae","\uff78\uff9e":"\u30b0","\uff79\uff9e":"\u30b2","\uff7a\uff9e":"\u30b4","\uff7b\uff9e":"\u30b6","\uff7c\uff9e":"\u30b8","\uff7d\uff9e":"\u30ba","\uff7e\uff9e":"\u30bc","\uff7f\uff9e":"\u30be","\uff80\uff9e":"\u30c0","\uff81\uff9e":"\u30c2","\uff82\uff9e":"\u30c5","\uff83\uff9e":"\u30c7","\uff84\uff9e":"\u30c9","\uff8a\uff9e":"\u30d0","\uff8b\uff9e":"\u30d3","\uff8c\uff9e":"\u30d6","\uff8d\uff9e":"\u30d9","\uff8e\uff9e":"\u30dc","\uff8a\uff9f":"\u30d1","\uff8b\uff9f":"\u30d4","\uff8c\uff9f":"\u30d7","\uff8d\uff9f":"\u30da","\uff8e\uff9f":"\u30dd","\uff73\uff9e":"\u30f4","\uff9c\uff9e":"\u30f7","\uff66\uff9e":"\u30fa"},$.each(n,function(e,t){(t=$(t)).find(":not(iframe)").addBack().contents().filter(function(){return 3===this.nodeType}).each(function(){var n=this.textContent;$.each(i,function(e,t){n=n.replace(new RegExp(e,"g"),t)}),n=n.replace(/[\uff61-\uff9f]/g,function(e){return r[e]}),this.textContent=n}),o.push(t.html())}),"array"==t.type?o:o[0]},l.checkReplaceWords=function(i,e){var t,a;t=l.formatContent(e),(a=l.config.replace_words)&&$.each(t,function(e,t){var n,o,r;for(o in a)r=a[o],n=t.match(RegExp(""+o.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),"g")),$.isEmptyObject(n)||l.errors.push({id:i,idx:e,code:n[0],ele:t,msg:l.message.replaceWord+"\u300c"+o+"\u300d\u2192\u300c"+r+"\u300d",correctContent:l.correctReplaceWords,replaceKey:o,replaceValue:r})})},l.correctReplaceWords=function(e,t,n){var o,r,i,a;if(i=l.formatContent(t),o=n.replaceKey,r=n.replaceValue,a=[],o||r)return $.each(i,function(e,t){(t=$(t)).find(":not(iframe)").addBack().contents().filter(function(){return 3===this.nodeType}).each(function(){var e;return e=this.textContent.replace(RegExp(""+o.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),"g"),function(){return r}),this.textContent=e}),a.push(t.html())}),"array"==t.type?a:a[0]},l.checkDateFormat=function(n,e){var t,o;t=l.formatContent(e),$.each(t,function(e,t){o=[],$(t).find(":not(iframe)").addBack().contents().filter(function(){return 3===this.nodeType}).each(function(){var e;(e=this.textContent.match(/\d{4}[\.\-\/]\d{1,2}[\.\-\/]\d{1,2}/g))&&(o=$.merge(o,e))}),$.isEmptyObject(o)||(o=$.grep(o,function(e){return l.isValidDate(new Date(e))}),$.isEmptyObject(o)||l.errors.push({id:n,idx:e,code:o.join(","),ele:t,msg:l.message.invalidDateFormat,detail:l.detail.invalidDateFormat,correctContent:l.correctDateFormat}))})},l.correctDateFormat=function(e,t){var n,o;return o=l.formatContent(t),n=[],$.each(o,function(e,t){(t=$(t)).find(":not(iframe)").addBack().contents().filter(function(){return 3===this.nodeType}).each(function(){var e;return e=this.textContent.replace(/(\d{4})[\.\-\/](\d{1,2})[\.\-\/](\d{1,2})/g,function(e,t,n,o){return l.isValidDate(new Date([t,n,o].join("/")))?t+"\u5e74"+n+"\u6708"+o+"\u65e5":e}),this.textContent=e}),n.push(t.html())}),"array"==t.type?n:n[0]},l.checkImgAlt=function(n,e){var t;t=l.formatContent(e),$.each(t,function(t,e){$(e).find("img").each(function(){var e;(e=$(this).attr("alt"))&&""!==$.trim(e)&&!/^[\w\s\.\-]*$/.test(e)||l.errors.push({id:n,idx:t,code:l.outerHtmlSummary(this),ele:this,msg:l.message.notSetImgAlt,detail:l.detail.notSetImgAlt})})})},l.checkAppletAlt=function(n,e){var t;t=l.formatContent(e),$.each(t,function(t,e){$(e).find("applet").each(function(){var e;(e=$(this).attr("alt"))&&""!==$.trim(e)&&!/^[\w\s\.\-]*$/.test(e)||l.errors.push({id:n,idx:t,code:l.outerHtmlSummary(this),ele:this,msg:l.message.notSetAppletAlt,detail:l.detail.notSetAppletAlt})})})},l.checkAreaAlt=function(n,e){var t;t=l.formatContent(e),$.each(t,function(t,e){$(e).find("area").each(function(){var e;(e=$(this).attr("alt"))&&""!==$.trim(e)&&!/^[\w\s\.\-]*$/.test(e)||l.errors.push({id:n,idx:t,code:l.outerHtmlSummary(this),ele:this,msg:l.message.notSetAreaAlt,detail:l.detail.notSetAreaAlt})})})},l.checkImgDataUriScheme=function(n,e){var t;t=l.formatContent(e),$.each(t,function(t,e){$(e).find("img[src]").each(function(){var e;e=$(this).attr("src"),/^data:.*?,.*?$/.test(e)&&l.errors.push({id:n,idx:t,code:l.outerHtmlSummary(this),ele:this,msg:l.message.invalidImgScheme,detail:l.detail.invalidImgScheme})})})},l.checkTable=function(o,e){var t;t=l.formatContent(e),$.each(t,function(n,e){$(e).find("table").each(function(){var e,t;t=this,(e=$(this).find("caption"))&&""!==$.trim(e.text())||l.errors.push({id:o,idx:n,code:l.outerHtmlSummary(this),ele:t,msg:l.message.notSetTableCaption,detail:l.detail.notSetTableCaption,correctContent:l.correctTableCaption}),$(t).find("th").each(function(){if(!$(this).attr("scope"))return l.errors.push({id:o,idx:n,code:l.outerHtmlSummary(this),ele:t,msg:l.message.notSetThScope,detail:l.detail.notSetThScope,correctContent:l.correctTableScope}),!1})})})},l.correctTableCaption=function(e,t){var n,o;return o=l.formatContent(t),n=[],$.each(o,function(e,t){t=$(t).find("table"),$(t).find("caption").remove(),$(t).prepend("<caption>\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3</caption>"),t=$(t).parents().last().html()||$(t).html(),n.push(t)}),"array"==t.type?n:n[0]},l.correctTableScope=function(e,t){var n,o,r;return n=l.formatContent(t),o=[],$.each(n,function(e,t){t=$(t).find("table"),r=1==$(t).find("tr:first th").length?"row":"col",$(t).find("tr:first th").each(function(){if(!$(this).attr("scope"))return $(this).attr("scope",r)}),$(t).find("tr:not(:first) th").each(function(){if(!$(this).attr("scope"))return $(this).attr("scope","row")}),t=$(t).parents().last().html()||$(t).html(),o.push(t)}),"array"==t.type?o:o[0]},l.checkOrderOfH=function(n,e){var t,o,r,i,a,s;t=l.formatContent(e),$.each(t,function(e,t){if(t=$(t),!(r=$(t).find("h1,h2,h3,h4,h5,h6")).length)return!1;for(o="",i=a=0,s=r.length-1;0<=s?a<=s:s<=a;i=0<=s?++a:--a)0===i?/h[12]/i.test(r[i].tagName)||(o+=r[i].tagName+" "):/h3/i.test(r[i].tagName)?/h[23456]/i.test(r[i-1].tagName)||(o+=r[i].tagName+" "):/h4/i.test(r[i].tagName)?/h[3456]/i.test(r[i-1].tagName)||(o+=r[i].tagName+" "):/h5/i.test(r[i].tagName)?/h[456]/i.test(r[i-1].tagName)||(o+=r[i].tagName+" "):/h6/i.test(r[i].tagName)&&(/h[56]/i.test(r[i-1].tagName)||(o+=r[i].tagName+" "));""!==o&&l.errors.push({id:n,idx:e,code:o,ele:t,msg:l.message.invalidOrderOfH,detail:l.detail.invalidOrderOfH,correctContent:l.correctOrderOfH})})},l.correctOrderOfH=function(e,t){var n,o,r,i,a,s,c;return n=l.formatContent(t),o=[],$.each(n,function(e,t){if(t=$(t),(r=$(t).find("h1,h2,h3,h4,h5,h6")).length){for(c=t,i=a=0,s=r.length-1;0<=s?a<=s:s<=a;i=0<=s?++a:--a)0===i?/h[12]/i.test(r[i].tagName)||(c=$("<h1>"+$(r[i]).html()+"</h1>"),$(r[i]).after(c).remove(),r[i]=c[0]):/h3/i.test(r[i].tagName)?/h[23456]/i.test(r[i-1].tagName)||((c=$("<"+r[i-1].tagName.replace("1","2")+">")).html($(r[i]).html()),$(r[i]).after(c).remove(),r[i]=c[0]):/h4/i.test(r[i].tagName)?/h[3456]/i.test(r[i-1].tagName)||((c=$("<"+r[i-1].tagName.replace("1","2")+">")).html($(r[i]).html()),$(r[i]).after(c).remove(),r[i]=c[0]):/h5/i.test(r[i].tagName)?/h[456]/i.test(r[i-1].tagName)||((c=$("<"+r[i-1].tagName.replace("1","2")+">")).html($(r[i]).html()),$(r[i]).after(c).remove(),r[i]=c[0]):/h6/i.test(r[i].tagName)&&(/h[56]/i.test(r[i-1].tagName)||((c=$("<"+r[i-1].tagName.replace("1","2")+">")).html($(r[i]).html()),$(r[i]).after(c).remove(),r[i]=c[0]));c=$(c).parents().last().html()||$(c).html(),o.push(c)}else o.push($(t).parents().last().html())}),"array"==t.type?o:o[0]},l.checkAdjacentA=function(o,e){var t;t=l.formatContent(e),$.each(t,function(n,e){e=$(e),$(e).find("a[href]").each(function(){var e,t;t=$(this).attr("href"),(e=$(this).next("a[href]")).length&&t==e.attr("href")&&l.errors.push({id:o,idx:n,code:l.outerHtmlSummary(this)+l.outerHtmlSummary(e),ele:this,msg:l.message.invalidAdjacentA,detail:l.detail.invalidAdjacentA,correctContent:l.correctAdjacentA})})})},l.correctAdjacentA=function(e,t){var n,o,r,i;return n=l.formatContent(t),o=[],$.each(n,function(e,t){t=$(t),i=$(t).attr("href"),(r=$(t).next("a[href]")).length&&i==r.attr("href")&&($(t).html()!==$(r).html()&&$(t).html($(t).html()+$(r).html()),r.remove()),t=$(t).parents().last().html()||$(t).html(),o.push(t)}),"array"==t.type?o:o[0]},l.checkInterwordSpace=function(i,e){var t;t=l.formatContent(e),$.each(t,function(r,e){e=$(e),$(e).find(":not(iframe)").addBack().contents().filter(function(){return 3==this.nodeType}).each(function(){var e,t,n,o;if(o=$.trim(l.justText(this)),/[\u3000]/.test(o))for(e=t=0,n=o.length-1;0<=n?t<=n:n<=t;e=0<=n?++t:--t)if(256<=o.charCodeAt(e)){l.errors.push({id:i,idx:r,code:o,msg:l.message.checkInterwordSpace,detail:l.detail.checkInterwordSpace});break}})})},l.checkLinkText=function(n,e){var t;t=l.formatContent(e),$.each(t,function(e,t){t=$(t),$(t).find("a[href]").each(function(){$(this).text().length<=3&&l.errors.push({id:n,idx:e,code:l.outerHtmlSummary(this),msg:l.message.checkLinkText,detail:l.detail.checkLinkText})})})},l.checkObjectText=function(n,e){var t;t=l.formatContent(e),$.each(t,function(t,e){e=$(e),$(e).find("object").each(function(){var e;e=$(this).text(),$.trim(e)||l.errors.push({id:n,idx:t,code:l.outerHtmlSummary(this),msg:l.message.checkObjectText,detail:l.detail.checkObjectText})})})},l.checkEmbeddedMedia=function(o,e){var t,r,i;t=l.formatContent(e),$.each(t,function(n,e){e=$(e),$(e).find("embed,video").each(function(){l.errors.push({id:o,idx:n,code:l.outerHtmlSummary(this),msg:l.message.checkEmbeddedMedia,detail:l.detail.checkEmbeddedMedia})}),r=new RegExp("("+l.mediaExtensions.join("|")+")","i"),i=/https?:\/\/www\.youtube\.com\//,$(e).find("iframe[src]").each(function(){var e,t;e=(t=$(this).attr("src")).replace(/\?.*$/,"").replace(/.*\//,"").split(".").pop(),(r.test(e)||i.test(t)
  )&&l.errors.push({id:o,idx:n,code:l.outerHtmlSummary(this),msg:l.message.checkEmbeddedMedia,detail:l.detail.checkEmbeddedMedia})}),$(e).find("a[href]").each(function(){var e,t;e=(t=$(this).attr("href")).replace(/\?.*$/,"").replace(/.*\//,"").split(".").pop(),(r.test(e)||i.test(t))&&l.errors.push({id:o,idx:n,code:l.outerHtmlSummary(this),msg:l.message.checkEmbeddedMedia,detail:l.detail.checkEmbeddedMedia})})})},l}(),this.Form_Checker=function(){function n(e){this.$el=null,this.$elBody=null,this.form=e}function i(e,t){this.$el=$(e),this.form=t,this.resultBox=new n(t)}return n.prototype.init=function(){if(this.$el)return this;var e=$("#errorFormChecker");if(e[0])return this.$el=e,this.$elBody=e.find(".errorExplanationBody"),this.moveLast();(e=$("<div/>",{id:"errorFormChecker","class":"errorExplanation"})).append("<h2>"+i.message.header+"</h2>");var t=$("<div/>",{"class":"errorExplanationBody"});return e.append(t),this.$el=e,this.$elBody=t,this.moveLast()},n.prototype.moveLast=function(){return $(this.form.addonSelector).append(this.$el),this},n.prototype.showMessage=function(e){return this.init(),this.$elBody.html(e),this.moveLast(),this},n.prototype.showChecking=function(){return this.showMessage(SS.loading)},n.prototype.showResult=function(e){if(!e||0==e.length)return this.$elBody.html(""),void this.$elBody.append("<p>"+i.message.noErrors+"</p>");var t=$("<ul/>");return $.each(e,function(){t.append("<li>"+this+"</li>")}),this.$elBody.html(""),this.$elBody.append("<p>"+i.message.body+"</p>"),this.$elBody.append(t),this.moveLast()},i.message={header:"\u5236\u7d04\u30c1\u30a7\u30c3\u30af",body:"\u6b21\u306e\u9805\u76ee\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002",noErrors:"\u30a8\u30e9\u30fc\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002",formCheckerError:"\u5185\u5bb9\u30c1\u30a7\u30c3\u30af\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\u6b21\u306eURL\u306b\u63a5\u7d9a\u3067\u304d\u307e\u305b\u3093\u3002"},i.render=function(e){e=e||Cms_Form;var t=new i(document,e);return t.render(),t},i.prototype.render=function(){var n=this;this.$el.on("click","button.form-check",function(){var e=this;e.disabled=!0;var t=function(){e.disabled=!1};n.asyncCheck().done(t).fail(t)})},i.prototype.asyncCheck=function(){var r=$.Deferred();this.resultBox.showChecking();var e=this.form.getFormData($("#"+Form_Preview.form_id)),t=this;return $.ajax({type:"POST",url:this.form.form_check_path,data:e,processData:!1,contentType:!1,cache:!1,success:function(e){t.resultBox.showResult(e),r.resolve({status:e&&0<e.length?"error":"ok"})},error:function(e,t,n){var o=i.message.formCheckerError+": "+form.form_check_path;i.resultBox.showMessage("<p>"+o+"</p>"),r.reject(e,t,n)}}),r.promise()},i}(),this.Mobile_Size_Checker=function(){function e(){this.$el=null,this.$elBody=null}function m(){}return e.prototype.init=function(){if(this.$el)return this;var e=$("#errorMobileChecker");if(e[0])return this.$el=e,this.$elBody=e.find(".errorExplanationBody"),this.moveLast();(e=$("<div/>",{id:"errorMobileChecker","class":"errorExplanation"})).append("<h2>"+m.message.header+"</h2>");var t=$("<div/>",{"class":"errorExplanationBody"});return e.append(t),this.$el=e,this.$elBody=t,this.moveLast()},e.prototype.moveLast=function(){return $(Cms_Form.addonSelector).append(this.$el),this},e.prototype.showMessage=function(e){return this.init(),this.$elBody.html(e),this.moveLast(),this},e.prototype.showChecking=function(){return this.showMessage(SS.loading)},e.prototype.showResult=function(){if(0===m.error.length)return this.showMessage("<p>"+m.message.mobile_check+"</p>");var e=m.error;this.$elBody.html("");for(var t=0,n=e.length;t<n;t++){var o=e[t];this.$elBody.append('<p class="error">'+o+"</p>")}return this.moveLast()},m.message={header:"\u643a\u5e2f\u30c7\u30fc\u30bf\u30b5\u30a4\u30ba\u30c1\u30a7\u30c3\u30af",body:"",success:"\u6210\u529f",failure:"\u5931\u6557",mobile_disable:"\u30e2\u30d0\u30a4\u30eb\u30b5\u30a4\u30ba\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002",mobile_check:"\u672c\u6587\u306e\u30c7\u30fc\u30bf\u30b5\u30a4\u30ba\u306fOK\u3067\u3059\u3002",SizeCheckServerError:"\u672c\u6587\u30c7\u30fc\u30bf\u30b5\u30a4\u30ba\u306e\u30c1\u30a7\u30c3\u30af\u4e2d\u306b\u30b5\u30fc\u30d0\u30fc\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002"},m.error=[],m.url="/.cms/mobile_size_check/check.json",m.rootUrl="",m.imgs=[],m.hostFullUrl="",m.resultBox=new e,m.render=function(){return $(document).on("click","button.mobile-size-check",function(){if(m.enabled){var t=this;t.disabled=!0,m.resultBox.showChecking(),m.reset();var e=function(e){m.check(e,!0,function(){m.resultBox.showResult(),t.disabled=!1})},n=function(){m.resultBox.showMessage("<p>"+m.message.SizeCheckServerError+"</p>"),t.disabled=!1};Cms_Form.getHtml(e,n)}else m.resultBox.showMessage("<p>"+m.message.mobile_disable+"</p>")})},m.reset=function(){this.message.body="",this.imgs={},this.error=""},m.get_str_byte=function(e){var t,n,o,r,i;if(t=";,/?:@&=+$ ",n=[0,1,1,1,2,3,2,3,4,3],i=0,null===e||""===e)return i;for(r in e)o=e[r],0<=t.indexOf(o)?i++:i+=n[encodeURI(o).length];return i},m.check=function(e,t,n){var o,r,i,a,s,c,l,d,h,u,p;if((c=m.mobile_size)<(d=m.get_str_byte(e)))return o='<p class="error">',o+=m.message.SizeCheckError,o+="(\u672c\u6587\u30b5\u30a4\u30ba\uff1a"+parseInt(d/1024)+"KB)",o+="</p>",m.error=[o],void n();for(r=[],i={},a=0,s=(l=$(e).find("img[src]")).length;a<s;a++)h=l[a],(u=(p=(p=$(h).attr("src")).replace(m.hostFullUrl.replace(/\/$/,""),"")).match(/^\/fs\/(.+?)\/_\//))&&(i[u[1].replace(/\//g,"")]=p.match(/_\/thumb\//),r.push(parseInt(u[1].replace(/\//g,""))));0!=r.length?$.ajax({type:"POST",url:m.url,cache:!1,data:JSON.stringify({img_ids:r,mobile_size:c,is_thumb:i}),contentType:"application/json",dataType:"json",crossDomain:!0,async:t,success:function(e){if(0<e.errors.length)return m.error=e.errors},error:function(){var e;e="<p>",e+=m.message.SizeCheckServerError,e+="</p>",m.error=[e]},complete:function(){n()}}):n()},m.checkHtmlSize=function(e){m.reset(),m.enabled&&(m.resultBox.showChecking(),m.check(e,!1,function(){m.resultBox.showResult()}))},m.validateHtml=function(e,t,n){if(!m.checkHtmlSize(n.html)&&0!==m.error.length)for(var o=0,r=m.error.length;o<r;o++){var i=m.error[o];Form_Alert.add("\u643a\u5e2f\u30c7\u30fc\u30bf\u30b5\u30a4\u30ba\u30c1\u30a7\u30c3\u30af",this,i)}},m}(),this.Link_Checker=function(){function n(e){this.$el=null,this.$elBody=null,this.form=e}function a(e,t){this.$el=$(e),this.form=t,this.links={},this.linkErrorCount=0,this.resultBox=new n(t)}return n.prototype.init=function(){if(this.$el)return this;var e=$("#errorLinkChecker");if(e[0])return this.$el=e,this.$elBody=e.find(".errorExplanationBody"),this.moveLast();(e=$("<div/>",{id:"errorLinkChecker","class":"errorExplanation"})).append("<h2>"+a.message.header+"</h2>");var t=$("<div/>",{"class":"errorExplanationBody"});return e.append(t),this.$el=e,this.$elBody=t,this.moveLast()},n.prototype.moveLast=function(){return $(this.form.addonSelector).append(this.$el),this},n.prototype.showMessage=function(e){return this.init(),this.$elBody.html(e),this.moveLast(),this},n.prototype.showChecking=function(){return this.showMessage(SS.loading)},n.prototype.showResult=function(e){var n=$("<ul/>");return $.each(e,function(e,t){n.append("<li>"+t+"</li>")}),this.$elBody.html(""),this.$elBody.append("<p>"+a.message.checkLinks+"</p>"),this.$elBody.append(n),this.moveLast()},a.message={header:"\u30ea\u30f3\u30af\u30c1\u30a7\u30c3\u30af",noLinks:"\u30ea\u30f3\u30af\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002",checkLinks:"\u6b21\u306e\u30ea\u30f3\u30af\u3092\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002",success:"\u6210\u529f",failure:"\u5931\u6557",linkCheckerError:"\u30ea\u30f3\u30af\u30c1\u30a7\u30c3\u30af\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\u6b21\u306eURL\u306b\u63a5\u7d9a\u3067\u304d\u307e\u305b\u3093\u3002"},a.url="/.cms/link_check/check.json",a.rootUrl="",a.instance=null,a.render=function(e){e=e||Cms_Form;var t=a.instance=new a(document,e);return t.render(),t},a.reset=function(){a.instance&&a.instance.reset()},a.prototype.render=function(){var n=this;return this.$el.on("click","button.link-check",function(){var e=this;e.disabled=!0;var t=function(){e.disabled=!1};n.asyncCheck().done(t).fail(t)})},a.prototype.asyncCheck=function(){return".mod-cms-body"===this.form.addonSelector?this.asyncCheckInEditor():this.asyncCheckInForm()},a.prototype.asyncCheckInEditor=function(){var r=this,i=$.Deferred();this.beforeCheck();var t=$(this.form.getEditorHtml()),n=[];return t.find("a[href]").each(function(){var e=$(this).attr("href");"#"!==e&&("#"===e[0]?r.addMessage(e,0!==t.find(e).length):(/^\//.test(e)&&(e=a.rootUrl+e.slice(1)),n.push(e)))}),0===n.length?($.isEmptyObject(this.links)?this.resultBox.showMessage("<p>"+a.message.noLinks+"</p>"):this.resultBox.showResult(this.links),i.resolve({status:0===this.linkErrorCount?"ok":"failed"})):$.ajax({type:"POST",url:a.url,cache:!1,data:JSON.stringify({url:n}),contentType:"application/json",dataType:"json",crossDomain:!0,success:function(e){$.each(e,function(e,t){r.addMessage(e,200===t)}),r.resultBox.showResult(r.links),i.resolve({status:0===r.linkErrorCount?"ok":"failed"})},error:function(e,t,n){var o=a.message.linkCheckerError+": "+a.url;r.resultBox.showMessage("<p>"+o+"</p>"),i.reject(e,t,n)}}),i.promise()},a.prototype.asyncCheckInForm=function(){var r=this,i=$.Deferred();if(this.beforeCheck(),!this.form.form_link_check_path){var e="form link check path is not configured";return this.resultBox.showMessage("<p>"+e+"</p>"),void i.reject(null,null,e)}var t=this.form.getFormData($("#"+Form_Preview.form_id));return t.append("route",Form_Preview.page_route),$.ajax({type:"POST",url:r.form.form_link_check_path,data:t,processData:!1,contentType:!1,cache:!1,success:function(e){if(!e||0===e.length)return r.resultBox.showMessage("<p>"+a.message.noLinks+"</p>"),void i.resolve({status:"ok"});result="ok",$.each(e,function(){var e=this[0],t=this[1],n='<span class="'+t+'">'+a.message[t]+"</span>";r.addMessage(e,null,n),"failure"===t&&(result="failed")}),r.resultBox.showResult(r.links),i.resolve({status:result})},error:function(e,t,n){var o=a.message.linkCheckerError+": "+r.form.form_link_check_path;r.resultBox.showMessage("<p>"+o+"</p>"),i.reject(e,t,n)}}),i.promise()},a.prototype.reset=function(){this.links={},this.linkErrorCount=0},a.prototype.beforeCheck=function(){this.reset(),$.support.cors=!0,this.resultBox.showChecking()},a.prototype.addMessage=function(e,t,n){n||(t?n='<span class="success">'+a.message.success+"</span>":(n='<span class="failure">'+a.message.failure+"</span>",this.linkErrorCount++)),this.links[e]=e+" "+n},a}(),Cms_TemplateForm=function(e){this.options=e,this.$formChangeBtn=$("#addon-basic .btn-form-change"),this.$formSelect=$('#addon-basic select[name="item[form_id]"]'),this.$formPage=$("#addon-cms-agents-addons-form-page"),this.$formPageBody=this.$formPage.find(".addon-body"),this.selectedFormId=null,Cms_TemplateForm.target&&this.bind(Cms_TemplateForm.target.el,Cms_TemplateForm.target.options)},Cms_TemplateForm.instance=null,Cms_TemplateForm.userId=null,Cms_TemplateForm.target=null,Cms_TemplateForm.confirms={},Cms_TemplateForm.paths={},Cms_TemplateForm.duration=400,Cms_TemplateForm.render=function(e){if(!Cms_TemplateForm.instance){var t=new Cms_TemplateForm(e);t.render(),Cms_TemplateForm.instance=t}},Cms_TemplateForm.bind=function(e,t){Cms_TemplateForm.instance?Cms_TemplateForm.instance.bind(e,t):(Cms_TemplateForm.target.el=e,Cms_TemplateForm.target.options=t)},Cms_TemplateForm.prototype.render=function(){var e=this;this.$formChangeBtn.on("click",function(){e.changeForm()})},Cms_TemplateForm.prototype.changeForm=function(){var e=this.$formSelect.val();e?this.selectedFormId&&this.selectedFormId===e?this.activateForm():(this.loadAndActivateForm(e),this.selectedFormId=e):this.deactivateForm()},Cms_TemplateForm.prototype.loadAndActivateForm=function(e){var o=this;this.$formChangeBtn.attr("disabled",!0),$.ajax({url:Cms_TemplateForm.paths.formUrlTemplate.replace(":id",e),type:"GET",success:function(e){o.loadForm(e),o.activateForm()},error:function(e,t,n){o.showError(n),o.activateForm()},complete:function(){o.$formChangeBtn.attr("disabled",!1)}})},Cms_TemplateForm.prototype.loadForm=function(e){this.$formPage.html($(e).html()),SS.renderAjaxBox(),SS.renderDateTimePicker()},Cms_TemplateForm.prototype.showError=function(e){this.$formPageBody.html("<p>"+e+"</p>")},Cms_TemplateForm.prototype.activateForm=function(){this.$formPage.removeClass("hide"),$("#addon-cms-agents-addons-body").addClass("hide"),$("#addon-cms-agents-addons-file").addClass("hide"),Cms_Form.addonSelector="#addon-cms-agents-addons-form-page .addon-body",Cms_Form.activateSyntaxChecks()},Cms_TemplateForm.prototype.deactivateForm=function(){this.$formPageBody.html(""),this.$formPage.addClass("hide"),$("#addon-cms-agents-addons-body").removeClass("hide"),$("#addon-cms-agents-addons-file").removeClass("hide"),Cms_Form.addonSelector=".mod-cms-body",Cms_Form.activateSyntaxChecks()},Cms_TemplateForm.prototype.bind=function(e,t){(!this.el||this.el!==e)&&this.bindOne(e,t),this.resetOrder()},Cms_TemplateForm.prototype.bindOne=function(e,t){this.el=e,this.$el=$(e);var n=this;this.$el.on("change",".column-value-controller-move-position",function(){n.movePosition($(this))}),this.$el.on("click",".column-value-controller-move-up",function(){n.moveUp($(this))}),this.$el.on("click",".column-value-controller-move-down",function(){n.moveDown($(this))}),this.$el.on("click",".column-value-controller-delete",function(){n.remove($(this))}),this.$el.on("click",".column-value-palette [data-form-id]",function(){var o=$(this),e=o.data("form-id"),t=o.data("column-id");o.closest("fieldset").attr("disabled",!0),o.css("cursor","wait"),o.closest(".column-value-palette").find(".column-value-palette-error").addClass("hide").html(""),$.ajax({url:Cms_TemplateForm.paths.formColumn.replace(/:formId/,e).replace(/:columnId/,t),success:function(e){var t=o.closest(".column-value-palette");t.before(e);t.prev(".column-value");SS.renderAjaxBox(),SS.renderDateTimePicker(),Cms_Form.activateSyntaxChecks(),n.resetOrder()},error:function(e,t,n){o.closest(".column-value-palette").find(".column-value-palette-error").html(n).removeClass("hide")},complete:function(){o.css("cursor","pointer"),o.closest("fieldset").attr("disabled",!1)}})}),t&&"entry"===t.type&&this.$el.find(".addon-body").sortable({axis:"y",handle:".sortable-handle",items:"> .column-value",beforeStop:function(e,t){t.item.trigger("column:beforeMove")},stop:function(e,t){t.item.trigger("column:afterMove")},update:function(){n.resetOrder()}})},Cms_TemplateForm.prototype.resetOrder=function(){for(var e=this.$el.find(".column-value").length,t='<option value=":value">:display</option>',n=[],o=0;o<e;o++)n.push(t.replace(":value",o.toString()).replace(":display",(o+1).toString()));this.$el.find(".column-value").each(function(e){var t=$(this).find(".column-value-controller-move-position");t.html(n.join("")),t.val(e)})},Cms_TemplateForm.prototype.movePosition=function(e){var t=this,n=e.val();if(n){n=parseInt(n);var o,r,i=e.closest(".column-value"),a=i[0],s=this.$el.find(".column-value"),c=-1;if(s.each(function(e){if(this===a)return c=e,!1}),!(c<0))if(!(n===c||n>=s.length||n<0))n<c?(o=$(s[n]),r=o.before.bind(o)):(o=$(s[n]),r=o.after.bind(o)),Cms_TemplateForm.insertElement(i,o,function(){i.trigger("column:beforeMove"),r(i),t.resetOrder(),i.trigger("column:afterMove")})}},Cms_TemplateForm.prototype.moveUp=function(e){var t=e.closest(".column-value");if(t[0]){var n=t.prev(".column-value");if(n[0]){var o=this;Cms_TemplateForm.swapElement(n,t,function(){t.trigger("column:beforeMove"),n.before(t),o.resetOrder(),t.trigger("column:afterMove")})}}},Cms_TemplateForm.prototype.moveDown=function(e){var t=e.closest(".column-value");if(t[0]){var n=t.next(".column-value");if(n[0]){var o=this;Cms_TemplateForm.swapElement(t,n,function(){t.trigger("column:beforeMove"),n.after(t),o.resetOrder(),t.trigger("column:afterMove")})}}},Cms_TemplateForm.swapElement=function(e,t,n){var o=e[0],r=t[0],i=r.offsetTop-o.offsetTop,a=r.offsetTop-(o.offsetTop+o.offsetHeight);o.style.transitionDuration=Cms_TemplateForm.duration+"ms",r.style.transitionDuration=Cms_TemplateForm.duration+"ms",o.style.transform="translateY("+(r.offsetHeight+a)+"px)",r.style.transform="translateY("+-i+"px)",setTimeout(function(){o.style.transitionDuration="",r.style.transitionDuration="",o.style.transform="",r.style.transform="",n()},Cms_TemplateForm.duration)},Cms_TemplateForm.insertElement=function(e,t,n){var o=e[0],r=t[0];if(o!==r){var i,a,s=[];if(r.offsetTop<o.offsetTop){if(o===r.nextElementSibling)return void Cms_TemplateForm.swapElement(t,e,n);var c=o.offsetTop+o.offsetHeight,l=o.previousElementSibling,d=l.offsetTop+l.offsetHeight;i=r.offsetTop-o.offsetTop,a=c-d;for(var h=r;h!==o;)s.push(h),h=h.nextElementSibling}else if(r.offsetTop>o.offsetTop){if(o===r.previousElementSibling)return void Cms_TemplateForm.swapElement(e,t,n);var u=r.offsetTop+r.offsetHeight,p=(c=o.offsetTop+o.offsetHeight,o.nextElementSibling);i=u-c,a=o.offsetTop-p.offsetTop;for(h=r;h!==o;)s.push(h),h=h.previousElementSibling}o.style.transitionDuration=Cms_TemplateForm.duration+"ms",o.style.transform="translateY("+i+"px)",s.forEach(function(e){e.style.transitionDuration=Cms_TemplateForm.duration+"ms",e.style.transform="translateY("+a+"px)"}),setTimeout(function(){o.style.transitionDuration="",o.style.transform="",s.forEach(function(e){e.style.transitionDuration="",e.style.transform=""}),n()},Cms_TemplateForm.duration)}else n()},Cms_TemplateForm.prototype.remove=function(e){var t=e.closest(".column-value");if(t[0]&&confirm(Cms_TemplateForm.confirms["delete"])){var n=this;t.addClass("column-value-deleting").fadeOut(Cms_TemplateForm.duration).queue(function(){t.remove(),n.resetOrder(),Cms_Form.activateSyntaxChecks()})}},SS_Workflow=function(e,t){this.$el=$(e),this.options=t;var r=this;this.$el.on("click",".update-item",function(e){return r.updateItem($(this)),e.preventDefault(),!1}),$(document).on("click",".mod-workflow-approve .update-item",function(e){return r.updateItem($(this)),e.preventDefault(),!1}),$(document).on("click",".mod-workflow-view .request-cancel",function(e){return r.cancelRequest($(this)),e.preventDefault(),!1}),this.$el.find(".mod-workflow-approve").insertBefore("#addon-basic"),this.$el.find(".toggle-label").on("click",function(e){return r.$el.find(".request-setting").slideToggle(),e.preventDefault(),!1}),this.$el.find(".workflow-partial-section").each(function(){r.loadRouteList()}),this.$el.on("click",".workflow-route-start",function(e){var t=$(this).siblings("#workflow_route:first").val();return r.loadRoute(t),e.preventDefault(),!1}),this.$el.on("click",".workflow-route-cancel",function(e){return r.loadRouteList(),e.preventDefault(),!1}),this.$el.on("click",".workflow-reroute",function(e){var t=$(this),n=t.data("level"),o=t.data("user-id");return r.reroute(n,o),e.preventDefault(),!1}),$(".mod-workflow-approve .btn-file-upload").data("on-select",function(e){$.colorbox.close(),r.onUploadFileSelected(e)}),this.tempFile=new SS_Addon_TempFile(".mod-workflow-approve .upload-drop-area",this.options.user_id,{select:function(e,t){r.onDropFile(e,t)}})},SS_Workflow.prototype={collectApprovers:function(){var e=[];return this.$el.find(".workflow-multi-select").each(function(){e=e.concat($(this).val())}),this.$el.find("input[name='workflow_approvers']").each(function(){e.push($(this).prop("value"))}),e},collectApproverAttachmentUses:function(){var e=[];return this.$el.find("input[name='workflow_approver_attachment_uses']").each(function(){e.push($(this).prop("value"))}),e},collectCirculations:function(){var e=[];return this.$el.find("input[name='workflow_circulations']").each(function(){e.push($(this).prop("value"))}),e},agentType:function(){return this.$el.find("input[name=agent_type]:checked").val()},collectDelegatees:function(){var e=[];return"agent"!==this.agentType()||this.$el.find("input[name='workflow_delegatees']").each(function(){e.push($(this).prop("value"))}),e},collectCirculationAttachmentUses:function(){var e=[];return this.$el.find("input[name='workflow_circulation_attachment_uses']").each(function(){e.push($(this).prop("value"))}),e},collectFileIds:function(){var e=[];return $("input[name='workflow_file_ids[]']").each(function(){e.push($(this).prop("value"))}),e},composeWorkflowUrl:function(e){if(this.options&&this.options.paths&&this.options.paths[e])return this.options.paths[e];var t=location.pathname.split("/");return t[2]=this.options.workflow_node,t[3]=e,5<t.length&&t.splice(4,1),t.join("/")},updateItem:function(e){var t=this,n=e.attr("updatetype"),o=this.collectApprovers();if($.isEmptyObject(o)&&"request"===n)alert(this.options.errors.not_select);else{var r=[];this.$el.find("input[name='workflow_required_counts']").each(function(){r.push($(this).prop("value"))});var i=this.composeWorkflowUrl("pages");i+="/"+n+"_update";var a,s=$("#workflow_comment").prop("value"),c=$("#workflow_pull_up").prop("value"),l=$("#workflow_on_remand").prop("value"),d=$("#remand_comment").prop("value");a="request"==n?$("#forced-request").prop("checked"):$("#forced-update").prop("checked");var h=this.collectCirculations(),u=this.collectFileIds();$.ajax({type:"POST",url:i,async:!1,data:{workflow_comment:s,workflow_pull_up:c,workflow_on_remand:l,workflow_approvers:o,workflow_required_counts:r,workflow_approver_attachment_uses:this.collectApproverAttachmentUses(),remand_comment:d,url:this.options.request_url,forced_update_option:a,workflow_circulations:h,workflow_circulation_attachment_uses:this.collectCirculationAttachmentUses(),workflow_file_ids:u,workflow_agent_type:this.agentType(),workflow_users:this.collectDelegatees()},success:function(e){e.workflow_alert?alert(e.workflow_alert):e.redirect&&e.redirect.reload?location.reload():e.redirect&&e.redirect.show?location.href=e.redirect.show:"approve"===e.workflow_state&&t.options.redirect_location?location.href=t.options.redirect_location:location.reload()},error:function(e){try{var t=$.parseJSON(e.responseText);alert(["== Error =="].concat(t).join("\n"))}catch(n){alert(["== Error =="].concat(e.statusText).join("\n"))}}})}},cancelRequest:function(e){var t=e.data("ss-confirmation");if(t&&!confirm(t))return!1;var n=e.data("ss-method")||"post",o=e.attr("href"),r=$('meta[name="csrf-token"]').attr("content");$.ajax({type:n,url:o,async:!1,data:{authenticity_token:r},success:function(e){e.workflow_alert?alert(e.workflow_alert):"approve"===e.workflow_state&&""!==redirect_location?location.href=redirect_location:location.reload()},error:function(e){try{var t=$.parseJSON(e.responseText);alert(["== Error =="].concat(t).join("\n"))}catch(n){alert(["== Error =="].concat(e.statusText).join("\n"))}}})},loadRouteList:function(){var t=this,e=this.composeWorkflowUrl("wizard");$.ajax({type:"GET",url:e,async:!1,success:function(e){t.$el.find(".workflow-partial-section").html(e)},error:function(e){try{var t=$.parseJSON(e.responseText);alert(["== Error =="].concat(t).join("\n"))}catch(n){alert(["== Error =="].concat(e.statusText).join("\n"))}}})},loadRoute:function(e){var t=this,n=this.composeWorkflowUrl("wizard");n+="/approver_setting";var o={route_id:e};$.ajax({type:"POST",url:n,async:!1,data:o,success:function(e){t.$el.find(".workflow-partial-section").html(e)},error:function(e){try{var t=$.parseJSON(e.responseText);alert(t.join("\n"))}catch(n){alert(["== Error =="].concat(e.statusText).join("\n"))}}})},reroute:function(o,r){var e=this.composeWorkflowUrl("wizard");e+="/reroute",e+="?"+$.param({level:o,user_id:r});var i=this;$("<a/>").attr("href",e).colorbox({fixed:!0,width:"90%",height:"90%",open:!0,onCleanup:function(){var e=$("#cboxLoadedContent input[name=selected_user_id]").val();if(e){var t=i.composeWorkflowUrl("wizard");t+="/reroute";var n={level:o,user_id:r,new_user_id:e,url:i.options.request_url};$.ajax({type:"POST",url:t,data:n,success:function(){location.reload()},error:function(e){try{var t=$.parseJSON(e.responseText);alert(t.join("\n"))}catch(n){alert(["== Error =="].concat(e.statusText).join("\n"))}}})}}})},fileSelectViewUrl:function(e){return"/.u:user/apis/temp_files/:id/select.html".replace(/:user/g,this.options.user_id).replace(/:id/g,e)},onUploadFileSelected:function(e){var t=this;$.ajax({url:this.fileSelectViewUrl(e.data("id")),success:function(e){t.renderFileHtml(e)},error:function(){alert("== Error ==")}})},renderFileHtml:function(e){var t=this,n=$(e);n.find("input[name='item[file_ids][]']").attr("name","workflow_file_ids[]"),n.find(".action .action-delete").removeAttr("onclick","").on("click",function(e){return e.preventDefault(),t.deleteUploadedFile($(this)),!1}),n.find(".action .action-attach").remove(),n.find(".action .action-paste").remove(),n.find(".action .action-thumb").remove(),$("#selected-files").append(n)},deleteUploadedFile:function(e){e.closest("div[data-file-id]").remove()},onDropFile:function(e){for(var t=this,n=0,o=e.length;n<o;n++){var r=e[n]._id,i=t.fileSelectViewUrl(r);$.ajax({url:i,success:function(e){t.renderFileHtml(e)},error:function(){alert("== Error ==")}})}}},SS_WorkflowRerouteBox=function(e,t){this.$el=$(e),this.options=t;var n=this;this.$el.find("form.search").on("submit",function(e){$(this).ajaxSubmit({url:$(this).attr("action"),success:function(e){n.$el.closest("#cboxLoadedContent").html(e)},error:function(){alert("== Error ==")}}),e.preventDefault()}),this.$el.find(".pagination a").on("click",function(e){var t=$(this).attr("href");return n.$el.closest("#cboxLoadedContent").load(t,function(e,t){"error"===t&&alert("== Error ==")}),e.preventDefault(),!1}),this.$el.find(".select-single-item").on("click",function(e){var t=$(this);if(!SS.disableClick(t))return!1;n.selectItem(t),e.preventDefault(),$.colorbox.close()})},SS_WorkflowRerouteBox.prototype={selectItem:function(e){var t=e.closest(".list-item"),n=t.data("id"),o=t.data("name"),r=t.data("email"),i=this.$el.data("name"),a=this.$el.data("email");i&&a&&(i+="("+a+")");var s="";i&&(s+=i,s+="\u3092"),s+=o+"("+r+")\u306b\u5909\u66f4\u3057\u307e\u3059\u3002\u3088\u308d\u3057\u3044\u3067\u3059\u304b\uff1f",confirm(s)&&this.$el.find("input[name=selected_user_id]").val(n)}},this.SS_Addon_TempFile=function(){function n(e,t,n){this.selector=e.selector||e,this.userId=t,this.dropEventTriggered=null,n&&n.select&&(this.select=n.select),n&&n.selectUrl&&(this.selectUrl=n.selectUrl),n&&n.uploadUrl&&(this.uploadUrl=n.uploadUrl),this.render()}return n.renderDrop=function(e,t){return new n(e,t,{})},n.prototype.select=function(e){for(var t=0,n=e.length;t<n;t++){var o=e[t]._id,r=this.selectUrl(o),i={};$("#show-file-size").val()&&(i.file_size=$("#show-file-size").val()),$.ajax({url:r,data:i,success:function(e){$("#selected-files").append(e)}})}},n.prototype.selectUrl=function(e){return"/.u"+this.userId+"/apis/temp_files/"+e+"/select"},n.prototype.uploadUrl=function(){return"/.u"+this.userId+"/apis/temp_files.json"},n.prototype.render=function(){var c=this;$(document).on("dragenter",this.selector,function(){return $(this).addClass("file-dragenter"),!1}),$(document).on("dragleave",this.selector,function(){return $(this).removeClass("file-dragenter"),!1}),$(document).on("dragover",this.selector,function(){return $(this).addClass("file-dragenter"),!1}),$(document).on("drop",this.selector,function(e){var o=e.target,t=$('meta[name="csrf-token"]').attr("content"),n=new FormData;n.append("authenticity_token",t),$("#file-resizing").val()&&n.append("item[resizing]",$("#file-resizing").val());var r=e.originalEvent.dataTransfer.files;if(0===r.length)return!1;if(c.dropEventTriggered)return!1;c.dropEventTriggered=!0;for(var i=0,a=r.length;i<a;i++)n.append("item[in_files][]",r[i]);var s=new XMLHttpRequest;return s.onload=function(){if(s.readyState===XMLHttpRequest.DONE){if($(o).removeClass("file-dragenter"),200===s.status||201===s.status){var e=JSON.parse(s.response);c.select(e,o)}else if(413===s.status)alert(["== Error =="].concat("\u30c7\u30fc\u30bf\u306e\u30b5\u30a4\u30ba\u304c\u5927\u304d\u3059\u304e\u307e\u3059\u3002").join("\n"));else try{var t=$.parseJSON(s.response);alert(["== Error =="].concat(t).join("\n"))}catch(n){alert(["== Error =="].concat(s.statusText).join("\n"))}c.dropEventTriggered=!1}},s.open("POST",c.uploadUrl()),s.send(n),!1})},n}(),this.SS_SearchUI=function(){function e(){}return e.anchorAjaxBox,e.defaultSelector=function(e){var t,n,o,r,i,a,s;return a=this,o=(n=e.closest("[data-id]")).data("id"),i=n.data("name")||n.find(".select-item").text()||e.text()||n.text(),s=$("<tr />").attr("data-id",o),r=(r=a.anchorAjaxBox.closest("dl").find(".hidden-ids").clone(!1)).val(o).removeClass("hidden-ids"),t=$('<a class="deselect btn" href="#">\u524a\u9664</a>').on("click",a.deselect),s.append($("<td />").append(r).append(i)),s.append($("<td />").append(t)),a.anchorAjaxBox.closest("dl").find(".ajax-selected tbody").prepend(s),a.anchorAjaxBox.closest("dl").find(".ajax-selected").trigger("change")},e.select=function(e){var t;return(t=this.anchorAjaxBox.data("on-select"))?t(e):this.defaultSelector(e)},e.selectItems=function(e){e||(e=$("#ajax-box"));var t=this;return e.find(".items input:checkbox").filter(":checked").each(function(){return t.select($(this))}),t.anchorAjaxBox.closest("dl").find(".ajax-selected").show()},e.deselect=function(e){var t;return t=$(this).parents(".ajax-selected:first"),$(this).parents("tr:first").remove(),0===t.find("tbody tr").size()&&t.hide(),t.trigger("change"),e.preventDefault()},e.toggleSelectButton=function(e){return e||(e=$("#ajax-box")),0<e.find(".items input:checkbox").filter(":checked").size()?e.find(".select-items").parent("div").show():e.find(".select-items").parent("div").hide()},e.render=function(){var e;return e=this,$(".ajax-selected").each(function(){if($(this).find("a.deselect").on("click",e.deselect),0===$(this).find("a.deselect").size())return $(this).hide()})},e.modal=function(e){e||(e={});var t=this,n=e.colorbox||$.colorbox;t.anchorAjaxBox=e.anchor||n.element();var o=e.$el||$("#ajax-box"),r=window==o[0].ownerDocument.defaultView;return r&&o.find("form.search").on("submit",function(e){var t=$("<span />",{"class":"loading"}).html(SS.loading);return o.find("[type=submit]").after(t),$(this).ajaxSubmit({url:$(this).attr("action"),success:function(e){o.closest("#cboxLoadedContent").html(e)},error:function(){t.html("== Error ==")}}),e.preventDefault(),!1}),o.find(".pagination a").on("click",function(e){return t.selectItems(o),!r||(o.find(".pagination").html(SS.loading),$.ajax({url:$(this).attr("href"),type:"GET",success:function(e){o.closest("#cboxLoadedContent").html(e)},error:function(){o.find(".pagination").html("== Error ==")}}),e.preventDefault(),!1)}),$.each(e.submit_on_changes||["#s_group"],function(){o.find(this).on("change",function(){return t.selectItems(o),o.find("form.search").submit()})}),o.find(".submit-on-change").on("change",function(){return t.selectItems(o),o.find("form.search").submit()}),t.anchorAjaxBox.closest("dl").find(".ajax-selected tr[data-id]").each(function(){var e,t,n;return e=$(this).data("id"),(n=$("#colorbox .items [data-id='"+e+"']")).find("input[type=checkbox]").remove(),t=n.find(".select-item,.select-single-item").html(),n.find(".select-item,.select-single-item").replaceWith("<span class='select-item' style='color: #888'>"+t+"</span>")}),o.find("table.index").each(function(){SS_ListUI.render(this)}),o.find("a.select-item").on("click",function(e){return SS.disableClick($(this))&&(t.select($(this)),t.anchorAjaxBox.closest("dl").find(".ajax-selected").show(),e.preventDefault(),n.close()),!1}),o.find(".select-single-item").on("click",function(e){return SS.disableClick($(this))&&(t.anchorAjaxBox.closest("dl").find(".ajax-selected tr[data-id]").each(function(){if($(this).find("input[value]").length)return $(this).remove()}),t.select($(this)),t.anchorAjaxBox.closest("dl").find(".ajax-selected").show(),e.preventDefault(),n.close()),!1}),o.find(".select-items").on("click",function(e){return SS.disableClick($(this))&&(t.selectItems(o),e.preventDefault(),n.close()),!1}),o.find(".index").on("change",function(){return t.toggleSelectButton(o)}),t.toggleSelectButton(o)},e}(),this.SS_ListUI=function(){function e(){}return e.render=function(e){var h;(h=e?$(e):$(document)).find(".list-head input:checkbox").change(function(){var e;return e=$(this).prop("checked"),h.find(".list-item").each(function(){return $(this).toggleClass("checked",e),$(this).find("input:checkbox").prop("checked",e)})}),h.find(".list-item").each(function(){var i;return(i=$(this)).find("input:checkbox").change(function(){return i.toggleClass("checked",$(this).prop("checked"))}),i.mouseup(function(e){var t,n,o,r;if(!$(
  e.target).is("a")&&!$(e.target).closest("a,label").length)return(t=i.find(".tap-menu")).hasClass("tap-menu-relative")?(n=$(this).offset(),o=e.pageX-n.left,r=e.pageY-n.top):(o=e.pageX,r=e.pageY),t.css("left",o-t.width()+5).css("top",r).show()}),i.mouseleave(function(){return h.find(".tap-menu").hide()})}),h.find(".list-head .destroy-all").on("click",function(){var e,t,n,o,r,i;if(i=$('meta[name="csrf-token"]').attr("content"),0===(e=h.find(".list-item input:checkbox:checked").map(function(){return $(this).val()})).length)return!1;if(!confirm("\u524a\u9664\u3057\u3066\u3088\u308d\u3057\u3044\u3067\u3059\u304b\uff1f"))return!1;for((t=$("<form/>",{action:"",method:"post"})).append($("<input/>",{name:"_method",value:"delete",type:"hidden"})),t.append($("<input/>",{name:"authenticity_token",value:i,type:"hidden"})),n=0,r=e.length;n<r;n++)o=e[n],t.append($("<input/>",{name:"ids[]",value:o,type:"hidden"}));return t.appendTo(document.body).submit()}),h.find(".list-head .set-tag-all").on("click",function(){var e,t,n,o,r,i,a;if(a=$('meta[name="csrf-token"]').attr("content"),e=h.find(".list-item input:checkbox:checked").map(function(){return $(this).val()}),i=h.find(".list-head .tag").val(),0===e.length)return!1;if(!i)return!1;if(!confirm("\u30bf\u30b0\u3092\u8a2d\u5b9a\u3057\u3066\u3088\u308d\u3057\u3044\u3067\u3059\u304b\uff1f"))return!1;for((t=$("<form/>",{action:"pages/tag",method:"post"})).append($("<input/>",{name:"authenticity_token",value:a,type:"hidden"})),t.append($("<input/>",{name:"tag",value:i,type:"hidden"})),n=0,r=e.length;n<r;n++)o=e[n],t.append($("<input/>",{name:"ids[]",value:o,type:"hidden"}));return t.appendTo(document.body).submit()}),h.find(".list-head .reset-tag-all").on("click",function(){var e,t,n,o,r,i,a;if(a=$('meta[name="csrf-token"]').attr("content"),e=h.find(".list-item input:checkbox:checked").map(function(){return $(this).val()}),i=h.find(".list-head .tag").val(),0===e.length)return!1;if(!i)return!1;if(!confirm("\u30bf\u30b0\u3092\u524a\u9664\u3057\u3066\u3088\u308d\u3057\u3044\u3067\u3059\u304b\uff1f"))return!1;for((t=$("<form/>",{action:"pages/tag",method:"post"})).append($("<input/>",{name:"_method",value:"delete",type:"hidden"})),t.append($("<input/>",{name:"authenticity_token",value:a,type:"hidden"})),t.append($("<input/>",{name:"tag",value:i,type:"hidden"})),n=0,r=e.length;n<r;n++)o=e[n],t.append($("<input/>",{name:"ids[]",value:o,type:"hidden"}));return t.appendTo(document.body).submit()}),h.find(".list-head [data-ss-list-head-method]").on("click",function(){var e,t,n,o,r,i,a,s,c,l,d;if(c=$(this).data("ss-list-head-method")||"post",e=$(this).data("ss-list-head-action")||"",l={authenticity_token:$('meta[name="csrf-token"]').attr("content")},"delete"!==(c=c.toString().toLowerCase())&&"patch"!==c||(l._method=c,c="post"),0===(t=h.find(".list-item input:checkbox:checked").map(function(){return $(this).val()})).length)return!1;if((n=$(this).data("ss-confirmation")||"")&&!confirm(n))return!1;for(a in o=$("<form/>",{action:e,method:c}),l)d=l[a],o.append($("<input/>",{name:a,value:d,type:"hidden"}));for(r=0,s=t.length;r<s;r++)i=t[r],o.append($("<input/>",{name:"ids[]",value:i,type:"hidden"}));return o.appendTo(document.body).submit()})},e}(),this.SS_TreeUI=function(){function l(e,t){var s;null==t&&(t={});var c=null;this.tree=$(e),s=[],c=t.expand_all,this.tree.find("tbody tr").each(function(){return s.push(parseInt($(this).attr("data-depth")))}),s=Math.min.apply(null,s),s=parseInt(s),isNaN(s)||s<0||(this.tree.find("tbody tr").each(function(){var e,t,n,o,r,i,a;for(a=$(this).find(".expandable"),t=parseInt($(this).attr("data-depth")),a.prepend('<img src="'+l.closeImagePath+'" alt="toggle" class="toggle closed">'),t!==s&&(c||$(this).hide()),n=o=r=s,i=t;r<=i?o<i:i<o;n=r<=i?++o:--o)a.prepend('<span class="padding">');if(e=parseInt($(this).next("tr").attr("data-depth"))||0,n=$(this).find(".toggle:first"),0===e||e<=t)return n.replaceWith('<span class="padding">')}),this.tree.find(".toggle").on("mousedown mouseup",function(e){return e.stopPropagation(),!1}),this.tree.find(".toggle").on("click",function(e){var n,t,o;return t=(o=$(this).closest("tr")).find(".toggle:first"),n=parseInt(o.attr("data-depth")),l.toggleImage(t),o.nextAll("tr").each(function(){var e,t;return e=parseInt($(this).attr("data-depth")),t=$(this).find(".toggle:first"),!(e<=n)&&(n+1===e?$(this).toggle():$(this).hide(),l.closeImage(t))}),e.stopPropagation(),!1}),c?l.openImage(this.tree.find("tbody tr img")):this.tree.find("tr[data-depth='"+s+"'] img").click())}return l.openImagePath="/assets/img/tree-open.png",l.closeImagePath="/assets/img/tree-close.png",l.render=function(e,t){return new l(e,t)},l.toggleImage=function(e){return e.attr("src")===l.openImagePath?l.closeImage(e):e.attr("src")===l.closeImagePath?l.openImage(e):void 0},l.openImage=function(e){return e.attr("src",l.openImagePath),e.addClass("opened"),e.removeClass("closed")},l.closeImage=function(e){return e.attr("src",l.closeImagePath),e.removeClass("opened"),e.addClass("closed")},l.prototype.expandAll=function(){return this.tree.find("tr img.toggle.closed").click()},l.prototype.collapseAll=function(){return $(this.tree.find("tr img.toggle.opened").get().reverse()).each(function(){return $(this).click()})},l}(),this.SS_Dropdown=function(){function t(e,t){this.elem=$(e),this.options=t,this.target=$(this.options.target),this.bindEvents()}return t.render=function(){return $("button.dropdown").each(function(){var e;if(e=new t(this,{target:$(this).parent().find(".dropdown-container")[0]}),!t.dropdown)return t.dropdown=e})},t.openDropdown=function(){if(t.dropdown)return t.dropdown.openDropdown()},t.closeDropdown=function(){if(t.dropdown)return t.dropdown.closeDropdown()},t.toggleDropdown=function(){if(t.dropdown)return t.dropdown.toggleDropdown()},t.prototype.bindEvents=function(){var t,n,o;return this.elem.on("click",(t=this,function(e){return t.toggleDropdown(),t.cancelEvent(e)})),$(document).on("click",(n=this,function(e){if(e.target!==n.elem&&e.target!==n.target)return n.closeDropdown()})),this.elem.on("keydown",(o=this,function(e){if(27===e.keyCode)return o.closeDropdown(),o.cancelEvent(e)}))},t.prototype.openDropdown=function(){return this.target.show()},t.prototype.closeDropdown=function(){return this.target.hide()},t.prototype.toggleDropdown=function(){return this.target.toggle()},t.prototype.cancelEvent=function(e){return e.preventDefault(),e.stopPropagation(),!1},t}(),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){return t<this.length?t|=0:t=this.length,this.substr(t-e.length,e.length)===e}),String.prototype.includes||(String.prototype.includes=function(e,t){return"number"!=typeof t&&(t=0),!(t+e.length>this.length)&&-1!==this.indexOf(e,t)}),String.prototype.padEnd||(String.prototype.padEnd=function(e,t){return e>>=0,t=String(t||" "),this.length>e?String(this):((e-=this.length)>t.length&&(t+=t.repeat(e/t.length)),String(this)+t.slice(0,e))}),String.prototype.padStart||(String.prototype.padStart=function(e,t){return e>>=0,t=String(t||" "),this.length>e?String(this):((e-=this.length)>t.length&&(t+=t.repeat(e/t.length)),t.slice(0,e)+String(this))}),String.prototype.repeat||(String.prototype.repeat=function(e){if(null==this)throw new TypeError("can't convert "+this+" to object");var t=""+this;if((e=+e)!=e&&(e=0),e<0)throw new RangeError("repeat count must be non-negative");if(e==1/0)throw new RangeError("repeat count must be less than infinity");if(e=Math.floor(e),0==t.length||0==e)return"";if(t.length*e>=1<<28)throw new RangeError("repeat count must not overflow maximum string size");for(var n="";1==(1&e)&&(n+=t),0!=(e>>>=1);)t+=t;return n}),String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}),SS_Preview=function(){function s(e){this.el=e,this.inplaceMode=!1,this.layouts=[],this.parts=[],this.editLock=new t(this)}function t(e){this.container=e,this.timerId=null}function n(e){this.container=e,this.$overlay=$("#ss-preview-overlay"),this.initPosition();var n=this;this.$overlay.on("click",".ss-preview-overlay-btn-edit",function(){var e=n.$overlay.data("mode")+":edit";n.$overlay.trigger(e,n.$overlay.data())}),this.$overlay.on("click",".ss-preview-overlay-btn-delete",function(){var e=n.$overlay.data("mode")+":delete";n.$overlay.trigger(e,n.$overlay.data())}),this.$overlay.on("click",".ss-preview-overlay-btn-move-up",function(){var e=n.$overlay.data("mode")+":moveUp";n.$overlay.trigger(e,n.$overlay.data())}),this.$overlay.on("click",".ss-preview-overlay-btn-move-down",function(){var e=n.$overlay.data("mode")+":moveDown";n.$overlay.trigger(e,n.$overlay.data())}),this.$overlay.on("change",".ss-preview-overlay-btn-move-position",function(){var e=n.$overlay.data("mode")+":movePosition",t=parseInt($(this).val(),10);n.$overlay.trigger(e,[n.$overlay.data(),t])}),this.on=this.$overlay.on.bind(this.$overlay),this.off=this.$overlay.off.bind(this.$overlay)}function r(e,t){this.container=e,this.$el=t;var n=this;this.$el.on("load",function(){n.initializeFrame()})}function a(e){this.container=e,this.$el=this.container.$el.find(".ss-preview-notice-wrap"),this.timerId=null}return s.libs={jquery:{isInstalled:function(){return!!window.jQuery},js:null,css:null},datetimePicker:{isInstalled:function(){return!!$.datetimepicker},js:null,css:null},colorbox:{isInstalled:function(){return!!$.colorbox},js:null,css:null},dialog:{isInstalled:function(){return $.ui&&$.ui.dialog},js:null,css:null}},s.confirms={"delete":null,publish:null},s.notices={deleted:null,published:null,moved:null},s.item={},s.preview_path="",s.mobile_path="/mobile",s.request_path=null,s.form_item=null,s.overlayPadding=0,s.previewToolHeight=70,s.inplaceFormPath={page:null,columnValue:{},palette:null},s.workflowPath={wizard:null,pages:null},s.redirectorPath={newPage:null},s.publishPath=null,s.lockPath=null,s.refreshLockInterval=12e4,s.instance=null,s.minFrameSize={width:320,height:150},s.initialFrameSize={width:960,height:240},s.initialApproverSize={width:s.initialFrameSize.width,height:480},s.jqueryDialogMargin={height:60},s.pageTitle="\u672c\u6587",s.userInplaceEdit=!0,s.render=function(e){s.instance||(s.instance=new s("#ss-preview"),s.loadJQuery(function(){$.when(s.lazyLoad(s.libs.datetimePicker),s.lazyLoad(s.libs.colorbox),s.lazyLoad(s.libs.dialog)).done(function(){s.instance.initialize(e)})}))},s.loadJQuery=function(e){if(window.jQuery)e();else{var t=document.createElement("link");t.rel="stylesheet",t.href=s.libs.jquery.css;var n=document.createElement("script");n.type="text/javascript",n.src=s.libs.jquery.js,n.readyState||(n.onload=function(){e()}),document.getElementsByTagName("head")[0].appendChild(t),document.getElementsByTagName("head")[0].appendChild(n)}},s.lazyLoad=function(e){var t,n,o=$.Deferred();return e.isInstalled()?o.resolve():(e.css&&((t=document.createElement("link")).rel="stylesheet",t.href=e.css),e.js&&((n=document.createElement("script")).type="text/javascript",n.src=e.js),t&&document.getElementsByTagName("head")[0].appendChild(t),n?(n.readyState?o.resolve():n.onload=function(){o.resolve()},document.getElementsByTagName("head")[0].appendChild(n)):o.resolve()),o.promise()},s.notice=function(e){s.instance&&s.instance.notice&&s.instance.notice.show(e)},s.bindToWorkflowCommentForm=function(e){s.instance&&s.instance.bindToWorkflowCommentForm(e)},s.prototype.initialize=function(e){this.$el=$(this.el),this.$datePicker=this.$el.find(".ss-preview-date"),this.$datePicker.datetimepicker({lang:"ja",roundTime:"ceil",step:30,closeOnDateSelect:!0});var o=this;this.initializePart(),this.initializeLayout(),this.initializePage(),this.initializeColumn(),this.$el.on("click","#ss-preview-btn-workflow-start",function(){o.openWorkflowApprove()}),this.$el.on("click","#ss-preview-btn-workflow-approve",function(){o.openWorkflowComment("approve")}),this.$el.on("click","#ss-preview-btn-workflow-remand",function(){o.openWorkflowComment("remand")}),this.$el.on("click","#ss-preview-btn-workflow-pull-up",function(){o.openWorkflowComment("pull-up")}),this.$el.on("click","#ss-preview-btn-publish",function(){o.publish()}),this.overlay=new n(this),this.overlay.on("part:edit",function(e,t){o.openPartEdit(t.id)}),this.overlay.on("page:edit",function(e,t){o.openPageEdit(t.id)}),this.overlay.on("column:edit",function(e,t){o.openColumnEdit(t.id)}),this.overlay.on("column:delete",function(e,t){o.postColumnDelete(t.id)}),this.overlay.on("column:moveUp",function(e,t){o.postColumnMoveUp(t.id)}),this.overlay.on("column:moveDown",function(e,t){o.postColumnMoveDown(t.id)}),this.overlay.on("column:movePosition",function(e,t,n){o.postColumnMovePosition(t.id,n)});var t=$("#ss-preview-form-end");t[0]&&(this.formPalette=r.createBefore(this,t[0])),this.$el.on("click",".ss-preview-btn-toggle-inplace",function(){var e=o.inplaceMode;o.toggleInplaceMode().always(function(){e!==o.inplaceMode&&window.history.pushState&&(o.inplaceMode?window.history.pushState(null,null,window.location.pathname+"#inplace"):window.history.pushState(null,null,window.location.pathname))})}),$(document).on("click",".ss-preview-btn-open-path",function(){var e=$(this).data("path");e&&window.open(e,"_blank")});var i=this.$el.find("#ss-preview-btn-select-node");i.colorbox({iframe:!0,fixed:!0,width:"90%",height:"90%"}).data("on-select",function(e){var t=e.closest("[data-id]"),n=t.data("id"),o=t.find(".name").text(),r=i.closest("[data-node-id]");s.setData(r,"node-id",n),r.find("label").html(o)}),this.$el.find("#ss-preview-btn-create-new-page").on("click",function(){var e=i.closest("[data-node-id]").data("node-id");window.open(s.redirectorPath.newPage.replace(":nodeId",e))}),this.$el.find("#ss-preview-btn-select-draft-page").colorbox({iframe:!0,fixed:!0,width:"90%",height:"90%"}).data("on-select",function(e){var t=e.closest("[data-id]").find(".filename").text(),n=s.previewPath.replace(":path",t);"#inplace"===window.location.hash&&(n+="#inplace"),window.location.href=n}),this.$el.on("click",".ss-preview-btn-pc",function(){o.previewPc()}),this.$el.on("click",".ss-preview-btn-mobile",function(){o.previewMobile()}),s.request_path&&$('body a [href="#"]').val("onclick","return false;"),window.history.pushState&&window.addEventListener("popstate",function(){"#inplace"===window.location.hash?o.startInplaceMode():o.stopInplaceMode()}),"#inplace"===window.location.hash&&this.startInplaceMode(),this.notice=new a(this),e.notice&&this.notice.show(e.notice)},s.prototype.initializeLayout=function(){var e=$("body");e.data("layout-id")&&(this.layouts=[{id:e.data("layout-id"),name:e.data("layout-name"),filename:e.data("layout-filename"),path:e.data("layout-path")}]);var t=this.$el.find(".ss-preview-btn-edit-layout");if(this.layouts&&0!==this.layouts.length){t.closest(".ss-preview-btn-group").removeClass("ss-preview-hide");var n=this.layouts[0].path;t.on("click",function(){window.open(n,"_blank")})}else t.closest(".ss-preview-btn-group").addClass("ss-preview-hide")},s.prototype.initializePage=function(){var e=this;$(document).on("mouseover",".ss-preview-page",function(){e.inplaceMode&&e.overlay.showForPage($(this))})},s.prototype.adjustDialogSize=function(e){var t=e.contentWindow.document.body.scrollWidth,n=e.contentWindow.document.body.scrollHeight;$(e).closest(".ui-dialog")[0]&&(n+=s.jqueryDialogMargin.height),t<s.initialFrameSize.width&&(t=s.initialFrameSize.width),n<s.initialFrameSize.height&&(n=s.initialFrameSize.height);var o=Math.floor(.9*window.innerWidth),r=Math.floor(.9*window.innerHeight);o<t&&(t=o),r<n&&(n=r),$(e).closest("#cboxLoadedContent")[0]&&$.colorbox.resize({width:t,height:n}),$(e).closest(".ui-dialog")[0]&&$(e).dialog("option","width",t).dialog("option","height",n).css("display","").css("width","")},s.prototype.initializeFrame=function(r){var i=r.contentWindow.document.querySelector("#item-form");if(i){this.adjustDialogSize(r);var a=this;a.saveIfNoAlerts=!1,a.ignoreAlertsAndSave=!1,i.addEventListener("click",function(e){var t=e.target;return"BUTTON"===t.tagName&&t.classList.contains("btn-cancel")&&($(r).closest("#cboxLoadedContent")[0]&&$.colorbox.close(),$(r).closest(".ui-dialog")[0]&&$(r).dialog("close")),"INPUT"===t.tagName&&"save_if_no_alerts"===t.name&&(a.saveIfNoAlerts=!0),"INPUT"===t.tagName&&"ignore_alerts_and_save"===t.name&&(a.ignoreAlertsAndSave=!0),!0}),i.onsubmit=function(e){var t=r.contentWindow.Cms_Form.getFormData(r.contentWindow.$(i),{preserveMethod:!0});a.saveIfNoAlerts&&t.append("save_if_no_alerts","button"),a.ignoreAlertsAndSave&&t.append("ignore_alerts_and_save","button");var n=i.getAttribute("action"),o=i.getAttribute("method")||"POST";return $.ajax({url:n,type:o,data:t,processData:!1,contentType:!1,cache:!1,success:function(e){$.colorbox.close(),"string"==typeof e?location.reload():e&&e.location?location.href=e.location:location.reload()},error:function(e){var t=$(e.responseText).find("#item-form");i.innerHTML=t.html(),a.adjustDialogSize(r)}}),a.saveIfNoAlerts=!1,a.ignoreAlertsAndSave=!1,e.preventDefault(),!1},r.contentWindow.CKEDITOR&&r.contentWindow.CKEDITOR.on("instanceReady",function(e){a.adjustRichEditorHeight(e.editor)})}},s.prototype.openDialogInFrame=function(e){var t=this,n=$("<iframe></iframe>",{id:"ss-preview-dialog-frame",frameborder:"0",allowfullscreen:!0,src:e});n[0].onload=function(){t.initializeFrame(n[0])},n.dialog({autoOpen:!0,width:s.initialFrameSize.width,height:s.initialFrameSize.height,minWidth:s.minFrameSize.width,minHeight:s.minFrameSize.height,closeOnEscape:!1,dialogClass:"ss-preview-dialog ss-preview-dialog-column",draggable:!0,modal:!0,resizable:!0,close:function(){$(this).dialog("destroy").remove()}})},s.prototype.openDialog=function(e,n){var i=this;n||(n={}),$.ajax({url:e,type:"GET",success:function(e){var t=$("div#ss-preview-dialog-frame");t[0]||(t=$("<div></div>",{id:"ss-preview-dialog-frame"})),t.html(e),t.dialog({autoOpen:!0,width:n.width||s.initialFrameSize.width,height:n.height||s.initialFrameSize.height,minWidth:n.minWidth||s.minFrameSize.width,minHeight:n.minHeight||s.minFrameSize.height,closeOnEscape:!1,dialogClass:"ss-preview-dialog ss-preview-dialog-column",draggable:!0,modal:!0,resizable:!0,close:function(){$(this).dialog("destroy").remove()}})},error:function(e,t,n){try{var o=e.responseJSON.join("\n");i.notice.show(o)}catch(r){i.notice.show("Error: "+n)}}})},s.prototype.adjustRichEditorHeight=function(e){if("ready"===e.status){var t=$(e.element.$).parent().height();(t-=40)<50&&(t=50),e.resize("100%",t.toString())}},s.prototype.openPageEdit=function(e){var t=s.inplaceFormPath.page.replace(":id",e);this.openDialogInFrame(t)},s.prototype.initializePart=function(){var t=this;if(this.parts=[],$(document).find(".ss-preview-part").each(function(){var e=$(this);e.data("part-id")&&t.parts.push({el:e,id:e.data("part-id"),name:e.data("part-name"),filename:e.data("part-filename"),path:e.data("part-path")})}),this.parts&&0!==this.parts.length){var e=this.$el.find(".ss-preview-part-list"),n=e.html();$.each(this.parts,function(e,t){n+='<option value="'+t.id+'">'+t.name+"</option>"}),e.html(n).on("change",function(){t.changePart($(this))}),this.$el.on("click",".ss-preview-btn-edit-part",function(){t.openPartEdit(e.val())}),this.$el.find(".ss-preview-part-group").removeClass("ss-preview-hide"),$(document).on("mouseover",".ss-preview-part",function(){t.inplaceMode&&t.overlay.showForPart($(this))})}else this.$el.find(".ss-preview-part-group").addClass("ss-preview-hide")},s.prototype.findPartById=function(t){if(!t)return null;"string"===$.type(t)&&(t=parseInt(t));var e=$.grep(this.parts,function(e){return e.id===t});return e&&0!==e.length?e[0]:null},s.prototype.initializeColumn=function(){var e=this;$(document).on("mouseover",".ss-preview-column",function(){e.inplaceMode&&e.overlay.showForColumn($(this))})},s.prototype.openColumnEdit=function(e){var t=s.inplaceFormPath.columnValue.edit.replace(":pageId",e.pageId).replace(":id",e.columnId);this.openDialogInFrame(t)},s.prototype.postColumnDelete=function(n){if(confirm(s.confirms["delete"])){var i=this,e=s.inplaceFormPath.columnValue.destroy.replace(":pageId",n.pageId).replace(":id",n.columnId),t=$('meta[name="csrf-token"]').attr("content");$.ajax({url:e,type:"POST",data:{_method:"DELETE",authenticity_token:t},success:function(e){if(i.overlay.hide(),e&&e.location)location.href=e.location;else{var t=$(document).find(".ss-preview-column[data-page-id='"+n.pageId+"'][data-column-id='"+n.columnId+"']");t.fadeOut("fast",function(){t.remove(),i.notice.show(s.notices.deleted)})}},error:function(e,t,n){try{var o=e.responseJSON.join("\n");i.notice.show(o)}catch(r){i.notice.show("Error: "+n)}}})}},s.prototype.postColumnMoveUp=function(t){var i=this,e=s.inplaceFormPath.columnValue.moveUp.replace(":pageId",t.pageId).replace(":id",t.columnId),n=$('meta[name="csrf-token"]').attr("content");$.ajax({url:e,type:"POST",data:{authenticity_token:n},success:function(e){i.overlay.hide(),e.location?location.href=e.location:(i.finishColumnMoveUp(t,e),i.notice.show(s.notices.moved))},error:function(e,t,n){try{var o=e.responseJSON.join("\n");i.notice.show(o)}catch(r){i.notice.show("Error: "+n)}}})},s.camelize=function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,function(e,t){return 0==t?e.toLowerCase():e.toUpperCase()}).replace(/[\s-]+/g,"")},s.setData=function(e,t,n){e.data(t,n);var o=s.camelize(t);e.each(function(){this.dataset[o]=n})},s.prototype.finishColumnMoveUp=function(e,t){this.overlay.hide();var n=$(document).find(".ss-preview-column[data-page-id='"+e.pageId+"'][data-column-id='"+e.columnId+"']");if(n[0]){var o=n.prev(".ss-preview-column[data-page-id='"+e.pageId+"']");o[0]&&Cms_TemplateForm.swapElement(o,n,function(){s.setData(o,"column-order",t[o.data("column-id")]),s.setData(n,"column-order",t[n.data("column-id")]),n.after(o)})}},s.prototype.postColumnMoveDown=function(t){var i=this,e=s.inplaceFormPath.columnValue.moveDown.replace(":pageId",t.pageId).replace(":id",t.columnId),n=$('meta[name="csrf-token"]').attr("content");$.ajax({url:e,type:"POST",data:{authenticity_token:n},success:function(e){i.overlay.hide(),e.location?location.href=e.location:(i.finishColumnMoveDown(t,e),i.notice.show(s.notices.moved))},error:function(e,t,n){try{var o=e.responseJSON.join("\n");i.notice.show(o)}catch(r){i.notice.show("Error: "+n)}}})},s.prototype.finishColumnMoveDown=function(e,t){this.overlay.hide();var n=$(document).find(".ss-preview-column[data-page-id='"+e.pageId+"'][data-column-id='"+e.columnId+"']");if(n[0]){var o=n.next(".ss-preview-column[data-page-id='"+e.pageId+"']");o[0]&&Cms_TemplateForm.swapElement(n,o,function(){s.setData(o,"column-order",t[o.data("column-id")]),s.setData(n,"column-order",t[n.data("column-id")]),n.before(o)})}},s.prototype.postColumnMovePosition=function(t,n){var i=this,e=s.inplaceFormPath.columnValue.moveAt.replace(":pageId",t.pageId).replace(":id",t.columnId),o=$('meta[name="csrf-token"]').attr("content");$.ajax({url:e,type:"POST",data:{authenticity_token:o,order:n},success:function(e){e.location?location.href=e.location:(i.finishColumnMovePosition(t,n,e),i.notice.show(s.notices.moved))},error:function(e,t,n){try{var o=e.responseJSON.join("\n");i.notice.show(o)}catch(r){i.notice.show("Error: "+n)}}})},s.prototype.finishColumnMovePosition=function(e,t,n){this.overlay.hide();var o=$(document).find(".ss-preview-column[data-page-id='"+e.pageId+"'][data-column-id='"+e.columnId+"']");if(o[0]){var r=o.data("column-order"),i=$(document).find(".ss-preview-column[data-page-id='"+e.pageId+"'][data-column-order='"+t+"']");i[0]&&Cms_TemplateForm.insertElement(o,i,function(){$(document).find(".ss-preview-column[data-page-id='"+e.pageId+"']").each(function(){var e=$(this);s.setData(e,"column-order",n[e.data("column-id")])}),t<r?i.before(o):i.after(o)})}},s.prototype.previewPc=function(){var e=this.dateForPreview();if(e){var t=s.request_path||location.pathname;t=t.replace(RegExp("\\/preview\\d*("+s.mobile_path+"|"+s.preview_path+")?"),"/preview"+e+s.preview_path)+location.search,s.request_path?this.submitFormPreview(t,s.form_item):location.href=t}},s.prototype.previewMobile=function(){var e=this.dateForPreview();if(e){var t=s.request_path||location.pathname;t=t.replace(RegExp("\\/preview\\d*("+s.mobile_path+"|"+s.preview_path+")?"),"/preview"+e+s.mobile_path)+location.search,s.request_path?this.submitFormPreview(t,s.form_item):location.href=t}},s.prototype.dateForPreview=function(){var e=this.$datePicker.val();if(e)return e.replace(/[^\d]/g,"")},s.prototype.submitFormPreview=function(e,t){var n=$('meta[name="csrf-token"]').attr("content"),o=$("<form>").attr("method","post").attr("action",e);s.appendParams(o,"preview_item",t),o.append($("<input/>",{name:"authenticity_token",value:n,type:"hidden"})),o.appendTo("body"),o.submit()},s.prototype.changePart=function(e){var t=this.findPartById(e.val());t?(this.overlay.showForPart(t.el),this.scrollToPart(t.el)):this.overlay.hide()},s.prototype.scrollToPart=function(e){var t=e.offset().top-s.previewToolHeight;t<0&&(t=0),window.scrollTo({top:t,behavior:"smooth"})},s.prototype.openPartEdit=function(e){var t=this.findPartById(e);t&&window.open(t.path,"_blank")},s.prototype.openWorkflowApprove=function(){var e=s.workflowPath.wizard.replace(":id",s.item.pageId)+"/frame";this.openDialog(e,{width:s.initialApproverSize.width,height:s.initialApproverSize.height})},s.prototype.openWorkflowComment=function(e){var t=s.workflowPath.wizard.replace(":id",s.item.pageId)+"/comment?update_type="+e;this.openDialog(t,{width:s.initialApproverSize.width,height:s.initialApproverSize.height})},s.prototype.bindToWorkflowCommentForm=function(o){var i=this,r=$("#ss-preview-dialog-frame");r.on("click","input[type=submit]",function(){var e=r.find("textarea[name=comment]").prop("value"),t=o+"_update",n=s.workflowPath.pages.replace(":id",s.item.pageId);n+="/"+t,$.ajax({type:"POST",url:n,data:{remand_comment:e,url:s.request_path,forced_update_option:!0},success:function(e){e.workflow_alert?i.notice.show(e.workflow_alert):e.redirect.reload?location.reload():e.redirect.url?location.href=s.previewPath.replace(":path",e.redirect.url.slice(1)):location.reload()},error:function(e,t,n){try{var o=e.responseJSON.join("\n");i.notice.show(o)}catch(r){i.notice.show("Error: "+n)}},complete:function(){r.dialog("close")}})}),r.on("click","button[type=reset]",function(){r.dialog("close")})},s.prototype.publish=function(){if(confirm(s.confirms.publish)){var i=this,e=s.publishPath,t=$('meta[name="csrf-token"]').attr("content");$.ajax({url:e,type:"POST",data:{authenticity_token:t},success:function(e){(i.overlay.hide(),e&&e.location)?location.href=e.location:(i.notice.show(s.notices.published),i.$el.find("#ss-preview-btn-publish").closest(".ss-preview-btn-group").remove())},error:function(e,t,n){try{var o=e.responseJSON.join("\n");i.notice.show(o)}catch(r){i.notice.show("Error: "+n)}}})}},t.prototype.acquire=function(){if(!s.lockPath)return $.Deferred().resolve().promise();var o=this,e=s.lockPath,t=$('meta[name="csrf-token"]').attr("content");return $.ajax({url:e,type:"POST",dataType:"json",cache:!1,data:{authenticity_token:t}}).done(function(){o.bindBeforeUnloadOnce()}).fail(function(e,t,n){o.container.notice&&(e.responseJSON?o.container.notice.show(e.responseJSON.join("\n")):o.container.notice.show(n))})},t.prototype.release=function(){if(!s.lockPath)return $.Deferred().resolve().promise();var o=this,e=s.lockPath,t=$('meta[name="csrf-token"]').attr("content");return $.ajax({url:e,type:"POST",dataType:"json",cache:!1,data:{_method:"delete",authenticity_token:t}}).fail(function(e,t,n){o.container.notice&&(e.responseJSON?o.container.notice.show(e.responseJSON.join("\n")):o.container.notice.show(n))})},t.prototype.startRefreshLoop=function(e){var t=this;t.timerId||(t.timerId=setTimeout(function(){t.acquire().fail(e),t.startRefreshLoop()},s.refreshLockInterval))},t.prototype.stopRefreshLoop=function(){this.timerId&&clearTimeout(this.timerId),this.timerId=null},t.prototype.bindBeforeUnloadOnce=function(){var e=this;$(window).on("beforeunload",function(){e.release()}),this.bindBeforeUnloadOnce=function(){}},s.prototype.toggleInplaceMode=function(){return this.inplaceMode?this.stopInplaceMode():this.startInplaceMode()},s.prototype.startInplaceMode=function(){if(!s.userInplaceEdit)return $.Deferred().resolve().promise();if(!this.inplaceMode){var e=this;return this.editLock.acquire().done(function(){e.inplaceMode=!0,e.$el.find(".ss-preview-btn-toggle-inplace").addClass("ss-preview-active"),$("#ss-preview-notice").addClass("ss-preview-hide"),e.formPalette&&e.formPalette.show(),$("a[href]").each(function(){var e=$(this),t=e.attr("href");t&&t.startsWith("/")&&(t.includes("#")||e.attr("href",t+"#inplace"))}),e.editLock.startRefreshLoop(function(){e.stopInplaceMode(!0)}),window.location.hash="#inplace"})}},s.prototype.stopInplaceMode=function(e){if(this.inplaceMode){var t=this,n=function(){t.editLock.stopRefreshLoop(),t.$el.find(".ss-preview-btn-toggle-inplace").removeClass("ss-preview-active"),t.overlay.hide(),t.formPalette&&t.formPalette.hide(),$("a[href]").each(function(){var e=$(this),t=e.attr("href");t&&t.startsWith("/")&&e.attr("href",t.replace("#inplace",""))}),t.inplaceMode=!1,window.location.hash=""};return e?(n(),$.Deferred().resolve().promise()):this.editLock.release().always(n)}},s.prototype.showError=function(e){var t=[];$.each(e,function(){t.push("<li>"+this+"</li>")}),$("#ss-preview-error-explanation ul").html(t.join()),$("#ss-preview-error-explanation").removeClass("ss-preview-hide"),$("#ss-preview-messages").removeClass("ss-preview-hide")},s.prototype.clearError=function(){$("#ss-preview-error-explanation ul").html(""),$("#ss-preview-error-explanation").addClass("ss-preview-hide"),$("#ss-preview-messages").addClass("ss-preview-hide")},s.appendParams=function(e,t,n){var o,r,i;for(o in n.length<=0&&e.append($("<input/>",{name:t+"[]",value:"",type:"hidden"})),r=[],n)i=n[o],o.match(/^\d+$/)&&(o=""),"object"==typeof i?r.push(s.appendParams(e,t+"["+o+"]",i)):r.push(e.append($("<input/>",{name:t+"["+o+"]",value:i,type:"hidden"})));return r},n.prototype.initPosition=function(){var e=this.$overlay.find(".ss-preview-overlay-btn-move-position");if(e[0]){var t=[];$(document).find(".ss-preview-column[data-column-order]").each(function(){var e=parseInt(this.dataset.columnOrder,10);t.push('<option value="'+e+'">'+(e+1)+"</option>")}),e.html(t.join(""))}},n.prototype.hide=function(){this.$overlay.addClass("ss-preview-hide")},n.prototype.showForPage=function(e){var t=e[0].getBoundingClientRect();t&&(this.moveTo(t),this.setInfo({mode:"page",id:e.data("page-id"),name:s.pageTitle}),this.$overlay.find(".ss-preview-overlay-btn-group-move").addClass("ss-preview-hide"),this.$overlay.find(".ss-preview-overlay-btn-group-delete").addClass("ss-preview-hide"),this.$overlay.removeClass("ss-preview-hide"))},n.prototype.showForColumn=function(e){var t=e[0].getBoundingClientRect();if(t){if(this.moveTo(t),this.setInfo({mode:"column",id:{pageId:e.data("page-id"),columnId:e.data("column-id")},name:e.data("column-name")}),"entry"===s.item.formSubType)this.$overlay.find(".ss-preview-overlay-btn-group-move").removeClass("ss-preview-hide"),this.$overlay.find(".ss-preview-overlay-btn-group-delete").removeClass("ss-preview-hide"),this.$overlay.find(".ss-preview-overlay-btn-move-position").val(e.data("column-order"));else this.$overlay.find(".ss-preview-overlay-btn-group-move").addClass("ss-preview-hide"),this.$overlay.find(".ss-preview-overlay-btn-group-delete").addClass("ss-preview-hide");this.$overlay.removeClass("ss-preview-hide")}},n.prototype.showForPart=function(e){var t=this.container.findPartById(e.data("part-id"));if(t){var n=e[0].getBoundingClientRect();n&&(this.moveTo(n),this.setInfo({mode:"part",id:t.id,name:t.name}),this.$overlay.find(".ss-preview-overlay-btn-group-move").addClass("ss-preview-hide"),this.$overlay.find(".ss-preview-overlay-btn-group-delete").addClass("ss-preview-hide"),this.$overlay.removeClass("ss-preview-hide"))}},n.prototype.moveTo=function(e){var t=window.pageYOffset||document.documentElement.scrollTop,n=window.pageXOffset||document.documentElement.scrollLeft,o=Math.floor(e.top+t)-s.overlayPadding,r=Math.floor(e.left+n)-s.overlayPadding,i=e.width+2*s.overlayPadding,a=e.height+2*s.overlayPadding;this.$overlay[0].style.top=o+"px",this.$overlay[0].style.left=r+"px",this.$overlay[0].style.width=i+"px",this.$overlay[0].style.height=a+"px"},n.prototype.setInfo=function(e){s.setData(this.$overlay,"mode",e.mode),s.setData(this.$overlay,"id",e.id),e.name?this.$overlay.find(".ss-preview-overlay-name").text(e.name).removeClass("ss-preview-hide"):this.$overlay.find(".ss-preview-overlay-name").text("").addClass("ss-preview-hide")},r.margin={height:20},r.createBefore=function(
  e,t){var n=t.dataset.formId;if(!n)return null;if("entry"!==t.dataset.formSubType)return null;var o=$("<iframe />",{id:"ss-preview-form-palette","class":"ss-preview-hide",frameborder:"0",scrolling:"no",src:s.inplaceFormPath.palette.replace(":id",n)});return $(t).before(o),new r(e,o)},r.prototype.initializeFrame=function(){this.adjustHeight();var e=this.$el[0],o=this;e.contentWindow.addEventListener("resize",function(){o.delayAdjustHeight()}),e.contentWindow.document.addEventListener("click",function(e){var t=e.target;if("BUTTON"===t.tagName&&t.dataset.formId&&t.dataset.columnId)o.clickPalette(t);else{var n=$(t).closest("button[data-form-id]")[0];n&&n.dataset.formId&&n.dataset.columnId&&o.clickPalette(n)}})},r.prototype.delayAdjustHeight=function(){0<this.timer&&clearTimeout(this.timer);var e=this;this.timer=setTimeout(function(){e.adjustHeight(),e.timer=0},100)},r.prototype.adjustHeight=function(){var e=this.$el[0];if(e){var t=e.contentWindow.document.body.scrollHeight+r.margin;e.style.height=t+"px"}},r.prototype.show=function(){this.$el.removeClass("ss-preview-hide"),this.delayAdjustHeight()},r.prototype.hide=function(){this.$el.addClass("ss-preview-hide")},r.prototype.clickPalette=function(e){var t=e.dataset.formId,n=e.dataset.columnId;if(t&&n){var o=s.inplaceFormPath.columnValue["new"].replace(":pageId",s.item.pageId).replace(":columnId",n);this.container.openDialogInFrame(o)}},a.speed="normal",a.holdInMillis=1800,a.prototype.show=function(e){this.hide();var t=this;this.$el.html(e).slideDown(a.speed,function(){t.noticeShown()})},a.prototype.hide=function(){this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.$el.hide(),this.$el.html("")},a.prototype.noticeShown=function(){var e=this;this.timerId=setTimeout(function(){e.$el.slideUp(a.speed),e.timerId=null},a.holdInMillis)},s}();